public EndOperationNodeGR( OperationNode operationNode, ProcessRepresentation aDrawing, boolean isInPalet) { super(operationNode, ShapeType.CIRCLE, aDrawing, isInPalet); // Important: width is different from height here to avoid connector blinking when editing // layout // This little difference allows a kind of hysteresis favourizing horizontal layout setWidth(30.1); setHeight(30); setIsFloatingLabel(true); foreground = ForegroundStyle.makeStyle(Color.BLACK); foreground.setLineWidth(0.2); background = BackgroundStyle.makeColoredBackground(getMainBgColor()); setForeground(foreground); setBackground(background); setDimensionConstraints(DimensionConstraints.UNRESIZABLE); painterForeground = ForegroundStyle.makeStyle(Color.DARK_GRAY); painterForeground.setLineWidth(2.0); painterBackground = BackgroundStyle.makeColoredBackground(Color.DARK_GRAY); setShapePainter( new ShapePainter() { @Override public void paintShape(FGEShapeGraphics g) { g.useBackgroundStyle(painterBackground); g.fillCircle(0.2, 0.2, 0.6, 0.6); } }); }
public void setForeground(ForegroundStyle aForeground) { FGENotification notification = requireChange(Parameters.foreground, aForeground); if (notification != null) { if (foreground != null) { foreground.deleteObserver(this); } foreground = aForeground; if (aForeground != null) { aForeground.addObserver(this); } hasChanged(notification); } }
public final void paintShadow(FGEShapeGraphics g) { double deep = getGraphicalRepresentation().getShadowStyle().getShadowDepth(); int blur = getGraphicalRepresentation().getShadowStyle().getShadowBlur(); double viewWidth = getGraphicalRepresentation().getViewWidth(1.0); double viewHeight = getGraphicalRepresentation().getViewHeight(1.0); AffineTransform shadowTranslation = AffineTransform.getTranslateInstance(deep / viewWidth, deep / viewHeight); int darkness = getGraphicalRepresentation().getShadowStyle().getShadowDarkness(); Graphics2D oldGraphics = g.cloneGraphics(); Area clipArea = new Area( new java.awt.Rectangle( 0, 0, getGraphicalRepresentation().getViewWidth(g.getScale()), getGraphicalRepresentation().getViewHeight(g.getScale()))); Area a = new Area(getGraphicalRepresentation().getShape().getShape()); a.transform( getGraphicalRepresentation().convertNormalizedPointToViewCoordinatesAT(g.getScale())); clipArea.subtract(a); g.getGraphics().clip(clipArea); Color shadowColor = new Color(darkness, darkness, darkness); ForegroundStyle foreground = ForegroundStyle.makeStyle(shadowColor); foreground.setUseTransparency(true); foreground.setTransparencyLevel(0.5f); BackgroundStyle background = BackgroundStyle.makeColoredBackground(shadowColor); background.setUseTransparency(true); background.setTransparencyLevel(0.5f); g.setDefaultForeground(foreground); g.setDefaultBackground(background); for (int i = blur - 1; i >= 0; i--) { float transparency = 0.4f - i * 0.4f / blur; foreground.setTransparencyLevel(transparency); background.setTransparencyLevel(transparency); AffineTransform at = AffineTransform.getScaleInstance( (i + 1 + viewWidth) / viewWidth, (i + 1 + viewHeight) / viewHeight); at.concatenate(shadowTranslation); getShape().transform(at).paint(g); } g.releaseClonedGraphics(oldGraphics); }
@Override public void delete() { if (foreground != null) { foreground.deleteObserver(this); } super.delete(); disableStartObjectObserving(); disableEndObjectObserving(); }
public OperatorGR(O operatorNode, ProcessRepresentation aDrawing, boolean isInPalet) { super(operatorNode, ShapeType.LOSANGE, aDrawing, isInPalet); // setX(getOperatorNode().getPosX()); // setY(getOperatorNode().getPosY()); setWidth(35); setHeight(35); // setText(getOperatorNode().getName()); // setAbsoluteTextX(getOperatorNode().getNodeLabelPosX()); // setAbsoluteTextY(getOperatorNode().getNodeLabelPosY()); setIsFloatingLabel(true); foreground = ForegroundStyle.makeStyle(Color.BLACK); foreground.setLineWidth(0.6); if (getImageIcon() != null) { background = BackgroundStyle.makeImageBackground(getImageIcon()); ((BackgroundStyle.BackgroundImage) background).setScaleX(1); ((BackgroundStyle.BackgroundImage) background).setScaleY(1); ((BackgroundStyle.BackgroundImage) background).setDeltaX(-2); ((BackgroundStyle.BackgroundImage) background).setDeltaY(-3); } else { background = BackgroundStyle.makeEmptyBackground(); } setForeground(foreground); setBackground(background); setDimensionConstraints(DimensionConstraints.UNRESIZABLE); if (getOperatorNode().getLevel() == FlexoLevel.ACTIVITY) { setLayer(ACTIVITY_LAYER); } else if (getOperatorNode().getLevel() == FlexoLevel.OPERATION) { setLayer(OPERATION_LAYER); } else if (getOperatorNode().getLevel() == FlexoLevel.ACTION) { setLayer(ACTION_LAYER); } updatePropertiesFromWKFPreferences(); }
public ConnectorGraphicalRepresentation( ConnectorType aConnectorType, ShapeGraphicalRepresentation<?> aStartObject, ShapeGraphicalRepresentation<?> anEndObject, O aDrawable, Drawing<?> aDrawing) { super(aDrawable, aDrawing); layer = FGEConstants.DEFAULT_CONNECTOR_LAYER; setStartObject(aStartObject); setEndObject(anEndObject); setConnectorType(aConnectorType); graphics = new FGEConnectorGraphics(this); foreground = ForegroundStyle.makeStyle(Color.BLACK); // foreground.setGraphicalRepresentation(this); foreground.addObserver(this); addToMouseClickControls( MouseClickControl.makeMouseClickControl( "Selection", MouseButton.LEFT, 1, MouseClickControlActionType.SELECTION)); if (ToolBox.getPLATFORM() == ToolBox.MACOS) { addToMouseClickControls( MouseClickControl.makeMouseMetaClickControl( "Multiple selection", MouseButton.LEFT, 1, MouseClickControlActionType.MULTIPLE_SELECTION)); } else { addToMouseClickControls( MouseClickControl.makeMouseControlClickControl( "Multiple selection", MouseButton.LEFT, 1, MouseClickControlActionType.MULTIPLE_SELECTION)); } }
public EntitySpecializationGR(EntitySpecialization anEntitySpecialization, Drawing<?> aDrawing) { super( ConnectorType.RECT_POLYLIN, (ShapeGraphicalRepresentation<?>) aDrawing.getGraphicalRepresentation(anEntitySpecialization.getSpecializedEntity()), (ShapeGraphicalRepresentation<?>) aDrawing.getGraphicalRepresentation(anEntitySpecialization.getParentEntity()), anEntitySpecialization, aDrawing); // setText(getRole().getName()); updateStyles(); propertyNameStyle = TextStyle.makeTextStyle(Color.DARK_GRAY, ATTRIBUTE_FONT); setTextStyle(propertyNameStyle); getConnector().setIsRounded(true); getConnector().setRectPolylinConstraints(RectPolylinConstraints.VERTICAL_LAYOUT); getConnector().setAdjustability(RectPolylinAdjustability.FULLY_ADJUSTABLE); getConnector().setStraightLineWhenPossible(true); getConnector().setPixelOverlap(30); setEndSymbol(EndSymbolType.PLAIN_ARROW); setEndSymbolSize(15); if (getSpecializedEntity().hasGraphicalPropertyForKey(getStoredPolylinKey())) { ensurePolylinConverterIsRegistered(); polylinIWillBeAdustedTo = (FGERectPolylin) getSpecializedEntity()._graphicalPropertyForKey(getStoredPolylinKey()); getConnector().setWasManuallyAdjusted(true); } setForeground(ForegroundStyle.makeStyle(Color.DARK_GRAY, 1.6f)); setIsFocusable(true); addToMouseClickControls(new ResetLayout(), true); addToMouseClickControls(new ERDiagramController.ShowContextualMenuControl()); if (ToolBox.getPLATFORM() != ToolBox.MACOS) { addToMouseClickControls(new ERDiagramController.ShowContextualMenuControl(true)); } // addToMouseDragControls(new DrawRoleSpecializationControl()); }
public PortmapGR(FlexoPortMap portmap, ProcessRepresentation aDrawing) { super(portmap, ShapeType.CIRCLE, aDrawing); setWidth(PORTMAP_ROUND_SIZE); setHeight(PORTMAP_ROUND_SIZE); setLayer(ACTIVITY_LAYER); setForeground(ForegroundStyle.makeStyle(Color.BLACK)); setBackground(BackgroundStyle.makeColoredBackground(getMainBgColor())); // setBorder(new ShapeGraphicalRepresentation.ShapeBorder(0,10,0,0)); setDimensionConstraints(DimensionConstraints.UNRESIZABLE); layoutAs(SimplifiedCardinalDirection.NORTH); setShapePainter(new PortmapGRShapePainter()); updatePropertiesFromWKFPreferences(); }