public void mouseDragged(MouseEvent e) { if (startPort != null) { mouseMoved(e); } else { super.mouseDragged(e); } }
public void mousePressed(MouseEvent e) { if (startPort == null) { super.mousePressed(e); } }
/** * Returns an instance of <code>JGraph</code> which displays the specified * data model using the specified view. * * @param model * the <code>GraphModel</code> to use as the data model * @param cache * the <code>GraphLayoutCache</code> to use as the cache */ public JGraph(GraphModel model, GraphLayoutCache cache) { this(model, cache, new BasicMarqueeHandler()); }
g.setColor(fg); g.setXORMode(bg); overlay(graph, g, true); processMouseDraggedEvent(e); g.setColor(bg); g.setXORMode(fg); overlay(graph, g, false); } else { dirty.add(marqueeBounds);
marquee.mouseReleased(null); if (mouseListener != null) mouseListener.mouseReleased(null);
/** * Returning true signifies the marquee handler has precedence over other * handlers, and is receiving subsequent mouse events. */ public boolean isForceMarqueeEvent(MouseEvent event) { if (marquee != null) return marquee.isForceMarqueeEvent(event); return false; }
/** * Called after the component was repainted (after autoscroll). This is used * to indicate that the graphics is no more dirty. */ public void paint(JGraph graph, Graphics g) { if (marqueeBounds != null) { if (graph.isXorEnabled()) { Color bg = graph.getBackground(); Color fg = graph.getMarqueeColor(); g.setColor(fg); g.setXORMode(bg); } overlay(graph, g, false); } }
/** * Start the marquee at the specified startPoint. This invokes * expandMarqueeToPoint to initialize marquee selection. */ public void mousePressed(MouseEvent e) { startPoint = e.getPoint(); marqueeBounds = new Rectangle2D.Double(startPoint.getX(), startPoint .getY(), 0, 0); if (!(e.getSource() instanceof JGraph)) throw new IllegalArgumentException( "MarqueeHandler cannot handle event from unknown source: " + e); JGraph graph = (JGraph) e.getSource(); if (isMarqueeTriggerEvent(e, graph)) { previousCursor = graph.getCursor(); graph.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); } }
/** * Stops the current marquee selection. */ public void mouseReleased(MouseEvent e) { try { if (e != null && marqueeBounds != null) { if (!(e.getSource() instanceof JGraph)) throw new IllegalArgumentException("MarqueeHandler cannot " + "handle event from unknown source: " + e); JGraph graph = (JGraph) e.getSource(); Rectangle2D bounds = graph .fromScreen((Rectangle2D) marqueeBounds.clone()); handleMarqueeEvent(e, graph, bounds); graph.setCursor(previousCursor); Rectangle dirty = new Rectangle((int) marqueeBounds.getX(), (int) marqueeBounds.getY(), (int) marqueeBounds .getWidth() + 1, (int) marqueeBounds .getHeight() + 1); dirty.width++; dirty.height++; graph.repaint(dirty); } } finally { currentPoint = null; startPoint = null; marqueeBounds = null; previousCursor = null; } }
/** * Description of the Method * *@param e Description of Parameter */ public void mouseMoved(MouseEvent e) { // Check Mode and Find Port if (e != null && getGraph()!=null && getSourcePortAt(e.getPoint()) != null && !e.isConsumed() && getGraph().isPortsVisible()) { // Set Cusor on Graph (Automatically Reset) getGraph().setCursor(new Cursor(Cursor.HAND_CURSOR)); // Consume Event e.consume(); } // Call Superclass super.mouseReleased(e); }
/** * Gets the forceMarqueeEvent attribute of the MarqueeHandler object * *@param e Description of Parameter *@return The forceMarqueeEvent value */ public boolean isForceMarqueeEvent(MouseEvent e) { // If Right Mouse Button we want to Display the PopupMenu if (SwingUtilities.isRightMouseButton(e)) { // Return Immediately return true; } // Find and Remember Port port = getSourcePortAt(e.getPoint()); // If Port Found and in ConnectMode (=Ports Visible) if (port != null && getGraph().isPortsVisible()) { return true; } // Else Call Superclass return super.isForceMarqueeEvent(e); }
super.overlay(graph, g, clear);
/** * Invoked when the mouse pointer has been moved on a component (with no * buttons down). */ public void mouseMoved(MouseEvent e) { if (previousCursor == null) { previousCursor = graph.getCursor(); } if (graph != null && graph.isEnabled()) { if (marquee != null) marquee.mouseMoved(e); if (handle != null) handle.mouseMoved(e); if (!e.isConsumed() && previousCursor != null) { Cursor currentCursor = graph.getCursor(); if (currentCursor != previousCursor) { graph.setCursor(previousCursor); } previousCursor = null; } } }
Object[] valparFactory = {resources,ids}; Class[] consparModel = {mde.getClass(), String.class,ObjectManager.class, Model.class,BasicMarqueeHandler.class, Preferences.class}; Object[] valparModel = {mde,id,ids.om,new Model(ids),new BasicMarqueeHandler(), ids.prefs};
start = current = null; super.mouseReleased(e); if (getGraph()!=null){
public void mouseDragged(MouseEvent e) { autoscroll(graph, e.getPoint()); if (graph.isEnabled()) { if (handler != null && handler == marquee) marquee.mouseDragged(e); else if (handler == null && !isEditing(graph) && focus != null) { if (!graph.isCellSelected(focus.getCell())) { selectCellForEvent(focus.getCell(), e); cell = null; } if (handle != null) handle.mousePressed(e); handler = handle; } if (handle != null && handler == handle) handle.mouseDragged(e); } }
public synchronized JGraph cloneJGraph(IDEState ids){ OrganizationModelModelJGraph jg=new OrganizationModelModelJGraph( (OrganizationModelDataEntity) this.mde,name, ids.om, new Model(ids),new BasicMarqueeHandler(),ids.prefs); this.setSelectionCells(getGraphLayoutCache().getCells(false,true,false,false)); Action copyaction =new EventRedirectorForGraphCopy(this,this.getTransferHandler().getCopyAction(),null ); Action pasteaction =new EventRedirectorPasteForGraphCopy(jg,jg.getTransferHandler().getPasteAction(),null ); copyaction.actionPerformed(new ActionEvent(this,0,"hello")); pasteaction.actionPerformed(new ActionEvent(this,0,"hello")); jg.invalidate(); jg.doLayout(); return jg; }
public void mouseReleased(MouseEvent e) { try { if (e != null && !e.isConsumed() && graph != null && graph.isEnabled()) { if (handler == marquee && marquee != null) marquee.mouseReleased(e); else if (handler == handle && handle != null) handle.mouseReleased(e); if (isDescendant(cell, focus) && e.getModifiers() != 0) { // Do not switch to parent if Special Selection cell = focus; } if (!e.isConsumed() && cell != null) { Object tmp = cell.getCell(); boolean wasSelected = graph.isCellSelected(tmp); if (!e.isPopupTrigger() || !wasSelected) { selectCellForEvent(tmp, e); focus = cell; postProcessSelection(e, tmp, wasSelected); } } } } finally { handler = null; cell = null; } }