This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ade1433e18b1d3f8b2df25fb07a88d5c881cf886 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Sep 15 14:47:53 2016 +0200 Add more config ui model constructors (Fixes #4034) --- .../jaxx/runtime/swing/config/ConfigUIHelper.java | 7 +++++- .../swing/config/model/ConfigUIModelBuilder.java | 26 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/jaxx-config/src/main/java/jaxx/runtime/swing/config/ConfigUIHelper.java b/jaxx-config/src/main/java/jaxx/runtime/swing/config/ConfigUIHelper.java index 3f20149..e82f129 100644 --- a/jaxx-config/src/main/java/jaxx/runtime/swing/config/ConfigUIHelper.java +++ b/jaxx-config/src/main/java/jaxx/runtime/swing/config/ConfigUIHelper.java @@ -38,9 +38,9 @@ import org.nuiton.config.ConfigOptionDef; import javax.swing.Icon; import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; import java.awt.Frame; import java.io.File; -import javax.swing.table.TableCellRenderer; /** * A helper to build a config ui. @@ -72,6 +72,11 @@ public class ConfigUIHelper { modelBuilder.createModel(config, configFile); } + public ConfigUIHelper(Object configurationBean, ApplicationConfig config) { + modelBuilder = new ConfigUIModelBuilder(); + modelBuilder.createModel(configurationBean, config); + } + public ConfigUIHelper(ApplicationConfig config, File configFile) { modelBuilder = new ConfigUIModelBuilder(); modelBuilder.createModel(config, configFile); diff --git a/jaxx-config/src/main/java/jaxx/runtime/swing/config/model/ConfigUIModelBuilder.java b/jaxx-config/src/main/java/jaxx/runtime/swing/config/model/ConfigUIModelBuilder.java index 0232b79..1c021ee 100644 --- a/jaxx-config/src/main/java/jaxx/runtime/swing/config/model/ConfigUIModelBuilder.java +++ b/jaxx-config/src/main/java/jaxx/runtime/swing/config/model/ConfigUIModelBuilder.java @@ -104,6 +104,28 @@ public class ConfigUIModelBuilder { /** * Create a new model and set it as current model. * + * @param configurationBean configuration bean used in model + * @param config the configuration used in model + * @return the builder + * @throws IllegalStateException if there is already a current model + * @throws NullPointerException if there is some null parameters + */ + public ConfigUIModelBuilder createModel(Object configurationBean, ApplicationConfig config) + throws IllegalStateException, NullPointerException { + checkNoCurrent(model, "model"); + checkNotNull(config, "createModel", "config"); + checkNotNull(configurationBean, "createModel", "configurationBean"); + model = new ConfigUIModel(configurationBean, config); + + if (log.isDebugEnabled()) { + log.debug("model created : " + model); + } + return this; + } + + /** + * Create a new model and set it as current model. + * * @param config the configuration used in model * @return the builder * @throws IllegalStateException if there is already a current model @@ -366,7 +388,7 @@ public class ConfigUIModelBuilder { Preconditions.checkArgument( categoryDefaultCallBack == null, "You can not use the method *setOptionCallBack* when " + - "a default callback has been assigned to a category"); + "a default callback has been assigned to a category"); model.registerOptionCallBack(name, option); return this; @@ -528,7 +550,7 @@ public class ConfigUIModelBuilder { if (o == null) { throw new NullPointerException( "method " + method + " does not support null parameter " + - parameter + "!"); + parameter + "!"); } } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.