Diagramming for Java Swing, V4.1.4 Released

MindFusion is happy to announce the new version of the Java Diagramming library. The release offers useful new features and improvements.

What’s 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.

Java Diagram Library: Table Nodes

Java Diagram Library: Table Nodes

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.

The trial version is available for download from the following link:

Download MindFusion.Diagramming for Java Swing, V4.1.4 Trial Version

Technical support
MindFusion puts special effort in providing high quality technical support to all its clients and evaluators. You can post your questions about Diagramming for Java or any other of our components at the forum, help desk or at support@mindfusion.eu. All support inquiries are usually answered within hours of being received.

About Diagramming for Java Swing: MindFusion.Diagramming for Java Swing provides your Java application with all necessary functionality to create and customize a diagram. The library is very easy to integrate and program. There are numerous utility methods, rich event set, more than 100 predefined shapes. The tool supports a variety of ways to render or export the diagram, advanced node types like TreeView nodes, hierarchical nodes, tables, container nodes and many more. There are 15 automatic layouts, various input / output options and fully customizable appearance. A detailed list with JDiagram’s features is uploaded here. You can check the online demo to see some of the functionality implemented.

Diagramming for Java Swing is royalty free, there are no distribution fees. Licenses depend on the count of developers using the tool – check here the prices.

Display Petri nets using MindFusion diagram component.

In this post we show how to build a Petri net using MindFusion.Diagramming for WinForms. Petri nets are used to model and study distributed systems. A net contains places, transitions and arcs. A place represents possible state of the system, and a transition represents the change from one state to another. Arcs connect places to transitions and show the flow direction.

First, create a new .NET Windows Forms project and add a Model.cs file to it where we’ll define Petri net model classes

public class Net
{
	public List Places { get; set; }
	public List Transitions { get; set; }
	public List Arcs { get; set; }

	public Net()
	{
		Places = new List();
		Transitions = new List();
		Arcs = new List();
	}
}

public class Node
{
	public string Label { get; set; }
}

public class Place : Node
{
	public int Tokens { get; set; }
}

public class Transition : Node
{
}

public class Arc
{
	// Arcs run from a place to a transition or vice versa,
	// never between places or between transitions.

	public Arc(Place input, Transition output)
	{
		Input = input;
		Output = output;
	}

	public Arc(Transition input, Place output)
	{
		Input = input;
		Output = output;
	}

	public Node Input { get; private set; }
	public Node Output { get; private set; }

	public int Multiplicity { get; set; }
}

Now we can create a simple Petri net:

Net CreateSampleNet()
{
	var net = new Net();

	var p1 = new Place { Label = "P1", Tokens = 1 };
	var p2 = new Place { Label = "P2", Tokens = 0 };
	var p3 = new Place { Label = "P3", Tokens = 2 };
	var p4 = new Place { Label = "P4", Tokens = 1 };

	net.Places.AddRange(new[] { p1, p2, p3, p4 });

	var t1 = new Transition { Label = "T1" };
	var t2 = new Transition { Label = "T2" };

	net.Transitions.AddRange(new[] { t1, t2 });

	var a1 = new Arc(p1, t1);
	var a2 = new Arc(t1, p2);
	var a3 = new Arc(t1, p3);
	var a4 = new Arc(p2, t2);
	var a5 = new Arc(p3, t2);
	var a6 = new Arc(t2, p4);
	var a7 = new Arc(t2, p1);

	net.Arcs.AddRange(new[] { a1, a2, a3, a4, a5, a6, a7 });

	return net;
}

Next, drop a DiagramView and Diagram objects on the form which we’ll use to visualize the net. Add the following method to create diagram elements representing the model objects, and run LayeredLayout to arrange them:

void BuildDiagram(Net net)
{
	var nodeMap = new Dictionary<node, diagramnode="">();

	var placeBounds = new RectangleF(0, 0, 16, 16);
	var transBounds = new RectangleF(0, 0, 6, 20);

	foreach (var place in net.Places)
	{
		var node = diagram.Factory.CreateShapeNode(placeBounds);
		node.Text = place.Label;
		node.TextFormat.LineAlignment = StringAlignment.Far;
		node.Shape = Shapes.Ellipse;
		node.Tag = place.Tokens;
		node.CustomDraw = CustomDraw.Additional;
		nodeMap[place] = node;
	}

	foreach (var trans in net.Transitions)
	{
		var node = diagram.Factory.CreateShapeNode(transBounds);
		node.Text = trans.Label;
		node.TextFormat.LineAlignment = StringAlignment.Far;
		node.Shape = Shapes.Rectangle;
		nodeMap[trans] = node;
	}

	foreach (var arc in net.Arcs)
	{
		var link = diagram.Factory.CreateDiagramLink(
			nodeMap[arc.Input], nodeMap[arc.Output]);
		link.Tag = arc.Multiplicity;
		link.HeadShape = ArrowHeads.PointerArrow;
	}

	var layout = new LayeredLayout();
	layout.Orientation = Orientation.Horizontal;
	layout.StraightenLongLinks = true;
	layout.Arrange(diagram);
}</node,>

We will use the DrawNode custom draw event to render marks associated with each place. Another possibility is to create a custom node class and override its Draw method.

void OnDrawNode(object sender, DrawNodeEventArgs e)
{
	var node = e.Node;
	var g = e.Graphics;

	if (node.Tag is int)
	{
		var tokens = (int)node.Tag;
		var cx = node.Bounds.Width / 2;
		var cy = node.Bounds.Height / 2;

		if (tokens == 1)
		{
			float r = cx / 2;
			DrawMark(cx, cy, r, g);
		}
		else if (tokens == 2)
		{
			float r = 2 * cx / 5;
			DrawMark(cx / 2, cy, r, g);
			DrawMark(3 * cx / 2, cy, r, g);
		}
		else if (tokens == 3)
		{
			float r = cx / 3;
			float y2 = 4 * cy / 3;
			DrawMark(cx, 2 * cy / 5, r, g);
			DrawMark(cx / 2, y2, r, g);
			DrawMark(3 * cx / 2, y2, r, g);
		}
	}
}

void DrawMark(float x, float y, float r, IGraphics g)
{
	g.FillEllipse(Brushes.Black, x - r, y - r, r * 2, r * 2);
}

Finally, set some appearance properties and call the methods above to build the diagram:

public MainForm()
{
	InitializeComponent();

	diagram.ShadowsStyle = ShadowsStyle.None;
	diagram.DiagramLinkStyle.Brush = new MindFusion.Drawing.SolidBrush(Color.Black);
	diagram.ShapeNodeStyle.Brush = new MindFusion.Drawing.SolidBrush(Color.White);
	diagram.ShapeNodeStyle.FontSize = 10f;
	diagram.ShapeNodeStyle.FontStyle = FontStyle.Bold;

	var textAbove = new[]
	{
		new LineTemplate(-100, -100, 200, -100),
		new LineTemplate(200, -100, 200, 0),
		new LineTemplate(200, 0, -100, 0),
		new LineTemplate(-100, 0, -100, -100)
	};
	Shapes.Ellipse.TextArea = textAbove;
	Shapes.Rectangle.TextArea = textAbove;

	var net = CreateSampleNet();
	BuildDiagram(net);
}

The final result is displayed below.
Petri net diagram

The complete sample project is available for download here:
PetriNet.zip

For more information on Petri nets, see this Wikipedia article:
http://en.wikipedia.org/wiki/Petri_net

All MindFusion.Diagramming libraries expose the same programming interface, so most of the sample code shown above will work with only a few modifications in WPF, ASP.NET, Silverlight and Java versions of the control.

Enjoy!

Reporting for Silverlight V1.4 and Scheduling for Silverlight, V3.4

MindFusion has released new versions for two of its Silverlight controls – Scheduler and Reporter. Below are details about the new features:

WebForms Scheduler by MindFusionWhat’s New in Scheduler for Silverlight, Version 3.4

Interactive Recurrence Rescheduling
Recurrences can be rescheduled interactively by holding down the RescheduleRecurrenceKey while dragging a recurrent item. The control tries to preserve the current pattern of the recurrence when possible. Otherwise, the recurrence may be modified to accommodate to the new start and end times of the modified item. Interactive rescheduling is not registered in the undo history.

New Theme
A new built-in theme is available in the Silverlight Scheduling control – the Light theme. It is available through the ThemeType enumeration.

Silverlight Scheduler: The Light Theme

Silverlight Scheduler: The Light Theme

New Members

Several new properties and events have been added to the control:

The trial version of Silverlight Scheduler is available for direct download from here:

MindFusion Scheduling for Silverlight, V3.4 Trial Download

The component is also available on Nuget. To install the component, run the following command in the Package Manager Console

PM> Install-Package MindFusion.Scheduling.Silverlight

WPF Reporting ToolWhat’s New in Silverlight Reporter, V1.4

Report Parameters

Parameters can now be added to a report through the new Parameters collection of the Report class. The parameters provide name, description and value and can be of any type, including expression. For more information about parameters, check the Report Parameters topic.

Barcodes

MindFusion Silverlight reports can now display UPC-A, UPC-E, EAN-8, EAN-13, and QR barcodes. The barcodes are represented by the new Barcode report item.

Silverlight Reporter: Barcode Report Items

Silverlight Reporter: Barcode Report Items

Miscellaneous

  • Report items can be searched by name through the new FindItem method.
  • Fixed an issue with horizontal data ranges.
  • Items in data range headers and footers can now bind to the data source of the data range.
  • New sample illustrating the Barcode report items.

You can download the trial version directly from here:

Reporting for Silverlight, V1.4 Trial Download

The component is also available on Nuget. To install the component, run the following command in the Package Manager Console:

PM> Install-Package MindFusion.Reporting.Silverlight

Technical support is available on the MindFusion discussion board, per email at support@mindfusion.eu. or at the Help Desk. Your questions and comments are always welcomed by MindFusion friendly and competent support team.

About MindFusion Scheduler for Silverlight: MindFusion.Scheduling for Silverlight provides your web application with a host of useful features for creating, customizing, importing and exporting calendars, time tables, appointment schedules. What’s more, the component includes a full-features Gantt chart with an activity chart and a resource chart. Unleash your creativity with the vast set of appearance options and enjoy the freedom to create calendars where every single detail is customizable and can be controlled by you. Implement professional Gantt diagrams and bring project planning features to your web software with a few mouse clicks. The library is packed with many samples, tutorials and extensive documentation to help you started. The licensing scheme is very attractive with various discount options and great savings for multiple licenses as well for small companies – check it here.

About Reporting for Silverlight: An intuitive programming component that integrates into any Silverlight application with ease and provides the full range of reporting features needed to render, customize and save business reports. The control ships with a versatile report viewer, optimized to display quickly even the largest reports and packed with a single-button import/export functionality to PDF, Excel as well full-featured print and print preview options. Impress the end-user with elegant charts and unlimited number of pictures. MindFusion reports can host any Silverlight component so you can efficiently change your reports as the requirements of the end user evolve. More on MindFusion Silverlight Reporter here.

Scheduling for WPF, V 3.4 and Reporting for WPF, V1.4

We are pleased to announce new versions for two of MindFusion’s WPF components – Reporting and Scheduling. Below we list the new features and improvements in each of the controls.

WebForms Scheduler by MindFusionNew in Scheduling for WPF, V3.4

Interactive Recurrence Rescheduling
Recurrences can be rescheduled interactively by holding down the RescheduleRecurrenceKey while dragging a recurrent item. The control tries to preserve the current pattern of the recurrence when possible. Otherwise, you can modify the recurrence to accommodate to the new start and end times of the modified item. Interactive rescheduling is not registered in the undo history.

New Theme
A new built-in theme is available in the Scheduler control – the Light theme. It is available through the ThemeType enumeration.

Scheduler for WPF: The Light Theme

Scheduler for WPF: The Light Theme

New API Members
Several new properties and events have been added to the control:

You can download the trial version of the control directly from this link:

Scheduling for WPF, V3.4 Trial Version Download

The component is also available on Nuget. To install the component, run the following command in the Package Manager Console:

PM> Install-Package MindFusion.Scheduling.Wpf

WPF Reporting ToolNew in Reporting for WPF, V1.4

Report Parameters
Parameters can now be added to a report through the new Parameters collection of the Report class. The parameters provide name, description and value and can be of any type, including expression. For more information about parameters, check the Report Parameters topic.

Barcodes
MindFusion WPF Reporter can now display UPC-A, UPC-E, EAN-8, EAN-13, and QR barcodes. The barcodes are represented by the new Barcode report item.

WPF Reporter: Barcode Report Items

WPF Reporter: Barcode Report Items

Improved charts
Several new properties have been added to the LineChart class to imporive the customization for the plot, grid, legend and axes. The axes settings can be specified through the new XAxisSettings and YAxisSettings properties. The AxesChart class exposes four new properties, which can be used to specify the intervals displayed by the chart axes. The new properties are XMinValue, XMaxValue, YMinValue, and YMaxValue.

Miscellaneous

  • Report items can be searched by name through the new FindItem method.
  • Fixed an issue with horizontal data ranges.
  • Items in data range headers and footers can now bind to the data source of the data range.
  • New sample illustrating the Barcode report items.

You can download the trial version of the control directly from this link:

Reportingfor WPF, V1.4 Trial Version Download

The component is also available on Nuget. To install the component, run the following command in the Package Manager Console:

PM> Install-Package MindFusion.Reporting.Wpf

Technical support: You can write at the Scheduling for WPF discussion board and Reporting for WPF discussion board. Additionally, you can write us at support@mindfusion.eu. Anyway we’ll be glad to answer your questions, comments and recommendations and assist you on how to use the MindFusion WPF controls.

About Scheduling for WPF: The perfect programming tool to enhance your WPF application with a compelling set of ready-to-use calendar features. Choose among six types of schedule views all optimized for high performance and easy customization. Treat your users to the convenience of creating appointments with reminders and recurrence options on the fly with the built-in forms. Change every single calendar element to achieve the perfect look without compromise – apply styling, customize the fonts and colors or simply set one of the elegant predefined themes. Persisting the calendar into a variety of formats is easily done with the integrated exporters and importers. The control is also packed with a rich event set that gives you full control over the user’s actions. More about Scheduler for WPF here.

About Reporting for WPF: A programming tool that provides developers with everything they’ll need to create high-impact data driven reports using WPF. The control supports comprehensive list of report elements, which can be nested, combined and customized to create reports optimized for the needs of your current WPF application. A full-featured chart component is integrated into the report tool and you can extend every single report with a compelling chart of your choice. The report can be saved into a variety of formats and rendered on the screen with the built-in elegant viewer for optimal performance. Further details about MindFusion WPF Reporter here.

Map Control for WinForms, V2.0

We have just released a new version of the Mapping component for WinForms. The release contains some exciting new features, details below:

Street maps

You can render street maps in OpenStreetMap format by adding a StreetMapLayer instance to the MapView. In order to load a street map, create a new StreetMapLayer object and call its Map‘s LoadFromXml method to load the corresponding *.osm file. The pens and brushes used for drawing the map are stored within the StreetMapPens and StreetMapBrushes collections in the static StreetMapFeatures class. You can define additional pens and brushes for drawing and painting certain map features by using the StreetMapLayer’s AddPen and AddBrush methods.

MindFusion Map Control for WinForms: Street maps

MindFusion Map Control for WinForms: Street maps

Zoom control

The ZoomControl class lets users change interactively the current zoom level and scroll position of a MapView. To set it up, add a ZoomControl to the form, place it anywhere over a MapView, and set the control’s Target 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.

MindFusion Map Control for WinForms: Zoom

MindFusion Map Control for WinForms: Zoom

Multiple selection

Now it’s possible to select multiple decorations or map shapes by drawing a selection rectangle. To enable that, set the Behavior property to Select. Selected elements are stored in the Selection collection of respective layer objects.

API changes

  • The type of MapElement‘s Label property has been changed from string to Label class.
  • The FontName and FontSize properties have been moved from MapElement to Label.
  • Type of Layers property changed from List to ObservableCollection.

About MindFusion Mapping for WinForms: Use this powerful WinForms control to provide your software with maps of your choice that include any type of administrative, geographical and political data. The component offers a comprehensive data set of mapping data, which is royalty-free and can easily be integrated into any MindFusion map. You can organize the map data in layers and combine several data files to deliver to the end user the exact map that is required. The advanced pan and zoom options offer a convenient way for the users to inspect in details even a large map. The control fully supports the OpenStreetMap format and lets you create precise and elegant street maps. The API is neatly organized and dutifully documented with plenty of sample code that guarantees you can easily build the map your application demands without compromises on speed and quality. More on Mapping for WinForms here.