use of org.cytoscape.ding.impl.BendImpl in project cytoscape-impl by cytoscape.
the class EdgeBendTest method testEdgeBend.
@Test
public void testEdgeBend() {
Bend bend1 = new BendImpl();
bend1.insertHandleAt(0, new HandleImpl(null, null, 10, 20));
}
use of org.cytoscape.ding.impl.BendImpl in project cytoscape-impl by cytoscape.
the class EdgeBendValueEditor method updateUI.
private void updateUI(Bend startBend) {
innerPanel.removeAll();
final Color NODE_COLOR = UIManager.getColor("Label.disabledForeground");
final Color EDGE_COLOR = UIManager.getColor("Label.foreground");
final Color SELECTION_COLOR = UIManager.getColor("Focus.color");
final Color BACKGROUND_COLOR = UIManager.getColor("Table.background");
// Create very simple dummy view.
final CyNetworkFactory networkFactory = serviceRegistrar.getService(CyNetworkFactory.class);
final CyNetwork dummyNet = networkFactory.createNetworkWithPrivateTables(SavePolicy.DO_NOT_SAVE);
final CyNode source = dummyNet.addNode();
final CyNode target = dummyNet.addNode();
final CyEdge edge = dummyNet.addEdge(source, target, true);
// TODO Unfortunately, handles cannot be clicked when the edge is selected like this
// dummyNet.getRow(edge, CyNetwork.DEFAULT_ATTRS).set(CyNetwork.SELECTED, true);
// Create View
dummyView = cyNetworkViewFactory.createNetworkView(dummyNet);
// Set appearances of the view
final View<CyNode> sourceView = dummyView.getNodeView(source);
final View<CyNode> targetView = dummyView.getNodeView(target);
edgeView = dummyView.getEdgeView(edge);
dummyView.setVisualProperty(NETWORK_BACKGROUND_PAINT, BACKGROUND_COLOR);
sourceView.setVisualProperty(NODE_FILL_COLOR, NODE_COLOR);
targetView.setVisualProperty(NODE_FILL_COLOR, NODE_COLOR);
sourceView.setVisualProperty(NODE_LABEL_COLOR, BACKGROUND_COLOR);
targetView.setVisualProperty(NODE_LABEL_COLOR, BACKGROUND_COLOR);
sourceView.setVisualProperty(NODE_SELECTED_PAINT, SELECTION_COLOR);
targetView.setVisualProperty(NODE_SELECTED_PAINT, SELECTION_COLOR);
sourceView.setVisualProperty(NODE_LABEL_FONT_SIZE, 16);
targetView.setVisualProperty(NODE_LABEL_FONT_SIZE, 16);
sourceView.setVisualProperty(NODE_LABEL, "S");
targetView.setVisualProperty(NODE_LABEL, "T");
sourceView.setVisualProperty(NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
targetView.setVisualProperty(NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
sourceView.setVisualProperty(NODE_WIDTH, 40d);
sourceView.setVisualProperty(NODE_HEIGHT, 40d);
sourceView.setVisualProperty(NODE_BORDER_PAINT, NODE_COLOR);
targetView.setVisualProperty(NODE_WIDTH, 40d);
targetView.setVisualProperty(NODE_HEIGHT, 40d);
targetView.setVisualProperty(NODE_BORDER_PAINT, NODE_COLOR);
edgeView.setVisualProperty(EDGE_SELECTED_PAINT, SELECTION_COLOR);
edgeView.setVisualProperty(EDGE_STROKE_SELECTED_PAINT, SELECTION_COLOR);
edgeView.setVisualProperty(EDGE_STROKE_UNSELECTED_PAINT, EDGE_COLOR);
edgeView.setVisualProperty(EDGE_WIDTH, 4d);
edgeView.setVisualProperty(EDGE_TARGET_ARROW_SHAPE, ArrowShapeVisualProperty.ARROW);
edgeView.setVisualProperty(DVisualLexicon.EDGE_TARGET_ARROW_UNSELECTED_PAINT, EDGE_COLOR);
edgeView.setVisualProperty(DVisualLexicon.EDGE_CURVED, true);
if (startBend == null || startBend.equals(EDGE_BEND.getDefault()))
startBend = new BendImpl();
edgeView.setVisualProperty(EDGE_BEND, startBend);
sourceView.setVisualProperty(NODE_X_LOCATION, 0d);
sourceView.setVisualProperty(NODE_Y_LOCATION, 100d);
targetView.setVisualProperty(NODE_X_LOCATION, 400d);
targetView.setVisualProperty(NODE_Y_LOCATION, 120d);
// Render it in this panel. It is not necessary to register this engine to manager.
presentationFactory.createRenderingEngine(innerPanel, dummyView);
final InnerCanvas innerCanvas = (InnerCanvas) innerPanel.getComponent(0);
innerCanvas.disablePopupMenu();
}
Aggregations