/** * Sets the current scale and revalidates the view. Fires a "scale" event * after calling revalidate. Revalidate is only called if isEventsEnabled. * * @param value * New scale to be used. */ public void setScale(double value) { double previousScale = scale; if (scale != value) { scale = value; if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.SCALE, "scale", scale, "previousScale", previousScale)); }
/** * Sets the current scale and revalidates the view. Fires a "scale" event * after calling revalidate. Revalidate is only called if isEventsEnabled. * * @param value * New scale to be used. */ public void setScale(double value) { double previousScale = scale; if (scale != value) { scale = value; if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.SCALE, "scale", scale, "previousScale", previousScale)); }
/** * Sets and returns the current root and fires an undo event. * * @param root * mxCell that specifies the root of the displayed cell * hierarchy. * @return Returns the object that represents the current root. */ public Object setCurrentRoot(Object root) { if (currentRoot != root) { mxCurrentRootChange change = new mxCurrentRootChange(this, root); change.execute(); mxUndoableEdit edit = new mxUndoableEdit(this, false); edit.add(change); fireEvent(new mxEventObject(mxEvent.UNDO, "edit", edit)); } return root; }
/** * Sets and returns the current root and fires an undo event. * * @param root * mxCell that specifies the root of the displayed cell * hierarchy. * @return Returns the object that represents the current root. */ public Object setCurrentRoot(Object root) { if (currentRoot != root) { mxCurrentRootChange change = new mxCurrentRootChange(this, root); change.execute(); mxUndoableEdit edit = new mxUndoableEdit(this, false); edit.add(change); fireEvent(new mxEventObject(mxEvent.UNDO, "edit", edit)); } return root; }
/** * Changes the current root of the view. */ public void execute() { Object tmp = view.getCurrentRoot(); view.currentRoot = previous; previous = tmp; mxPoint translate = view.graph.getTranslateForRoot(view .getCurrentRoot()); if (translate != null) { view.translate = new mxPoint(-translate.getX(), translate.getY()); } // Removes all existing cell states and revalidates view.reload(); up = !up; String eventName = (up) ? mxEvent.UP : mxEvent.DOWN; view.fireEvent(new mxEventObject(eventName, "root", view.currentRoot, "previous", previous)); }
/** * Sets the scale and translation. Fires a "scaleAndTranslate" event after * calling revalidate. Revalidate is only called if isEventsEnabled. * * @param scale * Decimal value that specifies the new scale (1 is 100%). * @param dx * X-coordinate of the translation. * @param dy * Y-coordinate of the translation. */ public void scaleAndTranslate(double scale, double dx, double dy) { double previousScale = this.scale; Object previousTranslate = translate.clone(); if (scale != this.scale || dx != translate.getX() || dy != translate.getY()) { this.scale = scale; translate = new mxPoint(dx, dy); if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE, "scale", scale, "previousScale", previousScale, "translate", translate, "previousTranslate", previousTranslate)); }
/** * Sets the scale and translation. Fires a "scaleAndTranslate" event after * calling revalidate. Revalidate is only called if isEventsEnabled. * * @param scale * Decimal value that specifies the new scale (1 is 100%). * @param dx * X-coordinate of the translation. * @param dy * Y-coordinate of the translation. */ public void scaleAndTranslate(double scale, double dx, double dy) { double previousScale = this.scale; Object previousTranslate = translate.clone(); if (scale != this.scale || dx != translate.getX() || dy != translate.getY()) { this.scale = scale; translate = new mxPoint(dx, dy); if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE, "scale", scale, "previousScale", previousScale, "translate", translate, "previousTranslate", previousTranslate)); }
/** * Changes the current root of the view. */ public void execute() { Object tmp = view.getCurrentRoot(); view.currentRoot = previous; previous = tmp; mxPoint translate = view.graph.getTranslateForRoot(view .getCurrentRoot()); if (translate != null) { view.translate = new mxPoint(-translate.getX(), translate.getY()); } // Removes all existing cell states and revalidates view.reload(); up = !up; String eventName = (up) ? mxEvent.UP : mxEvent.DOWN; view.fireEvent(new mxEventObject(eventName, "root", view.currentRoot, "previous", previous)); }
/** * Sets the current translation and invalidates the view. Fires a property * change event for "translate" after calling revalidate. Revalidate is only * called if isEventsEnabled. * * @param value * New translation to be used. */ public void setTranslate(mxPoint value) { Object previousTranslate = translate.clone(); if (value != null && (value.getX() != translate.getX() || value.getY() != translate .getY())) { translate = value; if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.TRANSLATE, "translate", translate, "previousTranslate", previousTranslate)); }
/** * Sets the current translation and invalidates the view. Fires a property * change event for "translate" after calling revalidate. Revalidate is only * called if isEventsEnabled. * * @param value * New translation to be used. */ public void setTranslate(mxPoint value) { Object previousTranslate = translate.clone(); if (value != null && (value.getX() != translate.getX() || value.getY() != translate .getY())) { translate = value; if (isEventsEnabled()) { revalidate(); } } fireEvent(new mxEventObject(mxEvent.TRANSLATE, "translate", translate, "previousTranslate", previousTranslate)); }