Search
Version History

The list below describes past changes and additions to JDiagram:

New in version 4.6.2

Multiple labels per node

The NodeLabel class allows multiple captions to be displayed for a single DiagramNode of any type. Node labels provide a set of properties allowing full customization of their display and positioning. Label position is defined by specifying a pin point and offset from it, set through setCornerPosition, setEdgePosition, setCenterPosition methods. In addition, the HorizontalAlign and VerticalAlign properties of NodeLabel specify on which side of pin point to draw the label's caption.

For example, following code adds extra labels to top-left and bottom-right corners of a ShapeNode:

Java  Copy Code

ShapeNode node = diagram.getFactory().createShapeNode(10, 50, 40, 30);
node.setText("text"); // centered main text

NodeLabel lb1 = node.addLabel("label 1");
lb1.setCornerPosition(0, 0, 0);
lb1.setHorizontalAlign(Align.Near);
lb1.setVerticalAlign(Align.Near);
lb1.setBrush(new SolidBrush(Color.red));
lb1.setTextColor(Color.white);

NodeLabel lb2 = node.addLabel("label 2");
lb2.setCornerPosition(2, 0, 0);
lb2.setHorizontalAlign(Align.Far);
lb2.setVerticalAlign(Align.Far);
lb2.setBrush(new SolidBrush(Color.yellow));
lb2.setTextColor(Color.red);

Miscellaneous

  • Improved text rendering quality on high-resolution displays.
  • Fixed automatic scrolling and ZoomControl panning on high-resolution displays.
  • Improved ZoomControl rendering quality.
  • More precise vertical centering of text in table captions and cells.
  • The MoveLabels behavior lets user move link and node labels interactively.
  • ExcelExporter exports pen width of links.
  • ExcelExporter sets more precise positions of link end points.
  • HorizontalOffset and VerticalOffset now work for link labels positioned using setLinkLengthPosition method.
  • DashStyle.DashDotDot serialization fix.

New in version 4.6.1

TableNode improvements

TreeViewNode improvements

  • The Brush property of TreeViewItem allows assigning different backgrounds to individual items.
  • The ShowLines property lets you toggle visibility of items' connecting lines.

Miscellaneous

Fixed exception when serializing LinkLabel in JSON format.

New in version 4.6

Scrollable containers

Set the Scrollable property of ContainerNode to let users scroll the container's contents. The node then displays scrollbars at right and bottom edges that can be used to scroll interactively. The ScrollX and ScrollY properties let you determine current scroll position or change it programmatically. Note that in order to let container's content overflow and become scrollable, you must either disable AutoGrow, or allow users reduce container size by changing HandlesStyle and EnabledHandles properties from their default MoveOnly / Move values.

Container improvements

  • ContainerNode containment is no longer implemented via a Group object. Child nodes are now stored in a dedicated Children list, and a node's container is returned by the Container property.
  • Enable the AutoDeleteChildren property to automatically delete child nodes when a container is deleted.
  • Drag-and-drop operations from NodeListView and ShapeListBox automatically add the newly created node to a container if one is found at the drop position.
  • Call the resizeToFitChildren method to resize a container, making it big enough to contain its child nodes.
  • The KeepInsideParent constraint of child nodes now also prevents them from overlapping the container's caption bar.
  • The AutoGrow property lets you prevent ContainerNode from growing when adding child nodes to it.

Text rendering improvements

  • If WrapAtCharacter is disabled, long words that do not fit on a single line are now rendered clipped by default instead of stopping rendering at their position.
  • WrapOverflowingSingleWordLines property of TextFormat enables wrapping of long words that would not fit on a single line, while other text lines keep wrapping only at word boundaries.

Lasso zoom tool

The control now supports several ways to zoom using lasso tool:

Modifier keys

The ModifierKeyActions property of DiagramView lets you bind modifier keys to diagram actions defined in ModifierKeyAction enum to execute when dragging with left mouse button with respective key pressed:

  • None: disables the modifier.
  • Pan: pans the view.
  • Select: draws selection lasso.
  • OverrideBehavior: draws a new item instead of grabbing adjustment handle.
  • Magnify: shows magnifier.
  • ExtendSelection: adds to selection without deselecting items outside of lasso.
  • Zoom: draws zoom lasso.

Button bindings

RightButtonActions and MiddleButtonActions properties of DiagramView let you map mouse buttons to members of the MouseButtonAction enum (Pan, Cancel, Select, Draw, Magnify, Zoom) specifying how mouse click or drag operations affect the diagram.

Miscellaneous

  • The initializeLasso event lets you customize appearance of selection lasso before it shows on screen.
  • New bringIntoView overload lets you scroll to specified rectangular area.
  • New zoomToRect overload lets you zoom to a rectangular area while keeping it centered in the viewport.
  • ImageAlign supports new FitLeft, FitTop, FitRight and FitBottom alignment styles, which resize Image to fit node's boundaries and align it to respective border.
  • Layout classes now process DiagramLinks connected to TreeViewItems.
  • Fixed background drawing glitch when the diagram is smaller than current viewport and grows due to AutoResize.

API changes

  • Container's child nodes are no longer accessible via SubordinateGroup; use the container's Children list instead.
  • A node's container is no longer accessible via MasterGroup; use the Container property instead.
  • Java Applet classes removed.

New in version 4.5.1

  • The MoveNodes behavior allows grabbing nodes to drag them without using adjustment handles.
  • Fixed tooltips when Windows 10 display scaling is enabled.
  • Fixed inplace-edit when Windows 10 display scaling is enabled.
  • FillMode enum moved from com.mindfusion.diagramming to com.mindfusion.drawing package.

New in version 4.5

SVG nodes

The SvgNode class represents nodes that can display SVG drawings in addition to the rendering provided by its base ShapeNode class. SVG elements are rendered after the associated bitmap Image and just before the drawNode event is raised for Additional custom drawing. SVG elements are parsed and associated with the node through a com.mindfusion.svg.SvgContent object, which should be initialized and then assigned to the Content property. The Factory class contains createSvgNode overloaded methods for creating nodes from SVG files or from already loaded SvgContent instances.

JSON serialization improvements

Miscellaneous

New in version 4.4.1

JSON Serialization

Diagrams can now be serialized in JSON format. This can be used for interoperability with MindFusion JavaScript diagramming library, or for general storage in JSON files or databases. To serialize a Diagram to a JSON string, call its saveToJson method. To deserialize a diagram back from its JSON representation, call the loadFromJson method. Custom item classes can implement JSON serialization for their additional properties by overriding the saveToJson and loadFromJson methods of DiagramItem. Such classes must be registered for serialization by calling the registerItemClass method and providing a string identifier for the clientClass parameter.

Miscellaneous

New in version 4.4

New CompositeNode components

Component classes that support user interaction can now be used as part of CompositeNode templates:

Improved FlowchartLayout

FlowchartLayout can now arrange more types of graphs, no longer requiring them to represent strictly-nested source code structures.

New in version 4.3.3

Text improvements

  • Caption text of TableNode and ContainerNode objects can wrap to multiple lines in plain-text mode.
  • Table cell text can wrap to multiple lines in plain-text mode too (i.e. when EnableStyledText is disabled).
  • TextPadding now works for ContainerNode captions.

Bug fixes

New in version 4.3.2

Export Excel files

The ExcelExporter class from com.mindfusion.diagramming.export package exports diagrams to Excel Open XML format (XSLX). Diagrams are exported as Excel AutoShapes drawings. The export overload that takes a DiagramDocument parameter creates a sheet for each DiagramPage in the document. The export(Diagram) overload creates a single Excel sheet.

Java  Copy Code

ExcelExporter ex = new ExcelExporter();
ex.setTemplatePath(
    templatesFolder + "/ExcelTemplate.xlt");
ex.export(diagram, fileChooser.getSelectedFile().getAbsolutePath());

Miscellaneous

Improved back-buffer allocation code. The memory footprint of the diagram should now be much lower and drawing should be slightly faster.

New in version 4.3.1

Flip shapes

The shape of a ShapeNode can be flipped horizontally or vertically. Enable the AllowFlip property and the shape flips when an edge is dragged over its opposite edge. You can get or set current flip state using FlipX and FlipY properties.

DiagramLink improvements

  • AllowSplitLinks now works for Bezier links too. Users can insert a new Bezier segment by dragging any point (other than a control point) of a selected link. Adjacent segments can be merged back into a single one by dragging a tangent control point (square adjustment handle) onto a pass-through control point (round adjustment handle).
  • IntermediateShape shapes are now rendered at correct position for Spline links.

Miscellaneous

  • The PanAndModify behavior lets you select and modify when the mouse pointer is over an item, or pan the view otherwise.
  • The updateRuntimeIndices method of Diagram assigns unique integer identifiers to items, accessible via getRuntimeIndex. Identifiers are transient and valid only for the current state of diagram immediately after the updateRuntimeIndices() call.

API changes

New in version 4.3

Fluent API

Builder classes in com.mindfusion.diagramming.builders package add support for fluent programming style. Static with and instance init methods in DiagramItem, DiagramItemStyle and Layout -derived classes return a builder instance that can be used to set up respective new or existing objects:

Java  Copy Code

diagram.getNodes().add(
    ShapeNode.with()
        .brush(Color.LIGHT_GRAY)
        .font("Arial", 4)
        .enableStyledText(true)
        .text("Task <i>1</i>")
        .toolTip("This is the task")
        .create());

diagram.getFactory()
    .createShapeNode(20, 20, 20, 20).init()
        .brush(Color.LIGHT_GRAY)
        .font("Arial", 4)
        .enableStyledText(true)
        .text("Task <i>2</i>")
        .toolTip("This is the second task");

TreeLayout.with()
    .levelDistance(20)
    .nodeDistance(20)
    .linkStyle(TreeLayoutLinkType.Cascading3)
    .create()
    .arrange(diagram);

DiagramLink improvements

  • The component no longer keeps a separate segmentCount field, removing a common source of errors. The SegmentCount property now calculates its value from ControlPoints elements. The updateFromPoints(updateGroups, updateSegments) overload has been removed too.
  • SegmentCount setter no longer refuses changing number of segments if auto-routing is enabled or the link is a self-loop.
  • The new Spline element of LinkShape enumeration draws links as interpolating splines that pass through all of their control points:

Enum types

Old-style enumeration classes with static finals have been replaced by enum types, improving type checking and auto-completion support. This change will not affect your code if only passing enum members to methods from the API. If storing them in fields on the other hand, you must change the field type from int to respective enum type.

The types changed to enum are - Action, Align, Anchoring, AttachToLink, AttachToNode, AutoResize, Behavior, CellFrameStyle, ColumnStyle, CustomDraw, DelKeyAction, DirectionConstraint, EffectPhase, ExpandButtonAction, ExpandButtonPosition, GlassEffectType, Granularity, GraphicsUnit, GridStyle, GroupRotation, HandlesStyle, HatchStyle, HitTestPriority, HyperLinkStyle, ImageAlign, LayeredLayoutLinkType, LinkCrossings, LinkShape, LinkTextStyle, MarkStyle, ModificationStart, MouseInputMode, MultipleGraphsPlacement, NodeHandleType, Orientation, Relationship, RelativeToLink, RerouteLinks, RestrictToBounds, SaveToStringFormat, SelectionStyle, ShadowsStyle, ShowAnchors, SimpleShape, SnapToAnchor, TableConnectionStyle, TickPosition, TreeLayoutBalance, TreeLayoutDirection, TreeLayoutLinkType, TreeLayoutType, TreeViewConnectionStyle.

Type of EnabledHandles and TriggerRerouting properties has been changed to EnumSet.

Fixes

  • Fixed a problem where setLicenseKey did not work on non-Oracle implementations of the Java runtime.
  • Fixed SvgExporter bug where incorrect offset would be applied to nodes' Image bitmaps.

New in version 4.2

Free-form nodes

A FreeFormNode collects all points from users' mouse or touch input and displays them as node's outline. To let users draw free-form nodes interactively, set Behavior to DrawFreeForms or LinkFreeForms. Use the Points property of FreeFormNode to get or set outline points programmatically. If the Closed property is set, the node is drawn as a closed shape and its interior filled, or otherwise the node is drawn as a poly-line. If the distance between first and last points drawn by user is shorter than AutoCloseDistance, the node's Closed property is automatically set to true. AutoCloseDistance default value is Float.MAX_VALUE, so free-form nodes are always closed.

Convert free-form drawings to ShapeNodes

Additional drawing modes, convenient for touch input, convert FreeFormNode objects drawn by user to ShapeNode objects with matching shapes. To enable them, set Behavior to DrawFreeShapes or LinkFreeShapes. The shapes against which the user's input is matched are set via diagram's FreeFormTargets property. By default it contains Rectangle, Decision and Ellipse shapes.

Fixed bugs

  • Text outside of node boundaries was not repainted correctly after loading custom shape library from XML.
  • TreeViewNode scrollbar arrow buttons did not scroll correctly in some situations.
  • HandlesStyle is now serialized by the base DiagramNode class. This automatically saves the value for custom node types and fixes lost non-default values for CompositeNode and TreeViewNode after serialization.

API changes

Adjustment handles are no longer identified by integer values but by instances of AdjustmentHandle and derived classes. This changes the signatures of DiagramItem.hitTestHandle methods and the InteractionState constructor. Standard handle classes included are NodeAdjustmentHandle for changing a node's position and size, LinkAdjustmentHandle for changing link control point positions, and FreeFormHandle for changing the position of a FreeFormNode outline point.

New in version 4.1.4

Resize table columns and rows

Columns and rows of a TableNode can now be resized interactively if its AllowResizeColumns or AllowResizeRows properties are enabled. In order to resize, move the mouse pointer to the border line on column's right side or row's bottom side until it shows resize cursor and start dragging. The control raises tableColumnResizing and tableRowResizing events to let you validate new size or prevent resizing some elements. The tableColumnResized and tableRowResized events are raised after the operation completes.

License keys

There is no separate trial build of the control's JAR archive provided anymore. Instead, call the setLicenseKey method of DiagramView to disable the component's evaluation mode and stop displaying trial messages. setLicenseKey is static and you can call it just once before creating any views. License key strings are now listed on the Keys & Downloads page at MindFusion's customer portal.

Miscellaneous

  • Undo/redo records for in-place edit operations are now created automatically.
  • KeepInsideDiagram constraint prevents a node from leaving diagram boundaries during user interaction (the older RestrictItemsToBounds property does not stop nodes from leaving diagram area but returns them to original position if dropped outside).
  • Dashed selection frames are now drawn in two colors and should be visible on both the default white background and custom darker backgrounds. You can change the second dash color via DashBackground property of HandlesVisualStyle.
  • Improved mouse capture for composite controls hosted inside ControlNodes.
  • StartPoint and EndPoint properties provide a shortcut to setting the first and last control points of a DiagramLink.

Fixed bugs

  • Fixed text clipping problem when magnifier is over TreeViewNode.
  • Links to contained nodes were left visibly disconnected from them after deleting a folded ContainerNode.
  • Lasso selection could not select strictly horizontal or vertical straight-line links when IncludeItemsIfIntersect is disabled.

New in version 4.1.3

  • Type of LayoutTraits keys, such as TreeLayoutTraits and SpringLayoutTraits, has been changed from custom objects to Java enumerations.
  • LayoutTraits values are now saved also by binary serialization methods, while older versions saved them only in XML format.
  • The changeUnit method now also scales pen widths.
  • A new setBounds overloaded method lets you move a node without updating positions of its links or attached nodes.
  • Fixed a bug where setMeasureUnit would not switch away from Centimeter unit.
  • Fixed a bug where folding a ContainerNode would not hide its child nodes after loading from XML until Z order cache is invalidated.
  • Fixed all compiler warnings from component's source code and sample projects.
  • Fixed obfuscation problem where nested XDimension2D.Double type wasn't accessible.

New in version 4.1.2

AnchorPatern improvements

  • The XUnit and YUnit properties allow specifying the coordinates of an AnchorPoint as a fixed offset from the node's top-left corner rather than in percentage, so that the point position does not change when the node is resized.
  • The AnchorPattern property of Shape class lets you associate anchor points with shape definitions. If a ShapeNode instance does not contain its own AnchorPattern, it will derive the one defined by the node's Shape.

Miscellaneous

New in version 4.1.1

Improved arrowhead rendering

  • Arrowheads are rendered as a single path when possible and several arrowhead Shape definitions have been changed to implement mitered joints when HeadPen is set to a thick pen.
  • The point where end segments connect to arrowheads can be specified via the LinkSegmentInset property of shapes. Shape definitions from the ArrowHeads class set it to suitable default value. This allows using transparent or semi-transparent brushes without seeing the link line drawn behind arrowheads.
  • Arrowhead shadows are no longer filled if the link's EffectiveBrush is null or fully transparent.
  • IntermediateShape is now also rendered for Bezier links.

Miscellaneous

  • Set the Brush property of LinkLabel to fill the background of link labels.
  • Multiple-resize of rotated nodes fixed to apply same offsets in nodes' local coordinate system.
  • Fixed a bug where setting the CaptionBackBrush property of containers would hide the caption-bar borders.

New in version 4.1

Tree map layout

Tree maps represent hierarchies by nesting child nodes within their parents, where the areas of leaf nodes are proportional to their Weight values. Unlike other layout algorithms, TreeMapLayout expects hierarchies to be defined via grouping or containment (see attachTo method and ContainerNode class), and will ignore any links in the diagram. The diagram area covered by the topmost nodes in a hierarchy is specified via the LayoutArea property. By default, the layout tries to keep the ratio of node sides as close as possible to one. However this could make it hard to distinguish separate levels of the hierarchy. To alleviate that, set Squarify to false, and child nodes will be arranged either as a row or a column inside their parent node, alternating directions for each level. The drawback is that when Weight ratios differ greatly or nodes contain many children, some nodes could end up with very narrow rectangles.

Decision flowchart layout

DecisionLayout arranges simple flowcharts consisting of decision boxes with up to three outgoing links per node and activity boxes with a single outgoing link per node. The nodes are arranged in columns and rows, whose distance depends on the HorizontalPadding and VerticalPadding property values. When links share the same row or column, they are placed at a distance specified via LinkPadding. The layout arranges nodes recursively starting from StartNode. If StartNode is not specified, the algorithm selects the root of the deepest branch of the graph's spanning tree as start node.

Composite nodes

The CompositeNode class implements nodes whose appearance can be defined via composition of components and layout containers. The content of a composite node can be loaded from XML files similar to .NET Xaml templates and Android XML layouts. This initial release includes layout containers such as StackPanel and GridPanel, and read-only components like ImageComponent, TextComponent, ShapeComponent, BorderComponent. Future versions will add interactive components like buttons and text editors.

Export Visio 2013 files

The VisioExporter class can export the content of Diagram and DiagramDocument objects to Visio 2013 VSDX files. In order to use it, import the com.mindfusion.diagramming.export namespace. VisioExporter relies on a template file, called Visio2013.vxt, containing some boilerplate Visio XML code. The template must be either located in same folder as the application, or its path must be specified via the TemplatePath property. At this time the exporter supports shapes from Visio basic stencil. Support for more shapes will be added upon request.

Miscellaneous

  • Layout algorithms now automatically resize diagram's Bounds if it's not large enough to fit the arranged content. To revert to old behavior and keep fixed Bounds size, set GrowToFit to false.
  • Improved PdfExporter performance.
  • VisioImporter now supports Visio group shapes. Child shapes in groups are no longer lost when importing, and their corresponding diagram nodes are attached to the corresponding group node.

New in version 4.0.5

Resize multiple nodes

Now it is possible to resize multiple selected nodes simultaneously. To enable that, set the AllowMultipleResize property to true. When enabled, dragging a corner or side adjustment handle of any node resizes all nodes in the selection. The operation will be cancelled for all nodes if any of them does not accept its new size, e.g. if it's smaller than minimum allowed node size.

VisioImporter improvements

  • The Item argument of VisioImportListener.importItem event handlers is now pre-set to a DiagramItem instance created for the imported Visio shape, letting you avoid parsing some standard data such as Bounds or Text. You can either modify this item's properties, or replace it with a new instance of a different type.
  • ImportItemEvent now provides properties for accessing the XML content of Visio shape masters.
  • NURBS lines are now imported as Bezier links.
  • Fixed a crash when a shape master does not have a name attribute (this happens with custom stencils).
  • Fixed a bug where one-segment connectors were imported at wrong positions.
  • Fixed a crash when theme1.xml is missing from the imported vsdx archive (this happens with files converted from old Visio versions to 2013 format)

ZoomControl improvements

  • Changing DiagramView's ZoomFactor now updates zoom control slider automatically.
  • The pan widget now fills the ZoomControl width or height instead of having fixed size.
  • Setting ZoomControl's width larger than its height makes the zoom slider horizontal.

Miscellaneus

  • Fixed a bug where Ruler alignment guides were not positioned correctly for diagrams starting at negative coordinates.

API changes

New in version 4.0.4

Import Visio 2013 files

The VisioImporter class can import .vsdx files created by Visio 2013. In order to use it, you must import the com.mindfusion.diagramming.importers namespace. Various overloads of the import method can be used to import the file into a DiagramDocument whose pages correspond to the Visio drawing pages, or into a single Diagram whose content is merged from all imported pages. At this time VisioImporter supports the basic flowchart and data flow Visio stencils. For each node shape from the .vsdx file, the importer creates a ShapeNode object whose Shape, Text, Brush and Pen properties are set to values corresponding to the imported Visio shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.

Import OpenOffice Draw files

The DrawImporter class can import .odg files, created by the OpenOffice Draw vector graphics editor. In order to use it, you must import the com.mindfusion.diagramming.importers namespace. DrawImporter supports shapes from the General and Flowchart shape palettes in Draw. Various overloads of the import method can be used to import the OpenOffice drawing into a DiagramDocument whose pages correspond to the Draw pages, or into a single Diagram whose content is merged from all imported pages. For each node shape from the .odg file, the importer creates a ShapeNode object whose Shape, Text, Brush and Pen properties are set to values corresponding to the imported OpenOffice shape. For each connector shape, the importer creates a DiagramLink object whose Origin and Destination are set to the corresponding imported nodes, and whose ControlPoints reflect the geometry of the connector.

Zoom control

The ZoomControl class lets users change interactively the current zoom level and scroll position of a DiagramView. To set it up, add a ZoomControl to the frame, place it anywhere over a DiagramView, and set the control's View property to that view. Set the ZoomStep and ScrollStep properties to specify the amount added to view's zoom level or scroll position by ZoomControl's buttons. You can customize the control's appearance by setting properties such as Fill, BorderColor, CornerRadius and TickPosition.

Miscellaneous

  • Links can now snap to nodes from a distance when their AutoSnapToNode property is enabled. The maximum snap distance is specified via the AutoSnapDistance property. AutoSnapToNode supersedes the old SnapToNodeBorder property, which worked only for nodes under mouse pointer.
  • Set the RoundedLinks and RoundedLinksRadius property to draw arcs at the joints of Cascading and Polyline links' segments.
  • Selection.IncludeItemsIfIntersect property specifies if lasso-selection should select items that intersect the selection rectangle, or otherwise are entirely inside it.
  • Several new shapes added for better compatibility with Visio 2013 basic stencil: RightTriangle, Decagon, Trapezoid, Star4Pointed, Star5Pointed, Star6Pointed, Star7Pointed, Star16Pointed, Star24Pointed, Star32Pointed, Donut, Plaque.
  • Permissions attribute added to JAR manifest file to allow loading DiagramApplet under Java 7 update 51.

New in version 4.0.3

Pattern brushes

The HatchBrush class allows filling shapes with a pattern. Supported patterns are exposed as members of the HatchStyle class. Points or lines from the patterns are painted using the brush' ForegroundColor property, while the space between points or lines is filled using BackgroundColor.

Adjustment handles improvements

  • MoveOnly and HatchHandles3 handle styles now have the same default appearance as in .NET versions of the control, based on a HatchBrush with Percent50 pattern. The brush can be changed using the PatternBrush property of HandlesVisualStyle.
  • Two new HandlesStyle members added, RoundAndSquare and RoundAndSquare2, that draw corner resize handles as circles and remaining handles as squares.
  • RotationHandleBrush property added to HandlesVisualStyle.

Miscellaneous

  • Scrollable property added to TreeViewNode.
  • Decoration elements in Shape definitions can now be accessed using the getDecorations method.
  • You can change the text region of existing shapes using the setTextArea method.
  • The colors of multiple-selection frame can now be customized using the Pen and Brush properties.
  • The MeasureUnit property now supports Centimeter and WpfPoint values. The latter allows loading diagram files saved by WPF and Silverlight versions of the control with their default units.

API changes

For source code compatibility with Android version of the control, and eventual multi-touch support in future Java Swing versions, these members has been renamed to follow the W3C pointer events specification:

New in version 4.0.2

ContainerNode improvements

  • child nodes are now drawn by their containers; when containers overlap, the children of a lower container cannot appear in front of the upper container anymore;
  • the ClipChildren property specifies whether to clip child items to container’s boundaries;
  • the ZIndex property  no longer changes automatically when dropping nodes into a container;
  • the Visible property of child items no longer changes when folding or unfolding containers; this lets you keep invisible items inside containers;
  • when selection including a container and its child node is dropped into another container, the child node now remains in its original container;

Miscellaneous

New in version 4.0.1

Preserve order in tree layout

The Balance property of TreeLayout can be set to Preserve to keep the original geometric order of child nodes when arranging them under their parent. This can be used to arrange tree branches in a specific order by first placing them in increasing horizontal or vertical positions. Another possibility is to apply TreeLayout from nodeModified handler to let users rearrange the tree branches by dragging and dropping a node.

Undirected path finding

PathFinder now supports undirected mode. Its methods have been changed from static to instance, and its constructor takes an ignoreDirection parameter. If ignoreDirection is enabled, the underlying graph is treated as undirected and link direction is not considered when looking for paths.

Selection improvements

  • DiagramView.Behavior can be set to SelectOnly to let users select existing items, but not modify them or draw new ones.
  • The SetsDirtyFlag property of the Selection class specifies whether the Dirty flag should be set when selection changes.

Miscellaneous

  • Style classes now contain a FontUnit property specifying the unit of measure of FontSize. Important: the default FontUnit value is Point, while font sizes were always measured in diagram's MeasureUnit in previous versions. If using styles instead of setting items' Font property, when upgrading to version 4.0.1 you must either adjust FontSize for the Point units, or change FontUnit to World, which makes it compatible with previous versions.
  • the last row in a TableNode will now be rendered clipped if it fits only partially inside the node, whereas in previous versions the row would not be rendered at all.
  • the HandlesStyle of a link can now be set to Invisible to stop rendering its selection handles, but still allow dragging control points.
  • the AllowAddChildren and AllowRemoveChildren properties of ContainerNode specify whether users are allowed to add or remove child nodes to / from the container.
  • the getNearestBorderPoint method of DiagramNode can be used to find a point from the node's border closest to a specified point.
  • the Ruler control now raises nodeModified events when nodes are moved using alignment guides.
  • styled text can contain <br> tags to force line breaks.
  • HeadBrush, BaseBrush and IntermediateBrush properties allow setting distinct brushes for respective arrowhead shapes.
  • the Cell.TextPadding property allows customizing text margins of table cells.

Fixed bugs

New in version 4

Styles and themes

The appearance of the items in a diagram can now be modified using styles. The style represents a set of properties, which can be applied to an individual diagram item (by assigning it to the DiagramItem.Style property) or to all items of a specific type (by using a Theme). The styles can be easily expanded to include the properties in derived item classes.

The theme represents a collection of styles. Each style in the theme is associated with the diagram items of a specific type and affects all items of this type. Themes can be loaded from XML files. New themes can be created using the Theme Editor tool. Several pre-defined theme files are installed under the Themes subfolder of the control's root installation folder.

For more information about this new feature, check Styles and Themes.

Node effects

Two visual effects, represented by GlassEffect and AeroEffect classes, can be applied to nodes. To apply an effect, create an instance of the respective class, set up its properties, then add the instance to the Effects collection of a node (or to Diagram.NodeEffects collection to apply it to all nodes). Effects can be added, removed or modified at any time and this will immediately reflect on the diagram. Effects of different types can be applied simultaneously. It is also possible to apply more than one effect of the same type.

Diagram documents and tabbed views

The DiagramDocument class represents a collection of diagram pages or sheets, represented by DiagramPage objects. DiagramPage is derived from Diagram and only adds a Title property, so any current code that processes Diagram objects will work with DiagramPage objects too. New pages can be added to the document and existing pages can be removed and reordered via the Pages collection. The diagram document provides higher level of events for the pages contained inside it. The document supports the notion of an active page.

DocumentView object placed inside a TabbedScrollPane can be used to display DiagramDocument objects. The view displays tabs for the individual pages in the document. The active page can be changed interactively by activating its associated tab. New pages can be added and removed to/from the document through buttons in the tab tray and the pages can be rearranged by dragging their associated tabs with the mouse.

One-way graph Layout

The OneWayLayout class ensures that links enter into nodes from the same general direction and exit them from the opposite side. If the graph contains cycles, some links bend around the nodes to keep the enter/exit direction consistent. The algorithm aims to minimize the number of such links.

Rotation improvements

  • All built-in node types can now be rotated by setting their RotationAngle property, or interactively through the rotation handle. To enable interactive rotation, you must set the respective bit in DiagramNode.EnabledHandles;
  • Attached nodes can rotate together with their master node if the group's FollowMasterRotation property is set to RotateChildren;

Node list control

The NodeListView is a JList control that can host any type of DiagramNode objects. Nodes from to the NodeListView control can be drag-and-dropped onto a Diagram, which creates a clone of the dragged node at the drop position.

Layers

Items can now be assigned to layers, and layers can be hidden, locked or moved up/down in the Z order as a group. Call the setLayerIndex method of items to associate them with layers in the Diagram.Layers collection. The Layer objects provide Visible, Locked and ZIndex properties, which will affect all items in the respective layer. Layers also expose a Title property shown in the LayerListView control. Newly drawn items are added to the layer specified via Diagram.setActiveLayer.

For additional information about layers, refer to Layers.

Layer list control

The LayerListView control provides user interface for working with Layer objects. The control displays a list of all layers in a specified Diagram with a title and an overview area, and also allows editing of layer's Title, Visible and Locked properties and choosing the Diagram's currently active layer. New layers can be added to the Diagram by clicking the '+' button. The selected layer can be deleted by clicking the '-' button.

Magnifier

The new magnifier tool allows users to interactively zoom in (or out) portions of the diagram by holding down a modifier key or pressing a mouse button. The magnifier's zoom factor and appearance can be customized. Additional information can be found in the corresponding section of Scrolling and Zooming.

Ruler improvements

The ruler units can now be specified more precisely through instances of the new MeasureUnit class. The MeasureUnit class provides several built-in units as well as the opportunity to create custom units of measure. As a result, the RulerUnit enumeration has been removed and the type of the Unit property has been changed. The InchDivisions property of the Ruler class has been removed as well - the division information is now built into the MeasureUnit type and no longer needs to be specified explicitly. Custom divisions can still be specified for any unit by creating a custom MeasureUnit instance and providing the appropriate value in the standardDivisons constructor parameter.

Miscellaneous

  • The value of DiagramItem.ZIndex property is no longer required to be unique and smaller than the number of items;
  • The Shape property in ContainerNode and TreeViewNode can be set to Rectangle or RoundedRectangle;
  • Link labels are arranged automatically by the control when their AutoArrange property is enabled. Auto-arranged labels will avoid overlapping nodes or other labels.
  • HeaderFont property added to PrintOptions, specifies the font used to draw the page header.
  • The new TextPadding property specify the distance between node's text and the node borders

API changes

  • RotationAngle property moved from ShapeNode to base DiagramNode;
  • Inherited node classes should now override the drawLocal method instead of draw to get built-in support for node rotation. Overriding draw still works, but any custom drawing code would have to take care of rotation;
  • Type of Group.FollowMasterRotation changed from boolean to enum GroupRotation;
  • LinkStyle enum renamed to LinkShape;
  • DiagramLink.Style property renamed to Shape;
  • TableStyle enum renamed to SimpleShape;
  • TableNode.Style property renamed to Shape;
  • The type of TextColor and CaptionColor properties have been changed to Brush; the properties have been renamed to TextBrush and CaptionBrush;
  • The default value of Pen, Brush and Font properties of items is now null to allow for inheritance from DiagramItem.Style or Diagram.Theme. Custom drawing code in inherited classes should use the values returned by getEffectivePen, getEffectiveBrush or getEffectiveFont to get the actual object that should be used when drawing;
  • zLevelUp, zLevelDown, zTop and zBottom methods now require a boolean argument specifying whether items are allowed to change layers;
  • ZIndex no longer corresponds to the position of items within Diagram.Items collection. Items however still contains the items sorted by Z order, as defined by item's ZIndex and LayerIndex;

New in Version 3.5

Use Java Swing components as nodes

ControlNode is an adapter class that allows using any java.awt.Component -derived object as a diagram node. Such nodes can be used to implement advanced entity viewers or editors using the Java Swing framework. A Component instance can be assigned to the Control property of the host node. It could be a standard Java Swing component such as a JTable or your own custom control. If the Behavior property of DiagramView is set to DrawControls or LinkControls, then users are allowed to draw control host nodes interactively. Such host nodes will have their Control initialized to an instance of the type specified via DefaultControlType.

Loading UI controls in the same applet instance

Recent Java and browser versions do not work very well when more than one applets are loaded on the page (e.g. IE crashes when reloading such pages, in some browsers Java objects cannot be passed between two applets). Hence the DiagramApplet, used to host a DiagramView control, has been modified to also show the miscellaneous UI controls such as Overview, ShapeListBox and Ruler. The applet parameters used to create and customize these controls are listed in the Diagram Applet topic.

Miscellaneous

  • Improved path-finding for long links in QuickRouter.
  • The print header string now can contain a %T format specifier that will display the total number of pages.
  • SwimlaneLayout improvements.

New in Version 3.4

Automatic node alignment

If AutoAlignNodes is enabled, the node currently being drawn or resized is aligned to another node so that a pair of their vertical or horizontal sides become collinear. To specify the maximal distance at which nodes are aligned, set the AutoAlignDistance property. The pair of aligned nodes is indicated visually by drawing an alignment guide using the pen assigned to AlignmentGuidePen.

Fractal tree layout

FractalLayout is a tree layout algorithm that places child nodes symmetrically around their parent node. Nodes at the lowest level are arranged directly in a circle around their parent. At the upper level, the already arranged nodes form branches that are arranged in a circle around the new parent node. The algorithm is recursively repeated till the highest level is reached. If nodes in the tree have uniform number of children, the end result has fractal-like appearance (subsets of the graph look like scaled-down copies of the whole graph). You can choose which node should be displayed at the center of the topmost circle by setting the Root property. If it is not specified, the algorithm automatically selects a root that leads to more balanced distribution of nodes.

New node constraints

  • If KeepInsideParent is enabled, a node cannot be moved outside the boundaries of its ContainerNode or group's master node.
  • If KeepRatio is enabled, a node's width-to-height ratio is preserved when the user resizes the node.
  • The user cannot move a node's side past its opposite side if the DisableMirroring constraint is set.

Miscellaneous

  • getAllIncomingLinks, getAllOutgoingLinks, getAllLinks methods return all links connected to a node and its elements (TableNode rows or TreeViewNode items).
  • Rotated nodes are now aligned to the grid when moved.
  • PdfExporter could not be used from Java 7 because of a removed deprecated method (FontManager.getFont). This is now fixed by using equivalent API members.
  • Fixed a bug where a link would align to incorrect anchor point when the target node is rotated.

New in Version 3.3

Layout class enhancements

Relationship queries

The query method of DiagramItem can be used to find items that can be reached from the current one by following a path described in the query expression specified as argument. The expression includes selectors separated by a / character, where each selector returns the items from the result set of the previous step. The expressions can also include boolean predicates that filter the results using boolean and arithmetic expressions.

Miscellaneous

  • createFlowchartLayout method added to ScriptHelper.
  • Find out a link's length via the getLength method of DiagramLink.
  • Display multiple link labels via the addLabel method.

New in Version 3.2

Swimlanes

The swimlane grid lets you emphasize the relationship between a group of diagram items by displaying them in a distinct lane or cell within the grid. To display the lane grid, set the EnableLanes property of the Diagram class to true. In order to customize the grid, set the various attributes exposed by the LaneGrid property, which lets you specify the number of rows and columns, add headers, customize the cell appearance, etc. The new Lanes sample project uses the lane grid to let users draw Gantt charts.

SwimlaneLayout algorithm

SwimlaneLayout can be used to arrange process diagrams in which nodes representing activities are placed in swimlanes representing resources. The index of the resource allocated to an activity should be assigned to the corresponding node's LayoutTraits via the SwimlaneLayoutTraits.Lane key.
By default, the algorithm works with the diagram's LaneGrid, but its SwimlaneGrid property can be set to any class that implements the SwimlaneGrid interface. This allows applying the layout to a custom-drawn grid rendered through the drawBackground event, or one composed of locked background nodes.

CascadeLayout algorithm

CascadeLayout places nodes on a virtual grid and arranges links orthogonally, such that if the source graph is planar all links are guaranteed to have no more than two bends and will not intersect. By default the layout method arranges nodes in rows and link segments in columns; this can be changed by setting the Orientation property.

TriangularLayout algorithm

TriangularLayout places nodes on a virtual grid, such that if the source graph is planar, all links are guaranteed to have a single segment and not intersect. If the graph is not planar, its intersecting links can be optionally segmented and bended in order to improve readability. The layout method places the nodes from the external face on a triangle and recursively adds the rest of the nodes as vertices of internal triangles. As a result, it is very effective for near maximal-planar (a.k.a. triangular) graphs.

HierarchicalLayout algorithm

HierarchicalLayout places nodes on user-defined levels, such that if the source graph is level-planar, all links are guaranteed to have a single segment and will not intersect. A graph is considered level-planar if it is possible to draw it without link intersections when its nodes are positioned on predefined levels. The layout method requires that for each node LayoutTraits contains a HierarchicalLayoutTraits.Level entry specifying the level, and no two connected nodes must be on the same level.

Miscellaneous

  • selectionChanged event raised when items are selected or deselected.
  • drawStyledText draws a formatted text string similarly to shape nodes whose EnableStyledText property is enabled.
  • UBendMaxLen property added to QuickRouter.
  • The FoldedSize property of ContainerNode specifies the container's size when it is folded.
  • The Id property added to DiagramItem allows assigning custom identifiers to items. It can also be used to just store additional custom data similarly to Tag.

New in Version 3.1

Support for custom arrowheads

The type of the HeadShape, BaseShape and IntermediateShape properties of DiagramLink has been changed from enum ArrowHead to class Shape, which is also used to define ShapeNode shapes. The ArrowHeads class now exposes Shape definitions that correspond to the ArrowHead enumeration members from previous versions. It is also possible to set any other predefined or custom shape accessible through the fromId method as an arrowhead. When used for arrowheads, position (50, 0) in the shape definition corresponds to the arrowhead's tip point.

Topological graph layout

If the underlying graph if acyclic, TopologicalLayout arranges the nodes linearly in such a way that each node comes before all destination nodes of its outgoing links. The links are drawn as curves above the chain of nodes, with their height proportional to the distance between the nodes. If the graph is not acyclic, the layout algorithm finds an ordering with a minimal number of back links, and draws the back links below the chain of nodes.

Miscellaneous

New in Version 3

TreeView nodes

The TreeViewNode class represents nodes that can display hierarchical data. The root items displayed in the node can be accessed through the getRootItems method. New items can be added to and removed from the returned collection. The root items can have child items on their own and so on. For more information, refer to the TreeViewItem class.

Ruler control

The Ruler control provides horizontal and vertical scales that helps users measure and align diagram items. In order to set the Ruler as a parent of a DiagramView, call its setDiagramView method. The control also implements support for scrolling and can be used instead of a JScrollPane.

Export to SVG

The SvgExporter class creates a Scalable Vector Graphics (SVG) drawing from the content of a Diagram. Custom-drawn elements are exported too through an SVG implementation of the Graphics2D interface provided by JDiagram.

Link routing enhancements

A much faster link routing algorithm has been implemented. It can arrange a thousand links for just a few seconds, while older versions would require several minutes. Now it is also possible to create custom routing classes to be used when a link must be routed by implementing the LinkRouter interface. An instance of such class can be set through the LinkRouter property of the Diagram class. JDiagram provides two classes that implement LinkRouter - GridRouter and QuickRouter. By default LinkRouter is set to a QuickRouter instance.

Flowchart graph layout

FlowchartLayout recognizes program code-like patterns in the graph, such as loops, sequences and if/switch branchings, and arranges them recursively. FlowchartLayout could be used to arrange other types of graphs as well, though with some restrictions. For example it treats all back links as loops in the code, and expects that they are nested - loop links starting closer to the stop node should end closer to the start node. Another similar restriction is that there shouldn't be any cross-links that connect different branches of a decision sub-graph.

Layout enhancements

Adjustment handles styling

The ActiveItemHandlesColor, SelectedItemHandlesColor and DisabledHandlesColor properties have been replaced by ActiveItemHandlesStyle, SelectedItemHandlesStyle and DisabledHandlesStyle. The HandlesVisualStyle objects returned by them provide sub-properties for greater control over the appearance of selection handles. The adjustment handles can now be painted not only in solid color but with arbitrary brushes, such as GradientBrush and TextureBrush objects.

New ScriptHelper methods

  • The createColor method creates a Color instance.
  • Use createPaper and createPageFormat to create objects required for print job setup.
  • createSize and createSizeF create Dimension and Dimension2D instances.

Miscellaneous

  • DiagramApplet provides local clipboard support through the copyToClipboard and pasteFromClipboard methods, which avoids the security checks done by the corresponding DiagramView methods.
  • Elements of Shape definitions can be assigned distinct color and pen style attributes.
  • The ShowLabels property of ShapeListBox specifies whether the control should display item labels.
  • Links can be custom draw by setting their CustomDraw property and handling the drawLink event.
  • PdfExporter creates hyperlinks for nodes whose HyperLink property is set.
  • The drawForeground event lets render custom graphics in the diagram foreground.

API changes

serializeTag and deserializeTag handlers should call the setHandled method in order for the control to use the custom tag xml.

New in Version 2.2

Export to PDF

The PdfExporter class lets you exports diagrams to Adobe Portable Document Format (PDF) files. In order to do that, create a PdfExporter instance and call its export method. If you need to set the page size and orientation, call the setPageSize, and setPageOrientation methods.

New in Version 2.1

OrthogonalLayout

The OrthogonalLayout class implements an orthogonal graph layout algorithm. Each link is drawn as a chain of alternating horizontal and vertical segments. Nodes are placed in a way that facilitates few links bends and crossings. This algorithm was designed for planar graphs where the nodes have at most four incident links, and produces best results with such graphs as input. It can arrange any arbitrary graph as well, by adding some dummy nodes and links to planarize the graph and reduce its vertex degree, and removing them after the layout.

CircularLayout

CircularLayout distributes nodes evenly on the circumference of a circle at positions that result in as few link crossing as possible. Set its Radius attribute to specify the size of the layout circle. Call setSiftingRounds to specify the number of fine-tuning crossing-reduction iterations.

Miscellaneous

  • The mergeUndoRecords method lets you merge several undo records into a single composite record.
  • A custom position for the collapse/expand button displayed for expandable nodes can be specified through the setExpandButtonPosition method.
  • The draw method of Diagram is now public, and can be used to draw the diagram content on a custom Graphics2D object.
  • Link labels can be edited in place. linkTextEdited and linkTextEditing events have been added.

API changes

The OrthogonalLayout class from previous JDiagram versions has been renamed to OrthogonalRouter.

New in Version 2

Document/View Architecture

JDiagram implements the Model-View-Controller (MVC) architectural pattern in its new version 2. The MVC design pattern as applied to JDiagram separates the diagram data (model) from its representation to the user (view) and controlling it by the user (controller). According to the MVC design pattern, JDiagram Version 2 provides two new classes instead of the FlowChart class, namely Diagram and DiagramView.

Support for Custom Diagram Item Types

The JDiagram API has been redesigned to allow for seamless integration of custom node and link types. You can define a custom item type by deriving from DiagramLink or DiagramNode. You can also derive from more specific node types such as ShapeNode or ContainerNode. New items can be added to a diagram by instantiating them and adding them to the Nodes or Links collections. To improve support for custom types, many type-specific methods have been replaced with more generic versions, for example, findNode instead of findBox and findTable. For more information on the API changes, take a look at the Moving to JDiagram 2 section of the help file.

Containers

The ContainerNode class implements diagram nodes that can function as containers for other nodes. Containers can be folded to hide their content, and unfolded to show it again. Containers can be nested one within another, without limitation on the depth of nesting. The containerChildAdded and containerChildRemoved methods are called when nodes are added to or removed from containers.

OrthogonalRouter

OrthogonalRouter is a secondary layout algorithm that can be used to arrange links after an initial node arrangement has already been applied. The orthogonal layout is useful when there are much more links than nodes in a graph. The algorithm strives to achieve the following criteria, while preserving as much of the initial node configuration as possible: links must not overlap; only vertical and horizontal routing lines are used; graph routing is performed with respect to the specified main layout direction; links crossings are minimized; bends are minimized.

Layout Algorithm Improvements

Now, it is possible to place the unconnected subgraphs in such a way that the diagram covers a minimal area. To enable that, choose MinimalArea for the MultipleGraphsPlacement object.

Clipboard Operations

A single diagram item or a selection of items can be copied or cut to the system clipboard. This is done programmatically using the copyToClipboard and cutToClipboard methods. To paste the clipboard contents into the current diagram call pasteFromClipboard.

API Changes

For more information on the API changes, take a look at the Moving to JDiagram 2 section of the help file.