private void addVisibleLabel(IFigure figure) { visibleLabel = new Label(); visibleLabel.setBorder(new SimpleRaisedBorder()); visibleLabel.addMouseListener(new MouseListener.Stub() { @Override public void mousePressed(MouseEvent me) { EPlanElement node = getModel(); TriState oldValue = SpifePlanUtils.getVisible(node); if (!PlanEditApproverRegistry.getInstance().canModify(node)) { return; } try { VisibleOperation op = new VisibleOperation(node, oldValue == TriState.FALSE); op.addContext(TransactionUtils.getUndoContext(node)); IOperationHistory history = OperationHistoryFactory.getOperationHistory(); history.execute(op, null, null); } catch (Exception e) { trace.error(e.getMessage(), e); } } }); updateVisibleVisual(); figure.add(visibleLabel); }
public SplitFigure(int orientation) { this.orientation = orientation; setLayoutManager(new SplitFigureLayout()); dividerFigure = new RectangleFigure(); dividerFigure.setOutline(false); dividerFigure.setBorder(new SimpleRaisedBorder()); switch(getOrientation()) { case HORIZONTAL_SPLIT: dividerFigure.setSize(5, 0); dividerFigure.setPreferredSize(new Dimension(5, 0)); break; case VERTICAL_SPLIT: dividerFigure.setSize(0, 5); dividerFigure.setPreferredSize(new Dimension(0, 5)); break; } add(dividerFigure, DIVIDER); }
@Override public void showTargetFeedback(final Request request) { final ERDiagram diagram = (ERDiagram) getHost().getRoot().getContents().getModel(); if (diagram.isTooltip()) { final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final TableView tableView = (TableView) getHost().getModel(); final Rectangle tableBounds = getHostFigure().getBounds(); final String name = TableViewEditPart.getTableViewName(tableView, diagram); final Label label = new Label(); label.setText(name); label.setBorder(new SimpleRaisedBorder()); label.setBackgroundColor(ColorConstants.orange); label.setOpaque(true); final Dimension dim = FigureUtilities.getTextExtents(name, Display.getCurrent().getSystemFont()); label.setBounds(new Rectangle((int) (zoom * (tableBounds.x + 33)), (int) (zoom * (tableBounds.y + 5)), (int) (dim.width * 1.5), 20)); addFeedback(label); } super.showTargetFeedback(request); }
@Override public void showTargetFeedback(Request request) { ERDiagram diagram = (ERDiagram) this.getHost().getRoot().getContents() .getModel(); if (diagram.isTooltip()) { ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this .getHost().getRoot()).getZoomManager(); double zoom = zoomManager.getZoom(); TableView tableView = (TableView) this.getHost().getModel(); Rectangle tableBounds = this.getHostFigure().getBounds(); String name = TableViewEditPart.getTableViewName(tableView, diagram); Label label = new Label(); label.setText(name); label.setBorder(new SimpleRaisedBorder()); label.setBackgroundColor(ColorConstants.orange); label.setOpaque(true); Dimension dim = FigureUtilities.getTextExtents(name, Display .getCurrent().getSystemFont()); label.setBounds(new Rectangle((int) (zoom * (tableBounds.x + 33)), (int) (zoom * (tableBounds.y + 5)), (int) (dim.width * 1.5), 20)); this.addFeedback(label); } super.showTargetFeedback(request); }
@Override public void showTargetFeedback(Request request) { final ERDiagram diagram = ERModelUtil.getDiagram(getHost().getRoot().getContents()); if (diagram.isTooltip()) { final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager(); final double zoom = zoomManager.getZoom(); final TableView tableView = (TableView) getHost().getModel(); final Rectangle tableBounds = getHostFigure().getBounds(); final String name = TableViewEditPart.getTableViewName(tableView, diagram); final Label label = new Label(); label.setText(name); label.setBorder(new SimpleRaisedBorder()); label.setBackgroundColor(ColorConstants.orange); label.setOpaque(true); final Dimension dim = FigureUtilities.getTextExtents(name, Display.getCurrent().getSystemFont()); label.setBounds(new Rectangle( (int) (zoom * (tableBounds.x + 33)), (int) (zoom * (tableBounds.y + 5)), (int) (dim.width * 1.5), 20)); addFeedback(label); } super.showTargetFeedback(request); }
private void addScheduledLabel(IFigure figure) { scheduledLabel = new Label(); scheduledLabel.setBorder(new SimpleRaisedBorder()); scheduledLabel.addMouseListener(new MouseListener.Stub() { @Override public void mousePressed(MouseEvent me) { EPlanElement node = getModel(); ScheduledOperation.toggleScheduledness(node); } }); updateScheduledVisual(); figure.add(scheduledLabel); }
public ButtonFigure(){ setText("按钮"); SimpleRaisedBorder border = new SimpleRaisedBorder(); setBorder(border); }
public ButtonFigure(String text){ super(text); SimpleRaisedBorder border = new SimpleRaisedBorder(); setBorder(border); }