Author: pcraveiro
Date: 2012-03-26 17:55:14 -0400 (Mon, 26 Mar 2012)
New Revision: 1541
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/PicketLinkConsoleFramework.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/TrustDomain.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardStep.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardView.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizard.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizardStep1.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderRestartColumn.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/TrustDomainTable.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/WizardView.java
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/PicketLinkConsole.gwt.xml
console/trunk/gui/src/main/java/org/picketlink/as/console/client/BeanFactory.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/IdentityProvider.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/ServiceProvider.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractFederationDetails.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractModelElementTable.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/EditableFederationDetails.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationDetails.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationEditor.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationPresenter.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationTable.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationView.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/IdentityProviderDetails.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizard.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizardStep1.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderDetails.java
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderTable.java
Log:
Added more features.
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/PicketLinkConsole.gwt.xml
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/PicketLinkConsole.gwt.xml 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/PicketLinkConsole.gwt.xml 2012-03-26
21:55:14 UTC (rev 1541)
@@ -15,11 +15,17 @@
<module rename-to="PicketLinkConsole">
<inherits name="org.jboss.as.console.App" />
+
+ <generate-with
+ class="org.picketlink.as.console.rebind.extension.PicketLinkApplicationMetaDataGenerator">
+ <when-type-assignable
+ class="org.jboss.as.console.client.widgets.forms.ApplicationMetaData" />
+ </generate-with>
+
+ <replace-with
class="org.picketlink.as.console.client.PicketLinkConsoleFramework">
+ <when-type-is class="org.jboss.ballroom.client.spi.Framework" />
+ </replace-with>
- <generate-with
class="org.picketlink.as.console.rebind.extension.PicketLinkApplicationMetaDataGenerator">
- <when-type-assignable
class="org.jboss.as.console.client.widgets.forms.ApplicationMetaData" />
- </generate-with>
-
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/BeanFactory.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/BeanFactory.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/BeanFactory.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -25,6 +25,7 @@
import org.picketlink.as.console.client.shared.subsys.model.Federation;
import org.picketlink.as.console.client.shared.subsys.model.IdentityProvider;
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
import com.google.gwt.autobean.shared.AutoBean;
@@ -43,4 +44,6 @@
AutoBean<IdentityProvider> identityProvider();
AutoBean<ServiceProvider> serviceProvider();
+
+ AutoBean<TrustDomain> trustDomain();
}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/PicketLinkConsoleFramework.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/PicketLinkConsoleFramework.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/PicketLinkConsoleFramework.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client;
+
+import org.jboss.as.console.client.Console;
+import org.jboss.ballroom.client.spi.Framework;
+
+import com.google.gwt.autobean.shared.AutoBeanFactory;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.EventBus;
+import com.gwtplatform.mvp.client.proxy.PlaceManager;
+
+/**
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 20, 2012
+ */
+public class PicketLinkConsoleFramework implements Framework {
+
+ private final static BeanFactory factory = GWT.create(BeanFactory.class);
+
+ @Override
+ public EventBus getEventBus() {
+ return Console.MODULES.getEventBus();
+ }
+
+ @Override
+ public PlaceManager getPlaceManager() {
+ return Console.MODULES.getPlaceManager();
+ }
+
+ @Override
+ public AutoBeanFactory getBeanFactory() {
+ return factory;
+ }
+}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -23,8 +23,10 @@
package org.picketlink.as.console.client.shared.subsys.model;
import java.util.List;
+import java.util.Map;
import org.jboss.as.console.client.domain.model.SimpleCallback;
+import org.jboss.as.console.client.shared.model.ResponseWrapper;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -54,9 +56,87 @@
void loadIdentityProviders(Federation federation, final
AsyncCallback<List<IdentityProvider>> callback);
/**
+ * <p>
+ * Loads the service providers configurations given a federation instance.
+ * </p>
+ *
* @param federation
* @param simpleCallback
*/
void loadServiceProviders(Federation federation,
SimpleCallback<List<ServiceProvider>> simpleCallback);
+
+ /**
+ * <p>
+ * Create a new federation element configuration in the subsystem.
+ * </p>
+ *
+ * @param datasource
+ * @param callback
+ */
+ void createFederation(Federation federation,
AsyncCallback<ResponseWrapper<Boolean>> callback);
+
+ /**
+ * <p>
+ * Deletes a federation element configuration from the subsystem.
+ * </p>
+ *
+ * @param federation
+ * @param simpleCallback
+ */
+ void deleteFederation(Federation federation, SimpleCallback<Boolean>
simpleCallback);
+
+ /**
+ * @param identityProvider
+ * @param simpleCallback
+ */
+ void createIdentityProvider(Federation federation, IdentityProvider identityProvider,
SimpleCallback<ResponseWrapper<Boolean>> simpleCallback);
+
+ /**
+ * @param federation
+ * @param changedValues
+ * @param simpleCallback
+ */
+ void updateIdentityProvider(Federation federation, IdentityProvider identityProvider,
Map<String, Object> changedValues,
+ SimpleCallback<ResponseWrapper<Boolean>> simpleCallback);
+
+ /**
+ * @param currentFederation
+ * @param serviceProvider
+ * @param simpleCallback
+ */
+ void createServiceProvider(Federation currentFederation, ServiceProvider
serviceProvider,
+ SimpleCallback<ResponseWrapper<Boolean>> simpleCallback);
+
+ /**
+ * @param currentFederation
+ * @param trustDomain
+ * @param simpleCallback
+ */
+ void createTrustDomain(Federation currentFederation, IdentityProvider
identityProvider, TrustDomain trustDomain,
+ SimpleCallback<ResponseWrapper<Boolean>> simpleCallback);
+
+ /**
+ * @param currentFederation
+ * @param identityProvider
+ * @param simpleCallback
+ */
+ void loadTrustDomains(Federation currentFederation, IdentityProvider
identityProvider,
+ SimpleCallback<List<TrustDomain>> simpleCallback);
+
+ /**
+ * @param currentFederation
+ * @param identityProvider
+ * @param simpleCallback
+ */
+ void deleteTrustDomain(Federation currentFederation, IdentityProvider
identityProvider, TrustDomain trustDomain,
+ SimpleCallback<Boolean> callback);
+
+ /**
+ * @param currentFederation
+ * @param serviceProvider
+ * @param simpleCallback
+ */
+ void deleteServiceProvider(Federation currentFederation, ServiceProvider
serviceProvider,
+ SimpleCallback<Boolean> simpleCallback);
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,11 +22,17 @@
package org.picketlink.as.console.client.shared.subsys.model;
+import static org.jboss.dmr.client.ModelDescriptionConstants.ADD;
+import static org.jboss.dmr.client.ModelDescriptionConstants.ADDRESS;
import static org.jboss.dmr.client.ModelDescriptionConstants.OP;
+import static org.jboss.dmr.client.ModelDescriptionConstants.OUTCOME;
import static
org.jboss.dmr.client.ModelDescriptionConstants.READ_CHILDREN_RESOURCES_OPERATION;
+import static org.jboss.dmr.client.ModelDescriptionConstants.REMOVE;
import static org.jboss.dmr.client.ModelDescriptionConstants.RESULT;
+import static org.jboss.dmr.client.ModelDescriptionConstants.SUCCESS;
import java.util.List;
+import java.util.Map;
import javax.inject.Inject;
@@ -34,6 +40,8 @@
import org.jboss.as.console.client.shared.dispatch.DispatchAsync;
import org.jboss.as.console.client.shared.dispatch.impl.DMRAction;
import org.jboss.as.console.client.shared.dispatch.impl.DMRResponse;
+import org.jboss.as.console.client.shared.model.ModelAdapter;
+import org.jboss.as.console.client.shared.model.ResponseWrapper;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.as.console.client.widgets.forms.AddressBinding;
import org.jboss.as.console.client.widgets.forms.ApplicationMetaData;
@@ -63,6 +71,8 @@
private Baseadress baseadress;
private BeanMetaData identityProviderMetaData;
private BeanMetaData serviceProviderMetaData;
+ private BeanMetaData trustDomainMetaData;
+ private EntityAdapter<TrustDomain> trustDomainAdapter;
@Inject
public FederationStoreImpl(DispatchAsync dispatcher, ApplicationMetaData
propertyMetaData, Baseadress baseadress) {
@@ -72,12 +82,244 @@
this.federationMetaData = metaData.getBeanMetaData(Federation.class);
this.identityProviderMetaData =
metaData.getBeanMetaData(IdentityProvider.class);
this.serviceProviderMetaData = metaData.getBeanMetaData(ServiceProvider.class);
+ this.trustDomainMetaData = metaData.getBeanMetaData(TrustDomain.class);
this.federationAdapter = new EntityAdapter<Federation>(Federation.class,
propertyMetaData);
this.identityProviderAdapter = new
EntityAdapter<IdentityProvider>(IdentityProvider.class, propertyMetaData);
this.serviceProviderAdapter = new
EntityAdapter<ServiceProvider>(ServiceProvider.class, propertyMetaData);
+ this.trustDomainAdapter = new EntityAdapter<TrustDomain>(TrustDomain.class,
propertyMetaData);
}
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#createFederation(org.picketlink.as.console.client.shared.subsys.model.Federation,
com.google.gwt.user.client.rpc.AsyncCallback)
+ */
+ @Override
+ public void createFederation(final Federation federation, final
AsyncCallback<ResponseWrapper<Boolean>> callback) {
+ AddressBinding address = federationMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias());
+ ModelNode operation = federationAdapter.fromEntity(federation);
+ operation.get(OP).set(ADD);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+
+ callback.onSuccess(new ResponseWrapper<Boolean>(wasSuccessful,
modelNode));
+ }
+ });
+ }
+
/* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#createIdentityProvider(org.picketlink.as.console.client.shared.subsys.model.IdentityProvider,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void createIdentityProvider(Federation federation, final IdentityProvider
identityProvider,
+ final SimpleCallback<ResponseWrapper<Boolean>> callback) {
+ AddressBinding address = identityProviderMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), identityProvider.getAlias());
+
+ ModelNode operation = identityProviderAdapter.fromEntity(identityProvider);
+ operation.get(OP).set(ADD);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+
+ callback.onSuccess(new ResponseWrapper<Boolean>(wasSuccessful,
modelNode));
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#createServiceProvider(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.picketlink.as.console.client.shared.subsys.model.ServiceProvider,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void createServiceProvider(Federation federation, final ServiceProvider
serviceProvider,
+ final SimpleCallback<ResponseWrapper<Boolean>> callback) {
+ AddressBinding address = serviceProviderMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), serviceProvider.getAlias());
+
+ ModelNode operation = serviceProviderAdapter.fromEntity(serviceProvider);
+ operation.get(OP).set(ADD);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+
+ callback.onSuccess(new ResponseWrapper<Boolean>(wasSuccessful,
modelNode));
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#createTrustDomain(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.picketlink.as.console.client.shared.subsys.model.TrustDomain,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void createTrustDomain(Federation federation, IdentityProvider
identityProvider, TrustDomain trustDomain,
+ final SimpleCallback<ResponseWrapper<Boolean>> callback) {
+ AddressBinding address = trustDomainMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), identityProvider.getAlias(), trustDomain.getName());
+
+ ModelNode operation = trustDomainAdapter.fromEntity(trustDomain);
+ operation.get(OP).set(ADD);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+
+ callback.onSuccess(new ResponseWrapper<Boolean>(wasSuccessful,
modelNode));
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#updateIdentityProvider(org.picketlink.as.console.client.shared.subsys.model.Federation,
java.util.Map, org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void updateIdentityProvider(Federation federation, IdentityProvider
identityProvider, Map<String, Object> changedValues,
+ final SimpleCallback<ResponseWrapper<Boolean>> callback) {
+ AddressBinding address = this.identityProviderMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), identityProvider.getAlias());
+ ModelNode operation = this.identityProviderAdapter.fromChangeset(changedValues,
addressModel);
+
+ dispatcher.execute(new DMRAction(operation), new
AsyncCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+
+ callback.onSuccess(ModelAdapter.wrapBooleanResponse(result));
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#deleteFederation(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void deleteFederation(Federation federation, final
SimpleCallback<Boolean> callback) {
+ AddressBinding address = this.federationMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias());
+
+ ModelNode operation = federationAdapter.fromEntity(federation);
+ operation.get(OP).set(REMOVE);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+ callback.onSuccess(wasSuccessful);
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#deleteTrustDomain(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.picketlink.as.console.client.shared.subsys.model.IdentityProvider,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void deleteTrustDomain(Federation federation, IdentityProvider
identityProvider, TrustDomain trustDomain,
+ final SimpleCallback<Boolean> callback) {
+ AddressBinding address = this.trustDomainMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), identityProvider.getAlias(), trustDomain.getName());
+
+ ModelNode operation = trustDomainAdapter.fromEntity(trustDomain);
+ operation.get(OP).set(REMOVE);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+ callback.onSuccess(wasSuccessful);
+ }
+ });
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#deleteServiceProvider(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.picketlink.as.console.client.shared.subsys.model.ServiceProvider,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void deleteServiceProvider(Federation federation, ServiceProvider
serviceProvider,
+ final SimpleCallback<Boolean> callback) {
+ AddressBinding address = this.serviceProviderMetaData.getAddress();
+ ModelNode addressModel = address.asResource(baseadress.getAdress(),
federation.getAlias(), serviceProvider.getAlias());
+
+ ModelNode operation = serviceProviderAdapter.fromEntity(serviceProvider);
+ operation.get(OP).set(REMOVE);
+ operation.get(ADDRESS).set(addressModel.get(ADDRESS));
+
+ dispatcher.execute(new DMRAction(operation), new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode modelNode = result.get();
+ boolean wasSuccessful =
modelNode.get(OUTCOME).asString().equals(SUCCESS);
+ callback.onSuccess(wasSuccessful);
+ }
+ });
+ }
+
+ /* (non-Javadoc)
* @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#loadFederations(com.google.gwt.user.client.rpc.AsyncCallback)
*/
@Override
@@ -162,4 +404,34 @@
});
}
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.shared.subsys.model.FederationStore#loadTrustDomains(org.picketlink.as.console.client.shared.subsys.model.Federation,
org.picketlink.as.console.client.shared.subsys.model.IdentityProvider,
org.jboss.as.console.client.domain.model.SimpleCallback)
+ */
+ @Override
+ public void loadTrustDomains(Federation federation, IdentityProvider
identityProvider,
+ final SimpleCallback<List<TrustDomain>> callback) {
+ AddressBinding address = this.trustDomainMetaData.getAddress();
+
+ ModelNode operation = address.asSubresource(federation.getAlias(),
identityProvider.getAlias());
+ operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
+
+ dispatcher.execute(new DMRAction(operation), new
AsyncCallback<DMRResponse>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ callback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(DMRResponse result) {
+ ModelNode response = result.get();
+
+ if (response.isFailure()) {
+ callback.onFailure(new
RuntimeException(response.getFailureDescription()));
+ } else {
+ List<TrustDomain> datasources =
trustDomainAdapter.fromDMRList(response.get(RESULT).asList());
+ callback.onSuccess(datasources);
+ }
+ }
+ });
+ }
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/IdentityProvider.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/IdentityProvider.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/IdentityProvider.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,6 +22,7 @@
package org.picketlink.as.console.client.shared.subsys.model;
+import org.jboss.as.console.client.shared.model.DeploymentRecord;
import org.jboss.as.console.client.widgets.forms.Address;
import org.jboss.as.console.client.widgets.forms.Binding;
@@ -33,7 +34,7 @@
* @since Mar 14, 2012
*/
@Address("/subsystem=picketlink/federation={0}/identity-provider={1}")
-public interface IdentityProvider {
+public interface IdentityProvider extends DeploymentRecord {
@Binding(key = true)
String getAlias();
@@ -44,11 +45,11 @@
void setUrl(String url);
@Binding (detypedName="signOutgoingMessages")
- String getSignOutgoingMessages();
- void setSignOutgoingMessages(String url);
+ boolean isSignOutgoingMessages();
+ void setSignOutgoingMessages(boolean url);
@Binding (detypedName="ignoreIncomingSignatures")
- String getIgnoreIncomingSignatures();
- void setIgnoreIncomingSignatures(String url);
+ boolean isIgnoreIncomingSignatures();
+ void setIgnoreIncomingSignatures(boolean url);
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/ServiceProvider.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/ServiceProvider.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/ServiceProvider.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,6 +22,7 @@
package org.picketlink.as.console.client.shared.subsys.model;
+import org.jboss.as.console.client.shared.model.DeploymentRecord;
import org.jboss.as.console.client.widgets.forms.Address;
import org.jboss.as.console.client.widgets.forms.Binding;
@@ -29,18 +30,22 @@
* <p>Federation bean definition.</p>
* <p>This interface also defines the address to be used when using the AS7
management API.</p>
*
- * @author Pedro Silva
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 14, 2012
*/
@Address("/subsystem=picketlink/federation={0}/service-provider={0}")
-public interface ServiceProvider {
+public interface ServiceProvider extends DeploymentRecord {
@Binding(key = true)
String getAlias();
void setAlias(String alias);
- @Binding(key = true)
+ @Binding
String getUrl();
void setUrl(String url);
+
+ @Binding (detypedName="post-binding")
+ boolean isPostBinding();
+ void setPostBinding(boolean postBinding);
}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/TrustDomain.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/TrustDomain.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/TrustDomain.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.shared.subsys.model;
+
+import org.jboss.as.console.client.widgets.forms.Address;
+import org.jboss.as.console.client.widgets.forms.Binding;
+
+/**
+ * <p>TrustDomain bean definition.</p>
+ * <p>This interface also defines the address to be used when using the AS7
management API.</p>
+ *
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 14, 2012
+ */
+@Address("/subsystem=picketlink/federation={0}/identity-provider={0}/trust-domain={0}")
+public interface TrustDomain {
+
+ @Binding(key = true)
+ String getName();
+ void setName(String name);
+
+}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractFederationDetails.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractFederationDetails.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractFederationDetails.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -23,9 +23,11 @@
package org.picketlink.as.console.client.ui.federation;
import java.util.List;
+import java.util.Map;
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.shared.viewframework.builder.FormLayout;
+import org.jboss.as.console.client.widgets.forms.FormToolStrip;
import org.jboss.ballroom.client.widgets.forms.Form;
import org.jboss.ballroom.client.widgets.forms.FormItem;
import org.jboss.dmr.client.ModelNode;
@@ -42,7 +44,8 @@
private Form<T> form;
private IdentityProvider entityInstance;
-
+ private VerticalPanel detailPanel;
+
public AbstractFederationDetails() {
this.form = new Form(getEntityClass());
this.form.setNumColumns(2);
@@ -54,8 +57,8 @@
protected abstract Class<?> getEntityClass();
public Widget asWidget() {
- VerticalPanel detailPanel = new VerticalPanel();
- detailPanel.setStyleName("fill-layout-width");
+ this.detailPanel = new VerticalPanel();
+ this.detailPanel.setStyleName("fill-layout-width");
List<FormItem<?>> formItems = getFormItems();
@@ -65,6 +68,24 @@
Widget formWidget = form.asWidget();
+ FormToolStrip<T> toolStrip = new FormToolStrip<T>(
+ form,
+ new FormToolStrip.FormCallback<T>() {
+ @Override
+ public void onSave(Map<String, Object> changeset) {
+ doOnSave(changeset);
+ }
+
+ @Override
+ public void onDelete(T entity) {
+
+ }
+ });
+
+ toolStrip.providesDeleteOp(false);
+
+ detailPanel.add(toolStrip.asWidget());
+
final FormHelpPanel helpPanel = new FormHelpPanel(new
FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
@@ -73,11 +94,15 @@
}, form);
- detailPanel.add(formWidget);
+ this.detailPanel.add(formWidget);
- return new FormLayout().setHelp(helpPanel).setForm(form).build();
+ return new
FormLayout().setHelp(helpPanel).setForm(form).setSetTools(toolStrip).build();
}
+ protected void doOnSave(Map<String, Object> changeset) {
+
+ }
+
protected abstract ModelNode getHelpModelAddress();
/**
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractModelElementTable.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractModelElementTable.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractModelElementTable.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,10 +22,13 @@
package org.picketlink.as.console.client.ui.federation;
+import java.util.List;
+
import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
import org.jboss.ballroom.client.widgets.tables.DefaultPager;
+import org.picketlink.as.console.client.shared.subsys.model.Federation;
-import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.ListDataProvider;
@@ -61,6 +64,7 @@
*
* @return
*/
+ @SuppressWarnings("unchecked")
public DefaultCellTable<T> getCellTable() {
if (this.dataTable == null) {
this.dataTable = new DefaultCellTable<T>(
@@ -71,9 +75,7 @@
return doGetKey(item);
}
});
-
doAddConlumns(this.dataTable);
-
}
return this.dataTable;
@@ -84,7 +86,7 @@
/**
* @param federationTable2
*/
- protected abstract void doAddConlumns(DefaultCellTable<T> federationTable);
+ protected abstract void doAddConlumns(CellTable federationTable);
/**
* Returns a instance of {@link ListDataProvider} to be used to manipulate table
items.
@@ -99,5 +101,13 @@
return this.dataProvider;
}
+
+ /**
+ * @param datasources
+ */
+ public void setList(List<T> items) {
+ this.getDataProvider().setList(items);
+ }
+
}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardStep.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardStep.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardStep.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.as.console.client.Console;
+import org.jboss.as.console.client.shared.help.FormHelpPanel;
+import org.jboss.ballroom.client.widgets.forms.Form;
+import org.jboss.ballroom.client.widgets.forms.FormItem;
+import org.jboss.ballroom.client.widgets.forms.FormValidation;
+import org.jboss.ballroom.client.widgets.window.DialogueOptions;
+import org.jboss.ballroom.client.widgets.window.WindowContentBuilder;
+import org.jboss.dmr.client.ModelNode;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 23, 2012
+ */
+public abstract class AbstractWizardStep<T> {
+
+ private WizardView wizard;
+ private Class entityClass;
+ private String title;
+ private Form<T> form;
+ private List<FormItem> formItems;
+
+ public AbstractWizardStep(String title, WizardView wizard, Class entityClass) {
+ this.wizard = wizard;
+ this.entityClass = entityClass;
+ this.title = title;
+ }
+
+ public Widget asWidget() {
+ VerticalPanel layout = new VerticalPanel();
+
+ layout.setStyleName("window-content");
+ layout.add(new HTML("<h3>" + this.title +
"</h3>"));
+
+ form = new Form<T>(this.entityClass);
+
+ doAddFormItems(form);
+
+ form.setFields(this.formItems.toArray(new FormItem[this.formItems.size()]));
+
+ final FormHelpPanel helpPanel = new FormHelpPanel(
+ new FormHelpPanel.AddressCallback() {
+ @Override
+ public ModelNode getAddress() {
+ return doGetHelpAddress();
+ }
+ }, form
+ );
+
+ layout.add(helpPanel.asWidget());
+
+ layout.add(form.asWidget());
+
+ ClickHandler submitHandler = new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ FormValidation validation = form.validate();
+ if(!validation.hasErrors())
+ {
+ wizard.onSave(form.getUpdatedEntity());
+ wizard.onClose();
+ }
+ }
+ };
+
+ ClickHandler cancelHandler = new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ wizard.onClose();
+ }
+ };
+
+ DialogueOptions options = new DialogueOptions(
+ Console.CONSTANTS.common_label_save(),submitHandler,
+ Console.CONSTANTS.common_label_cancel(),cancelHandler
+ );
+
+ return new WindowContentBuilder(layout, options).build();
+ }
+
+ /**
+ * @return
+ */
+ protected abstract void doAddFormItems(Form<T> form);
+
+ protected void addFormItem(FormItem formItem) {
+ if (this.formItems == null) {
+ this.formItems = new ArrayList<FormItem>();
+ }
+
+ this.formItems.add(formItem);
+ }
+
+ /**
+ * @return
+ */
+ protected ModelNode doGetHelpAddress() {
+ return null;
+ }
+
+}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardView.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardView.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/AbstractWizardView.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import org.jboss.as.console.client.Console;
+import org.jboss.ballroom.client.widgets.window.DefaultWindow;
+
+import com.google.gwt.user.client.ui.DeckPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtplatform.mvp.client.Presenter;
+
+/**
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 23, 2012
+ */
+public abstract class AbstractWizardView<P extends Presenter, T> implements
WizardView<P, T> {
+
+ private P presenter;
+ private DeckPanel deck;
+ private DefaultWindow window;
+ private String title;
+
+ public AbstractWizardView(String title, P presenter) {
+ this.presenter = presenter;
+ this.title = title;
+ }
+
+ public Widget asWidget() {
+ deck = new DeckPanel();
+
+ doAddSteps(deck);
+
+ deck.showWidget(0);
+
+ return deck;
+ }
+
+ /**
+ * @param deck2
+ */
+ protected abstract void doAddSteps(DeckPanel deck);
+
+ /**
+ * Lunch this wizard.
+ */
+ public void lunch() {
+ window = new DefaultWindow(Console.MESSAGES.createTitle(this.title));
+ window.setWidth(480);
+ window.setHeight(450);
+
+ window.setWidget(this.asWidget());
+
+ window.setGlassEnabled(true);
+ window.center();
+ }
+
+ /**
+ * <p>
+ * Callback method called when the user wants to close/cancel the wizard.
+ * </p>
+ */
+ public void onClose() {
+ window.hide();
+ }
+
+ public P getPresenter() {
+ return this.presenter;
+ }
+
+}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/EditableFederationDetails.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/EditableFederationDetails.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/EditableFederationDetails.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -41,7 +41,7 @@
/**
* This class defines the widget to be displayed when a federation instance is selected.
*
- * @author Pedro Silva
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 14, 2012
*/
public class EditableFederationDetails {
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationDetails.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationDetails.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationDetails.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -25,13 +25,21 @@
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.shared.subsys.Baseadress;
import org.jboss.as.console.client.shared.viewframework.builder.FormLayout;
+import org.jboss.as.console.client.widgets.ContentDescription;
+import org.jboss.ballroom.client.widgets.ContentGroupLabel;
import org.jboss.ballroom.client.widgets.forms.Form;
+import org.jboss.ballroom.client.widgets.forms.TextBoxItem;
import org.jboss.ballroom.client.widgets.forms.TextItem;
import org.jboss.ballroom.client.widgets.tools.ToolButton;
+import org.jboss.ballroom.client.widgets.tools.ToolStrip;
import org.jboss.dmr.client.ModelNode;
import org.picketlink.as.console.client.shared.subsys.model.Federation;
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.cellview.client.CellTable;
+import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -46,13 +54,15 @@
public class FederationDetails {
private Form<Federation> form;
+ private Form<TrustDomain> trustDomainForm;
+ private TrustDomainTable trustDomainTable;
private FederationPresenter presenter;
- private ToolButton disableBtn;
- public FederationDetails(FederationPresenter presenter) {
+ public FederationDetails(CellTable<Federation> table, FederationPresenter
presenter) {
+ this.form = new Form<Federation>(Federation.class);
+ this.form.setNumColumns(2);
+ this.form.bind(table);
this.presenter = presenter;
- form = new Form(Federation.class);
- form.setNumColumns(2);
}
public Widget asWidget() {
@@ -65,8 +75,68 @@
form.setEnabled(false);
- Widget formWidget = form.asWidget();
+ final FormHelpPanel helpPanel = createHelpPanel();
+
+ detailPanel.add(new FormLayout().setHelp(helpPanel).setForm(form).build());
+ VerticalPanel trustDomainsHeader = new VerticalPanel();
+
+ trustDomainsHeader.setStyleName("fill-layout-width");
+
+ trustDomainsHeader.add(new ContentGroupLabel("Trusted Domains"));
+
+ this.trustDomainForm = new Form<TrustDomain>(TrustDomain.class);
+
+ this.trustDomainForm.setFields(new TextBoxItem("name",
"Name"));
+
+ trustDomainsHeader.add(this.trustDomainForm.asWidget());
+
+ ToolStrip trustDomainTools = new ToolStrip();
+
+ ToolButton addTrustedDomainBtn = new ToolButton("Add");
+
+ addTrustedDomainBtn.addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(ClickEvent event) {
+ presenter.onCreateTrustDomain(trustDomainForm.getUpdatedEntity());
+ }
+ });
+
+ trustDomainTools.addToolButtonRight(addTrustedDomainBtn);
+
+ ToolButton removeTrustedDomainBtn = new ToolButton("Remove");
+
+ removeTrustedDomainBtn.addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(ClickEvent event) {
+
presenter.onRemoveTrustDomain(getTrustDomainTable().getSelectedTrustedDomain());
+ }
+ });
+
+ trustDomainTools.addToolButtonRight(removeTrustedDomainBtn);
+
+ trustDomainTools.setStyleName("fill-layout-width");
+
+ trustDomainsHeader.add(trustDomainTools);
+
+ trustDomainsHeader.add(new ContentDescription(""));
+
+ detailPanel.add(trustDomainsHeader);
+ detailPanel.add(getTrustDomainTable().asWidget());
+
+ return detailPanel;
+ }
+
+ /**
+ * <p>
+ * Creates a instance of {@link FormHelpPanel} to show descriptions about the
federation.
+ * </p>
+ *
+ * @return
+ */
+ private FormHelpPanel createHelpPanel() {
final FormHelpPanel helpPanel = new FormHelpPanel(new
FormHelpPanel.AddressCallback() {
@Override
public ModelNode getAddress() {
@@ -76,22 +146,16 @@
return address;
}
}, form);
-
- detailPanel.add(formWidget);
-
- return new FormLayout().setHelp(helpPanel).setForm(form).build();
+
+ return helpPanel;
}
+
+ public TrustDomainTable getTrustDomainTable() {
+ if (this.trustDomainTable == null) {
+ this.trustDomainTable = new TrustDomainTable();
+ }
- public void bind(CellTable<Federation> dataSourceTable) {
- form.bind(dataSourceTable);
+ return this.trustDomainTable;
}
- public void setEnabled(boolean b) {
- form.setEnabled(b);
- }
-
- public Federation getCurrentSelection() {
- return form.getEditedEntity();
- }
-
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationEditor.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationEditor.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationEditor.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -25,26 +25,22 @@
import java.util.List;
import org.jboss.as.console.client.Console;
-import org.jboss.as.console.client.shared.subsys.jca.DataSourcePresenter;
-import org.jboss.as.console.client.shared.subsys.jca.wizard.NewDatasourceWizard;
import org.jboss.as.console.client.widgets.ContentDescription;
import org.jboss.ballroom.client.widgets.ContentGroupLabel;
import org.jboss.ballroom.client.widgets.ContentHeaderLabel;
import org.jboss.ballroom.client.widgets.tools.ToolButton;
import org.jboss.ballroom.client.widgets.tools.ToolStrip;
-import org.jboss.ballroom.client.widgets.window.DefaultWindow;
import org.jboss.ballroom.client.widgets.window.Feedback;
-import org.picketlink.as.console.client.BeanFactory;
import org.picketlink.as.console.client.shared.subsys.model.Federation;
import org.picketlink.as.console.client.shared.subsys.model.IdentityProvider;
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
import com.google.gwt.dom.client.Style;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -64,35 +60,34 @@
*/
public class FederationEditor {
- /**
- *
- */
private static final String EDITOR_DESCRIPTION = "The PicketLink Federation
provides the configurations for IDPs and SPs given a federation configuration.";
-
private static final String EDITOR_LABEL_TEXT = "Federation";
private FederationPresenter presenter;
- private FederationTable federationTable;
private FederationDetails federationDetails;
-
private IdentityProviderDetails identityProviderDetails;
-
private ServiceProviderDetails serviceProviderDetails;
- private DefaultWindow window;
+ private WizardView newFederationWizard;
- private BeanFactory beanFactory;
+ private FederationTable federationTable;
- public FederationEditor(FederationPresenter presenter, BeanFactory beanFactory) {
+ public FederationEditor(FederationPresenter presenter) {
this.presenter = presenter;
- this.beanFactory = beanFactory;
}
+ /**
+ * <p>
+ * Creates the widget for this component.
+ * </p>
+ *
+ * @return
+ */
public Widget asWidget() {
LayoutPanel layout = new LayoutPanel();
VerticalPanel vpanel = new VerticalPanel();
-
+
vpanel.setStyleName("rhs-content-panel");
ScrollPanel scroll = new ScrollPanel(vpanel);
@@ -120,7 +115,7 @@
*/
private void addSelectionWidgets(VerticalPanel vpanel) {
vpanel.add(new ContentGroupLabel(Console.CONSTANTS.common_label_selection()));
-
+
TabPanel bottomPanel = new TabPanel();
bottomPanel.setStyleName("default-tabpanel");
@@ -128,9 +123,8 @@
bottomPanel.add(getFederationDetails().asWidget(), "General");
bottomPanel.add(getIdentityProvidersDetails().asWidget(), "Identity
Provider");
bottomPanel.add(getServiceProviderDetails().asWidget(), "Service
Providers");
- bottomPanel.add(new SimplePanel(), "Digital Certificates");
bottomPanel.selectTab(0);
-
+
addSelectionChangeHandler();
vpanel.add(bottomPanel);
@@ -141,7 +135,7 @@
*/
private ServiceProviderDetails getServiceProviderDetails() {
if (this.serviceProviderDetails == null) {
- this.serviceProviderDetails = new ServiceProviderDetails();
+ this.serviceProviderDetails = new ServiceProviderDetails(this.presenter);
}
return this.serviceProviderDetails;
@@ -149,18 +143,17 @@
/**
* <p>
- * Adds a {@link SelectionChangeEvent.Handler} to handle selection from the table.
- * This method must be called after the
<code>addSelectionWidgets</code>.
+ * Adds a {@link SelectionChangeEvent.Handler} to handle selection from the table.
This method must be called after the
+ * <code>addSelectionWidgets</code>.
* </p>
*/
private void addSelectionChangeHandler() {
- SingleSelectionModel<Federation> selectionModel =
(SingleSelectionModel<Federation>) this.getFederationTable()
- .getCellTable().getSelectionModel();
+ SingleSelectionModel<Federation> selectionModel = getCurrentFederation();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ @SuppressWarnings("unchecked")
@Override
public void onSelectionChange(SelectionChangeEvent event) {
- getFederationDetails().setEnabled(false);
presenter.loadIdentityProvider(((SingleSelectionModel<Federation>)
event.getSource()).getSelectedObject());
presenter.loadServiceProviders(((SingleSelectionModel<Federation>)
event.getSource()).getSelectedObject());
}
@@ -168,8 +161,25 @@
}
/**
- * Adds the widgtes related with the table from which items can be selected, addes or
removed.
+ * Returns the selected federation instance from the table.
*
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public SingleSelectionModel<Federation> getCurrentFederation() {
+ SingleSelectionModel<Federation> selectionModel =
(SingleSelectionModel<Federation>) this.getFederationTable()
+ .getCellTable().getSelectionModel();
+
+ if (selectionModel.getSelectedObject() == null &&
!this.getFederationTable().getDataProvider().getList().isEmpty()) {
+
selectionModel.setSelected(this.getFederationTable().getDataProvider().getList().get(0),
true);
+ }
+
+ return selectionModel;
+ }
+
+ /**
+ * Adds the widgtes related with the table from which items can be selected, added or
removed.
+ *
* @param vpanel
*/
private void addTableWidgets(VerticalPanel vpanel) {
@@ -181,11 +191,9 @@
/**
* @return
*/
- @SuppressWarnings("unchecked")
private FederationDetails getFederationDetails() {
if (this.federationDetails == null) {
- this.federationDetails = new FederationDetails(this.presenter);
- this.federationDetails.bind(getFederationTable().getCellTable());
+ this.federationDetails = new
FederationDetails(getFederationTable().getCellTable(), this.presenter);
}
return this.federationDetails;
@@ -203,6 +211,11 @@
}
/**
+ * <p>
+ * Creates the top level actions that can be used to maintain the federation table
items.
+ * Basically add and remove federation instances.
+ * </p>
+ *
* @return
*/
private ToolStrip createTopLevelActions() {
@@ -210,7 +223,7 @@
topLevelTools.addToolButtonRight(createAddFederationButton());
topLevelTools.addToolButtonRight(createDeleteFederationButton());
-
+
return topLevelTools;
}
@@ -226,24 +239,11 @@
@Override
public void onClick(ClickEvent event) {
- lunchNewFederationWizard();
+ getNewFederationWizard().lunch();
}
});
}
- private void lunchNewFederationWizard() {
- window = new
DefaultWindow(Console.MESSAGES.createTitle("Federation"));
- window.setWidth(480);
- window.setHeight(450);
-
- window.setWidget(
- new NewFederationWizard(this.presenter, this).asWidget()
- );
-
- window.setGlassEnabled(true);
- window.center();
- }
-
/**
* <p>
* Creates a instance of {@link ToolButton} to delete federation instances from the
table.
@@ -256,7 +256,7 @@
@Override
public void onClick(ClickEvent event) {
- final Federation currentSelection =
getFederationDetails().getCurrentSelection();
+ final Federation currentSelection =
getCurrentFederation().getSelectedObject();
if (currentSelection != null) {
Feedback.confirm(Console.MESSAGES.deleteTitle(EDITOR_LABEL_TEXT),
@@ -265,7 +265,7 @@
@Override
public void onConfirmation(boolean isConfirmed) {
if (isConfirmed) {
- presenter.onDelete(currentSelection);
+ presenter.onRemoveFederation(currentSelection);
}
}
});
@@ -281,29 +281,22 @@
}
/**
- * Updates the table wich the federation instances are listed.
+ * <p>
+ * Updates the table from which the federation instances are listed.
+ * </p>
*
* @param datasources
*/
public void updateFederations(List<Federation> datasources) {
- getFederationTable().getDataProvider().setList(datasources);
+ getFederationTable().setList(datasources);
getFederationTable().getCellTable().selectDefaultEntity();
}
/**
- * Returns a instance of the table to be used to show the federation instances.
+ * <p>
+ * Updates the informations about a identity provider for a selected federation
instance.
+ * </p>
*
- * @return
- */
- private FederationTable getFederationTable() {
- if (this.federationTable == null) {
- this.federationTable = new FederationTable();
- }
-
- return this.federationTable;
- }
-
- /**
* @param identityProviders
*/
public void updateIdentityProviders(List<IdentityProvider> identityProviders)
{
@@ -311,23 +304,58 @@
}
/**
+ * <p>
+ * Updates the informations about service providers for a selected federation
instance.
+ * </p>
+ *
* @param result
*/
public void updateServiceProviders(List<ServiceProvider> result) {
this.getServiceProviderDetails().updateServiceProviders(result);
}
+
+ /**
+ * <p>
+ * Updates the informations about the trusted domains.
+ * </p>
+ *
+ * @param result
+ */
+ public void updateTrustDomains(List<TrustDomain> result) {
+ this.getFederationDetails().getTrustDomainTable().setList(result);
+
getFederationDetails().getTrustDomainTable().getCellTable().selectDefaultEntity();
+ }
+
/**
+ * Returns a instance of the table used to show the federation instances.
*
+ * @return
*/
- public void closeDialogue() {
- window.hide();
+ private FederationTable getFederationTable() {
+ if (this.federationTable == null) {
+ this.federationTable = new FederationTable();
+ }
+
+ return this.federationTable;
}
/**
- * @return the beanFactory
+ * @return the newFederationWizard
*/
- public BeanFactory getBeanFactory() {
- return this.beanFactory;
+ public WizardView getNewFederationWizard() {
+ if (this.newFederationWizard == null) {
+ this.newFederationWizard = new NewFederationWizard(this.presenter);
+ }
+
+ return this.newFederationWizard;
}
+
+ /**
+ * @return
+ */
+ public IdentityProvider getIdentityProvider() {
+ return this.getIdentityProvidersDetails().getIdentityProvider();
+ }
+
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationPresenter.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationPresenter.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationPresenter.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -21,20 +21,33 @@
*/
package org.picketlink.as.console.client.ui.federation;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import org.jboss.as.console.client.Console;
+import org.jboss.as.console.client.domain.model.ServerGroupRecord;
import org.jboss.as.console.client.domain.model.SimpleCallback;
+import org.jboss.as.console.client.shared.deployment.DeployCommandExecutor;
+import org.jboss.as.console.client.shared.dispatch.impl.DMRResponse;
+import org.jboss.as.console.client.shared.model.DeploymentRecord;
+import org.jboss.as.console.client.shared.model.DeploymentStore;
+import org.jboss.as.console.client.shared.model.ResponseWrapper;
import org.jboss.as.console.client.shared.subsys.RevealStrategy;
import org.jboss.ballroom.client.layout.LHSHighlightEvent;
+import org.jboss.ballroom.client.widgets.window.Feedback;
+import org.jboss.dmr.client.ModelNode;
import org.picketlink.as.console.client.BeanFactory;
import org.picketlink.as.console.client.NameTokens;
import org.picketlink.as.console.client.shared.subsys.model.Federation;
import org.picketlink.as.console.client.shared.subsys.model.FederationStore;
import org.picketlink.as.console.client.shared.subsys.model.IdentityProvider;
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.ui.PopupPanel;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
@@ -52,30 +65,56 @@
* @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since 03/01/2011
*/
-public class FederationPresenter extends Presenter<FederationPresenter.MyView,
FederationPresenter.MyProxy> {
+public class FederationPresenter extends Presenter<FederationPresenter.MyView,
FederationPresenter.MyProxy> implements DeployCommandExecutor {
public interface MyView extends View {
void setPresenter(FederationPresenter presenter);
-
+
/**
* <p>
* Updates the view with federations instances configured in the subsystem.
* </p>
+ *
* @param federations
*/
void updateFederations(List<Federation> federations);
/**
- * Updates the view with the informations about a identity provider.
+ * <p>
+ * Updates the view with informations about a identity provider.
+ * </p>
*
- * @param result
+ * @param identityProviders
*/
- void updateIdentityProviders(List<IdentityProvider> result);
+ void updateIdentityProviders(List<IdentityProvider> identityProviders);
/**
+ * <p>
+ * Updates the view with informations about service providers.
+ * </p>
+ *
+ * @param serviceProviders
+ */
+ void updateServiceProviders(List<ServiceProvider> serviceProviders);
+
+ /**
+ * <p>
+ * Returns the current selected federation instance.
+ * </p>
+ *
+ * @return
+ */
+ Federation getCurrentFederation();
+
+ /**
+ * @return
+ */
+ IdentityProvider getIdentityProvider();
+
+ /**
* @param result
*/
- void updateServiceProviders(List<ServiceProvider> result);
+ void updateTrustDomains(List<TrustDomain> result);
}
@ProxyCodeSplit
@@ -84,19 +123,25 @@
}
private final RevealStrategy revealStrategy;
- private FederationStore federationStore;
- private BeanFactory beanFactory;
+ private final FederationStore federationStore;
+ private final DeploymentStore deploymentStore;
+ private final BeanFactory beanFactory;
+ private List<DeploymentRecord> availableDeployments;
@Inject
public FederationPresenter(final EventBus eventBus, BeanFactory beanFactory, final
MyView view, final MyProxy proxy,
- final PlaceManager placeManager, RevealStrategy revealStrategy,
FederationStore federationStore) {
+ final PlaceManager placeManager, RevealStrategy revealStrategy,
FederationStore federationStore,
+ DeploymentStore deploymentStore) {
super(eventBus, view, proxy);
this.revealStrategy = revealStrategy;
this.federationStore = federationStore;
+ this.deploymentStore = deploymentStore;
this.beanFactory = beanFactory;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.gwtplatform.mvp.client.PresenterWidget#onReveal()
*/
@Override
@@ -110,7 +155,9 @@
});
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.gwtplatform.mvp.client.Presenter#revealInParent()
*/
@Override
@@ -118,16 +165,21 @@
this.revealStrategy.revealInParent(this);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.gwtplatform.mvp.client.HandlerContainerImpl#onBind()
*/
@Override
protected void onBind() {
super.onBind();
+ loadDeployments();
getView().setPresenter(this);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.gwtplatform.mvp.client.PresenterWidget#onReset()
*/
@Override
@@ -137,6 +189,13 @@
}
/**
+ * @return the availableDeployments
+ */
+ public List<DeploymentRecord> getAvailableDeployments() {
+ return this.availableDeployments;
+ }
+
+ /**
* <p>
* Loads the federation instances from the subsystem.
* </p>
@@ -146,10 +205,22 @@
@Override
public void onSuccess(List<Federation> result) {
getView().updateFederations(result);
+ loadIdentityProvider(getView().getCurrentFederation());
}
});
}
-
+
+ public void loadDeployments() {
+ // load deployments
+ deploymentStore.loadDeploymentContent(new
SimpleCallback<List<DeploymentRecord>>() {
+
+ @Override
+ public void onSuccess(List<DeploymentRecord> result) {
+ availableDeployments = result;
+ }
+ });
+ }
+
/**
* <p>
* Loads the federation instances from the subsystem.
@@ -160,11 +231,16 @@
@Override
public void onSuccess(List<IdentityProvider> result) {
getView().updateIdentityProviders(result);
+ loadTrustDomain();
}
});
}
-
+
/**
+ * <p>
+ * Loads the service providers instances from the subsystem, given a selected
federation instance.
+ * </p>
+ *
* @param federation
*/
public void loadServiceProviders(Federation federation) {
@@ -175,22 +251,112 @@
}
});
}
+
+ /**
+ * <p>
+ * Loads the service providers instances from the subsystem, given a selected
federation instance.
+ * </p>
+ *
+ * @param federation
+ */
+ public void loadTrustDomain() {
+ if (getView().getIdentityProvider() != null) {
+ this.federationStore.loadTrustDomains(getView().getCurrentFederation(),
getView().getIdentityProvider(), new SimpleCallback<List<TrustDomain>>() {
+ @Override
+ public void onSuccess(List<TrustDomain> result) {
+ getView().updateTrustDomains(result);
+ }
+ });
+ } else {
+ getView().updateTrustDomains(Collections.EMPTY_LIST);
+ }
+ }
-
/**
- * @param currentSelection
+ * <p>
+ * Creates the given federation instance in the subsystem.
+ * </p>
+ *
+ * @param federation
*/
- public void onDelete(Federation currentSelection) {
- // TODO: on delete federation
+ public void onCreateFederation(final Federation federation) {
+ this.federationStore.createFederation(federation, new
SimpleCallback<ResponseWrapper<Boolean>>() {
+
+ @Override
+ public void onSuccess(ResponseWrapper<Boolean> result) {
+ if (result.getUnderlying()) {
+ Console.info(Console.MESSAGES.added("Federation ") +
federation.getAlias());
+ loadFederations();
+ } else
+ Console.error(Console.MESSAGES.addingFailed("Federation " +
federation.getAlias()), result.getResponse()
+ .toString());
+ }
+ });
}
/**
+ * <p>
+ * Removes the selected federation instance from the subsystem.
+ * </p>
+ *
+ * @param federation
+ */
+ public void onRemoveFederation(final Federation federation) {
+ this.federationStore.deleteFederation(federation, new
SimpleCallback<Boolean>() {
+ @Override
+ public void onSuccess(Boolean success) {
+
+ if (success) {
+ Console.info(Console.MESSAGES.deleted("Federation ") +
federation.getAlias());
+ } else {
+ Console.error(Console.MESSAGES.deletionFailed("Federation
") + federation.getAlias());
+ }
+
+ loadFederations();
+ }
+ });
+ }
+
+ /**
* @param updatedEntity
*/
- public void onCreateFederation(Federation updatedEntity) {
-
+ public void onRemoveTrustDomain(final TrustDomain trustDomain) {
+ this.federationStore.deleteTrustDomain(getView().getCurrentFederation(),
getView().getIdentityProvider(), trustDomain, new SimpleCallback<Boolean>() {
+ @Override
+ public void onSuccess(Boolean success) {
+
+ if (success) {
+ Console.info(Console.MESSAGES.deleted("Trusted Domain ") +
trustDomain.getName());
+ } else {
+ Console.error(Console.MESSAGES.deletionFailed("Trusted Domain
") + trustDomain.getName());
+ }
+
+ loadFederations();
+ }
+ });
}
+
+ /**
+ * @param serviceProvider
+ */
+ public void onRemoveServiceProvider(final ServiceProvider serviceProvider) {
+ this.federationStore.deleteServiceProvider(getView().getCurrentFederation(),
serviceProvider, new SimpleCallback<Boolean>() {
+ @Override
+ public void onSuccess(Boolean success) {
+ if (success) {
+ Console.info(Console.MESSAGES.deleted("Service Provider ")
+ serviceProvider.getAlias());
+ } else {
+ Console.error(Console.MESSAGES.deletionFailed("Service Provider
") + serviceProvider.getAlias());
+ }
+
+ loadFederations();
+ }
+ });
+ this.restartServiceProvider(serviceProvider);
+ }
+
+
/**
* @return
*/
@@ -198,4 +364,208 @@
return this.beanFactory;
}
+ /**
+ * <p>
+ * Creates an identity provider instance fiven a federation.
+ * </p>
+ *
+ * @param changeset
+ */
+ public void onCreateIdentityProvider(final IdentityProvider identityProvider) {
+
this.federationStore.createIdentityProvider(this.getView().getCurrentFederation(),
identityProvider,
+ new SimpleCallback<ResponseWrapper<Boolean>>() {
+
+ @Override
+ public void onSuccess(ResponseWrapper<Boolean> result) {
+ if (result.getUnderlying()) {
+ Console.info(Console.MESSAGES.added("Identity Provider
") + identityProvider.getAlias());
+ loadFederations();
+ } else
+ Console.error(Console.MESSAGES.addingFailed("Identity
Provider " + identityProvider.getAlias()),
+ result.getResponse().toString());
+ }
+ });
+ this.restartIdentityProvider(identityProvider);
+ }
+
+ /**
+ * <p>
+ * Updates an identity provider instance fiven a federation.
+ * </p>
+ *
+ * @param changedValues
+ */
+ public void onUpdateIdentityProvider(final IdentityProvider identityProvider, final
Map<String, Object> changedValues) {
+ if (changedValues.size() > 0) {
+ this.federationStore.updateIdentityProvider(getView().getCurrentFederation(),
identityProvider, changedValues,
+ new SimpleCallback<ResponseWrapper<Boolean>>() {
+
+ @Override
+ public void onSuccess(ResponseWrapper<Boolean> response) {
+ if (response.getUnderlying())
+ Console.info(Console.MESSAGES.saved("Identity
Provider " + identityProvider.getAlias()));
+ else
+ Console.error(Console.MESSAGES.saveFailed("Identity
Provider ") + identityProvider.getAlias(),
+ response.getResponse().toString());
+
+ loadIdentityProvider(getView().getCurrentFederation());
+ }
+
+ });
+ restartIdentityProvider(identityProvider);
+ }
+ }
+
+ /**
+ * @param serviceProvider
+ */
+ public void onCreateServiceProvider(final ServiceProvider serviceProvider) {
+ this.federationStore.createServiceProvider(this.getView().getCurrentFederation(),
serviceProvider,
+ new SimpleCallback<ResponseWrapper<Boolean>>() {
+
+ @Override
+ public void onSuccess(ResponseWrapper<Boolean> result) {
+ if (result.getUnderlying()) {
+ Console.info(Console.MESSAGES.added("Service Provider
") + serviceProvider.getAlias());
+ loadFederations();
+ } else
+ Console.error(Console.MESSAGES.addingFailed("Service
Provider " + serviceProvider.getAlias()),
+ result.getResponse().toString());
+ }
+ });
+ this.restartServiceProvider(serviceProvider);
+ }
+
+ /**
+ * @param updatedEntity
+ */
+ public void onCreateTrustDomain(final TrustDomain trustDomain) {
+ this.federationStore.createTrustDomain(this.getView().getCurrentFederation(),
this.getView().getIdentityProvider(), trustDomain,
+ new SimpleCallback<ResponseWrapper<Boolean>>() {
+
+ @Override
+ public void onSuccess(ResponseWrapper<Boolean> result) {
+ if (result.getUnderlying()) {
+ Console.info(Console.MESSAGES.added("Trust Domain
") + trustDomain.getName());
+ loadFederations();
+ } else
+ Console.error(Console.MESSAGES.addingFailed("Trust
Domain " + trustDomain.getName()),
+ result.getResponse().toString());
+ }
+ });
+ loadTrustDomain();
+ restartIdentityProvider(getView().getIdentityProvider());
+ }
+
+
+ public void restartIdentityProvider(IdentityProvider identityProvider) {
+ identityProvider.setName(identityProvider.getAlias());
+ identityProvider.setRuntimeName(identityProvider.getAlias());
+
+ this.enableDisableDeployment(identityProvider);
+ }
+
+ public void restartServiceProvider(ServiceProvider serviceProvider) {
+ serviceProvider.setName(serviceProvider.getAlias());
+ serviceProvider.setRuntimeName(serviceProvider.getAlias());
+
+ this.enableDisableDeployment(serviceProvider);
+ }
+
+ public void enableDisableDeployment(final DeploymentRecord record) {
+
+ final PopupPanel loading = Feedback.loading(
+ Console.CONSTANTS.common_label_plaseWait(),
+ Console.CONSTANTS.common_label_requestProcessed(),
+ new Feedback.LoadingCallback() {
+ @Override
+ public void onCancel() {
+
+ }
+ });
+
+ record.setEnabled(true);
+
+ deploymentStore.enableDisableDeployment(record, new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onSuccess(DMRResponse response) {
+ loading.hide();
+
+ ModelNode result = response.get();
+
+ if(result.isFailure())
+ {
+ Console.error(Console.MESSAGES.modificationFailed("Deployment
"+record.getRuntimeName()), result.getFailureDescription());
+ }
+ else
+ {
+ Console.info(Console.MESSAGES.modified("Deployment
"+record.getRuntimeName()));
+ }
+ }
+ });
+
+ record.setEnabled(false);
+
+ deploymentStore.enableDisableDeployment(record, new
SimpleCallback<DMRResponse>() {
+
+ @Override
+ public void onSuccess(DMRResponse response) {
+ loading.hide();
+
+ ModelNode result = response.get();
+
+ if(result.isFailure())
+ {
+ Console.error(Console.MESSAGES.modificationFailed("Deployment
"+record.getRuntimeName()), result.getFailureDescription());
+ }
+ else
+ {
+ Console.info(Console.MESSAGES.modified("Deployment
"+record.getRuntimeName()));
+ }
+ }
+ });
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.console.client.shared.deployment.DeployCommandExecutor#addToServerGroup(org.jboss.as.console.client.shared.model.DeploymentRecord,
boolean, java.lang.String[])
+ */
+ @Override
+ public void addToServerGroup(DeploymentRecord record, boolean enable, String...
selectedGroups) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.console.client.shared.deployment.DeployCommandExecutor#getPossibleGroupAssignments(org.jboss.as.console.client.shared.model.DeploymentRecord)
+ */
+ @Override
+ public List<ServerGroupRecord> getPossibleGroupAssignments(DeploymentRecord
record) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.console.client.shared.deployment.DeployCommandExecutor#promptForGroupSelections(org.jboss.as.console.client.shared.model.DeploymentRecord)
+ */
+ @Override
+ public void promptForGroupSelections(DeploymentRecord record) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.console.client.shared.deployment.DeployCommandExecutor#removeContent(org.jboss.as.console.client.shared.model.DeploymentRecord)
+ */
+ @Override
+ public void removeContent(DeploymentRecord record) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.as.console.client.shared.deployment.DeployCommandExecutor#removeDeploymentFromGroup(org.jboss.as.console.client.shared.model.DeploymentRecord)
+ */
+ @Override
+ public void removeDeploymentFromGroup(DeploymentRecord record) {
+
+ }
+
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationTable.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationTable.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationTable.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,15 +22,17 @@
package org.picketlink.as.console.client.ui.federation;
-import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import java.util.List;
+
import org.picketlink.as.console.client.shared.subsys.model.Federation;
+import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.TextColumn;
/**
* This class defines the widget to be displayed for the table of federations.
*
- * @author Pedro Silva
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 14, 2012
*/public class FederationTable extends AbstractModelElementTable<Federation> {
@@ -45,8 +47,9 @@
/* (non-Javadoc)
* @see
org.picketlink.as.console.client.ui.federation.AbstractModelElementTable#doAddConlumns(org.jboss.ballroom.client.widgets.tables.DefaultCellTable)
*/
+ @SuppressWarnings("unchecked")
@Override
- protected void doAddConlumns(DefaultCellTable<Federation> federationTable) {
+ protected void doAddConlumns(CellTable federationTable) {
TextColumn<Federation> aliasColumn = new TextColumn<Federation>() {
@Override
public String getValue(Federation record) {
@@ -56,4 +59,5 @@
federationTable.addColumn(aliasColumn, "Name");
}
+
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationView.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationView.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/FederationView.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -29,6 +29,7 @@
import org.picketlink.as.console.client.shared.subsys.model.Federation;
import org.picketlink.as.console.client.shared.subsys.model.IdentityProvider;
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.ui.Widget;
@@ -45,28 +46,43 @@
private FederationPresenter presenter;
private FederationEditor federationEditor;
-
+
/* (non-Javadoc)
* @see org.jboss.as.console.client.core.SuspendableView#createWidget()
*/
@Override
public Widget createWidget() {
- this.federationEditor = new FederationEditor(presenter,
this.presenter.getBeanFactory());
DefaultTabLayoutPanel tabLayoutpanel = new DefaultTabLayoutPanel(40,
Style.Unit.PX);
tabLayoutpanel.addStyleName("default-tabpanel");
- tabLayoutpanel.add(federationEditor.asWidget(), "PicketLink
Federation", true);
+ tabLayoutpanel.add(getFederationEditor().asWidget(), "PicketLink
Federation", true);
tabLayoutpanel.selectTab(0);
return tabLayoutpanel;
}
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.FederationPresenter.MyView#getCurrentFederation()
+ */
+ @Override
+ public Federation getCurrentFederation() {
+ return this.getFederationEditor().getCurrentFederation().getSelectedObject();
+ }
/* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.FederationPresenter.MyView#getIdentityProvider()
+ */
+ @Override
+ public IdentityProvider getIdentityProvider() {
+ return this.getFederationEditor().getIdentityProvider();
+ }
+
+ /* (non-Javadoc)
* @see
org.picketlink.as.console.client.ui.federation.FederationPresenter.MyView#updateFederations(java.util.List)
*/
@Override
public void updateFederations(List<Federation> federations) {
- this.federationEditor.updateFederations(federations);
+ getFederationEditor().updateFederations(federations);
}
/* (non-Javadoc)
@@ -74,7 +90,7 @@
*/
@Override
public void updateIdentityProviders(List<IdentityProvider> federations) {
- this.federationEditor.updateIdentityProviders(federations);
+ getFederationEditor().updateIdentityProviders(federations);
}
/* (non-Javadoc)
@@ -82,10 +98,18 @@
*/
@Override
public void updateServiceProviders(List<ServiceProvider> result) {
- this.federationEditor.updateServiceProviders(result);
+ getFederationEditor().updateServiceProviders(result);
}
-
+
/* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.FederationPresenter.MyView#updateTrustDomains(java.util.List)
+ */
+ @Override
+ public void updateTrustDomains(List<TrustDomain> result) {
+ getFederationEditor().updateTrustDomains(result);
+ }
+
+ /* (non-Javadoc)
* @see
org.picketlink.as.console.client.ui.federation.FederationPresenter.MyView#setPresenter(org.picketlink.as.console.client.ui.federation.FederationPresenter)
*/
@Override
@@ -93,4 +117,15 @@
this.presenter = presenter;
}
+ /**
+ * @return
+ */
+ private FederationEditor getFederationEditor() {
+ if (this.federationEditor == null) {
+ this.federationEditor = new FederationEditor(presenter);
+ }
+
+ return this.federationEditor;
+ }
+
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/IdentityProviderDetails.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/IdentityProviderDetails.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/IdentityProviderDetails.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -24,13 +24,18 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.jboss.as.console.client.shared.subsys.Baseadress;
+import org.jboss.ballroom.client.widgets.forms.CheckBoxItem;
+import org.jboss.ballroom.client.widgets.forms.ComboBoxItem;
import org.jboss.ballroom.client.widgets.forms.FormItem;
-import org.jboss.ballroom.client.widgets.forms.TextItem;
+import org.jboss.ballroom.client.widgets.forms.TextBoxItem;
import org.jboss.dmr.client.ModelNode;
import org.picketlink.as.console.client.shared.subsys.model.IdentityProvider;
+import com.google.gwt.core.client.GWT;
+
/**
* <p>
* This class defines the widget to that renders a read-only form for the informations
about a Identity Provider.
@@ -41,18 +46,36 @@
*/
public class IdentityProviderDetails extends
AbstractFederationDetails<IdentityProvider> {
+ private FederationPresenter presenter;
+ private IdentityProvider identityProvider;
+ List<FormItem<?>> items;
+
public IdentityProviderDetails(FederationPresenter presenter) {
super();
+ this.presenter = presenter;
}
protected List<FormItem<?>> getFormItems() {
- List<FormItem<?>> items = new ArrayList<FormItem<?>>();
+ items = new ArrayList<FormItem<?>>();
- items.add(new TextItem("alias", "Alias"));
- items.add(new TextItem("url", "Identity URL"));
- items.add(new TextItem("signOutgoingMessages", "Sign Outgoing
Messages"));
- items.add(new TextItem("ignoreIncomingSignatures", "Ignore
Incoming Signatures"));
+ ComboBoxItem aliasesItem = new ComboBoxItem("alias",
"Alias");
+ aliasesItem.setRequired(true);
+
+ String[] aliases = new String[this.presenter.getAvailableDeployments().size()];
+
+ for (int i = 0; i < this.presenter.getAvailableDeployments().size(); i++) {
+ aliases[i] = this.presenter.getAvailableDeployments().get(i).getName();
+ }
+
+ aliasesItem.setValueMap(aliases);
+
+
+ items.add(aliasesItem);
+ items.add(new TextBoxItem("url", "Identity URL", true));
+ items.add(new CheckBoxItem("signOutgoingMessages", "Sign Outgoing
Messages"));
+ items.add(new CheckBoxItem("ignoreIncomingSignatures", "Ignore
Incoming Signatures"));
+
return items;
}
@@ -84,8 +107,78 @@
* @param identityProviders
*/
public void updateIdentityProvider(List<IdentityProvider> identityProviders) {
- setEntityInstance(identityProviders.get(0));
- getForm().edit(identityProviders.get(0));
+ if (!identityProviders.isEmpty()) {
+ this.identityProvider = identityProviders.get(0);
+ setEntityInstance(this.identityProvider);
+ getForm().edit(identityProviders.get(0));
+ } else {
+ this.identityProvider = null;
+ getForm().clearValues();
+
+ IdentityProvider as =
this.presenter.getBeanFactory().identityProvider().as();
+
+ as.setUrl(getBaseUrl() + "/CONTEXT");
+ as.setIgnoreIncomingSignatures(false);
+ as.setSignOutgoingMessages(false);
+
+ getForm().edit(as);
+ }
}
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractFederationDetails#doOnSave(java.util.Map)
+ */
+ @Override
+ protected void doOnSave(Map<String, Object> changeset) {
+ if (this.identityProvider == null) {
+ this.presenter.onCreateIdentityProvider(this.getForm().getUpdatedEntity());
+ } else {
+ this.presenter.onUpdateIdentityProvider(this.identityProvider, changeset);
+ }
+ }
+
+ private String getBaseUrl() {
+ // extract host
+ String base = GWT.getHostPageBaseURL();
+ return extractHttpEndpointUrl(base);
+ }
+
+ public static String extractHttpEndpointUrl(String base) {
+ String protocol = base.substring(0, base.indexOf("//")+2);
+ String remainder = base.substring(base.indexOf(protocol)+protocol.length(),
base.length());
+
+ String host = null;
+ String port = null;
+
+ int portDelim = remainder.indexOf(":");
+ if(portDelim !=-1 )
+ {
+ host = remainder.substring(0, portDelim);
+ String portRemainder = remainder.substring(portDelim+1, remainder.length());
+ if(portRemainder.indexOf("/")!=-1)
+ {
+ port = portRemainder.substring(0, portRemainder.indexOf("/"));
+ }
+ else
+ {
+ port = portRemainder;
+ }
+ }
+ else
+ {
+ host = remainder.substring(0, remainder.indexOf("/"));
+ port = "80";
+ }
+
+ // default url
+ return protocol + host + ":" + port + "/";
+ }
+
+ /**
+ * @return the identityProvider
+ */
+ public IdentityProvider getIdentityProvider() {
+ return identityProvider;
+ }
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizard.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizard.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizard.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -25,62 +25,37 @@
import org.picketlink.as.console.client.shared.subsys.model.Federation;
import com.google.gwt.user.client.ui.DeckPanel;
-import com.google.gwt.user.client.ui.Widget;
/**
+ * <p>
+ * A wizard to be used when creating a new federation configuration.
+ * </p>
+ *
* @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 19, 2012
*/
-public class NewFederationWizard {
+public class NewFederationWizard extends AbstractWizardView<FederationPresenter,
Federation> {
- private FederationPresenter presenter;
-
- private DeckPanel deck;
-
-
- private Federation baseAttributes = null;
-
- private FederationEditor editor;
-
- public NewFederationWizard(
- FederationPresenter presenter, FederationEditor editor) {
- this.presenter = presenter;
- this.editor = editor;
+ public NewFederationWizard(FederationPresenter presenter) {
+ super("Federation", presenter);
}
- public Widget asWidget() {
- deck = new DeckPanel();
-
- deck.add(new NewFederationWizardStep1(this,
this.editor.getBeanFactory()).asWidget());
-
- deck.showWidget(0);
-
- return deck;
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardView#doAddSteps(com.google.gwt.user.client.ui.DeckPanel)
+ */
+ @Override
+ protected void doAddSteps(DeckPanel deck) {
+ deck.add(new NewFederationWizardStep1(this).asWidget());
}
- public FederationPresenter getPresenter() {
- return presenter;
- }
-
- public void onFinish(Federation updatedEntity) {
-
- // merge previous attributes into single entity
- updatedEntity.setAlias(baseAttributes.getAlias());
-
- presenter.onCreateFederation(updatedEntity);
- }
-
/**
- * @param updatedEntity
+ * <p>
+ * Callback method called when the user wants to save a new federation instance.
+ * </p>
+ *
+ * @param newFederation
*/
- public void onConfigureBaseAttributes(Federation updatedEntity) {
- this.presenter.onCreateFederation(updatedEntity);
+ public void onSave(Federation newFederation) {
+ this.getPresenter().onCreateFederation(newFederation);
}
-
- /**
- * @return the editor
- */
- public FederationEditor getEditor() {
- return this.editor;
- }
}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizardStep1.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizardStep1.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewFederationWizardStep1.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,103 +22,43 @@
package org.picketlink.as.console.client.ui.federation;
-import org.jboss.as.console.client.Console;
-import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.shared.subsys.Baseadress;
-import org.jboss.as.console.client.shared.subsys.jca.model.DataSource;
-import org.jboss.as.console.client.shared.subsys.jca.wizard.NewDatasourceWizard;
-import org.jboss.as.console.client.widgets.forms.items.JndiNameItem;
import org.jboss.ballroom.client.widgets.forms.Form;
-import org.jboss.ballroom.client.widgets.forms.FormValidation;
import org.jboss.ballroom.client.widgets.forms.TextBoxItem;
-import org.jboss.ballroom.client.widgets.window.DialogueOptions;
-import org.jboss.ballroom.client.widgets.window.WindowContentBuilder;
import org.jboss.dmr.client.ModelNode;
-import org.picketlink.as.console.client.BeanFactory;
import org.picketlink.as.console.client.shared.subsys.model.Federation;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
/**
+ * <p>
+ * The first step during the wizard to create a new federation instance.
+ * </p>
+ *
* @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 19, 2012
*/
-public class NewFederationWizardStep1 {
+public class NewFederationWizardStep1 extends AbstractWizardStep<Federation> {
- NewFederationWizard wizard;
- private BeanFactory beanFactory;
-
public NewFederationWizardStep1(NewFederationWizard wizard) {
- this.wizard = wizard;
+ super("New Federation", wizard, Federation.class);
}
- /**
- * @param newFederationWizard
- * @param beanFactory
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardStep#doAddFormItems(org.jboss.ballroom.client.widgets.forms.Form)
*/
- public NewFederationWizardStep1(NewFederationWizard newFederationWizard, BeanFactory
beanFactory) {
- this.beanFactory = beanFactory;
+ @Override
+ protected void doAddFormItems(Form<Federation> form) {
+ addFormItem(new TextBoxItem("alias", "Alias"));
}
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardStep#doGetHelpAddress()
+ */
+ protected ModelNode doGetHelpAddress() {
+ ModelNode address = Baseadress.get();
+ address.add("subsystem", "picketlink");
+ address.add("federation", "*");
+ return address;
+ }
- Widget asWidget() {
- VerticalPanel layout = new VerticalPanel();
- layout.setStyleName("window-content");
-
- layout.add(new HTML("<h3>New Federation</h3>"));
-
- final Form<Federation> form = new
Form<Federation>(Federation.class);
-
- final TextBoxItem name = new TextBoxItem("alias", "Alias");
-
- form.setFields(name);
-
- form.edit(this.beanFactory.federation().as());
-
- final FormHelpPanel helpPanel = new FormHelpPanel(
- new FormHelpPanel.AddressCallback() {
- @Override
- public ModelNode getAddress() {
- ModelNode address = Baseadress.get();
- address.add("subsystem", "picketlink");
- address.add("federation", "*");
- return address;
- }
- }, form
- );
-
- layout.add(helpPanel.asWidget());
-
- layout.add(form.asWidget());
-
- ClickHandler submitHandler = new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- FormValidation validation = form.validate();
- if(!validation.hasErrors())
- {
- wizard.onConfigureBaseAttributes(form.getUpdatedEntity());
- }
- }
- };
-
- ClickHandler cancelHandler = new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- wizard.getEditor().closeDialogue();
- }
- };
-
- DialogueOptions options = new DialogueOptions(
- Console.CONSTANTS.common_label_save(),submitHandler,
- Console.CONSTANTS.common_label_cancel(),cancelHandler
- );
-
- return new WindowContentBuilder(layout, options).build();
- }
-
-}
+}
\ No newline at end of file
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizard.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizard.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizard.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+
+import com.google.gwt.user.client.ui.DeckPanel;
+
+/**
+ * <p>
+ * A wizard to be used when creating a new service provider configuration.
+ * </p>
+ *
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 19, 2012
+ */
+public class NewServiceProviderWizard extends AbstractWizardView<FederationPresenter,
ServiceProvider>{
+
+ private NewServiceProviderWizardStep1 newServiceProviderWizardStep1;
+
+ public NewServiceProviderWizard(
+ FederationPresenter presenter) {
+ super("Service Provider", presenter);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardView#doAddSteps(com.google.gwt.user.client.ui.DeckPanel)
+ */
+ @Override
+ protected void doAddSteps(DeckPanel deck) {
+ deck.add(new NewServiceProviderWizardStep1(this,
this.getPresenter()).asWidget());
+ }
+
+ /**
+ * @return
+ */
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.WizardView#onSave(java.lang.Object)
+ */
+ @Override
+ public void onSave(ServiceProvider updatedEntity) {
+ this.getPresenter().onCreateServiceProvider(updatedEntity);
+ }
+
+}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizardStep1.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizardStep1.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/NewServiceProviderWizardStep1.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import java.util.List;
+
+import org.jboss.as.console.client.shared.model.DeploymentRecord;
+import org.jboss.as.console.client.shared.subsys.Baseadress;
+import org.jboss.ballroom.client.widgets.forms.CheckBoxItem;
+import org.jboss.ballroom.client.widgets.forms.ComboBoxItem;
+import org.jboss.ballroom.client.widgets.forms.Form;
+import org.jboss.ballroom.client.widgets.forms.TextBoxItem;
+import org.jboss.dmr.client.ModelNode;
+import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+
+/**
+ * <p>
+ * The first step during the wizard to create a new federation instance.
+ * </p>
+ *
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 19, 2012
+ */
+public class NewServiceProviderWizardStep1 extends
AbstractWizardStep<ServiceProvider> {
+
+ private List<DeploymentRecord> deployments;
+ private FederationPresenter presenter;
+
+ public NewServiceProviderWizardStep1(NewServiceProviderWizard wizard,
FederationPresenter presenter) {
+ super("New Service Provider", wizard, ServiceProvider.class);
+ this.presenter = presenter;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardStep#doAddFormItems(org.jboss.ballroom.client.widgets.forms.Form)
+ */
+ @Override
+ protected void doAddFormItems(Form<ServiceProvider> form) {
+ ComboBoxItem aliasesItem = new ComboBoxItem("alias",
"Alias");
+
+ aliasesItem.setRequired(true);
+
+ String[] aliases = new String[this.presenter.getAvailableDeployments().size()];
+
+ for (int i = 0; i < this.presenter.getAvailableDeployments().size(); i++) {
+ aliases[i] = this.presenter.getAvailableDeployments().get(i).getName();
+ }
+
+ aliasesItem.setValueMap(aliases);
+
+ addFormItem(aliasesItem);
+ addFormItem(new TextBoxItem("url", "URL"));
+ addFormItem(new CheckBoxItem("postBinding", "HTTP-Post
Binding"));
+ }
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractWizardStep#doGetHelpAddress()
+ */
+ protected ModelNode doGetHelpAddress() {
+ ModelNode address = Baseadress.get();
+ address.add("subsystem", "picketlink");
+ address.add("federation", "*");
+ address.add("service-provider", "*");
+ return address;
+ }
+
+}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderDetails.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderDetails.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderDetails.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -25,8 +25,12 @@
import java.util.List;
import org.jboss.as.console.client.widgets.ContentDescription;
+import org.jboss.ballroom.client.widgets.tools.ToolButton;
+import org.jboss.ballroom.client.widgets.tools.ToolStrip;
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -42,20 +46,58 @@
public class ServiceProviderDetails {
private ServiceProviderTable serviceProviderTable;
+ private FederationPresenter presenter;
+ private NewServiceProviderWizard serviceProviderWizard;
+ public ServiceProviderDetails(FederationPresenter presenter) {
+ this.presenter = presenter;
+ }
+
public Widget asWidget() {
VerticalPanel layout = new VerticalPanel();
layout.setStyleName("rhs-content-panel");
- HorizontalPanel horizontalPanel = new HorizontalPanel();
+// HorizontalPanel horizontalPanel = new HorizontalPanel();
+//
+// horizontalPanel.setHeight("10px");
+//
+// layout.add(horizontalPanel);
- horizontalPanel.setHeight("10px");
+ ToolStrip trustDomainTools = new ToolStrip();
- layout.add(horizontalPanel);
- layout.add(new ContentDescription("Avaiable Service Providers"));
- layout.add(getFederationTable().asWidget());
+ trustDomainTools.setStyleName("fill-layout-width");
+ ToolButton editBtn = new ToolButton("Add");
+
+ editBtn.addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(ClickEvent event) {
+ getServiceProviderWizard().lunch();
+ }
+ });
+
+ trustDomainTools.add(editBtn);
+
+ ToolButton removeBtn = new ToolButton("Remove");
+
+ removeBtn.addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(ClickEvent event) {
+
presenter.onRemoveServiceProvider(getServiceProviderTable().getSelectedServiceProvider());
+ }
+ });
+
+ trustDomainTools.add(removeBtn);
+
+ layout.add(trustDomainTools);
+
+ layout.add(new ContentDescription(""));
+
+ layout.add(getServiceProviderTable().asWidget());
+
return layout;
}
@@ -64,9 +106,9 @@
*
* @return
*/
- private ServiceProviderTable getFederationTable() {
+ private ServiceProviderTable getServiceProviderTable() {
if (this.serviceProviderTable == null) {
- this.serviceProviderTable = new ServiceProviderTable();
+ this.serviceProviderTable = new ServiceProviderTable(this.presenter);
}
return this.serviceProviderTable;
@@ -76,7 +118,15 @@
* @param result
*/
public void updateServiceProviders(List<ServiceProvider> result) {
- this.getFederationTable().getDataProvider().setList(result);
+ this.getServiceProviderTable().setList(result);
}
+
+ public NewServiceProviderWizard getServiceProviderWizard() {
+ if (this.serviceProviderWizard == null) {
+ this.serviceProviderWizard = new NewServiceProviderWizard(this.presenter);
+ }
+ return this.serviceProviderWizard;
+ }
+
}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderRestartColumn.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderRestartColumn.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderRestartColumn.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import org.jboss.as.console.client.shared.deployment.DeployCommandExecutor;
+import org.jboss.as.console.client.shared.deployment.DeploymentCommand;
+import org.jboss.as.console.client.shared.deployment.DeploymentCommandCell;
+import org.jboss.as.console.client.shared.model.DeploymentRecord;
+import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+
+import com.google.gwt.user.cellview.client.Column;
+
+/**
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 23, 2012
+ */
+public class ServiceProviderRestartColumn extends Column<DeploymentRecord,
DeploymentRecord> {
+
+ public ServiceProviderRestartColumn(DeployCommandExecutor executor, DeploymentCommand
command) {
+ super(new DeploymentCommandCell(executor, command));
+ }
+
+ /* (non-Javadoc)
+ * @see com.google.gwt.user.cellview.client.Column#getValue(java.lang.Object)
+ */
+ @Override
+ public DeploymentRecord getValue(DeploymentRecord object) {
+ return object;
+ }
+
+}
Modified:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderTable.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderTable.java 2012-03-26
21:53:57 UTC (rev 1540)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/ServiceProviderTable.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -22,17 +22,33 @@
package org.picketlink.as.console.client.ui.federation;
-import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
+import java.util.List;
+
import org.picketlink.as.console.client.shared.subsys.model.ServiceProvider;
+import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionChangeEvent.Handler;
+import com.google.gwt.view.client.SingleSelectionModel;
/**
+ * <p>
+ * A table widget to be used to show service providers.
+ * </p>
+ *
* @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
* @since Mar 19, 2012
*/
public class ServiceProviderTable extends
AbstractModelElementTable<ServiceProvider> {
+ private FederationPresenter presenter;
+ private ServiceProvider selectedServiceProvider;
+
+ public ServiceProviderTable(FederationPresenter presenter) {
+ this.presenter = presenter;
+ }
+
/*
* (non-Javadoc)
*
@@ -50,8 +66,9 @@
*
org.picketlink.as.console.client.ui.federation.AbstractModelElementTable#doAddConlumns(org.jboss.ballroom.client.widgets
* .tables.DefaultCellTable)
*/
+ @SuppressWarnings("unchecked")
@Override
- protected void doAddConlumns(DefaultCellTable<ServiceProvider> federationTable)
{
+ protected void doAddConlumns(CellTable federationTable) {
TextColumn<ServiceProvider> aliasColumn = new
TextColumn<ServiceProvider>() {
@Override
public String getValue(ServiceProvider record) {
@@ -60,6 +77,53 @@
};
federationTable.addColumn(aliasColumn, "Name");
+
+ TextColumn<ServiceProvider> urlColumn = new
TextColumn<ServiceProvider>() {
+ @Override
+ public String getValue(ServiceProvider record) {
+ return record.getUrl();
+ }
+ };
+
+ federationTable.addColumn(aliasColumn, "URL");
+
+ final SingleSelectionModel<ServiceProvider> selectionModel = new
SingleSelectionModel<ServiceProvider>();
+
+ Handler selectionHandler = new SelectionChangeEvent.Handler() {
+
+ @Override
+ public void onSelectionChange(com.google.gwt.view.client.SelectionChangeEvent
event) {
+ SingleSelectionModel<ServiceProvider> selection =
(SingleSelectionModel<ServiceProvider>) event.getSource();
+
+ selectedServiceProvider = selection.getSelectedObject();
+ }
+
+ };
+
+ selectionModel.addSelectionChangeHandler(selectionHandler);
+ // cellTable.setSelectionEnabled(true);
+ this.getCellTable().setSelectionModel(selectionModel);
}
+
+ /* (non-Javadoc)
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractModelElementTable#setList(java.util.List)
+ */
+ @Override
+ public void setList(List<ServiceProvider> items) {
+ for (ServiceProvider serviceProvider : items) {
+ serviceProvider.setName(serviceProvider.getAlias());
+ serviceProvider.setRuntimeName(serviceProvider.getRuntimeName());
+ serviceProvider.setEnabled(true);
+ }
+
+ super.setList(items);
+ }
+
+ /**
+ * @return the selectedServiceProvider
+ */
+ public ServiceProvider getSelectedServiceProvider() {
+ return selectedServiceProvider;
+ }
}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/TrustDomainTable.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/TrustDomainTable.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/TrustDomainTable.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import org.picketlink.as.console.client.shared.subsys.model.TrustDomain;
+
+import com.google.gwt.user.cellview.client.CellTable;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionChangeEvent.Handler;
+import com.google.gwt.view.client.SingleSelectionModel;
+
+/**
+ * <p>
+ * A table widget to be used to show service providers.
+ * </p>
+ *
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 19, 2012
+ */
+public class TrustDomainTable extends AbstractModelElementTable<TrustDomain> {
+
+ private TrustDomain selectedTrustedDomain;
+
+ public TrustDomainTable() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.picketlink.as.console.client.ui.federation.AbstractModelElementTable#doGetKey(java.lang.Object)
+ */
+ @Override
+ protected Object doGetKey(TrustDomain item) {
+ return item.getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ *
org.picketlink.as.console.client.ui.federation.AbstractModelElementTable#doAddConlumns(org.jboss.ballroom.client.widgets
+ * .tables.DefaultCellTable)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void doAddConlumns(CellTable table) {
+ TextColumn<TrustDomain> nameColumn = new TextColumn<TrustDomain>() {
+ @Override
+ public String getValue(TrustDomain record) {
+ return record.getName();
+ }
+ };
+
+ table.addColumn(nameColumn, "Name");
+
+ final SingleSelectionModel<TrustDomain> selectionModel = new
SingleSelectionModel<TrustDomain>();
+
+ Handler selectionHandler = new SelectionChangeEvent.Handler() {
+
+ @Override
+ public void onSelectionChange(com.google.gwt.view.client.SelectionChangeEvent
event) {
+ SingleSelectionModel<TrustDomain> selection =
(SingleSelectionModel<TrustDomain>) event.getSource();
+
+ selectedTrustedDomain = selection.getSelectedObject();
+ }
+
+ };
+
+ selectionModel.addSelectionChangeHandler(selectionHandler);
+ // cellTable.setSelectionEnabled(true);
+ this.getCellTable().setSelectionModel(selectionModel);
+ }
+
+ /**
+ * @return the selectedTrustedDomain
+ */
+ public TrustDomain getSelectedTrustedDomain() {
+ return selectedTrustedDomain;
+ }
+}
Added:
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/WizardView.java
===================================================================
---
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/WizardView.java
(rev 0)
+++
console/trunk/gui/src/main/java/org/picketlink/as/console/client/ui/federation/WizardView.java 2012-03-26
21:55:14 UTC (rev 1541)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.ui.federation;
+
+import com.gwtplatform.mvp.client.Presenter;
+
+/**
+ * @author <a href="mailto:psilva@redhat.com">Pedro Silva</a>
+ * @since Mar 23, 2012
+ */
+public interface WizardView<P extends Presenter, T> {
+
+ /**
+ * <p>
+ * Lunchs the wizard.
+ * </p>
+ */
+ void lunch();
+
+ /**
+ * @param updatedEntity
+ */
+ void onSave(T updatedEntity);
+
+ /**
+ *
+ */
+ void onClose();
+
+}