Search in sources :

Example 11 with Label

use of org.eclipse.draw2d.Label in project tdi-studio-se by Talend.

the class NodeContainerFigure method updateParallelFigure.

/**
     * DOC YeXiaowei Comment method "updateParallelFigure".
     * 
     * @param status
     */
private void updateParallelFigure(int status) {
    if (!PluginChecker.isTeamEdition() || parallelFigure == null) {
        return;
    }
    //$NON-NLS-1$
    String numberParallel = "0";
    if ((status & Process.PARALLEL_STATUS) != 0) {
        IElementParameter numberParallelizeParameter = nodeContainer.getNode().getElementParameter(EParameterName.PARALLELIZE_NUMBER.getName());
        if (numberParallelizeParameter != null) {
            numberParallel = (String) numberParallelizeParameter.getValue();
        }
        //$NON-NLS-1$
        String paralString = "x" + numberParallel;
        parallelFigure.setText(paralString);
        parallelFigure.setToolTip(new Label(paralString));
        parallelFigure.setVisible(true);
    } else {
        parallelFigure.setVisible(false);
    }
}
Also used : Label(org.eclipse.draw2d.Label) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 12 with Label

use of org.eclipse.draw2d.Label in project tdi-studio-se by Talend.

the class XmlmapBranchContent method createContent.

@Override
protected void createContent() {
    super.createContent();
    statusFigure = new Label();
    statusFigure.setForegroundColor(ColorConstants.red);
    statusFigure.setText(getStatus());
    defaultValue = new Label();
    defaultValue.setForegroundColor(ColorConstants.blue);
    defaultValue.setText(getDefaultValue());
    ImageInfo infor = ImageInfo.SETLOOPFUNCTION_BUTTON;
    if (treeNode instanceof OutputTreeNode) {
        InputLoopNodesTable inputLoopNodesTable = ((OutputTreeNode) treeNode).getInputLoopNodesTable();
        infor = (inputLoopNodesTable == null || inputLoopNodesTable.getInputloopnodes().isEmpty()) ? ImageInfo.SETLOOPFUNCTION_BUTTON_ERROR : ImageInfo.SETLOOPFUNCTION_BUTTON;
    }
    loopButtonFigure = new ToolBarButtonImageFigure(ImageProviderMapper.getImage(infor));
    loopButtonFigure.addMouseListener(new MouseListener.Stub() {

        @Override
        public void mousePressed(MouseEvent me) {
            OutputTreeNode outputTreeNode = (OutputTreeNode) treeNode;
            List<TreeNode> loopNodes = new ArrayList<TreeNode>();
            if (manager.isMainTableMultiLoop()) {
                loopNodes.addAll(XmlMapUtil.getMultiLoopsForXmlTree(manager.getMainInputTree()));
            }
            InputLoopNodesTable inputLoopNodesTable = null;
            if (outputTreeNode.getInputLoopNodesTable() != null) {
                inputLoopNodesTable = outputTreeNode.getInputLoopNodesTable();
            } else {
                inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
                outputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
                AbstractInOutTree abstractInOutTree = XmlMapUtil.getAbstractInOutTree(outputTreeNode);
                if (abstractInOutTree != null) {
                    ((OutputXmlTree) abstractInOutTree).getInputLoopNodesTables().add(inputLoopNodesTable);
                }
            }
            SetLoopFunctionDialog nsDialog = new SetLoopFunctionDialog(null, outputTreeNode.getInputLoopNodesTable(), loopNodes);
            if (nsDialog.open() == Window.OK) {
                manager.getProblemsAnalyser().checkProblems(XmlMapUtil.getAbstractInOutTree(outputTreeNode));
                manager.getMapperUI().updateStatusBar();
            }
        }
    });
    if (treeNode != null && treeNode instanceof OutputTreeNode) {
        // display loop setup button only when input main is multiloop
        if (treeNode.isLoop() && manager.isMainTableMultiLoop()) {
            this.add(loopButtonFigure);
        }
    }
    this.add(statusFigure);
    this.add(defaultValue);
}
Also used : InputLoopNodesTable(org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable) ToolBarButtonImageFigure(org.talend.designer.gefabstractmap.figures.treetools.ToolBarButtonImageFigure) MouseEvent(org.eclipse.draw2d.MouseEvent) Label(org.eclipse.draw2d.Label) SetLoopFunctionDialog(org.talend.designer.xmlmap.ui.dialog.SetLoopFunctionDialog) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) MouseListener(org.eclipse.draw2d.MouseListener) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) List(java.util.List) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) ImageInfo(org.talend.designer.gefabstractmap.resource.ImageInfo)

Example 13 with Label

use of org.eclipse.draw2d.Label 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 14 with Label

use of org.eclipse.draw2d.Label in project tdi-studio-se by Talend.

the class BusinessTextNonResizableEditPolicy method updateLabel.

/**
     * @generated
     */
protected void updateLabel(Label target) {
    Label source = (Label) getHostFigure();
    target.setText(source.getText());
    target.setTextAlignment(source.getTextAlignment());
    target.setFont(source.getFont());
}
Also used : WrapLabel(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel) Label(org.eclipse.draw2d.Label)

Example 15 with Label

use of org.eclipse.draw2d.Label in project cubrid-manager by CUBRID.

the class GraphPlanTooltipFigure method addKeyValueItem.

public void addKeyValueItem(String key, String value) {
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 5;
    layout.verticalSpacing = 0;
    layout.makeColumnsEqualWidth = true;
    Label namelbl = new Label();
    namelbl.setFont(bolderFont);
    namelbl.setTextAlignment(PositionConstants.LEFT);
    namelbl.setText(key);
    GridData nameData = new GridData(SWT.NONE);
    nameData.grabExcessHorizontalSpace = true;
    nameData.horizontalSpan = 0;
    getKeyValueCompartment().add(namelbl, nameData);
    Label valueLbl = new Label();
    valueLbl.setFont(normalFont);
    valueLbl.setTextAlignment(PositionConstants.RIGHT);
    valueLbl.setText(value);
    GridData valueData = new GridData(SWT.NONE);
    valueData.grabExcessHorizontalSpace = true;
    valueData.horizontalSpan = 0;
    getKeyValueCompartment().add(valueLbl, valueData);
    updateMap(key + value, keyValueFigures, namelbl, valueLbl);
}
Also used : GridLayout(org.eclipse.draw2d.GridLayout) Label(org.eclipse.draw2d.Label) GridData(org.eclipse.draw2d.GridData)

Aggregations

Label (org.eclipse.draw2d.Label)56 IFigure (org.eclipse.draw2d.IFigure)8 Rectangle (org.eclipse.draw2d.geometry.Rectangle)8 Point (org.eclipse.draw2d.geometry.Point)7 LineBorder (org.eclipse.draw2d.LineBorder)6 WrapLabel (org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel)6 Image (org.eclipse.swt.graphics.Image)6 MouseEvent (org.eclipse.draw2d.MouseEvent)5 MouseListener (org.eclipse.draw2d.MouseListener)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Figure (org.eclipse.draw2d.Figure)4 RectangleFigure (org.eclipse.draw2d.RectangleFigure)4 Dimension (org.eclipse.draw2d.geometry.Dimension)4 PolylineConnection (org.eclipse.draw2d.PolylineConnection)3 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)3 EImage (org.talend.commons.ui.runtime.image.EImage)3 ComboCellLabel (org.talend.designer.gefabstractmap.figures.ComboCellLabel)3 RowBorder (org.talend.designer.gefabstractmap.figures.borders.RowBorder)3 CompoundBorder (org.eclipse.draw2d.CompoundBorder)2