com.objectwave.tools.propertyEditor
Class JConfigure

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.objectwave.tools.propertyEditor.JConfigure
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.event.TreeSelectionListener

public class JConfigure
extends javax.swing.JPanel
implements javax.swing.event.TreeSelectionListener

A JPanel that provides support for editing a property file.

Version:
2.1
See Also:
Serialized Form

Field Summary
protected  javax.swing.JPanel deck
           
protected  java.util.Hashtable decks
           
protected static java.util.Properties defaultTemplate
           
protected  java.lang.String filename
           
protected  DeckLayout layout
           
protected  java.util.Vector listOfValues
           
protected  ConfigureTreeModel model
           
protected  java.util.Properties originalProperties
           
protected  boolean showTree
           
protected  java.util.Properties sourceProperties
           
protected  javax.swing.JSplitPane splitPane
           
protected  java.util.Properties template
           
protected  javax.swing.JLabel title
           
protected  javax.swing.JTree tree
           
 
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
JConfigure()
           
JConfigure(boolean showTree)
           
 
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.
 void addPath()
          Let the user add a path to the list of paths.
 FieldPanel addPath(java.lang.String path)
          This will add the path to the hash of FieldPanels if it is not already there.
 void addProperty()
          Let the user add properties.
 void defineFieldsFor(java.lang.String path)
           
 void definePath()
           
 void deletePath()
          Let the user delete the selected path;
 void deleteProperty()
           
protected  void fillProperties(java.util.Properties props)
          Copy the values out of our model into the parameter.
 javax.swing.Action[] getActions()
          By using actions to describe the input points, this will facilitate the creation of buttons or menu items.
 java.lang.String[] getAllProperties()
           
 PropertyField getNewPropertyField(java.lang.String path, java.lang.String name)
          Get the PropertyField defined for this property.
 java.util.Properties getProperties()
          The source properties that are updated as changes occur in the JConfigure panel.
 boolean getShowTree()
          This method was created in VisualAge.
 java.util.Properties getTemplate()
           
 void importPropertyFile()
           
 void initDefaultTemplates()
           
 void initialize()
          This method was created in VisualAge.
protected  void loadProperties(ConfigureTreeModel tree, java.util.Properties source)
           
 void readFile(java.lang.String fileName)
          This will read the file in and look for a templates file of a similar name.
 void readProperties(java.util.Properties p)
          Read the properties from the parameter and add them to the model.
protected  void readPropertiesFromFile(ConfigureTreeModel tree, java.lang.String filename)
           
 void readTemplate(java.util.Properties source)
          Read templates from the property object.
 void readTemplateFile(java.lang.String filename)
          Read templates from the file.
 void renamePath()
           
 void renameProperty()
           
 void save()
          Save the file.
 void saveAs()
           
 void setProperties(java.util.Properties p)
          Change the source properties to be that of the argument.
 void setShowTree(boolean newValue)
          This method was created in VisualAge.
 void setTemplate(java.util.Properties p)
           
 void setTreeTitle(java.lang.String title)
           
 java.lang.String treePath(javax.swing.tree.TreePath treePath)
          Convert the parameter into a string.
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
          When the selected path changes, change the display of the properties.
protected  void writeProperties(ConfigureTreeModel tree, java.lang.String filename)
           
 
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

tree

protected javax.swing.JTree tree

title

protected javax.swing.JLabel title

deck

protected javax.swing.JPanel deck

filename

protected java.lang.String filename

layout

protected DeckLayout layout

decks

protected java.util.Hashtable decks

model

protected ConfigureTreeModel model

template

protected java.util.Properties template

defaultTemplate

protected static java.util.Properties defaultTemplate

originalProperties

protected java.util.Properties originalProperties

listOfValues

protected java.util.Vector listOfValues

splitPane

protected javax.swing.JSplitPane splitPane

sourceProperties

protected java.util.Properties sourceProperties

showTree

protected boolean showTree
Constructor Detail

JConfigure

public JConfigure()

JConfigure

public JConfigure(boolean showTree)
Method Detail

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 void addPath()
Let the user add a path to the list of paths.


addPath

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


addProperty

public void addProperty()
Let the user add properties.


defineFieldsFor

public void defineFieldsFor(java.lang.String path)
Parameters:
path - The full path of the property line.

definePath

public void definePath()

deletePath

public void deletePath()
Let the user delete the selected path;


deleteProperty

public void deleteProperty()

fillProperties

protected void fillProperties(java.util.Properties props)
Copy the values out of our model into the parameter.

Parameters:
props - Object being populated.

getActions

public javax.swing.Action[] getActions()
By using actions to describe the input points, this will facilitate the creation of buttons or menu items.


getAllProperties

public java.lang.String[] getAllProperties()

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

getProperties

public java.util.Properties getProperties()
The source properties that are updated as changes occur in the JConfigure panel.

Returns:
Source properties.

getShowTree

public boolean getShowTree()
This method was created in VisualAge.

Returns:
boolean

getTemplate

public java.util.Properties getTemplate()

importPropertyFile

public void importPropertyFile()
                        throws java.io.IOException
java.io.IOException

initDefaultTemplates

public void initDefaultTemplates()

initialize

public void initialize()
This method was created in VisualAge.


loadProperties

protected void loadProperties(ConfigureTreeModel tree,
                              java.util.Properties source)
Parameters:
tree - The tree model that is being built.
source - The properties from which the tree model is being built.

readFile

public void readFile(java.lang.String fileName)
              throws java.io.IOException
This will read the file in and look for a templates file of a similar name.

java.io.IOException

readProperties

public void readProperties(java.util.Properties p)
Read the properties from the parameter and add them to the model. If there are no properties not currently loaded into JConfigure, the parameter becomes the sourceProperties for this model.

Parameters:
p - The source of new property values.

readPropertiesFromFile

protected void readPropertiesFromFile(ConfigureTreeModel tree,
                                      java.lang.String filename)
                               throws java.io.IOException
Parameters:
tree - The tree model that is being built.
filename - Source property file from which values are loaded.
Throws:
java.io.IOException
See Also:
loadProperties(com.objectwave.tools.propertyEditor.ConfigureTreeModel, java.util.Properties)

readTemplate

public void readTemplate(java.util.Properties source)
Read templates from the property object. Templates define what type of PropertyField object to use and any parameters that may be associated with the PropertyField.

Parameters:
source - Template properties.

readTemplateFile

public void readTemplateFile(java.lang.String filename)
                      throws java.io.IOException
Read templates from the file.

Parameters:
filename - Source file.
Throws:
java.io.IOException

renamePath

public void renamePath()

renameProperty

public void renameProperty()

save

public void save()
          throws java.io.IOException
Save the file.

Throws:
java.io.IOException

saveAs

public void saveAs()
            throws java.io.IOException
java.io.IOException

setProperties

public void setProperties(java.util.Properties p)
Change the source properties to be that of the argument. All old values in the model are discarded.

Parameters:
p - The new source.

setShowTree

public void setShowTree(boolean newValue)
This method was created in VisualAge.

Parameters:
newValue - boolean

setTemplate

public void setTemplate(java.util.Properties p)

setTreeTitle

public void setTreeTitle(java.lang.String title)
Parameters:
title - The "Root" node of the tree.

treePath

public java.lang.String treePath(javax.swing.tree.TreePath treePath)
Convert the parameter into a string.

Parameters:
treePath - The JTree tree elements.
Returns:
A stringified version of the JTree.treePath object.

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent event)
When the selected path changes, change the display of the properties.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
event -

writeProperties

protected void writeProperties(ConfigureTreeModel tree,
                               java.lang.String filename)
                        throws java.io.IOException
Parameters:
tree - The source of the property values.
filename - Write the properties found in the TreeModel to this file.
Throws:
java.io.IOException