当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
StoreGroup (Ant-Based Project Support) - NetBeans API Javadoc (Current Development Version)
org.netbeans.spi.project.support.ant.ui
Class StoreGroup
java.lang.Object
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.
- 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.
- 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.
- Use the models in your Swing controls by calling
setModel()
or setDocument()
For storing the models back to the proprties of project.
- Get the EditableProperties you want to store the model in e.g. private or project
properties
- Call the store method on given
SourceGroup with the EditableProperties
as parameter
- Manually store models which need some special handling.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StoreGroup
public StoreGroup()
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 toggle button model representing a boolean in the StoreGroup.
In case the value is one of "true", "yes" "on" the button model
will be "selected". 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
propertypropertyName
- 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
propertypropertyName
- 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
propertypropertyName
- Name of the ANT property
- Returns:
- ButtonModel representing the value