當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。