当前位置: 首页>>代码示例>>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;未经允许,请勿转载。