Search in sources :

Example 6 with RectangleFigure

use of org.eclipse.draw2d.RectangleFigure in project cogtool by cogtool.

the class FrameEditorMouseState method updateDynamicDuplicate.

protected void updateDynamicDuplicate(int x, int y) {
    int dx = x - lastX;
    int dy = y - lastY;
    Iterator<RectangleFigure> frameFigs = duplicatingDynamic.iterator();
    while (frameFigs.hasNext()) {
        RectangleFigure frameFig = frameFigs.next();
        Point frameOrigin = frameFig.getLocation();
        frameOrigin.x += dx;
        frameOrigin.y += dy;
        frameFig.setLocation(frameOrigin);
    }
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) Point(org.eclipse.draw2d.geometry.Point) DoublePoint(edu.cmu.cs.hcii.cogtool.model.DoublePoint) Point(org.eclipse.draw2d.geometry.Point) DoublePoint(edu.cmu.cs.hcii.cogtool.model.DoublePoint)

Example 7 with RectangleFigure

use of org.eclipse.draw2d.RectangleFigure in project cogtool by cogtool.

the class DesignEditorFrame method addSpeakerBox.

protected void addSpeakerBox() {
    speakerBox.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.setOpaque(true);
    Image speakerIconImg = getSpeakerIconImage();
    // TODO: handle getImage returning null
    org.eclipse.swt.graphics.Rectangle bds = speakerIconImg.getBounds();
    IFigure speakerImgFig = new ImageFigure(speakerIconImg);
    IFigure speakerImgToolTip = new Label(L10N.get("DEF.SpeakerText", "Speaker text"));
    speakerImgFig.setToolTip(speakerImgToolTip);
    speakerImgWidth = bds.width;
    speakerImgHeight = bds.height;
    speakerLayout.setConstraint(speakerImgFig, new Rectangle(0, 0, bds.width, bds.height));
    speakerBox.add(speakerImgFig);
    RectangleFigure speakerEastBorder = new RectangleFigure();
    speakerEastBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerLayout.setConstraint(speakerEastBorder, new Rectangle(speakerImgWidth, 0, SPEAKER_DIVIDER_WIDTH, speakerImgHeight));
    speakerBox.add(speakerEastBorder);
    timeWestBorder = new RectangleFigure();
    timeWestBorder.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(timeWestBorder);
    String text = frame.getSpeakerText();
    speakerText = new Label(text);
    speakerText.setLabelAlignment(PositionConstants.LEFT);
    speakerTextToolTip = new Label(text);
    if ((text != null) && !text.equals("")) {
        speakerText.setToolTip(speakerTextToolTip);
    }
    speakerBox.add(speakerText);
    divider = new RectangleFigure();
    divider.setBorder(new LineBorder(ColorConstants.black, 1));
    speakerBox.add(divider);
    double listenTimeInSecs = frame.getListenTimeInSecs();
    listenTime = new Label((listenTimeInSecs == Frame.NO_LISTEN_TIME) ? NO_LISTEN_TIME_LABEL : Double.toString(listenTimeInSecs));
    listenTime.setLabelAlignment(PositionConstants.RIGHT);
    speakerBox.add(listenTime);
    Label listenTimeToolTip = new Label(LISTEN_TIME_TOOLTIP);
    listenTime.setToolTip(listenTimeToolTip);
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) LineBorder(org.eclipse.draw2d.LineBorder) Label(org.eclipse.draw2d.Label) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ImageFigure(org.eclipse.draw2d.ImageFigure) Image(org.eclipse.swt.graphics.Image) IFigure(org.eclipse.draw2d.IFigure)

Example 8 with RectangleFigure

use of org.eclipse.draw2d.RectangleFigure in project cogtool by cogtool.

the class DesignEditorMouseState method dealWithMousePressed.

@Override
protected boolean dealWithMousePressed(IFigure figure, int button, int x, int y, int state) {
    boolean goForward = super.dealWithMousePressed(figure, button, x, y, state);
    ui.confirmRenameFrame();
    if (goForward) {
        if (dynamicSelectionArea == null) {
            dynamicSelectionArea = new RectangleFigure();
            if (OSUtils.MACOSX) {
                dynamicSelectionArea.setLineStyle(SWT.LINE_DOT);
            } else {
                dynamicSelectionArea.setLineStyle(SWT.LINE_DASH);
            }
            dynamicSelectionArea.setVisible(false);
            showSelectionArea(dynamicSelectionArea);
        }
        setMouseDown(x, y, state);
        switch(getMouseState()) {
            case MouseUp:
                {
                    handleMousePressed(StructureViewUIModel.NO_LABEL);
                    break;
                }
            // case MouseUp:
            default:
                {
                    // TODO: Throw exception?
                    break;
                }
        }
    // switch (getMouseState())
    }
    cleanup();
    return goForward;
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure)

Example 9 with RectangleFigure

use of org.eclipse.draw2d.RectangleFigure in project cogtool by cogtool.

the class DesignEditorMouseState method updateDynamicDuplicate.

protected void updateDynamicDuplicate(int x, int y) {
    double dx = x - lastX;
    double dy = y - lastY;
    Iterator<RectangleFigure> frameFigs = duplicatingDynamic.iterator();
    while (frameFigs.hasNext()) {
        RectangleFigure frameFig = frameFigs.next();
        Point frameOrigin = frameFig.getLocation();
        frameOrigin.x += dx;
        frameOrigin.y += dy;
        frameFig.setLocation(frameOrigin);
    }
    ui.performRepaintUpdates();
}
Also used : RectangleFigure(org.eclipse.draw2d.RectangleFigure) Point(org.eclipse.draw2d.geometry.Point) DoublePoint(edu.cmu.cs.hcii.cogtool.model.DoublePoint)

Example 10 with RectangleFigure

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

the class ProcessResizableEditPolicy 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 NodeContainer) {
        return null;
    }
    if (modelPart instanceof Node) {
        Node node = (Node) modelPart;
        figure = new NodeFigure(node);
        if (node.isStart()) {
            figure.setBackgroundColor(NodeFigure.START_COLOR);
        } else {
            figure.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) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) IFigure(org.eclipse.draw2d.IFigure)

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