Search in sources :

Example 1 with RowLayout

use of org.talend.designer.gefabstractmap.figures.layout.RowLayout in project tdi-studio-se by Talend.

the class OutputTreeSettingTable method createColumns.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.table.AbstractTable#createColumns()
     */
@Override
protected void createColumns() {
    TableColumn column = new TableColumn(ColumnKeyConstant.TREE_SETTING_PROPERTY);
    column.setText("Property");
    addColumn(column);
    ColumnSash sash = new ColumnSash(this);
    sash.setLeftColumn(column);
    addSeparator(sash);
    column = new TableColumn(ColumnKeyConstant.TREE_SETTING_VALUE);
    column.setText("Value");
    sash.setRightColumn(column);
    addColumn(column);
    settingsContainer = getTableItemContainer();
    rejectRow = new Figure();
    rejectRow.setLayoutManager(new RowLayout());
    Label label = new Label();
    label.setText("Catch Output Reject");
    label.setLabelAlignment(PositionConstants.LEFT);
    CompoundBorder compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    rejectRow.add(label);
    reject = new ComboCellLabel();
    reject.setDirectEditType(DirectEditType.OUTPUT_REJECT);
    reject.setText(String.valueOf(outputxmlTree.isReject()));
    reject.setLabelAlignment(PositionConstants.LEFT);
    reject.setBorder(new RowBorder(2, 5, 2, -1));
    rejectRow.add(reject);
    settingsContainer.add(rejectRow);
    innerJoinRejectRow = new Figure();
    innerJoinRejectRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Catch Lookup Inner Join Reject");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    innerJoinRejectRow.add(label);
    innerJoinReject = new ComboCellLabel();
    innerJoinReject.setDirectEditType(DirectEditType.LOOK_UP_INNER_JOIN_REJECT);
    innerJoinReject.setText(String.valueOf(outputxmlTree.isRejectInnerJoin()));
    innerJoinReject.setLabelAlignment(PositionConstants.LEFT);
    innerJoinReject.setBorder(new RowBorder(2, 5, 2, -1));
    innerJoinRejectRow.add(innerJoinReject);
    settingsContainer.add(innerJoinRejectRow);
    allInOneRow = new Figure();
    allInOneRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("All in one");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    allInOneRow.add(label);
    allInOne = new ComboCellLabel();
    allInOne.setDirectEditType(DirectEditType.ALL_IN_ONE);
    allInOne.setText(String.valueOf(outputxmlTree.isAllInOne()));
    allInOne.setLabelAlignment(PositionConstants.LEFT);
    allInOne.setBorder(new RowBorder(2, 5, 2, -1));
    allInOneRow.add(allInOne);
    // container.add(allInOneRow);
    enableEmptyElementRow = new Figure();
    enableEmptyElementRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Create empty element");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    enableEmptyElementRow.add(label);
    enableEmptyElement = new ComboCellLabel();
    enableEmptyElement.setDirectEditType(DirectEditType.ENABLE_EMPTY_ELEMENT);
    enableEmptyElement.setText(String.valueOf(outputxmlTree.isEnableEmptyElement()));
    enableEmptyElement.setLabelAlignment(PositionConstants.LEFT);
    enableEmptyElement.setBorder(new RowBorder(2, 5, 2, -1));
    enableEmptyElementRow.add(enableEmptyElement);
    // container.add(enableEmptyElementRow);
    showOrHideDocumentSetting();
    settingsContainer.setOpaque(true);
    settingsContainer.setBackgroundColor(ColorConstants.white);
    // show selection
    settingsContainer.addMouseListener(new MouseListener() {

        Figure selectedFigure = null;

        @Override
        public void mousePressed(MouseEvent me) {
            boolean joinModel = rejectRow.containsPoint(me.x, me.y);
            if (joinModel) {
                if (selectedFigure != rejectRow) {
                    rejectRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    rejectRow.setOpaque(true);
                    innerJoinRejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean persistentModel = innerJoinRejectRow.containsPoint(me.x, me.y);
            if (persistentModel) {
                if (selectedFigure != innerJoinRejectRow) {
                    innerJoinRejectRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    innerJoinRejectRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean allInOne = allInOneRow.containsPoint(me.x, me.y);
            if (allInOne) {
                if (selectedFigure != allInOneRow) {
                    allInOneRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    allInOneRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    innerJoinRejectRow.setOpaque(false);
                    enableEmptyElementRow.setOpaque(false);
                }
                return;
            }
            boolean emptyElement = enableEmptyElementRow.containsPoint(me.x, me.y);
            if (emptyElement) {
                if (selectedFigure != enableEmptyElementRow) {
                    enableEmptyElementRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    enableEmptyElementRow.setOpaque(true);
                    rejectRow.setOpaque(false);
                    innerJoinRejectRow.setOpaque(false);
                    allInOneRow.setOpaque(false);
                }
            }
        }

        @Override
        public void mouseReleased(MouseEvent me) {
        }

        @Override
        public void mouseDoubleClicked(MouseEvent me) {
        }
    });
}
Also used : RowBorder(org.talend.designer.gefabstractmap.figures.borders.RowBorder) MouseListener(org.eclipse.draw2d.MouseListener) MouseEvent(org.eclipse.draw2d.MouseEvent) RowLayout(org.talend.designer.gefabstractmap.figures.layout.RowLayout) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) Label(org.eclipse.draw2d.Label) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) CompoundBorder(org.eclipse.draw2d.CompoundBorder) ColumnSash(org.talend.designer.gefabstractmap.figures.table.ColumnSash) ColumnBorder(org.talend.designer.gefabstractmap.figures.borders.ColumnBorder) TableColumn(org.talend.designer.gefabstractmap.figures.table.TableColumn) Figure(org.eclipse.draw2d.Figure)

Example 2 with RowLayout

use of org.talend.designer.gefabstractmap.figures.layout.RowLayout in project tdi-studio-se by Talend.

the class InputTreeSettingTable method createColumns.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.newabstractmap.figures.table.AbstractTable#createColumns()
     */
@Override
protected void createColumns() {
    TableColumn column = new TableColumn(ColumnKeyConstant.TREE_SETTING_PROPERTY);
    column.setText("Property");
    addColumn(column);
    ColumnSash sash = new ColumnSash(this);
    sash.setLeftColumn(column);
    addSeparator(sash);
    column = new TableColumn(ColumnKeyConstant.TREE_SETTING_VALUE);
    column.setText("Value");
    sash.setRightColumn(column);
    addColumn(column);
    Figure container = getTableItemContainer();
    lookupModelRow = new Figure();
    lookupModelRow.setLayoutManager(new RowLayout());
    Label label = new Label();
    label.setText("Lookup Model");
    label.setLabelAlignment(PositionConstants.LEFT);
    CompoundBorder compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    lookupModelRow.add(label);
    lookupModel = new ComboCellLabel();
    lookupModel.setDirectEditType(DirectEditType.LOOKUP_MODEL);
    lookupModel.setText(getLookupDisplayName(inputxmlTree.getLookupMode()));
    lookupModel.setLabelAlignment(PositionConstants.LEFT);
    lookupModel.setBorder(new RowBorder(2, 5, 2, -1));
    lookupModelRow.add(lookupModel);
    container.add(lookupModelRow);
    matchModelRow = new Figure();
    matchModelRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Match Model");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    matchModelRow.add(label);
    matchModel = new ComboCellLabel();
    matchModel.setDirectEditType(DirectEditType.MATCH_MODEL);
    matchModel.setText(getMatchModelDisplayName(inputxmlTree.getMatchingMode()));
    matchModel.setLabelAlignment(PositionConstants.LEFT);
    matchModel.setBorder(new RowBorder(2, 5, 2, -1));
    matchModelRow.add(matchModel);
    container.add(matchModelRow);
    joinModelRow = new Figure();
    joinModelRow.setLayoutManager(new RowLayout());
    label = new Label();
    label.setText("Join Model");
    label.setLabelAlignment(PositionConstants.LEFT);
    compoundBorder = new CompoundBorder(new ColumnBorder(), new RowBorder(2, 5, 2, -1));
    label.setBorder(compoundBorder);
    joinModelRow.add(label);
    joinModel = new ComboCellLabel();
    joinModel.setDirectEditType(DirectEditType.JOIN_MODEL);
    String join = "";
    if (inputxmlTree.isInnerJoin()) {
        join = TreeSettingsConstant.INNER_JOIN;
    } else {
        join = TreeSettingsConstant.LEFT_OUTER_JOIN;
    }
    joinModel.setText(join);
    joinModel.setLabelAlignment(PositionConstants.LEFT);
    joinModel.setBorder(new RowBorder(2, 5, 2, -1));
    joinModelRow.add(joinModel);
    container.add(joinModelRow);
    // TDI-17714:remove the true option in the Store temp data lookup property.
    // persistentModelRow = new Figure();
    // persistentModelRow.setLayoutManager(new TableItemLayout());
    // label = new Label();
    // label.setText("Store Temp Data");
    // label.setLabelAlignment(PositionConstants.LEFT);
    // compoundBorder = new CompoundBorder(new RowBorder(), new ColumnBorder());
    // label.setBorder(compoundBorder);
    // persistentModelRow.add(label);
    // persistentModel = new ComboCellLabel();
    // persistentModel.setDirectEditType(DirectEditType.PERSISTENT_MODEL);
    // persistentModel.setText(String.valueOf(inputxmlTree.isPersistent()));
    // persistentModel.setLabelAlignment(PositionConstants.LEFT);
    // persistentModel.setBorder(new RowBorder(2, 5, 2, -1));
    // persistentModelRow.add(persistentModel);
    // container.add(persistentModelRow);
    container.setOpaque(true);
    container.setBackgroundColor(ColorConstants.white);
    container.addMouseListener(new MouseListener() {

        Figure selectedFigure = null;

        @Override
        public void mousePressed(MouseEvent me) {
            boolean lookup = lookupModelRow.containsPoint(me.x, me.y);
            if (lookup) {
                if (selectedFigure != lookupModelRow) {
                    lookupModelRow.setOpaque(true);
                    lookupModelRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    matchModelRow.setOpaque(false);
                    joinModelRow.setOpaque(false);
                // persistentModelRow.setOpaque(false);
                }
                return;
            }
            boolean matchModel = matchModelRow.containsPoint(me.x, me.y);
            if (matchModel) {
                if (selectedFigure != matchModelRow) {
                    matchModelRow.setOpaque(true);
                    matchModelRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    lookupModelRow.setOpaque(false);
                    joinModelRow.setOpaque(false);
                // persistentModelRow.setOpaque(false);
                }
                return;
            }
            boolean joinModel = joinModelRow.containsPoint(me.x, me.y);
            if (joinModel) {
                if (selectedFigure != joinModelRow) {
                    joinModelRow.setOpaque(true);
                    joinModelRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_COLUMN_TREE_SETTING));
                    lookupModelRow.setOpaque(false);
                    matchModelRow.setOpaque(false);
                // persistentModelRow.setOpaque(false);
                }
                return;
            }
        // boolean persistentModel = persistentModelRow.containsPoint(me.x, me.y);
        // if (persistentModel) {
        // if (selectedFigure != persistentModelRow) {
        // persistentModelRow.setOpaque(true);
        // persistentModelRow.setBackgroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_SELECTION));
        // lookupModelRow.setOpaque(false);
        // matchModelRow.setOpaque(false);
        // joinModelRow.setOpaque(false);
        // }
        // }
        }

        @Override
        public void mouseReleased(MouseEvent me) {
        }

        @Override
        public void mouseDoubleClicked(MouseEvent me) {
        }
    });
}
Also used : RowBorder(org.talend.designer.gefabstractmap.figures.borders.RowBorder) MouseEvent(org.eclipse.draw2d.MouseEvent) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) Label(org.eclipse.draw2d.Label) ComboCellLabel(org.talend.designer.gefabstractmap.figures.ComboCellLabel) ColumnSash(org.talend.designer.gefabstractmap.figures.table.ColumnSash) ColumnBorder(org.talend.designer.gefabstractmap.figures.borders.ColumnBorder) TableColumn(org.talend.designer.gefabstractmap.figures.table.TableColumn) Figure(org.eclipse.draw2d.Figure) MouseListener(org.eclipse.draw2d.MouseListener) RowLayout(org.talend.designer.gefabstractmap.figures.layout.RowLayout) CompoundBorder(org.eclipse.draw2d.CompoundBorder)

Aggregations

CompoundBorder (org.eclipse.draw2d.CompoundBorder)2 Figure (org.eclipse.draw2d.Figure)2 Label (org.eclipse.draw2d.Label)2 MouseEvent (org.eclipse.draw2d.MouseEvent)2 MouseListener (org.eclipse.draw2d.MouseListener)2 ComboCellLabel (org.talend.designer.gefabstractmap.figures.ComboCellLabel)2 ColumnBorder (org.talend.designer.gefabstractmap.figures.borders.ColumnBorder)2 RowBorder (org.talend.designer.gefabstractmap.figures.borders.RowBorder)2 RowLayout (org.talend.designer.gefabstractmap.figures.layout.RowLayout)2 ColumnSash (org.talend.designer.gefabstractmap.figures.table.ColumnSash)2 TableColumn (org.talend.designer.gefabstractmap.figures.table.TableColumn)2