How to Use List & Label .NET Directly in Java

With the help of Javonet, the List & Label .NET component can be easily integrated and used directly from Java – with the usual ease of use you are accustomed to from .NET. With this cooperation, Java customers have easy access e.g. to real data preview in the Designer, drilldown reporting and report parameters to name just a few of the interactive features.

All you need is a wrapper that can be written quickly. You can also use your own .NET objects or events here. And even if you don’t expect it, because you have to communicate via Java to .NET and back to Java, the performance is really good. 

Such a Javonet based wrapper for the List & Label .NET component has now been developed in cooperation – including a suitable Eclipse Java example, which can be downloaded from GitHub and contains a detailed description.

.NET code with easy data binding and printing:

private void OnButtonPrintList()
{
ListLabel LL = null;
try
{
LL = new ListLabel();

// attach the preview control
LL.PreviewControl = this.LLPreviewControl;

// bind to the DbCommandSetDataProvider
LL.SetDataBinding(CreateDbCommandSetDataProvider(), "Products");

// set the default project name
LL.AutoProjectFile = "simple.lst";

// choose a list project
LL.AutoProjectType = LlProject.List;

// call the print method
LL.Print();
}
catch (LL_User_Aborted_Exception ex)
{
// ignore this exception
}
catch (ListLabelException LlException)
{
MessageBox.Show("Information: " +
LlException.Message +
"nnThis information was generated by a List & Label custom exception.",
"Information",
MessageBoxButtons.OK, MessageBoxIcon.Error
);
}
finally
{
if (LL != null)
{
LL.Dispose();
}
}
}

Java code that maps the identical .NET code using the Javonet wrapper:

private void OnButtonPrintList() {
ListLabel LL = null;
try {
LL = new ListLabel();

// attach the preview control
LL.setPreviewControl(this.LLPreviewControl);

// bind to the DbCommandSetDataProvider
LL.SetDataBinding(CreateDbCommandSetDataProvider(), "Products");

// set the default project name
LL.setAutoProjectFile("simple.lst");

// choose a list project
LL.setAutoProjectType(LlProject.List);

// call the print method
LL.Print(this);
} catch (LL_User_Aborted_Exception ex) {
// ignore this exception
} catch (ListLabelException LlException) {
JOptionPane.showMessageDialog(null,
"Information: " + LlException.getMessage()
+ "nnThis information was generated by a List & Label custom exception.",
"Information", JOptionPane.ERROR_MESSAGE);
}
finally {
if(LL != null) {
LL.Dispose();
}
}
}

List & Label in Java can now be used just as easily as directly in .NET. So far, the wrapper does not yet map the entire List & Label .NET component, but the very easy .NET data binding and the associated design and print calls are already included. And best of all, the Javonet Wrapper’s GitHub project allows you to easily implement your own extensions yourself.

Related Posts

Leave a Comment