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

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

public class ConfigUIModelBuilder
extends java.lang.Object

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

Since:
2.0.0
Version:
$Revision: 1694 $

Mise a jour: $Date: 2009-12-22 18:34:34 +0100 (mar., 22 déc. 2009) $ par : $Author: tchemit $

Author:
Tony Chemit Copyright Code Lutin

Constructor Summary
ConfigUIModelBuilder()
           
 
Method Summary
 void addCategory(java.lang.String categoryName, java.lang.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, java.lang.String propertyName)
          Add a new option with a propertyName, and set it as current.
protected  void checkCurrent(java.lang.Object o, java.lang.String type)
           
protected  void checkNoCurrent(java.lang.Object o, java.lang.String type)
           
protected  void checkNotNull(java.lang.Object o, java.lang.String method, java.lang.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 setCategory(CategoryModel categoryModel)
          Set the given category as current category.
 void setModel(ConfigUIModel model)
          Set the given model as current model.
 void setOption(OptionModel optionModel)
          Sets the given option as current option.
 void setOptionEditor(javax.swing.table.TableCellEditor editor)
          Set the editor on the current option.
 void setOptionNeedReloadApplication(boolean needReload)
          Set the needReloadApplication flag on the current option.
 void setOptionNeedReloadUI(boolean needReload)
          Set the needReloadUI flag on the current option.
 void setOptionPropertyName(java.lang.String propertyName)
          Set the propertyName on the current option.
 void setReloadApplicationCallback(java.lang.Runnable callback)
          Set the reloadApplicationCallback of the current model.
 void setReloadUICallback(java.lang.Runnable callback)
          Set the reloadUICallback of the current model.
 
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 java.lang.IllegalStateException,
                        java.lang.NullPointerException
Create a new model and set it as current model.

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

setReloadApplicationCallback

public void setReloadApplicationCallback(java.lang.Runnable callback)
                                  throws java.lang.IllegalStateException,
                                         java.lang.NullPointerException
Set the reloadApplicationCallback of the current model.

Parameters:
callback - the call back to set
Throws:
java.lang.IllegalStateException - if there is not a current model
java.lang.NullPointerException - if any of parameter is null
See Also:
ConfigUIModel.setReloadApplicationCallback(Runnable)

setReloadUICallback

public void setReloadUICallback(java.lang.Runnable callback)
Set the reloadUICallback of the current model.

Parameters:
callback - the call back to set
Throws:
java.lang.IllegalStateException - if there is not a current model
java.lang.NullPointerException - if any of parameter is null
See Also:
ConfigUIModel.setReloadUICallback(Runnable)

addCategory

public void addCategory(java.lang.String categoryName,
                        java.lang.String categoryLabel)
                 throws java.lang.IllegalStateException,
                        java.lang.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:
java.lang.IllegalStateException - if there is not a current model, nor category
java.lang.NullPointerException - if any of parameter is null

addOption

public void addOption(org.nuiton.util.ApplicationConfig.OptionDef def)
               throws java.lang.IllegalStateException,
                      java.lang.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:
java.lang.IllegalStateException - if there is not a current model, nor category
java.lang.NullPointerException - if any of parameter is null

addOption

public void addOption(org.nuiton.util.ApplicationConfig.OptionDef def,
                      java.lang.String propertyName)
               throws java.lang.IllegalStateException,
                      java.lang.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:
java.lang.IllegalStateException - if there is not a current model, nor category
java.lang.NullPointerException - if any of parameter is null

setOptionPropertyName

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

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

setOptionEditor

public void setOptionEditor(javax.swing.table.TableCellEditor editor)
                     throws java.lang.IllegalStateException,
                            java.lang.NullPointerException
Set the editor on the current option.

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

setOptionNeedReloadUI

public void setOptionNeedReloadUI(boolean needReload)
                           throws java.lang.IllegalStateException
Set the needReloadUI flag on the current option.

Parameters:
needReload - new value to set
Throws:
java.lang.IllegalStateException - if there is not a current option set.
See Also:
OptionModel.setNeedReloadUI(boolean)

setOptionNeedReloadApplication

public void setOptionNeedReloadApplication(boolean needReload)
                                    throws java.lang.IllegalStateException
Set the needReloadApplication flag on the current option.

Parameters:
needReload - new value to set
Throws:
java.lang.IllegalStateException - if there is not a current option set.
See Also:
OptionModel.setNeedReloadUI(boolean)

flushModel

public ConfigUIModel flushModel()
                         throws java.lang.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:
java.lang.IllegalStateException - if there is not a current model set.

setModel

public void setModel(ConfigUIModel model)
              throws java.lang.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:
java.lang.IllegalStateException - if there is already a current model

setCategory

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

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

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

setOption

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

Parameters:
optionModel - the option to use
Throws:
java.lang.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(java.lang.Object o,
                            java.lang.String type)

checkNoCurrent

protected void checkNoCurrent(java.lang.Object o,
                              java.lang.String type)

checkNotNull

protected void checkNotNull(java.lang.Object o,
                            java.lang.String method,
                            java.lang.String parameter)


Copyright © 2008-2010 CodeLutin. All Rights Reserved.