You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2017/03/07 11:16:02 UTC
[1/2] syncope git commit: [SYNCOPE-1039] provides on_change event
handling to be used to update the field model
Repository: syncope
Updated Branches:
refs/heads/2_0_X 72a1f085d -> 036243b46
refs/heads/master e38c042d8 -> bfcac4bbd
[SYNCOPE-1039] provides on_change event handling to be used to update the field model
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/036243b4
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/036243b4
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/036243b4
Branch: refs/heads/2_0_X
Commit: 036243b4637e9eca904446acdc669a96f9282723
Parents: 72a1f08
Author: fmartelli <fa...@gmail.com>
Authored: Tue Mar 7 12:15:20 2017 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Tue Mar 7 12:15:20 2017 +0100
----------------------------------------------------------------------
.../client/console/panels/ConnObjects.java | 2 +-
.../client/console/panels/VirSchemaDetails.java | 4 +--
.../console/status/ResourceStatusModal.java | 3 +-
.../html/form/AjaxDropDownChoicePanel.java | 8 +++++
.../markup/html/form/AjaxSpinnerFieldPanel.java | 31 ++++++++++++++++++--
.../markup/html/form/EncryptedFieldPanel.java | 25 ++++++++++++++++
.../client/console/wizards/any/PlainAttrs.java | 12 ++++----
7 files changed, 72 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
index af491e7..17d5036 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
@@ -60,7 +60,7 @@ public class ConnObjects extends Panel implements ModalPanel {
}
}, new ArrayList<String>());
- anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<String>(), true);
+ anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<String>());
anyTypes.setChoices(availableAnyTypes);
anyTypes.hideLabel();
anyTypes.setNullValid(false);
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index 5c712e2..34cc61c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -70,7 +70,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
schemaForm.add(readonly);
final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>(
- "resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource")).
+ "resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource"), false).
setNullValid(false);
resource.setChoices(CollectionUtils.collect(resourceRestClient.list(),
EntityTOUtils.<ResourceTO>keyTransformer(), new ArrayList<String>()));
@@ -82,7 +82,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
schemaForm.add(resource);
anyType = new AjaxDropDownChoicePanel<>(
- "anyType", getString("anyType"), new PropertyModel<String>(schemaTO, "anyType")).
+ "anyType", getString("anyType"), new PropertyModel<String>(schemaTO, "anyType"), false).
setNullValid(false);
anyType.setChoices(new ArrayList<>(anyTypes.keySet()));
anyType.setOutputMarkupId(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
index ea07105..d3a61d1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
@@ -62,7 +62,8 @@ public class ResourceStatusModal extends StatusModal<ResourceTO> {
}
};
- AjaxDropDownChoicePanel<String> anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel);
+ AjaxDropDownChoicePanel<String> anyTypes
+ = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel, false);
anyTypes.setChoices(types);
anyTypes.hideLabel();
add(anyTypes);
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
index 4fbc518..193c0ad 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
@@ -57,6 +57,14 @@ public class AjaxDropDownChoicePanel<T extends Serializable> extends FieldPanel<
protected void onUpdate(final AjaxRequestTarget target) {
// nothing to do
}
+ }).add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
});
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
index d697674..12d315f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
@@ -26,6 +26,9 @@ import com.googlecode.wicket.jquery.ui.form.spinner.SpinnerBehavior;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
@@ -47,7 +50,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
final String name,
final Class<T> reference,
final IModel<T> model,
- final Options options) {
+ final Options options,
+ final boolean enableOnChange) {
super(id, name, model);
@@ -62,6 +66,19 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
return behavior;
}
};
+
+ if (enableOnChange && !isReadOnly()) {
+ field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
+ });
+ }
+
add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true));
this.name = name;
@@ -156,7 +173,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
@Override
public AjaxSpinnerFieldPanel<T> clone() {
- final AjaxSpinnerFieldPanel<T> panel = new AjaxSpinnerFieldPanel<>(getId(), name, reference, model, options);
+ final AjaxSpinnerFieldPanel<T> panel
+ = new AjaxSpinnerFieldPanel<>(getId(), name, reference, model, options, false);
panel.setRequired(isRequired());
panel.setReadOnly(isReadOnly());
@@ -173,6 +191,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
private final Options options = new Options();
+ private boolean enableOnChange = false;
+
public Builder<T> min(final T min) {
options.set("min", min);
return this;
@@ -188,13 +208,18 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
return this;
}
+ public Builder<T> enableOnChange() {
+ enableOnChange = true;
+ return this;
+ }
+
public AjaxSpinnerFieldPanel<T> build(
final String id,
final String name,
final Class<T> reference,
final IModel<T> model) {
- return new AjaxSpinnerFieldPanel<>(id, name, reference, model, options);
+ return new AjaxSpinnerFieldPanel<>(id, name, reference, model, options, enableOnChange);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
index 10befa0..f3c7d01 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
@@ -18,22 +18,47 @@
*/
package org.apache.syncope.client.console.wicket.markup.html.form;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
public class EncryptedFieldPanel extends FieldPanel<String> implements Cloneable {
+ private static final long serialVersionUID = 1882871043451691005L;
+
public EncryptedFieldPanel(final String id, final String name, final IModel<String> model) {
+ this(id, name, model, false);
+ }
+
+ public EncryptedFieldPanel(
+ final String id, final String name, final IModel<String> model, final boolean enableOnChange) {
super(id, name, model);
field = new TextField<String>("encryptedField", model) {
+ private static final long serialVersionUID = 7545877620091912863L;
+
@Override
protected String[] getInputTypes() {
return new String[] { "password" };
}
};
+
+ if (enableOnChange && !isReadOnly()) {
+ field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
+ });
+ }
+
add(field.setLabel(new ResourceModel(name, name)).setRequired(false).setOutputMarkupId(true));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/036243b4/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
index 192654e..5c1291a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
@@ -211,7 +211,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
FieldPanel panel;
switch (type) {
case Boolean:
- panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<Boolean>(), false);
+ panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<Boolean>(), true);
panel.setRequired(required);
break;
@@ -233,7 +233,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Enum:
- panel = new AjaxDropDownChoicePanel<>("panel", schemaTO.getKey(), new Model<>(), false);
+ panel = new AjaxDropDownChoicePanel<>("panel", schemaTO.getKey(), new Model<>(), true);
((AjaxDropDownChoicePanel<String>) panel).setChoices(SchemaUtils.getEnumeratedValues(schemaTO));
if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
@@ -267,7 +267,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Long:
- panel = new AjaxSpinnerFieldPanel.Builder<Long>().
+ panel = new AjaxSpinnerFieldPanel.Builder<Long>().enableOnChange().
build("panel", schemaTO.getKey(), Long.class, new Model<Long>());
if (required) {
@@ -276,7 +276,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Double:
- panel = new AjaxSpinnerFieldPanel.Builder<Double>().step(0.1).
+ panel = new AjaxSpinnerFieldPanel.Builder<Double>().enableOnChange().step(0.1).
build("panel", schemaTO.getKey(), Double.class, new Model<Double>());
if (required) {
@@ -293,7 +293,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Encrypted:
- panel = new EncryptedFieldPanel("panel", schemaTO.getKey(), new Model<String>());
+ panel = new EncryptedFieldPanel("panel", schemaTO.getKey(), new Model<String>(), true);
if (required) {
panel.addRequiredLabel();
@@ -301,7 +301,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
default:
- panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<String>(), false);
+ panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<String>(), true);
if (jexlHelp) {
AjaxTextFieldPanel.class.cast(panel).enableJexlHelp();
[2/2] syncope git commit: [SYNCOPE-1039] provides on_change event
handling to be used to update the field model
Posted by fm...@apache.org.
[SYNCOPE-1039] provides on_change event handling to be used to update the field model
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/bfcac4bb
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/bfcac4bb
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/bfcac4bb
Branch: refs/heads/master
Commit: bfcac4bbd4a8007ee2df3bf4c61e667c2d1215b2
Parents: e38c042
Author: fmartelli <fa...@gmail.com>
Authored: Tue Mar 7 12:15:20 2017 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Tue Mar 7 12:15:39 2017 +0100
----------------------------------------------------------------------
.../client/console/panels/ConnObjects.java | 2 +-
.../client/console/panels/VirSchemaDetails.java | 4 +--
.../console/status/ResourceStatusModal.java | 3 +-
.../html/form/AjaxDropDownChoicePanel.java | 8 +++++
.../markup/html/form/AjaxSpinnerFieldPanel.java | 31 ++++++++++++++++++--
.../markup/html/form/EncryptedFieldPanel.java | 25 ++++++++++++++++
.../client/console/wizards/any/PlainAttrs.java | 12 ++++----
7 files changed, 72 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
index af491e7..17d5036 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
@@ -60,7 +60,7 @@ public class ConnObjects extends Panel implements ModalPanel {
}
}, new ArrayList<String>());
- anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<String>(), true);
+ anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<String>());
anyTypes.setChoices(availableAnyTypes);
anyTypes.hideLabel();
anyTypes.setNullValid(false);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index 5c712e2..34cc61c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -70,7 +70,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
schemaForm.add(readonly);
final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>(
- "resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource")).
+ "resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource"), false).
setNullValid(false);
resource.setChoices(CollectionUtils.collect(resourceRestClient.list(),
EntityTOUtils.<ResourceTO>keyTransformer(), new ArrayList<String>()));
@@ -82,7 +82,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
schemaForm.add(resource);
anyType = new AjaxDropDownChoicePanel<>(
- "anyType", getString("anyType"), new PropertyModel<String>(schemaTO, "anyType")).
+ "anyType", getString("anyType"), new PropertyModel<String>(schemaTO, "anyType"), false).
setNullValid(false);
anyType.setChoices(new ArrayList<>(anyTypes.keySet()));
anyType.setOutputMarkupId(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
index ea07105..d3a61d1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/status/ResourceStatusModal.java
@@ -62,7 +62,8 @@ public class ResourceStatusModal extends StatusModal<ResourceTO> {
}
};
- AjaxDropDownChoicePanel<String> anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel);
+ AjaxDropDownChoicePanel<String> anyTypes
+ = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", typeModel, false);
anyTypes.setChoices(types);
anyTypes.hideLabel();
add(anyTypes);
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
index 4fbc518..193c0ad 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
@@ -57,6 +57,14 @@ public class AjaxDropDownChoicePanel<T extends Serializable> extends FieldPanel<
protected void onUpdate(final AjaxRequestTarget target) {
// nothing to do
}
+ }).add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
});
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
index d697674..12d315f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxSpinnerFieldPanel.java
@@ -26,6 +26,9 @@ import com.googlecode.wicket.jquery.ui.form.spinner.SpinnerBehavior;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
@@ -47,7 +50,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
final String name,
final Class<T> reference,
final IModel<T> model,
- final Options options) {
+ final Options options,
+ final boolean enableOnChange) {
super(id, name, model);
@@ -62,6 +66,19 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
return behavior;
}
};
+
+ if (enableOnChange && !isReadOnly()) {
+ field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
+ });
+ }
+
add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true));
this.name = name;
@@ -156,7 +173,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
@Override
public AjaxSpinnerFieldPanel<T> clone() {
- final AjaxSpinnerFieldPanel<T> panel = new AjaxSpinnerFieldPanel<>(getId(), name, reference, model, options);
+ final AjaxSpinnerFieldPanel<T> panel
+ = new AjaxSpinnerFieldPanel<>(getId(), name, reference, model, options, false);
panel.setRequired(isRequired());
panel.setReadOnly(isReadOnly());
@@ -173,6 +191,8 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
private final Options options = new Options();
+ private boolean enableOnChange = false;
+
public Builder<T> min(final T min) {
options.set("min", min);
return this;
@@ -188,13 +208,18 @@ public final class AjaxSpinnerFieldPanel<T extends Number> extends FieldPanel<T>
return this;
}
+ public Builder<T> enableOnChange() {
+ enableOnChange = true;
+ return this;
+ }
+
public AjaxSpinnerFieldPanel<T> build(
final String id,
final String name,
final Class<T> reference,
final IModel<T> model) {
- return new AjaxSpinnerFieldPanel<>(id, name, reference, model, options);
+ return new AjaxSpinnerFieldPanel<>(id, name, reference, model, options, enableOnChange);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
index 10befa0..f3c7d01 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/EncryptedFieldPanel.java
@@ -18,22 +18,47 @@
*/
package org.apache.syncope.client.console.wicket.markup.html.form;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
public class EncryptedFieldPanel extends FieldPanel<String> implements Cloneable {
+ private static final long serialVersionUID = 1882871043451691005L;
+
public EncryptedFieldPanel(final String id, final String name, final IModel<String> model) {
+ this(id, name, model, false);
+ }
+
+ public EncryptedFieldPanel(
+ final String id, final String name, final IModel<String> model, final boolean enableOnChange) {
super(id, name, model);
field = new TextField<String>("encryptedField", model) {
+ private static final long serialVersionUID = 7545877620091912863L;
+
@Override
protected String[] getInputTypes() {
return new String[] { "password" };
}
};
+
+ if (enableOnChange && !isReadOnly()) {
+ field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // nothing to do
+ }
+ });
+ }
+
add(field.setLabel(new ResourceModel(name, name)).setRequired(false).setOutputMarkupId(true));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/bfcac4bb/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
index 192654e..5c1291a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
@@ -211,7 +211,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
FieldPanel panel;
switch (type) {
case Boolean:
- panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<Boolean>(), false);
+ panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<Boolean>(), true);
panel.setRequired(required);
break;
@@ -233,7 +233,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Enum:
- panel = new AjaxDropDownChoicePanel<>("panel", schemaTO.getKey(), new Model<>(), false);
+ panel = new AjaxDropDownChoicePanel<>("panel", schemaTO.getKey(), new Model<>(), true);
((AjaxDropDownChoicePanel<String>) panel).setChoices(SchemaUtils.getEnumeratedValues(schemaTO));
if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
@@ -267,7 +267,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Long:
- panel = new AjaxSpinnerFieldPanel.Builder<Long>().
+ panel = new AjaxSpinnerFieldPanel.Builder<Long>().enableOnChange().
build("panel", schemaTO.getKey(), Long.class, new Model<Long>());
if (required) {
@@ -276,7 +276,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Double:
- panel = new AjaxSpinnerFieldPanel.Builder<Double>().step(0.1).
+ panel = new AjaxSpinnerFieldPanel.Builder<Double>().enableOnChange().step(0.1).
build("panel", schemaTO.getKey(), Double.class, new Model<Double>());
if (required) {
@@ -293,7 +293,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Encrypted:
- panel = new EncryptedFieldPanel("panel", schemaTO.getKey(), new Model<String>());
+ panel = new EncryptedFieldPanel("panel", schemaTO.getKey(), new Model<String>(), true);
if (required) {
panel.addRequiredLabel();
@@ -301,7 +301,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
default:
- panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<String>(), false);
+ panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<String>(), true);
if (jexlHelp) {
AjaxTextFieldPanel.class.cast(panel).enableJexlHelp();