summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build_infos.txt3
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java50
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/GroupDefinition.java34
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/ModifyableGuiBuilderConfiguration.java4
4 files changed, 71 insertions, 20 deletions
diff --git a/build_infos.txt b/build_infos.txt
new file mode 100644
index 00000000..584f3250
--- /dev/null
+++ b/build_infos.txt
@@ -0,0 +1,3 @@
+Infos for version update
+ mvn versions:set -DnewVersion=4.0.2-snapshot ... update parent project version by using
+ mvn versions:commit ... delete backups of parent pom \ No newline at end of file
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
index c9c2ec0b..706c163d 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
@@ -26,13 +26,17 @@
*******************************************************************************/
package at.gv.egiz.eaaf.core.impl.gui;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.eaaf.core.api.gui.GroupDefinition;
+import at.gv.egiz.eaaf.core.api.gui.GroupDefinition.TYPE;
import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration;
/**
@@ -42,11 +46,11 @@ import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration;
public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilderConfiguration {
private static final Logger log = LoggerFactory.getLogger(AbstractGUIFormBuilderConfiguration.class);
- public static final String PARAM_GROUP_FORM = "form";
- public static final String PARAM_GROUP_ACTIONS = "actions";
- public static final String PARAM_GROUP_PARAMS = "params";
- public static final String PARAM_GROUP_UIOPTIONS = "uiOptions";
- public static final String PARAM_GROUP_MSG = "msg";
+ public static final GroupDefinition PARAM_GROUP_FORM = GroupDefinition.getInstance("form", TYPE.MAP);
+ public static final GroupDefinition PARAM_GROUP_ACTIONS = GroupDefinition.getInstance("actions", TYPE.LIST);
+ public static final GroupDefinition PARAM_GROUP_PARAMS = GroupDefinition.getInstance("params", TYPE.MAP);
+ public static final GroupDefinition PARAM_GROUP_UIOPTIONS = GroupDefinition.getInstance("uiOptions", TYPE.MAP);
+ public static final GroupDefinition PARAM_GROUP_MSG = GroupDefinition.getInstance("msg", TYPE.MAP);
public static final String PARAM_VIEWNAME = "viewName";
@@ -130,29 +134,40 @@ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilder
/**
* Get the Group for generic form elements
*
- * @return groupName or <code>null</code> if no groups are used
+ * @return {@link GroupDefinition} or <code>null</code> if no groups are used
*/
- abstract protected String getFromGroup();
+ abstract protected GroupDefinition getFromGroup();
@SuppressWarnings("unchecked")
- protected void setViewParameter(String group, String key, Object value) {
+ protected void setViewParameter(GroupDefinition groupDefinition, String key, Object value) {
- if (StringUtils.isNotEmpty(group)) {
+ if (groupDefinition != null) {
log.trace("Adding group object ... ");
- Object groupMap = params.get(group);
+ Object groupMap = params.get(groupDefinition.getName());
if (groupMap == null) {
- groupMap = new HashMap<String, Object>();;
- log.trace("Build new group element");
+ if (groupDefinition.getType().equals(TYPE.MAP)) {
+ groupMap = new HashMap<String, Object>();;
+ log.trace("Build new MAP based group element");
+
+ } else if (groupDefinition.getType().equals(TYPE.LIST)) {
+ groupMap = new ArrayList<String>();
+ log.trace("Build new List based group element");
+
+ } else
+ log.warn("GroupDefinition contains an unknown type: {}", groupDefinition.getType().name());
}
-
- if (groupMap instanceof Map<?,?>) {
+
+ params.put(groupDefinition.getName(), groupMap);
+ if (groupMap instanceof Map<?,?>)
((Map<String, Object>) groupMap).put(key, value);
- params.put(group, groupMap);
- } else
+ else if (groupMap instanceof List<?>)
+ ((List<String>)groupMap).add(value.toString());
+
+ else
log.warn("Can NOT add element: {} to group: {}, because group is of type: {}",
- key, group, groupMap.getClass().getName());
+ key, groupDefinition.getName(), groupMap.getClass().getName());
} else {
log.trace("Add root object ... ");
@@ -161,5 +176,4 @@ public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilder
}
}
-
}
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/GroupDefinition.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/GroupDefinition.java
new file mode 100644
index 00000000..441f1917
--- /dev/null
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/GroupDefinition.java
@@ -0,0 +1,34 @@
+package at.gv.egiz.eaaf.core.api.gui;
+
+public class GroupDefinition {
+
+ private final String name;
+ private final TYPE type;
+
+ private GroupDefinition(String name, TYPE type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public static GroupDefinition getInstance(String name, TYPE type) {
+ return new GroupDefinition(name, type);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public TYPE getType() {
+ return type;
+ }
+
+ public enum TYPE {
+ LIST("list"),
+ MAP("map");
+
+ private TYPE(String type) {
+ }
+ }
+
+}
+
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/ModifyableGuiBuilderConfiguration.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/ModifyableGuiBuilderConfiguration.java
index 19fe9a12..6df6a78f 100644
--- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/ModifyableGuiBuilderConfiguration.java
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/ModifyableGuiBuilderConfiguration.java
@@ -39,7 +39,7 @@ public interface ModifyableGuiBuilderConfiguration {
* @param key velocity context key
* @param value of this key
*/
- void putCustomParameterWithOutEscaption(@Nullable String group, @Nonnull String key, @Nonnull Object value);
+ void putCustomParameterWithOutEscaption(@Nullable GroupDefinition group, @Nonnull String key, @Nonnull Object value);
/**
* Add a key/value pair into Velocity context.<br>
@@ -49,6 +49,6 @@ public interface ModifyableGuiBuilderConfiguration {
* @param key velocity context key
* @param value of this key
*/
- void putCustomParameter(@Nullable String group, @Nonnull String key, @Nonnull String value);
+ void putCustomParameter(@Nullable GroupDefinition group, @Nonnull String key, @Nonnull String value);
} \ No newline at end of file