/** * Dispatches the given event name with this object as the event source. * <code>fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))</code> * */ public void fireEvent(mxEventObject evt) { fireEvent(evt, null); }
/** * Dispatches the given event name with this object as the event source. * <code>fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))</code> * */ public void fireEvent(mxEventObject evt) { fireEvent(evt, null); }
/** * Notified when an overlay has been removed from the graph. This * implementation removes the given overlay from its parent if it is a * component inside a component hierarchy. */ protected void removeCellOverlayComponent(mxICellOverlay overlay, Object cell) { if (overlay instanceof Component) { Component comp = (Component) overlay; if (comp.getParent() != null) { comp.setVisible(false); comp.getParent().remove(comp); eventSource.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, "cell", cell, "overlay", overlay)); } } }
/** * Notified when an overlay has been removed from the graph. This * implementation removes the given overlay from its parent if it is a * component inside a component hierarchy. */ protected void removeCellOverlayComponent(mxICellOverlay overlay, Object cell) { if (overlay instanceof Component) { Component comp = (Component) overlay; if (comp.getParent() != null) { comp.setVisible(false); comp.getParent().remove(comp); eventSource.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY, "cell", cell, "overlay", overlay)); } } }
/** * Hides the marker and fires a mxEvent.MARK event. */ public void unmark() { if (getParent() != null) { setVisible(false); getParent().remove(this); eventSource.fireEvent(new mxEventObject(mxEvent.MARK)); } }
/** * Hides the marker and fires a mxEvent.MARK event. */ public void unmark() { if (getParent() != null) { setVisible(false); getParent().remove(this); eventSource.fireEvent(new mxEventObject(mxEvent.MARK)); } }
eventSource.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY, "cell", cell, "overlay", overlay));
eventSource.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY, "cell", cell, "overlay", overlay));
/** * */ public void startEditingAtCell(Object cell, EventObject evt) { if (cell == null) { cell = graph.getSelectionCell(); if (cell != null && !graph.isCellEditable(cell)) { cell = null; } } if (cell != null) { eventSource.fireEvent(new mxEventObject(mxEvent.START_EDITING, "cell", cell, "event", evt)); cellEditor.startEditing(cell, evt); } }
/** * */ public void startEditingAtCell(Object cell, EventObject evt) { if (cell == null) { cell = graph.getSelectionCell(); if (cell != null && !graph.isCellEditable(cell)) { cell = null; } } if (cell != null) { eventSource.fireEvent(new mxEventObject(mxEvent.START_EDITING, "cell", cell, "event", evt)); cellEditor.startEditing(cell, evt); } }
/** * Sets the label of the specified cell to the given value using * mxGraph.cellLabelChanged and fires mxEvent.LABEL_CHANGED while the * transaction is in progress. Returns the cell whose label was changed. * * @param cell * Cell whose label should be changed. * @param value * New value of the label. * @param evt * Optional event that triggered the change. */ public Object labelChanged(Object cell, Object value, EventObject evt) { mxIGraphModel model = graph.getModel(); model.beginUpdate(); try { graph.cellLabelChanged(cell, value, graph.isAutoSizeCell(cell)); eventSource.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED, "cell", cell, "value", value, "event", evt)); } finally { model.endUpdate(); } return cell; }
/** * Sets the label of the specified cell to the given value using * mxGraph.cellLabelChanged and fires mxEvent.LABEL_CHANGED while the * transaction is in progress. Returns the cell whose label was changed. * * @param cell * Cell whose label should be changed. * @param value * New value of the label. * @param evt * Optional event that triggered the change. */ public Object labelChanged(Object cell, Object value, EventObject evt) { mxIGraphModel model = graph.getModel(); model.beginUpdate(); try { graph.cellLabelChanged(cell, value, graph.isAutoSizeCell(cell)); eventSource.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED, "cell", cell, "value", value, "event", evt)); } finally { model.endUpdate(); } return cell; }
/** * Marks the markedState and fires a mxEvent.MARK event. */ public void mark() { if (markedState != null) { Rectangle bounds = markedState.getRectangle(); bounds.grow(3, 3); bounds.width += 1; bounds.height += 1; setBounds(bounds); if (getParent() == null) { setVisible(true); if (KEEP_ON_TOP) { graphComponent.getGraphControl().add(this, 0); } else { graphComponent.getGraphControl().add(this); } } repaint(); eventSource.fireEvent(new mxEventObject(mxEvent.MARK, "state", markedState)); } }
eventSource.fireEvent(new mxEventObject(mxEvent.PAINT, "g", g));
/** * Marks the markedState and fires a mxEvent.MARK event. */ public void mark() { if (markedState != null) { Rectangle bounds = markedState.getRectangle(); bounds.grow(3, 3); bounds.width += 1; bounds.height += 1; setBounds(bounds); if (getParent() == null) { setVisible(true); if (KEEP_ON_TOP) { graphComponent.getGraphControl().add(this, 0); } else { graphComponent.getGraphControl().add(this); } } repaint(); eventSource.fireEvent(new mxEventObject(mxEvent.MARK, "state", markedState)); } }
eventSource.fireEvent(new mxEventObject(mxEvent.PAINT, "g", g));
/** * */ public void mouseReleased(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && current != null) { mxGraph graph = graphComponent.getGraph(); double scale = graph.getView().getScale(); mxPoint tr = graph.getView().getTranslate(); current.setX(current.getX() / scale - tr.getX()); current.setY(current.getY() / scale - tr.getY()); current.setWidth(current.getWidth() / scale); current.setHeight(current.getHeight() / scale); Object cell = insertCell(current); eventSource.fireEvent(new mxEventObject(mxEvent.INSERT, "cell", cell)); e.consume(); } reset(); }
/** * */ public void mouseReleased(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && current != null) { mxGraph graph = graphComponent.getGraph(); double scale = graph.getView().getScale(); mxPoint tr = graph.getView().getTranslate(); current.setX(current.getX() / scale - tr.getX()); current.setY(current.getY() / scale - tr.getY()); current.setWidth(current.getWidth() / scale); current.setHeight(current.getHeight() / scale); Object cell = insertCell(current); eventSource.fireEvent(new mxEventObject(mxEvent.INSERT, "cell", cell)); e.consume(); } reset(); }