com.objectwave.tools.uiWidget
Class PropertyWizard

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.objectwave.tools.uiWidget.PropertyWizard
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class PropertyWizard
extends javax.swing.JPanel
implements java.beans.PropertyChangeListener

Useful for creating a wizard to set property values.

Version:
1.0
Author:
Dave Hoag
See Also:
Serialized Form

Field Summary
protected  java.util.Stack back
           
protected  java.lang.String currentPage
           
protected  javax.swing.JPanel deck
           
protected  java.util.Hashtable deckRequired
           
protected  java.util.Hashtable decks
           
protected  DeckLayout layout
           
protected  java.util.Properties resultProperties
           
protected  java.util.Properties sourceProperties
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
PropertyWizard()
          The PropertyWizard will consist of a center panel that contains the data for each page and a button bar along the button that allows the navigation of the wizard.
 
Method Summary
 void addField(java.lang.String path, java.lang.String name, java.lang.String value)
          Create ui widgets to represent the fields and add them the 'card' that represents the path.
protected  void addFields(java.lang.String page, java.lang.String[] properties)
           
 FieldPanel addPath(java.lang.String path)
          This will add the path to the hash of FieldPanels if it is not already there.
 void backClicked()
          Go back to the previous page.
 void cancelClicked()
          Clear the result properties and attempt to close the Window.
 boolean checkFinished(java.lang.String propertyKey)
          Has the side effect of changing the state of the FINISHED button.
 java.lang.String checkNext(java.lang.String propertyKey)
          Has the side effect of changing the state of the NEXT button.
protected  java.lang.String checkRequired(java.lang.String next)
          Check to see that all required fields have values.
 void finishedClicked()
          Attempt to close the Window.
 javax.swing.AbstractAction[] getActions()
          These are the actions of the PropertyWizard.
 java.lang.String getData(java.lang.String path, java.lang.String propertyName)
          Get data from the result properties.
 javax.swing.JDialog getDialog(java.util.Properties props)
          Convenience method for getting the property wizard as a dialog.
protected  javax.swing.AbstractAction[] getNewActions()
          These are the actions of the PropertyWizard.
 PropertyField getNewPropertyField(java.lang.String path, java.lang.String name)
          Get the PropertyField defined for this property.
 java.util.Properties getResultProperties()
           
 java.util.Properties getSourceProperties()
           
 void helpClicked()
           
protected  void initDefaults()
          Some of the PropertyFields may have default values.
protected  boolean isSpecialProperty(java.lang.String str)
           
static void main(java.lang.String[] args)
           
 void nextClicked()
          Advance to the next page.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          A change was made to a PropetyValue.
 void resetWizard()
           
 void setData(java.lang.String path, java.lang.String propertyName, java.lang.String propertyValue)
          Set one of the result values being defined by this wizard.
 void setPage(java.lang.String page)
           
protected  void setPanelProps(PropertyField field, java.lang.String path, java.lang.String name)
          Add various listeners, and panel properties.
 void setResultProperties(java.util.Properties propValue)
           
 void setSourceProperties(java.util.Properties propValue)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

currentPage

protected java.lang.String currentPage

back

protected java.util.Stack back

layout

protected DeckLayout layout

decks

protected java.util.Hashtable decks

deckRequired

protected java.util.Hashtable deckRequired

deck

protected javax.swing.JPanel deck

sourceProperties

protected java.util.Properties sourceProperties

resultProperties

protected java.util.Properties resultProperties
Constructor Detail

PropertyWizard

public PropertyWizard()
The PropertyWizard will consist of a center panel that contains the data for each page and a button bar along the button that allows the navigation of the wizard.

Method Detail

getActions

public javax.swing.AbstractAction[] getActions()
These are the actions of the PropertyWizard. They are used to create the buttons.


getNewActions

protected javax.swing.AbstractAction[] getNewActions()
These are the actions of the PropertyWizard. They are used to create the buttons. A new set of AbstractAction objects are created.


backClicked

public void backClicked()
Go back to the previous page.


nextClicked

public void nextClicked()
Advance to the next page.


finishedClicked

public void finishedClicked()
Attempt to close the Window.


cancelClicked

public void cancelClicked()
Clear the result properties and attempt to close the Window.


helpClicked

public void helpClicked()

getResultProperties

public java.util.Properties getResultProperties()

setResultProperties

public void setResultProperties(java.util.Properties propValue)

resetWizard

public void resetWizard()

addFields

protected void addFields(java.lang.String page,
                         java.lang.String[] properties)

isSpecialProperty

protected boolean isSpecialProperty(java.lang.String str)

setPage

public void setPage(java.lang.String page)

checkNext

public java.lang.String checkNext(java.lang.String propertyKey)
Has the side effect of changing the state of the NEXT button.


checkRequired

protected java.lang.String checkRequired(java.lang.String next)
Check to see that all required fields have values.


checkFinished

public boolean checkFinished(java.lang.String propertyKey)
Has the side effect of changing the state of the FINISHED button.


getSourceProperties

public java.util.Properties getSourceProperties()

setSourceProperties

public void setSourceProperties(java.util.Properties propValue)

addField

public void addField(java.lang.String path,
                     java.lang.String name,
                     java.lang.String value)
Create ui widgets to represent the fields and add them the 'card' that represents the path. The order that the fields are added will be the same order as the UIWidgets appear on the card. It is wise to sort the values before calling addField.

Parameters:
path - Path leading to the property.
name - String property name.
value - String Value of property

addPath

public FieldPanel addPath(java.lang.String path)
This will add the path to the hash of FieldPanels if it is not already there.


getNewPropertyField

public PropertyField getNewPropertyField(java.lang.String path,
                                         java.lang.String name)
                                  throws java.lang.ClassNotFoundException,
                                         java.lang.InstantiationException,
                                         java.lang.IllegalAccessException
Get the PropertyField defined for this property. This can be specified as a fully qualifed path to the property or using whild cards. ex. The following two would be equal in the template file. aValue.anotherElement.propertyName= *.propertyName= *.anotherPropertyName=:

Parameters:
path - The path portion of the Label specification.
name - Fully qualified class name of a class that implements the PropertyField interface.
Returns:
An instance of a PropertyField created via the public default constructor.
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

setPanelProps

protected void setPanelProps(PropertyField field,
                             java.lang.String path,
                             java.lang.String name)
Add various listeners, and panel properties.


initDefaults

protected void initDefaults()
Some of the PropertyFields may have default values. This will go through all of the defined property fields and set the default values on the result set.


getDialog

public javax.swing.JDialog getDialog(java.util.Properties props)
Convenience method for getting the property wizard as a dialog.

Parameters:
props - The properties used to define the wizard functionallity.
Returns:
A JDialog that is ready to be shown.

main

public static void main(java.lang.String[] args)

getData

public java.lang.String getData(java.lang.String path,
                                java.lang.String propertyName)
Get data from the result properties.


setData

public void setData(java.lang.String path,
                    java.lang.String propertyName,
                    java.lang.String propertyValue)
Set one of the result values being defined by this wizard. When data changes, it may change the conditions of the checkNext. In addition to setting the data, we 'recheck' the validity of the next panel.


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
A change was made to a PropetyValue. This will set that value immediately.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener