Commit 8936b9db authored by Gianluca Filippone's avatar Gianluca Filippone
Browse files

Refactoring EE edit panel

parent 95e9c93f
......@@ -16,6 +16,7 @@
package org.apache.syncope.client.console.panels;
import java.io.Serializable;
import org.apache.syncope.client.console.rest.EnactmentEngineRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.EncryptedFieldPanel;
......@@ -29,6 +30,8 @@ public abstract class AbstractEnactmentEngineModalPanel extends AbstractModalPan
private static final long serialVersionUID = 1570261203472359825L;
protected final EnactmentEngineRestClient restClient;
protected final FieldPanel<String> nameInput;
protected final FieldPanel<String> usernameInput;
......@@ -42,6 +45,8 @@ public abstract class AbstractEnactmentEngineModalPanel extends AbstractModalPan
final PageReference pageRef) {
super(modal, pageRef);
this.restClient = new EnactmentEngineRestClient();
final WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
add(container);
......
......@@ -22,7 +22,6 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.BasePage;
import static org.apache.syncope.client.console.panels.AbstractModalPanel.LOG;
import org.apache.syncope.client.console.rest.EnactmentEngineRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.wicket.PageReference;
......@@ -33,12 +32,8 @@ public class AddEnactmentEngineModalPanel extends AbstractEnactmentEngineModalPa
private static final long serialVersionUID = -8997920710314548677L;
private final EnactmentEngineRestClient restClient;
public AddEnactmentEngineModalPanel(final BaseModal<Serializable> modal, final PageReference pageRef) {
super(modal, pageRef);
restClient = new EnactmentEngineRestClient();
}
@Override
......
......@@ -22,7 +22,6 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.pages.BasePage;
import static org.apache.syncope.client.console.panels.AbstractModalPanel.LOG;
import org.apache.syncope.client.console.rest.EnactmentEngineRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyObjectTO;
......@@ -36,15 +35,13 @@ public class EditEnactmentEngineModalPanel extends AbstractEnactmentEngineModalP
private final AnyObjectTO enactmentEngine;
private final EnactmentEngineRestClient restClient;
public EditEnactmentEngineModalPanel(
final BaseModal<Serializable> modal,
final PageReference pageRef,
final AnyObjectTO enactmentEngine) {
super(modal, pageRef);
this.enactmentEngine = enactmentEngine;
this.restClient = new EnactmentEngineRestClient();
nameInput.setModelObject(enactmentEngine.getName());
urlInput.setModelObject(enactmentEngine.getPlainAttrMap()
......
......@@ -53,7 +53,7 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
private static final long serialVersionUID = 7303610381539502741L;
private final BaseModal<Serializable> utilityModal = new BaseModal<>("outer");
private final BaseModal<Serializable> modal = new BaseModal<>("outer");
private final EnactmentEngineRestClient enactmentEngineRestClient;
......@@ -62,15 +62,18 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
this.enactmentEngineRestClient = new EnactmentEngineRestClient();
utilityModal.addSubmitButton();
utilityModal.size(Modal.Size.Medium);
addOuterObject(utilityModal);
modal.addSubmitButton();
modal.size(Modal.Size.Medium);
addOuterObject(modal);
modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = 8804221891699487139L;
utilityModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
@Override
public void onClose(final AjaxRequestTarget target) {
target.add(container);
utilityModal.show(false);
modal.show(false);
}
});
}
......@@ -94,6 +97,9 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
addPropertyColumn("name", ReflectionUtils.findField(AnyObjectTO.class, "name"), columns);
columns.add(new AbstractColumn<AnyObjectTO, String>(new ResourceModel("", "Base URL")) {
private static final long serialVersionUID = 2054811145491901166L;
@Override
public void populateItem(
final Item<ICellPopulator<AnyObjectTO>> item,
......@@ -140,11 +146,11 @@ public class EnactmentEngineDirectoryPanel extends AnyObjectDirectoryPanel {
@Override
public void onClick(final AjaxRequestTarget target) {
utilityModal.header(Model.of("Edit Enactment Engine"));
utilityModal.setContent(new EditEnactmentEngineModalPanel(
utilityModal, pageRef, model.getObject()));
utilityModal.show(true);
target.add(utilityModal);
modal.header(Model.of("Edit Enactment Engine"));
modal.setContent(new EditEnactmentEngineModalPanel(
modal, pageRef, model.getObject()));
modal.show(true);
target.add(modal);
}
}, ChoreographyActionsPanel.ChoreographyActionType.EDIT);
choreographyActionsPanel.addAction(new IndicatingAjaxLink<Void>("link") {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment