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)); } }
@Override public void handleClick( GraphicalRepresentation<?> graphicalRepresentation, DrawingController<?> controller, MouseEvent event) { super.handleClick(graphicalRepresentation, controller, event); FlexoEditor editor = ((VEShemaController) controller).getEditor(); ViewElement ve = null; if (graphicalRepresentation instanceof VEShapeGR) { VEShapeGR gr = (VEShapeGR) graphicalRepresentation; ve = gr.getDrawable(); } else if (graphicalRepresentation instanceof VEConnectorGR) { VEConnectorGR gr = (VEConnectorGR) graphicalRepresentation; ve = gr.getDrawable(); } if (ve != null && ve.getEditionPatternReference() != null) { for (GraphicalElementAction action : patternRole.getActions(mask)) { if (action.evaluateCondition(ve.getEditionPatternReference())) { if (action.getAbstractActionScheme() instanceof NavigationScheme) { NavigationSchemeAction navigationAction = (new NavigationSchemeActionType( (NavigationScheme) action.getAbstractActionScheme(), ve.getEditionPatternReference())) .makeNewAction(ve, null, editor); navigationAction.doAction(); } else if (action.getAbstractActionScheme() instanceof ActionScheme) { ActionSchemeAction actionAction = (new ActionSchemeActionType( (ActionScheme) action.getAbstractActionScheme(), ve.getEditionPatternReference())) .makeNewAction(ve, null, editor); actionAction.doAction(); } } } } }