/** * Instantiates a new node figure. * * @param name the name * @param width the weight */ public SimpleNodeFigure(Node node, int width, MouseListener mouseListener) { super(); this.node = node; LineBorder b = new LineBorder(); b.setColor(NodeUtil.FG_COLOR); setBorder(b); textFigure = new RectangleFigure(); text = new Label(getNodeName()); text.setForegroundColor(NodeUtil.FG_COLOR_DARK); setSize(width, 10); textFigure.add(text); hideButton = new RectangleFigure(); hideSymbol = new Label(getSymbol()); hideSymbol.setSize(10, 10); hideSymbol.setTextAlignment(PositionConstants.CENTER); hideSymbol.setFont(hideButtonFont); hideSymbol.setForegroundColor(NodeUtil.FG_COLOR_DARK); hideButton.add(hideSymbol); hideButton.setBackgroundColor(exitClor); hideButton.addMouseListener(mouseListener); hideButton.addMouseMotionListener( new MouseMotionListener() { @Override public void mouseMoved(MouseEvent me) {} @Override public void mouseHover(MouseEvent me) {} @Override public void mouseExited(MouseEvent me) { hideButton.setBackgroundColor(exitClor); } @Override public void mouseEntered(MouseEvent me) { hideButton.setBackgroundColor(entredClor); } @Override public void mouseDragged(MouseEvent me) {} }); hideButton.setSize(10, 10); setLayoutManager(new XYLayout()); add(textFigure); }
/* * (non-Javadoc) * * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure() */ @Override protected IFigure createFigure() { RectangleFigure fig = new RectangleFigure(); counterLabel = new Label(Integer.toString(getCastedModel().getCounter())); fig.setLayoutManager(new XYLayout()); fig.setFont(SWTResourceManager.getFont("Sans", 13, SWT.BOLD)); fig.setBackgroundColor(ColorConstants.lightGray); fig.setOpaque(true); fig.setOutline(false); fig.add(counterLabel, new Rectangle(17, 10, 30, 30)); fig.add(new Label("x"), new Rectangle(0, 9, 30, 30)); return fig; }
public DashboardFigure() { imgReg = Activator.getDefault().getImageRegistry(); add( logoFigure = new ImageFigure() { @Override protected void paintFigure(Graphics graphics) { if (getImage() != null) { graphics.drawImage( getImage(), new Rectangle(getImage().getBounds()), getBounds()); } } }); Image logoImage = imgReg.get(Activator.IMG_MDA_ID); if (logoImage != null) { logoFigure.setImage(logoImage); } initFigure.setSize(20, 20); initFigure.setBackgroundColor(DASHBOARD_FG); add(initFigure); add(methodoFigure = createMethodologyFigure("Methodology")); add(processFigure = createProcessFigure("Process")); endFigure.setSize(20, 20); endFigure.setBackgroundColor(DASHBOARD_FG); add(endFigure); add(init2methoFlow = createFlowFigure(true)); add(metho2processFlow = createFlowFigure(true)); add(process2endFlow = createFlowFigure(true)); add(statusFigure = new Figure()); statusFigure.setFont(JFaceResources.getBannerFont()); ToolbarLayout statusLayout = new ToolbarLayout(); statusLayout.setStretchMinorAxis(false); statusFigure.setLayoutManager(statusLayout); statusFigure.add(new Label()); statusFigure.add(new Label()); setLayoutManager(new DashboardLayout()); setBorder(new MarginBorder(10)); setBackgroundColor(DASHBOARD_BG); setForegroundColor(DASHBOARD_FG); }