@Override protected IFigure createContentPane() { RectangleFigure rectangle = new RectangleFigure(); rectangle.setForegroundColor(ColorConstants.lightGray); rectangle.setFill(true); return rectangle; }
/** * Constructor of ROI figure. * * @param name name of the ROI. It must be unique for this graph. * @param color color of the ROI. * @param roiListener listener on ROI updates. Can be null. * @param roiInfoProvider provides information for the ROI. Can be null. */ public ROIFigure( IntensityGraphFigure intensityGraphFigure, String name, Color color, IROIListener roiListener, IROIInfoProvider roiInfoProvider) { this.intensityGraphFigure = intensityGraphFigure; this.name = name; this.roiListener = roiListener; this.roiInfoProvider = roiInfoProvider; setToolTip(new Label(name)); setBackgroundColor(ColorConstants.white); setForegroundColor(ColorConstants.black); roiRectFigure = new RectangleFigure() { public boolean containsPoint(int x, int y) { if (!super.containsPoint(x, y)) return false; return !Rectangle.SINGLETON.setBounds(getBounds()).shrink(3, 3).contains(x, y); } }; roiRectFigure.setCursor(Cursors.SIZEALL); roiRectFigure.setFill(false); roiRectFigure.setOutline(true); roiRectFigure.setForegroundColor(color); ROIRectDragger roiRectDragger = new ROIRectDragger(); roiRectFigure.addMouseListener(roiRectDragger); roiRectFigure.addMouseMotionListener(roiRectDragger); setFocusTraversable(true); setRequestFocusEnabled(true); resizeHandlers = new ResizeHandler[HANDLERS_COUNT]; add(roiRectFigure); for (int i = 0; i < HANDLERS_COUNT; i++) { resizeHandlers[i] = new ResizeHandler(i); add(resizeHandlers[i]); } addFocusListener( new FocusListener() { public void focusGained(FocusEvent fe) { for (Figure handler : resizeHandlers) { handler.setVisible(true); } } public void focusLost(FocusEvent fe) { for (Figure handler : resizeHandlers) { handler.setVisible(false); } } }); intensityGraphFigure.addCroppedDataSizeListener( new ICroppedDataSizeListener() { public void croppedDataSizeChanged(int croppedDataWidth, int croppedDataHeight) { updateROIGeoBounds(); updateChildrenBounds(); } }); }
/** * Creates the figure used for feedback. * * @return the new feedback figure */ protected IFigure createDragSourceFeedbackFigure() { // Use a ghost rectangle for feedback RectangleFigure r = new RectangleFigure(); FigureUtilities.makeGhostShape(r); r.setLineStyle(Graphics.LINE_DOT); r.setForegroundColor(ColorConstants.white); r.setBounds(getInitialFeedbackBounds()); addFeedback(r); return r; }
/** @generated NOT */ private void createContents() { fFigureSceneTopicFigure = new WrappingLabel(); fFigureSceneTopicFigure.setText("Untitled Scene"); fFigureSceneTopicFigure.setFont(FFIGURESCENETOPICFIGURE_FONT); GridData constraintFFigureSceneTopicFigure = new GridData(); constraintFFigureSceneTopicFigure.verticalAlignment = GridData.BEGINNING; constraintFFigureSceneTopicFigure.horizontalAlignment = GridData.CENTER; constraintFFigureSceneTopicFigure.horizontalIndent = 0; constraintFFigureSceneTopicFigure.horizontalSpan = 1; constraintFFigureSceneTopicFigure.verticalSpan = 1; constraintFFigureSceneTopicFigure.grabExcessHorizontalSpace = true; constraintFFigureSceneTopicFigure.grabExcessVerticalSpace = false; this.add(fFigureSceneTopicFigure, constraintFFigureSceneTopicFigure); RectangleFigure dialogueRectangle0 = new RectangleFigure(); dialogueRectangle0.setFill(false); dialogueRectangle0.setOutline(false); dialogueRectangle0.setLineWidth(1); GridData constraintDialogueRectangle0 = new GridData(); constraintDialogueRectangle0.verticalAlignment = GridData.BEGINNING; constraintDialogueRectangle0.horizontalAlignment = GridData.FILL; constraintDialogueRectangle0.horizontalIndent = 0; constraintDialogueRectangle0.horizontalSpan = 0; constraintDialogueRectangle0.verticalSpan = 0; constraintDialogueRectangle0.grabExcessHorizontalSpace = true; constraintDialogueRectangle0.grabExcessVerticalSpace = true; this.add(dialogueRectangle0, constraintDialogueRectangle0); GridLayout layoutDialogueRectangle0 = new GridLayout(); layoutDialogueRectangle0.numColumns = 1; layoutDialogueRectangle0.makeColumnsEqualWidth = true; dialogueRectangle0.setLayoutManager(layoutDialogueRectangle0); RectangleFigure line1 = new RectangleFigure(); // line1.setSize(400, 1); line1.setFill(false); line1.setLineWidth(2); line1.setForegroundColor(ColorConstants.black); line1.setPreferredSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(1))); GridData constraintLine1 = new GridData(); constraintLine1.verticalAlignment = GridData.BEGINNING; constraintLine1.horizontalAlignment = GridData.FILL; constraintLine1.horizontalIndent = 0; constraintLine1.horizontalSpan = 0; constraintLine1.verticalSpan = 0; constraintLine1.grabExcessHorizontalSpace = true; constraintLine1.grabExcessVerticalSpace = false; dialogueRectangle0.add(line1, constraintLine1); fFigureDialogueFigure = new WrappingLabel(); fFigureDialogueFigure.setTextWrap(true); fFigureDialogueFigure.setText("Click to edit..."); fFigureDialogueFigure.setPreferredSize( new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(100))); GridData constraintFFigureDialogueFigure = new GridData(); constraintFFigureDialogueFigure.verticalAlignment = GridData.FILL; constraintFFigureDialogueFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureDialogueFigure.horizontalIndent = 0; constraintFFigureDialogueFigure.horizontalSpan = 1; constraintFFigureDialogueFigure.verticalSpan = 1; constraintFFigureDialogueFigure.grabExcessHorizontalSpace = true; constraintFFigureDialogueFigure.grabExcessVerticalSpace = true; dialogueRectangle0.add(fFigureDialogueFigure, constraintFFigureDialogueFigure); fFigureSketchesCompartmentFigure = new org.eclipse.draw2d.RectangleFigure(); fFigureSketchesCompartmentFigure.setLineWidth(1); fFigureSketchesCompartmentFigure.setForegroundColor( org.eclipse.draw2d.ColorConstants.lightGray); org.eclipse.draw2d.GridData constraintFFigureSketchesCompartmentFigure = new org.eclipse.draw2d.GridData(); // constraintFFigureSketchesCompartmentFigure.verticalAlignment = // org.eclipse.draw2d.GridData.FILL; constraintFFigureSketchesCompartmentFigure.horizontalAlignment = org.eclipse.draw2d.GridData.FILL; constraintFFigureSketchesCompartmentFigure.horizontalIndent = 0; constraintFFigureSketchesCompartmentFigure.horizontalSpan = 1; constraintFFigureSketchesCompartmentFigure.verticalSpan = 1; constraintFFigureSketchesCompartmentFigure.grabExcessHorizontalSpace = true; // constraintFFigureSketchesCompartmentFigure.grabExcessVerticalSpace = true; this.add(fFigureSketchesCompartmentFigure, constraintFFigureSketchesCompartmentFigure); }
public void setROIColor(Color roiColor) { roiRectFigure.setForegroundColor(roiColor); }