public boolean isSourceWidget(Widget arg0) { if (caratteristiche.getExpressionFunction() == null || caratteristiche.getExpressionFunction().equals("")) { return false; } return true; }
// giannisk private void deleteTargetConnection(Widget sourceWidget) { ReviewCorrespondences review = new ReviewCorrespondences(); review.removeCorrespondence(caratteristiche.getValueCorrespondence()); caratteristiche.setTargetWidget(null); ConnectionWidget connection = new ConnectionWidget(sourceWidget.getScene()); connection.removeFromParent(); StatusDisplayer.getDefault() .setStatusText(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION)); }
public void createConnection(Widget sourceWidget, Widget targetWidget) { try { ConnectionWidget connection = new ConnectionWidget(sourceWidget.getScene()); connection.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED); connection.setSourceAnchor(AnchorFactory.createRectangularAnchor(sourceWidget)); connection.setTargetAnchor(AnchorFactory.createRectangularAnchor(targetWidget)); Stroke stroke = Costanti.BASIC_STROKE; connection.setStroke(stroke); connection .getActions() .addAction( ActionFactory.createPopupMenuAction( new MyPopupProviderConnectionFunc( sourceWidget.getScene(), mainLayer, caratteristiche))); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.setTargetWidget(targetWidget); connectionInfo.setConnectionWidget(connection); caratteristiche.setTargetWidget((VMDPinWidgetTarget) targetWidget); creator.createCorrespondenceWithFunction( mainLayer, targetWidget, caratteristiche, connectionInfo); caratteristiche.setConnectionInfo(connectionInfo); connectionLayer.addChild(connection, connectionInfo); } catch (ExpressionSyntaxException e) { DialogDisplayer.getDefault() .notify( new NotifyDescriptor.Message( NbBundle.getMessage(Costanti.class, Costanti.SYNTAX_WARNING) + " : " + e.getMessage(), DialogDescriptor.WARNING_MESSAGE)); // giannisk delete target connection if exception if caught deleteTargetConnection(sourceWidget); } }