org.netbeans.modules.project.ant/1 1.12.22

org.netbeans.spi.project.support.ant.ui
Class StoreGroup

java.lang.Object
  extended by org.netbeans.spi.project.support.ant.ui.StoreGroup

public class StoreGroup
extends Object

Serves as utility class for storing Swing models into project properties. Usefull for creating project customizers. StoreGroup is capable of doing two things: First create the representation of the project properties which can be used in the GUI. Second at some time convert the objects back to the ANT properties form and store them into the project properties.
For creating the object representation.

  1. Create new instance of StoreGroup for each group of properties you want to store later e.g. project and private. Sometimes it might be useful to create temporary source group which will only be used for creating the models without being used for storing. E.g. for properties which need special handling.
  2. Call the factory methods e.g. createToggleButtonModel(org.netbeans.spi.project.support.ant.PropertyEvaluator, java.lang.String), createStringDocument(org.netbeans.spi.project.support.ant.PropertyEvaluator, java.lang.String), etc. which will create the swing models for you.
  3. Use the models in your Swing controls by calling setModel() or setDocument()
For storing the models back to the proprties of project.
  1. Get the EditableProperties you want to store the model in e.g. private or project properties
  2. Call the store method on given SourceGroup with the EditableProperties as parameter
  3. Manually store models which need some special handling.


Constructor Summary
StoreGroup()
           
 
Method Summary
 JToggleButton.ToggleButtonModel createInverseToggleButtonModel(PropertyEvaluator evaluator, String propertyName)
          Creates toggle button model representing a boolean in the StoreGroup.
 Document createStringDocument(PropertyEvaluator evaluator, String propertyName)
          Creates Document containing the string value of given property.
 JToggleButton.ToggleButtonModel createToggleButtonModel(PropertyEvaluator evaluator, String propertyName)
          Creates toogle button model representing a boolean in the StoreGroup.
 void store(EditableProperties editableProperties)
          Stores all models created in the StoreGroup into given EditableProperties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreGroup

public StoreGroup()
Method Detail

store

public void store(EditableProperties editableProperties)
Stores all models created in the StoreGroup into given EditableProperties.

Parameters:
editableProperties - The properties where to store the values.

createToggleButtonModel

public final JToggleButton.ToggleButtonModel createToggleButtonModel(PropertyEvaluator evaluator,
                                                                     String propertyName)
Creates toogle button model representing a boolean in the StoreGroup.
In case the value is one of "true", "yes" "on" the button model will be "selcted". If the property does not exist or is set to some other value the result of isPressed will be false.
Call to the store() method stores the model in appropriate form e.g "true/false", "yes/no", "on/off".
Method will throw IllegalArgumentException if you try to get more than one model for one property.

Parameters:
evaluator - The PropertyEvaluator to be used to evaluate given property
propertyName - Name of the ANT property
Returns:
ButtonModel representing the value

createInverseToggleButtonModel

public final JToggleButton.ToggleButtonModel createInverseToggleButtonModel(PropertyEvaluator evaluator,
                                                                            String propertyName)
Creates toggle button model representing a boolean in the StoreGroup.
In case the value is one of "true", "yes" "on" the button model will NOT be "selcted". If the property does not exist or is set to some other value the result of isPressed will be true.
Call to the store() method stores the model in appropriate form e.g "true/false", "yes/no", "on/off".
Method will throw IllegalArgumentException if you try to get more than one model for one property.

Parameters:
evaluator - The PropertyEvaluator to be used to evaluate given property
propertyName - Name of the ANT property
Returns:
ButtonModel representing the value

createStringDocument

public final Document createStringDocument(PropertyEvaluator evaluator,
                                           String propertyName)
Creates Document containing the string value of given property. If the property does not extsts or the value of it is null the resulting document will be empty.
Method will throw IllegalArgumentException if you try to get more than one model for one property.

Parameters:
evaluator - The PropertyEvaluator to be used to evaluate given property
propertyName - Name of the ANT property
Returns:
ButtonModel representing the value

org.netbeans.modules.project.ant/1 1.12.22

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.