Package org.jitterbit.integration.data.structure.text

Examples of org.jitterbit.integration.data.structure.text.Segment


        buttons.add(3, new KongaButton(copySegmentAction));
        return buttons;
    }

    private void showFieldDialog(int rowIndex) {
        Segment segment = getSegment(rowIndex);
        if (segment != null) {
            if (SegmentFieldDialog.show(segment, isFixedWidth, isReadOnly())) {
                // The field definition was changed. Fire a property
                // change event.
                fireTableContentsChanged();
View Full Code Here


        }

        private void copySelectedSegment() {
            int[] rows = getTable().getSelectedRows();
            if  (rows.length == 1 && rows[0] > 0) {
                Segment segment = getSegment(rows[0]);
                Segment copy = new Segment(segment);
                copy.setName(getNameOfNewSegment(segment));
                getModel().addRow(copy);
                int lastRow = getModel().getRowCount() - 1;
                getTable().setRowSelectionInterval(lastRow, lastRow);
            } else {
                throw new IllegalStateException("Exactly one copyable segment must be selected");
View Full Code Here

        return document.isUnknownDoc() || document.getDataStructure() == null;
    }

    private void createNewTextStructure(TextDocument document) {
        textStructure = new ComplexTextStructure(document.getName(), document.isFixedField());
        Segment root = Segment.newRootSegment();
        addRow(root);
    }
View Full Code Here

    }

    private void populateModel(ComplexTextStructure structure) {
        Map<String, Segment> segments = Maps.newHashMap();
        for (Segment seg : structure.getSegmentList()) {
            Segment copy = new Segment(seg);
            Segment fromMap = segments.get(seg.getName());
            if (fromMap == null) {
                segments.put(seg.getName(), copy);
            } else {
                copy.alias = fromMap;
            }
View Full Code Here

    @Override
    protected boolean updateObjectWithColumnData(Object o, int rowIndex, int columnIndex, Object value) {
        boolean updated = false;
        if (o instanceof Segment) {
            Segment seg = (Segment) o;
            switch (columnIndex) {
            case 1:
                updated = renameSegment(seg, (String) value, rowIndex);
                break;
            case 2:
View Full Code Here

        return false;
    }

    @Override
    public Object createNewObject() {
        Segment s = new Segment("");
        Field id = new Field(-1, "ID", FieldDataType.Identifier.name(), "", "", 1, 0, 0, null, textStructure.isFixField());
        s.fieldList.add(id);
        return s;
    }
View Full Code Here

            }

            @Override
            public void moveRowUp(int rowIndex) {
                if (canRowMoveUp(rowIndex)) {
                    Segment toBeMoved = getSegment(rowIndex);
                    Segment above = getSegment(rowIndex - 1);
                    if (toBeMoved.getParentName().equals(above.getName())) {
                        setValueAt(getSegment(0).getName(), rowIndex, PARENT);
                    }
                    super.moveRowUp(rowIndex);
                }
            }
View Full Code Here

    public void deleteRow(int rowIndex) {
        // If the deleted row is the parent of any segment we must assign a new parent (the root segment)
        String name = getSegment(rowIndex).getName();
        super.deleteRow(rowIndex);
        // Note that the loop starts at 1, since the first row is the root segment
        Segment root = getSegment(0);
        for (int row = 1; row < getRowCount(); ++row) {
            Segment seg = getSegment(row);
            if (seg.getParentName().equals(name)) {
                setValueAt(root.getName(), row, PARENT);
            }
        }
    }
View Full Code Here

    public void validateModel() throws TextDocumentDefinitionException {
        new SegmentTableModelValidator(this).validate();
    }

    private void segmentRenamed(Segment renamedSegment, String oldName, int rowIndex) {
        Segment topSegmentWithOldName = getTopSegmentWithOldName(oldName, rowIndex);
        processRowsUnderRenamedSegment(renamedSegment, oldName, rowIndex, topSegmentWithOldName);
        processRowsAboveRenamedSegment(renamedSegment, rowIndex, topSegmentWithOldName);

    }
View Full Code Here

    }

    private Segment getTopSegmentWithOldName(String oldName, int rowIndex) {
        for (int row = 0; row < rowIndex; ++row) {
            Segment s = getSegment(row);
            if (oldName.equals(s.getName())) {
                return s;
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.data.structure.text.Segment

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.