/** * */ public mxGraphControl() { addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (translate.x != 0 || translate.y != 0) { translate = new Point(0, 0); repaint(); } } }); }
/** * */ public mxGraphControl() { addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (translate.x != 0 || translate.y != 0) { translate = new Point(0, 0); repaint(); } } }); }
graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this);
graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this);
graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this);
graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this);
/** * Adds handling of edit and stop-edit events after all other handlers have * been installed. */ protected void installDoubleClickHandler() { graphControl.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (isEnabled()) { if (!e.isConsumed() && isEditEvent(e)) { Object cell = getCellAt(e.getX(), e.getY(), false); if (cell != null && getGraph().isCellEditable(cell)) { startEditingAtCell(cell, e); } } else { // Other languages use focus traversal here, in Java // we explicitely stop editing after a click elsewhere stopEditing(!invokesStopCellEditing); } } } }); }
/** * Adds handling of edit and stop-edit events after all other handlers have * been installed. */ protected void installDoubleClickHandler() { graphControl.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (isEnabled()) { if (!e.isConsumed() && isEditEvent(e)) { Object cell = getCellAt(e.getX(), e.getY(), false); if (cell != null && getGraph().isCellEditable(cell)) { startEditingAtCell(cell, e); } } else { // Other languages use focus traversal here, in Java // we explicitely stop editing after a click elsewhere stopEditing(!invokesStopCellEditing); } } } }); }
/** * Constructs a new rotation handler. */ public mxRotationHandler(mxGraphComponent graphComponent) { this.graphComponent = graphComponent; graphComponent.addMouseListener(this); handle = createHandle(); // Installs the paint handler graphComponent.addListener(mxEvent.AFTER_PAINT, new mxIEventListener() { public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } }); // Listens to all mouse events on the rendering control graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); // Needs to catch events because these are consumed handle.addMouseListener(this); handle.addMouseMotionListener(this); }
/** * Constructs a new rotation handler. */ public mxRotationHandler(mxGraphComponent graphComponent) { this.graphComponent = graphComponent; graphComponent.addMouseListener(this); handle = createHandle(); // Installs the paint handler graphComponent.addListener(mxEvent.AFTER_PAINT, new mxIEventListener() { public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } }); // Listens to all mouse events on the rendering control graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); // Needs to catch events because these are consumed handle.addMouseListener(this); handle.addMouseMotionListener(this); }
/** * Perform default init. */ public void init(ModelContainer modelcontainer) { setDragEnabled(false); setPanning(true); setCenterZoom(false); setAutoscrolls(true); setAutoExtend(true); getViewport().setOpaque(false); setBackground(Color.WHITE); setOpaque(true); setTextAntiAlias(true); modelcontainer.setGraphComponent(this); MouseController mc = new MouseController(modelcontainer); getGraphControl().addMouseListener(mc); getGraphControl().addMouseWheelListener(mc); new DeletionController(modelcontainer); new KeyboardController(this, modelcontainer); new mxRubberband(this); }
/** * */ public mxInsertHandler(mxGraphComponent graphComponent, String style) { this.graphComponent = graphComponent; this.style = style; // Installs the paint handler graphComponent.addListener(mxEvent.AFTER_PAINT, new mxIEventListener() { public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } }); // Listens to all mouse events on the rendering control graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }
/** * */ public mxInsertHandler(mxGraphComponent graphComponent, String style) { this.graphComponent = graphComponent; this.style = style; // Installs the paint handler graphComponent.addListener(mxEvent.AFTER_PAINT, new mxIEventListener() { public void invoke(Object sender, mxEventObject evt) { Graphics g = (Graphics) evt.getProperty("g"); paint(g); } }); // Listens to all mouse events on the rendering control graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }
@Override protected void installDoubleClickHandler() { graphControl.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent ev) { if (nodeExploder != null && !ev.isConsumed() && isEditEvent(ev)) { Object cell = getCellAt(ev.getX(), ev.getY(), false); if (cell != null && getGraph().isCellEditable(cell)) { String nodeLabel = (String) graph.getModel().getValue(cell); if (nodeLabel != null) { nodeExploder.explode(nodeLabel); } } } } }); } }
/** * installs a handler to set the focus to the container. */ protected void installFocusHandler() { graphControl.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (!hasFocus()) { requestFocus(); } } }); }
/** * installs a handler to set the focus to the container. */ protected void installFocusHandler() { graphControl.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (!hasFocus()) { requestFocus(); } } }); }
/** * * @param graphComponent */ public mxPanningHandler(mxGraphComponent graphComponent) { this.graphComponent = graphComponent; graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }
/** * Constructs an event handler that highlights cells. */ public mxCellTracker(mxGraphComponent graphComponent, Color color) { super(graphComponent, color); graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }
/** * * @param graphComponent */ public mxPanningHandler(mxGraphComponent graphComponent) { this.graphComponent = graphComponent; graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }
/** * Constructs an event handler that highlights cells. */ public mxCellTracker(mxGraphComponent graphComponent, Color color) { super(graphComponent, color); graphComponent.getGraphControl().addMouseListener(this); graphComponent.getGraphControl().addMouseMotionListener(this); }