Search in sources :

Example 1 with VertexShapeSizeAspect

use of org.talend.dq.indicators.graph.VertexShapeSizeAspect 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;
}
Also used : JPanel(javax.swing.JPanel) ConstantEdgeStringer(edu.uci.ics.jung.graph.decorators.ConstantEdgeStringer) PickableEdgePaintFunction(edu.uci.ics.jung.graph.decorators.PickableEdgePaintFunction) FRLayout(edu.uci.ics.jung.visualization.FRLayout) GradientPickedEdgePaintFunction(org.talend.dq.indicators.graph.GradientPickedEdgePaintFunction) FontHandler(org.talend.dq.indicators.graph.FontHandler) BorderLayout(java.awt.BorderLayout) VisualizationViewer(edu.uci.ics.jung.visualization.VisualizationViewer) GraphBuilder(org.talend.dq.indicators.graph.GraphBuilder) ShapePickSupport(edu.uci.ics.jung.visualization.ShapePickSupport) DirectionDisplayPredicate(org.talend.dq.indicators.graph.DirectionDisplayPredicate) EdgeShape(edu.uci.ics.jung.graph.decorators.EdgeShape) DefaultModalGraphMouse(edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse) EdgeWeightStrokeFunction(org.talend.dq.indicators.graph.EdgeWeightStrokeFunction) GraphZoomScrollPane(edu.uci.ics.jung.visualization.GraphZoomScrollPane) ConstantVertexStringer(edu.uci.ics.jung.graph.decorators.ConstantVertexStringer) VertexDisplayPredicate(org.talend.dq.indicators.graph.VertexDisplayPredicate) GraphRenderer(org.talend.dq.indicators.graph.GraphRenderer) Layout(edu.uci.ics.jung.visualization.Layout) FRLayout(edu.uci.ics.jung.visualization.FRLayout) BorderLayout(java.awt.BorderLayout) GridLayout(java.awt.GridLayout) AbstractPopupGraphMousePlugin(edu.uci.ics.jung.visualization.control.AbstractPopupGraphMousePlugin) PluggableRenderer(edu.uci.ics.jung.visualization.PluggableRenderer) PickedState(edu.uci.ics.jung.visualization.PickedState) VertexShapeSizeAspect(org.talend.dq.indicators.graph.VertexShapeSizeAspect) VertexStrokeHighlight(org.talend.dq.indicators.graph.VertexStrokeHighlight)

Aggregations

ConstantEdgeStringer (edu.uci.ics.jung.graph.decorators.ConstantEdgeStringer)1 ConstantVertexStringer (edu.uci.ics.jung.graph.decorators.ConstantVertexStringer)1 EdgeShape (edu.uci.ics.jung.graph.decorators.EdgeShape)1 PickableEdgePaintFunction (edu.uci.ics.jung.graph.decorators.PickableEdgePaintFunction)1 FRLayout (edu.uci.ics.jung.visualization.FRLayout)1 GraphZoomScrollPane (edu.uci.ics.jung.visualization.GraphZoomScrollPane)1 Layout (edu.uci.ics.jung.visualization.Layout)1 PickedState (edu.uci.ics.jung.visualization.PickedState)1 PluggableRenderer (edu.uci.ics.jung.visualization.PluggableRenderer)1 ShapePickSupport (edu.uci.ics.jung.visualization.ShapePickSupport)1 VisualizationViewer (edu.uci.ics.jung.visualization.VisualizationViewer)1 AbstractPopupGraphMousePlugin (edu.uci.ics.jung.visualization.control.AbstractPopupGraphMousePlugin)1 DefaultModalGraphMouse (edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse)1 BorderLayout (java.awt.BorderLayout)1 GridLayout (java.awt.GridLayout)1 JPanel (javax.swing.JPanel)1 DirectionDisplayPredicate (org.talend.dq.indicators.graph.DirectionDisplayPredicate)1 EdgeWeightStrokeFunction (org.talend.dq.indicators.graph.EdgeWeightStrokeFunction)1 FontHandler (org.talend.dq.indicators.graph.FontHandler)1 GradientPickedEdgePaintFunction (org.talend.dq.indicators.graph.GradientPickedEdgePaintFunction)1