FormLayout class
Package: com.tecit.TFORMer.Repository
Provides access to a FormLayout which is referenced by a Repository or available as stand-alone FormLayout.
Usage and notes
Overview
A FormLayout is a document which was created with TFORMer Designer. This class is used to retrieve or set information belonging to a FormLayout.
A typical FormLayout contains static content (like a logo), dynamic content (like a DataField) and a number of properties which are used to describe the FormLayout and its behavior during print-time. Each FormLayout is member of exactly one Project (in the case of a Repository) or the GlobalProject (in the case of a stand-alone FormLayout).
Note
It is not possible to change the appearance of the FormLayout (like adding new elements or bands) through the SDK. Design tasks are supported by TFORMer Designer only.
Repository-based FormLayouts
General
Each FormLayout referenced from within a Repository is a member of exactly one Project.
DataFields defined within a Project are only usable by FormLayouts which are member of this Project.
The so-called GlobalProject is allocated by default and is exclusively used to define DataFields and DataSources which are available for all FormLayouts (regardless of their actual Project membership). It can not store references to a FormLayout.
The Repository also stores JobTrayControl objects (see Job.setJobTrayControlName).
A Repository uses the file extension
*.tfr.
Printing
When printing a specific FormLayout within a Repository 3 parameters must be specified to identify the FormLayout:
The Repository name (which is identical to the filename of the Repository, see Job.setRepositoryName)
The Project name as defined by the user in TFORMer Designer (see Job.setProjectName)
The FormLayout name as defined by the user in TFORMer Designer (see Job.setFormName)
Stand-Alone FormLayout
General
A stand-alone FormLayout can be used on its own and can be imagined like a very simple type of Repository which contains exactly one Project (namely the GlobalProject).
A stand-alone FormLayout stores the DataField definitions, JobTrayControl definitions, DataSource definitions as well as the FormLayout itself. It is not able to share DataField definitions with other FormLayouts and can not contain user-defined Project objects.
A stand-alone FormLayout uses the file extension
*.tff.
Printing
When printing a Job using a stand-alone FormLayout 1 parameter must be specified:
The Repository name (which is identical to the filename of the stand-alone FormLayout, see Job.setRepositoryName)
Note
Do not use Job.setProjectName and Job.setFormName when using a stand-alone FormLayout!
Determining Used DataFields
To find a data-field by name, use Project.getDataField. To iterate through the available data-fields, use Project.getFirstDataField and DataField.getNext. If you want to know, whether the returned DataField is actually used you can use the method FormLayout.getDataFieldUsage.
Sample
To retrieve the FormLayout object within a stand-alone FormLayout do the following:
// Retrieve the global Project
// A stand-alone FormLayout contains only the global Project, the global Project contains the FormLayout
Project project = repository.getGlobalProject ();
if (project != null)
{
System.out.println (project.toString());
// Retrieve the first (and only) FormLayout
FormLayout formlayout = project.getFirstFormLayout ();
if (formlayout != null)
{
System.out.println (formlayout.toString());
}
}
To retrieve all FormLayout objects within a Repository do the following:
// Retrieve the first Project
Project project = repository.getFirstProject ();
while (project != null)
{
System.out.println (project.toString());
// Retrieve the first FormLayout in this Project
FormLayout formlayout = project.getFirstFormLayout ();
while (formlayout != null)
{
System.out.println (formlayout.toString());
// Get the next FormLayout in this Project
formlayout = formlayout.getNext ();
}
// Get the next Project
project = project.getNext ();
}
Attention
The FormLayout is only valid as long as it is available in the Project. If it is removed from the Project all instances of the FormLayout become invalid immediately.
Note
Thread-safety: A single instance of this class must not be used by different threads.
Methods
| Member | Description |
|---|---|
| design(String, boolean, boolean, boolean, String) | Opens the FormLayout with TFORMer Designer. |
| dispose() | Releases the resources allocated by this instance. |
| dump(PrintStream) | Dumps the current instance into a text stream. |
| getComment() | Gets the comment for the FormLayout. |
| getDataFieldUsage(String) | Retrieves the usage of a specific DataField in a FormLayout. |
| getDescription() | Gets the description of the FormLayout. |
| getFileName() | Gets the filename of the FormLayout. |
| getName() | Gets the name of the FormLayout. |
| getNext() | Gets the next FormLayout in the Project. |
| setComment(String) | Sets the comment for the FormLayout. |
| setDescription(String) | Sets the description of the FormLayout. |
| setFileName(String) | Sets the filename of the FormLayout. |
| setName(String) | Sets the name of the FormLayout. |
| toString() | Returns a string representation of the instance. |