|
|
||||
| Package com.dassault_systemes.catjdialog |
Class CATDialog
|
| Class Hierarchy |
java.lang.Object
|
+-com.dassault_systemes.catjdialog.CATCallbackSource
|
+-com.dassault_systemes.catjdialog.CATDialog
| Class Location |
| Class Description |
public abstract class CATDialog
The base graphical component class.
Properties are attributes that represent the component content/state.
A component exposing a property involves that it has:
public <Ppty_Type> get<Ppty_Name>() public void set<Ppty_Name>(<Ppty_Type>)State property.CATCheckBox class exposes: public boolean getState() public void setState(boolean)
Notifications are (user) events that the component may fire, and that
the application may register to.
A component exposing a notification involves that it has a method with the following signature:
public <Notif_Type> get<Notif_Name>Notification()
<Notif_Type> being CATNotification or a subclass.
Example: the button component exposes a ButtonActivated notification.
Then the CATButton class exposes:
public CATNotification getButtonActivatedNotification()
Properties and notifications are clearly identified in the javadoc of each JDialog component.
The XMLDlg format allows to:
public fields with component instances,
Sample: let's study the following XMLDlg excerpt
<?xml version="1.0"?>
<Frame onCreate="onCreate" Controller="com.mypackage.MyController" DefaultButton="AddButton">
<Table Name="List" Attribute="_list" SelectionMode="LINE_SELECTION_MODE" onToolbar="onCommand" onMenu="onCommand"/>
<TextField Name="Field" Attribute="_field" Text="please enter text"/>
<Button Name="AddButton" onButtonActivated="onAdd"/>
[...]
Name attribute (in red) instantiates the named JDialog component with the specified name, <component_instance> = new CAT<component_type>(<parent_component>, <Name>)
(the topmost component is instantiated with the XMLDlg file's name)Controller attribute (in orange) declares and instantiates the controller class, <controller_instance> = new <controller_class>()
Attribute attribute (in brown) assigns the component object instance to the named public controller field, <controller_instance>.<field_name> = <component_instance>
on[Notif_Name] attribute (in green) registers the controller to the named notification on the specified method name, <component_instance>.addCallback(<component_instance>.get<Notif_Name>Notification(), <controller_instance>, <method_name>, null)
<component_instance>.set<Attr_Name>(<Attr_Value>)
All component properties that are displayed to the end-user (such as a
CATButton title, a CATLabel text, a tooltip, ...), support an implicit mapping
to the message catalog file.
The entry is of the form:
<relative_component_path>.<Ppty_Mapping> = "the message value";
Message Catalog Implicit Mappings are clearly identified in the javadoc of each JDialog component.
Sample: here is an XMLDlg with its associated CATNls file
| XMLDlg file | CATNls file |
|---|---|
<?xml version="1.0"?>
<!-- XMLDlg file for MySearch command -->
<DialogBox onCreate="onCreate"
Controller="com.mypackage.MySearch">
<Frame Name="frame">
<WebPartFrame Name="search">
<Frame Name="f">
<Label Name="CriteriaLabel"/>
<TextField Name="Criteria"
Attribute="_criteria"/>
<Button Name="Search"
onButtonActivated="onSearch"/>
[...]
</Frame>
</WebPartFrame>
<WebPartFrame Name="results">
<Table Name="Table" Attribute="_results"/>
</WebPartFrame>
[...]
</Frame>
</DialogBox>
|
// --- English Message Catalog for MySearch command // 'search' WebPartFrame title frame.search.Title = "Search: "; // 'CriteriaLabel' Label text frame.search.f.CriteriaLabel.Title = "Criteria: "; // 'Search' Button label frame.search.f.Search.Title = "Search"; // 'Search' Button tooltip frame.search.f.Search.Tooltip = "Click Here To Search"; // 'results' WebPartFrame title frame.results.Title = "Results: "; |
| Field Summary |
| Constructor Summary |
| CATDialog(CATDialog iParent, String iName) |
| Method Summary |
| Field Detail |
| Constructor Detail |
CATDialog(CATDialog iParent, String iName)
This is the base constructor for any graphical component.
iParentiName| Method Detail |
CATDialog getChild(String iName)
Returns the child component with the given name.
iName
boolean getVisibility()
Returns whether this component is visibile or not. Default is visible.
true if this component is visible; false otherwise.
void setVisibility(boolean iVisibility)
Changes this component visibility (true displays it, false hides it).
An invisible component is never displayed to the end user. It doesn't occupy any space in the page layout.
iVisibilitytrue makes this component visible; false hides it.
boolean getAsyncRefreshable()
Determines whether this component may be refreshed asynchronously.
true if this component may be refreshed asynchronously; false otherwise.
void setAsyncRefreshable(boolean iRefreshable)
Sets whether this component may be refreshed asynchronously.
iRefreshabletrue makes this component "asynchronously refreshable".
void requestAsyncRefresh()
This method triggers the asynchronous refresh mechanism on this component.
boolean isDisplayed()
Determines whether this component is displayed on screen or not.
This method checks that:
true if this component is displayed on screen; false otherwise.
boolean show()
Tries to have this component displayed on screen.
This method proceeds as follows:
boolean displayChild(CATDialog iChild)
Tries to display the given child component.
This is involved in the show() method implementation.
iChild
boolean isChildDisplayed(CATDialog iChild)
Determines whether the child component is displayed by this component.
This is involved in the isDisplayed() method implementation.
iChildtrue if the specified child component is displayed by this component; false otherwise.
Enumeration getChildren()
Returns the list of children components.
null if this component has no child.
boolean hasChildren()
Returns the list of children components.
null if this component has no child.
String[] getNotifications()
Returns the list of notification names exposed by this component.
The list of notifications is retreived by introspecting methods with the following signature:
CATNotification get<Notif_Name>Notification()
Object[][] getProperties()
Returns the list of property names and types exposed by the given component.
The list of properties is retreived by introspecting methods with the following signature:
<Ppty_Type> get<Ppty_Name>()
void set<Ppty_Name>(<Ppty_Type>)
Object getProperty(String iName)
Returns a property value by name.
Returns the property value by invoking <Ppty_Type> get<Ppty_Name>()
This method might throw an Error if the given method is not found or not accessible.
iName
void setProperty(String iName, String iValue)
Sets a property value by name, from a string.
Sets the property value by invoking void set<Ppty_Name>(<Ppty_Type>) and trying to cast the given string value to the expected type.
This method might throw an Error if the given method is not found or not accessible, or if the string value cannot be casted into the expected type.
iNameiValue
CATNotification getCreateNotification()
The component creation notification.
This notification is sent right after the component is instantiated and added to its parent.
CATNotification getDestroyNotification()
The component destruction notification.
This notification is sent right before the component is removed from its parent and destroyed.
Object getExtension(String iExtension)
Returns the renderer object associated to this component class.
This method is called by the framework to retreive renderer classes.
iExtension
String getExtensionClass(String iClass, String iExtension)
Returns the name of an extension class.
Overload this method for custom widgets that are not part of the com.dassault_systemes.catjdialog package.
iClassiExtension
String getName()
Returns the component name (that was passed in the constructor).
CATNotification getNewChildNotification()
The component new child notification.
This notification is sent right after a new child is added to this component.
String getNLS(String iMessage, String iDefault)
Retreives a NLS message from the command message catalog.
NLS messages are defined in CATNls resource files in the runtime view.
Navigate in component hierarchy to find a message catalog.
iMessageiDefault
CATDialog getParent()
Returns the parent component of this component.
CATNotification getRemoveChildNotification()
The component remove child notification.
This notification is sent right before new child is removed from this component.
CATNotification getDocumentChangedNotification()
The component document changed notification.
This notification is sent by the top command component every time the command document changes (including when activating of stacking the command).
CATDialog instanciate(String iFile, String iName)
Instanciates a component from an XMLDlg file.
iFileiName
CATDialog instanciate(String iFile)
This helper method calls instanciate(iFile, iFile)
iFile
CATDialog instanciate(String iFile, String iName, Object iController)
Helper method for instanciate.
iFileiNameiController
CATDialog instanciate(CATDialog iParent, CATXMLNode iNode, Object iController, String iMessageCatalog)
Instanciate a component hierarchy from an XML document
void requestDestruction()
Destroys this component.
The component is first removed from its parent and then destroyed.
String getPath()
Returns the component absolute path.
This path is built up with component names from the top component to this one, separated with '/' characters.
Note: The path identifies uniquely the component in a user session (no other component may share the same path).
CATDialog search(String iPath)
Searches a component child from its path.
iPath
CATSession getSession()
Returns the user session.
void errorBox(CATError iError)
Causes an error box to show up.
iError
String toString()
Returns a string representation of the component object.