syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject syncope git commit: Parameters page with enum panel, #SYNCOPE-156
Date Tue, 26 Jan 2016 16:36:08 GMT
Repository: syncope
Updated Branches:
  refs/heads/master 800a39f9d -> dc8e946d3


Parameters page with enum panel, #SYNCOPE-156


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/dc8e946d
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/dc8e946d
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/dc8e946d

Branch: refs/heads/master
Commit: dc8e946d31e00ac7f5680166e47aa0a97d05c438
Parents: 800a39f
Author: Massimiliano Perrone <massimiliano.perrone@tirasa.net>
Authored: Tue Jan 26 17:12:01 2016 +0100
Committer: Massimiliano Perrone <massimiliano.perrone@tirasa.net>
Committed: Tue Jan 26 17:35:35 2016 +0100

----------------------------------------------------------------------
 .../panels/ParametersCreateWizardAttrStep.java  |  3 +-
 .../panels/ParametersCreateWizardPanel.java     | 14 ++--
 .../ParametersCreateWizardSchemaStep.java       | 72 ++++++++++++++++++++
 .../client/console/panels/ParametersPanel.java  |  1 +
 .../ParametersCreateWizardSchemaStep.html       |  1 +
 .../ParametersCreateWizardSchemaStep.properties |  1 +
 ...rametersCreateWizardSchemaStep_it.properties |  1 +
 ...etersCreateWizardSchemaStep_pt_BR.properties |  1 +
 8 files changed, 83 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
index c86d4ae..4ddb9a7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
@@ -54,6 +54,7 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
 
         final AjaxTextFieldPanel schema = new AjaxTextFieldPanel(
                 "schema", getString("schema"), new PropertyModel<String>(modelObject.getAttrTO(),
"schema"));
+        schema.setRequired(true);
         content.add(schema);
 
         final LoadableDetachableModel<List<PlainSchemaTO>> loadableDetachableModel
@@ -75,8 +76,6 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
             @Override
             protected void populateItem(final ListItem<PlainSchemaTO> item) {
                 final Panel panel = getFieldPanel("panel", modelObject.getAttrTO(), item.getModelObject());
-                panel.setEnabled(true);
-                panel.setVisible(true);
                 item.add(panel);
             }
         };

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardPanel.java
index 09f7aae..8db78d0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardPanel.java
@@ -56,15 +56,11 @@ public class ParametersCreateWizardPanel extends AjaxWizardBuilder<ParametersCre
 
     @Override
     protected Serializable onApplyInternal(final ParametersForm modelObject) {
-        try {
-            final PlainSchemaTO finalpPlainSchemaTO = modelObject.getPlainSchemaTO();
-            finalpPlainSchemaTO.setKey(modelObject.getAttrTO().getSchema());
-            SyncopeConsoleSession.get().getService(SchemaService.class).create(
-                    SchemaType.PLAIN, finalpPlainSchemaTO);
-            SyncopeConsoleSession.get().getService(ConfigurationService.class).set(modelObject.getAttrTO());
-        } catch (Exception e) {
-            LOG.error("While deleting SecutiryQuestionTO", e);
-        }
+        final PlainSchemaTO finalpPlainSchemaTO = modelObject.getPlainSchemaTO();
+        finalpPlainSchemaTO.setKey(modelObject.getAttrTO().getSchema());
+        SyncopeConsoleSession.get().getService(SchemaService.class).create(
+                SchemaType.PLAIN, finalpPlainSchemaTO);
+        SyncopeConsoleSession.get().getService(ConfigurationService.class).set(modelObject.getAttrTO());
         return modelObject.getAttrTO();
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
index a5b4eaf..769081e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
@@ -18,13 +18,23 @@
  */
 package org.apache.syncope.client.console.panels;
 
+import static org.apache.syncope.client.console.commons.PropertyList.getEnumValuesAsString;
+
 import java.util.Arrays;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.commons.PropertyList;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.extensions.wizard.WizardStep;
 import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 
 public class ParametersCreateWizardSchemaStep extends WizardStep {
@@ -41,6 +51,68 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
         type.setChoices(Arrays.asList(AttrSchemaType.values()));
         content.add(type);
 
+        final MultiFieldPanel<String> panel = new MultiFieldPanel.Builder<String>(
+                new PropertyModel<List<String>>(modelObject.getPlainSchemaTO(),
"enumerationValues") {
+
+            private static final long serialVersionUID = 3985215199105092649L;
+
+            @Override
+            public PropertyList<PlainSchemaTO> getObject() {
+                return new PropertyList<PlainSchemaTO>(modelObject.getPlainSchemaTO())
{
+
+                    @Override
+                    public String getValues() {
+                        System.out.println(">>>>>>>>> getvalues:
" + modelObject.getPlainSchemaTO().
+                                getEnumerationValues());
+                        return modelObject.getPlainSchemaTO().getEnumerationValues();
+                    }
+
+                    @Override
+                    public void setValues(final List<String> list) {
+                        System.out.println(">>>>>>>>> setvalues
" + list);
+                        modelObject.getPlainSchemaTO().setEnumerationValues(getEnumValuesAsString(list));
+                    }
+                };
+            }
+
+            @Override
+            public void setObject(final List<String> object) {
+                System.out.println(">>>>>>>>> setObject: " + object);
+                modelObject.getPlainSchemaTO().setEnumerationValues(PropertyList.getEnumValuesAsString(object));
+            }
+        }) {
+
+            private static final long serialVersionUID = -8752965211744734798L;
+
+            @Override
+            protected String newModelObject() {
+                return StringUtils.EMPTY;
+            }
+
+        }.build("values", getString("values"), new AjaxTextFieldPanel(
+                "panel", getString("values"), new Model<String>(), false));
+
+        panel.setVisible(false);
+        content.add(panel);
+
+        type.getField().add(new AjaxFormComponentUpdatingBehavior("onchange") {
+
+            private static final long serialVersionUID = -1107858522700306810L;
+
+            @Override
+            protected void onUpdate(final AjaxRequestTarget target) {
+                if ("enum".equalsIgnoreCase(type.getField().getModelObject().name())) {
+                    panel.setVisible(true);
+                    content.add(panel);
+                    target.add(content);
+                } else {
+                    panel.setVisible(false);
+                    content.add(panel);
+                    target.add(content);
+                }
+            }
+        });
+
         final AjaxTextFieldPanel mandatoryCondition = new AjaxTextFieldPanel(
                 "mandatoryCondition", getString("mandatoryCondition"),
                 new PropertyModel<String>(modelObject.getPlainSchemaTO(), "mandatoryCondition"));

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersPanel.java
index 34ce06c..803f478 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersPanel.java
@@ -116,6 +116,7 @@ public class ParametersPanel extends AbstractSearchResultPanel<
             }
 
         }, true);
+        addNotificationPanel((BasePage.class.cast(pageRef.getPage()).getNotificationPanel()));
         modal.size(Modal.Size.Medium);
         initResultTable();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
index b45f560..320ae7a 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
@@ -20,6 +20,7 @@ under the License.
   <wicket:panel>
     <div wicket:id="content">
       <span wicket:id="type">[type]</span>
+      <span wicket:id="values">[values]</span>
       <span wicket:id="mandatoryCondition">[mandatoryCondition]</span>
       <span wicket:id="panel">[panel]</span>
     </div>

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.properties
index c5d8c1e..4084774 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.properties
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 type=Schema type
+values=Values
 multivalue=Multivalue
 mandatoryCondition=Mandatory

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_it.properties
index 07e4ac5..9e4acf7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_it.properties
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 type=Tipo di schema
+values=Valori
 multivalue=Multivalore
 mandatoryCondition=Obbligatorio

http://git-wip-us.apache.org/repos/asf/syncope/blob/dc8e946d/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_pt_BR.properties
index c9c9bc6..9b877b7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep_pt_BR.properties
@@ -12,5 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 type=Tipo de esquema
+values=Valores
 multivalue=Multi-valorizados
 mandatoryCondition=Obrigat\u00f3rio


Mime
View raw message