wt.clients.beans
Class AttributesForm

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bywt.clients.beans.AttributesForm
All Implemented Interfaces:
Accessible, EventListener, Externalizable, ImageObserver, MenuContainer, PropertyChangeListener, Serializable

public class AttributesForm
extends Panel
implements PropertyChangeListener, Externalizable

AttributesForm is Java Bean component for manipulating modeled Windchill business objects, such as Parts, Documents, etc. It contains methods to specify the class of the object being manipulated and the attributes to be displayed. A label and edit/view may be specified for each attribute. The AttributesForm dynamically constructs a user interface based on the contained class and the specified information about the attributes. Boolean attributes are represented as checkboxes, Enumerated types as choice lists, string and integer values are shown in text fields. The following attribute types are currently supported:

  1. int
  2. short
  3. long
  4. float
  5. double
  6. boolean
  7. java.lang.Integer
  8. java.lang.Double
  9. java.lang.Float
  10. java.lang.Boolean
  11. java.lang.String
  12. java.sql.Timestamp
  13. java.sql.Date
  14. java.util.Date
  15. wt.fc.EnumeratedType
  16. wt.vc.views.ViewReference
  17. wt.team.TeamTemplateReference
  18. wt.lifecycle.LifeCycleState
  19. wt.org.WTPrincipalReference
  20. wt.part.Quantity
Additional attribute types can be supported by the AttributesForm bean by creating an appropriate wt.clients.beans.selectors.ComponentDelegate for an attribute type and placing an entry in the service.properties file in the section for use by the wt.clients.beans.selectors.ComponentDelegateFactory . The bean uses Windchill Introspection mechanisms to determine if an attribute is required. If the attribute is required, the label will contain a leading asterisk(*), or other suitable localized character. The bean uses Windchill Introspection mechanisms to determine the maximum length of String attributes. By default, string attributes with a maximum length of more than 80 characters are displayed in TextAreas, while strings 80 characters or less are displayed in TextFields. The transition point value of 80 characters may be overridden by specifying another value for the "MaxTextFieldLength" property for the bean. The bean will also use Windchill Introspection mechanisms to obtain a display value to use as the label for property. The following code demonstrates a possible use of this class:

	    Frame f = new Frame("AttributesPanel test");

	    AttributesForm attributeBean = new AttributesForm();
	    f.setSize(700,600);
	    f.setLayout(new BorderLayout());

       try
       {
	         attributeBean.setObjectClassName("wt.part.WTPart");
           {
		        java.lang.String[] tempString = new java.lang.String[4];
		        tempString[0] = new java.lang.String("number");
		        tempString[1] = new java.lang.String("name");
		        tempString[2] = new java.lang.String("source");
		        tempString[3] = new java.lang.String("partType");
		        attributeBean.setAttributes(tempString);
		    }
          {
		        java.lang.String[] tempString = new java.lang.String[4];

		        tempString[0] = "true";
		        tempString[1] = "true";
		        tempString[2] = "true";
		        tempString[3] = "true";
	            attributeBean.setEdits(tempString);
           }

       }
       catch ( WTPropertyVetoException wte)
       {
            wte.printStackTrace();
       }

	    f.add("Center",attributeBean);
	    f.pack();
	    f.show();
      wt.part.WTPart part = wt.part.WTPart.newWTPart();
      attributeBean.setObject(part);

 


Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  String[] attributes
           
private  String[] attributesProperty
           
private  Color background
           
protected  ClassInfo classInfo
           
private  ContainerColorUtility colorUtility
           
protected  ComponentDelegate[] componentSelectors
           
static int CREATE_MODE
           
protected  int DEFAULT_MAX_TEXT_FIELD_LENGTH
           
private  boolean[] edits
           
private  boolean[] editsProperty
           
private  String[] editValues
           
private  String[] editValuesProperty
           
static String FALSE
           
private  String focusAttributeName
           
private  Font font
           
private  Color foreground
           
protected  Vector getterMethods
           
protected  HelpContext helpContext
           
protected  HelpSystem helpSystem
           
private  String[] labels
           
private  String[] labelsProperty
           
protected  boolean listenForPropChange
           
private  String[] maxLen
           
private  String[] maxLenProperty
           
private  int maxTextFieldLength
           
private  int mode
           
private  Object object
           
private  Class objectClass
           
private  String objectClassName
           
private  String objectClassNameProperty
           
private  Class objectClassProperty
           
protected  Vector objectPropertyChangeListeners
           
protected  PropertyChangeSupport propertyChangeSupport
           
protected  PropertyDescriptor[] propertyDescriptors
           
protected  PropertyItem[] propertyItems
           
private  Schema schema
           
private  int[] separators
           
protected  Vector setterMethods
           
private  int[] spaces
           
static String TRUE
           
protected  Vector types
           
protected  Vector uiAttributes
           
protected  boolean uiCreationAllowed
           
protected  Vector uiLabels
           
static int UPDATE_MODE
           
protected static boolean VERBOSE
           
static int VIEW_MODE
           
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
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
AttributesForm()
          Construct an empty AttributesForm
 
Method Summary
protected  String[] _getEdits()
          Method for use internally by the bean itself.
protected  boolean _getEdits(int index)
          Method for use internally by the bean itself.
 String _getObjectClassName()
          Method for use internally by the bean itself.
protected  void _setAttributes(String[] attributes)
          Method for use internally by the bean itself.
 void _setEdits(int index, boolean editValue)
          Set the edits value for the specified index.
protected  void _setEdits(String[] editValues)
          Method for use internally by the bean itself.
protected  void _setLabels(String[] labels)
          Method for use internally by the bean itself.
protected  void _setMaxLen(String[] max_len)
          Method for use internally by the bean itself.
protected  void _setObjectClassName(String objectClassName)
          Method for use internally by the bean itself.
 void addHelpListener(PropertyChangeListener listener)
          Add a help listener for this component.
protected  void addHelpListenerToComponent(Component c, PropertyChangeListener l)
          Add a help listener for components which use their own HelpSystem.
 void addObjectPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener to be notified of changes to attributes in the contained business object.
 void addPropertyChangeListener(PropertyChangeListener listener)
          add a change listener for changes to bean properties.
protected  boolean compareArrays(Object[] array1, Object[] array2)
          Compare two arrays of objects.
protected  int createComponents(Component comp, int x, int y, int width)
          Add the specified component at the specified location
protected  Component createHorizontalLine()
          Create a horizontal line to separate groups of attributes.
protected  void createLabels(int x, int y, int i)
          Create a label component at the specified grid position.
protected  Object createNewObject()
          Internal method to create a new instance of the specified persistable business class if the setObjectAttributeValues method is invoked before setObject .
protected  void createUI()
          Create the user interface by creating the components for each attribute.
protected  void fireObjectPropertyChangeEvent(String propertyName, Object oldValue, Object newValue)
           
 String[] getAttributes()
          Return the array of attribute names
protected  Object getAttrValue(Object obj, Method getter)
          Internal method to invoke the specified getter method on the specified object.
 Color getBackground()
           
protected  Class getClassContained()
          Get a Class object for the contained object or classname
protected  ClassInfo getClassInfo()
          Get the ClassInfo for the current object class name.
protected  Component getComponent(String attributeName)
          Return the component currently used for the specified attribute
 boolean[] getEditable()
          Return the array of booleans specifying if an attribute is editable.
 String[] getEdits()
          Return the array of strings specifying if an attribute is editable.
 boolean getEdits(int index)
          Get the edits value for the specified index.
 String getFocusAttributeName()
          Set the attribute name of the component to have focus.
 Font getFont()
           
 Color getForeground()
           
protected  Method getGetterMethod(PropertyDescriptor attributeDescriptor)
          Get the getter method for the specified attribute.
 HelpContext getHelpContext()
          Return the help context.
 String[] getLabels()
          Return the labels used for the attributes.
 String[] getMaxLen()
          Return the maximum lengths for each attribute.
 int getMaxTextFieldLength()
          Get the maximum text field size in characters.
 int getMode()
          Return the current mode (CREATE_MODE, UPDATE_MODE, VIEW_MODE).
 Object getObject()
          Return the contained object.
protected  Class getObjectClass()
          Return the class of the contained object
 String getObjectClassName()
          Get the fully qualified class name of the contained object.
protected  PropertyDescriptor[] getPropertyDescriptors()
          Get the property descriptors for the current attribute list.
 Schema getSchema()
          Return the current Schema object specifying the object class name and a list of attributes.
 String[] getSeparators()
          Get the position values of any separators.
protected  Method getSetterMethod(PropertyDescriptor attributeDescriptor)
          Get the setter method for the specified attribute.
protected  String getSimpleName(String fullClassName)
          Helper method to get the name of the class without the package qualification.
 String[] getSpaces()
          Get the array of spacer locations.
 void initializeHelp()
          Initialize the help system for this component.
protected  boolean isReadyForUI()
          Check if enough information is known to construct the user interface.
 boolean isUICreationAllowed()
           
static void main(String[] args)
          A main method that demonstrates how to use this class and allows testing
protected  boolean needSeparatorNow(int i)
          Determine if a separator should placed at the specified position.
protected  boolean needSpaceNow(int i)
          Determine if a spacer should placed at the specified position.
protected static ClassInfo obtainClassInfo(String className)
          Obtain a ClassInfo object for the specified class name
protected  Method obtainComponentHelpMethod(Component c)
          Return the method "addHelpListener" for the component if it exists.
protected static PropertyDescriptor obtainPropertyDescriptor(ClassInfo a_class_info, String attribute_constant)
          Obtain a property descriptor for the specified attribute using the specified ClassInfo
 void propertyChange(PropertyChangeEvent event)
           
 void readExternal(ObjectInput stream)
          Externalization routine used for serialization.
private static void recursiveRemoveAll(Container con)
          Added 10/02/99 tcd Use this as a workaround to a problem where the AttributesForm bean would lock up during the createUI() method during the call to this.removeAll().
 void removeObjectPropertyChangeListener(PropertyChangeListener listener)
          Remove a property change listener to be notified of changes to attributes in the contained business object.
 void removePropertyChangeListener(PropertyChangeListener listener)
          remove a change listener for changes to bean properties.
 void setAttributes(String[] attributes)
          Set the attributes to be displayed for the contained object.
protected  void setAttrValue(Object obj, Method setter, Object value)
          Internal method to invoke the specified setter method on the object.
 void setBackground(Color color)
           
protected  void setClassInfo(ClassInfo classInfo)
          Set the ClassInfo for the current object class.
 void setEditable(boolean[] editValues)
          Set the editable values for each attribute.
 void setEdits(int index, boolean editValue)
          Set the edits value for the specified index.
 void setEdits(String[] editValues)
          Set the edits values for each attribute.
 void setFocus(String attributeName)
          Set focus to the component associated with the specified attribute name.
 void setFocusAttributeName(String attributeName)
          Set the attribute name of the component to have focus.
 void setFont(Font font)
           
 void setForeground(Color color)
           
 void setHelpContext(HelpContext helpContext)
          Set the help context.
 void setLabels(String[] labels)
          Set the labels for the attributes.
 void setMaxLen(String[] max_len)
          Deprecated. The values specified in the String array for this method are ignored by the bean. The bean will use the maximum values specified in the Rose models and returned via Windchill Introspection mechanisms.
 void setMaxTextFieldLength(int size)
          Set the maximum text field size in characters.
 void setMode(int mode)
          Set the current mode (CREATE_MODE, UPDATE_MODE, VIEW_MODE).
 void setObject(Object object)
          Set the contained object.
 Object setObjectAttributeValues()
          Transfers any user-modified values to the contained object.
 void setObjectClassName(String objectClassName)
          Set the fully qualified class name of the contained object.
protected  void setPropertyDescriptors(PropertyDescriptor[] descriptors)
          Set the property descriptors for the current attributes
protected  void setPropertyDescriptors(String[] attributes)
          Set the property descriptors for the specified attribute names
 void setSchema(Schema schema)
          Set the current Schema.
 void setSeparators(int[] separators)
          Specify where any separators should be placed.
 void setSeparators(String[] separatorStrings)
          Specify where any separators should be placed.
 void setSpaces(int[] spaces)
          Set the location for any spacer elements The spacer elements are simply blank spaces.
 void setSpaces(String[] spacerStrings)
          Set the location for any spacer elements.
 void setUICreationAllowed(boolean value)
          This method can be used to control the creation of User Interface elements by the bean.
protected  void TRACE(String message)
           
 void writeExternal(ObjectOutput stream)
          Externalization routine used for serialization.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MAX_TEXT_FIELD_LENGTH

protected final int DEFAULT_MAX_TEXT_FIELD_LENGTH
See Also:
Constant Field Values

attributes

private String[] attributes

labels

private String[] labels

maxLen

private String[] maxLen

edits

private boolean[] edits

objectClassName

private String objectClassName

objectClass

private Class objectClass

attributesProperty

private String[] attributesProperty

labelsProperty

private String[] labelsProperty

maxLenProperty

private String[] maxLenProperty

editsProperty

private boolean[] editsProperty

objectClassNameProperty

private String objectClassNameProperty

objectClassProperty

private Class objectClassProperty

editValuesProperty

private String[] editValuesProperty

editValues

private String[] editValues

separators

private int[] separators

spaces

private int[] spaces

focusAttributeName

private String focusAttributeName

colorUtility

private ContainerColorUtility colorUtility

background

private Color background

foreground

private Color foreground

font

private Font font

maxTextFieldLength

private int maxTextFieldLength

object

private Object object

mode

private int mode

schema

private Schema schema

getterMethods

protected Vector getterMethods

setterMethods

protected Vector setterMethods

types

protected Vector types

uiLabels

protected Vector uiLabels

uiAttributes

protected Vector uiAttributes

propertyDescriptors

protected PropertyDescriptor[] propertyDescriptors

propertyItems

protected PropertyItem[] propertyItems

classInfo

protected ClassInfo classInfo

componentSelectors

protected ComponentDelegate[] componentSelectors

helpSystem

protected HelpSystem helpSystem

helpContext

protected HelpContext helpContext

VERBOSE

protected static boolean VERBOSE

uiCreationAllowed

protected boolean uiCreationAllowed

listenForPropChange

protected boolean listenForPropChange

TRUE

public static final String TRUE
See Also:
Constant Field Values

FALSE

public static final String FALSE
See Also:
Constant Field Values

propertyChangeSupport

protected PropertyChangeSupport propertyChangeSupport

objectPropertyChangeListeners

protected transient Vector objectPropertyChangeListeners

VIEW_MODE

public static int VIEW_MODE

CREATE_MODE

public static int CREATE_MODE

UPDATE_MODE

public static int UPDATE_MODE
Constructor Detail

AttributesForm

public AttributesForm()
Construct an empty AttributesForm

Method Detail

writeExternal

public void writeExternal(ObjectOutput stream)
                   throws IOException
Externalization routine used for serialization.

Specified by:
writeExternal in interface Externalizable
Parameters:
stream - the object output stream
Throws:
IOException

readExternal

public void readExternal(ObjectInput stream)
                  throws IOException,
                         ClassNotFoundException
Externalization routine used for serialization.

Specified by:
readExternal in interface Externalizable
Parameters:
stream - the input object stream
Throws:
IOException
ClassNotFoundException

addObjectPropertyChangeListener

public void addObjectPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to be notified of changes to attributes in the contained business object. Note that this for changes to the attributes in the object specified in the setObject method, not for changes in the properties to the bean itself.

Parameters:
listener - the listener to add

removeObjectPropertyChangeListener

public void removeObjectPropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener to be notified of changes to attributes in the contained business object.

Parameters:
listener -

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
add a change listener for changes to bean properties.

Parameters:
listener -

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
remove a change listener for changes to bean properties.

Parameters:
listener -

getMode

public int getMode()
Return the current mode (CREATE_MODE, UPDATE_MODE, VIEW_MODE).

Returns:
the current mode (CREATE_MODE, UPDATE_MODE, or VIEW_MODE)

setMode

public void setMode(int mode)
             throws WTPropertyVetoException
Set the current mode (CREATE_MODE, UPDATE_MODE, VIEW_MODE). If the mode is set to CREATE_MODE, the bean will display editable components for all attributes which have a valid public setter. If the mode is set to UPDATE_MODE, the bean will display editable components for all attributes which have a valid public setter and for which the attribute is updateable (the attribute can be modified after the object is persisted). If the attribute has a public setter but is modeled to be not updateable, a non-editable component is displayed for the attribute. To model an attribute as non-updateable, the attribute should have its Windchill "Changeable" property set to "ViaOtherMeans". If the mode is set to VIEW_MODE, the bean will display non-editable components for the all attributes. This method is intended for use as an alternative to invoking the setEdits() method to individually specify if each attribute is editable or not.

Parameters:
mode - the new mode (CREATE_MODE, UPDATE_MODE, VIEW_MODE)
Throws:
WTPropertyVetoException

getObject

public Object getObject()
Return the contained object.

Returns:
the contained object

setObject

public void setObject(Object object)
               throws WTException
Set the contained object. This is the Persistable business object displayed in the form. The AttributesForm will extract the relevant data out of the object and display the information in the components for each attribute.

Parameters:
object - the object to refresh and display in the form
Throws:
WTException

setObjectAttributeValues

public Object setObjectAttributeValues()
                                throws WTPropertyVetoException,
                                       WTException
Transfers any user-modified values to the contained object.

Returns:
the object with the modified values
Throws:
WTPropertyVetoException - if an exception was thrown when invoking the setter on the object.
WTException

getObjectClass

protected Class getObjectClass()
                        throws ClassNotFoundException
Return the class of the contained object

Returns:
the class of the contained objec
Throws:
ClassNotFoundException

createNewObject

protected Object createNewObject()
                          throws WTException
Internal method to create a new instance of the specified persistable business class if the setObjectAttributeValues method is invoked before setObject . The method will attempt to instantiate an object using a Windchill style factory method ( ClassName.newClassName() ). If no factory method is available, a default Java constructor will be used ( new ClassName() ).

Returns:
newly created object
Throws:
WTException

getSimpleName

protected String getSimpleName(String fullClassName)
Helper method to get the name of the class without the package qualification.


getAttrValue

protected Object getAttrValue(Object obj,
                              Method getter)
Internal method to invoke the specified getter method on the specified object.

Parameters:
obj - the object to invoke the method on
getter - the getter method to invoke
Returns:
the value returned by the getter method

setAttrValue

protected void setAttrValue(Object obj,
                            Method setter,
                            Object value)
                     throws WTPropertyVetoException
Internal method to invoke the specified setter method on the object.

Parameters:
obj - the object to invoke the setter method on
setter - the method to invoke
value - the value to use in the setter method
Throws:
WTPropertyVetoException - if invoking the setter threw an exception
WTPropertyVetoException

getObjectClassName

public String getObjectClassName()
Get the fully qualified class name of the contained object.

Returns:
the fully qualified class name of the contained object

_getObjectClassName

public String _getObjectClassName()
Method for use internally by the bean itself. Other callers should use the getObjectClassName() method.


setObjectClassName

public void setObjectClassName(String objectClassName)
                        throws WTPropertyVetoException
Set the fully qualified class name of the contained object.

Parameters:
objectClassName - the fully qualified class name of the contained object
Throws:
WTPropertyVetoException - if the class name is not valid.

_setObjectClassName

protected void _setObjectClassName(String objectClassName)
                            throws WTPropertyVetoException
Method for use internally by the bean itself. Other callers should use the setObjectClassName() method.

Parameters:
objectClassName -
Throws:
WTPropertyVetoException

_setAttributes

protected void _setAttributes(String[] attributes)
                       throws WTPropertyVetoException
Method for use internally by the bean itself. Other callers should use the setAttributes() method.

Parameters:
attributes -
Throws:
WTPropertyVetoException

setAttributes

public void setAttributes(String[] attributes)
                   throws WTPropertyVetoException
Set the attributes to be displayed for the contained object.

Parameters:
attributes - an array of attribute names
Throws:
WTPropertyVetoException - if any of the attributes are not valid for the contained class.

setMaxTextFieldLength

public void setMaxTextFieldLength(int size)
                           throws WTPropertyVetoException
Set the maximum text field size in characters. Strings longer than this value will displayed in multi-line TextArea components.

Parameters:
size - the maximum text field size
Throws:
WTPropertyVetoException - if the size is not valid.

getMaxTextFieldLength

public int getMaxTextFieldLength()
Get the maximum text field size in characters. Strings longer than this value will displayed in multi-line TextArea components.

Returns:
the maximum text field size

setFocusAttributeName

public void setFocusAttributeName(String attributeName)
                           throws WTPropertyVetoException
Set the attribute name of the component to have focus.

Parameters:
attributeName - the attribute name of the component with focus
Throws:
WTPropertyVetoException - if the attribute name is not valid.

getFocusAttributeName

public String getFocusAttributeName()
Set the attribute name of the component to have focus.

Throws:
WTPropertyVetoException - if the attribute name is not valid.

getComponent

protected Component getComponent(String attributeName)
Return the component currently used for the specified attribute

Parameters:
attributeName - the name of the attribute
Returns:
the component used in the AttributesForm for the specified attribute

setFocus

public void setFocus(String attributeName)
              throws WTPropertyVetoException
Set focus to the component associated with the specified attribute name. Note that this method should be called after the AttributesForm has been constructed and displayed, otherwise the component peer may not be ready to accept focus.

Parameters:
attributeName - the name of attribute
Throws:
WTPropertyVetoException

getClassInfo

protected ClassInfo getClassInfo()
Get the ClassInfo for the current object class name.

Returns:
the ClassInfo for the current object class name.

setClassInfo

protected void setClassInfo(ClassInfo classInfo)
Set the ClassInfo for the current object class.

Parameters:
classInfo - the ClassInfo for the current object class

getPropertyDescriptors

protected PropertyDescriptor[] getPropertyDescriptors()
Get the property descriptors for the current attribute list.

Returns:
the current property descriptors

setPropertyDescriptors

protected void setPropertyDescriptors(PropertyDescriptor[] descriptors)
                               throws WTPropertyVetoException
Set the property descriptors for the current attributes

Parameters:
descriptors - the property descriptors for the current attributes
Throws:
WTPropertyVetoException

setPropertyDescriptors

protected void setPropertyDescriptors(String[] attributes)
                               throws WTPropertyVetoException
Set the property descriptors for the specified attribute names

Parameters:
attributes - the names of each attribute
Throws:
WTPropertyVetoException

obtainPropertyDescriptor

protected static PropertyDescriptor obtainPropertyDescriptor(ClassInfo a_class_info,
                                                             String attribute_constant)
                                                      throws WTIntrospectionException
Obtain a property descriptor for the specified attribute using the specified ClassInfo

Parameters:
a_class_info -
attribute_constant -
Returns:
the property descriptor for the named attribute
Throws:
WTIntrospectionException

obtainClassInfo

protected static ClassInfo obtainClassInfo(String className)
                                    throws WTIntrospectionException,
                                           ClassNotFoundException
Obtain a ClassInfo object for the specified class name

Parameters:
className - the fully qualified class name
Returns:
the ClassInfo for the specified class name
Throws:
WTIntrospectionException
ClassNotFoundException

createLabels

protected void createLabels(int x,
                            int y,
                            int i)
Create a label component at the specified grid position.

Parameters:
x - the x position
y - the y position
i - the index in the labels array

createComponents

protected int createComponents(Component comp,
                               int x,
                               int y,
                               int width)
Add the specified component at the specified location

Parameters:
comp -
x -
y -
width -

createHorizontalLine

protected Component createHorizontalLine()
Create a horizontal line to separate groups of attributes.

Returns:
the created horizontal line component

needSpaceNow

protected boolean needSpaceNow(int i)
Determine if a spacer should placed at the specified position.

Parameters:
i - the index of the attribute
Returns:
true if a spacer is needed

needSeparatorNow

protected boolean needSeparatorNow(int i)
Determine if a separator should placed at the specified position.

Parameters:
i - the index of the attribute
Returns:
true if a separator is needed

recursiveRemoveAll

private static void recursiveRemoveAll(Container con)
Added 10/02/99 tcd Use this as a workaround to a problem where the AttributesForm bean would lock up during the createUI() method during the call to this.removeAll(). See SPR 774506 for details.


createUI

protected void createUI()
Create the user interface by creating the components for each attribute.


getAttributes

public String[] getAttributes()
Return the array of attribute names

Returns:
an array of attribute names

getEditable

public boolean[] getEditable()
Return the array of booleans specifying if an attribute is editable.

Returns:
the array of booleans specifying if an attribute is editable

setEditable

public void setEditable(boolean[] editValues)
                 throws WTPropertyVetoException
Set the editable values for each attribute.

Parameters:
editValues - array of booleans indicating if the corresponding attribute is editable.
Throws:
WTPropertyVetoException

getEdits

public boolean getEdits(int index)
Get the edits value for the specified index.

Parameters:
index - the index for the attribute
Returns:
true if the attribute is editable

_getEdits

protected boolean _getEdits(int index)
Method for use internally by the bean itself. Other callers should use the getEdits() method.

Parameters:
index -

setEdits

public void setEdits(int index,
                     boolean editValue)
              throws WTPropertyVetoException
Set the edits value for the specified index.

Parameters:
index - the index for the attribute
editValue - true if the attribute should be editable
Throws:
WTPropertyVetoException

_setEdits

public void _setEdits(int index,
                      boolean editValue)
               throws WTPropertyVetoException
Set the edits value for the specified index.

Parameters:
index - the index for the attribute
editValue - true if the attribute should be editable
Throws:
WTPropertyVetoException

setEdits

public void setEdits(String[] editValues)
              throws WTPropertyVetoException
Set the edits values for each attribute.

Parameters:
editValues - array of strings indicating if the corresponding attribute is editable.
Throws:
WTPropertyVetoException

_setEdits

protected void _setEdits(String[] editValues)
                  throws WTPropertyVetoException
Method for use internally by the bean itself. Other callers should use the setEdits() method.

Parameters:
editValues -
Throws:
WTPropertyVetoException

getEdits

public String[] getEdits()
Return the array of strings specifying if an attribute is editable.

Returns:
the array of strings specifying if an attribute is editable

_getEdits

protected String[] _getEdits()
Method for use internally by the bean itself. Other callers should use the getEdits() method.


_setLabels

protected void _setLabels(String[] labels)
                   throws WTPropertyVetoException
Method for use internally by the bean itself. Other callers should use the setLabels() method.

Parameters:
labels -
Throws:
WTPropertyVetoException

setLabels

public void setLabels(String[] labels)
               throws WTPropertyVetoException
Set the labels for the attributes. If this method is called to initialize the labels, the bean will use Windchill Introspection mechanisms to find display names for the attributes.

Parameters:
labels - an array of strings, each string is the label for the corresponding attribute.
Throws:
WTPropertyVetoException
WTPropertyVetoException

isReadyForUI

protected boolean isReadyForUI()
Check if enough information is known to construct the user interface.

Returns:
true if the ui can be safely constructed

getLabels

public String[] getLabels()
Return the labels used for the attributes.

Returns:
an array of strings used for the attribute labels

_setMaxLen

protected void _setMaxLen(String[] max_len)
                   throws WTPropertyVetoException
Method for use internally by the bean itself. Other callers should use the setMaxLen() method.

Parameters:
max_len -
Throws:
WTPropertyVetoException

setMaxLen

public void setMaxLen(String[] max_len)
               throws WTPropertyVetoException
Deprecated. The values specified in the String array for this method are ignored by the bean. The bean will use the maximum values specified in the Rose models and returned via Windchill Introspection mechanisms.

Set the maximum length for each attribute. Note: this is only currently used to determine if a string value should be displayed in a text field or a text area. In the future it will be used to prevent user input of values greater than the maximum length specified. To leave the maximum length unspecified, use the empty string "".

Parameters:
max_len - an array of strings, each string representing the maximum length or value for the corresponding attribute.
Throws:
WTPropertyVetoException - if value is not numeric and not empty
WTPropertyVetoException

getMaxLen

public String[] getMaxLen()
Return the maximum lengths for each attribute.

Returns:
an array of the maximum lengths for each attribute.

setSeparators

public void setSeparators(String[] separatorStrings)
                   throws WTPropertyVetoException
Specify where any separators should be placed. The AttributesForm will display a symantec.itools.awt.shape.HorizontalLine at each specified separator location. This horizontal line can be used to separate attributes into different logical groups within the form.

Parameters:
separatorStrings - the list of separator positions
Throws:
WTPropertyVetoException - if the value is not numeric
WTPropertyVetoException

setSeparators

public void setSeparators(int[] separators)
                   throws WTPropertyVetoException
Specify where any separators should be placed. The AttributesForm will display a symantec.itools.awt.shape.HorizontalLine at each specified separator location. This horizontal line can be used to separate attributes into different logical groups within the form.

Parameters:
separators - the list of separator positions
Throws:
WTPropertyVetoException - if the value is not numeric
WTPropertyVetoException

getSeparators

public String[] getSeparators()
Get the position values of any separators.

Returns:
an array of separator location values

setSpaces

public void setSpaces(String[] spacerStrings)
               throws WTPropertyVetoException
Set the location for any spacer elements. The spacer elements are simply blank spaces. This property can be used to help control the layout of components with the form by inserting blank spaces at the specified locations.

Parameters:
spacerStrings - array of spacer locations
Throws:
WTPropertyVetoException - is a location is not numeric
WTPropertyVetoException

setSpaces

public void setSpaces(int[] spaces)
               throws WTPropertyVetoException
Set the location for any spacer elements The spacer elements are simply blank spaces. This property can be used to help control the layout of components with the form by inserting blank spaces at the specified locations.

Parameters:
spaces - the list of spacer positions
Throws:
WTPropertyVetoException - is a location is not numeric
WTPropertyVetoException

getSpaces

public String[] getSpaces()
Get the array of spacer locations.

Returns:
array of spacer locations

setSchema

public void setSchema(Schema schema)
               throws PropertyVetoException
Set the current Schema. The Schema object contains the object class name and an array of attribute names. This method is an alternative to using the separate setObjectClassName() and setAttributes() methods. It is used by the SchemaEditor to allow the class name and attributes to be selected graphically at dev time in an IDE such as Visual Cafe.

Parameters:
schema - the schema specifing the object class name and a list of attribute names
Throws:
PropertyVetoException
See Also:
Schema

getSchema

public Schema getSchema()
Return the current Schema object specifying the object class name and a list of attributes.


setForeground

public void setForeground(Color color)

getForeground

public Color getForeground()

setBackground

public void setBackground(Color color)

getBackground

public Color getBackground()

setFont

public void setFont(Font font)

getFont

public Font getFont()
Specified by:
getFont in interface MenuContainer

getClassContained

protected Class getClassContained()
Get a Class object for the contained object or classname

Returns:
the class for the ontained object or classname

getGetterMethod

protected Method getGetterMethod(PropertyDescriptor attributeDescriptor)
Get the getter method for the specified attribute.

Returns:
the getter method

getSetterMethod

protected Method getSetterMethod(PropertyDescriptor attributeDescriptor)
Get the setter method for the specified attribute.

Returns:
the setter method

setHelpContext

public void setHelpContext(HelpContext helpContext)
                    throws WTPropertyVetoException
Set the help context.

Parameters:
helpContext - the HelpContext to use
Throws:
WTPropertyVetoException - if the helpContext is invalid

getHelpContext

public HelpContext getHelpContext()
Return the help context.

Returns:
the current HelpContext

initializeHelp

public void initializeHelp()
Initialize the help system for this component.


addHelpListener

public void addHelpListener(PropertyChangeListener listener)
Add a help listener for this component.

Parameters:
listener - a new help listener

obtainComponentHelpMethod

protected Method obtainComponentHelpMethod(Component c)
Return the method "addHelpListener" for the component if it exists.

Parameters:
c - potential component with addHelpListener method
Returns:
the addHelpListener method if exits, else return null

addHelpListenerToComponent

protected void addHelpListenerToComponent(Component c,
                                          PropertyChangeListener l)
Add a help listener for components which use their own HelpSystem.

Parameters:
c - the component
l - a new help listener

setUICreationAllowed

public void setUICreationAllowed(boolean value)
This method can be used to control the creation of User Interface elements by the bean. By default, the bean will rebuild the user interface whenevener a relvant property is changed. Sometimes it can be useful to stop this process to avoid unneed flashing of the display when many properties are changed.

Parameters:
value - if true, the AttributesForm will construct a user interface if relavent properties have been changed. if false, the AttributesForm will not allow the user interface to be constructed even if relevant properties have changed.

isUICreationAllowed

public boolean isUICreationAllowed()

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface PropertyChangeListener

fireObjectPropertyChangeEvent

protected void fireObjectPropertyChangeEvent(String propertyName,
                                             Object oldValue,
                                             Object newValue)

compareArrays

protected boolean compareArrays(Object[] array1,
                                Object[] array2)
Compare two arrays of objects.

Returns:
true if arrays have identical values

main

public static void main(String[] args)
A main method that demonstrates how to use this class and allows testing


TRACE

protected void TRACE(String message)