當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultModalGraphMouse類代碼示例

本文整理匯總了Java中edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse的典型用法代碼示例。如果您正苦於以下問題:Java DefaultModalGraphMouse類的具體用法?Java DefaultModalGraphMouse怎麽用?Java DefaultModalGraphMouse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultModalGraphMouse類屬於edu.uci.ics.jung.visualization.control包,在下文中一共展示了DefaultModalGraphMouse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: DerivationViewer

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public DerivationViewer(DerivationTree g, Dimension d, Color targetColor, AnchorType anchor) {
  super(new CircleLayout<>(g));
  anchorStyle = anchor;
  DerivationTreeTransformer dtt = new DerivationTreeTransformer(g, d, false);
  StaticLayout<Node, DerivationTreeEdge> derivationLayout = new StaticLayout<>(g, dtt);
  // derivationLayout.setSize(dtt.getSize());
  setGraphLayout(derivationLayout);
  scaleToLayout(new LayoutScalingControl());
  // g.addCorrespondences();
  setPreferredSize(new Dimension(DEFAULT_HEIGHT, DEFAULT_WIDTH));
  getRenderContext().setVertexLabelTransformer(new ToStringLabeller<>());

  DefaultModalGraphMouse<Node, DerivationTreeEdge> graphMouse = new DefaultModalGraphMouse<>();
  graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
  setGraphMouse(graphMouse);
  addKeyListener(graphMouse.getModeKeyListener());
  // this.setPickedVertexState(new DerivationTreePickedState(g));

  getRenderContext().setVertexFillPaintTransformer(vp);
  getRenderContext().setEdgeStrokeTransformer(es);
  getRenderContext().setVertexShapeTransformer(ns);
  getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

  TGT = targetColor;
  anchorPoint = dtt.getAnchorPosition(anchorStyle);
}
 
開發者ID:apache,項目名稱:incubator-joshua,代碼行數:27,代碼來源:DerivationViewer.java

示例2: StateVisualizer

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public StateVisualizer() {
    super("Model Visualizer");
    graph = new DirectedSparseMultigraph<>();
    graph.addVertex(current);
//    Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
    layout = new KKLayout<>(graph);
    layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
    vv = new VisualizationViewer<>(layout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
//    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
//    vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.addKeyListener(gm.getModeKeyListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    getContentPane().add(vv);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1024, 768);
    pack();
    setVisible(true);
  }
 
開發者ID:mukatee,項目名稱:osmo,代碼行數:27,代碼來源:StateVisualizer.java

示例3: FSMBuildVisualizer

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public FSMBuildVisualizer() {
    super("Model Visualizer");
    graph = new DirectedSparseMultigraph<>();
    graph.addVertex(current);
//    Layout<FSMTransition, String> layout = new CircleLayout<FSMTransition, String>(graph);
    layout = new KKLayout<>(graph);
    layout.setSize(new Dimension(800, 600)); // sets the initial size of the space
    vv = new VisualizationViewer<>(layout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    VertexLabelAsShapeRenderer<String, StepCounter> vlasr = new VertexLabelAsShapeRenderer<>(vv.getRenderContext());
//    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexShapeTransformer(new EllipseVertexTransformer());
//    vv.getRenderContext().setVertexLabelRenderer(new TransitionVertextLabelRenderer(Color.GREEN));
    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.addKeyListener(gm.getModeKeyListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    getContentPane().add(vv);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(1024, 768);
    pack();
    setVisible(true);
  }
 
開發者ID:mukatee,項目名稱:osmo,代碼行數:27,代碼來源:FSMBuildVisualizer.java

示例4: applyStyles

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public static <V, E> void applyStyles(final VisualizationViewer<V, E> visualizationViewer) {
    final RenderContext<V, E> renderContext = visualizationViewer.getRenderContext();

    renderContext.setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM, false));
    renderContext.setEdgeStrokeTransformer(input -> stroke);
    renderContext.setEdgeDrawPaintTransformer(input -> WidgetUtils.BG_COLOR_LESS_BRIGHT);
    renderContext.setVertexLabelRenderer(new DefaultVertexLabelRenderer(WidgetUtils.BG_COLOR_BLUE_MEDIUM));
    renderContext.setEdgeFontTransformer(GraphUtils.createFontTransformer());
    renderContext.setVertexFontTransformer(GraphUtils.createFontTransformer());

    final DefaultModalGraphMouse<Object, Integer> graphMouse = new DefaultModalGraphMouse<Object, Integer>() {
        @Override
        public void mouseWheelMoved(final MouseWheelEvent e) {
            // avoid zooming
            return;
        }
    };
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
    graphMouse.setZoomAtMouse(false);

    visualizationViewer.setGraphMouse(graphMouse);
}
 
開發者ID:datacleaner,項目名稱:DataCleaner,代碼行數:23,代碼來源:GraphUtils.java

示例5: GraphRenderer

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
/**
 * Full constructor
 * 
 * @param graph
 *            The graph to render
 * @param layout
 *            The layout to use
 */
public GraphRenderer(Graph<V, E> graph, Layout<V, E> layout) {
	this.graph = graph;
	this.setBackground(Color.WHITE);
	layout.setSize(new Dimension(1680, 1050));

	final VisualizationViewer<V, E> viewer = new VisualizationViewer<V, E>(
			layout);
	viewer.setBackground(Color.WHITE);
	viewer.getRenderContext().setVertexDrawPaintTransformer(
			new BlackVertexDrawPaintFunction<V>());
	viewer.getRenderContext().setVertexFillPaintTransformer(
			new HighlightingVertexFillPaintFunction<V>());
	viewer.getRenderContext().setEdgeDrawPaintTransformer(
			new HighlightingEdgePaintFunction());
	viewer.getRenderContext().setEdgeStrokeTransformer(
			new HighlightingEdgeStrokeFunction());
	viewer.getRenderContext().setVertexLabelTransformer(
			new ToStringLabeller<V>());
	viewer.setGraphMouse(new DefaultModalGraphMouse<V, E>());

	this.setLayout(new BorderLayout());
	this.add(viewer, BorderLayout.CENTER);
}
 
開發者ID:markuskorbel,項目名稱:adt.reference,代碼行數:32,代碼來源:GraphRenderer.java

示例6: visualizeGraph

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public static <V, E> void visualizeGraph(Graph<V,E> g) {
	
	Layout<Integer, String> layout = new KKLayout(g);
       layout.setSize(new Dimension(800,800)); // sets the initial size of the layout space
       // The BasicVisualizationServer<V,E> is parameterized by the vertex and edge types
       VisualizationViewer<Integer,String> vv = new VisualizationViewer<Integer,String>(layout);
       
       DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
       gm.setMode(DefaultModalGraphMouse.Mode.TRANSFORMING);
       vv.setGraphMouse(gm);
       
      
       vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
       vv.setPreferredSize(new Dimension(800,800)); //Sets the viewing area size
       
       JFrame frame = new JFrame("Simple Graph View");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.getContentPane().add(vv); 
       frame.pack();
       frame.setVisible(true);   
}
 
開發者ID:kilick,項目名稱:kPrimaryCorridors,代碼行數:22,代碼來源:ViewGraph.java

示例7: getDefaultModalGraphMouse

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
/**
 * Gets the DefaultModalGraphMouse.
 * @return the default modal graph mouse
 */
private DefaultModalGraphMouse<GraphNode, GraphEdge> getDefaultModalGraphMouse() {
	if (defaultModalGraphMouse == null) {
		defaultModalGraphMouse = new DefaultModalGraphMouse<GraphNode, GraphEdge>(1/1.1f, 1.1f);
	}
	return defaultModalGraphMouse;
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:11,代碼來源:BasicGraphGui.java

示例8: GraphPreviewPanel

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
/**
 * create an instance of a simple graph with controls to demo the zoom features.
 *
 * @param peopleList
 *            the people list
 * @param links
 *            the links
 * @throws UNISoNException
 *             the UNI so n exception
 */
public GraphPreviewPanel(final LinkedList<String> peopleList, final List<Relationship> links)
        throws UNISoNException {
	// create a simple graph for the demo
	this.graph = new DirectedSparseGraph();
	final Vertex[] v = this.createEdges(links, peopleList);

	final PluggableRenderer pr = new PluggableRenderer();
	pr.setVertexStringer(new UnicodeVertexStringer(v, peopleList));
	pr.setVertexPaintFunction(
	        new PickableVertexPaintFunction(pr, Color.lightGray, Color.white, Color.yellow));
	pr.setGraphLabelRenderer(new DefaultGraphLabelRenderer(Color.cyan, Color.cyan));
	final VertexIconAndShapeFunction dvisf = new VertexIconAndShapeFunction(
	        new EllipseVertexShapeFunction());
	pr.setVertexShapeFunction(dvisf);
	pr.setVertexIconFunction(dvisf);
	this.vv = new VisualizationViewer(new FRLayout(this.graph), pr);
	this.vv.setPickSupport(new ShapePickSupport());
	pr.setEdgeShapeFunction(new EdgeShape.QuadCurve());
	this.vv.setBackground(Color.white);

	// add my listener for ToolTips
	this.vv.setToolTipFunction(new DefaultToolTipFunction());

	// create a frome to hold the graph
	final GraphZoomScrollPane panel = new GraphZoomScrollPane(this.vv);
	this.add(panel);
	// this.add(vv);
	final ModalGraphMouse gm = new DefaultModalGraphMouse();
	this.vv.setGraphMouse(gm);

	// showLabels = true;
}
 
開發者ID:leonarduk,項目名稱:unison,代碼行數:43,代碼來源:GraphPreviewPanel.java

示例9: main

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public static void main(String[] args) {
  DirectedSparseGraph<String, String> g = new DirectedSparseGraph<String, String>();
  g.addVertex("Square");
  g.addVertex("Rectangle");
  g.addVertex("Circle");
  g.addEdge("Edge1", "Square", "Rectangle");
  g.addEdge("Edge2", "Square", "Circle");
  g.addEdge("Edge3", "Circle", "Square");
  
  VisualizationViewer<String, String> vv =
    new VisualizationViewer<String, String>(
      new FRLayout<String, String>(g), new Dimension(400,400));
  Transformer<String, String> transformer = new Transformer<String, String>() {
    @Override public String transform(String arg0) { return arg0; }
  };
  vv.getRenderContext().setVertexLabelTransformer(transformer);
  transformer = new Transformer<String, String>() {
    @Override public String transform(String arg0) { return arg0; }
  };
  vv.getRenderContext().setEdgeLabelTransformer(transformer);
  vv.getRenderer().setVertexRenderer(new MyRenderer());
 
  // The following code adds capability for mouse picking of vertices/edges. Vertices can even be moved!
  final DefaultModalGraphMouse<String,Number> graphMouse = new DefaultModalGraphMouse<String,Number>();
  vv.setGraphMouse(graphMouse);
  graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
 
  JFrame frame = new JFrame();
  frame.getContentPane().add(vv);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.pack();
  frame.setVisible(true);
}
 
開發者ID:marcvanzee,項目名稱:mdp-plan-revision,代碼行數:34,代碼來源:VertexShapes.java

示例10: initGraph

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private void initGraph() {
	try {
		labelMap = new HashMap();
		iconMap = new HashMap();
		graph = new DelegateForest();
		treeLayout = new TreeLayout(graph);
		balloonLayout = new BalloonLayout(graph);
		vv = new VisualizationViewer(balloonLayout);
		vv.setSize(new Dimension(800, 800));
		refreshGraph();
		vv.setBackground(Color.white);
		vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
		vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
		vv.setVertexToolTipTransformer(new EntityTransformer());
		graphPanel = new GraphZoomScrollPane(vv);
		DefaultModalGraphMouse mouse = new DefaultModalGraphMouse();
		vv.setGraphMouse(mouse);
		mouse.add(new MemoriaGraphMouse(this));
		// T O D O  MemoriaPanel compile error suppress 2 lines
		//VertexStringerImpl localVertexStringerImpl = new VertexStringerImpl(/*this.labelMap*/);
		//this.vv.getRenderContext().setVertexLabelTransformer(new VertexStringerImpl(/*localVertexStringerImpl*/));
		VertexIconShapeTransformer transformer = new VertexIconShapeTransformer(new EllipseVertexShapeTransformer());
		DefaultVertexIconTransformer iconTransformer = new DefaultVertexIconTransformer();
		transformer.setIconMap(iconMap);
		iconTransformer.setIconMap(iconMap);
		vv.getRenderContext().setVertexShapeTransformer(transformer);
		vv.getRenderContext().setVertexIconTransformer(iconTransformer);
	} catch (Exception exc) {
		SbApp.error("MemoriaPanel.initGraph()",exc);
	}
}
 
開發者ID:markkohdev,項目名稱:oStorybook,代碼行數:33,代碼來源:MemoriaPanel.java

示例11: TreePane

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public TreePane(Dominoes domino) {

        
        // create a simple graph for the demo
        graph = new DelegateForest<>();
        graph.addVertex(domino.getHistoric());

        this.createTree(domino.getHistoric());

        treeLayout = new TreeLayout<>(graph);

        final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
        vv = new VisualizationViewer<>(treeLayout, new Dimension(600, 600));
        vv.setBackground(Color.white);
        vv.getRenderContext().setVertexFillPaintTransformer(new ConstantTransformer(Color.GRAY));
        vv.getRenderContext().setEdgeFillPaintTransformer(new ConstantTransformer(Color.BLACK));
        vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
        vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
        vv.setGraphMouse(graphMouse);
        // add a listener for ToolTips
        vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.WHITE));
        
        
        
        SwingNode s = new SwingNode();
        s.setContent(vv);
        this.getChildren().add(s);

    }
 
開發者ID:gems-uff,項目名稱:dominoes,代碼行數:30,代碼來源:TreePane.java

示例12: createWindow

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
private JFrame createWindow(final VisualizationViewer<Node, Edge> viewer, final String name) {
    viewer.setBackground(Color.WHITE);

    final DefaultModalGraphMouse<Node, Edge> gm = new DefaultModalGraphMouse<Node, Edge>();
    gm.setMode(DefaultModalGraphMouse.Mode.PICKING);
    viewer.setGraphMouse(gm);

    final JFrame frame = new JFrame(name + " viewer");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setLayout(new GridLayout());
    frame.getContentPane().add(viewer);
    frame.pack();

    return frame;
}
 
開發者ID:apache,項目名稱:incubator-batchee,代碼行數:16,代碼來源:DiagramGenerator.java

示例13: startFunction

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
public JPanel startFunction() {
    Graph g = getGraph();
    
    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(voltages);
    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;
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:64,代碼來源:PluggableRendererDemo.java

示例14: createGraphComponent

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
private JComponent createGraphComponent() {

        Graph<State, TransitionEdge> graph = new DirectedSparseGraph<>();

        Layout<State, TransitionEdge> layout = new StaticLayout<>(graph, new ReachGraphInitializer(graph.getVertices()));

        visualizationViewer = new VisualizationViewer<>(layout);
        DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
        gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
        visualizationViewer.setGraphMouse(gm);

        VertexLabelAsShapeRenderer<State, TransitionEdge> vertexRenderer = new VertexLabelAsShapeRenderer<>(visualizationViewer.getRenderContext());

        // vertices
        visualizationViewer.getRenderContext().setVertexLabelTransformer(state -> {
            StringBuilder sb = new StringBuilder();
            for (Integer token : state.getMarking().values()) {
                sb.append(token == -1 ? "\u221E" : token).append(",");
            }
            if (sb.length() > 0) sb.setLength(sb.length() - 1);
            return sb.toString();
        });
        visualizationViewer.getRenderContext().setVertexShapeTransformer(vertexRenderer);
        visualizationViewer.getRenderContext().setVertexFillPaintTransformer(s -> {
            if (!visualizationViewer.getPickedVertexState().getPicked().isEmpty())
                return visualizationViewer.getPickedVertexState().isPicked(s) ? ACTIVE_VERTEX_FILL_COLOR : INACTIVE_VERTEX_FILL_COLOR;
            return VERTEX_FILL_COLOR;
        });
        visualizationViewer.getRenderContext().setVertexFontTransformer(s -> FONT);
        visualizationViewer.getRenderer().setVertexLabelRenderer(vertexRenderer);

        // edges
        visualizationViewer.getRenderContext().setEdgeLabelTransformer(transition -> "T" + transition.getTransition().getId());
        visualizationViewer.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<>());
        visualizationViewer.getRenderContext().setEdgeDrawPaintTransformer(this::getEdgeColor);
        visualizationViewer.getRenderContext().setArrowDrawPaintTransformer(this::getEdgeColor);
        visualizationViewer.getRenderContext().setArrowFillPaintTransformer(this::getEdgeColor);
        visualizationViewer.getRenderContext().setEdgeFontTransformer(s -> FONT);
        visualizationViewer.getRenderContext().getEdgeLabelRenderer().setRotateEdgeLabels(false);
        ReachGraphEdgeLabelRenderer<State, TransitionEdge> reachGraphEdgeLabelRenderer = new ReachGraphEdgeLabelRenderer<>(this::getEdgeColor);
        visualizationViewer.getRenderer().setEdgeLabelRenderer(reachGraphEdgeLabelRenderer);

        visualizationViewer.setBackground(GRAPH_BACKGROUND);

        addComponentListener(new AbstractResizeComponentListener() {
            @Override
            public void componentResized(ComponentEvent e) {
                Dimension size = e.getComponent().getSize();
                layout.setSize(size);
            }
        });

        ReachGraphMouseListener graphMouseListener = new ReachGraphMouseListener(visualizationViewer, new StatePickedListener(graphService), this);
        visualizationViewer.addMouseListener(graphMouseListener);
        visualizationViewer.addGraphMouseListener(graphMouseListener);

        return visualizationViewer;
    }
 
開發者ID:tomaszi1,項目名稱:petri-nets-simulator,代碼行數:59,代碼來源:ReachabilityGraphPanel.java

示例15: CustomQueryView

import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse; //導入依賴的package包/類
/**
*   Initializer
*
*   @param inVdat VarData Object
*/
public CustomQueryView(VarData inVdat, VarSifter inGui) {
    vdat = inVdat;
    gui = inGui;
    String[] origSampleNames = vdat.returnSampleNames();  // The original names - DON'T CHANGE THIS!!
    sampleNames = new String[origSampleNames.length];
    annotNames = vdat.returnDataNames();
    dataTypeAt = vdat.returnDataTypeAt();
    sampleIndexOf = new HashMap<String,Integer>(origSampleNames.length);
    annoSize = dataTypeAt.size();
    annotMap = vdat.returnAnnotMap();

    for (int i=0; i<origSampleNames.length; i++) {
        String n = origSampleNames[i];
        sampleIndexOf.put(n, i);
        sampleNames[i] = n;
    }

    graph = new DelegateForest<CustomVertex,Integer>();
    layout = new TreeLayout<CustomVertex,Integer>(graph);
    vv = new VisualizationViewer<CustomVertex,Integer>(layout);
    VertexLabelAsShapeRenderer<CustomVertex,Integer> vlasr = new 
        VertexLabelAsShapeRenderer<CustomVertex,Integer>(vv.getRenderContext());
    vv.getRenderContext().setVertexLabelTransformer(
        new ChainedTransformer<CustomVertex,String>(new Transformer[]{
            new ToStringLabeller<String>(),
            new Transformer<String,String>() {
                public String transform(String input) {
                    return "<html><center>"+input;
                }
            }
        }));
    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderer().setVertexLabelRenderer(vlasr);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
    modeBox = graphMouse.getModeComboBox();
    modeBox.setMaximumSize(modeBox.getPreferredSize());
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);

    vv.setGraphMouse(graphMouse);

    String out = "";
    sampleList = new JList(sampleNames);
    annotList = new JList(annotNames);

    initQuery();
    initTable();
}
 
開發者ID:teerjk,項目名稱:VarSifter,代碼行數:56,代碼來源:CustomQueryView.java


注:本文中的edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。