http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchedTaskModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchedTaskModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchedTaskModalPage.java deleted file mode 100644 index 78ca906..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchedTaskModalPage.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.DateFormatROModel; -import org.apache.syncope.client.console.wicket.markup.html.CrontabContainer; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.to.SchedTaskTO; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -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.modal.ModalWindow; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.model.ResourceModel; -import org.springframework.util.StringUtils; - -/** - * Modal window with Task form (to stop and start execution). - */ -public abstract class AbstractSchedTaskModalPage extends TaskModalPage { - - private static final long serialVersionUID = 2892005971093059242L; - - protected CrontabContainer crontab; - - public AbstractSchedTaskModalPage(final ModalWindow window, final SchedTaskTO taskTO, - final PageReference pageRef) { - - super(taskTO); - - crontab = new CrontabContainer("crontab", new PropertyModel<String>(taskTO, "cronExpression"), - taskTO.getCronExpression()); - form.add(crontab); - - final AjaxTextFieldPanel name = - new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(taskTO, "name")); - name.setEnabled(true); - profile.add(name); - - final AjaxTextFieldPanel description = new AjaxTextFieldPanel("description", "description", - new PropertyModel<String>(taskTO, "description")); - description.setEnabled(true); - profile.add(description); - - final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"), - new DateFormatROModel(new PropertyModel<String>(taskTO, "lastExec"))); - lastExec.setEnabled(false); - profile.add(lastExec); - - final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"), - new DateFormatROModel(new PropertyModel<String>(taskTO, "nextExec"))); - nextExec.setEnabled(false); - profile.add(nextExec); - - final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - SchedTaskTO taskTO = (SchedTaskTO) form.getModelObject(); - taskTO.setCronExpression(StringUtils.hasText(taskTO.getCronExpression()) - ? crontab.getCronExpression() - : null); - - try { - submitAction(taskTO); - - ((BasePage) pageRef.getPage()).setModalResult(true); - - window.close(target); - } catch (SyncopeClientException e) { - LOG.error("While creating or updating task", e); - error(getString(Constants.ERROR) + ": " + e.getMessage()); - feedbackPanel.refresh(target); - } - } - - @Override - protected void onError(final AjaxRequestTarget target, final Form<?> form) { - feedbackPanel.refresh(target); - } - }; - - final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - window.close(target); - } - }; - - cancel.setDefaultFormProcessing(false); - - if (taskTO.getKey() > 0) { - MetaDataRoleAuthorizationStrategy.authorize( - submit, RENDER, xmlRolesReader.getEntitlement(TASKS, "update")); - } else { - MetaDataRoleAuthorizationStrategy.authorize( - submit, RENDER, xmlRolesReader.getEntitlement(TASKS, "create")); - } - - form.add(submit); - form.add(cancel); - } - - protected abstract void submitAction(SchedTaskTO taskTO); - -}
http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchemaModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchemaModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchemaModalPage.java deleted file mode 100644 index 1c1bd0f..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSchemaModalPage.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import org.apache.syncope.common.lib.to.AbstractSchemaTO; -import org.apache.syncope.common.lib.types.AttributableType; -import org.apache.wicket.PageReference; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; - -/** - * Modal window with Schema form. - */ -public abstract class AbstractSchemaModalPage<T extends AbstractSchemaTO> extends BaseModalPage { - - private static final long serialVersionUID = 7369215690388444748L; - - protected AttributableType kind; - - public AbstractSchemaModalPage(final AttributableType kind) { - this.kind = kind; - } - - public abstract void setSchemaModalPage(PageReference callerPageRef, ModalWindow window, T schema, - boolean createFlag); - - public AttributableType getKind() { - return kind; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractStatusModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractStatusModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractStatusModalPage.java deleted file mode 100644 index f5dfbca..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractStatusModalPage.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import org.apache.wicket.markup.html.panel.Fragment; - -public class AbstractStatusModalPage extends BaseModalPage { - - private static final long serialVersionUID = 6633408683036028540L; - - public AbstractStatusModalPage() { - add(new Fragment("pwdMgtFields", "emptyFragment", this)); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSyncTaskModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSyncTaskModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSyncTaskModalPage.java deleted file mode 100644 index aa62b41..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/AbstractSyncTaskModalPage.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.apache.commons.lang3.StringUtils; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.SelectChoiceRenderer; -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.common.lib.to.AbstractProvisioningTaskTO; -import org.apache.syncope.common.lib.to.ResourceTO; -import org.apache.syncope.common.lib.types.MatchingRule; -import org.apache.syncope.common.lib.types.UnmatchingRule; -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.AjaxLink; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.markup.html.list.ListView; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.LoadableDetachableModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.PropertyModel; - -/** - * Abstract Modal window for Sync and Push Task form. - */ -public abstract class AbstractSyncTaskModalPage extends AbstractSchedTaskModalPage { - - private static final long serialVersionUID = 2148403203517274669L; - - protected AjaxDropDownChoicePanel<MatchingRule> matchingRule; - - protected AjaxDropDownChoicePanel<UnmatchingRule> unmatchingRule; - - protected abstract List<String> getSyncActions(); - - final IModel<List<String>> allResources = new LoadableDetachableModel<List<String>>() { - - private static final long serialVersionUID = 5275935387613157437L; - - @Override - protected List<String> load() { - final List<String> resourceNames = new ArrayList<>(); - - for (ResourceTO resourceTO : resourceRestClient.getAll()) { - resourceNames.add(resourceTO.getKey()); - } - - Collections.sort(resourceNames); - return resourceNames; - } - }; - - final IModel<List<String>> syncActionsClasses = new LoadableDetachableModel<List<String>>() { - - private static final long serialVersionUID = 5275935387613157438L; - - @Override - protected List<String> load() { - return getSyncActions(); - } - }; - - public AbstractSyncTaskModalPage( - final ModalWindow window, final AbstractProvisioningTaskTO taskTO, final PageReference pageRef) { - - super(window, taskTO, pageRef); - - final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>("resource", - getString("resourceName"), new PropertyModel<String>(taskTO, "resource")); - resource.setChoices(allResources.getObject()); - resource.setChoiceRenderer(new SelectChoiceRenderer<String>()); - resource.addRequiredLabel(); - resource.setEnabled(taskTO.getKey() == 0); - resource.setStyleSheet("ui-widget-content ui-corner-all long_dynamicsize"); - - profile.add(resource); - - final WebMarkupContainer syncActionsClassNames = new WebMarkupContainer("syncActionsClassNames"); - syncActionsClassNames.setOutputMarkupId(true); - profile.add(syncActionsClassNames); - - final AjaxLink<Void> first = new IndicatingAjaxLink<Void>("first") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - taskTO.getActionsClassNames().add(StringUtils.EMPTY); - setVisible(false); - target.add(syncActionsClassNames); - } - }; - first.setOutputMarkupPlaceholderTag(true); - first.setVisible(taskTO.getActionsClassNames().isEmpty()); - syncActionsClassNames.add(first); - - final ListView<String> actionsClasses = new ListView<String>( - "actionsClasses", new PropertyModel<List<String>>(taskTO, "actionsClassNames")) { - - private static final long serialVersionUID = 9101744072914090143L; - - @Override - protected void populateItem(final ListItem<String> item) { - final String className = item.getModelObject(); - - final DropDownChoice<String> actionsClass = new DropDownChoice<String>( - "actionsClass", new Model<String>(className), syncActionsClasses.getObject()); - actionsClass.setNullValid(true); - actionsClass.setRequired(true); - actionsClass.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - taskTO.getActionsClassNames().set(item.getIndex(), actionsClass.getModelObject()); - target.add(syncActionsClassNames); - } - }); - actionsClass.setRequired(true); - actionsClass.setOutputMarkupId(true); - actionsClass.setRequired(true); - item.add(actionsClass); - - AjaxLink<Void> minus = new IndicatingAjaxLink<Void>("drop") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - taskTO.getActionsClassNames().remove(className); - first.setVisible(taskTO.getActionsClassNames().isEmpty()); - target.add(syncActionsClassNames); - } - }; - item.add(minus); - - final AjaxLink<Void> plus = new IndicatingAjaxLink<Void>("add") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - taskTO.getActionsClassNames().add(StringUtils.EMPTY); - target.add(syncActionsClassNames); - } - }; - plus.setOutputMarkupPlaceholderTag(true); - plus.setVisible(item.getIndex() == taskTO.getActionsClassNames().size() - 1); - item.add(plus); - } - }; - syncActionsClassNames.add(actionsClasses); - - syncActionsClassNames.setEnabled(!syncActionsClasses.getObject().isEmpty()); - - 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")); - profile.add(updates); - - final AjaxCheckBoxPanel deletes = new AjaxCheckBoxPanel("performDelete", getString("updates"), - new PropertyModel<Boolean>(taskTO, "performDelete")); - profile.add(deletes); - - final AjaxCheckBoxPanel syncStatus = new AjaxCheckBoxPanel("syncStatus", getString("syncStatus"), - new PropertyModel<Boolean>(taskTO, "syncStatus")); - profile.add(syncStatus); - - matchingRule = new AjaxDropDownChoicePanel<MatchingRule>( - "matchingRule", "matchingRule", new PropertyModel<MatchingRule>(taskTO, "matchingRule")); - matchingRule.setChoices(Arrays.asList(MatchingRule.values())); - ((DropDownChoice) matchingRule.getField()).setNullValid(false); - - unmatchingRule = new AjaxDropDownChoicePanel<UnmatchingRule>( - "unmatchingRule", "unmatchingRule", new PropertyModel<UnmatchingRule>(taskTO, "unmatchingRule")); - unmatchingRule.setChoices(Arrays.asList(UnmatchingRule.values())); - ((DropDownChoice) unmatchingRule.getField()).setNullValid(false); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/ActivitiModelerPopupPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ActivitiModelerPopupPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ActivitiModelerPopupPage.java deleted file mode 100644 index 05658fc..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ActivitiModelerPopupPage.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import org.apache.wicket.markup.html.WebPage; - -public class ActivitiModelerPopupPage extends WebPage { - - private static final long serialVersionUID = -7031206743629422898L; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/ApprovalModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ApprovalModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ApprovalModalPage.java deleted file mode 100644 index 79deeb0..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ApprovalModalPage.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import java.io.Serializable; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.math.NumberUtils; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.MapChoiceRenderer; -import org.apache.syncope.client.console.rest.ApprovalRestClient; -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.DateTimeFieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.SpinnerFieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.list.AltListView; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO; -import org.apache.syncope.common.lib.to.WorkflowFormTO; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -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.modal.ModalWindow; -import org.apache.wicket.markup.html.basic.Label; -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.model.IModel; -import org.apache.wicket.model.LoadableDetachableModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.spring.injection.annot.SpringBean; - -public class ApprovalModalPage extends BaseModalPage { - - private static final long serialVersionUID = -8847854414429745216L; - - private final static int USER_WIN_HEIGHT = 550; - - private final static int USER_WIN_WIDTH = 800; - - @SpringBean - private ApprovalRestClient restClient; - - private final ModalWindow editUserWin; - - public ApprovalModalPage(final PageReference pageRef, final ModalWindow window, final WorkflowFormTO formTO) { - super(); - - IModel<List<WorkflowFormPropertyTO>> formProps = new LoadableDetachableModel<List<WorkflowFormPropertyTO>>() { - - private static final long serialVersionUID = 3169142472626817508L; - - @Override - protected List<WorkflowFormPropertyTO> load() { - return formTO.getProperties(); - } - }; - - final ListView<WorkflowFormPropertyTO> propView = - new AltListView<WorkflowFormPropertyTO>("propView", formProps) { - - private static final long serialVersionUID = 9101744072914090143L; - - @Override - @SuppressWarnings({ "unchecked", "rawtypes" }) - protected void populateItem(final ListItem<WorkflowFormPropertyTO> item) { - final WorkflowFormPropertyTO prop = item.getModelObject(); - - Label label = new Label("key", prop.getName() == null - ? prop.getId() - : prop.getName()); - item.add(label); - - FieldPanel field; - switch (prop.getType()) { - case Boolean: - field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(), - new Model<Boolean>(Boolean.valueOf(prop.getValue()))).setChoices(Arrays.asList( - new String[] { "Yes", "No" })); - break; - - case Date: - SimpleDateFormat df = StringUtils.isNotBlank(prop.getDatePattern()) - ? new SimpleDateFormat(prop.getDatePattern()) - : new SimpleDateFormat(); - Date parsedDate = null; - if (StringUtils.isNotBlank(prop.getValue())) { - try { - parsedDate = df.parse(prop.getValue()); - } catch (ParseException e) { - LOG.error("Unparsable date: {}", prop.getValue(), e); - } - } - - field = new DateTimeFieldPanel("value", label.getDefaultModelObjectAsString(), - new Model<Date>(parsedDate), df.toLocalizedPattern()); - break; - - case Enum: - MapChoiceRenderer<String, String> enumCR = - new MapChoiceRenderer<String, String>(prop.getEnumValues()); - - field = new AjaxDropDownChoicePanel("value", label.getDefaultModelObjectAsString(), - new Model(prop.getValue())).setChoiceRenderer(enumCR).setChoices(new Model() { - - private static final long serialVersionUID = -858521070366432018L; - - @Override - public Serializable getObject() { - return new ArrayList<String>(prop.getEnumValues().keySet()); - } - }); - break; - - case Long: - field = new SpinnerFieldPanel<Long>("value", label.getDefaultModelObjectAsString(), - Long.class, new Model<Long>(NumberUtils.toLong(prop.getValue())), - null, null); - break; - - case String: - default: - field = new AjaxTextFieldPanel("value", PARENT_PATH, - new Model<String>(prop.getValue())); - break; - } - - field.setReadOnly(!prop.isWritable()); - if (prop.isRequired()) { - field.addRequiredLabel(); - } - - item.add(field); - } - }; - - final AjaxButton userDetails = new IndicatingAjaxButton("userDetails", - new Model<String>(getString("userDetails"))) { - - private static final long serialVersionUID = -4804368561204623354L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - editUserWin.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new ViewUserModalPage(ApprovalModalPage.this.getPageReference(), editUserWin, - userRestClient.read(formTO.getUserKey())) { - - private static final long serialVersionUID = -2819994749866481607L; - - @Override - protected void closeAction(final AjaxRequestTarget target, final Form form) { - setResponsePage(ApprovalModalPage.this); - } - }; - } - }); - - editUserWin.show(target); - } - }; - MetaDataRoleAuthorizationStrategy.authorize(userDetails, ENABLE, - xmlRolesReader.getEntitlement("Users", "read")); - - final AjaxButton submit = new IndicatingAjaxButton(APPLY, new Model<String>(getString(SUBMIT))) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - - Map<String, WorkflowFormPropertyTO> props = formTO.getPropertyMap(); - - for (int i = 0; i < propView.size(); i++) { - @SuppressWarnings("unchecked") - ListItem<WorkflowFormPropertyTO> item = (ListItem<WorkflowFormPropertyTO>) propView.get(i); - String input = ((FieldPanel) item.get("value")).getField().getInput(); - - if (!props.containsKey(item.getModelObject().getId())) { - props.put(item.getModelObject().getId(), new WorkflowFormPropertyTO()); - } - - if (item.getModelObject().isWritable()) { - switch (item.getModelObject().getType()) { - case Boolean: - props.get(item.getModelObject().getId()).setValue(String.valueOf("0".equals(input))); - break; - - case Date: - case Enum: - case String: - case Long: - default: - props.get(item.getModelObject().getId()).setValue(input); - break; - } - } - } - - formTO.getProperties().clear(); - formTO.getProperties().addAll(props.values()); - try { - restClient.submitForm(formTO); - - ((Todo) pageRef.getPage()).setModalResult(true); - window.close(target); - } catch (SyncopeClientException e) { - error(getString(Constants.ERROR) + ": " + e.getMessage()); - LOG.error("While submitting form {}", formTO, e); - feedbackPanel.refresh(target); - } - } - - @Override - protected void onError(final AjaxRequestTarget target, final Form<?> form) { - feedbackPanel.refresh(target); - } - }; - - final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form form) { - window.close(target); - } - - @Override - protected void onError(final AjaxRequestTarget target, final Form form) { - // nothing - } - }; - - cancel.setDefaultFormProcessing(false); - - Form form = new Form(FORM); - form.add(propView); - form.add(userDetails); - form.add(submit); - form.add(cancel); - - MetaDataRoleAuthorizationStrategy.authorize(form, ENABLE, xmlRolesReader.getEntitlement("Approval", - SUBMIT)); - - editUserWin = new ModalWindow("editUserWin"); - editUserWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); - editUserWin.setInitialHeight(USER_WIN_HEIGHT); - editUserWin.setInitialWidth(USER_WIN_WIDTH); - editUserWin.setCookieName("edit-user-modal"); - add(editUserWin); - - add(form); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/BaseModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BaseModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BaseModalPage.java index 20892dd..6da298a 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BaseModalPage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BaseModalPage.java @@ -18,7 +18,12 @@ */ package org.apache.syncope.client.console.pages; -import org.apache.syncope.client.console.commons.CloseOnESCBehavior; +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxEventBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; +import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; /** * Syncope Modal Window. @@ -30,6 +35,29 @@ public abstract class BaseModalPage extends AbstractBasePage { public BaseModalPage() { super(); - add(new CloseOnESCBehavior("keyup")); + add(new AjaxEventBehavior("keyup") { + + private static final long serialVersionUID = -7133385027739964990L; + + @Override + protected void onEvent(final AjaxRequestTarget target) { + ModalWindow.closeCurrent(target); + } + + @Override + protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { + super.updateAjaxAttributes(attributes); + + attributes.getAjaxCallListeners().add(new AjaxCallListener() { + + private static final long serialVersionUID = 7160235486520935153L; + + @Override + public CharSequence getPrecondition(final Component aComponent) { + return " if(Wicket.Event.keyCode(attrs.event) != 27){return false;}"; + } + }); + } + }); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java index 2540c37..7547448 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java @@ -18,21 +18,9 @@ */ package org.apache.syncope.client.console.pages; -import org.apache.syncope.client.console.SyncopeApplication; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.wicket.Component; -import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.IAjaxIndicatorAware; -import org.apache.wicket.behavior.Behavior; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.link.BookmarkablePageLink; import org.apache.wicket.request.mapper.parameter.PageParameters; -/** - * Syncope Wicket base-page. - */ public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware { private static final long serialVersionUID = 1571997737305598502L; @@ -43,41 +31,6 @@ public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware { public BasePage(final PageParameters parameters) { super(parameters); - - pageSetup(); - } - - private void pageSetup() { - ((SyncopeApplication) getApplication()).setupNavigationPanel(this, xmlRolesReader, true); - - final String kind = getClass().getSimpleName().toLowerCase(); - final BookmarkablePageLink kindLink = (BookmarkablePageLink) get(kind); - if (kindLink != null) { - kindLink.add(new Behavior() { - - private static final long serialVersionUID = 1469628524240283489L; - - @Override - public void onComponentTag(final Component component, final ComponentTag tag) { - tag.put("class", kind); - } - }); - - Component kindIcon = kindLink.get(0); - if (kindIcon != null) { - kindIcon.add(new Behavior() { - - private static final long serialVersionUID = 1469628524240283489L; - - @Override - public void onComponentTag(final Component component, final ComponentTag tag) { - tag.put("src", "../.." + SyncopeApplication.IMG_PREFIX + kind + Constants.PNG_EXT); - } - }); - } - } - - ((SyncopeApplication) getApplication()).setupEditProfileModal(this, userSelfRestClient); } @Override @@ -85,27 +38,4 @@ public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware { return "veil"; } - /** - * Set a WindowClosedCallback for a ModalWindow instance. - * - * @param window window - * @param container container - */ - protected void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) { - - window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { - - private static final long serialVersionUID = 8804221891699487139L; - - @Override - public void onClose(final AjaxRequestTarget target) { - target.add(container); - if (isModalResult()) { - info(getString(Constants.OPERATION_SUCCEEDED)); - feedbackPanel.refresh(target); - setModalResult(false); - } - } - }); - } } http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionModalPage.java deleted file mode 100644 index 95e514b..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionModalPage.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.rest.BaseRestClient; -import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.syncope.common.lib.to.BulkAction; -import org.apache.syncope.common.lib.to.BulkActionResult; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.form.AjaxButton; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; -import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; -import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.springframework.beans.BeanUtils; - -public class BulkActionModalPage<T, S> extends BaseModalPage { - - private static final long serialVersionUID = 4114026480146090962L; - - public BulkActionModalPage( - final ModalWindow window, - final Collection<T> items, - final List<IColumn<T, S>> columns, - final Collection<ActionLink.ActionType> actions, - final BaseRestClient bulkActionExecutor, - final String idFieldName, - final String pageId) { - - super(); - - final SortableDataProvider<T, S> dataProvider = new SortableDataProvider<T, S>() { - - private static final long serialVersionUID = 5291903859908641954L; - - @Override - public Iterator<? extends T> iterator(final long first, final long count) { - return items.iterator(); - } - - @Override - public long size() { - return items.size(); - } - - @Override - public IModel<T> model(final T object) { - return new CompoundPropertyModel<>(object); - } - }; - - add(new AjaxFallbackDefaultDataTable<>( - "selectedObjects", - new ArrayList<>(columns.subList(1, columns.size() - 1)), - dataProvider, - Integer.MAX_VALUE).setVisible(items != null && !items.isEmpty())); - - @SuppressWarnings("rawtypes") - final ActionLinksPanel actionPanel = new ActionLinksPanel("actions", new Model(), getPageReference()); - add(actionPanel); - - for (ActionLink.ActionType action : actions) { - final BulkAction bulkAction = new BulkAction(); - for (T item : items) { - try { - bulkAction.getTargets().add(getTargetId(item, idFieldName).toString()); - } catch (Exception e) { - LOG.error("Error retrieving item id {}", idFieldName, e); - } - } - - switch (action) { - case DELETE: - bulkAction.setOperation(BulkAction.Type.DELETE); - break; - case SUSPEND: - bulkAction.setOperation(BulkAction.Type.SUSPEND); - break; - case REACTIVATE: - bulkAction.setOperation(BulkAction.Type.REACTIVATE); - break; - case EXECUTE: - bulkAction.setOperation(BulkAction.Type.EXECUTE); - break; - case DRYRUN: - bulkAction.setOperation(BulkAction.Type.DRYRUN); - break; - default: - LOG.error("Bulk action type not supported"); - } - - actionPanel.add(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - try { - final BulkActionResult res = (BulkActionResult) bulkActionExecutor.getClass(). - getMethod("bulkAction", BulkAction.class).invoke(bulkActionExecutor, bulkAction); - - setResponsePage(new BulkActionResultModalPage<>(window, items, columns, res, idFieldName)); - } catch (Exception e) { - error(getString(Constants.ERROR) - + ": Operation " + bulkAction.getOperation() + " not supported"); - feedbackPanel.refresh(target); - } - - } - }, action, pageId, !items.isEmpty()); - } - - final Form<Void> form = new Form<>(FORM); - add(form); - - final AjaxButton cancel = - new ClearIndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL), getPageReference()) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) { - window.close(target); - } - }; - - cancel.setDefaultFormProcessing(false); - form.add(cancel); - } - - private Object getTargetId(final Object target, final String idFieldName) - throws IllegalAccessException, InvocationTargetException { - - return BeanUtils.getPropertyDescriptor(target.getClass(), idFieldName). - getReadMethod().invoke(target, new Object[0]); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java deleted file mode 100644 index b9b8968..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BulkActionResultModalPage.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionResultColumn; -import org.apache.syncope.common.lib.to.BulkActionResult; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; -import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; -import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.IModel; - -/** - * Show user or group status after performing a successful operation. - */ -public class BulkActionResultModalPage<T, S> extends BaseModalPage { - - /** - * Serial version id. - */ - private static final long serialVersionUID = 2646115294319713724L; - - public BulkActionResultModalPage( - final ModalWindow window, - final Collection<T> items, - final List<IColumn<T, S>> columns, - final BulkActionResult results, - final String idFieldName) { - - super(); - - final List<IColumn<T, S>> newColumnList = new ArrayList<>(columns.subList(1, columns.size() - 1)); - newColumnList.add(newColumnList.size(), new ActionResultColumn<T, S>(results, idFieldName)); - - final SortableDataProvider<T, S> dataProvider = new SortableDataProvider<T, S>() { - - private static final long serialVersionUID = 5291903859908641954L; - - @Override - public Iterator<? extends T> iterator(final long first, final long count) { - return items.iterator(); - } - - @Override - public long size() { - return items.size(); - } - - @Override - public IModel<T> model(final T object) { - return new CompoundPropertyModel<T>(object); - } - }; - - add(new AjaxFallbackDefaultDataTable<T, S>( - "selectedObjects", - newColumnList, - dataProvider, - Integer.MAX_VALUE).setVisible(items != null && !items.isEmpty())); - - final AjaxLink<Void> close = new IndicatingAjaxLink<Void>("close") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - window.close(target); - } - }; - - add(close); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/java/org/apache/syncope/client/console/pages/ConfModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ConfModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ConfModalPage.java deleted file mode 100644 index 0c65ac2..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ConfModalPage.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.apache.syncope.client.console.pages; - -import java.util.Collections; -import org.apache.commons.lang3.StringUtils; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.Mode; -import org.apache.syncope.client.console.panels.PlainAttrsPanel; -import org.apache.syncope.common.lib.to.AttrTO; -import org.apache.syncope.common.lib.to.ConfTO; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -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.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.ResourceModel; - -public class ConfModalPage extends BaseModalPage { - - private static final long serialVersionUID = 3524777398688399977L; - - public ConfModalPage(final PageReference pageRef, final ModalWindow window, final WebMarkupContainer parameters) { - super(); - - MetaDataRoleAuthorizationStrategy.authorize( - parameters, ENABLE, xmlRolesReader.getEntitlement("Configuration", "list")); - final ConfTO conf = confRestClient.list(); - - final Form<ConfTO> form = new Form<>("confForm"); - form.setModel(new CompoundPropertyModel<>(conf)); - - form.add(new PlainAttrsPanel("paramAttrs", conf, form, Mode.ADMIN)); - - final AjaxButton submit = new IndicatingAjaxButton(SUBMIT, new ResourceModel(SUBMIT)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - final ConfTO updatedConf = (ConfTO) form.getModelObject(); - - try { - for (AttrTO attr : updatedConf.getPlainAttrs()) { - attr.getValues().removeAll(Collections.singleton(null)); - if (attr.getValues().isEmpty() - || attr.getValues().equals(Collections.singletonList(StringUtils.EMPTY))) { - - confRestClient.delete(attr.getSchema()); - } else { - confRestClient.set(attr); - } - } - - if (pageRef.getPage() instanceof BasePage) { - ((BasePage) pageRef.getPage()).setModalResult(true); - } - - window.close(target); - } catch (Exception e) { - error(getString(Constants.ERROR) + ": " + e.getMessage()); - feedbackPanel.refresh(target); - } - } - - @Override - protected void onError(final AjaxRequestTarget target, final Form<?> form) { - feedbackPanel.refresh(target); - } - }; - MetaDataRoleAuthorizationStrategy.authorize( - submit, ENABLE, xmlRolesReader.getEntitlement("Configuration", "set")); - MetaDataRoleAuthorizationStrategy.authorize( - submit, ENABLE, xmlRolesReader.getEntitlement("Configuration", "delete")); - form.add(submit); - form.setDefaultButton(submit); - - final AjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - window.close(target); - } - }; - cancel.setDefaultFormProcessing(false); - form.add(cancel); - - add(form); - } -}
