Search in sources :

Example 11 with RectangleFigure

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

the class JobletContainerFigure method initMRFigures.

private void initMRFigures() {
    Node node = this.jobletContainer.getNode();
    if (!node.isMapReduceStart()) {
        return;
    }
    if (node.getMrGroupId() == null) {
        return;
    }
    if (dispose) {
        return;
    }
    Integer mrCount = node.getMrJobInGroupCount();
    if (mrCount == null) {
        mrCount = 1;
    }
    Image image = ImageProvider.getImage(ECoreImage.MRGREEBAR);
    // Image map = ImageProvider.getImage(ECoreImage.MRMAP);
    // Image reduce = ImageProvider.getImage(ECoreImage.MRREDUCE);
    int progressHeight = image.getBounds().height;
    int progressWidth = image.getBounds().width;
    for (int i = 0; i < mrCount; i++) {
        SimpleHtmlFigure progressMap = new SimpleHtmlFigure();
        // progressMap.setOutline(false);
        progressMap.setOpaque(false);
        Label mapTip = new Label();
        mapTip.setText("Map ");
        progressMap.setToolTip(mapTip);
        progressMap.setLayoutManager(new ToolbarLayout(true));
        progressMap.setVisible(false);
        SimpleHtmlFigure mapTitle = new SimpleHtmlFigure();
        mapTitle.setText("<b>Map</b> ");
        mapTitle.setSize(mapTitle.getPreferredSize());
        mapTitle.setOpaque(false);
        RectangleFigure mapGreen = new RectangleFigure();
        mapGreen.setSize(progressWidth, progressHeight);
        mapGreen.setPreferredSize(progressWidth, progressHeight + 5);
        mapGreen.setBorder(new LineBorder(ColorConstants.black, 1));
        mapGreen.setLayoutManager(new ToolbarLayout(true));
        mapGreen.setLocation(new Point(progressMap.getLocation().x + mapTitle.getPreferredSize().width, progressMap.getLocation().y));
        mapGreen.setOpaque(true);
        mapGreen.setAlpha(255);
        mapGreen.setVisible(true);
        progressMap.add(mapTitle, 0);
        progressMap.add(mapGreen, 1);
        progressMap.setSize(mapTitle.getPreferredSize().width + mapGreen.getPreferredSize().width, progressHeight + 2);
        progressMap.setPreferredSize(mapTitle.getPreferredSize().width + mapGreen.getPreferredSize().width, progressHeight + 2);
        mrFigures.put(KEY_MAP + i, progressMap);
        // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        SimpleHtmlFigure progressReduce = new SimpleHtmlFigure();
        // progressReduce.setOutline(false);
        progressReduce.setOpaque(false);
        Label reduceTip = new Label();
        reduceTip.setText("Reduce ");
        progressReduce.setToolTip(reduceTip);
        progressReduce.setLayoutManager(new ToolbarLayout(true));
        progressReduce.setVisible(false);
        SimpleHtmlFigure reduceTitle = new SimpleHtmlFigure();
        reduceTitle.setText("<b>Reduce</b> ");
        reduceTitle.setSize(reduceTitle.getPreferredSize());
        reduceTitle.setOpaque(false);
        RectangleFigure reduceGreen = new RectangleFigure();
        reduceGreen.setSize(progressWidth, progressHeight);
        reduceGreen.setPreferredSize(progressWidth, progressHeight + 5);
        reduceGreen.setBorder(new LineBorder(ColorConstants.black, 1));
        reduceGreen.setLayoutManager(new ToolbarLayout(true));
        reduceGreen.setLocation(new Point(progressReduce.getLocation().x + reduceTitle.getPreferredSize().width, progressReduce.getLocation().y));
        reduceGreen.setOpaque(true);
        reduceGreen.setAlpha(255);
        reduceGreen.setVisible(true);
        progressReduce.add(reduceTitle, 0);
        progressReduce.add(reduceGreen, 1);
        progressReduce.setSize(reduceTitle.getPreferredSize().width + reduceGreen.getPreferredSize().width, progressHeight + 2);
        progressReduce.setPreferredSize(reduceTitle.getPreferredSize().width + reduceGreen.getPreferredSize().width, progressHeight + 2);
        mrFigures.put(KEY_REDUCE + i, progressReduce);
    }
}
Also used : ToolbarLayout(org.eclipse.draw2d.ToolbarLayout) RectangleFigure(org.eclipse.draw2d.RectangleFigure) Node(org.talend.designer.core.ui.editor.nodes.Node) LineBorder(org.eclipse.draw2d.LineBorder) Label(org.eclipse.draw2d.Label) Point(org.eclipse.draw2d.geometry.Point) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) ECoreImage(org.talend.commons.ui.runtime.image.ECoreImage) Point(org.eclipse.draw2d.geometry.Point) SimpleHtmlFigure(org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)

Example 12 with RectangleFigure

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

the class NodeContainerResizableEditPolicy method getCustomFeedbackFigure.

/**
     * This will take the figure of the node and set it as feedback figure.
     * 
     * @param modelPart
     * @return
     */
protected IFigure getCustomFeedbackFigure(Object modelPart) {
    IFigure figure;
    if (modelPart instanceof Node) {
        Node node = (Node) modelPart;
        figure = new Figure();
        figure.setOpaque(false);
        NodeFigure nodeFigure = new NodeFigure(node);
        figure.add(nodeFigure);
        nodeFigure.setLocation(new Point(32, 32));
        if (node.isStart()) {
            nodeFigure.setBackgroundColor(NodeFigure.START_COLOR);
        } else {
            nodeFigure.setOpaque(false);
        }
    } else {
        figure = new RectangleFigure();
        ((RectangleFigure) figure).setXOR(true);
        ((RectangleFigure) figure).setFill(true);
        figure.setBackgroundColor(ColorConstants.darkGreen);
        figure.setForegroundColor(ColorConstants.white);
    }
    return figure;
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure) Node(org.talend.designer.core.ui.editor.nodes.Node) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure) IFigure(org.eclipse.draw2d.IFigure) Figure(org.eclipse.draw2d.Figure) RectangleFigure(org.eclipse.draw2d.RectangleFigure) NodeFigure(org.talend.designer.core.ui.editor.nodes.NodeFigure)

Example 13 with RectangleFigure

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

the class BusinessTextNonResizableEditPolicy method createSelectionFeedbackFigure.

/**
     * @generated
     */
protected IFigure createSelectionFeedbackFigure() {
    if (getHostFigure() instanceof Label) {
        Label feedbackFigure = new Label();
        feedbackFigure.setOpaque(true);
        feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
        feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
        return feedbackFigure;
    } else {
        RectangleFigure feedbackFigure = new RectangleFigure();
        feedbackFigure.setFill(false);
        return feedbackFigure;
    }
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) WrapLabel(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel) Label(org.eclipse.draw2d.Label)

Example 14 with RectangleFigure

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

the class BusinessTextSelectionEditPolicy method createSelectionFeedbackFigure.

/**
     * @generated
     */
protected IFigure createSelectionFeedbackFigure() {
    if (getHostFigure() instanceof Label) {
        Label feedbackFigure = new Label();
        feedbackFigure.setOpaque(true);
        feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
        feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
        return feedbackFigure;
    } else {
        RectangleFigure feedbackFigure = new RectangleFigure();
        feedbackFigure.setFill(false);
        return feedbackFigure;
    }
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) WrapLabel(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel) Label(org.eclipse.draw2d.Label)

Aggregations

RectangleFigure (org.eclipse.draw2d.RectangleFigure)14 Point (org.eclipse.draw2d.geometry.Point)7 DoublePoint (edu.cmu.cs.hcii.cogtool.model.DoublePoint)6 IFigure (org.eclipse.draw2d.IFigure)5 Label (org.eclipse.draw2d.Label)4 Node (org.talend.designer.core.ui.editor.nodes.Node)4 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 NodeFigure (org.talend.designer.core.ui.editor.nodes.NodeFigure)3 InteractionFigure (edu.cmu.cs.hcii.cogtool.view.InteractionFigure)2 StandardDrawingEditor (edu.cmu.cs.hcii.cogtool.view.StandardDrawingEditor)2 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 LineBorder (org.eclipse.draw2d.LineBorder)2 WrapLabel (org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel)2 Image (org.eclipse.swt.graphics.Image)2 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)1 GridButton (edu.cmu.cs.hcii.cogtool.model.GridButton)1 GridButtonGroup (edu.cmu.cs.hcii.cogtool.model.GridButtonGroup)1 DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)1 FrameEltGroupHalo (edu.cmu.cs.hcii.cogtool.uimodel.FrameEltGroupHalo)1