|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
wt.clients.beans.AssociationsPanel
public class AssociationsPanel
This bean has a dev-time and run-time component. At dev-time,
this component can be dragged from the component library in
Visual Cafe and dropped onto a container. The properties can
also be edited by using Visual Cafe's Property Editor. At
run-time, this class retrieves the links of the object and displays
them in a multilist. The bean has an Edit and View mode.
In edit mode, the user can add new relationships, remove existing
relationships, and update existing relationships by editing the
attributes on the link. In view mode, the user can view the
relationships and view the attributes on the link. The bean
keeps track of the creates, updates, and removes and is able
to persist the changes when save() is invoked.
The following is an example of how to use the bean:
The class accommodates validating and persisting changes only when
the save() method is invoked. To turn on this behavior invoke the
setSaveUpdatesOnly(true) method. The normal behavior is to verify
and persist all association entries even though some of the entries
are not changed. When the normal behavior is used existing
described by documents that are in a checked out state by another
user will error when the save() method is invoked. This results in
adds, removes, or updates not being saved. If this is not the
desired behavior then invoke the setSaveUpdatesOnly(true) method
immediately after instantiating the class.
associationsPanel1 = new wt.clients.beans.AssociationsPanel();
associationsPanel1.setRole("someRole");
associationsPanel1.setChooserOptions(wt.clients.beans.query.ChooserOptions.SOME_SEARCH_LIST);
try {
java.lang.String[] tempString = new java.lang.String[5];
tempString[0] = display("nameColumn");
tempString[1] = display("numberColumn");
tempString[2] = display(SomeRB.TITLE_COLUMN);
tempString[3] = display(SomeRB.PART_TYPE_COLUMN);
tempString[4] = display(SomeRB.SOURCE_COLUMN);
associationsPanel1.setLabels(tempString);
}
catch(java.beans.PropertyVetoException e) { }
try {
associationsPanel1.setLinkClassName("someClass");
}
catch(wt.util.WTPropertyVetoException e) { }
try {
associationsPanel1.setObjectClassName("anotherClass");
}
catch(java.lang.ClassNotFoundException e) { }
try {
java.lang.String[] tempString = new java.lang.String[5];
tempString[0] = new java.lang.String("name");
tempString[1] = new java.lang.String("number");
tempString[2] = new java.lang.String("title");
tempString[3] = new java.lang.String("partType");
tempString[4] = new java.lang.String("source");
associationsPanel1.setOtherSideAttributes(tempString);
}
catch(wt.util.WTPropertyVetoException e) { }
try {
associationsPanel1.setOtherSideClassName("someClass");
}
catch(java.lang.ClassNotFoundException e) { }
associationsPanel1.setMode("Edit");
try {
java.lang.String[] tempString = new java.lang.String[1];
tempString[0] = new java.lang.String("description");
associationsPanel1.setLinkAttributes(tempString);
}
catch(wt.util.WTPropertyVetoException e) { }
associationsPanel1.setBounds(0,0,530,62);
associationsPanel1.setBackground(new Color(12632256));
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(0,0,0,0);
((GridBagLayout)panel3.getLayout()).setConstraints(associationsPanel1, gbc);
panel3.add(associationsPanel1);
associationsPanel1.addHelpListener(helpListener);
associationsPanel1.setObject(taskLogic.getCurrentObject());
associationsPanel1.setEnabled(true);
associationsPanel1.save(taskLogic.getCurrentObject());
associationsPanel1.getHelpContext().stopIt();
Supported API: true.
Extendable: true.
| Nested Class Summary | |
|---|---|
class |
AssociationsPanel.AddObjectListener
This class listens for the user to select an objec. |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
AssociationsPanel()
This is the no arg constructor that creates the panel with a multilist, a view button, and an attributesForm which will be used to display or edit the attributes on the link. |
|
AssociationsPanel(String mode)
This creates an instance of the associationsPanel and sets the mode to the parameter. |
|
| Method Summary | |
|---|---|
protected void |
addEditButtons()
This adds the buttons that are associated with the edit mode Supported API: true. |
void |
addHelpListener(PropertyChangeListener pcl)
Method addHelpListener adds the given listener to be notified
of PropertyChangeEvents in the help system. |
protected void |
addSelectedObject(Persistable added_object)
This creates a new link to an object selected by the user and adds it to the multilist. |
protected void |
addToTable(BinaryLink link)
this adds a new object to the table Supported API: true. |
protected void |
createEditButtons()
This creates the buttons used in edit mode Supported API: true. |
protected void |
createUI()
This adds and removes fields based on the mode Supported API: true. |
protected void |
defaultColumnWidths()
This initialized the column widths of the multilist to equal widths with a hidden last column. |
Applet |
getApplet()
This is the public getter used to get the Applet that started this bean. |
Color |
getBackground()
This gets the background of the panel. |
String |
getChooserOptions()
This is used to get the list of classes that the user can pick from on the frame that pops up when the user clicks the Add button. |
Font |
getFont()
This gets the font of the panel. |
Color |
getForeground()
This gets the foreground of the panel. |
Frame |
getFrame()
This is the public getter used to get the Frame that started this bean. |
HelpContext |
getHelpContext()
This returns the helpContext being used for online help. |
HelpSystem |
getHelpSystem()
This returns the helpSystem being used for online help. |
String[] |
getLabels()
This gets the labels that are used as the column headers for the multilist. |
String[] |
getLinkAttributes()
This gets the names of the attributes of the other-side class that are displayed in the columns of the multilist. |
String |
getLinkClassName()
This gets the name of the linkClass that to be traversed. |
wt.clients.beans.Schema |
getLinkSchema()
This method returns the linkSchema set by the developer at dev-time Supported API: true. |
Dimension |
getMinimumSize()
This returns the minimum size that will be used at dev-time and at run-time depending on the layout. |
Dimension |
getMinimumSize(int cols,
int rows)
This returns the minimum size that will be used at dev-time and at run-time depending on the layout. |
String |
getMode()
This is the public getter that returns the current mode of the bean. |
String[] |
getMultiListLinkAttributes()
This gets the names of the attributes of the link class that are displayed in the columns of the multilist. |
Object |
getObject()
This is the public getter that will return the object that is being edited or viewed. |
Class |
getObjectClass()
This is the public getter for the objectClass whose links are navigated & updated, or viewed. |
String |
getObjectClassName()
This is the public getter for the objectClassName which is the string that represents the objectClass whose links are navigated & updated, or viewed. |
String[] |
getOtherSideAttributes()
This is the public getter used to get the otherSideAttributes that are displayed in the multilist. |
Class |
getOtherSideClass()
This is the public getter that returns the class that is being navigated to along the role. |
String |
getOtherSideClassName()
This is the public getter that returns the name of the class that is being navigated to along the role. |
wt.clients.beans.Schema |
getOtherSideSchema()
This method returns the otherSideSchema set by the developer at dev-time Supported API: true. |
Dimension |
getPreferredSize()
This returns the preferred size that will be used at dev-time and at run-time depending on the layout. |
Dimension |
getPreferredSize(int cols,
int rows)
This returns the preferred size that will be used at dev-time and at run-time depending on the layout. |
String[] |
getRelativeColumnWidths()
This method is used to get the widths of the of the multilist relative to 1 which represents the smallest column width. |
String |
getRole()
This is the public getter for the role that is navigated. |
boolean |
getSaveUpdatesOnly()
This is the public getter that returns the boolean value of the saveUpdatesOnly flag. |
BinaryLink |
getSelectedLink()
This returns the link represented by the row that the user has selected in the multilist. |
Persistable |
getSelectedObject()
This returns the object that the user has currently selected in the multilist. |
Object[] |
getSelectedObjects()
This returns the objects that the user has currently selected in the multilist. |
boolean |
getShowIBA()
Get whether IBA tab will show. |
protected boolean |
isCurrentLinkAttributeDirty()
This returns a boolean value representing whether or not the user has modified the current link attribute(s). |
boolean |
isDirty()
This returns a boolean value representing whether or not the user has modified anything. |
protected void |
launchChooserDialog()
This launches a dialog that will allow the user to select an object and add it to the multilist, create a new link to it, and edit the link. |
protected void |
launchQueryDialog()
This launches a dialog that will allow the user to select an object and add it to the multilist, create a new link to it, and edit the link. |
protected void |
localize()
This method sets the text of the components to the localized string from the resource bundle. |
protected void |
populate()
This retrieves the links on the object and displays them in the multilist. |
void |
refresh()
This method redraws the column widths after the multilist has been displayed. |
protected void |
removeEditButtons()
This removes the buttons that are associated with the edit mode Supported API: true. |
void |
removeHelpListener(PropertyChangeListener pcl)
Method removeHelpListener removes a listener which was being
notified of PropertyChangeEvents in the help system. |
protected void |
removeSelectedObject(BinaryLink link)
this removes the link that the user has selected from the links hashtable and adds it to the removedLinks hashtable if it is persistent so that it can be removed from the db. |
void |
requestFocus()
Calling requestFocus() on this panel will set the focus to the first field in the panel which is the multilist. |
protected void |
resetHashtables()
This resets the hashtables Supported API: true. |
protected void |
resetLabels()
This resets the column headers with the context of the labels property and the multiListLinkAttributes property. |
Persistable |
save(Persistable persistable)
This is used to save the links the to Persistable
passed in. |
void |
setApplet(Applet applet)
This is the public setter used to set the Applet that started this bean. |
void |
setBackground(Color color)
This sets the background of the panel. |
void |
setChooserOptions(String options)
This is used to set the list of classes that the user can pick from on the frame that pops up when the user clicks the Add button. |
protected void |
setCurrentLinkAttributeDirty(boolean flag)
This sets the dirty flag and should be called when the user makes some action to change the state of the bean. |
protected void |
setDirty(boolean flag)
This sets the dirty flag and should be called when the user makes some action to change the state of the bean. |
void |
setEnabled(boolean b)
This sets the panel and it's components to enabled or disabled based on the passed in boolean. |
protected void |
setFieldState(boolean b,
Container container)
This sets the fields to either editable or enabled depending on the boolean and the type of component. |
void |
setFont(Font font)
This sets the font of the panel. |
void |
setForeground(Color color)
This sets the foreground of the panel. |
void |
setFrame(Frame frame)
This is the public setter used to set the Frame that started this bean. |
void |
setLabels(String[] labels)
This sets the labels that will be used as the column headers for the multilist. |
void |
setLinkAttributes(String[] link_attributes)
This sets the names of the attributes of the other-side class that will be displayed in the columns of the multilist. |
void |
setLinkClassName(String class_name)
This sets the name of the linkClass that is being traversed. |
void |
setLinkSchema(wt.clients.beans.Schema schema)
This is used at dev-time when the developer uses the schema editor to select the class and the attributes of the link. |
void |
setMode(String mode)
This is used to set the mode of the bean to either EDIT_MODE or VIEW_MODE and the GUI will be updated based on the mode. |
void |
setModel(wt.clients.beans.AssociationsModel model)
This method sets the model class used to navigate the relationship. |
void |
setMultiListLinkAttributes(String[] link_attributes)
This sets the names of the attributes of the link class that will be displayed in the columns of the multilist. |
void |
setObject(Object object)
This is the public setter that will set the object that to be edited or viewed. |
void |
setObjectClass(Class object_class)
This is the public setter for the objectClass whose links will be navigated & updated, or viewed. |
void |
setObjectClassName(String object_class)
This is the public setter for the objectClassName which is the string that represents the objectClass whose links will be navigated & updated, or viewed. |
void |
setOtherSideAttributes(String[] attributes)
This is the public setter used to set the otherSideAttributes that are displayed in the multilist. |
void |
setOtherSideClass(Class other_side)
This is the public setter that sets the class to be navigated to along the role. |
void |
setOtherSideClassName(String other_side)
This is the public setter that sets the name of the class to be navigated to along the role. |
void |
setOtherSideSchema(wt.clients.beans.Schema schema)
This is used at dev-time when the developer uses the schema editor to select the class and the attributes of the other-side object. |
void |
setRelativeColumnWidths(String[] widths)
This method is used to set the widths of the of the multilist relative to 1 which represents the smallest column width. |
void |
setRole(String role)
This is the public setter for the role that will be navigated. |
void |
setSaveUpdatesOnly(boolean flagValue)
This sets the boolean value of the saveUpdatesOnly flag. |
void |
setShowIBA(boolean show_iba)
Used to set if IBA tab will show up. |
protected void |
updateLinks()
This updates the links with the results of the user's actions Supported API: true. |
protected void |
updateTableLinkValues(int row,
BinaryLink link)
Update the string values displayed in the MultiList. |
protected void |
viewSelectedObject()
This will use the TaskDelegate for the selected object to launch a view of that object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AssociationsPanel()
public AssociationsPanel(String mode)
| Method Detail |
|---|
protected void localize()
public Dimension getMinimumSize()
getMinimumSize in class Container
public Dimension getMinimumSize(int cols,
int rows)
public Dimension getPreferredSize()
getPreferredSize in class Container
public Dimension getPreferredSize(int cols,
int rows)
public boolean isDirty()
protected void setDirty(boolean flag)
protected boolean isCurrentLinkAttributeDirty()
protected void setCurrentLinkAttributeDirty(boolean flag)
public void setMode(String mode)
public String getMode()
public void setChooserOptions(String options)
public String getChooserOptions()
public void setShowIBA(boolean show_iba)
public boolean getShowIBA()
public Object getObject()
public void setObject(Object object)
linkClass.
public void setRole(String role)
public String getRole()
public void setObjectClass(Class object_class)
public Class getObjectClass()
public void setObjectClassName(String object_class)
throws ClassNotFoundException
ClassNotFoundExceptionpublic String getObjectClassName()
public Class getOtherSideClass()
public void setOtherSideClass(Class other_side)
public String getOtherSideClassName()
public void setOtherSideClassName(String other_side)
throws ClassNotFoundException
ClassNotFoundException
public void setLinkClassName(String class_name)
throws WTPropertyVetoException
WTPropertyVetoExceptionpublic String getLinkClassName()
public void setLinkAttributes(String[] link_attributes)
throws WTPropertyVetoException
WTPropertyVetoExceptionpublic String[] getLinkAttributes()
public void setMultiListLinkAttributes(String[] link_attributes)
throws WTPropertyVetoException,
PropertyVetoException,
ClassNotFoundException,
wt.introspection.WTIntrospectionException
WTPropertyVetoException
PropertyVetoException
ClassNotFoundException
wt.introspection.WTIntrospectionExceptionpublic String[] getMultiListLinkAttributes()
public void setLinkSchema(wt.clients.beans.Schema schema)
throws PropertyVetoException
PropertyVetoExceptionpublic wt.clients.beans.Schema getLinkSchema()
public void setModel(wt.clients.beans.AssociationsModel model)
throws PropertyVetoException
PropertyVetoException
public void setOtherSideSchema(wt.clients.beans.Schema schema)
throws PropertyVetoException,
ClassNotFoundException
PropertyVetoException
ClassNotFoundExceptionpublic wt.clients.beans.Schema getOtherSideSchema()
public void setApplet(Applet applet)
public Applet getApplet()
public void setFrame(Frame frame)
public Frame getFrame()
public void setOtherSideAttributes(String[] attributes)
public String[] getOtherSideAttributes()
public void setLabels(String[] labels)
throws PropertyVetoException
PropertyVetoExceptionpublic String[] getLabels()
public boolean getSaveUpdatesOnly()
public void setSaveUpdatesOnly(boolean flagValue)
public void setRelativeColumnWidths(String[] widths)
throws PropertyVetoException
PropertyVetoExceptionpublic String[] getRelativeColumnWidths()
public void refresh()
throws PropertyVetoException
PropertyVetoExceptionpublic void setForeground(Color color)
setForeground in class Componentpublic Color getForeground()
getForeground in class Componentpublic void setBackground(Color color)
setBackground in class Componentpublic Color getBackground()
getBackground in class Componentpublic void setFont(Font font)
setFont in class Containerpublic Font getFont()
getFont in interface MenuContainergetFont in class Component
public Persistable save(Persistable persistable)
throws WTException,
wt.introspection.WTIntrospectionException
Persistable
passed in. It persists the created & updated links, and
deletes the removed links.
WTException
wt.introspection.WTIntrospectionException
protected void createUI()
throws WTPropertyVetoException
WTPropertyVetoExceptionprotected void removeEditButtons()
protected void addEditButtons()
protected void createEditButtons()
protected void resetHashtables()
protected void updateLinks()
throws wt.introspection.WTIntrospectionException,
WTException
wt.introspection.WTIntrospectionException
WTException
protected void resetLabels()
throws PropertyVetoException
PropertyVetoException
protected void defaultColumnWidths()
throws PropertyVetoException
PropertyVetoExceptionprotected void populate()
protected void addToTable(BinaryLink link)
throws InvalidRoleException,
WTException,
InvocationTargetException,
IllegalAccessException,
NoSuchMethodException
InvalidRoleException
WTException
InvocationTargetException
IllegalAccessException
NoSuchMethodException
protected void updateTableLinkValues(int row,
BinaryLink link)
throws InvalidRoleException,
WTException,
InvocationTargetException,
IllegalAccessException,
NoSuchMethodException
InvalidRoleException
WTException
InvocationTargetException
IllegalAccessException
NoSuchMethodException
protected void addSelectedObject(Persistable added_object)
throws wt.introspection.WTIntrospectionException,
IllegalAccessException,
NoSuchMethodException,
InstantiationException,
ClassNotFoundException,
InvocationTargetException,
WTException
wt.introspection.WTIntrospectionException
IllegalAccessException
NoSuchMethodException
InstantiationException
ClassNotFoundException
InvocationTargetException
WTException
protected void removeSelectedObject(BinaryLink link)
throws WTException,
InvalidRoleException
WTException
InvalidRoleException
protected void launchQueryDialog()
throws WTException
WTException
protected void launchChooserDialog()
throws WTException
WTExceptionpublic Object[] getSelectedObjects()
getSelectedObjects in interface ItemSelectable
public Persistable getSelectedObject()
throws InvalidRoleException,
WTException
InvalidRoleException
WTExceptionpublic BinaryLink getSelectedLink()
protected void viewSelectedObject()
public HelpContext getHelpContext()
public HelpSystem getHelpSystem()
public void addHelpListener(PropertyChangeListener pcl)
addHelpListener adds the given listener to be notified
of PropertyChangeEvents in the help system. Tool description
PropertyChangeEvents are generated when the user mouses over
the buttons and list of ContentItems in this panel. The
given listener will be notified of those events.
pcl - The PropertyChangeListener to be notified of
PropertyChangeEvents generated by the help system.removeHelpListener(java.beans.PropertyChangeListener),
HelpSystem,
HelpContext,
PropertyChangeListenerpublic void removeHelpListener(PropertyChangeListener pcl)
removeHelpListener removes a listener which was being
notified of PropertyChangeEvents in the help system. If
the given listener is not currently a listener, no changes are made.
pcl - the PropertyChangeListener to be removed as a
listener of events generated by the help system of this panel.addHelpListener(java.beans.PropertyChangeListener),
PropertyChangeListenerpublic void setEnabled(boolean b)
setEnabled in class Component
protected void setFieldState(boolean b,
Container container)
public void requestFocus()
requestFocus in class Component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||