Permalink
Browse files

Fix Components#getParams() to take into account converter of ParamHolder

  • Loading branch information...
1 parent ff948cb commit f914b835e197ad50fbeeec94e0f182642b6ffc1d @BalusC BalusC committed Jul 2, 2015
@@ -63,6 +63,27 @@ public SimpleParam(String name, Object value, Converter converter) {
this.converter = converter;
}
+ /**
+ * Construct a simple param with name and value of given {@link UIParameter} component.
+ * @param param The {@link UIParameter} to copy.
+ * @since 2.2
+ */
+ public SimpleParam(UIParameter param) {
+ name = param.getName();
+ value = param.getValue();
+ }
+
+ /**
+ * Construct a simple param with name, value and converter of given {@link ParamHolder} instance.
+ * @param param The {@link ParamHolder} to copy.
+ * @since 2.2
+ */
+ public SimpleParam(ParamHolder param) {
+ name = param.getName();
+ value = param.getLocalValue();
+ converter = param.getConverter();
+ }
+
// Getters/setters ------------------------------------------------------------------------------------------------
@Override
@@ -64,7 +64,6 @@
import org.omnifaces.component.ParamHolder;
import org.omnifaces.component.SimpleParam;
-import org.omnifaces.component.output.Param;
/**
* <p>
@@ -857,16 +856,9 @@ public static boolean hasInvokedSubmit(UIComponent component) {
for (UIComponent child : component.getChildren()) {
if (child instanceof UIParameter) {
UIParameter param = (UIParameter) child;
- String name = param.getName();
- if (!isEmpty(name) && !param.isDisable()) {
- ParamHolder paramHolder = new SimpleParam(name, param.getValue());
-
- if (param instanceof Param) {
- paramHolder.setConverter(((Param) param).getConverter());
- }
-
- params.add(paramHolder);
+ if (!isEmpty(param.getName()) && !param.isDisable()) {
+ params.add(new SimpleParam(param));
}
}
}

0 comments on commit f914b83

Please sign in to comment.