private void updateFigureVisibility(IFigure figure, int visibility) { switch (visibility) { case INVISIBLE: figure.setVisible(false); break; case VISIBLE: figure.setForegroundColor(ColorConstants.listForeground); figure.setBackgroundColor(ColorConstants.titleInactiveBackground); figure.setVisible(true); break; case FADED: figure.setForegroundColor( FigureUtilities.mixColors( ColorConstants.listForeground, ColorConstants.listBackground, 0.1)); figure.setBackgroundColor( FigureUtilities.mixColors( ColorConstants.titleInactiveBackground, ColorConstants.listBackground, 0.1)); figure.setVisible(true); break; default: return; } }
/** @generated NOT */ protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); if (RobmodPackage.eINSTANCE.getPort_External().equals(feature)) { if (notification.getNewBooleanValue()) { primaryShape.setVisible(false); } else { primaryShape.setVisible(true); } } else super.handleNotificationEvent(notification); }
@Override public void refreshVisuals() { Point loc = new Point(((WorkflowNode) getModel()).getX(), ((WorkflowNode) getModel()).getY()); int width = WORKFLOW_NODE_WIDTH; int height = WORKFLOW_NODE_WIDTH; if (((WorkflowNode) getModel()) .getComponentDescription() .getComponentInstallation() .getComponentRevision() .getComponentInterface() .getSize() == ComponentSize.SMALL) { width = SMALL_WORKFLOW_NODE_WIDTH; height = SMALL_WORKFLOW_NODE_WIDTH; } Rectangle r = new Rectangle(loc, new Dimension(width, height)); final Label label = (Label) getFigure(); String labelText = getWorkflowNode().getName(); // try to abbreviate label just, when the name of the workflow has changed in the model if (!currentLabel.equals(getWorkflowNode().getName())) { abbreviateLabel(label, labelText, MAX_LABELTEXT_SIZE); } // remember original workflow node name from model currentLabel = labelText; setTooltipText(); localFigure.setVisible( ((WorkflowNode) getModel()).getComponentDescription().canOnlyBeExecutedLocally()); deprecatedFigure.setVisible( ((WorkflowNode) getModel()) .getComponentDescription() .getComponentInstallation() .getComponentRevision() .getComponentInterface() .getIsDeprecated()); getFigure() .setBackgroundColor( getColor( ((WorkflowNode) getModel()) .getComponentDescription() .getComponentInstallation() .getComponentRevision() .getComponentInterface())); ((GraphicalEditPart) getParent()).setLayoutConstraint(this, label, r); }
/** * Updates the visual indicators for {@link WorkflowNodeValidationMessage}s and refreshes the * graphical representation of this {@link WorkflowNodePart}. * * @param valid true, if validation yielded not {@link WorkflowNodeValidationMessage}s. */ private void updateValid() { final boolean valid = validationSupport.isValid(); final String errorText = getValidationMessageText(WorkflowNodeValidationMessage.Type.ERROR); errorFigure.setVisible(!errorText.isEmpty()); if (!valid) { errorFigure.setToolTip(new Label(errorText)); } final String warningText = getValidationMessageText(WorkflowNodeValidationMessage.Type.WARNING); warningFigure.setVisible(!warningText.isEmpty()); if (!valid) { warningFigure.setToolTip(new Label(warningText)); } refresh(); refreshVisuals(); }
{ final int offsetX = 62; final int offsetY = 2; final int size = 16; warningFigure.setBounds(new Rectangle(offsetX, offsetY, size, size)); warningFigure.setVisible(false); }
{ final int offsetX = 23; final int offsetY = 17; final int size = 32; deprecatedFigure.setBounds(new Rectangle(offsetX, offsetY, size, size)); deprecatedFigure.setToolTip(new Label(Messages.deprecated)); deprecatedFigure.setVisible(false); }
{ final int offsetX = 62; final int offsetY = 62; final int size = 16; localFigure.setBounds(new Rectangle(offsetX, offsetY, size, size)); localFigure.setToolTip(new Label(Messages.localExecutionOnly)); localFigure.setVisible(false); }
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); // hides grid on diagram, but you can reenable it if (getGraphicalViewer() != null && getGraphicalViewer().getEditPartRegistry() != null) { ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID); IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER); gridFigure.setVisible(false); } }
/** Shows a nice guideline to show the move */ protected void showSourceFeedback() { if (_container == null) { return; } if (guideline.getParent() == null) { addFeedback(guideline); } Rectangle bounds = Rectangle.SINGLETON.getCopy(); bounds.y = getCurrentPositionZoomed(); Rectangle containerBounds = _container.getFigure().getBounds().getCopy(); _container.getFigure().translateToAbsolute(containerBounds); ((DiagramEditPart) getCurrentViewer().getContents()) .getFigure() .translateToRelative(containerBounds); bounds.x = containerBounds.x; bounds.height = 1; bounds.width = containerBounds.width; ZoomManager zoomManager = ((DiagramRootEditPart) getCurrentViewer().getRootEditPart()).getZoomManager(); bounds.performScale(zoomManager.getZoom()); guideline.setBounds(bounds); guideline.setVisible(getState() == STATE_DRAG_IN_PROGRESS); ChangeBoundsRequest request = new ChangeBoundsRequest(RequestConstants.REQ_MOVE); request.setMoveDelta(((ChangeBoundsRequest) getSourceRequest()).getMoveDelta()); request.setSizeDelta(new Dimension(0, 0)); request.setEditParts(_movingShapes); for (IGraphicalEditPart part : _movingShapes) { part.showSourceFeedback(request); } ChangeBoundsRequest spRequest = new ChangeBoundsRequest(RequestConstants.REQ_RESIZE); Point moveDelta = ((ChangeBoundsRequest) getSourceRequest()).getMoveDelta().getCopy(); Dimension spSizeDelta = new Dimension(moveDelta.x, moveDelta.y); spRequest.setSizeDelta(spSizeDelta); spRequest.setMoveDelta(new Point(0, 0)); spRequest.setEditParts(_subProcesses); for (IGraphicalEditPart sp : _subProcesses) { sp.showSourceFeedback(spRequest); } ((DiagramEditPart) getCurrentViewer().getContents()).getRoot().refresh(); }
/** * initialize the figure * * @param figure */ protected void initFigure(final IFigure figure) { if (figure == null) throw new IllegalArgumentException("Editpart does not provide a figure!"); // $NON-NLS-1$ Set<String> allPropIds = getWidgetModel().getAllPropertyIDs(); if (allPropIds.contains(AbstractWidgetModel.PROP_COLOR_BACKGROUND)) figure.setBackgroundColor( CustomMediaFactory.getInstance().getColor(getWidgetModel().getBackgroundColor())); if (allPropIds.contains(AbstractWidgetModel.PROP_COLOR_FOREGROUND)) figure.setForegroundColor( CustomMediaFactory.getInstance().getColor(getWidgetModel().getForegroundColor())); if (allPropIds.contains(AbstractWidgetModel.PROP_FONT)) figure.setFont(getWidgetModel().getFont().getSWTFont()); if (allPropIds.contains(AbstractWidgetModel.PROP_VISIBLE)) figure.setVisible( getExecutionMode() == ExecutionMode.RUN_MODE ? getWidgetModel().isVisible() : true); if (allPropIds.contains(AbstractWidgetModel.PROP_ENABLED)) figure.setEnabled(getWidgetModel().isEnabled()); if (allPropIds.contains(AbstractWidgetModel.PROP_WIDTH) && allPropIds.contains(AbstractWidgetModel.PROP_HEIGHT)) figure.setSize(getWidgetModel().getSize()); if (allPropIds.contains(AbstractWidgetModel.PROP_BORDER_COLOR) && allPropIds.contains(AbstractWidgetModel.PROP_BORDER_STYLE) && allPropIds.contains(AbstractWidgetModel.PROP_BORDER_WIDTH)) figure.setBorder( BorderFactory.createBorder( getWidgetModel().getBorderStyle(), getWidgetModel().getBorderWidth(), getWidgetModel().getBorderColor(), getWidgetModel().getName())); if (allPropIds.contains(AbstractWidgetModel.PROP_TOOLTIP)) { if (!getWidgetModel().getTooltip().equals("")) { // $NON-NLS-1$ tooltipLabel = new TooltipLabel(getWidgetModel()); figure.setToolTip(tooltipLabel); } } }
{ final int offset = 2; final int size = 16; errorFigure.setBounds(new Rectangle(offset, offset, size, size)); errorFigure.setVisible(false); }
/** Default constructor, with no args as required by the palette. */ public MultipleShapesVerticalMoveTool() { guideline = new GuideEditPart.GuideLineFigure(); guideline.setVisible(false); }
public void showRightParen(boolean val) { p3.setVisible(val); p4.setVisible(val); }
public void showLeftParen(boolean val) { p1.setVisible(val); p2.setVisible(val); }