use of org.talend.dq.indicators.graph.DirectionDisplayPredicate in project tdq-studio-se by Talend.
the class MyFullDemoMain method startFunction.
public JPanel startFunction() {
final GraphBuilder graphBuilder = new GraphBuilder();
// getGraph();
Graph g = graphBuilder.createMultiGraph(MyFirstMain.createListObjects());
// init variables
edge_weight = graphBuilder.getEdgeWeight();
vertexWeights = graphBuilder.getVertexWeight();
final GraphRenderer graphRenderer = new GraphRenderer();
// pr = graphRenderer.createPluggableRenderer();
pr = new PluggableRenderer();
Layout layout = new FRLayout(g);
vv = new VisualizationViewer(layout, pr);
// add Shape based pick support
vv.setPickSupport(new ShapePickSupport());
PickedState picked_state = vv.getPickedState();
affineTransformer = vv.getLayoutTransformer();
// create decorators
vcf = new SeedColor(picked_state);
ewcs = new EdgeWeightStrokeFunction(edge_weight);
vsh = new VertexStrokeHighlight(picked_state);
ff = new FontHandler();
vs_none = new ConstantVertexStringer(null);
es_none = new ConstantEdgeStringer(null);
vssa = new VertexShapeSizeAspect(vertexWeights);
show_edge = new DirectionDisplayPredicate(true, true);
show_arrow = new DirectionDisplayPredicate(true, false);
show_vertex = new VertexDisplayPredicate(false);
// uses a gradient edge if unpicked, otherwise uses picked selection
edgePaint = new GradientPickedEdgePaintFunction(new PickableEdgePaintFunction(picked_state, Color.black, Color.cyan), vv, vv, picked_state);
pr.setVertexPaintFunction(vcf);
pr.setVertexStrokeFunction(vsh);
pr.setVertexStringer(vs_none);
pr.setVertexFontFunction(ff);
pr.setVertexShapeFunction(vssa);
pr.setVertexIncludePredicate(show_vertex);
pr.setEdgePaintFunction(edgePaint);
pr.setEdgeStringer(es_none);
pr.setEdgeFontFunction(ff);
pr.setEdgeStrokeFunction(ewcs);
pr.setEdgeIncludePredicate(show_edge);
pr.setEdgeShapeFunction(new EdgeShape.Line());
pr.setEdgeArrowPredicate(show_arrow);
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
vv.setBackground(Color.white);
GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
jp.add(scrollPane);
gm = new DefaultModalGraphMouse();
vv.setGraphMouse(gm);
gm.add(new PopupGraphMousePlugin());
addBottomControls(jp);
vssa.setScaling(true);
vv.setToolTipFunction(new VoltageTips());
vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");
return jp;
}
Aggregations