Package com.nexirius.util

Examples of com.nexirius.util.StringVector


            DialogManager.error("CannotRead{0}", fileName);

            return null;
        }

        StringVector sv;

        try {
            sv = new StringVector();
            BufferedInputStream in = file.getBufferedInputStream();
            ByteArrayOutputStream line = new ByteArrayOutputStream(102400);

            int oldc = 0;

            while (true) {
                int c = in.read();

                if (c < 0) {
                    break;
                }

                if (c == '\n' && oldc != '\r') {
                    //String s = line.toString("ISO-8859-1");
                    String s = line.toString("Cp1252");
                    //String str = new String(bytes, "ISO-8859-1");
                    sv.append(s);
                    line.reset();
                } else {
                    line.write(c);
                }

                oldc = c;
            }

        } catch (Exception e) {
            DialogManager.error(e.getMessage());

            return null;
        }

        ArrayModel arr = null;
        String[] columnNames = null;

        for (String line = sv.firstItem(); line != null; line = sv.nextItem()) {

            StringVector tokens = new StringVector(line, ';', false);

            if (tokens.size() < 2) {
                continue;
            }

            StructModel s = new StructModel("A");
            if (columnNames == null) {
                StringVector columnNamesVector = null;

                columnNamesVector = tokens;

                columnNames = new String[tokens.size()];

                int i = 0;
                for (i = 0; i < columnNames.length; ++i) {
                    if (columnNamesVector != null && i < columnNamesVector.size()) {
                        columnNames[i] = columnNamesVector.getItem(i);
                    } else {
                        columnNames[i] = Integer.toString(i);
                    }

                    s.append(new StringModel("", columnNames[i]));
View Full Code Here


    private void init() {
        MailModel mailModel = new MailModel();

        DataModelEnumeration en = mailModel.getChildren().getEnumeration();

        fields = new StringVector();

        while (en.hasMore()) {
            DataModel model = en.next();

            fields.sortInsert(model.getFieldName());
View Full Code Here

//        removeDoubleQuotes = new BooleanModel(true, FIELD_removeDoubleQuotes);
//        append(removeDoubleQuotes);
    }

    public void setMaxAttributes(int maxFields) {
        StringVector sv = new StringVector();

        for (int i = 0; i < maxFields; ++i) {
            sv.append("field_" + i);
        }

        SimpleArrayModel fieldAttributes = new SimpleArrayModel(sv.getArray());
        for (int i = 0; i < MailModel.MAIL_FIELDS.length; i++) {
            String attribute = MailModel.MAIL_FIELDS[i];

            append(new ComboBoxModel(i, fieldAttributes, attribute));
        }
View Full Code Here

                if (x < 0) {
                    return model;
                }

                FieldName fieldName = fields.getFieldName(x);
                StringVector sv = new StringVector();

                while (fieldName != null) {
                    sv.insertElementAt(fieldName.toString(), 0);
                    fieldName = fieldName.getParent();
                }

                sv.removeElementAt(0);

                String names[] = sv.getArray();

                return model.getChild(names);
            } catch (Exception ex) {
                ex.printStackTrace();
View Full Code Here

     *
     * @param childName
     */
    public void addSelectedChild(String childName) {
        if (selectedChildren == null) {
            selectedChildren = new StringVector();
        }
        FWLog.debug("add " + childName);
        selectedChildren.append(childName);
    }
View Full Code Here

        public void dataModelEdit(DataModelEvent ev) {
        }
    }

    public void updateHighlight() {
        StringVector fieldNames = new StringVector();
        StringVector fieldValues = new StringVector();

        DataModelEnumeration e = model.getEnumeration();

        while (e.hasMore()) {
            DataModel child = e.next();
            String fieldName = child.getFieldName();
            String fieldValue = model.getChildText(fieldName);

            if (fieldValue != null && fieldValue.length() > 0) {
                fieldNames.append(fieldName);
                fieldValues.append(fieldValue);
            }
        }

        boolean found = false;
        int i = 0;

        if (fieldNames.size() > 0) {
            e = selectionArray.getEnumeration();

            while (e.hasMore()) {
                DataModel item = e.next();
                String fieldValue = fieldValues.firstItem();
                boolean hit = true;

                for (String fieldName = fieldNames.firstItem(); fieldName != null; fieldName = fieldNames.nextItem()) {

                    if (!item.getChildText(fieldName).startsWith(fieldValue)) {
                        hit = false;
                        break;
                    }

                    fieldValue = fieldValues.nextItem();
                }

                if (hit) {
                    found = true;
                    break;
View Full Code Here

            if (codes == null) {
                throw new RuntimeException(CURRENCY_CODES + " must be defined in the resources (comma separated list)");
            }

            StringVector codesVector = new StringVector(codes, ", \t");

            currencyCodes = new SimpleArrayModel(codesVector.getArray(), CURRENCY_CODES);
        }

        return currencyCodes;
    }
View Full Code Here

        return ret;
    }

    public StringVector getVariableNames() {
        StringVector ret = new StringVector();
        Enumeration enumeration = variableTable.keys();

        while (enumeration.hasMoreElements()) {
            String s = (String) enumeration.nextElement();
            ret.sortInsert(s);
        }

        return ret;
    }
View Full Code Here

                } catch (InterruptedException ex) {
                    return;
                }

                TextSelector textSelector = getTextSelector();
                StringVector tipText = new StringVector();

                boolean hasMore = textSelector.getCompletionListFor(text, tipText);

                if (isInterrupted() || this != thread) {
                    return;
                }

                if (tipText.size() == 1 && text.equals(tipText.firstItem())) {
                    removeTip();
                } else {
                    setTip(tipText, hasMore);
                }
            }
View Full Code Here

     */
    public void create() {

        if (getModel() instanceof LimitIntModel) {
            if (!((LimitIntModel) getModel()).getObjectList().hasList()) {
                setVector(new StringVector("...", ""));
            }

            ObjectList list = ((LimitIntModel) getModel()).getObjectList();

            JPanel box = new JPanel(new ArrayLayout(horizontal, ArrayLayout.FULL_SIZE));
View Full Code Here

TOP

Related Classes of com.nexirius.util.StringVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.