jaxx.runtime.swing.editor.config.model
Class ConfigUIModelBuilder

java.lang.Object
  extended by jaxx.runtime.swing.editor.config.model.ConfigUIModelBuilder

public class ConfigUIModelBuilder
extends Object

A builder of ConfigUIModel Created: 22 déc. 2009

Since:
2.0.0
Author:
tchemit

Constructor Summary
ConfigUIModelBuilder()
           
 
Method Summary
 void addCategory(String categoryName, String categoryLabel)
          Add a new category, and set it as current.
 void addOption(org.nuiton.util.ApplicationConfig.OptionDef def)
          Add a new option, and set it as current.
 void addOption(org.nuiton.util.ApplicationConfig.OptionDef def, String propertyName)
          Add a new option with a propertyName, and set it as current.
protected  void checkCurrent(Object o, String type)
           
protected  void checkNoCurrent(Object o, String type)
           
protected  void checkNotNull(Object o, String method, String parameter)
           
 void createModel(org.nuiton.util.ApplicationConfig config)
          Create a new model and set it as current model.
protected  CategoryModel flushCategory()
           
 ConfigUIModel flushModel()
          Flush the model and return it.
protected  OptionModel flushOption()
           
 void registerCallBack(String name, String description, Icon icon, Runnable action)
          Registers a new callback.
 void setCategory(CategoryModel categoryModel)
          Set the given category as current category.
 void setFinalizer(CallBackFinalizer finalizer)
           
 void setModel(ConfigUIModel model)
          Set the given model as current model.
 void setOption(OptionModel optionModel)
          Sets the given option as current option.
 void setOptionCallBack(String name)
          Registers the current option into a known callback.
 void setOptionEditor(TableCellEditor editor)
          Set the editor on the current option.
 void setOptionPropertyName(String propertyName)
          Set the propertyName on the current option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigUIModelBuilder

public ConfigUIModelBuilder()
Method Detail

createModel

public void createModel(org.nuiton.util.ApplicationConfig config)
                 throws IllegalStateException,
                        NullPointerException
Create a new model and set it as current model.

Parameters:
config - the configuration used in model
Throws:
IllegalStateException - if there is already a current model
NullPointerException - if config is null

addCategory

public void addCategory(String categoryName,
                        String categoryLabel)
                 throws IllegalStateException,
                        NullPointerException
Add a new category, and set it as current.

Note: As side effets, if a previous category, then store it to the model.

Parameters:
categoryName - the name of the new category (can not to be null)
categoryLabel - the label of the new category (can not to be null)
Throws:
IllegalStateException - if there is not a current model, nor category
NullPointerException - if any of parameter is null

addOption

public void addOption(org.nuiton.util.ApplicationConfig.OptionDef def)
               throws IllegalStateException,
                      NullPointerException
Add a new option, and set it as current.

Note: As side effets, if a previous option, then store it to the model.

Parameters:
def - the def ot the new option
Throws:
IllegalStateException - if there is not a current model, nor category
NullPointerException - if any of parameter is null

addOption

public void addOption(org.nuiton.util.ApplicationConfig.OptionDef def,
                      String propertyName)
               throws IllegalStateException,
                      NullPointerException
Add a new option with a propertyName, and set it as current.

Note: As side effets, if a previous option, then store it to the model.

Note: This method is a short-cut for addOption(org.nuiton.util.ApplicationConfig.OptionDef) then setOptionPropertyName(String).

Parameters:
def - the def ot the new option
propertyName - the propertyName to set on the option
Throws:
IllegalStateException - if there is not a current model, nor category
NullPointerException - if any of parameter is null

setOptionPropertyName

public void setOptionPropertyName(String propertyName)
                           throws IllegalStateException,
                                  NullPointerException
Set the propertyName on the current option.

Parameters:
propertyName - the propertyName to set in the current option.
Throws:
IllegalStateException - if there is not a current option set.
NullPointerException - if any of parameter is null
See Also:
OptionModel.setPropertyName(String)

setOptionEditor

public void setOptionEditor(TableCellEditor editor)
                     throws IllegalStateException,
                            NullPointerException
Set the editor on the current option.

Parameters:
editor - the editor to set in the current option.
Throws:
IllegalStateException - if there is not a current option set.
NullPointerException - if any of parameter is null
See Also:
OptionModel.setEditor(TableCellEditor)

registerCallBack

public void registerCallBack(String name,
                             String description,
                             Icon icon,
                             Runnable action)
Registers a new callback.

Note: the order of registred callback is used to determine the higher priority of callback to launch if required.

Parameters:
name - the unique name of a callback
description - the i18n key to describe the action
icon - the icon of the callBack (used in ui)
action - the action of the callback

setOptionCallBack

public void setOptionCallBack(String name)
Registers the current option into a known callback.

Parameters:
name - the name of the callback

setFinalizer

public void setFinalizer(CallBackFinalizer finalizer)

flushModel

public ConfigUIModel flushModel()
                         throws IllegalStateException
Flush the model and return it.

Note: As a side effect, nothing is available in the builder after this operation. To reuse the builder on a model, use the dedicated setter.

Returns:
the final model
Throws:
IllegalStateException - if there is not a current model set.

setModel

public void setModel(ConfigUIModel model)
              throws IllegalStateException
Set the given model as current model.

Note: As side effets, il will clean current category and option.

Parameters:
model - the model to use
Throws:
IllegalStateException - if there is already a current model

setCategory

public void setCategory(CategoryModel categoryModel)
                 throws IllegalStateException
Set the given category as current category.

Note: As side effets, il will clean current option.

Parameters:
categoryModel - the category to use
Throws:
IllegalStateException - if there is not a current model or a current category

setOption

public void setOption(OptionModel optionModel)
               throws IllegalStateException
Sets the given option as current option.

Parameters:
optionModel - the option to use
Throws:
IllegalStateException - if there is not a current model, nor category, or a current option

flushCategory

protected CategoryModel flushCategory()

flushOption

protected OptionModel flushOption()

checkCurrent

protected void checkCurrent(Object o,
                            String type)

checkNoCurrent

protected void checkNoCurrent(Object o,
                              String type)

checkNotNull

protected void checkNotNull(Object o,
                            String method,
                            String parameter)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.