You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/03/06 18:29:31 UTC
svn commit: r1297585 [2/5] - in /incubator/syncope/trunk:
client/src/main/java/org/syncope/client/report/
client/src/main/java/org/syncope/client/search/
client/src/main/java/org/syncope/client/to/
console/src/main/java/org/syncope/console/commons/ con...
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportModalPage.java Tue Mar 6 17:29:27 2012
@@ -25,6 +25,10 @@ import java.util.List;
import org.apache.wicket.Page;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.IAjaxCallDecorator;
+import org.apache.wicket.ajax.calldecorator.AjaxPreprocessingCallDecorator;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
@@ -38,6 +42,7 @@ import org.apache.wicket.extensions.mark
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.CompoundPropertyModel;
@@ -48,6 +53,7 @@ import org.apache.wicket.spring.injectio
import org.apache.wicket.util.resource.IResourceStream;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
+import org.syncope.client.report.ReportletConf;
import org.syncope.client.to.ReportExecTO;
import org.syncope.client.to.ReportTO;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
@@ -61,16 +67,27 @@ import org.syncope.console.wicket.extens
import org.syncope.console.wicket.markup.html.form.ActionLink;
import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.syncope.console.wicket.markup.html.form.SingleColumnPalette;
import org.syncope.types.ReportExecStatus;
public class ReportModalPage extends BaseModalPage {
private static final long serialVersionUID = -5747628615211127644L;
+ private static final String ADD_BUTTON_ID = "addButton";
+
+ private static final String EDIT_BUTTON_ID = "editButton";
+
+ private static final String REMOVE_BUTTON_ID = "removeButton";
+
private static final int EXEC_EXPORT_WIN_HEIGHT = 100;
private static final int EXEC_EXPORT_WIN_WIDTH = 400;
+ private static final int REPORTLET_CONF_WIN_HEIGHT = 500;
+
+ private static final int REPORTLET_CONF_WIN_WIDTH = 800;
+
@SpringBean
private ReportRestClient restClient;
@@ -88,9 +105,11 @@ public class ReportModalPage extends Bas
private long exportExecId;
- public ReportModalPage(final ModalWindow window, final ReportTO reportTO,
- final PageReference callerPageRef) {
+ private ReportletConf modalReportletConf;
+
+ private String modalReportletConfOldName;
+ public ReportModalPage(final ModalWindow window, final ReportTO reportTO, final PageReference callerPageRef) {
this.reportTO = reportTO;
form = new Form<ReportTO>("form");
@@ -101,23 +120,17 @@ public class ReportModalPage extends Bas
setupExecutions();
final CrontabContainer crontab = new CrontabContainer("crontab",
- new PropertyModel<String>(reportTO, "cronExpression"),
- reportTO.getCronExpression());
+ new PropertyModel<String>(reportTO, "cronExpression"), reportTO.getCronExpression());
form.add(crontab);
- final IndicatingAjaxButton submit = new IndicatingAjaxButton(
- "apply", new ResourceModel("apply")) {
+ final IndicatingAjaxButton submit = new IndicatingAjaxButton("apply", new ResourceModel("apply")) {
private static final long serialVersionUID = -958724007591692537L;
@Override
- protected void onSubmit(
- final AjaxRequestTarget target,
- final Form form) {
-
+ protected void onSubmit(final AjaxRequestTarget target, final Form form) {
ReportTO reportTO = (ReportTO) form.getModelObject();
- reportTO.setCronExpression(
- StringUtils.hasText(reportTO.getCronExpression())
+ reportTO.setCronExpression(StringUtils.hasText(reportTO.getCronExpression())
? crontab.getCronExpression() : null);
try {
@@ -138,9 +151,7 @@ public class ReportModalPage extends Bas
}
@Override
- protected void onError(final AjaxRequestTarget target,
- final Form form) {
-
+ protected void onError(final AjaxRequestTarget target, final Form form) {
target.add(feedbackPanel);
}
};
@@ -158,90 +169,226 @@ public class ReportModalPage extends Bas
}
private void setupProfile() {
- WebMarkupContainer profile = new WebMarkupContainer("profile");
+ final WebMarkupContainer profile = new WebMarkupContainer("profile");
profile.setOutputMarkupId(true);
form.add(profile);
+ final ModalWindow reportletConfWin = new ModalWindow("reportletConfWin");
+ reportletConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ reportletConfWin.setCookieName("reportlet-conf-win-modal");
+ reportletConfWin.setInitialHeight(REPORTLET_CONF_WIN_HEIGHT);
+ reportletConfWin.setInitialWidth(REPORTLET_CONF_WIN_WIDTH);
+ reportletConfWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
+
+ private static final long serialVersionUID = 8804221891699487139L;
+
+ @Override
+ public void onClose(final AjaxRequestTarget target) {
+ int foundIdx = -1;
+ if (modalReportletConfOldName != null) {
+ for (int i = 0; i < reportTO.getReportletConfs().size() && foundIdx == -1; i++) {
+ if (reportTO.getReportletConfs().get(i).getName().equals(modalReportletConfOldName)) {
+ foundIdx = i;
+ }
+ }
+ }
+ if (modalReportletConf != null) {
+ if (foundIdx == -1) {
+ reportTO.addReportletConf(modalReportletConf);
+ } else {
+ reportTO.getReportletConfs().set(foundIdx, modalReportletConf);
+ }
+ }
+
+ target.add(profile);
+ }
+ });
+ add(reportletConfWin);
+
final Label idLabel = new Label("idLabel", new ResourceModel("id"));
profile.add(idLabel);
- final AjaxTextFieldPanel id = new AjaxTextFieldPanel(
- "id", getString("id"),
- new PropertyModel<String>(reportTO, "id"), false);
-
+ final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"),
+ new PropertyModel<String>(reportTO, "id"));
id.setEnabled(false);
profile.add(id);
- final Label nameLabel =
- new Label("nameLabel", new ResourceModel("name"));
+ final Label nameLabel = new Label("nameLabel", new ResourceModel("name"));
profile.add(nameLabel);
- final AjaxTextFieldPanel name = new AjaxTextFieldPanel(
- "name", getString("name"),
- new PropertyModel<String>(reportTO, "name"), false);
-
- name.setEnabled(false);
+ final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"),
+ new PropertyModel<String>(reportTO, "name"));
profile.add(name);
- final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel(
- "lastExec", getString("lastExec"), new DateFormatROModel(
- new PropertyModel<String>(reportTO, "lastExec")), false);
+ final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"),
+ new DateFormatROModel(new PropertyModel<String>(reportTO, "lastExec")));
lastExec.setEnabled(false);
profile.add(lastExec);
- final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel(
- "nextExec", getString("nextExec"), new DateFormatROModel(
- new PropertyModel<String>(reportTO, "nextExec")), false);
+ final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"),
+ new DateFormatROModel(new PropertyModel<String>(reportTO, "nextExec")));
nextExec.setEnabled(false);
profile.add(nextExec);
+
+ final SingleColumnPalette<ReportletConf> reportlets = new SingleColumnPalette<ReportletConf>("reportlets",
+ new PropertyModel<List<? extends ReportletConf>>(reportTO, "reportletConfs"),
+ new IChoiceRenderer<ReportletConf>() {
+
+ private static final long serialVersionUID =
+ 1048000918946220007L;
+
+ @Override
+ public Object getDisplayValue(final ReportletConf object) {
+ return object.getName();
+ }
+
+ @Override
+ public String getIdValue(final ReportletConf object, int index) {
+
+ return object.getName();
+ }
+ }, 5, true);
+ reportlets.setOutputMarkupId(true);
+ reportlets.addRecordBehavior(new AjaxFormComponentUpdatingBehavior("onchange") {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ }
+ });
+ reportlets.addRecordBehavior(new AjaxFormComponentUpdatingBehavior("onselect") {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ if (target.getLastFocusedElementId() != null
+ && target.getLastFocusedElementId().startsWith(EDIT_BUTTON_ID)
+ && reportlets.getSelectedItem() != null) {
+
+ reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ modalReportletConfOldName = reportlets.getSelectedItem().getName();
+ modalReportletConf = null;
+ return new ReportletConfModalPage(reportlets.getSelectedItem(),
+ reportletConfWin, ReportModalPage.this.getPageReference());
+ }
+ });
+ reportletConfWin.show(target);
+ }
+ }
+ });
+ reportlets.setAddLink(new AjaxLink(ADD_BUTTON_ID) {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ modalReportletConfOldName = null;
+ modalReportletConf = null;
+ return new ReportletConfModalPage(null,
+ reportletConfWin, ReportModalPage.this.getPageReference());
+ }
+ });
+ reportletConfWin.show(target);
+ }
+ });
+ reportlets.setEditLink(new AjaxLink(EDIT_BUTTON_ID) {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ }
+
+ @Override
+ protected IAjaxCallDecorator getAjaxCallDecorator() {
+ return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
+
+ private static final long serialVersionUID = -7927968187160354605L;
+
+ @Override
+ public CharSequence preDecorateScript(final CharSequence script) {
+ return script
+ + reportlets.getEditOnClickJS();
+ }
+ };
+ }
+ });
+ reportlets.setRemoveLink(new AjaxLink(REMOVE_BUTTON_ID) {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ }
+
+ @Override
+ protected IAjaxCallDecorator getAjaxCallDecorator() {
+ return new AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
+
+ private static final long serialVersionUID = -7927968187160354605L;
+
+ @Override
+ public CharSequence preDecorateScript(final CharSequence script) {
+ return "if (confirm('" + getString("confirmDelete") + "')) {"
+ + script
+ + reportlets.getRemoveOnClickJS()
+ + "}";
+ }
+ };
+ }
+ });
+ profile.add(reportlets);
}
private void setupExecutions() {
- final WebMarkupContainer executions =
- new WebMarkupContainer("executions");
+ final WebMarkupContainer executions = new WebMarkupContainer("executions");
executions.setOutputMarkupId(true);
form.add(executions);
- final ModalWindow reportExecMessageWin = new ModalWindow(
- "reportExecMessageWin");
+ final ModalWindow reportExecMessageWin = new ModalWindow("reportExecMessageWin");
reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
reportExecMessageWin.setCookieName("report-exec-message-win-modal");
add(reportExecMessageWin);
- final ModalWindow reportExecExportWin = new ModalWindow(
- "reportExecExportWin");
+ final ModalWindow reportExecExportWin = new ModalWindow("reportExecExportWin");
reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
reportExecExportWin.setCookieName("report-exec-export-win-modal");
reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT);
reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH);
- reportExecExportWin.setWindowClosedCallback(
- new ModalWindow.WindowClosedCallback() {
+ reportExecExportWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
- private static final long serialVersionUID =
- 8804221891699487139L;
+ private static final long serialVersionUID =
+ 8804221891699487139L;
- @Override
- public void onClose(final AjaxRequestTarget target) {
- AjaxExportDownloadBehavior behavior =
- new AjaxExportDownloadBehavior(
- ReportModalPage.this.exportFormat,
- ReportModalPage.this.exportExecId);
- executions.add(behavior);
- behavior.initiate(target);
- }
- });
+ @Override
+ public void onClose(final AjaxRequestTarget target) {
+ AjaxExportDownloadBehavior behavior = new AjaxExportDownloadBehavior(
+ ReportModalPage.this.exportFormat, ReportModalPage.this.exportExecId);
+ executions.add(behavior);
+ behavior.initiate(target);
+ }
+ });
add(reportExecExportWin);
final List<IColumn> columns = new ArrayList<IColumn>();
columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id"));
- columns.add(new DatePropertyColumn(
- new ResourceModel("startDate"), "startDate", "startDate"));
- columns.add(new DatePropertyColumn(
- new ResourceModel("endDate"), "endDate", "endDate"));
- columns.add(new PropertyColumn(
- new ResourceModel("status"), "status", "status"));
- columns.add(new AbstractColumn<ReportExecTO>(
- new ResourceModel("actions", "")) {
+ columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate"));
+ columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate"));
+ columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status"));
+ columns.add(new AbstractColumn<ReportExecTO>(new ResourceModel("actions", "")) {
private static final long serialVersionUID = 2054811145491901166L;
@@ -258,28 +405,23 @@ public class ReportModalPage extends Bas
final ReportExecTO taskExecutionTO = model.getObject();
- final ActionLinksPanel panel =
- new ActionLinksPanel(componentId, model);
+ final ActionLinksPanel panel = new ActionLinksPanel(componentId, model);
panel.add(new ActionLink() {
- private static final long serialVersionUID =
- -3722207913631435501L;
+ private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
- reportExecMessageWin.setPageCreator(
- new ModalWindow.PageCreator() {
+ reportExecMessageWin.setPageCreator(new ModalWindow.PageCreator() {
- private static final long serialVersionUID =
- -7834632442532690940L;
+ private static final long serialVersionUID = -7834632442532690940L;
- @Override
- public Page createPage() {
- return new ExecMessageModalPage(
- model.getObject().getMessage());
- }
- });
+ @Override
+ public Page createPage() {
+ return new ExecMessageModalPage(model.getObject().getMessage());
+ }
+ });
reportExecMessageWin.show(target);
}
}, ActionLink.ActionType.EDIT, "Reports", "read",
@@ -295,24 +437,19 @@ public class ReportModalPage extends Bas
reportExecExportWin.setPageCreator(
new ModalWindow.PageCreator() {
- private static final long serialVersionUID =
- -7834632442532690940L;
+ private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
- ReportModalPage.this.exportExecId =
- model.getObject().getId();
+ ReportModalPage.this.exportExecId = model.getObject().getId();
return new ReportExecResultDownloadModalPage(
- reportExecExportWin,
- ReportModalPage.this.
- getPageReference());
+ reportExecExportWin, ReportModalPage.this.getPageReference());
}
});
reportExecExportWin.show(target);
}
}, ActionLink.ActionType.EXPORT, "Reports", "read",
- ReportExecStatus.SUCCESS.name().equals(
- model.getObject().getStatus()));
+ ReportExecStatus.SUCCESS.name().equals(model.getObject().getStatus()));
panel.add(new ActionLink() {
@@ -322,8 +459,7 @@ public class ReportModalPage extends Bas
@Override
public void onClick(final AjaxRequestTarget target) {
try {
- restClient.deleteExecution(
- taskExecutionTO.getId());
+ restClient.deleteExecution(taskExecutionTO.getId());
reportTO.removeExecution(taskExecutionTO);
@@ -351,8 +487,13 @@ public class ReportModalPage extends Bas
this.exportFormat = exportFormat;
}
- private class ReportExecutionsProvider
- extends SortableDataProvider<ReportExecTO> {
+ public void setModalReportletConf(final ReportletConf modalReportletConf) {
+ this.modalReportletConf = modalReportletConf;
+ }
+
+ private static class ReportExecutionsProvider extends SortableDataProvider<ReportExecTO> {
+
+ private static final long serialVersionUID = 2118096121691420539L;
private SortableDataProviderComparator<ReportExecTO> comparator;
@@ -381,13 +522,11 @@ public class ReportModalPage extends Bas
}
@Override
- public IModel<ReportExecTO> model(
- final ReportExecTO taskExecution) {
+ public IModel<ReportExecTO> model(final ReportExecTO taskExecution) {
return new AbstractReadOnlyModel<ReportExecTO>() {
- private static final long serialVersionUID =
- 7485475149862342421L;
+ private static final long serialVersionUID = 7485475149862342421L;
@Override
public ReportExecTO getObject() {
@@ -397,11 +536,9 @@ public class ReportModalPage extends Bas
}
}
- private class AjaxExportDownloadBehavior
- extends AbstractAjaxDownloadBehavior {
+ private class AjaxExportDownloadBehavior extends AbstractAjaxDownloadBehavior {
- private static final long serialVersionUID =
- 3109256773218160485L;
+ private static final long serialVersionUID = 3109256773218160485L;
private final String exportFormat;
@@ -411,9 +548,7 @@ public class ReportModalPage extends Bas
private HttpResourceStream stream;
- public AjaxExportDownloadBehavior(final String exportFormat,
- final long exportExecId) {
-
+ public AjaxExportDownloadBehavior(final String exportFormat, final long exportExecId) {
this.exportFormat = exportFormat;
this.exportExecId = exportExecId;
}
Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java Tue Mar 6 17:29:27 2012
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.pages;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.wicket.Component;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.PropertyAccessorFactory;
+import org.springframework.util.ClassUtils;
+import org.syncope.annotation.FormAttributeField;
+import org.syncope.client.SyncopeConstants;
+import org.syncope.client.report.ReportletConf;
+import org.syncope.client.search.NodeCond;
+import org.syncope.console.pages.panels.UserSearchPanel;
+import org.syncope.console.rest.ReportRestClient;
+import org.syncope.console.rest.SchemaRestClient;
+import org.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.syncope.console.wicket.markup.html.form.AjaxNumberFieldPanel;
+import org.syncope.console.wicket.markup.html.form.AjaxPalettePanel;
+import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.syncope.console.wicket.markup.html.form.CheckBoxMultipleChoiceFieldPanel;
+import org.syncope.console.wicket.markup.html.form.DateTimeFieldPanel;
+import org.syncope.console.wicket.markup.html.form.FieldPanel;
+import org.syncope.console.wicket.markup.html.form.MultiValueSelectorPanel;
+import org.syncope.types.AttributableType;
+
+public class ReportletConfModalPage extends BaseModalPage {
+
+ private static final long serialVersionUID = 3910027601200382958L;
+
+ private static final String[] EXCLUDE_PROPERTIES = new String[]{
+ "serialVersionUID", "class", "name", "reportletClassName"};
+
+ @SpringBean
+ private ReportRestClient restClient;
+
+ @SpringBean
+ private SchemaRestClient schemaRestClient;
+
+ private ReportletConf reportletConf;
+
+ final AjaxTextFieldPanel name;
+
+ private WebMarkupContainer propertiesContainer;
+
+ private ListView<String> propView;
+
+ public ReportletConfModalPage(final ReportletConf reportletConf,
+ final ModalWindow window, final PageReference callerPageRef) {
+
+ this.reportletConf = reportletConf;
+
+ Form form = new Form("form");
+ add(form);
+
+ propertiesContainer = new WebMarkupContainer("container");
+ propertiesContainer.setOutputMarkupId(true);
+ form.add(propertiesContainer);
+
+ name = new AjaxTextFieldPanel("name", "name",
+ this.reportletConf == null ? new Model() : new PropertyModel<String>(this.reportletConf, "name"));
+ name.setOutputMarkupId(true);
+ name.addRequiredLabel();
+ form.add(name);
+
+ final AjaxDropDownChoicePanel<String> reportletClass = new AjaxDropDownChoicePanel<String>(
+ "reportletClass", "reportletClass", new IModel<String>() {
+
+ private static final long serialVersionUID = -2316468110411802130L;
+
+ @Override
+ public String getObject() {
+ return ReportletConfModalPage.this.reportletConf == null
+ ? null : ReportletConfModalPage.this.reportletConf.getClass().getName();
+ }
+
+ @Override
+ public void setObject(final String object) {
+ try {
+ Class reportletClass = Class.forName(object);
+ ReportletConfModalPage.this.reportletConf = (ReportletConf) reportletClass.newInstance();
+ propertiesContainer.replace(buildPropView());
+ } catch (Exception e) {
+ LOG.error("Cannot find or initialize {}", object, e);
+ }
+ }
+
+ @Override
+ public void detach() {
+ }
+ });
+ reportletClass.setStyleShet("long_dynamicsize");
+ reportletClass.setChoices(restClient.getReportletConfClasses());
+ ((DropDownChoice) reportletClass.getField()).setNullValid(true);
+ reportletClass.addRequiredLabel();
+ reportletClass.getField().add(new AjaxFormComponentUpdatingBehavior("onchange") {
+
+ private static final long serialVersionUID = 5538299138211283825L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ ((DropDownChoice) reportletClass.getField()).setNullValid(false);
+ target.add(reportletClass.getField());
+ target.add(propertiesContainer);
+ }
+ });
+ form.add(reportletClass);
+
+ propertiesContainer.add(buildPropView());
+
+ final AjaxButton submit = new AjaxButton("apply", new ResourceModel("apply")) {
+
+ private static final long serialVersionUID = -958724007591692537L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ final BeanWrapper wrapper =
+ PropertyAccessorFactory.forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
+ wrapper.setPropertyValue("name", name.getField().getInput());
+
+ // Iterate over properties in order to find UserSearchPanel instances and manually update
+ // this.reportletConf with select search criteria - this is needed because UserSearchPanel
+ // does not comply with usual Wicket model paradigm.
+ for (Iterator<Component> itor = ReportletConfModalPage.this.propView.visitChildren(); itor.hasNext();) {
+ Component component = itor.next();
+ if (component instanceof UserSearchPanel) {
+ // using component.getDefaultModelObjectAsString() to fetch field name (set above)
+ wrapper.setPropertyValue(component.getDefaultModelObjectAsString(),
+ ((UserSearchPanel) component).buildSearchCond());
+ }
+ }
+
+ ((ReportModalPage) callerPageRef.getPage()).setModalReportletConf(
+ ReportletConfModalPage.this.reportletConf);
+ window.close(target);
+ }
+
+ @Override
+ protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ target.add(feedbackPanel);
+ }
+ };
+ form.add(submit);
+ }
+
+ private FieldPanel buildSinglePanel(final Class<?> type, final String fieldName, final String id) {
+ FieldPanel result = null;
+ PropertyModel model = new PropertyModel(ReportletConfModalPage.this.reportletConf, fieldName);
+ if (Boolean.TYPE.equals(type) || Boolean.class.equals(type)) {
+ result = new AjaxCheckBoxPanel(id, fieldName, model);
+ } else if (Integer.TYPE.equals(type) || Integer.class.equals(type)
+ || Long.TYPE.equals(type) || Long.class.equals(type)
+ || Double.TYPE.equals(type) || Double.class.equals(type)) {
+
+ result = new AjaxNumberFieldPanel(id, fieldName, model, ClassUtils.resolvePrimitiveIfNecessary(type));
+ } else if (Date.class.equals(type)) {
+ result = new DateTimeFieldPanel(id, fieldName, model, SyncopeConstants.DEFAULT_DATE_PATTERN);
+ } else if (type.isEnum()) {
+ result = new AjaxDropDownChoicePanel(id, fieldName, model).setChoices(
+ Arrays.asList(type.getEnumConstants()));
+ }
+
+ // treat as String if nothing matched above
+ if (result == null) {
+ result = new AjaxTextFieldPanel(id, fieldName, model);
+ }
+
+ return result;
+ }
+
+ private ListView<String> buildPropView() {
+ LoadableDetachableModel<List<String>> propViewModel = new LoadableDetachableModel<List<String>>() {
+
+ private static final long serialVersionUID = 5275935387613157437L;
+
+ @Override
+ protected List<String> load() {
+ List<String> result = new ArrayList<String>();
+ if (ReportletConfModalPage.this.reportletConf != null) {
+ for (Field field : ReportletConfModalPage.this.reportletConf.getClass().getDeclaredFields()) {
+ if (!ArrayUtils.contains(EXCLUDE_PROPERTIES, field.getName())) {
+ result.add(field.getName());
+ }
+ }
+ }
+
+ return result;
+ }
+ };
+
+ propView = new ListView<String>("propView", propViewModel) {
+
+ private static final long serialVersionUID = 9101744072914090143L;
+
+ @Override
+ protected void populateItem(final ListItem<String> item) {
+ final String fieldName = item.getModelObject();
+
+ Label label = new Label("key", fieldName);
+ item.add(label);
+
+ Field field = null;
+ try {
+ field = ReportletConfModalPage.this.reportletConf.getClass().getDeclaredField(fieldName);
+ } catch (Exception e) {
+ LOG.error("Could not find field {} in class {}",
+ new Object[]{fieldName, ReportletConfModalPage.this.reportletConf.getClass(), e});
+ }
+ if (field == null) {
+ return;
+ }
+
+ BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(
+ ReportletConfModalPage.this.reportletConf);
+
+ Panel panel;
+
+ if (NodeCond.class.equals(field.getType())) {
+ panel = new UserSearchPanel("value", (NodeCond) wrapper.getPropertyValue(fieldName), false);
+ // This is needed in order to manually update this.reportletConf with search panel selections
+ panel.setDefaultModel(new Model(fieldName));
+ } else if (List.class.equals(field.getType())) {
+ if (wrapper.getPropertyValue(fieldName) == null) {
+ wrapper.setPropertyValue(fieldName, new ArrayList());
+ }
+
+ Class listItemType = String.class;
+ if (field.getGenericType() instanceof ParameterizedType) {
+ listItemType =
+ (Class) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
+ }
+
+ FormAttributeField annotation = field.getAnnotation(FormAttributeField.class);
+
+ if (listItemType.equals(String.class) && annotation != null) {
+ List<String> choices;
+ switch (annotation.schema()) {
+ case UserSchema:
+ choices = schemaRestClient.getSchemaNames(AttributableType.USER);
+ break;
+
+ case UserDerivedSchema:
+ choices = schemaRestClient.getDerivedSchemaNames(AttributableType.USER);
+ break;
+
+ case UserVirtualSchema:
+ choices = schemaRestClient.getVirtualSchemaNames(AttributableType.USER);
+ break;
+
+ case RoleSchema:
+ choices = schemaRestClient.getSchemaNames(AttributableType.ROLE);
+ break;
+
+ case RoleDerivedSchema:
+ choices = schemaRestClient.getDerivedSchemaNames(AttributableType.ROLE);
+ break;
+
+ case RoleVirtualSchema:
+ choices = schemaRestClient.getVirtualSchemaNames(AttributableType.ROLE);
+ break;
+
+ case MembershipSchema:
+ choices = schemaRestClient.getSchemaNames(AttributableType.MEMBERSHIP);
+ break;
+
+ case MembershipDerivedSchema:
+ choices = schemaRestClient.getDerivedSchemaNames(AttributableType.MEMBERSHIP);
+ break;
+
+ case MembershipVirtualSchema:
+ choices = schemaRestClient.getVirtualSchemaNames(AttributableType.MEMBERSHIP);
+ break;
+
+ default:
+ choices = Collections.EMPTY_LIST;
+ }
+
+ panel = new AjaxPalettePanel("value", new PropertyModel<List<String>>(
+ ReportletConfModalPage.this.reportletConf, fieldName),
+ new ListModel<String>(choices), true);
+ } else if (listItemType.isEnum()) {
+ panel = new CheckBoxMultipleChoiceFieldPanel("value",
+ new PropertyModel(ReportletConfModalPage.this.reportletConf, fieldName),
+ new ListModel(Arrays.asList(listItemType.getEnumConstants())));
+ } else {
+ if (((List) wrapper.getPropertyValue(fieldName)).isEmpty()) {
+ ((List) wrapper.getPropertyValue(fieldName)).add(null);
+ }
+
+ panel = new MultiValueSelectorPanel("value",
+ new PropertyModel<List>(ReportletConfModalPage.this.reportletConf, fieldName),
+ buildSinglePanel(field.getType(), fieldName, "panel"));
+ }
+ } else {
+ panel = buildSinglePanel(field.getType(), fieldName, "value");
+ }
+
+ item.add(panel);
+ }
+ };
+
+ return propView;
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/ReportletConfModalPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchedTaskModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchedTaskModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchedTaskModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchedTaskModalPage.java Tue Mar 6 17:29:27 2012
@@ -42,25 +42,18 @@ public class SchedTaskModalPage extends
super(window, taskTO, callerPageRef);
- final IModel<List<String>> classNames =
- new LoadableDetachableModel<List<String>>() {
+ final IModel<List<String>> classNames = new LoadableDetachableModel<List<String>>() {
- private static final long serialVersionUID =
- 5275935387613157437L;
+ private static final long serialVersionUID = 5275935387613157437L;
- @Override
- protected List<String> load() {
- final List<String> classes = new ArrayList<String>(
- taskRestClient.getJobClasses());
+ @Override
+ protected List<String> load() {
+ return taskRestClient.getJobClasses();
+ }
+ };
- return classes;
- }
- };
-
- final AjaxDropDownChoicePanel<String> className =
- new AjaxDropDownChoicePanel<String>(
- "jobClassName", getString("class"),
- new PropertyModel(taskTO, "jobClassName"), false);
+ final AjaxDropDownChoicePanel<String> className = new AjaxDropDownChoicePanel<String>("jobClassName",
+ getString("class"), new PropertyModel(taskTO, "jobClassName"));
className.setChoices(classNames.getObject());
className.addRequiredLabel();
className.setEnabled(taskTO.getId() == 0);
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Schema.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Schema.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Schema.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Schema.java Tue Mar 6 17:29:27 2012
@@ -18,7 +18,6 @@
*/
package org.syncope.console.pages;
-import org.syncope.console.commons.SchemaModalPageFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -53,12 +52,14 @@ import org.syncope.client.to.SchemaTO;
import org.syncope.client.to.VirtualSchemaTO;
import org.syncope.console.commons.Constants;
import org.syncope.console.commons.PreferenceManager;
+import org.syncope.console.commons.SchemaModalPageFactory;
import org.syncope.console.commons.SelectChoiceRenderer;
import org.syncope.console.commons.SortableDataProviderComparator;
import org.syncope.console.rest.SchemaRestClient;
import org.syncope.console.wicket.markup.html.form.ActionLink;
import org.syncope.console.wicket.markup.html.form.ActionLink.ActionType;
import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
+import org.syncope.types.AttributableType;
/**
* Schema WebPage.
@@ -175,11 +176,6 @@ public class Schema extends BasePage {
private int membershipVirPageRows;
- /*
- * Response flag set by the Modal Window after the operation is completed
- */
- private boolean operationResult = false;
-
public Schema(PageParameters parameters) {
super(parameters);
@@ -302,7 +298,7 @@ public class Schema extends BasePage {
List<IColumn> rolesColumns = getColumnsForSchema(
roleSchemasContainer,
editRoleSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.NORMAL,
Constants.SCHEMA_FIELDS,
allowedReadRoles,
@@ -322,7 +318,7 @@ public class Schema extends BasePage {
List<IColumn> columnsRolesDer = getColumnsForSchema(
roleDerivedSchemasContainer,
editRoleDerivedSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.DERIVED,
Constants.DERIVED_SCHEMA_FIELDS,
allowedReadRoles,
@@ -343,7 +339,7 @@ public class Schema extends BasePage {
List<IColumn> columnsRolesVir = getColumnsForSchema(
roleVirtualSchemasContainer,
editRoleVirtualSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.VIRTUAL,
Constants.VIRTUAL_SCHEMA_FIELDS,
allowedReadRoles,
@@ -364,7 +360,7 @@ public class Schema extends BasePage {
List<IColumn> userColumns = getColumnsForSchema(
userSchemasContainer,
editUserSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.NORMAL,
Constants.SCHEMA_FIELDS,
allowedReadRoles,
@@ -386,7 +382,7 @@ public class Schema extends BasePage {
List<IColumn> columnsUsersDer = getColumnsForSchema(
userDerivedSchemasContainer,
editUserDerivedSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.DERIVED,
Constants.DERIVED_SCHEMA_FIELDS,
allowedReadRoles,
@@ -407,7 +403,7 @@ public class Schema extends BasePage {
List<IColumn> columnsUsersVir = getColumnsForSchema(
userVirtualSchemasContainer,
editUserVirtualSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.VIRTUAL,
Constants.VIRTUAL_SCHEMA_FIELDS,
allowedReadRoles,
@@ -428,7 +424,7 @@ public class Schema extends BasePage {
List<IColumn> membershipsColumns = getColumnsForSchema(
membershipSchemaContainer,
editMembershipSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.NORMAL,
Constants.SCHEMA_FIELDS,
allowedReadRoles,
@@ -450,7 +446,7 @@ public class Schema extends BasePage {
List<IColumn> columnsMembershipsDer = getColumnsForSchema(
membershipDerivedSchemaContainer,
editMembershipDerivedSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.DERIVED,
Constants.DERIVED_SCHEMA_FIELDS,
allowedReadRoles,
@@ -473,7 +469,7 @@ public class Schema extends BasePage {
List<IColumn> columnsMembershipsVir = getColumnsForSchema(
membershipVirtualSchemaContainer,
editMembershipVirtualSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.VIRTUAL,
Constants.VIRTUAL_SCHEMA_FIELDS,
allowedReadRoles,
@@ -672,7 +668,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createRoleSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.NORMAL,
"createRoleSchemaWinLink",
"createRoleSchemaWin",
@@ -680,7 +676,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createRoleDerivedSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.DERIVED,
"createRoleDerivedSchemaWinLink",
"createRoleDerivedSchemaWin",
@@ -688,7 +684,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createRoleVirtualSchemaWin,
- SchemaModalPageFactory.Entity.role,
+ AttributableType.ROLE,
SchemaModalPageFactory.SchemaType.VIRTUAL,
"createRoleVirtualSchemaWinLink",
"createRoleVirtualSchemaWin",
@@ -696,7 +692,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createUserSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.NORMAL,
"createUserSchemaWinLink",
"createUserSchemaModalWin",
@@ -704,7 +700,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createUserDerivedSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.DERIVED,
"createUserDerSchemaWinLink",
"createUserDerSchemaModalWin",
@@ -712,7 +708,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createUserVirtualSchemaWin,
- SchemaModalPageFactory.Entity.user,
+ AttributableType.USER,
SchemaModalPageFactory.SchemaType.VIRTUAL,
"createUserVirSchemaWinLink",
"createUserVirSchemaModalWin",
@@ -720,7 +716,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createMembershipSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.NORMAL,
"createMembershipSchemaWinLink",
"createMembershipSchemaModalWin",
@@ -728,7 +724,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createMembershipDerivedSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.DERIVED,
"createMembershipDerSchemaWinLink",
"createMembershipDerivedSchemaWin",
@@ -736,7 +732,7 @@ public class Schema extends BasePage {
add(getCreateSchemaWindow(
createMembershipVirtualSchemaWin,
- SchemaModalPageFactory.Entity.membership,
+ AttributableType.MEMBERSHIP,
SchemaModalPageFactory.SchemaType.VIRTUAL,
"createMembershipVirSchemaWinLink",
"createMembershipVirtualSchemaWin",
@@ -784,15 +780,15 @@ public class Schema extends BasePage {
List<SchemaTO> list;
switch (schemaType) {
case UserSchema:
- list = restClient.getSchemas("user");
+ list = restClient.getSchemas(AttributableType.USER);
break;
case RoleSchema:
- list = restClient.getSchemas("role");
+ list = restClient.getSchemas(AttributableType.ROLE);
break;
case MembershipSchema:
- list = restClient.getSchemas("membership");
+ list = restClient.getSchemas(AttributableType.MEMBERSHIP);
break;
default:
@@ -846,11 +842,11 @@ public class Schema extends BasePage {
List<DerivedSchemaTO> list = null;
if (schema == SchemaDerivedType.RoleDerivedSchema) {
- list = restClient.getDerivedSchemas("role");
+ list = restClient.getDerivedSchemas(AttributableType.ROLE);
} else if (schema == SchemaDerivedType.UserDerivedSchema) {
- list = restClient.getDerivedSchemas("user");
+ list = restClient.getDerivedSchemas(AttributableType.USER);
} else if (schema == SchemaDerivedType.MembershipDerivedSchema) {
- list = restClient.getDerivedSchemas("membership");
+ list = restClient.getDerivedSchemas(AttributableType.MEMBERSHIP);
}
return list;
@@ -900,11 +896,11 @@ public class Schema extends BasePage {
List<VirtualSchemaTO> list = null;
if (schema == SchemaVirtualType.RoleVirtualSchema) {
- list = restClient.getVirtualSchemas("role");
+ list = restClient.getVirtualSchemas(AttributableType.ROLE);
} else if (schema == SchemaVirtualType.UserVirtualSchema) {
- list = restClient.getVirtualSchemas("user");
+ list = restClient.getVirtualSchemas(AttributableType.USER);
} else if (schema == SchemaVirtualType.MembershipVirtualSchema) {
- list = restClient.getVirtualSchemas("membership");
+ list = restClient.getVirtualSchemas(AttributableType.MEMBERSHIP);
}
return list;
@@ -914,7 +910,7 @@ public class Schema extends BasePage {
private <T extends AbstractSchemaModalPage> List<IColumn> getColumnsForSchema(
final WebMarkupContainer webContainer,
final ModalWindow modalWindow,
- final SchemaModalPageFactory.Entity entity,
+ final AttributableType attributableType,
final SchemaModalPageFactory.SchemaType schemaType,
final String[] fields,
final String readPermissions,
@@ -923,15 +919,11 @@ public class Schema extends BasePage {
List<IColumn> columns = new ArrayList<IColumn>();
for (String field : fields) {
- columns.add(
- new PropertyColumn(new ResourceModel(field),
- field,
- field));
+ columns.add(new PropertyColumn(new ResourceModel(field), field, field));
}
- columns.add(new AbstractColumn<AbstractBaseBean>(
- new ResourceModel("actions", "")) {
+ columns.add(new AbstractColumn<AbstractBaseBean>(new ResourceModel("actions", "")) {
private static final long serialVersionUID = 2054811145491901166L;
@@ -948,38 +940,29 @@ public class Schema extends BasePage {
final AbstractBaseBean schemaTO = model.getObject();
- final ActionLinksPanel panel =
- new ActionLinksPanel(componentId, model);
+ final ActionLinksPanel panel = new ActionLinksPanel(componentId, model);
panel.add(new ActionLink() {
- private static final long serialVersionUID =
- -3722207913631435501L;
+ private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
- modalWindow.setPageCreator(
- new ModalWindow.PageCreator() {
+ modalWindow.setPageCreator(new ModalWindow.PageCreator() {
- private static final long serialVersionUID =
- -7834632442532690940L;
+ private static final long serialVersionUID = -7834632442532690940L;
- @Override
- public Page createPage() {
- AbstractSchemaModalPage page =
- SchemaModalPageFactory.
- getSchemaModalPage(entity,
- schemaType);
-
- page.setSchemaModalPage(
- Schema.this.getPageReference(),
- modalWindow,
- schemaTO,
- false);
-
- return page;
- }
- });
+ @Override
+ public Page createPage() {
+ AbstractSchemaModalPage page =
+ SchemaModalPageFactory.getSchemaModalPage(attributableType, schemaType);
+
+ page.setSchemaModalPage(Schema.this.getPageReference(), modalWindow,
+ schemaTO, false);
+
+ return page;
+ }
+ });
modalWindow.show(target);
}
@@ -995,19 +978,13 @@ public class Schema extends BasePage {
switch (schemaType) {
case DERIVED:
- restClient.deleteDerivedSchema(
- entity.toString(),
- ((DerivedSchemaTO) schemaTO).getName());
+ restClient.deleteDerivedSchema(attributableType, ((DerivedSchemaTO) schemaTO).getName());
break;
case VIRTUAL:
- restClient.deleteVirtualSchema(
- entity.toString(),
- ((VirtualSchemaTO) schemaTO).getName());
+ restClient.deleteVirtualSchema(attributableType, ((VirtualSchemaTO) schemaTO).getName());
break;
default:
- restClient.deleteSchema(
- entity.toString(),
- ((SchemaTO) schemaTO).getName());
+ restClient.deleteSchema(attributableType, ((SchemaTO) schemaTO).getName());
break;
}
@@ -1046,12 +1023,8 @@ public class Schema extends BasePage {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- prefMan.set(getRequest(),
- getResponse(),
- rowsPerPagePrefName,
- String.valueOf(rowChooser.getInput()));
- dataTable.setItemsPerPage(
- Integer.parseInt(rowChooser.getInput()));
+ prefMan.set(getRequest(), getResponse(), rowsPerPagePrefName, String.valueOf(rowChooser.getInput()));
+ dataTable.setItemsPerPage(Integer.parseInt(rowChooser.getInput()));
target.add(webContainer);
}
@@ -1064,7 +1037,7 @@ public class Schema extends BasePage {
private <T extends AbstractSchemaModalPage> AjaxLink getCreateSchemaWindow(
final ModalWindow createSchemaWin,
- final SchemaModalPageFactory.Entity entity,
+ final AttributableType attributableType,
final SchemaModalPageFactory.SchemaType schemaType,
final String winLinkName,
final String winName,
@@ -1079,20 +1052,14 @@ public class Schema extends BasePage {
createSchemaWin.setPageCreator(new ModalWindow.PageCreator() {
- private static final long serialVersionUID =
- -7834632442532690940L;
+ private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
- AbstractSchemaModalPage page =
- SchemaModalPageFactory.getSchemaModalPage(
- entity, schemaType);
-
- page.setSchemaModalPage(
- Schema.this.getPageReference(),
- new ModalWindow(winName),
- null,
- true);
+ AbstractSchemaModalPage page = SchemaModalPageFactory.getSchemaModalPage(
+ attributableType, schemaType);
+
+ page.setSchemaModalPage(Schema.this.getPageReference(), new ModalWindow(winName), null, true);
return page;
}
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchemaModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchemaModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchemaModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SchemaModalPage.java Tue Mar 6 17:29:27 2012
@@ -19,32 +19,33 @@
package org.syncope.console.pages;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.Arrays;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.util.string.Strings;
-import org.syncope.client.to.SchemaTO;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.util.string.Strings;
import org.syncope.client.AbstractBaseBean;
+import org.syncope.client.to.SchemaTO;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
import org.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.syncope.types.AttributableType;
import org.syncope.types.SchemaType;
/**
@@ -54,7 +55,7 @@ public class SchemaModalPage extends Abs
private static final long serialVersionUID = -5991561277287424057L;
- public SchemaModalPage(String kind) {
+ public SchemaModalPage(AttributableType kind) {
super(kind);
}
@@ -73,15 +74,13 @@ public class SchemaModalPage extends Abs
schemaForm.setModel(new CompoundPropertyModel(schema));
schemaForm.setOutputMarkupId(Boolean.TRUE);
- final AjaxTextFieldPanel name = new AjaxTextFieldPanel(
- "name", getString("name"),
- new PropertyModel<String>(schema, "name"), true);
+ final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"),
+ new PropertyModel<String>(schema, "name"));
name.addRequiredLabel();
name.setEnabled(createFlag);
- final AjaxTextFieldPanel conversionPattern = new AjaxTextFieldPanel(
- "conversionPattern", getString("conversionPattern"),
- new PropertyModel<String>(schema, "conversionPattern"), true);
+ final AjaxTextFieldPanel conversionPattern = new AjaxTextFieldPanel("conversionPattern",
+ getString("conversionPattern"), new PropertyModel<String>(schema, "conversionPattern"));
final IModel<List<String>> validatorsList =
new LoadableDetachableModel<List<String>>() {
@@ -95,27 +94,21 @@ public class SchemaModalPage extends Abs
}
};
- final AjaxDropDownChoicePanel<String> validatorClass =
- new AjaxDropDownChoicePanel<String>(
- "validatorClass", getString("validatorClass"),
- new PropertyModel(schema, "validatorClass"), true);
+ final AjaxDropDownChoicePanel<String> validatorClass = new AjaxDropDownChoicePanel<String>("validatorClass",
+ getString("validatorClass"), new PropertyModel(schema, "validatorClass"));
((DropDownChoice) validatorClass.getField()).setNullValid(true);
validatorClass.setChoices(validatorsList.getObject());
- final AjaxDropDownChoicePanel<SchemaType> type =
- new AjaxDropDownChoicePanel<SchemaType>(
- "type", getString("type"),
- new PropertyModel(schema, "type"), false);
+ final AjaxDropDownChoicePanel<SchemaType> type = new AjaxDropDownChoicePanel<SchemaType>("type",
+ getString("type"), new PropertyModel(schema, "type"));
type.setChoices(Arrays.asList(SchemaType.values()));
type.addRequiredLabel();
- final AjaxTextFieldPanel enumerationValues = new AjaxTextFieldPanel(
- "enumerationValues", getString("enumerationValues"),
- new PropertyModel<String>(schema, "enumerationValues"), false);
+ final AjaxTextFieldPanel enumerationValues = new AjaxTextFieldPanel("enumerationValues",
+ getString("enumerationValues"), new PropertyModel<String>(schema, "enumerationValues"));
- if (schema != null
- && SchemaType.Enum.equals(((SchemaTO) schema).getType())) {
+ if (schema != null && SchemaType.Enum.equals(((SchemaTO) schema).getType())) {
enumerationValues.addRequiredLabel();
enumerationValues.setEnabled(Boolean.TRUE);
} else {
@@ -182,17 +175,14 @@ public class SchemaModalPage extends Abs
}
});
- final AjaxCheckBoxPanel multivalue = new AjaxCheckBoxPanel(
- "multivalue", getString("multivalue"),
- new PropertyModel<Boolean>(schema, "multivalue"), true);
-
- final AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel(
- "readonly", getString("readonly"),
- new PropertyModel<Boolean>(schema, "readonly"), true);
-
- final AjaxCheckBoxPanel uniqueConstraint = new AjaxCheckBoxPanel(
- "uniqueConstraint", getString("uniqueConstraint"),
- new PropertyModel<Boolean>(schema, "uniqueConstraint"), true);
+ final AjaxCheckBoxPanel multivalue = new AjaxCheckBoxPanel("multivalue", getString("multivalue"),
+ new PropertyModel<Boolean>(schema, "multivalue"));
+
+ final AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
+ new PropertyModel<Boolean>(schema, "readonly"));
+
+ final AjaxCheckBoxPanel uniqueConstraint = new AjaxCheckBoxPanel("uniqueConstraint",
+ getString("uniqueConstraint"), new PropertyModel<Boolean>(schema, "uniqueConstraint"));
final AjaxButton submit = new IndicatingAjaxButton(
"apply", new ResourceModel("submit")) {
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SyncTaskModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SyncTaskModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SyncTaskModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/SyncTaskModalPage.java Tue Mar 6 17:29:27 2012
@@ -70,66 +70,51 @@ public class SyncTaskModalPage extends A
}
};
- final AjaxDropDownChoicePanel<String> resource =
- new AjaxDropDownChoicePanel<String>(
- "resource", getString("resourceName"),
- new PropertyModel(taskTO, "resource"), false);
+ final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<String>("resource",
+ getString("resourceName"), new PropertyModel(taskTO, "resource"));
resource.setChoices(allResources.getObject());
resource.setChoiceRenderer(new SelectChoiceRenderer());
resource.addRequiredLabel();
resource.setEnabled(taskTO.getId() == 0);
- resource.setStyleShet(
- "ui-widget-content ui-corner-all long_dynamicsize");
+ resource.setStyleShet("ui-widget-content ui-corner-all long_dynamicsize");
profile.add(resource);
- final IModel<List<String>> classNames =
- new LoadableDetachableModel<List<String>>() {
-
- private static final long serialVersionUID =
- 5275935387613157437L;
+ final IModel<List<String>> classNames = new LoadableDetachableModel<List<String>>() {
- @Override
- protected List<String> load() {
- final List<String> classes = new ArrayList<String>(
- taskRestClient.getJobActionsClasses());
+ private static final long serialVersionUID = 5275935387613157437L;
- return classes;
- }
- };
+ @Override
+ protected List<String> load() {
+ return taskRestClient.getJobActionsClasses();
+ }
+ };
- final AjaxDropDownChoicePanel<String> actionsClassName =
- new AjaxDropDownChoicePanel<String>(
- "jobActionsClassName", getString("actionsClass"),
- new PropertyModel(taskTO, "jobActionsClassName"), false);
+ final AjaxDropDownChoicePanel<String> actionsClassName = new AjaxDropDownChoicePanel<String>(
+ "jobActionsClassName", getString("actionsClass"), new PropertyModel(taskTO, "jobActionsClassName"));
actionsClassName.setChoices(classNames.getObject());
actionsClassName.setStyleShet(
"ui-widget-content ui-corner-all long_dynamicsize");
profile.add(actionsClassName);
- final AjaxCheckBoxPanel creates = new AjaxCheckBoxPanel(
- "performCreate", getString("creates"),
- new PropertyModel<Boolean>(taskTO, "performCreate"), false);
+ final AjaxCheckBoxPanel creates = new AjaxCheckBoxPanel("performCreate", getString("creates"),
+ new PropertyModel<Boolean>(taskTO, "performCreate"));
profile.add(creates);
- final AjaxCheckBoxPanel updates = new AjaxCheckBoxPanel(
- "performUpdate", getString("updates"),
- new PropertyModel<Boolean>(taskTO, "performUpdate"), false);
+ final AjaxCheckBoxPanel updates = new AjaxCheckBoxPanel("performUpdate", getString("updates"),
+ new PropertyModel<Boolean>(taskTO, "performUpdate"));
profile.add(updates);
- final AjaxCheckBoxPanel deletes = new AjaxCheckBoxPanel(
- "performDelete", getString("updates"),
- new PropertyModel<Boolean>(taskTO, "performDelete"), false);
+ final AjaxCheckBoxPanel deletes = new AjaxCheckBoxPanel("performDelete", getString("updates"),
+ new PropertyModel<Boolean>(taskTO, "performDelete"));
profile.add(deletes);
- final AjaxCheckBoxPanel status = new AjaxCheckBoxPanel(
- "syncStatus", getString("status"),
- new PropertyModel<Boolean>(taskTO, "syncStatus"), false);
+ final AjaxCheckBoxPanel status = new AjaxCheckBoxPanel("syncStatus", getString("status"),
+ new PropertyModel<Boolean>(taskTO, "syncStatus"));
profile.add(status);
- final AjaxCheckBoxPanel fullReconciliation = new AjaxCheckBoxPanel(
- "fullReconciliation", getString("fullReconciliation"),
- new PropertyModel<Boolean>(taskTO, "fullReconciliation"), false);
+ final AjaxCheckBoxPanel fullReconciliation = new AjaxCheckBoxPanel("fullReconciliation",
+ getString("fullReconciliation"), new PropertyModel<Boolean>(taskTO, "fullReconciliation"));
profile.add(fullReconciliation);
}
}
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/TaskModalPage.java Tue Mar 6 17:29:27 2012
@@ -109,9 +109,8 @@ public abstract class TaskModalPage exte
final Label idLabel = new Label("idLabel", new ResourceModel("id"));
profile.add(idLabel);
- final AjaxTextFieldPanel id = new AjaxTextFieldPanel(
- "id", getString("id"),
- new PropertyModel<String>(taskTO, "id"), false);
+ final AjaxTextFieldPanel id = new AjaxTextFieldPanel("id", getString("id"),
+ new PropertyModel<String>(taskTO, "id"));
id.setEnabled(false);
profile.add(id);
@@ -207,8 +206,7 @@ public abstract class TaskModalPage exte
executions.add(table);
}
- protected class TaskExecutionsProvider
- extends SortableDataProvider<TaskExecTO> {
+ protected static class TaskExecutionsProvider extends SortableDataProvider<TaskExecTO> {
private static final long serialVersionUID = 8943636537120648961L;
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/UserRequestModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/UserRequestModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/UserRequestModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/UserRequestModalPage.java Tue Mar 6 17:29:27 2012
@@ -35,6 +35,8 @@ import org.syncope.console.rest.UserRest
*/
public class UserRequestModalPage extends UserModalPage {
+ private static final long serialVersionUID = 603212869211672852L;
+
@SpringBean
private UserRestClient userRestClient;
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/VirtualSchemaModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/VirtualSchemaModalPage.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/VirtualSchemaModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/VirtualSchemaModalPage.java Tue Mar 6 17:29:27 2012
@@ -20,17 +20,18 @@ package org.syncope.console.pages;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
import org.syncope.client.AbstractBaseBean;
import org.syncope.client.to.VirtualSchemaTO;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
import org.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.syncope.types.AttributableType;
/**
* Modal window with Schema form.
@@ -39,7 +40,7 @@ public class VirtualSchemaModalPage exte
private static final long serialVersionUID = 5979623248182851337L;
- public VirtualSchemaModalPage(String kind) {
+ public VirtualSchemaModalPage(AttributableType kind) {
super(kind);
}
@@ -58,9 +59,8 @@ public class VirtualSchemaModalPage exte
schemaForm.setModel(new CompoundPropertyModel(schema));
- final AjaxTextFieldPanel name = new AjaxTextFieldPanel(
- "name", getString("name"),
- new PropertyModel<String>(schema, "name"), false);
+ final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"),
+ new PropertyModel<String>(schema, "name"));
name.addRequiredLabel();
name.setEnabled(createFlag);
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/AttributesPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/AttributesPanel.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/AttributesPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/AttributesPanel.java Tue Mar 6 17:29:27 2012
@@ -18,7 +18,6 @@
*/
package org.syncope.console.pages.panels;
-import org.syncope.console.wicket.markup.html.form.MultiValueSelectorPanel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -49,6 +48,8 @@ import org.syncope.console.wicket.markup
import org.syncope.console.wicket.markup.html.form.DateTextFieldPanel;
import org.syncope.console.wicket.markup.html.form.DateTimeFieldPanel;
import org.syncope.console.wicket.markup.html.form.FieldPanel;
+import org.syncope.console.wicket.markup.html.form.MultiValueSelectorPanel;
+import org.syncope.types.AttributableType;
import org.syncope.types.SchemaType;
public class AttributesPanel extends Panel {
@@ -79,14 +80,11 @@ public class AttributesPanel extends Pan
protected Map<String, SchemaTO> load() {
final List<SchemaTO> schemaTOs;
if (entityTO instanceof RoleTO) {
- schemaTOs = schemaRestClient.getSchemas(
- "role");
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
} else if (entityTO instanceof UserTO) {
- schemaTOs = schemaRestClient.getSchemas(
- "user");
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.USER);
} else {
- schemaTOs = schemaRestClient.getSchemas(
- "membership");
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
}
final Map<String, SchemaTO> schemas =
@@ -130,7 +128,6 @@ public class AttributesPanel extends Pan
item.add(new MultiValueSelectorPanel<String>(
"panel",
new PropertyModel(attributeTO, "values"),
- String.class,
panel));
}
}
@@ -190,36 +187,26 @@ public class AttributesPanel extends Pan
? SchemaType.String : schemaTO.getType();
switch (type) {
case Boolean:
- panel = new AjaxCheckBoxPanel(
- "panel", schemaTO.getName(), new Model(), true);
+ panel = new AjaxCheckBoxPanel("panel", schemaTO.getName(), new Model());
panel.setRequired(required);
break;
case Date:
- final String dataPattern = schemaTO.getConversionPattern() != null
+ final String dataPattern = schemaTO.getConversionPattern()
+ != null
? schemaTO.getConversionPattern()
: SyncopeConstants.DEFAULT_DATE_PATTERN;
if (!dataPattern.contains("H")) {
- panel = new DateTextFieldPanel(
- "panel",
- schemaTO.getName(),
- new Model(),
- true,
- dataPattern);
+ panel = new DateTextFieldPanel("panel", schemaTO.getName(), new Model(), dataPattern);
if (required) {
panel.addRequiredLabel();
}
} else {
- panel = new DateTimeFieldPanel(
- "panel",
- schemaTO.getName(),
- new Model(),
- true,
- dataPattern);
+ panel = new DateTimeFieldPanel("panel", schemaTO.getName(), new Model(), dataPattern);
if (required) {
panel.addRequiredLabel();
@@ -230,10 +217,8 @@ public class AttributesPanel extends Pan
break;
case Enum:
- panel = new AjaxDropDownChoicePanel<String>(
- "panel", schemaTO.getName(), new Model(), true);
- ((AjaxDropDownChoicePanel) panel).setChoices(
- Arrays.asList(schemaTO.getEnumerationValues().
+ panel = new AjaxDropDownChoicePanel<String>("panel", schemaTO.getName(), new Model());
+ ((AjaxDropDownChoicePanel) panel).setChoices(Arrays.asList(schemaTO.getEnumerationValues().
split(Schema.enumValuesSeparator)));
if (required) {
panel.addRequiredLabel();
@@ -241,8 +226,7 @@ public class AttributesPanel extends Pan
break;
default:
- panel = new AjaxTextFieldPanel(
- "panel", schemaTO.getName(), new Model(), true);
+ panel = new AjaxTextFieldPanel("panel", schemaTO.getName(), new Model());
if (required) {
panel.addRequiredLabel();
}
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/DerivedAttributesPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/DerivedAttributesPanel.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/DerivedAttributesPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/DerivedAttributesPanel.java Tue Mar 6 17:29:27 2012
@@ -46,6 +46,7 @@ import org.syncope.client.to.RoleTO;
import org.syncope.client.to.UserTO;
import org.syncope.console.rest.SchemaRestClient;
import org.syncope.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
+import org.syncope.types.AttributableType;
public class DerivedAttributesPanel extends Panel {
@@ -75,14 +76,11 @@ public class DerivedAttributesPanel exte
@Override
protected List<String> load() {
if (entityTO instanceof RoleTO) {
- return schemaRestClient.getDerivedSchemaNames(
- "role");
+ return schemaRestClient.getDerivedSchemaNames(AttributableType.ROLE);
} else if (entityTO instanceof UserTO) {
- return schemaRestClient.getDerivedSchemaNames(
- "user");
+ return schemaRestClient.getDerivedSchemaNames(AttributableType.USER);
} else {
- return schemaRestClient.getDerivedSchemaNames(
- "membership");
+ return schemaRestClient.getDerivedSchemaNames(AttributableType.MEMBERSHIP);
}
}
};
@@ -177,8 +175,7 @@ public class DerivedAttributesPanel exte
protected void onUpdate(
final AjaxRequestTarget art) {
- attributeTO.setSchema(schemaChoice.
- getModelObject());
+ attributeTO.setSchema(schemaChoice.getModelObject());
}
});