当前位置: 首页>>代码示例>>Java>>正文


Java VisualizationViewer.repaint方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.visualization.VisualizationViewer.repaint方法的典型用法代码示例。如果您正苦于以下问题:Java VisualizationViewer.repaint方法的具体用法?Java VisualizationViewer.repaint怎么用?Java VisualizationViewer.repaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.visualization.VisualizationViewer的用法示例。


在下文中一共展示了VisualizationViewer.repaint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * If the mouse is pressed in an empty area, create a new vertex there.
 * If the mouse is pressed on an existing vertex, prepare to create
 * an edge from that vertex to another
 */
@SuppressWarnings("unchecked")
public void mousePressed(MouseEvent e) {
    if(checkModifiers(e)) {
        final VisualizationViewer<String,String> vv =
            (VisualizationViewer<String,String>)e.getSource();
        final Point2D p = e.getPoint();
        GraphElementAccessor<String,String> pickSupport = vv.getPickSupport();
        if(pickSupport != null) {
        	
            final String vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY());
            if(vertex != null) { // get ready to make an edge
                startVertex = vertex;
                down = e.getPoint();
                transformEdgeShape(down, down);
                vv.addPostRenderPaintable(edgePaintable);
                transformArrowShape(down, e.getPoint());
                vv.addPostRenderPaintable(arrowPaintable);
            }
        }
        vv.repaint();
    }
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:28,代码来源:RoleGraphEditingPlugin.java

示例2: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	if (down != null) {
		MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer()
				.getTransformer(Layer.LAYOUT);
		Point2D p1 = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
		Point2D p2 = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());

		modelTransformer.translate(p2.getX() - p1.getX(), p2.getY() - p1.getY());
		down = e.getPoint();
		vv.repaint();

		changed = true;
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:18,代码来源:BetterTranslatingGraphMousePlugin.java

示例3: mouseWheelMoved

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
	if (e.getWheelRotation() == 0) {
		return;
	}

	VisualizationViewer<?, ?> vv = (VisualizationViewer<?, ?>) e.getSource();

	new LayoutScalingControl().scale(vv, e.getWheelRotation() > 0 ? in : out, e.getPoint());
	vv.repaint();

	if (lastTask != null) {
		lastTask.cancel(false);
	}

	lastTask = scheduler.schedule(
			() -> Stream.of(listeners.getListeners(JungListener.class)).forEach(l -> l.transformFinished()), 200,
			TimeUnit.MILLISECONDS);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:20,代码来源:BetterScalingGraphMousePlugin.java

示例4: mouseWheelMoved

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * zoom the master view display in or out, depending on the direction of the
 * mouse wheel motion.
 */
public void mouseWheelMoved(MouseWheelEvent e) {
    boolean accepted = checkModifiers(e);
    if(accepted == true) {
        VisualizationViewer vv = (VisualizationViewer)e.getSource();

        if(vv instanceof SatelliteVisualizationViewer) {
            VisualizationViewer vvMaster = 
                ((SatelliteVisualizationViewer)vv).getMaster();

            int amount = e.getWheelRotation();
            
            if(amount > 0) {
                scaler.scale(vvMaster, in, vvMaster.getCenter());

            } else if(amount < 0) {
                scaler.scale(vvMaster, out, vvMaster.getCenter());
            }
            e.consume();
            vv.repaint();
        }
    }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:27,代码来源:SatelliteScalingGraphMousePlugin.java

示例5: mouseWheelMoved

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * zoom the display in or out, depending on the direction of the
 * mouse wheel motion.
 */
public void mouseWheelMoved(MouseWheelEvent e) {
       boolean accepted = checkModifiers(e);
       if(accepted == true) {
           VisualizationViewer vv = (VisualizationViewer)e.getSource();
           Point2D mouse = e.getPoint();
           Point2D center = vv.getCenter();
           int amount = e.getWheelRotation();
           if(zoomAtMouse) {
               if(amount > 0) {
                   scaler.scale(vv, in, mouse);
               } else if(amount < 0) {
                   scaler.scale(vv, out, mouse);
               }
           } else {
               if(amount > 0) {
                   scaler.scale(vv, in, center);
               } else if(amount < 0) {
                   scaler.scale(vv, out, center);
               }
           }
           e.consume();
           vv.repaint();
       }
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:29,代码来源:ScalingGraphMousePlugin.java

示例6: mouseWheelMoved

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
* zoom the display in or out, depending on the direction of the
* mouse wheel motion.
*/
  public void mouseWheelMoved(MouseWheelEvent e) {
      boolean accepted = checkModifiers(e);
      float delta = this.delta;
      if(accepted == true) {
          VisualizationViewer vv = (VisualizationViewer)e.getSource();
          MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          MutableTransformer viewTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
          int amount = e.getWheelRotation();
          if(amount < 0) {
              delta = -delta;
          }
          changeMagnification(modelTransformer, delta);
          changeMagnification(viewTransformer, delta);
          vv.repaint();
          e.consume();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:22,代码来源:LensMagnificationGraphMousePlugin.java

示例7: mousePressed

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * Check the event modifiers. Set the 'down' point for later
 * use. If this event satisfies the modifiers, change the cursor
 * to the system 'move cursor'
 * @param e the event
 */
public void mousePressed(MouseEvent e) {
    VisualizationViewer vv = (VisualizationViewer)e.getSource();
    MutableTransformer vt = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
    if(vt instanceof LensTransformer) {
    	vt = ((LensTransformer)vt).getDelegate();
    }
    Point2D p = vt.inverseTransform(e.getPoint());
    boolean accepted = checkModifiers(e);
    if(accepted) {
        vv.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
        testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT), p);
        testViewCenter(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW), p);
        vv.repaint();
    }
    super.mousePressed(e);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:23,代码来源:LensTranslatingGraphMousePlugin.java

示例8: mouseReleased

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
    * If startVertex is non-null, and the mouse is released over an
    * existing vertex, create an undirected edge from startVertex to
    * the vertex under the mouse pointer. If shift was also pressed,
    * create a directed edge instead.
    */
   @SuppressWarnings("unchecked")
public void mouseReleased(MouseEvent e) {
       if(checkModifiers(e)) {
           final VisualizationViewer<V,E> vv =
               (VisualizationViewer<V,E>)e.getSource();
           final Point2D p = e.getPoint();
           Layout<V,E> layout = vv.getModel().getGraphLayout();
           GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
           if(pickSupport != null) {
               final V vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
               if(vertex != null && startVertex != null) {
                   Graph<V,E> graph = 
                   	vv.getGraphLayout().getGraph();
                       graph.addEdge(edgeFactory.create(),
                       		startVertex, vertex, edgeIsDirected);
                   vv.repaint();
               }
           }
           startVertex = null;
           down = null;
           edgeIsDirected = EdgeType.UNDIRECTED;
           vv.removePostRenderPaintable(edgePaintable);
           vv.removePostRenderPaintable(arrowPaintable);
       }
   }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:32,代码来源:EditingGraphMousePlugin.java

示例9: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
   * chack the modifiers. If accepted, translate the graph according
   * to the dragging of the mouse pointer
   * @param e the event
*/
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer vv = (VisualizationViewer)e.getSource();
      boolean accepted = checkModifiers(e);
      if(accepted) {
          MutableTransformer modelTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
          vv.setCursor(cursor);
          try {
              Point2D q = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
              Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
              float dx = (float) (p.getX()-q.getX());
              float dy = (float) (p.getY()-q.getY());
              
              modelTransformer.translate(dx, dy);
              down.x = e.getX();
              down.y = e.getY();
          } catch(RuntimeException ex) {
              System.err.println("down = "+down+", e = "+e);
              throw ex;
          }
      
          e.consume();
          vv.repaint();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:30,代码来源:TranslatingGraphMousePlugin.java

示例10: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
* Draws the transient Paintable that will become
* a Shape annotation when the mouse button is
* released
* 
*/
  @SuppressWarnings("unchecked")
  public void mouseDragged(MouseEvent e) {
      VisualizationViewer<V,E> vv = (VisualizationViewer)e.getSource();

  	Point2D out = e.getPoint();
  	if(e.getModifiers() == additionalModifiers) {
          rectangularShape.setFrameFromDiagonal(down,out);
  		
  	} else if(e.getModifiers() == modifiers) {
          rectangularShape.setFrameFromDiagonal(down,out);
  		
  	}
      rectangularShape.setFrameFromDiagonal(down,out);
      vv.repaint();
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:22,代码来源:AnnotatingGraphMousePlugin.java

示例11: mouseDraggedSuperAction

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * This is the MouseDragged super action of the super class (because of several exceptions).
 * @param me the MouseEvent
 */
private void mouseDraggedSuperAction(MouseEvent me) {

	if(locked == false) {
           VisualizationViewer<GraphNode,GraphEdge> vv = this.basicGraphGUI.getVisualizationViewer();
           if(vertex != null) {
               Point p = me.getPoint();
               Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p);
               Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
               Layout<GraphNode,GraphEdge> layout = vv.getGraphLayout();
               double dx = graphPoint.getX()-graphDown.getX();
               double dy = graphPoint.getY()-graphDown.getY();
               PickedState<GraphNode> ps = vv.getPickedVertexState();
               
               for(GraphNode v : ps.getPicked()) {
                   Point2D vp = layout.transform(v);
                   vp.setLocation(vp.getX()+dx, vp.getY()+dy);
                   layout.setLocation(v, vp);
               }
               down = p;
               me.consume();
               vv.repaint();
               
           } else {
               Point2D out = me.getPoint();
               if(me.getModifiers() == this.addToSelectionModifiers || me.getModifiers() == modifiers) {
                   if (down!=null) {
                   	rect.setFrameFromDiagonal(down,out);
                   	vv.repaint();
                   }
               }
           }
       }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:38,代码来源:GraphEnvironmentMousePlugin.java

示例12: mouseDragged

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
/**
 * If the mouse is over a picked vertex, drag all picked
 * vertices with the mouse.
 * If the mouse is not over a Vertex, draw the rectangle
 * to select multiple Vertices
 */
@SuppressWarnings("unchecked")
public void mouseDragged( MouseEvent e ) {
    if (locked == false) {
        VisualizationViewer<Room, Exit> vv = (VisualizationViewer) e.getSource();
        if (room != null) {
            Point p = e.getPoint();
            Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform( p );
            Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform( down );
            Layout<Room, Exit> layout = vv.getGraphLayout();
            double dx = graphPoint.getX() - graphDown.getX();
            double dy = graphPoint.getY() - graphDown.getY();
            PickedState<Room> ps = vv.getPickedVertexState();

            for (Room v : ps.getPicked()) {
                Point2D vp = layout.transform( v );
                vp.setLocation( vp.getX() + dx, vp.getY() + dy );
                layout.setLocation( v, vp );
            }
            down = p;

        } else {
            Point2D out = e.getPoint();
            if (e.getModifiers() == this.addToSelectionModifiers ||
                    e.getModifiers() == modifiers) {
                rect.setFrameFromDiagonal( down, out );
            }
        }
        if (room != null) e.consume();
        vv.repaint();
    }
}
 
开发者ID:lauriholmas,项目名称:batmapper,代码行数:38,代码来源:MapperPickingGraphMousePlugin.java

示例13: showGrid

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
protected void showGrid(VisualizationViewer vv, boolean state) {
		if(state == true) {
			vv.addPreRenderPaintable(viewGrid);
		} else {
			vv.removePreRenderPaintable(viewGrid);
		}
    vv.repaint();
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:9,代码来源:SatelliteViewDemo.java

示例14: cleanup

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
public void cleanup( VisualizationViewer<V, E> vv ) {
	// trying to fix the superimposed arrows when we have nothing to connect to
	// FIXME: this doesn't actually work at the moment
	startVertex = null;
	super.getEdgeEffects().endEdgeEffects( vv );
	super.getEdgeEffects().endArrowEffects( vv );
	vv.repaint();
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:9,代码来源:QueryGraphMousePlugin.java

示例15: mouseWheelMoved

import edu.uci.ics.jung.visualization.VisualizationViewer; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent e)
{
    boolean accepted = this.checkModifiers(e);
    if (accepted)
    {
        VisualizationViewer vv = (VisualizationViewer) e.getSource();
        int amount = e.getWheelRotation();
        if (this.zoomAtMouse)
        {
            if (amount > 0)
            {
                stateController.zoomOut();
            } else if (amount < 0)
            {
                stateController.zoomIn();
            }
        } else if (amount > 0)
        {
            stateController.zoomOut();
        } else if (amount < 0)
        {
            stateController.zoomIn();
        }

        e.consume();
        vv.repaint();
    }

}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:31,代码来源:JUNGCanvas.java


注:本文中的edu.uci.ics.jung.visualization.VisualizationViewer.repaint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。