Package jaxx.runtime.swing.config.model
Class ConfigUIModelBuilder
java.lang.Object
jaxx.runtime.swing.config.model.ConfigUIModelBuilder
public class ConfigUIModelBuilder
extends java.lang.Object
A builder of
ConfigUIModel
Created: 22 déc. 2009- Since:
- 2.5.11
- Author:
- Tony Chemit - chemit@codelutin.com
-
Constructor Summary
Constructors Constructor Description ConfigUIModelBuilder() -
Method Summary
Modifier and Type Method Description ConfigUIModelBuilderaddCategory(java.lang.String categoryName, java.lang.String categoryLabel)Add a new category, and set it as current.ConfigUIModelBuilderaddCategory(java.lang.String categoryName, java.lang.String categoryLabel, java.lang.String defaultCallback)Add a new category, and set it as current.ConfigUIModelBuilderaddOption(org.nuiton.config.ConfigOptionDef def)Add a new option, and set it as current.ConfigUIModelBuilderaddOption(org.nuiton.config.ConfigOptionDef def, java.lang.String propertyName)Deprecated.protected voidcheckCurrent(java.lang.Object o, java.lang.String type)protected voidcheckNoCurrent(java.lang.Object o, java.lang.String type)protected voidcheckNotNull(java.lang.Object o, java.lang.String method, java.lang.String parameter)ConfigUIModelBuildercreateModel(com.google.common.base.Supplier<org.nuiton.config.ApplicationConfig> config)Deprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonConfigUIModelBuildercreateModel(com.google.common.base.Supplier<org.nuiton.config.ApplicationConfig> config, java.io.File configFile)Deprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonConfigUIModelBuildercreateModel(java.lang.Object configurationBean, org.nuiton.config.ApplicationConfig config)Deprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonConfigUIModelBuildercreateModel(java.lang.Object configurationBean, org.nuiton.config.ApplicationConfig config, java.io.File configFile)Create a new model and set it as current model.ConfigUIModelBuildercreateModel(org.nuiton.config.ApplicationConfig config)Deprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonConfigUIModelBuildercreateModel(org.nuiton.config.ApplicationConfig config, java.io.File configFile)Deprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonprotected CategoryModelflushCategory()ConfigUIModelflushModel()Flush the model and return it.protected OptionModelflushOption()ConfigUIModelBuilderregisterCallBack(java.lang.String name, java.lang.String description, javax.swing.Icon icon, java.lang.Runnable action)Registers a new callback.ConfigUIModelBuildersetCategory(CategoryModel categoryModel)Set the given category as current category.ConfigUIModelBuildersetCategoryDefaultCallBack(java.lang.String categoryDefaultCallBack)Sets the default callback to use for this category (the call back will be add to all options of this category until you set another one or nullify it).ConfigUIModelBuildersetCloseAction(java.lang.Runnable runnable)ConfigUIModelBuildersetFinalizer(CallBackFinalizer finalizer)Sets the callback finalizetConfigUIModelBuildersetModel(ConfigUIModel model)Set the given model as current model.ConfigUIModelBuildersetOption(OptionModel optionModel)Sets the given option as current option.ConfigUIModelBuildersetOptionCallBack(java.lang.String name)Registers the current option into a known callback.ConfigUIModelBuildersetOptionEditor(javax.swing.table.TableCellEditor editor)Set the editor on the current option.ConfigUIModelBuildersetOptionPropertyName(java.lang.String propertyName)Set the propertyName on the current option.ConfigUIModelBuildersetOptionRenderer(javax.swing.table.TableCellRenderer renderer)Set the renderer on the current option.ConfigUIModelBuildersetOptionShortLabel(java.lang.String shortLabel)Set the short label on the current option.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ConfigUIModelBuilder
public ConfigUIModelBuilder()
-
-
Method Details
-
createModel
public ConfigUIModelBuilder createModel(java.lang.Object configurationBean, org.nuiton.config.ApplicationConfig config, java.io.File configFile) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionCreate a new model and set it as current model.- Parameters:
configurationBean- configuration bean used in model (optional)config- the configuration used in model (can not be null)configFile- configuration file where to save (can not be null)- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if config or configFile isnull- Since:
- 2.33
-
createModel
@Deprecated public ConfigUIModelBuilder createModel(com.google.common.base.Supplier<org.nuiton.config.ApplicationConfig> config) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonCreate a new model and set it as current model.- Parameters:
config- the configuration used in model- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if config isnull
-
createModel
@Deprecated public ConfigUIModelBuilder createModel(com.google.common.base.Supplier<org.nuiton.config.ApplicationConfig> config, java.io.File configFile) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonCreate a new model and set it as current model.- Parameters:
config- the configuration used in modelconfigFile- configuration file where to save (can not be null)- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if config or configFile isnull- Since:
- 2.5.21
-
createModel
@Deprecated public ConfigUIModelBuilder createModel(java.lang.Object configurationBean, org.nuiton.config.ApplicationConfig config) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonCreate a new model and set it as current model.- Parameters:
configurationBean- configuration bean used in modelconfig- the configuration used in model- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if there is some null parameters
-
createModel
@Deprecated public ConfigUIModelBuilder createModel(org.nuiton.config.ApplicationConfig config) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonCreate a new model and set it as current model.- Parameters:
config- the configuration used in model- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if config isnull
-
createModel
@Deprecated public ConfigUIModelBuilder createModel(org.nuiton.config.ApplicationConfig config, java.io.File configFile) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.33, prefer use thecreateModel(Object, ApplicationConfig, File)method instead, will be removed soonCreate a new model and set it as current model.- Parameters:
config- the configuration used in modelconfigFile- configuration file where to save (can not be null)- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is already a current modeljava.lang.NullPointerException- if config or configFile isnull- Since:
- 2.5.21
-
addCategory
public ConfigUIModelBuilder addCategory(java.lang.String categoryName, java.lang.String categoryLabel) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionAdd 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 benull)categoryLabel- the label of the new category (can not to benull)- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current model, nor categoryjava.lang.NullPointerException- if any of parameter isnull
-
addCategory
public ConfigUIModelBuilder addCategory(java.lang.String categoryName, java.lang.String categoryLabel, java.lang.String defaultCallback) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionAdd 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 benull)categoryLabel- the label of the new category (can not to benull)- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current model, nor categoryjava.lang.NullPointerException- if any of parameter isnull
-
addOption
public ConfigUIModelBuilder addOption(org.nuiton.config.ConfigOptionDef def) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionAdd 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- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current model, nor categoryjava.lang.NullPointerException- if any of parameter isnull
-
addOption
@Deprecated public ConfigUIModelBuilder addOption(org.nuiton.config.ConfigOptionDef def, java.lang.String propertyName) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionDeprecated.since 2.5.29, prefer use thesetOptionPropertyName(String)method instead, will be removed soonAdd 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 foraddOption(ConfigOptionDef)thensetOptionPropertyName(String).- Parameters:
def- the def ot the new optionpropertyName- the propertyName to set on the option- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current model, nor categoryjava.lang.NullPointerException- if any of parameter isnull
-
setOptionPropertyName
public ConfigUIModelBuilder setOptionPropertyName(java.lang.String propertyName) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionSet the propertyName on the current option.- Parameters:
propertyName- the propertyName to set in the current option.- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current option set.java.lang.NullPointerException- if any of parameter isnull- See Also:
OptionModel.setPropertyName(String)
-
setOptionShortLabel
public ConfigUIModelBuilder setOptionShortLabel(java.lang.String shortLabel) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionSet the short label on the current option.- Parameters:
shortLabel- the propertyName to set in the current option.- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current option set.java.lang.NullPointerException- if any of parameter isnull- Since:
- 2.5.29
- See Also:
OptionModel.setShortLabel(String)
-
setOptionEditor
public ConfigUIModelBuilder setOptionEditor(javax.swing.table.TableCellEditor editor) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionSet the editor on the current option.- Parameters:
editor- the editor to set in the current option.- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current option set.java.lang.NullPointerException- if any of parameter isnull- See Also:
OptionModel.setEditor(TableCellEditor)
-
setOptionRenderer
public ConfigUIModelBuilder setOptionRenderer(javax.swing.table.TableCellRenderer renderer) throws java.lang.IllegalStateException, java.lang.NullPointerExceptionSet the renderer on the current option.- Parameters:
renderer- the renderer to set in the current option.- Returns:
- the builder
- Throws:
java.lang.IllegalStateException- if there is not a current option set.java.lang.NullPointerException- if any of parameter isnull- See Also:
OptionModel.setRenderer(TableCellRenderer)
-
registerCallBack
public ConfigUIModelBuilder registerCallBack(java.lang.String name, java.lang.String description, javax.swing.Icon icon, java.lang.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 callbackdescription- the i18n key to describe the actionicon- the icon of the callBack (used in ui)action- the action of the callback- Returns:
- the builder
-
setOptionCallBack
Registers the current option into a known callback.- Parameters:
name- the name of the callback- Returns:
- the builder
-
setFinalizer
Sets the callback finalizet- Parameters:
finalizer- callback finalize- Returns:
- the builder
- See Also:
CallBackFinalizer
-
setCategoryDefaultCallBack
Sets the default callback to use for this category (the call back will be add to all options of this category until you set another one or nullify it).- Parameters:
categoryDefaultCallBack- default callbakc name for the category- Returns:
- the buider
-
flushModel
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
Set the given model as current model. Note: As side effets, il will clean current category and option.- Parameters:
model- the model to use- Returns:
- the buider
- Throws:
java.lang.IllegalStateException- if there is already a current model
-
setCategory
public ConfigUIModelBuilder setCategory(CategoryModel categoryModel) throws java.lang.IllegalStateExceptionSet the given category as current category. Note: As side effets, il will clean current option.- Parameters:
categoryModel- the category to use- Returns:
- the buider
- Throws:
java.lang.IllegalStateException- if there is not a current model or a current category
-
setOption
public ConfigUIModelBuilder setOption(OptionModel optionModel) throws java.lang.IllegalStateExceptionSets the given option as current option.- Parameters:
optionModel- the option to use- Returns:
- the buider
- Throws:
java.lang.IllegalStateException- if there is not a current model, nor category, or a current option
-
setCloseAction
-
flushCategory
-
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)
-
setOptionPropertyName(String)method instead, will be removed soon