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);
}
}
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);
}
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;
}
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();
}
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;
}
Aggregations