com.mindfusion.diagramming
Class Diagram

java.lang.Object
  extended by com.mindfusion.diagramming.Diagram
All Implemented Interfaces:
IItemFactory, java.awt.image.ImageObserver

public class Diagram
extends java.lang.Object
implements IItemFactory, java.awt.image.ImageObserver

The Diagram class represents a flow diagram.

The diagram document containing connected nodes and links. Nodes are instances of the ShapeNode and TableNode classes. The nodes can be accessed through getNodes(). Links in JDiagram are instances of the DiagramLink class and can be accessed through the getLinks() method. Diagram items can be grouped in hierarchical structures and the so formed groups can be accessed via getGroups().

Managing items: Use the Factory.createShapeNode(double, double, double, double), Factory.createTableNode(double, double, double, double) and Factory.createDiagramLink(com.mindfusion.diagramming.DiagramNode, com.mindfusion.diagramming.DiagramNode) methods to create new diagram items. Optionally, items can be created using the new operator and added to the diagram with the add(com.mindfusion.diagramming.DiagramItem) method. Items are deleted using the deleteItem(com.mindfusion.diagramming.DiagramItem) method.

The Factory.createGroup(com.mindfusion.diagramming.DiagramItem) method creates a new hierarchical Group of items. The subordinated items in a group always follow the movement of their master item. Use the destroyGroup(com.mindfusion.diagramming.Group) method to destroy a group.

Searching for a particular kind of items is done with the findLink(java.lang.Object), findNode(java.lang.Object) and findGroup(java.lang.Object) methods, which look for an item that has a particular Tag. To get whatever object is placed at a certain location, use the getItemAt(java.awt.geom.Point2D, boolean), getNodeAt(java.awt.geom.Point2D) and getLinkAt(java.awt.geom.Point2D.Float, float) methods.

Serialization: Binary serialization of diagrams is provided by the saveTo(java.io.ObjectOutputStream) and loadFrom(java.io.ObjectInputStream) methods which serialize diagrams to / from Java streams or files. Use the saveToXml(java.lang.String) and loadFromXml(java.lang.String) methods to serialize a diagram into/from XML documents.

Controlling users actions: Users actions can be validated by handling some events declared in DiagramListener, fired while items are being created or modified. In addition, the Diagram class provides some properties that control user interaction. The DiagramView.setBehavior(int) method specifies how users actions with the mouse are interpreted by creating nodes, links, selection, etc. The order in which items are hit-tested when clicking on them depends on the value assigned via setHitTestPriority(int).

The following attribute setters let you control what kind of links users can create: setAllowLinksRepeat(boolean), setAllowSelfLoops(boolean), setAllowUnanchoredLinks(boolean), setAllowUnconnectedLinks(boolean). To specify whether users are allowed to edit the text of nodes by double-clicking, use DiagramView.setAllowInplaceEdit(boolean).


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Diagram()
          Initializes a new instance of the Diagram class.
 
Method Summary
 void add(DiagramItem item)
          Adds a new item to the diagram.
 void add(DiagramItem item, boolean select)
          Adds a new item to the diagram and optionally selects it.
 void addDiagramListener(DiagramListener listener)
          Registers listener so that it will receive events when users create, modify or delete diagram items.
 java.awt.geom.Point2D.Float alignPointToGrid(java.awt.geom.Point2D.Float point)
          Aligns a point to the alignment grid.
 void clearAll()
          Deletes all items from the diagram.
 SelectionCopy copySelection(Diagram source, boolean unconnectedLinks, boolean copyGroups)
          Creates a copy of the currently selected objects and groups.
 java.awt.image.BufferedImage createImage()
          Creates a bitmap image representing the diagram contents.
 java.lang.Object createItem(java.lang.String itemClass)
          Implements the IItemFactory interface.
 void destroyGroup(Group group)
          Destroys the specified group.
 void draw(java.awt.Graphics2D graphics, RenderOptions options, java.awt.geom.Rectangle2D clipRect)
          Renders the diagram on the specified Graphics2D object.
 void executeCommand(Command cmd)
          Executes a command and saves it in the undo/redo history.
 Group findGroup(java.lang.Object tag)
          Finds the group that has the specified tag.
 DiagramLink findLink(java.lang.Object tag)
          Finds the link that has the specified tag.
 DiagramNode findNode(java.lang.Object tag)
          Finds the node that has the specified tag.
 DiagramItem getActiveItem()
          Gets the active item.
 HandlesVisualStyle getActiveItemHandlesStyle()
          Gets the visual style of the manipulation handles displayed around the active item.
 float getAdjustmentHandlesSize()
          Gets the size of selection handles.
 boolean getAlignToGrid()
          Gets a value indicating whether items are aligned to the alignment grid while users draw them with the mouse.
 boolean getAllowLinksRepeat()
          Gets a value indicating whether users are allowed to draw more than one links between the same nodes.
 boolean getAllowSelfLoops()
          Gets whether users are allowed to draw reflexive links.
 boolean getAllowSplitLinks()
          Gets whether link segments can be added and removed interactively.
 boolean getAllowUnanchoredLinks()
          Gets a value indicating whether users are allowed to attach links to nodes that do not have any anchor points.
 boolean getAllowUnconnectedLinks()
          Gets a value indicating whether users are allowed to draw unconnected links.
 int getAutoResize()
          Gets a value specifying whether the document scrollable area is resized automatically when users draw items near the edges of the diagram.
 Brush getBackBrush()
          Gets the diagram's background brush.
 java.awt.Image getBackgroundImage()
          Gets the background image.
 int getBackgroundImageAlign()
          Gets how the background image is positioned relatively to the scrollable area of the diagram.
 java.lang.String getBackgroundImageUrl()
          Gets the URL of the background image.
 java.awt.geom.Rectangle2D.Float getBounds()
          Gets the bounds of the scrollable area of the diagram.
 Pen getBoundsPen()
          Gets the pen with which the diagram bounds are drawn.
 int getCellFrameStyle()
          Gets the default style of the cell frames of new tables.
 java.util.HashMap<java.lang.String,ClassDescriptor> getClsidTable()
          Gets the table of registered item identifiers.
 java.lang.String getContainerCaption()
          Gets the default value for the Caption property of containers.
 float getContainerCaptionHeight()
          Gets the default value for the CaptionHeight property of containers.
 Pen getContainerHighlightPen()
          Gets the default value for the HighlightPen property of containers.
 float getContainerMargin()
          Gets the default value for the Margin property of containers.
 java.awt.geom.Dimension2D getContainerMinimumSize()
          Gets the default value for the MinimumSize property of containers.
 boolean getContainersFoldable()
          Gets the default value for the Foldable property of containers.
 float getCrossingRadius()
          Gets the radius of the shapes drawn at link crossing points.
 Shape getDefaultShape()
          Gets the default shape of nodes.
 boolean getDirty()
          Indicates whether the diagram has changed since the last save.
 HandlesVisualStyle getDisabledHandlesStyle()
          Gets the visual style of disabled manipulation handles.
 boolean getDynamicLinks()
          Gets a value indicating whether links automatically update their end points positions so that they will always point towards the node centers.
 boolean getEnableStyledText()
          Gets a value indicating whether new nodes display richly formatted text.
 int getExpandButtonAction()
          Gets what should happen when a user clicks the +/- button that is displayed near expandable nodes.
 int getExpandButtonPosition()
          Gets where expand/collapse buttons are located relatively to their nodes.
 boolean getExpandOnIncoming()
          Gets which direction of links is considered the tree direction when expanding or collapsing diagram branches.
 Factory getFactory()
          Gets a Factory instance that lets you add programmatically new items to the diagram.
 java.awt.Font getFont()
          Gets the default font for new diagram items.
 java.awt.Color getGridColor()
          Gets the color of the alignment grid.
 float getGridSizeX()
          Gets the horizontal distance between grid points.
 float getGridSizeY()
          Gets the vertical distance between grid points.
 int getGridStyle()
          Gets the appearance style of the alignment grid.
 GroupList getGroups()
          Gets a collection of all groups in the diagram.
 int getHitTestPriority()
          Gets a value indicating the order in which items are hit-tested.
 int getImageDpiX()
          Specifies the default resolution of images.
 int getImageDpiY()
           
 InteractionState getInteraction()
          Gets an InteractionState instance representing the current action being carried out by the user.
 DiagramItem getItemAt(java.awt.geom.Point2D point, boolean excludeLocked)
          Returns the top-most item that contains the specified point.
 DiagramItem getItemAt(java.awt.geom.Point2D point, boolean excludeLocked, boolean excludeModified)
          Returns the top-most item that contains the specified point.
 DiagramItemList getItems()
          Gets a collection of all items in the diagram.
 DiagramLink getLinkAt(java.awt.geom.Point2D.Float point, float maxDist)
          Returns the top-most link that passes near the specified point.
 DiagramLink getLinkAt(java.awt.geom.Point2D point, double maxDist, boolean exclLocked)
          Returns the top-most link that passes near the specified point.
 DiagramLink getLinkAt(java.awt.geom.Point2D point, double maxDist, boolean excludeLocked, boolean excludeModified)
          Returns the top-most link that passes near the specified point.
 DiagramLink getLinkAt(java.awt.geom.Point2D point, double maxDist, boolean excludeLocked, boolean excludeModified, ByRef<java.lang.Integer> segmNum)
          Returns the top-most link that passes near the specified point.
 int getLinkBaseShape()
          Gets the default shape displayed at the origin of new links.
 float getLinkBaseShapeSize()
          Gets the default size of the shape displayed at the origin of new links.
 Brush getLinkBrush()
          Gets the default brush assigned to new links.
 int getLinkCascadeOrientation()
          Gets the default orientation of the first segments of cascading links.
 int getLinkCrossings()
          Gets what shapes are drawn at link crossing points.
 int getLinkCustomDraw()
           
 boolean getLinkEndsMovable()
          Gets a value indicating users are allowed to move the end points of an link after the link is created.
 int getLinkHeadShape()
          Gets the default shape displayed as arrowhead of new links.
 float getLinkHeadShapeSize()
          Gets the default size of the shape displayed as arrowhead of new links.
 int getLinkIntermediateShape()
          Gets the default shape displayed at the middle of links segments.
 float getLinkIntermediateShapeSize()
          Gets the default size of the shape displayed at the middle of links segments.
 Pen getLinkPen()
          Gets the default pen assigned to new links.
 LinkRouter getLinkRouter()
          Gets the component used to find paths for auto-routed links when diagram nodes are added or their positions change.
 DiagramLinkList getLinks()
          Gets a collection of all links in the diagram.
 short getLinkSegments()
          Gets the default number of link segments.
 boolean getLinksRetainForm()
          Gets a value indicating whether new links are set to maintain their shapes while the nodes they connect are moved around.
 boolean getLinksSnapToBorders()
          Gets a value indicating whether newly created links are set to align their end points to the borders of the nodes they connect.
 int getLinkStyle()
          Gets the default style of links.
 java.lang.String getLinkText()
          Gets the default text assigned to new links.
 int getLinkTextStyle()
          Gets the default placement and orientation of the links labels.
 int getMeasureUnit()
          Gets the current unit of measure.
 float getMergeThreshold()
          Gets the maximum distance between adjacent control points of a link at which the respective segments can be merged.
 DiagramNode getNodeAt(java.awt.geom.Point2D point)
          Returns the top-most node that contains the specified point.
 DiagramNode getNodeAt(java.awt.geom.Point2D point, boolean excludeLocked, boolean excludeSelected)
          Returns the top-most node that contains the specified point.
 DiagramNode getNodeAt(java.awt.geom.Point2D point, float threshold)
          Returns the top-most node that contains the specified point.
 DiagramNodeList getNodes()
          Gets a collection of all nodes in the diagram.
 DiagramNodeList getNodesAt(java.awt.geom.Point2D.Float point)
          Returns the nodes that contain the specified point.
 boolean getNodesExpandable()
          Gets whether the tree branches that start from new nodes are expandable by default.
 boolean getRecursiveExpand()
          Gets whether tree branches are expanded recursively.
 int getRestrictItemsToBounds()
          Gets a value indicating whether users are allowed to move items outside the currently define document bounds.
 boolean getRouteLinks()
          Gets a value indicating whether newly created links will automatically find their way between nodes.
 RoutingOptions getRoutingOptions()
          Gets a RoutingOptions instance that lets you set various attributes of the link routing algorithm.
 boolean getSelectAfterCreate()
          Gets a value indicating whether newly created items are selected automatically.
 HandlesVisualStyle getSelectedItemHandlesStyle()
          Gets the visual style of the manipulation handles displayed around selected items.
 Selection getSelection()
          Gets a Selection instance representing the current selection.
 boolean getSelectionOnTop()
          Gets a value indicating whether selected items are drawn on top of the non-selected ones.
 java.awt.Color getShadowColor()
          Gets the color of items shadows.
 float getShadowOffsetX()
          Gets the default horizontal distance between shadows and the items that cast them.
 float getShadowOffsetY()
          Gets the default vertical distance between shadows and the items that cast them.
 int getShadowsStyle()
          Gets the style of shadows.
 Brush getShapeBrush()
          Gets the default brush assigned to new nodes.
 int getShapeCustomDraw()
          Gets whether new nodes should be custom drawn and what type of custom drawing will be performed on them.
 int getShapeHandlesStyle()
          Gets the default style of box selection handles.
 float getShapeOrientation()
          Gets the default shape definition orientation angle assigned to new nodes.
 Pen getShapePen()
          Gets the default pen assigned to new nodes.
 java.lang.String getShapeText()
          Gets the default text assigned to new nodes.
 int getShowAnchors()
          Gets a value indicating whether anchor points should be shown on screen.
 boolean getShowDisabledHandles()
          Gets whether disabled manipulation handles are displayed.
 boolean getShowGrid()
          Gets a value indicating whether the alignment grid is displayed.
 boolean getShowHandlesOnDrag()
          Gets whether selection handles of objects under the mouse are displayed while another object is being modified.
 int getSnapToAnchor()
          Gets a value indicating when links should snap to anchor points.
 Brush getTableBrush()
          Gets the default brush assigned to new tables.
 java.lang.String getTableCaption()
          Gets the default caption text assigned to new tables.
 float getTableCaptionHeight()
          Gets the default height of the caption area of new tables.
 int getTableColumnCount()
          Gets how many columns new tables have by default.
 float getTableColumnWidth()
          Gets the default width of the columns of new tables.
 int getTableConnectionStyle()
          Gets how users are allowed to link tables one to another - as integral entities, by rows, or both.
 int getTableHandlesStyle()
          Gets the default style of table selection handles.
 Pen getTablePen()
          Gets the default pen assigned to new tables.
 int getTableRowCount()
          Gets how many rows new tables have by default.
 float getTableRowHeight()
          Gets the default height of the row of new tables.
 boolean getTablesScrollable()
          Gets a value indicating whether users are allowed to scroll new tables.
 int getTableStyle()
          Gets the default style of tables.
 java.lang.Object getTag()
          Gets the custom data associated with this diagram.
 java.awt.Color getTextColor()
          Gets the default text color that is assigned to new items.
 TextFormat getTextFormat()
          Gets the default format and alignment of the text of new items.
 java.lang.String getToolTip()
          Gets the tooltip text.
 java.util.HashMap<java.lang.Class,ClassDescriptor> getTypeTable()
          Gets the table of registered item types.
 UndoManager getUndoManager()
          Gets the diagram's UndoManager.
 java.awt.geom.Point2D.Float imageToDoc(int x, int y)
          Transforms points from the image coordinate space to the document coordinate space.
 double imageToDocX(int x)
          Converts from image coordinates to document coordinates.
 double imageToDocY(int y)
          Converts from image coordinates to document coordinates.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
           
<T extends DiagramItem>
java.lang.Iterable<T>
items(java.lang.Class<T> desiredType)
          Iterates over diagram items of the desired type
 void loadFrom(java.io.InputStream in)
          Loads the diagram contents from a stream.
 void loadFrom(java.lang.String fileName)
          Loads the diagram contents from a file.
 void loadFromString(java.lang.String chartData)
          Loads the diagram contents from a string.
 void loadFromXml(org.w3c.dom.Document document, boolean freeProcessedXml)
          Loads the contents of the XML diagram document.
 void loadFromXml(org.xml.sax.InputSource source)
          Loads the contents of the XML diagram document.
 void loadFromXml(java.io.InputStream stream)
          Loads the contents of the XML diagram document.
 void loadFromXml(java.lang.String fileName)
          Loads the contents of the XML diagram document.
 java.awt.geom.Dimension2D measureString(java.lang.String text, java.awt.Font font)
          Measures a text taking into consideration the current affine transform of the diagram.
 boolean pasteSelection(Diagram doc, SelectionCopy data, CompositeCmd cmd, float dx, float dy)
          Adds the specified items and groups to the specified diagram document.
 void raiseActionRedone(Command command)
           
 void raiseActionUndone(Command command)
           
 void raiseCellTextEdited(Cell cell, java.lang.String oldText, java.lang.String newText, int column, int row)
          Raises the DiagramListener.cellTextEdited(com.mindfusion.diagramming.EditCellTextEvent) event.
 boolean raiseCellTextEditing(TableNode table, int column, int row)
          Raises the DiagramListener.cellTextEditing(com.mindfusion.diagramming.CellValidationEvent) event to validate entering inplace edit mode.
 void raiseClicked(DiagramItem item, java.awt.geom.Point2D mousePosition, int mouseButton)
          Raises the appropriate Clicked event.
 void raiseClicked(int mouseButton, java.awt.geom.Point2D mousePosition)
          Raises the DiagramListener.clicked(com.mindfusion.diagramming.DiagramEvent) event.
 boolean raiseDeleting(DiagramItem item)
          Raises the appropriate Deleting event.
 void raiseDoubleClicked(DiagramItem item, java.awt.geom.Point2D mousePosition, int mouseButton)
          Raises the appropriate DoubleClicked event.
 void raiseDoubleClicked(int mouseButton, java.awt.geom.Point2D mousePosition)
          Raises the DiagramListener.doubleClicked(com.mindfusion.diagramming.DiagramEvent) event.
 void raiseLinkTextEdited(DiagramLink link, java.lang.String oldText, java.lang.String newText)
          Raises the DiagramListener.linkTextEdited(com.mindfusion.diagramming.EditLinkTextEvent) event.
 boolean raiseLinkTextEditing(DiagramLink link)
          Raises the DiagramListener.linkTextEditing(com.mindfusion.diagramming.LinkValidationEvent) event to validate entering inplace edit mode.
 void raiseNodeTextEdited(DiagramNode node, java.lang.String oldText, java.lang.String newText)
          Raises the DiagramListener.nodeTextEdited(com.mindfusion.diagramming.EditNodeTextEvent) event.
 boolean raiseNodeTextEditing(DiagramNode node)
          Raises the DiagramListener.nodeTextEditing(com.mindfusion.diagramming.NodeValidationEvent) event to validate entering inplace edit mode.
 void raiseTreeCollapsed(DiagramNode root)
          Raises the TreeCollapsed event.
 void raiseTreeExpanded(DiagramNode root)
          Raises the TreeExpanded event.
 void raiseTreeViewItemEdited(TreeViewItem item, java.lang.String oldText, java.lang.String newText)
           
 void raiseViewRemoved()
          Raises the DiagramListener.viewRemoved(com.mindfusion.diagramming.ValidationEvent) event.
static void registerItemClass(java.lang.Class itemClass, java.lang.String classId, int classVersion)
          Registers a diagram item class for serialization support.
 void removeDiagramListener(DiagramListener listener)
          Unregisters listener so that it will no longer receive diagram events.
 void repaint()
          Repaints the diagram.
 void repaint(boolean redrawCacheImage)
          Causes the entire visible diagram area to be repainted.
 void repaint(java.lang.Object sender, java.awt.geom.Rectangle2D docRect)
          Repaints the specified region of the diagram.
 void repaint(java.awt.geom.Rectangle2D docRect)
          Repaints the specified region of the diagram.
 void resizeToFitItems(float margins)
          Resizes the document area so that it fits exactly the diagram items.
 void resizeToFitItems(float margins, boolean onlyVisible)
          Resizes the document area so that it fits exactly the diagram items.
 void routeAllLinks()
          Routes all links in the diagram so that they will not cross any node.
 void saveTo(java.io.OutputStream out)
          Saves the diagram contents into a stream.
 void saveTo(java.lang.String fileName)
          Saves the diagram contents into a file.
 java.lang.String saveToString()
          Saves the diagram contents into a string.
 java.lang.String saveToString(int format, boolean includeUnalteredProperties)
          Saves the diagram contents into a string.
 void saveToXml(org.w3c.dom.Document document)
          Saves the diagram to the specified XML document.
 void saveToXml(org.w3c.dom.Document document, boolean includeUnalteredProperties)
          Saves the diagram to the specified XML document.
 void saveToXml(java.io.OutputStream stream, boolean includeUnalteredProperties)
          Saves the diagram to the specified XML document.
 void saveToXml(java.lang.String fileName)
          Saves the diagram to the specified XML document.
 void setActiveItem(DiagramItem value)
          Sets the active item.
 void setAdjustmentHandlesSize(float value)
          Sets the size of selection handles.
 void setAlignToGrid(boolean value)
          Sets a value indicating whether items should be aligned to the alignment grid while users draw them with the mouse.
 void setAllowLinksRepeat(boolean value)
          Sets a value indicating whether users are allowed to draw more than one links between the same nodes.
 void setAllowSelfLoops(boolean value)
          Sets whether users are allowed to draw reflexive links.
 void setAllowSplitLinks(boolean value)
          Sets whether link segments can be added and removed interactively.
 void setAllowUnanchoredLinks(boolean value)
          Sets a value indicating whether users are allowed to attach links to nodes that do not have any anchor points.
 void setAllowUnconnectedLinks(boolean value)
          Sets a value indicating whether users are allowed to draw unconnected links.
 void setAutoResize(int value)
          Sets a value specifying whether the document scrollable area should be resized automatically when users draw items near the edges of the diagram.
 void setBackBrush(Brush value)
          Sets the diagram's background brush.
 void setBackgroundImage(java.awt.Image value)
          Sets the background image.
 void setBackgroundImage(java.awt.Image img, java.lang.String url)
          Allows setting of both image and imageUrl properties as other setters reset the skipped argument.
 void setBackgroundImageAlign(int value)
          Sets how the background image should be positioned relatively to the scrollable area of the diagram.
 void setBackgroundImageUrl(java.lang.String value)
          Sets the URL of the background image.
 void setBounds(java.awt.geom.Rectangle2D.Float value)
          Sets the size of the diagram's scrollable area.
 void setBounds(java.awt.geom.Rectangle2D value)
          Sets the bounds of the scrollable area of the diagram.
 void setBoundsPen(Pen value)
          Sets the pen with which document bounds are drawn.
 void setCellFrameStyle(int value)
          Sets the default style of the cell frames of new tables.
 void setContainerCaption(java.lang.String containerCaption)
          Sets the default value for the Caption property of containers.
 void setContainerCaptionHeight(float containerCaptionHeight)
          Sets the default value for the CaptionHeight property of containers.
 void setContainerHighlightPen(Pen containerHighlightPen)
          Sets the default value for the HighlightPen property of containers.
 void setContainerMargin(float containerMargin)
          Sets the default value for the Margin property of containers.
 void setContainerMinimumSize(java.awt.geom.Dimension2D containerMinimumSize)
          Sets the default value for the MinimumSize property of containers.
 void setContainersFoldable(boolean containersFoldable)
          Sets the default value for the Foldable property of containers.
 void setCrossingRadius(float value)
          Sets the radius of the shapes drawn at link crossing points.
 void setDefaultShape(Shape value)
          Sets the default shape that should be assigned to new nodes.
 void setDirty()
          Marks the diagram as modified.
 void setDirty(boolean value)
          Lets you set or clear the diagram's modification flag.
 void setDynamicLinks(boolean value)
          Sets a value indicating whether links should automatically update their end points positions so that they will always point towards the node centers.
 void setEnableStyledText(boolean value)
          Sets a value indicating whether newly created nodes should display richly formatted text.
 void setExpandButtonAction(int value)
          Sets what should happen when a user clicks the +/- button that is displayed near expandable nodes.
 void setExpandButtonPosition(int value)
          Sets where expand/collapse buttons are located relatively to their nodes.
 void setExpandOnIncoming(boolean value)
          Sets which direction of links is considered the tree direction when expanding or collapsing diagram branches.
 void setFont(java.awt.Font font)
          Sets the default font for new diagram items.
 void setGridColor(java.awt.Color value)
          Sets the color of the alignment grid.
 void setGridSizeX(float value)
          Sets or sets the horizontal distance between grid points.
 void setGridSizeY(float value)
          Sets the vertical distance between grid points.
 void setGridStyle(int value)
          Sets the appearance style of the alignment grid.
 void setHitTestPriority(int value)
          Sets a value indicating the order in which items are hit-tested.
 void setImageDpiX(int dpi)
           
 void setImageDpiY(int dpi)
           
 void setLinkBaseShape(int value)
          Sets what shape should be displayed at the origin of new links.
 void setLinkBaseShapeSize(float value)
          Sets the default size of the shape displayed at the origin of new links.
 void setLinkBrush(Brush value)
          Sets the default brush that should be assigned to new links.
 void setLinkCascadeOrientation(int value)
          Sets the default orientation of the first segments of cascading links.
 void setLinkCrossings(int value)
          Sets what shapes should be drawn at the points where links cross.
 void setLinkCustomDraw(int value)
           
 void setLinkEndsMovable(boolean value)
          Sets a value indicating users are allowed to move the end points of a link after the link is created.
 void setLinkHeadShape(int value)
          Sets what shape should be displayed as arrowhead of new links.
 void setLinkHeadShapeSize(float value)
          Sets the default size of the shape displayed as arrowhead of new links.
 void setLinkIntermediateShape(int value)
          Sets what shape should be displayed at the middle of links segments.
 void setLinkIntermediateShapeSize(float value)
          Sets the default size of the shape displayed at the middle of links segments.
 void setLinkPen(Pen value)
          Sets the default pen that should be assigned to new links.
 void setLinkRouter(LinkRouter value)
          Sets the component used to find paths for auto-routed links when diagram nodes are added or their positions change.
 void setLinkSegments(short value)
          Sets the default number of link segments.
 void setLinksRetainForm(boolean value)
          Sets a value indicating whether new links are set to maintain their shapes while the nodes they connect are moved around.
 void setLinksSnapToBorders(boolean value)
          Sets a value indicating whether newly created links are set to align their end points to the borders of the nodes they connect.
 void setLinkStyle(int value)
          Sets the style that should be assigned to new links.
 void setLinkText(java.lang.String value)
          Sets the default text that should be assigned to new links.
 void setLinkTextStyle(int value)
          Sets the default placement and orientation of the links labels.
 void setMeasureUnit(int value)
          Sets in what units JDiagram should measure lengths and sizes.
 void setMergeThreshold(float value)
          Sets the maximum distance between adjacent control points of a link at which the respective segments can be merged.
 void setNodesExpandable(boolean value)
          Sets whether the tree branches that start from new nodes should be expandable by default.
 void setRecursiveExpand(boolean value)
          Sets whether tree branches should be expanded recursively.
 void setRestrictItemsToBounds(int value)
          Sets a value indicating whether users are allowed to move items outside the currently define document bounds.
 void setRouteLinks(boolean value)
          Sets a value indicating whether newly created links will automatically find their way between nodes.
 void setSelectAfterCreate(boolean value)
          Sets a value indicating whether newly created items should be selected automatically.
 void setSelectionOnTop(boolean value)
          Sets a value indicating whether selected items should be drawn on top of the non-selected ones.
 void setShadowColor(java.awt.Color value)
          Sets the color of items shadows.
 void setShadowOffset(float x, float y)
          Sets the distance at which shadows are offset from the items that cast them.
 void setShadowOffsetX(float value)
          Sets the default horizontal distance between shadows and the items that cast them.
 void setShadowOffsetY(float value)
          Sets the default vertical distance between shadows and the items that cast them.
 void setShadowsStyle(int value)
          Sets the style of shadows.
 void setShapeBrush(Brush value)
          Sets the default brush that should be assigned to new nodes.
 void setShapeCustomDraw(int value)
          Sets whether new nodes should be custom drawn and what type of custom drawing will be performed on them.
 void setShapeHandlesStyle(int value)
          Sets the style of selection handles that should be assigned to new nodes.
 void setShapeOrientation(float value)
          Sets the default shape definition orientation angle assigned to new nodes.
 void setShapePen(Pen value)
          Sets the default pen that should be assigned to new nodes.
 void setShapeText(java.lang.String value)
          Sets the default text that should be assigned to new nodes.
 void setShowAnchors(int value)
          Sets a value indicating whether anchor points should be shown on screen.
 void setShowDisabledHandles(boolean value)
          Sets whether disabled manipulation handles should be displayed.
 void setShowGrid(boolean value)
          Sets a value indicating whether the alignment grid should be displayed.
 void setShowHandlesOnDrag(boolean value)
          Sets whether selection handles of objects under the mouse should be displayed while another object is being modified.
 void setSnapToAnchor(int value)
          Sets a value indicating when links should snap to anchor points.
 void setTableBrush(Brush value)
          Sets the default brush that should be assigned to new links.
 void setTableCaption(java.lang.String value)
          Sets the default caption text that should be assigned to new tables.
 void setTableCaptionHeight(float value)
          Sets the default height of the caption area of new tables.
 void setTableColumnCount(int value)
          Sets how many columns should be allocated to new tables.
 void setTableColumnWidth(float value)
          Sets the default width of columns in newly created tables.
 void setTableConnectionStyle(int value)
          Sets how users are allowed to link tables one to another - as integral entities, by rows, or both.
 void setTableHandlesStyle(int value)
          Sets the style of selection handles that should be assigned to new tables.
 void setTablePen(Pen value)
          Sets the default pen that should be assigned to new tables.
 void setTableRowCount(int value)
          Sets how many rows should be allocated to new tables.
 void setTableRowHeight(float value)
          Sets the default height of rows in newly created tables.
 void setTablesScrollable(boolean value)
          Sets a value indicating whether users are allowed to scroll new tables.
 void setTableStyle(int value)
          Sets the default style of tables.
 void setTag(java.lang.Object value)
          Associates a custom data with this diagram.
 void setTextColor(java.awt.Color value)
          Sets the default text color that should be assigned to new items.
 void setTextFormat(TextFormat value)
          Sets the default format and alignment of the text of new items.
 void setToolTip(java.lang.String value)
          Sets the tooltip text that should be displayed when the mouse hovers over an unoccupied area of the diagram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Diagram

public Diagram()
Initializes a new instance of the Diagram class.

Method Detail

addDiagramListener

public void addDiagramListener(DiagramListener listener)
Registers listener so that it will receive events when users create, modify or delete diagram items.

Parameters:
listener - An object implementing the DiagramListener interface.

removeDiagramListener

public void removeDiagramListener(DiagramListener listener)
Unregisters listener so that it will no longer receive diagram events.

Parameters:
listener - An object implementing the DiagramListener interface.

raiseClicked

public void raiseClicked(DiagramItem item,
                         java.awt.geom.Point2D mousePosition,
                         int mouseButton)
Raises the appropriate Clicked event.

Parameters:
item - The DiagramItem that has been clicked.
mousePosition - The mouse position in logical diagram coordinates.
mouseButton - Indicates which button has been clicked.

raiseDoubleClicked

public void raiseDoubleClicked(DiagramItem item,
                               java.awt.geom.Point2D mousePosition,
                               int mouseButton)
Raises the appropriate DoubleClicked event.

Parameters:
item - The DiagramItem that has been clicked.
mousePosition - The mouse position in logical diagram coordinates.
mouseButton - Indicates which button has been clicked.

raiseTreeExpanded

public void raiseTreeExpanded(DiagramNode root)
Raises the TreeExpanded event.

Parameters:
root - The root node of the expanded branch.

raiseTreeCollapsed

public void raiseTreeCollapsed(DiagramNode root)
Raises the TreeCollapsed event.

Parameters:
root - The root node of the collapsed branch.

raiseDeleting

public boolean raiseDeleting(DiagramItem item)
Raises the appropriate Deleting event.

Parameters:
item - The DiagramItem that will be deleted.
Returns:
true if the item should be deleted, otherwise false.

raiseLinkTextEditing

public boolean raiseLinkTextEditing(DiagramLink link)
Raises the DiagramListener.linkTextEditing(com.mindfusion.diagramming.LinkValidationEvent) event to validate entering inplace edit mode.

Parameters:
link - The DiagramLink whose text will be edited.
Returns:
true if the event handlers allow the operation, otherwise false.

raiseNodeTextEditing

public boolean raiseNodeTextEditing(DiagramNode node)
Raises the DiagramListener.nodeTextEditing(com.mindfusion.diagramming.NodeValidationEvent) event to validate entering inplace edit mode.

Parameters:
node - The DiagramNode whose text will be edited.
Returns:
true if the event handlers allow the operation, otherwise false.

raiseCellTextEditing

public boolean raiseCellTextEditing(TableNode table,
                                    int column,
                                    int row)
Raises the DiagramListener.cellTextEditing(com.mindfusion.diagramming.CellValidationEvent) event to validate entering inplace edit mode.

Parameters:
table - The TableNode related to the event.
column - The zero-based index of the table column related to the event.
row - The zero-based index of the table row related to the event.
Returns:
true if the event handlers allow the operation, otherwise false.

raiseClicked

public void raiseClicked(int mouseButton,
                         java.awt.geom.Point2D mousePosition)
Raises the DiagramListener.clicked(com.mindfusion.diagramming.DiagramEvent) event.

Parameters:
mouseButton - Indicates which mouse button has been pressed.
mousePosition - The mouse position in logical diagram coordinates.

raiseDoubleClicked

public void raiseDoubleClicked(int mouseButton,
                               java.awt.geom.Point2D mousePosition)
Raises the DiagramListener.doubleClicked(com.mindfusion.diagramming.DiagramEvent) event.

Parameters:
mouseButton - Indicates which mouse button has been pressed.
mousePosition - The mouse position in logical diagram coordinates.

raiseNodeTextEdited

public void raiseNodeTextEdited(DiagramNode node,
                                java.lang.String oldText,
                                java.lang.String newText)
Raises the DiagramListener.nodeTextEdited(com.mindfusion.diagramming.EditNodeTextEvent) event.

Parameters:
node - The node whose text has been edited.
oldText - The old text.
newText - The new text.

raiseLinkTextEdited

public void raiseLinkTextEdited(DiagramLink link,
                                java.lang.String oldText,
                                java.lang.String newText)
Raises the DiagramListener.linkTextEdited(com.mindfusion.diagramming.EditLinkTextEvent) event.

Parameters:
link - The DiagramLink whose text has been edited.
oldText - The old text.
newText - The new text.

raiseCellTextEdited

public void raiseCellTextEdited(Cell cell,
                                java.lang.String oldText,
                                java.lang.String newText,
                                int column,
                                int row)
Raises the DiagramListener.cellTextEdited(com.mindfusion.diagramming.EditCellTextEvent) event.

Parameters:
cell - The Cell whose text has been edited.
oldText - The old text.
newText - The new text.
column - The column index of the cell.
row - The row index of the cell.

raiseTreeViewItemEdited

public void raiseTreeViewItemEdited(TreeViewItem item,
                                    java.lang.String oldText,
                                    java.lang.String newText)

raiseActionUndone

public void raiseActionUndone(Command command)

raiseActionRedone

public void raiseActionRedone(Command command)

raiseViewRemoved

public void raiseViewRemoved()
Raises the DiagramListener.viewRemoved(com.mindfusion.diagramming.ValidationEvent) event.


getUndoManager

public UndoManager getUndoManager()
Gets the diagram's UndoManager.

Returns:
An UndoManager object.

executeCommand

public void executeCommand(Command cmd)
Executes a command and saves it in the undo/redo history.

Parameters:
cmd - The Command to execute.

saveTo

public void saveTo(java.io.OutputStream out)
            throws java.io.IOException
Saves the diagram contents into a stream.

Parameters:
out - An OutputStream where the diagram contents should be saved.
Throws:
java.io.IOException

saveToString

public java.lang.String saveToString()
Saves the diagram contents into a string.

Returns:
A String containing the base64 encoded diagram contents.

saveToString

public java.lang.String saveToString(int format,
                                     boolean includeUnalteredProperties)
Saves the diagram contents into a string.

Parameters:
format - A SaveToStringFormat constant indicating the output format.
includeUnalteredProperties - true to serialize all property; false to serialize only properties with non-default values.
Returns:
A String containing the serialized form of the diagram.

loadFrom

public void loadFrom(java.io.InputStream in)
              throws java.io.IOException
Loads the diagram contents from a stream.

Parameters:
in - An InputStream from which to load the diagram contents.
Throws:
java.io.IOException

loadFromString

public void loadFromString(java.lang.String chartData)
Loads the diagram contents from a string.

Parameters:
chartData - A String from which to load the diagram contents.

saveTo

public void saveTo(java.lang.String fileName)
            throws java.io.FileNotFoundException,
                   java.io.IOException
Saves the diagram contents into a file.

Parameters:
fileName - The name of the file into which the diagram contents should be saved.
Throws:
java.io.FileNotFoundException
java.io.IOException

loadFrom

public void loadFrom(java.lang.String fileName)
              throws java.io.FileNotFoundException,
                     java.io.IOException
Loads the diagram contents from a file.

Parameters:
fileName - The name of the file from which the diagram contents should be loaded.
Throws:
java.io.FileNotFoundException
java.io.IOException

saveToXml

public void saveToXml(java.lang.String fileName)
               throws java.io.FileNotFoundException,
                      java.io.IOException,
                      XmlException
Saves the diagram to the specified XML document.

Parameters:
fileName - The full path and name of the disk file where the diagram should be saved.
Throws:
java.io.FileNotFoundException
java.io.IOException
XmlException

saveToXml

public void saveToXml(java.io.OutputStream stream,
                      boolean includeUnalteredProperties)
               throws XmlException,
                      java.io.IOException
Saves the diagram to the specified XML document.

Parameters:
stream - An OutputStream where the XML markup should be serialized.
Throws:
XmlException
java.io.IOException

saveToXml

public void saveToXml(org.w3c.dom.Document document)
Saves the diagram to the specified XML document.

Parameters:
document - A DOM Document object where the diagram should be saved.

saveToXml

public void saveToXml(org.w3c.dom.Document document,
                      boolean includeUnalteredProperties)
Saves the diagram to the specified XML document.

Parameters:
document - A DOM Document object where the diagram should be saved.

loadFromXml

public void loadFromXml(java.lang.String fileName)
                 throws java.io.FileNotFoundException,
                        java.io.IOException,
                        XmlException
Loads the contents of the XML diagram document.

Parameters:
fileName - The name of the XML file the data should be read from.
Throws:
java.io.FileNotFoundException
java.io.IOException
XmlException

loadFromXml

public void loadFromXml(java.io.InputStream stream)
                 throws XmlException
Loads the contents of the XML diagram document.

Parameters:
stream - An InputStream where the XML markup should be read from.
Throws:
XmlException

loadFromXml

public void loadFromXml(org.xml.sax.InputSource source)
                 throws XmlException
Loads the contents of the XML diagram document.

Parameters:
source - An InputSource where the XML markup should be read from.
Throws:
XmlException

loadFromXml

public void loadFromXml(org.w3c.dom.Document document,
                        boolean freeProcessedXml)
                 throws XmlException
Loads the contents of the XML diagram document.

Parameters:
document - A DOM Document object from which to load the diagram data.
Throws:
XmlException

registerItemClass

public static void registerItemClass(java.lang.Class itemClass,
                                     java.lang.String classId,
                                     int classVersion)
Registers a diagram item class for serialization support.

Parameters:
itemClass - A Class instance identifying the item class.
classId - A class identifier to use when saving and loading items of the specified type.
classVersion - A revision number of the item's class serialization format.

getTypeTable

public java.util.HashMap<java.lang.Class,ClassDescriptor> getTypeTable()
Gets the table of registered item types.

Specified by:
getTypeTable in interface IItemFactory

getClsidTable

public java.util.HashMap<java.lang.String,ClassDescriptor> getClsidTable()
Gets the table of registered item identifiers.

Specified by:
getClsidTable in interface IItemFactory

createItem

public java.lang.Object createItem(java.lang.String itemClass)
Implements the IItemFactory interface.

Specified by:
createItem in interface IItemFactory

alignPointToGrid

public java.awt.geom.Point2D.Float alignPointToGrid(java.awt.geom.Point2D.Float point)
Aligns a point to the alignment grid.

Parameters:
point - A Point2D.Float object representing the point that should be aligned to the grid.
Returns:
A Point2D.Float object representing the aligned point.

createImage

public java.awt.image.BufferedImage createImage()
Creates a bitmap image representing the diagram contents.

Returns:
A java.awt.image.BufferedImage object containing a representation of the diagram.

draw

public void draw(java.awt.Graphics2D graphics,
                 RenderOptions options,
                 java.awt.geom.Rectangle2D clipRect)
Renders the diagram on the specified Graphics2D object.

Parameters:
graphics - The Graphics2D surface to draw the diagram on.
options - A RenderOptions object specifying options for the drawing operation.
clipRect - A Rectangle2D specifying the current clipping rectangle.

getMeasureUnit

public int getMeasureUnit()
Gets the current unit of measure.

Returns:
One of the GraphicsUnit constants.

setMeasureUnit

public void setMeasureUnit(int value)
Sets in what units JDiagram should measure lengths and sizes.

Parameters:
value - One of the GraphicsUnit constants.

imageToDocX

public double imageToDocX(int x)
Converts from image coordinates to document coordinates.

Parameters:
x - An image point x coordinate
Returns:
The document x coordinate for the image point.

imageToDocY

public double imageToDocY(int y)
Converts from image coordinates to document coordinates.

Parameters:
y - An image point y coordinate
Returns:
The document y coordinate for the image point.

imageToDoc

public java.awt.geom.Point2D.Float imageToDoc(int x,
                                              int y)
Transforms points from the image coordinate space to the document coordinate space. Images have its own coordinate space probably different than device space because they may have different resolution that the screen

Parameters:
x -
y -
Returns:
A Point2D.Float object, which represents the document coordinates of image point

measureString

public java.awt.geom.Dimension2D measureString(java.lang.String text,
                                               java.awt.Font font)
Measures a text taking into consideration the current affine transform of the diagram.

Parameters:
text - The String to measure.
font - A Font that will be used to render the text.
Returns:
This method returns a Dimension2D object that represents the size of the string text when drawn with the font parameter and the string parameter.

getDirty

public boolean getDirty()
Indicates whether the diagram has changed since the last save.

Returns:
true if there diagram has changed since the last save, otherwise false.

setDirty

public void setDirty(boolean value)
Lets you set or clear the diagram's modification flag.

Parameters:
value - true to mark the diagram as changed, otherwise false.

getFont

public java.awt.Font getFont()
Gets the default font for new diagram items.

Returns:
A Font object.

setFont

public void setFont(java.awt.Font font)
Sets the default font for new diagram items.

Parameters:
font - A Font object.

getLinkHeadShape

public int getLinkHeadShape()
Gets the default shape displayed as arrowhead of new links.

Returns:
One of the ArrowHead constants.

setLinkHeadShape

public void setLinkHeadShape(int value)
Sets what shape should be displayed as arrowhead of new links.

Parameters:
value - One of the ArrowHead constants.

getLinkBaseShape

public int getLinkBaseShape()
Gets the default shape displayed at the origin of new links.

Returns:
One of the ArrowHead constants.

setLinkBaseShape

public void setLinkBaseShape(int value)
Sets what shape should be displayed at the origin of new links.

Parameters:
value - One of the ArrowHead constants.

getLinkIntermediateShape

public int getLinkIntermediateShape()
Gets the default shape displayed at the middle of links segments.

Returns:
One of the ArrowHead constants.

setLinkIntermediateShape

public void setLinkIntermediateShape(int value)
Sets what shape should be displayed at the middle of links segments.

Parameters:
value - One of the ArrowHead constants.

getLinkHeadShapeSize

public float getLinkHeadShapeSize()
Gets the default size of the shape displayed as arrowhead of new links.

Returns:
A float value specifying the default arrowhead size.

setLinkHeadShapeSize

public void setLinkHeadShapeSize(float value)
Sets the default size of the shape displayed as arrowhead of new links.

Parameters:
value - A float value specifying the default arrowhead size.

getLinkBaseShapeSize

public float getLinkBaseShapeSize()
Gets the default size of the shape displayed at the origin of new links.

Returns:
A float value specifying the default size of the shapes displayed at the link base.

setLinkBaseShapeSize

public void setLinkBaseShapeSize(float value)
Sets the default size of the shape displayed at the origin of new links.

Parameters:
value - A float value specifying the default size of the shapes displayed at the link base.

getLinkIntermediateShapeSize

public float getLinkIntermediateShapeSize()
Gets the default size of the shape displayed at the middle of links segments.

Returns:
A float value specifying the default size of the shapes displayed in the middles of link segments.

setLinkIntermediateShapeSize

public void setLinkIntermediateShapeSize(float value)
Sets the default size of the shape displayed at the middle of links segments.

Parameters:
value - A float value specifying the default size of the shapes displayed in the middles of link segments.

getShowHandlesOnDrag

public boolean getShowHandlesOnDrag()
Gets whether selection handles of objects under the mouse are displayed while another object is being modified.

Returns:
true to display selection handles, otherwise false.

setShowHandlesOnDrag

public void setShowHandlesOnDrag(boolean value)
Sets whether selection handles of objects under the mouse should be displayed while another object is being modified.

Parameters:
value - true to display selection handles, otherwise false.

getShadowsStyle

public int getShadowsStyle()
Gets the style of shadows.

Returns:
One of the ShadowsStyle constants.

setShadowsStyle

public void setShadowsStyle(int value)
Sets the style of shadows.

Parameters:
value - One of the ShadowsStyle constants.

getLinkEndsMovable

public boolean getLinkEndsMovable()
Gets a value indicating users are allowed to move the end points of an link after the link is created.

Returns:
true if users are allowed to move the end points of new links, otherwise false.

setLinkEndsMovable

public void setLinkEndsMovable(boolean value)
Sets a value indicating users are allowed to move the end points of a link after the link is created.

Parameters:
value - true if users are allowed to move the end points of new links, otherwise false.

getAllowSplitLinks

public boolean getAllowSplitLinks()
Gets whether link segments can be added and removed interactively.

Returns:
true to make new links splittable by default, otherwise false.

setAllowSplitLinks

public void setAllowSplitLinks(boolean value)
Sets whether link segments can be added and removed interactively.

Parameters:
value - true to make new links splittable by default, otherwise false.

getInteraction

public InteractionState getInteraction()
Gets an InteractionState instance representing the current action being carried out by the user.

Returns:
The current InteractionState.

getLinkText

public java.lang.String getLinkText()
Gets the default text assigned to new links.

Returns:
A String containing the default link text.

setLinkText

public void setLinkText(java.lang.String value)
Sets the default text that should be assigned to new links.

Parameters:
value - A String containing the default link text.

getLinkTextStyle

public int getLinkTextStyle()
Gets the default placement and orientation of the links labels.

Returns:
One of the LinkTextStyle constants.

setLinkTextStyle

public void setLinkTextStyle(int value)
Sets the default placement and orientation of the links labels.

Parameters:
value - One of the LinkTextStyle constants.

getShapePen

public Pen getShapePen()
Gets the default pen assigned to new nodes.

Returns:
A Pen object.

setShapePen

public void setShapePen(Pen value)
Sets the default pen that should be assigned to new nodes.

Parameters:
value - A Pen object.

getShapeBrush

public Brush getShapeBrush()
Gets the default brush assigned to new nodes.

Returns:
A Brush object.

setShapeBrush

public void setShapeBrush(Brush value)
Sets the default brush that should be assigned to new nodes.

Parameters:
value - A Brush object.

getLinkPen

public Pen getLinkPen()
Gets the default pen assigned to new links.

Returns:
A Pen object that is assigned to newly created links.

setLinkPen

public void setLinkPen(Pen value)
Sets the default pen that should be assigned to new links.

Parameters:
value - A Pen object that should be assigned to newly created links.

getBoundsPen

public Pen getBoundsPen()
Gets the pen with which the diagram bounds are drawn.


setBoundsPen

public void setBoundsPen(Pen value)
Sets the pen with which document bounds are drawn.

Parameters:
value - A Pen object that should be assigned to newly created links.

getLinkBrush

public Brush getLinkBrush()
Gets the default brush assigned to new links.

Returns:
A Brush object that is assigned to newly created links.

setLinkBrush

public void setLinkBrush(Brush value)
Sets the default brush that should be assigned to new links.

Parameters:
value - A Brush object that should be assigned to newly created links.

getTablePen

public Pen getTablePen()
Gets the default pen assigned to new tables.

Returns:
A Pen object that is assigned to newly created tables.

setTablePen

public void setTablePen(Pen value)
Sets the default pen that should be assigned to new tables.

Parameters:
value - A Pen object that should be assigned to newly created tables.

getTableBrush

public Brush getTableBrush()
Gets the default brush assigned to new tables.

Returns:
A Brush object that is assigned to newly created tables.

setTableBrush

public void setTableBrush(Brush value)
Sets the default brush that should be assigned to new links.

Parameters:
value - A Brush object that should be assigned to newly created tables.

getAlignToGrid

public boolean getAlignToGrid()
Gets a value indicating whether items are aligned to the alignment grid while users draw them with the mouse.

Returns:
true if items are automatically aligned to the grid, otherwise false.

setAlignToGrid

public void setAlignToGrid(boolean value)
Sets a value indicating whether items should be aligned to the alignment grid while users draw them with the mouse.

Parameters:
value - true if items should be automatically aligned to the grid, otherwise false.

getShowGrid

public boolean getShowGrid()
Gets a value indicating whether the alignment grid is displayed.

Returns:
true if the alignment grid is drawn on the screen, otherwise false.

setShowGrid

public void setShowGrid(boolean value)
Sets a value indicating whether the alignment grid should be displayed.

Parameters:
value - true if the alignment grid should be drawn on the screen, otherwise false.

getGridColor

public java.awt.Color getGridColor()
Gets the color of the alignment grid.

Returns:
A Color object representing the grid color.

setGridColor

public void setGridColor(java.awt.Color value)
Sets the color of the alignment grid.

Parameters:
value - A Color object representing the grid color.

getGridSizeX

public float getGridSizeX()
Gets the horizontal distance between grid points.

Returns:
An integer value specifying the horizontal distance between grid points.

setGridSizeX

public void setGridSizeX(float value)
Sets or sets the horizontal distance between grid points.

Parameters:
value - An integer value specifying the horizontal distance between grid points.

getGridSizeY

public float getGridSizeY()
Gets the vertical distance between grid points.

Returns:
An integer value specifying the vertical distance between grid points.

setGridSizeY

public void setGridSizeY(float value)
Sets the vertical distance between grid points.

Parameters:
value - An integer value specifying the vertical distance between grid points.

getGridStyle

public int getGridStyle()
Gets the appearance style of the alignment grid.

Returns:
One of the GridStyle constants.

setGridStyle

public void setGridStyle(int value)
Sets the appearance style of the alignment grid.

Parameters:
value - One of the GridStyle constants.

getTableStyle

public int getTableStyle()
Gets the default style of tables.

Returns:
One of the TableStyle constants.

setTableStyle

public void setTableStyle(int value)
Sets the default style of tables.

Parameters:
value - One of the TableStyle constants.

getShadowColor

public java.awt.Color getShadowColor()
Gets the color of items shadows.

Returns:
A Color object representing the shadow color.

setShadowColor

public void setShadowColor(java.awt.Color value)
Sets the color of items shadows.

Parameters:
value - A Color object representing the shadow color.

getBackgroundImageAlign

public int getBackgroundImageAlign()
Gets how the background image is positioned relatively to the scrollable area of the diagram.

Returns:
One of the ImageAlign constants.

setBackgroundImageAlign

public void setBackgroundImageAlign(int value)
Sets how the background image should be positioned relatively to the scrollable area of the diagram.

Parameters:
value - One of the ImageAlign constants.

getImageDpiX

public int getImageDpiX()
Specifies the default resolution of images. It is used for conversion between image (pixel) coordinates and document coordinates. Some image formats contain this information and some not. Java has no standard way to obtain it, so this property is used instead. Zero means use default value. The default value is obtained from Toolkit#getScreenResolution()


setImageDpiX

public void setImageDpiX(int dpi)

getImageDpiY

public int getImageDpiY()

setImageDpiY

public void setImageDpiY(int dpi)

getTablesScrollable

public boolean getTablesScrollable()
Gets a value indicating whether users are allowed to scroll new tables.

Returns:
true if the rows of newly created tables can be scrolled up or down, otherwise false.

setTablesScrollable

public void setTablesScrollable(boolean value)
Sets a value indicating whether users are allowed to scroll new tables.

Parameters:
value - true if the rows of newly created tables can be scrolled up or down, otherwise false.

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Specified by:
imageUpdate in interface java.awt.image.ImageObserver

getFactory

public Factory getFactory()
Gets a Factory instance that lets you add programmatically new items to the diagram.


getLinks

public DiagramLinkList getLinks()
Gets a collection of all links in the diagram.

Returns:
An DiagramLinkList containing all links in the diagram.

getNodes

public DiagramNodeList getNodes()
Gets a collection of all nodes in the diagram.

Returns:
A ShapeNodeList containing all nodes in the diagram.

getGroups

public GroupList getGroups()
Gets a collection of all groups in the diagram.

Returns:
A GroupList containing all groups in the diagram.

getItems

public DiagramItemList getItems()
Gets a collection of all items in the diagram.

Returns:
An DiagramItemList containing all items in the diagram.

items

public <T extends DiagramItem> java.lang.Iterable<T> items(java.lang.Class<T> desiredType)
Iterates over diagram items of the desired type

Type Parameters:
T - desiredType
Parameters:
desiredType -
Returns:
Iterable which lets you iterate the specified items

getTextColor

public java.awt.Color getTextColor()
Gets the default text color that is assigned to new items.

Returns:
A Color object representing the default text color.

setTextColor

public void setTextColor(java.awt.Color value)
Sets the default text color that should be assigned to new items.

Parameters:
value - A Color object representing the default text color.

getLinkStyle

public int getLinkStyle()
Gets the default style of links.

Returns:
One of the LinkStyle constants.

setLinkStyle

public void setLinkStyle(int value)
Sets the style that should be assigned to new links.

Parameters:
value - One of the LinkStyle constants.

getLinkSegments

public short getLinkSegments()
Gets the default number of link segments.

Returns:
An integer value specifying the default number of link segments.

setLinkSegments

public void setLinkSegments(short value)
Sets the default number of link segments.

Parameters:
value - An integer value specifying the default number of link segments.

getActiveItem

public DiagramItem getActiveItem()
Gets the active item.

Returns:
A reference to the active DiagramItem.

setActiveItem

public void setActiveItem(DiagramItem value)
Sets the active item.

Parameters:
value - A reference to an DiagramItem that should be made the active one.

add

public void add(DiagramItem item)
Adds a new item to the diagram.

Parameters:
item - An DiagramItem that should be added to the diagram.

add

public void add(DiagramItem item,
                boolean select)
Adds a new item to the diagram and optionally selects it.

Parameters:
item - An DiagramItem that should be added to the diagram.
select - true if the item should be selected, otherwise false.

findNode

public DiagramNode findNode(java.lang.Object tag)
Finds the node that has the specified tag.

Parameters:
tag - An Object to which the tag of the found node should be equal.
Returns:
A reference to the found DiagramNode.

findLink

public DiagramLink findLink(java.lang.Object tag)
Finds the link that has the specified tag.

Parameters:
tag - An Object to which the tag of the found link should be equal.
Returns:
A reference to the found DiagramLink.

findGroup

public Group findGroup(java.lang.Object tag)
Finds the group that has the specified tag.

Parameters:
tag - An Object to which the tag of the found group should be equal.
Returns:
A reference to the found Group.

getShowDisabledHandles

public boolean getShowDisabledHandles()
Gets whether disabled manipulation handles are displayed.

Returns:
true if disabled selection handles are shown, otherwise false.

setShowDisabledHandles

public void setShowDisabledHandles(boolean value)
Sets whether disabled manipulation handles should be displayed.

Parameters:
value - true if disabled selection handles should be drawn, otherwise false.

getShapeHandlesStyle

public int getShapeHandlesStyle()
Gets the default style of box selection handles.

Returns:
One of the HandlesStyle constants.

setShapeHandlesStyle

public void setShapeHandlesStyle(int value)
Sets the style of selection handles that should be assigned to new nodes.

Parameters:
value - One of the HandlesStyle constants.

getTableHandlesStyle

public int getTableHandlesStyle()
Gets the default style of table selection handles.

Returns:
One of the HandlesStyle constants.

setTableHandlesStyle

public void setTableHandlesStyle(int value)
Sets the style of selection handles that should be assigned to new tables.

Parameters:
value - One of the HandlesStyle constants.

resizeToFitItems

public void resizeToFitItems(float margins)
Resizes the document area so that it fits exactly the diagram items.

Parameters:
margins - A float value specifying how much space to leave between the items and the document borders.

resizeToFitItems

public void resizeToFitItems(float margins,
                             boolean onlyVisible)
Resizes the document area so that it fits exactly the diagram items.

Parameters:
margins - A float value specifying how much space to leave between the items and the document borders.
onlyVisible - true to include only visible items in the new document size, otherwise false.

getAllowSelfLoops

public boolean getAllowSelfLoops()
Gets whether users are allowed to draw reflexive links.

Returns:
true if users are allowed to draw reflexive links, otherwise false.

setAllowSelfLoops

public void setAllowSelfLoops(boolean value)
Sets whether users are allowed to draw reflexive links.

Parameters:
value - true if users are allowed to draw reflexive links, otherwise false.

getDefaultShape

public Shape getDefaultShape()
Gets the default shape of nodes.

Returns:
The default Shape object that is assigned to newly created nodes.

setDefaultShape

public void setDefaultShape(Shape value)
Sets the default shape that should be assigned to new nodes. The shape of individual nodes can be set by calling their ShapeNode.setShape(com.mindfusion.diagramming.Shape) method.

Parameters:
value - The default Shape object that should be assigned to newly created nodes.

getShapeText

public java.lang.String getShapeText()
Gets the default text assigned to new nodes.

Returns:
A String containing the default box text.

setShapeText

public void setShapeText(java.lang.String value)
Sets the default text that should be assigned to new nodes.

Parameters:
value - A String containing the default box text.

getContainerCaption

public java.lang.String getContainerCaption()
Gets the default value for the Caption property of containers.

Returns:
A String containing the default caption string.

setContainerCaption

public void setContainerCaption(java.lang.String containerCaption)
Sets the default value for the Caption property of containers.

Parameters:
containerCaption - A String containing the default caption string.

getContainerCaptionHeight

public float getContainerCaptionHeight()
Gets the default value for the CaptionHeight property of containers.


setContainerCaptionHeight

public void setContainerCaptionHeight(float containerCaptionHeight)
Sets the default value for the CaptionHeight property of containers.


getContainerHighlightPen

public Pen getContainerHighlightPen()
Gets the default value for the HighlightPen property of containers.


setContainerHighlightPen

public void setContainerHighlightPen(Pen containerHighlightPen)
Sets the default value for the HighlightPen property of containers.


getContainerMargin

public float getContainerMargin()
Gets the default value for the Margin property of containers.


setContainerMargin

public void setContainerMargin(float containerMargin)
Sets the default value for the Margin property of containers.


getContainerMinimumSize

public java.awt.geom.Dimension2D getContainerMinimumSize()
Gets the default value for the MinimumSize property of containers.


setContainerMinimumSize

public void setContainerMinimumSize(java.awt.geom.Dimension2D containerMinimumSize)
Sets the default value for the MinimumSize property of containers.


getContainersFoldable

public boolean getContainersFoldable()
Gets the default value for the Foldable property of containers.


setContainersFoldable

public void setContainersFoldable(boolean containersFoldable)
Sets the default value for the Foldable property of containers.


getTextFormat

public TextFormat getTextFormat()
Gets the default format and alignment of the text of new items.

Returns:
A TextFormat object specifying the text format and alignment.

setTextFormat

public void setTextFormat(TextFormat value)
Sets the default format and alignment of the text of new items.

Parameters:
value - A TextFormat object specifying the text format and alignment.

getMergeThreshold

public float getMergeThreshold()
Gets the maximum distance between adjacent control points of a link at which the respective segments can be merged.

Returns:
A float value specifying the maximal merge distance.

setMergeThreshold

public void setMergeThreshold(float value)
Sets the maximum distance between adjacent control points of a link at which the respective segments can be merged.

Parameters:
value - A float value specifying the maximal merge distance.

getSelectAfterCreate

public boolean getSelectAfterCreate()
Gets a value indicating whether newly created items are selected automatically.

Returns:
true if newly created items are selected automatically, otherwise false.

setSelectAfterCreate

public void setSelectAfterCreate(boolean value)
Sets a value indicating whether newly created items should be selected automatically.

Parameters:
value - true if newly created items should be selected automatically, otherwise false.

setShadowOffset

public void setShadowOffset(float x,
                            float y)
Sets the distance at which shadows are offset from the items that cast them.

Parameters:
x - Specifies the horizontal shadow offset.
y - Specifies the vertical shadow offset.

getBounds

public java.awt.geom.Rectangle2D.Float getBounds()
Gets the bounds of the scrollable area of the diagram.

Returns:
A Rectangle2D.Float object representing the current document scrollable region.

setBounds

public void setBounds(java.awt.geom.Rectangle2D.Float value)
Sets the size of the diagram's scrollable area.


setBounds

public void setBounds(java.awt.geom.Rectangle2D value)
Sets the bounds of the scrollable area of the diagram.

Parameters:
value - A Rectangle2D object representing the document scrollable region.

getTag

public java.lang.Object getTag()
Gets the custom data associated with this diagram. If the tag object is serializable, it will be automatically saved when serializing the diagram into binary format. When serializing to XML, you can save the tag by handling the DiagramListener.serializeTag(com.mindfusion.diagramming.SerializeTagEvent) event.

Returns:
An Object assigned to the diagram via setTag(java.lang.Object).

setTag

public void setTag(java.lang.Object value)
Associates a custom data with this diagram.

Parameters:
value - An Object containing custom data.

clearAll

public void clearAll()
Deletes all items from the diagram.


getShapeCustomDraw

public int getShapeCustomDraw()
Gets whether new nodes should be custom drawn and what type of custom drawing will be performed on them.

Returns:
One of the CustomDraw constants.

setShapeCustomDraw

public void setShapeCustomDraw(int value)
Sets whether new nodes should be custom drawn and what type of custom drawing will be performed on them.

Parameters:
value - One of the CustomDraw constants.

getLinkCustomDraw

public int getLinkCustomDraw()

setLinkCustomDraw

public void setLinkCustomDraw(int value)

getShadowOffsetX

public float getShadowOffsetX()
Gets the default horizontal distance between shadows and the items that cast them.

Returns:
A float value specifying the horizontal shadow offset.

setShadowOffsetX

public void setShadowOffsetX(float value)
Sets the default horizontal distance between shadows and the items that cast them.

Parameters:
value - A float value specifying the horizontal shadow offset.

getShadowOffsetY

public float getShadowOffsetY()
Gets the default vertical distance between shadows and the items that cast them.

Returns:
A float value specifying the vertical shadow offset.

setShadowOffsetY

public void setShadowOffsetY(float value)
Sets the default vertical distance between shadows and the items that cast them.

Parameters:
value - A float value specifying the vertical shadow offset.

getRestrictItemsToBounds

public int getRestrictItemsToBounds()
Gets a value indicating whether users are allowed to move items outside the currently define document bounds.

Returns:
One of the RestrictToBounds constants.

setRestrictItemsToBounds

public void setRestrictItemsToBounds(int value)
Sets a value indicating whether users are allowed to move items outside the currently define document bounds.

Parameters:
value - One of the RestrictToBounds constants.

getDynamicLinks

public boolean getDynamicLinks()
Gets a value indicating whether links automatically update their end points positions so that they will always point towards the node centers.

Returns:
true if newly created links are set to update their end point positions automatically, otherwise false.

setDynamicLinks

public void setDynamicLinks(boolean value)
Sets a value indicating whether links should automatically update their end points positions so that they will always point towards the node centers.

Parameters:
value - true if newly created links should be set to update their end point positions automatically, otherwise false.

getLinksSnapToBorders

public boolean getLinksSnapToBorders()
Gets a value indicating whether newly created links are set to align their end points to the borders of the nodes they connect.

Returns:
true if newly created links are set to align automatically to node borders when modified, otherwise false.

setLinksSnapToBorders

public void setLinksSnapToBorders(boolean value)
Sets a value indicating whether newly created links are set to align their end points to the borders of the nodes they connect.

Parameters:
value - true if newly created links are set to align automatically to node borders when modified, otherwise false.

getLinksRetainForm

public boolean getLinksRetainForm()
Gets a value indicating whether new links are set to maintain their shapes while the nodes they connect are moved around.

Returns:
true if newly created links keep their shapes, otherwise false.

setLinksRetainForm

public void setLinksRetainForm(boolean value)
Sets a value indicating whether new links are set to maintain their shapes while the nodes they connect are moved around.

Parameters:
value - true if newly created links should preserve their shapes, otherwise false.

getRouteLinks

public boolean getRouteLinks()
Gets a value indicating whether newly created links will automatically find their way between nodes.

Returns:
true if newly created links are set to find their routes automatically, otherwise false.

setRouteLinks

public void setRouteLinks(boolean value)
Sets a value indicating whether newly created links will automatically find their way between nodes.

Parameters:
value - true if newly created links should be set to find their routes automatically, otherwise false.

getRoutingOptions

public RoutingOptions getRoutingOptions()
Gets a RoutingOptions instance that lets you set various attributes of the link routing algorithm.

Returns:
A reference to a RoutingOptions object.

getLinkRouter

public LinkRouter getLinkRouter()
Gets the component used to find paths for auto-routed links when diagram nodes are added or their positions change.


setLinkRouter

public void setLinkRouter(LinkRouter value)
Sets the component used to find paths for auto-routed links when diagram nodes are added or their positions change.


routeAllLinks

public void routeAllLinks()
Routes all links in the diagram so that they will not cross any node.


getTableRowCount

public int getTableRowCount()
Gets how many rows new tables have by default.

Returns:
An integer value specifying the default number of table rows.

setTableRowCount

public void setTableRowCount(int value)
Sets how many rows should be allocated to new tables.

Parameters:
value - An integer value specifying the default number of table rows.

getTableColumnCount

public int getTableColumnCount()
Gets how many columns new tables have by default.

Returns:
An integer value specifying the default number of table columns.

setTableColumnCount

public void setTableColumnCount(int value)
Sets how many columns should be allocated to new tables.

Parameters:
value - An integer value specifying the default number of table columns.

getTableColumnWidth

public float getTableColumnWidth()
Gets the default width of the columns of new tables.

Returns:
A float value specifying the default width of table columns.

setTableColumnWidth

public void setTableColumnWidth(float value)
Sets the default width of columns in newly created tables.

Parameters:
value - A float value specifying the default width of table columns.

getTableRowHeight

public float getTableRowHeight()
Gets the default height of the row of new tables.

Returns:
A float value specifying the default height of table rows.

setTableRowHeight

public void setTableRowHeight(float value)
Sets the default height of rows in newly created tables.

Parameters:
value - A float value specifying the default height of table rows.

getTableCaptionHeight

public float getTableCaptionHeight()
Gets the default height of the caption area of new tables.

Returns:
A float value specifying the default height of table caption bars.

setTableCaptionHeight

public void setTableCaptionHeight(float value)
Sets the default height of the caption area of new tables.

Parameters:
value - A float value specifying the default height of table caption bars.

getTableConnectionStyle

public int getTableConnectionStyle()
Gets how users are allowed to link tables one to another - as integral entities, by rows, or both.

Returns:
One of the TableConnectionStyle constants.

setTableConnectionStyle

public void setTableConnectionStyle(int value)
Sets how users are allowed to link tables one to another - as integral entities, by rows, or both.

Parameters:
value - One of the TableConnectionStyle constants.

destroyGroup

public void destroyGroup(Group group)
Destroys the specified group. The group items are not deleted, unless its autoDeleteItems attribute is set.

Parameters:
group - The Group to destroy.

copySelection

public SelectionCopy copySelection(Diagram source,
                                   boolean unconnectedLinks,
                                   boolean copyGroups)
Creates a copy of the currently selected objects and groups.


pasteSelection

public boolean pasteSelection(Diagram doc,
                              SelectionCopy data,
                              CompositeCmd cmd,
                              float dx,
                              float dy)
Adds the specified items and groups to the specified diagram document.


getTableCaption

public java.lang.String getTableCaption()
Gets the default caption text assigned to new tables.

Returns:
A String containing the default table caption.

setTableCaption

public void setTableCaption(java.lang.String value)
Sets the default caption text that should be assigned to new tables.

Parameters:
value - A String containing the default table caption.

getLinkCascadeOrientation

public int getLinkCascadeOrientation()
Gets the default orientation of the first segments of cascading links.

Returns:
One of the Orientation constants.

setLinkCascadeOrientation

public void setLinkCascadeOrientation(int value)
Sets the default orientation of the first segments of cascading links.

Parameters:
value - One of the Orientation constants.

getCellFrameStyle

public int getCellFrameStyle()
Gets the default style of the cell frames of new tables.

Returns:
One of the CellFrameStyle constants.

setCellFrameStyle

public void setCellFrameStyle(int value)
Sets the default style of the cell frames of new tables.

Parameters:
value - One of the CellFrameStyle constants.

getNodeAt

public DiagramNode getNodeAt(java.awt.geom.Point2D point)
Returns the top-most node that contains the specified point.

Parameters:
point - A Point2D object specifying where to look for a node.
Returns:
The DiagramNode found at the specified position.

getNodeAt

public DiagramNode getNodeAt(java.awt.geom.Point2D point,
                             float threshold)
Returns the top-most node that contains the specified point.

Parameters:
point - A Point2D object specifying where to look for a node.
threshold - Allowed distance from the node.
Returns:
The DiagramNode found at the specified position.

getNodesAt

public DiagramNodeList getNodesAt(java.awt.geom.Point2D.Float point)
Returns the nodes that contain the specified point.

Parameters:
point - A Point2D.Float object specifying where to look for nodes.
Returns:
A DiagramNodeList containing all nodes found at the specified position.

getLinkAt

public DiagramLink getLinkAt(java.awt.geom.Point2D.Float point,
                             float maxDist)
Returns the top-most link that passes near the specified point.

Parameters:
point - A Point2D.Float object specifying where to look for a link.
maxDist - Specifies the maximum allowed distance from the point to the link.
Returns:
The DiagramLink found at the specified position.

getLinkAt

public DiagramLink getLinkAt(java.awt.geom.Point2D point,
                             double maxDist,
                             boolean exclLocked)
Returns the top-most link that passes near the specified point.

Parameters:
point - A Point2D object specifying where to look for a link.
maxDist - Specifies the maximum allowed distance from the point to the link.
exclLocked - true if locked links should be excluded from the search, otherwise false.
Returns:
The DiagramLink found at the specified position.

getLinkAt

public DiagramLink getLinkAt(java.awt.geom.Point2D point,
                             double maxDist,
                             boolean excludeLocked,
                             boolean excludeModified)
Returns the top-most link that passes near the specified point.

Parameters:
point - A Point2D object specifying where to look for a link.
maxDist - Specifies the maximum allowed distance from the point to the link.
excludeLocked - true if locked links should be excluded from the search, otherwise false.
Returns:
The DiagramLink found at the specified position.

getLinkAt

public DiagramLink getLinkAt(java.awt.geom.Point2D point,
                             double maxDist,
                             boolean excludeLocked,
                             boolean excludeModified,
                             ByRef<java.lang.Integer> segmNum)
Returns the top-most link that passes near the specified point.

Parameters:
point - A Point2D object specifying where to look for a link.
maxDist - Specifies the maximum allowed distance from the point to the link.
excludeLocked - true if locked links should be excluded from the search, otherwise false.
segmNum - An output parameter that returns the index of the link segment that is closest to the specified point
Returns:
The DiagramLink found at the specified position.

getItemAt

public DiagramItem getItemAt(java.awt.geom.Point2D point,
                             boolean excludeLocked)
Returns the top-most item that contains the specified point.

Parameters:
point - A Point2D object specifying where to look for an item.
excludeLocked - true if locked items should be excluded from the search, otherwise false.
Returns:
The DiagramItem found at the specified position.

getItemAt

public DiagramItem getItemAt(java.awt.geom.Point2D point,
                             boolean excludeLocked,
                             boolean excludeModified)
Returns the top-most item that contains the specified point.

Parameters:
point - A Point2D object specifying where to look for an item.
excludeLocked - true if locked items should be excluded from the search, otherwise false.
Returns:
The DiagramItem found at the specified position.

getNodeAt

public DiagramNode getNodeAt(java.awt.geom.Point2D point,
                             boolean excludeLocked,
                             boolean excludeSelected)
Returns the top-most node that contains the specified point.

Parameters:
point - A Point2D object specifying where to look for a node.
excludeLocked - true if locked items should be excluded from the search, otherwise false.
excludeSelected - true if selected items should be excluded from the search, otherwise false.
Returns:
The DiagramNode found at the specified position.

getAdjustmentHandlesSize

public float getAdjustmentHandlesSize()
Gets the size of selection handles.

Returns:
A float value specifying the size of selection handles.

setAdjustmentHandlesSize

public void setAdjustmentHandlesSize(float value)
Sets the size of selection handles.

Parameters:
value - A float value specifying the size of selection handles.

getSelection

public Selection getSelection()
Gets a Selection instance representing the current selection.

Returns:
A reference to the Selection object.

getExpandOnIncoming

public boolean getExpandOnIncoming()
Gets which direction of links is considered the tree direction when expanding or collapsing diagram branches.

Returns:
true is tree branches are expanded in the direction of incoming links, otherwise false.

setExpandOnIncoming

public void setExpandOnIncoming(boolean value)
Sets which direction of links is considered the tree direction when expanding or collapsing diagram branches.

Parameters:
value - true is tree branches should be expanded in the direction of incoming links, otherwise false.

getRecursiveExpand

public boolean getRecursiveExpand()
Gets whether tree branches are expanded recursively.

Returns:
true if tree branches are expanded recursively.

setRecursiveExpand

public void setRecursiveExpand(boolean value)
Sets whether tree branches should be expanded recursively.

Parameters:
value - true if tree branches should be expanded recursively.

getNodesExpandable

public boolean getNodesExpandable()
Gets whether the tree branches that start from new nodes are expandable by default.

Returns:
true if nodes are expandable by default, otherwise false.

setNodesExpandable

public void setNodesExpandable(boolean value)
Sets whether the tree branches that start from new nodes should be expandable by default.

Parameters:
value - true if nodes should be expandable by default, otherwise false.

setDirty

public void setDirty()
Marks the diagram as modified.


repaint

public void repaint(java.awt.geom.Rectangle2D docRect)
Repaints the specified region of the diagram.

Parameters:
docRect - A Rectangle2D object representing the region of the diagram that should be repainted.

repaint

public void repaint(java.lang.Object sender,
                    java.awt.geom.Rectangle2D docRect)
Repaints the specified region of the diagram.

Parameters:
sender -
docRect -

repaint

public void repaint()
Repaints the diagram.


repaint

public void repaint(boolean redrawCacheImage)
Causes the entire visible diagram area to be repainted.

Parameters:
redrawCacheImage -

getAllowLinksRepeat

public boolean getAllowLinksRepeat()
Gets a value indicating whether users are allowed to draw more than one links between the same nodes.

Returns:
true if users are allowed to draw more than one link between the same nodes, otherwise false.

setAllowLinksRepeat

public void setAllowLinksRepeat(boolean value)
Sets a value indicating whether users are allowed to draw more than one links between the same nodes.

Parameters:
value - true if users are allowed to draw more than one link between the same nodes, otherwise false.

getHitTestPriority

public int getHitTestPriority()
Gets a value indicating the order in which items are hit-tested.

Returns:
A member of the HitTestPriority enumeration.

setHitTestPriority

public void setHitTestPriority(int value)
Sets a value indicating the order in which items are hit-tested.

Parameters:
value - A member of the HitTestPriority enumeration.

getSelectionOnTop

public boolean getSelectionOnTop()
Gets a value indicating whether selected items are drawn on top of the non-selected ones.

Returns:
true if selected items are drawn above non-selected ones, otherwise false.

setSelectionOnTop

public void setSelectionOnTop(boolean value)
Sets a value indicating whether selected items should be drawn on top of the non-selected ones.

Parameters:
value - true if selected items should be drawn above non-selected ones, otherwise false.

getShowAnchors

public int getShowAnchors()
Gets a value indicating whether anchor points should be shown on screen.

Returns:
A bitwise combination of the ShowAnchors constants.

setShowAnchors

public void setShowAnchors(int value)
Sets a value indicating whether anchor points should be shown on screen.

Parameters:
value - A bitwise combination of the ShowAnchors constants.

getSnapToAnchor

public int getSnapToAnchor()
Gets a value indicating when links should snap to anchor points.

Returns:
One of the SnapToAnchor constants.

setSnapToAnchor

public void setSnapToAnchor(int value)
Sets a value indicating when links should snap to anchor points.

Parameters:
value - One of the SnapToAnchor constants.

getShapeOrientation

public float getShapeOrientation()
Gets the default shape definition orientation angle assigned to new nodes.

Returns:
The default orientation applied to shape definitions when assigning shapes to nodes.

setShapeOrientation

public void setShapeOrientation(float value)
Sets the default shape definition orientation angle assigned to new nodes.

Parameters:
value - The default orientation applied to shape definitions when assigning shapes to nodes.

getAllowUnconnectedLinks

public boolean getAllowUnconnectedLinks()
Gets a value indicating whether users are allowed to draw unconnected links.

Returns:
true if users are allowed to draw unconnected links, otherwise false.

setAllowUnconnectedLinks

public void setAllowUnconnectedLinks(boolean value)
Sets a value indicating whether users are allowed to draw unconnected links.

Parameters:
value - true if users are allowed to draw unconnected links, otherwise false.

getAutoResize

public int getAutoResize()
Gets a value specifying whether the document scrollable area is resized automatically when users draw items near the edges of the diagram.

Returns:
One of the AutoResize constants.

setAutoResize

public void setAutoResize(int value)
Sets a value specifying whether the document scrollable area should be resized automatically when users draw items near the edges of the diagram.

Parameters:
value - One of the AutoResize constants.

getEnableStyledText

public boolean getEnableStyledText()
Gets a value indicating whether new nodes display richly formatted text.

Returns:
true if text formatting tags are processed by default, otherwise false.

setEnableStyledText

public void setEnableStyledText(boolean value)
Sets a value indicating whether newly created nodes should display richly formatted text.

Parameters:
value - true if text formatting tags should be processed by default, otherwise false.

getBackBrush

public Brush getBackBrush()
Gets the diagram's background brush.

Returns:
The background Brush.

setBackBrush

public void setBackBrush(Brush value)
Sets the diagram's background brush.

Parameters:
value - A Brush object representing the background brush.

getLinkCrossings

public int getLinkCrossings()
Gets what shapes are drawn at link crossing points.

Returns:
One of the LinkCrossings constants.

setLinkCrossings

public void setLinkCrossings(int value)
Sets what shapes should be drawn at the points where links cross.

Parameters:
value - One of the LinkCrossings constants.

getCrossingRadius

public float getCrossingRadius()
Gets the radius of the shapes drawn at link crossing points.

Returns:
A float value specifying the size of the shapes drawn at link intersection points.

setCrossingRadius

public void setCrossingRadius(float value)
Sets the radius of the shapes drawn at link crossing points.

Parameters:
value - A float value specifying the size of the shapes drawn at link intersection points.

getAllowUnanchoredLinks

public boolean getAllowUnanchoredLinks()
Gets a value indicating whether users are allowed to attach links to nodes that do not have any anchor points.

Returns:
true if users are allowed to attach links to nodes that do not have anchor points, otherwise false.

setAllowUnanchoredLinks

public void setAllowUnanchoredLinks(boolean value)
Sets a value indicating whether users are allowed to attach links to nodes that do not have any anchor points.

Parameters:
value - true to lets users attach links to nodes that do not have anchor points, otherwise false.

getBackgroundImage

public java.awt.Image getBackgroundImage()
Gets the background image.

Returns:
The background java.awt.Image object.

setBackgroundImage

public void setBackgroundImage(java.awt.Image value)
Sets the background image. The imageUrl property is reset to null.

Parameters:
value - The background java.awt.Image object.

setBackgroundImageUrl

public void setBackgroundImageUrl(java.lang.String value)
Sets the URL of the background image. Default applet security allows only images on the same server. URL may be relative to the document base for applets or current dir for applications.

Parameters:
value - The URL of the background image.

setBackgroundImage

public void setBackgroundImage(java.awt.Image img,
                               java.lang.String url)
Allows setting of both image and imageUrl properties as other setters reset the skipped argument. If the image is not null then no download is performed. It is assumed that at the specified URL is the specified image. This setter is preferred when the image is already available and it is desirable that the url is also present

Parameters:
img - The Image object that should be displayed in the background.
url - A string specifying the image URL.

getBackgroundImageUrl

public java.lang.String getBackgroundImageUrl()
Gets the URL of the background image.


getToolTip

public java.lang.String getToolTip()
Gets the tooltip text.

Returns:
A String containing the tooltip text.

setToolTip

public void setToolTip(java.lang.String value)
Sets the tooltip text that should be displayed when the mouse hovers over an unoccupied area of the diagram.

Parameters:
value - A String containing the tooltip text.

getExpandButtonAction

public int getExpandButtonAction()
Gets what should happen when a user clicks the +/- button that is displayed near expandable nodes.

Returns:

setExpandButtonAction

public void setExpandButtonAction(int value)
Sets what should happen when a user clicks the +/- button that is displayed near expandable nodes.

Parameters:
value -

getExpandButtonPosition

public int getExpandButtonPosition()
Gets where expand/collapse buttons are located relatively to their nodes.

Returns:
A member of the ExpandButtonPosition enumeration.

setExpandButtonPosition

public void setExpandButtonPosition(int value)
Sets where expand/collapse buttons are located relatively to their nodes.

Parameters:
value - A member of the ExpandButtonPosition enumeration.

getActiveItemHandlesStyle

public HandlesVisualStyle getActiveItemHandlesStyle()
Gets the visual style of the manipulation handles displayed around the active item.

Returns:
A HandlesVisualStyle object representing the visual style of the selection handles of the active item.

getSelectedItemHandlesStyle

public HandlesVisualStyle getSelectedItemHandlesStyle()
Gets the visual style of the manipulation handles displayed around selected items.

Returns:
A HandlesVisualStyle object representing the visual style of selection handles.

getDisabledHandlesStyle

public HandlesVisualStyle getDisabledHandlesStyle()
Gets the visual style of disabled manipulation handles.

Returns:
A HandlesVisualStyle object representing the visual style of disabled selection handles.