You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by em...@apache.org on 2014/07/04 00:58:03 UTC

svn commit: r1607764 [3/7] - in /james/bond/trunk/src: main/java/org/apache/james/bond/ main/java/org/apache/james/bond/client/ main/java/org/apache/james/bond/client/configure/ main/java/org/apache/james/bond/client/configure/dns/ main/java/org/apache...

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageActivity.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageActivity.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageActivity.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageActivity.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,233 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage;
+
+import java.util.List;
+
+import org.apache.james.bond.client.CommonActivity;
+import org.apache.james.bond.client.CommonTabsView;
+import org.apache.james.bond.client.ioc.ClientFactory;
+import org.apache.james.bond.client.manage.domain.ManageDomainsTabView;
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView;
+import org.apache.james.bond.client.manage.user.ManageUsersTabView;
+import org.apache.james.bond.client.serverconnection.AppRequestFactory.DomainRequest;
+import org.apache.james.bond.client.serverconnection.AppRequestFactory.MappingRequest;
+import org.apache.james.bond.client.serverconnection.AppRequestFactory.UserRequest;
+import org.apache.james.bond.client.serverconnection.BasicReceiver;
+import org.apache.james.bond.client.serverconnection.DomainProxy;
+import org.apache.james.bond.client.serverconnection.MappingProxy;
+import org.apache.james.bond.client.serverconnection.UserProxy;
+
+import com.google.web.bindery.requestfactory.shared.Receiver;
+
+/**
+ * This {@link CommonActivity} manages all the views to manage the server
+ * retrieving, updating and saving users and domains data.
+ */
+public class ManageActivity extends CommonActivity implements
+    ManageUsersTabView.Presenter, ManageDomainsTabView.Presenter,
+    ManageMappingsView.Presenter {
+  private ManageUsersTabView usersView;
+  private ManageDomainsTabView domainsView;
+  private ManageMappingsView mappingsView;
+
+  /**
+   * It creates a {@link ManageActivity} setting it as a presenter for the views
+   * 
+   * @see CommonActivity
+   * 
+   * @param place
+   * @param clientFactory
+   */
+  public ManageActivity(ManagePlace place, ClientFactory clientFactory) {
+    super(place, clientFactory);
+    this.usersView = clientFactory.getManageUsersTabView();
+    this.domainsView = clientFactory.getManageDomainsTabView();
+    this.mappingsView = clientFactory.getManageMappingsView();
+
+    usersView.setPresenter(this);
+    domainsView.setPresenter(this);
+    mappingsView.setPresenter(this);
+  }
+
+  /**
+   * It displays all domains in console
+   */
+  public void printDomains() {
+    Receiver<List<DomainProxy>> rec = new BasicReceiver<List<DomainProxy>>() {
+      public void onSuccess(List<DomainProxy> domains) {
+        for (DomainProxy domain : domains) {
+          System.out.println(domain.getDomain());
+        }
+      }
+    };
+    this.requestFactory.createDomainRequest().listDomains().fire(rec);
+  }
+
+  /**
+   * It displays all users in console
+   */
+  public void printUsers() {
+    Receiver<List<UserProxy>> rec = new BasicReceiver<List<UserProxy>>() {
+      public void onSuccess(List<UserProxy> users) {
+        for (UserProxy user : users) {
+          System.out.println(user.getUsername());
+        }
+      }
+    };
+    this.requestFactory.createUserRequest().listUsers().fire(rec);
+  }
+
+  /**
+   * It displays all mappings in console
+   */
+  public void listMappings() {
+    Receiver<List<MappingProxy>> rec = new BasicReceiver<List<MappingProxy>>() {
+      public void onSuccess(List<MappingProxy> mappingList) {
+        for (MappingProxy mapping : mappingList) {
+          System.out.println(mapping.getUserAndDomain());
+          for (String mappingString : mapping.getMappings()) {
+            System.out.println("*" + mappingString);
+          }
+        }
+      }
+    };
+    this.requestFactory.createMappingRequest().listMappings().fire(rec);
+  }
+
+  @Override
+  public void deleteUser(UserProxy user) {
+    UserRequest context = requestFactory.createUserRequest();
+    UserProxy userToDelete = context.create(UserProxy.class);
+    userToDelete.setUsername(user.getId());
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        usersView.updateData();
+      }
+    };
+    context.remove(userToDelete).fire(receiver);
+  }
+
+  @Override
+  public void addUser(String username, String password) {
+    UserRequest context = requestFactory.createUserRequest();
+    UserProxy user = context.create(UserProxy.class);
+    user.setUsername(username);
+    user.setPassword(password);
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        usersView.updateData();
+      }
+    };
+    context.persist(user).fire(receiver);
+  }
+
+  @Override
+  public void changePassword(UserProxy user, String newPassword) {
+    UserRequest context = requestFactory.createUserRequest();
+    UserProxy userToChange = context.create(UserProxy.class);
+    userToChange.setUsername(user.getUsername());
+    userToChange.setPassword(newPassword);
+    context.changePassword(userToChange).fire();
+  }
+
+  @Override
+  public void deleteDomain(DomainProxy domain) {
+    DomainRequest context = requestFactory.createDomainRequest();
+    DomainProxy domainToDelete = context.create(DomainProxy.class);
+    domainToDelete.setDomain(domain.getDomain());
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        domainsView.updateData();
+      }
+    };
+    context.remove(domainToDelete).fire(receiver);
+  }
+
+  @Override
+  public void addDomain(String domainName) {
+    DomainRequest context = requestFactory.createDomainRequest();
+    DomainProxy domain = context.create(DomainProxy.class);
+    domain.setDomain(domainName);
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        domainsView.updateData();
+      }
+    };
+    context.persist(domain).fire(receiver);
+  }
+
+  @Override
+  protected CommonTabsView createMainView(ClientFactory clientFactory,
+      String place) {
+    return clientFactory.getManageView(place);
+  }
+
+  @Override
+  public void addAddressMapping(String user, String domain, String address) {
+    MappingRequest context = requestFactory.createMappingRequest();
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        mappingsView.updateData();
+      }
+    };
+    context.addAddressMapping(user, domain, address).fire(receiver);
+  }
+
+  @Override
+  public void removeAddressMapping(String user, String domain, String address) {
+    MappingRequest context = requestFactory.createMappingRequest();
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        mappingsView.updateData();
+      }
+    };
+    context.removeAddressMapping(user, domain, address).fire(receiver);
+  }
+
+  @Override
+  public void addRegexMapping(String user, String domain, String regex) {
+    MappingRequest context = requestFactory.createMappingRequest();
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        mappingsView.updateData();
+      }
+    };
+    context.addRegexMapping(user, domain, regex).fire(receiver);
+  }
+
+  @Override
+  public void removeRegexMapping(String user, String domain, String regex) {
+    MappingRequest context = requestFactory.createMappingRequest();
+
+    Receiver<Void> receiver = new BasicReceiver<Void>() {
+      public void onSuccess(Void response) {
+        mappingsView.updateData();
+      }
+    };
+    context.removeRegexMapping(user, domain, regex).fire(receiver);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManagePlace.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManagePlace.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManagePlace.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManagePlace.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage;
+
+import org.apache.james.bond.client.CommonPlace;
+
+import com.google.gwt.place.shared.PlaceTokenizer;
+import com.google.gwt.place.shared.Prefix;
+
+/**
+ * This class is a {@link CommonPlace} with "ManagePlace" as prefix
+ */
+public class ManagePlace extends CommonPlace {
+  /**
+   * {@inheritDoc}
+   */
+  public ManagePlace(String token) {
+    super(token);
+  }
+
+  @Override
+  public String getPrefixPlace() {
+    return "ManagePlace";
+  }
+
+  @Prefix("ManagePlace")
+  public static class Tokenizer implements PlaceTokenizer<ManagePlace> {
+    @Override
+    public String getToken(ManagePlace place) {
+      return place.getToken();
+    }
+
+    @Override
+    public ManagePlace getPlace(String token) {
+      return new ManagePlace(token);
+    }
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage;
+
+import org.apache.james.bond.client.CommonTabsView;
+import org.apache.james.bond.client.manage.domain.ManageDomainsTabView;
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView;
+import org.apache.james.bond.client.manage.user.ManageUsersTabView;
+
+/**
+ * It defines the methods necessary to add all the necessary tabs to manage the
+ * server
+ */
+public interface ManageView extends CommonTabsView {
+  /**
+   * It adds the {@link ManageUsersTabView}
+   * 
+   * @param manageUsersTabView
+   */
+  public void setUsersView(ManageUsersTabView manageUsersTabView);
+
+  /**
+   * It adds the {@link ManageDomainsTabView}
+   * 
+   * @param manageDomainsTabView
+   */
+  public void setDomainsView(ManageDomainsTabView manageDomainsTabView);
+
+  /**
+   * It adds the {@link ManageMappingsView}
+   * 
+   * @param manageMappingsView
+   */
+  public void setMappingsView(ManageMappingsView manageMappingsView);
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/ManageViewImpl.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage;
+
+import org.apache.james.bond.client.CommonTabsViewImpl;
+import org.apache.james.bond.client.manage.domain.ManageDomainsTabView;
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView;
+import org.apache.james.bond.client.manage.user.ManageUsersTabView;
+
+/**
+ * This class defines the view to manage users and domains
+ */
+public class ManageViewImpl extends CommonTabsViewImpl implements ManageView {
+  /**
+   * {@inheritDoc}
+   */
+  public ManageViewImpl(String place) {
+    super(place);
+  }
+
+  @Override
+  public void setUsersView(ManageUsersTabView manageUsersTabView) {
+    addTab(manageUsersTabView, "Users");
+  }
+
+  @Override
+  public void setDomainsView(ManageDomainsTabView manageDomainsTabView) {
+    addTab(manageDomainsTabView, "Domains");
+  }
+
+  @Override
+  public void setMappingsView(ManageMappingsView manageMappingsView) {
+    addTab(manageMappingsView, "Mappings");
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,85 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.domain;
+
+import org.apache.james.bond.client.manage.domain.ManageDomainsTabView.Presenter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the user to insert a new dns ip address
+ */
+public class AddDomainView extends DialogBox implements HasText {
+
+  @UiField
+  TextBox domainTextBox;
+  @UiField
+  Button addButton;
+  @UiField
+  Button cancelButton;
+
+  private static AddDomainViewUiBinder uiBinder = GWT
+      .create(AddDomainViewUiBinder.class);
+  private Presenter listener;
+
+  interface AddDomainViewUiBinder extends UiBinder<Widget, AddDomainView> {
+  }
+
+  /**
+   * It creates a new {@link DialogBox} that is able to add a new domain using
+   * the {@link Presenter}
+   * 
+   * @param listener
+   */
+  public AddDomainView(Presenter listener) {
+    this.listener = listener;
+    setHTML("Add domain");
+    setWidget(uiBinder.createAndBindUi(this));
+  }
+
+  /**
+   * Closes the {@link AddDomainView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+
+  /**
+   * Adds the domain and closes the {@link AddDomainView}
+   * 
+   * @param e
+   */
+  @UiHandler("addButton")
+  void onAddClick(ClickEvent e) {
+    listener.addDomain(domainTextBox.getText());
+    this.hide();
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/AddDomainView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,30 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+
+	<g:HTMLPanel>
+		<g:Label>Domain:</g:Label>
+		<g:TextBox ui:field="domainTextBox"></g:TextBox>
+		<g:Label></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="addButton">Add</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,92 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.domain;
+
+import org.apache.james.bond.client.manage.domain.ManageDomainsTabView.Presenter;
+import org.apache.james.bond.client.serverconnection.DomainProxy;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the confirmation that the domain must be
+ * deleted
+ */
+public class DeleteConfirmationView extends DialogBox {
+
+  private static DeleteConfirmationViewUiBinder uiBinder = GWT
+      .create(DeleteConfirmationViewUiBinder.class);
+  private DomainProxy domain;
+  private Presenter listener;
+  @UiField
+  Label domainLabel;
+  @UiField
+  Button cancelButton;
+  @UiField
+  Button deleteButton;
+
+  interface DeleteConfirmationViewUiBinder extends
+      UiBinder<Widget, DeleteConfirmationView> {
+  }
+
+  /**
+   * It creates a {@link DeleteConfirmationView} to confirm to delete the domain
+   * through the listener
+   * 
+   * @param domain
+   * @param listener
+   */
+  public DeleteConfirmationView(DomainProxy domain, Presenter listener) {
+    this.domain = domain;
+    this.listener = listener;
+
+    setHTML("Delete domain");
+    setWidget(uiBinder.createAndBindUi(this));
+    domainLabel.setText(domain.getDomain());
+  }
+
+  /**
+   * It deletes the domain from the server and closes the
+   * {@link DeleteConfirmationView}
+   * 
+   * @param e
+   */
+  @UiHandler("deleteButton")
+  void onChangeClick(ClickEvent e) {
+    listener.deleteDomain(domain);
+    this.hide();
+  }
+
+  /**
+   * It closes the {@link DeleteConfirmationView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DeleteConfirmationView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,34 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+	<ui:style>
+		.important {
+			font-weight: bold;
+		}
+	</ui:style>
+
+	<g:HTMLPanel>
+		<g:Label>Domain: </g:Label>
+		<g:Label ui:field="domainLabel" addStyleNames="{style.important}"></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="deleteButton">Delete</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DomainsAsyncDataProvider.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DomainsAsyncDataProvider.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DomainsAsyncDataProvider.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/DomainsAsyncDataProvider.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,64 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.domain;
+
+import java.util.List;
+
+import org.apache.james.bond.client.serverconnection.AppRequestFactory;
+import org.apache.james.bond.client.serverconnection.BasicReceiver;
+import org.apache.james.bond.client.serverconnection.DomainProxy;
+
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.Range;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+
+/**
+ * An {@link AsyncDataProvider} that keeps the information about domains
+ */
+public class DomainsAsyncDataProvider extends AsyncDataProvider<DomainProxy> {
+  private AppRequestFactory requestFactory;
+
+  /**
+   * It creates a {@link DomainsAsyncDataProvider} defining the
+   * {@link AppRequestFactory} to use to get the data
+   * 
+   * @param requestFactory
+   */
+  public DomainsAsyncDataProvider(AppRequestFactory requestFactory) {
+    this.requestFactory = requestFactory;
+  }
+
+  @Override
+  protected void onRangeChanged(HasData<DomainProxy> display) {
+    final Range range = display.getVisibleRange();
+    Receiver<List<DomainProxy>> rec = new BasicReceiver<List<DomainProxy>>() {
+      /**
+       * It updates the data with the domains received
+       * 
+       * @param domains
+       */
+      public void onSuccess(List<DomainProxy> domains) {
+        updateRowData(range.getStart(), domains);
+        updateRowCount(domains.size(), true);
+      }
+    };
+    this.requestFactory.createDomainRequest().listDomains().fire(rec);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,60 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.domain;
+
+import org.apache.james.bond.client.serverconnection.DomainProxy;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * It defines the methods to show, edit and save a domains
+ */
+public interface ManageDomainsTabView extends IsWidget {
+  /**
+   * It sets the {@link Presenter} that manages the view
+   * 
+   * @param listener
+   */
+  void setPresenter(final Presenter listener);
+
+  /**
+   * It reads the domains from the server to update the information
+   */
+  void updateData();
+
+  /**
+   * It defines the behavior of the presenter that manages the
+   * {@link ManageDomainsTabView}
+   */
+  public interface Presenter {
+    /**
+     * It deletes a domain from the server
+     * 
+     * @param domain
+     */
+    void deleteDomain(final DomainProxy domain);
+
+    /**
+     * It adds a domain to the server
+     * 
+     * @param domain
+     */
+    void addDomain(final String domain);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,203 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.domain;
+
+import org.apache.james.bond.client.serverconnection.DomainProxy;
+
+import com.google.gwt.cell.client.ButtonCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.DataGrid;
+import com.google.gwt.user.cellview.client.Header;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Implementation of {@link ManageDomainsTabView} that shows the domains
+ * information in a {@link DataGrid} letting the user to update, add or delete
+ * the domains
+ */
+public class ManageDomainsTabViewImpl extends Composite implements
+    ManageDomainsTabView {
+  private static ManageDomainsTabViewImplUiBinder uiBinder = GWT
+      .create(ManageDomainsTabViewImplUiBinder.class);
+  private Presenter listener;
+  private DomainsAsyncDataProvider dataProvider;
+  final String COLUMN_NAME_DOMAIN = "Domain";
+  final String COLUMN_NAME_DELETE = "Delete Domain";
+  final String EMPTY_MESSAGE = "No data to display";
+
+  @UiField
+  Button addDomainButton;
+  @UiField
+  DataGrid<DomainProxy> dataGrid;
+  @UiField(provided = true)
+  SimplePager pager;
+
+  interface ManageDomainsTabViewImplUiBinder extends
+      UiBinder<Widget, ManageDomainsTabViewImpl> {
+  }
+
+  /**
+   * It creates a {@link ManageDomainsTabViewImpl} indicating the
+   * {@link DomainsAsyncDataProvider} used by the dataGrid
+   * 
+   * @param dataProvider
+   */
+  public ManageDomainsTabViewImpl(DomainsAsyncDataProvider dataProvider) {
+    this.dataProvider = dataProvider;
+    dataGrid = new DataGrid<DomainProxy>();
+    dataGrid.setWidth("100%");
+
+    dataGrid.setAutoHeaderRefreshDisabled(true);
+    dataGrid.setEmptyTableWidget(new Label(EMPTY_MESSAGE));
+
+    SimplePager.Resources pagerResources = GWT
+        .create(SimplePager.Resources.class);
+    pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+    pager.setDisplay(dataGrid);
+
+    initWidget(uiBinder.createAndBindUi(this));
+
+    buildDomainsTable();
+    dataGrid.setPageSize(20);
+    this.setSize("100%", "100%");
+  }
+
+  /**
+   * It opens a new window to let the user add a new domain
+   * 
+   * @param e
+   */
+  @UiHandler("addDomainButton")
+  void onAddDomainClick(ClickEvent e) {
+    final AddDomainView addDomainView = new AddDomainView(listener);
+    addDomainView.center();
+    addDomainView.show();
+  }
+
+  /**
+   * It creates the columns of the {@link DataGrid}
+   */
+  private void buildDomainsTable() {
+    dataGrid.addColumn(buildColumnDomain(), buildHeader(COLUMN_NAME_DOMAIN),
+        null);
+    dataGrid.addColumn(buildColumnDelete(), buildHeader(COLUMN_NAME_DELETE),
+        null);
+    setAsyncDataProvider();
+  }
+
+  /**
+   * It builds a column with the domains
+   * 
+   * @return
+   */
+  private Column<DomainProxy, String> buildColumnDomain() {
+    Column<DomainProxy, String> columnDomain = new TextColumn<DomainProxy>() {
+      @Override
+      public String getValue(DomainProxy domain) {
+        return domain.getDomain();
+      }
+    };
+
+    columnDomain.setDataStoreName(COLUMN_NAME_DOMAIN);
+    columnDomain.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+    columnDomain.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+
+    return columnDomain;
+  }
+
+  /**
+   * It creates a column that is able to open a dialog to delete the domain in
+   * the selected row
+   * 
+   * @return
+   */
+  private Column<DomainProxy, String> buildColumnDelete() {
+    Column<DomainProxy, String> columnDelete = new Column<DomainProxy, String>(
+        new ButtonCell()) {
+      @Override
+      public String getValue(DomainProxy object) {
+        return "Delete";
+      }
+    };
+
+    columnDelete.setCellStyleNames("delete");
+    columnDelete.setDataStoreName(COLUMN_NAME_DELETE);
+    columnDelete.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+    columnDelete.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+
+    columnDelete.setFieldUpdater(new FieldUpdater<DomainProxy, String>() {
+      public void update(int index, final DomainProxy domain, String value) {
+        final DeleteConfirmationView deleteConfirmationView = new DeleteConfirmationView(
+            domain, listener);
+        deleteConfirmationView.center();
+        deleteConfirmationView.show();
+      }
+    });
+
+    return columnDelete;
+  }
+
+  /**
+   * It creates a header with the text
+   * 
+   * @param text
+   * @return
+   */
+  private Header<String> buildHeader(final String text) {
+    return new Header<String>(new TextCell()) {
+      @Override
+      public String getValue() {
+        return text;
+      }
+    };
+  }
+
+  /**
+   * It sets the {@link DomainsAsyncDataProvider} for the {@link DataGrid}
+   */
+  private void setAsyncDataProvider() {
+    dataProvider.addDataDisplay(dataGrid);
+    dataProvider.updateRowCount(24, true);
+  }
+
+  @Override
+  public void setPresenter(final Presenter listener) {
+    this.listener = listener;
+  }
+
+  @Override
+  public void updateData() {
+    dataProvider.onRangeChanged(dataGrid);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/domain/ManageDomainsTabViewImpl.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,57 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:ct="urn:import:com.google.gwt.user.cellview.client">
+	<ui:style>
+		.panel {
+			width: 100%;
+			height: 100%;
+		}
+		
+		.button {
+			height: 30px;
+			width: 150px;
+		}
+	</ui:style>
+
+	<g:DockLayoutPanel unit="PX" addStyleNames="{style.panel}">
+		<g:north size="40">
+			<g:Button ui:field="addDomainButton" addStyleNames="{style.button}">Add New
+				Domain</g:Button>
+		</g:north>
+		<g:center size="200">
+			<g:ResizeLayoutPanel>
+				<ct:DataGrid ui:field="dataGrid" />
+			</g:ResizeLayoutPanel>
+		</g:center>
+
+		<g:south size="40">
+			<g:HTMLPanel>
+				<table style="width:100%">
+					<tr>
+						<td align='center'>
+							<ct:SimplePager ui:field='pager' />
+						</td>
+					</tr>
+				</table>
+			</g:HTMLPanel>
+		</g:south>
+	</g:DockLayoutPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,90 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView.Presenter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the user to add a new address mapping
+ */
+public class AddAddressMappingView extends DialogBox {
+  private Presenter listener;
+
+  @UiField
+  TextBox userTextBox;
+  @UiField
+  TextBox domainTextBox;
+  @UiField
+  TextBox addressTextBox;
+  @UiField
+  Button addButton;
+  @UiField
+  Button cancelButton;
+
+  private static AddAddressMappingViewUiBinder uiBinder = GWT
+      .create(AddAddressMappingViewUiBinder.class);
+
+  interface AddAddressMappingViewUiBinder extends
+      UiBinder<Widget, AddAddressMappingView> {
+  }
+
+  /**
+   * It creates a new {@link DialogBox} that is able to add a new address
+   * mapping using the {@link Presenter}
+   * 
+   * @param listener
+   */
+  public AddAddressMappingView(Presenter listener) {
+    this.listener = listener;
+    setHTML("Add address mapping");
+    setWidget(uiBinder.createAndBindUi(this));
+  }
+
+  /**
+   * Closes the {@link AddAddressMappingView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+
+  /**
+   * Adds the input mapping and closes the {@link AddAddressMappingView}
+   * 
+   * @param e
+   */
+  @UiHandler("addButton")
+  void onAddClick(ClickEvent e) {
+    listener.addAddressMapping(userTextBox.getText(), domainTextBox.getText(),
+        addressTextBox.getText());
+    this.hide();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddAddressMappingView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,34 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+
+	<g:HTMLPanel>
+		<g:Label>User: </g:Label>
+		<g:TextBox ui:field="userTextBox"></g:TextBox>
+		<g:Label>Domain:</g:Label>
+		<g:TextBox ui:field="domainTextBox"></g:TextBox>
+		<g:Label>Address:</g:Label>
+		<g:TextBox ui:field="addressTextBox"></g:TextBox>
+		<g:Label></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="addButton">Add</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,90 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView.Presenter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the user to add a new regex mapping
+ */
+public class AddRegexMappingView extends DialogBox {
+  private Presenter listener;
+
+  @UiField
+  TextBox userTextBox;
+  @UiField
+  TextBox domainTextBox;
+  @UiField
+  TextBox regexTextBox;
+  @UiField
+  Button addButton;
+  @UiField
+  Button cancelButton;
+
+  private static AddRegexMappingViewUiBinder uiBinder = GWT
+      .create(AddRegexMappingViewUiBinder.class);
+
+  interface AddRegexMappingViewUiBinder extends
+      UiBinder<Widget, AddRegexMappingView> {
+  }
+
+  /**
+   * It creates a new {@link DialogBox} that is able to add a new regex mapping
+   * using the {@link Presenter}
+   * 
+   * @param listener
+   */
+  public AddRegexMappingView(Presenter listener) {
+    this.listener = listener;
+    setHTML("Add regular expression mapping");
+    setWidget(uiBinder.createAndBindUi(this));
+  }
+
+  /**
+   * Closes the {@link AddRegexMappingView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+
+  /**
+   * Adds the input mapping and closes the {@link AddRegexMappingView}
+   * 
+   * @param e
+   */
+  @UiHandler("addButton")
+  void onAddClick(ClickEvent e) {
+    listener.addRegexMapping(userTextBox.getText(), domainTextBox.getText(),
+        regexTextBox.getText());
+    this.hide();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/AddRegexMappingView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,34 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+
+	<g:HTMLPanel>
+		<g:Label>User: </g:Label>
+		<g:TextBox ui:field="userTextBox"></g:TextBox>
+		<g:Label>Domain:</g:Label>
+		<g:TextBox ui:field="domainTextBox"></g:TextBox>
+		<g:Label>Regular expression:</g:Label>
+		<g:TextBox ui:field="regexTextBox"></g:TextBox>
+		<g:Label></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="addButton">Add</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,102 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import org.apache.james.bond.client.manage.mappings.ManageMappingsView.Presenter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the confirmation that the mapping must be
+ * deleted
+ */
+public class DeleteConfirmationView extends DialogBox {
+
+  private static DeleteConfirmationViewUiBinder uiBinder = GWT
+      .create(DeleteConfirmationViewUiBinder.class);
+  private Mapping mapping;
+  private Presenter listener;
+  @UiField
+  Label userLabel;
+  @UiField
+  Label mappingLabel;
+  @UiField
+  Button cancelButton;
+  @UiField
+  Button deleteButton;
+
+  interface DeleteConfirmationViewUiBinder extends
+      UiBinder<Widget, DeleteConfirmationView> {
+  }
+
+  /**
+   * It creates a {@link DeleteConfirmationView} to confirm to delete the
+   * mapping through the listener
+   * 
+   * @param domain
+   * @param listener
+   */
+  public DeleteConfirmationView(Mapping mapping, Presenter listener) {
+    this.mapping = mapping;
+    this.listener = listener;
+
+    setHTML("Delete mapping");
+    setWidget(uiBinder.createAndBindUi(this));
+    userLabel.setText(mapping.getUserDomain());
+    mappingLabel.setText(mapping.getMapping());
+  }
+
+  /**
+   * It deletes the mapping from the server and closes the
+   * {@link DeleteConfirmationView}
+   * 
+   * @param e
+   */
+  @UiHandler("deleteButton")
+  void onChangeClick(ClickEvent e) {
+    String mappingString = mapping.getMapping();
+
+    if (mappingString.startsWith("regex:")) {
+      listener.removeRegexMapping(mapping.getUser(), mapping.getDomain(),
+          mappingString.substring(mappingString.indexOf(":") + 1));
+    } else {
+      listener.removeAddressMapping(mapping.getUser(), mapping.getDomain(),
+          mappingString);
+    }
+    this.hide();
+  }
+
+  /**
+   * It closes the {@link DeleteConfirmationView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/DeleteConfirmationView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,36 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+	<ui:style>
+		.important {
+			font-weight: bold;
+		}
+	</ui:style>
+
+	<g:HTMLPanel>
+		<g:Label>User: </g:Label>
+		<g:Label ui:field="userLabel" addStyleNames="{style.important}"></g:Label>
+		<g:Label>Mapping: </g:Label>
+		<g:Label ui:field="mappingLabel" addStyleNames="{style.important}"></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="deleteButton">Delete</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,92 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import java.util.List;
+
+import org.apache.james.bond.client.serverconnection.MappingProxy;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+/**
+ * It defines the methods to show, edit, deleta and save all mappings
+ */
+public interface ManageMappingsView extends IsWidget {
+  /**
+   * It sets the {@link Presenter} that manages the view
+   * 
+   * @param listener
+   */
+  void setPresenter(final Presenter listener);
+
+  /**
+   * It adds to the view the {@link MappingProxy} list
+   * 
+   * @param mappingList
+   *          mappings to show
+   */
+  void showMappings(List<MappingProxy> mappingList);
+
+  /**
+   * It updates the view
+   */
+  void updateData();
+
+  /**
+   * It defines the behavior of the presenter that manages the
+   * {@link ManageMappingsView}
+   */
+  public interface Presenter {
+    /**
+     * It adds a new address mapping to the user and domain received
+     * 
+     * @param user
+     * @param domain
+     * @param address
+     */
+    void addAddressMapping(String user, String domain, String address);
+
+    /**
+     * It removes the address mapping that matches the user, domain and address
+     * 
+     * @param user
+     * @param domain
+     * @param address
+     */
+    void removeAddressMapping(String user, String domain, String address);
+
+    /**
+     * It adds a new regex mapping for the user and domain
+     * 
+     * @param user
+     * @param domain
+     * @param regex
+     */
+    void addRegexMapping(String user, String domain, String regex);
+
+    /**
+     * It deletes the mapping that matches the user, domain and regex
+     * 
+     * @param user
+     * @param domain
+     * @param regex
+     */
+    void removeRegexMapping(String user, String domain, String regex);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,268 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import java.util.List;
+
+import org.apache.james.bond.client.serverconnection.MappingProxy;
+
+import com.google.gwt.cell.client.ButtonCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
+import com.google.gwt.user.cellview.client.DataGrid;
+import com.google.gwt.user.cellview.client.Header;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
+import com.google.gwt.user.cellview.client.TextColumn;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;
+import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Implementation of {@link ManageMappingsView} that shows the mapping
+ * information in a {@link DataGrid} letting the user to add or delete the
+ * mappings
+ */
+public class ManageMappingsViewImpl extends Composite implements
+    ManageMappingsView {
+  private Presenter listener;
+  private MappingsAsyncDataProvider dataProvider;
+
+  Label label = new Label();
+  @UiField
+  Button addAddressMappingButton;
+  @UiField
+  Button addRegexMappingButton;
+
+  @UiField(provided = true)
+  DataGrid<Mapping> dataGrid;
+  @UiField(provided = true)
+  SimplePager pager;
+
+  final String COLUMN_NAME_USER = "User";
+  final String COLUMN_NAME_MAPPING = "Mapping";
+  final String COLUMN_NAME_DELETE = "Delete Mapping";
+  final String EMPTY_MESSAGE = "No data to display";
+
+  private static ManageMappingsViewImplUiBinder uiBinder = GWT
+      .create(ManageMappingsViewImplUiBinder.class);
+
+  interface ManageMappingsViewImplUiBinder extends
+      UiBinder<Widget, ManageMappingsViewImpl> {
+  }
+
+  /**
+   * It creates a {@link ManageMappingsViewImpl} indicating the
+   * {@link MappingsAsyncDataProvider} used by the dataGrid
+   * 
+   * @param dataProvider
+   */
+  public ManageMappingsViewImpl(MappingsAsyncDataProvider dataProvider) {
+    this.dataProvider = dataProvider;
+    dataGrid = new DataGrid<Mapping>();
+    dataGrid.setWidth("100%");
+
+    dataGrid.setAutoHeaderRefreshDisabled(true);
+    dataGrid.setEmptyTableWidget(new Label(EMPTY_MESSAGE));
+
+    SimplePager.Resources pagerResources = GWT
+        .create(SimplePager.Resources.class);
+    pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+    pager.setDisplay(dataGrid);
+
+    initWidget(uiBinder.createAndBindUi(this));
+    
+    AsyncHandler columnSortHandler = new AsyncHandler(dataGrid);
+    dataGrid.addColumnSortHandler(columnSortHandler);
+    
+    buildMappingTable();
+    dataGrid.setPageSize(20);
+    
+    this.setSize("100%", "100%");
+  }
+
+  /**
+   * It creates the columns of the {@link DataGrid}
+   */
+  private void buildMappingTable() {
+    dataGrid.addColumn(buildColumnUser(), buildHeader(COLUMN_NAME_USER), null);
+    dataGrid.addColumn(buildColumnMapping(), buildHeader(COLUMN_NAME_MAPPING),
+        null);
+    dataGrid.addColumn(buildColumnDelete(), buildHeader(COLUMN_NAME_DELETE),
+        null);
+    setAsyncDataProvider();
+
+  }
+
+  /**
+   * It sets the {@link MappingsAsyncDataProvider} for the {@link DataGrid}
+   */
+  private void setAsyncDataProvider() {
+    dataProvider.addDataDisplay(dataGrid);
+    dataProvider.updateRowCount(24, true);
+  }
+
+  /**
+   * It builds a column with the users including domains
+   * 
+   * @return
+   */
+  private Column<Mapping, String> buildColumnUser() {
+    Column<Mapping, String> columnUser = new TextColumn<Mapping>() {
+      @Override
+      public String getValue(Mapping mapping) {
+        return mapping.getUserDomain();
+      }
+    };
+    columnUser.setDataStoreName(COLUMN_NAME_USER);
+    columnUser.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+    columnUser.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+    columnUser.setSortable(true);
+
+    return columnUser;
+  }
+
+  /**
+   * It builds a column with all the mappings separated with commas
+   * 
+   * @return
+   */
+  private Column<Mapping, String> buildColumnMapping() {
+    Column<Mapping, String> columnMapping = new TextColumn<Mapping>() {
+      @Override
+      public String getValue(Mapping mapping) {
+        return mapping.getMapping();
+      }
+    };
+    columnMapping.setDataStoreName(COLUMN_NAME_MAPPING);
+    columnMapping.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+    columnMapping.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
+    columnMapping.setSortable(true);
+
+    return columnMapping;
+  }
+
+  /**
+   * It creates a column that is able to open a dialog to delete the mapping in
+   * the selected row
+   * 
+   * @return
+   */
+  private Column<Mapping, String> buildColumnDelete() {
+    Column<Mapping, String> columnDelete = new Column<Mapping, String>(
+        new ButtonCell()) {
+      @Override
+      public String getValue(Mapping object) {
+        return "Delete";
+      }
+    };
+
+    columnDelete.setCellStyleNames("delete");
+    columnDelete.setDataStoreName(COLUMN_NAME_DELETE);
+    columnDelete.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
+    columnDelete.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
+
+    columnDelete.setFieldUpdater(new FieldUpdater<Mapping, String>() {
+      public void update(int index, final Mapping mapping, String value) {
+        final DeleteConfirmationView deleteConfirmationView = new DeleteConfirmationView(
+            mapping, listener);
+        deleteConfirmationView.center();
+        deleteConfirmationView.show();
+      }
+    });
+
+    return columnDelete;
+  }
+
+  /**
+   * It creates a header with the text
+   * 
+   * @param text
+   * @return
+   */
+  private Header<String> buildHeader(final String text) {
+    return new Header<String>(new TextCell()) {
+      @Override
+      public String getValue() {
+        return text;
+      }
+    };
+  }
+
+  @Override
+  public void setPresenter(Presenter listener) {
+    this.listener = listener;
+  }
+
+  /**
+   * It opens a new window to let the user add a new address mapping associated
+   * to a user and a domain
+   * 
+   * @param e
+   */
+  @UiHandler("addAddressMappingButton")
+  void onAddAddressMappingClick(ClickEvent e) {
+    final AddAddressMappingView addAddressMappingView = new AddAddressMappingView(
+        listener);
+    addAddressMappingView.center();
+    addAddressMappingView.show();
+  }
+
+  /**
+   * It opens a new window to let the user add a new address mapping associated
+   * to a user and a domain
+   * 
+   * @param e
+   */
+  @UiHandler("addRegexMappingButton")
+  void onAddRegexMappingClick(ClickEvent e) {
+    final AddRegexMappingView addRegexMappingView = new AddRegexMappingView(
+        listener);
+    addRegexMappingView.center();
+    addRegexMappingView.show();
+  }
+
+  @Override
+  public void showMappings(List<MappingProxy> mappingList) {
+    String text = "";
+    for (MappingProxy mapping : mappingList) {
+      text += mapping.getUserAndDomain() + "\n";
+      for (String mappingString : mapping.getMappings()) {
+        text += "*" + mappingString + "\n";
+      }
+    }
+
+    label.setText(text);
+  }
+
+  @Override
+  public void updateData() {
+    dataProvider.onRangeChanged(dataGrid);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/ManageMappingsViewImpl.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,55 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you under the Apache License, Version 2.0 (the "License"); you may not use 
+	this file except in compliance with the License. You may obtain a copy of 
+	the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+	OF ANY KIND, either express or implied. See the License for the specific 
+	language governing permissions and limitations under the License. -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:ct="urn:import:com.google.gwt.user.cellview.client">
+	<ui:style>
+		.panel {
+			width: 100%;
+			height: 100%;
+		}
+		
+		.button {
+			height: 30px;
+			width: 170px;
+		}
+	</ui:style>
+
+	<g:DockLayoutPanel unit="PX" addStyleNames="{style.panel}">
+		<g:north size="40">
+			<g:HorizontalPanel>
+				<g:Button ui:field="addAddressMappingButton" addStyleNames="{style.button}">
+					Add address mapping
+				</g:Button>
+				<g:Button ui:field="addRegexMappingButton" addStyleNames="{style.button}">
+					Add regex mapping
+				</g:Button>
+			</g:HorizontalPanel>
+		</g:north>
+		<!-- DataGrid. -->
+		<g:center>
+			<ct:DataGrid ui:field='dataGrid' />
+		</g:center>
+
+		<!-- Pager. -->
+		<g:south size="3">
+			<g:HTMLPanel>
+				<table style="width:100%">
+					<tr>
+						<td align='center'>
+							<ct:SimplePager ui:field='pager' />
+						</td>
+					</tr>
+				</table>
+			</g:HTMLPanel>
+		</g:south>
+	</g:DockLayoutPanel>
+</ui:UiBinder> 
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/Mapping.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/Mapping.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/Mapping.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/Mapping.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,35 @@
+package org.apache.james.bond.client.manage.mappings;
+
+public class Mapping {
+  private String userDomain;
+  private String mapping;
+
+  public Mapping(String userDomain, String mapping) {
+    this.userDomain = userDomain;
+    this.mapping = mapping;
+  }
+
+  public String getUserDomain() {
+    return userDomain;
+  }
+
+  public void setUserDomain(String userDomain) {
+    this.userDomain = userDomain;
+  }
+
+  public String getMapping() {
+    return mapping;
+  }
+
+  public void setMapping(String mapping) {
+    this.mapping = mapping;
+  }
+
+  public String getUser() {
+    return userDomain.substring(0, userDomain.indexOf("@"));
+  }
+
+  public String getDomain() {
+    return userDomain.substring(userDomain.indexOf("@") + 1);
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/MappingsAsyncDataProvider.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/MappingsAsyncDataProvider.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/MappingsAsyncDataProvider.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/mappings/MappingsAsyncDataProvider.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,73 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.mappings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.james.bond.client.serverconnection.AppRequestFactory;
+import org.apache.james.bond.client.serverconnection.BasicReceiver;
+import org.apache.james.bond.client.serverconnection.MappingProxy;
+
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.Range;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+
+/**
+ * An {@link AsyncDataProvider} that keeps the information about mappings
+ */
+public class MappingsAsyncDataProvider extends AsyncDataProvider<Mapping> {
+  private AppRequestFactory requestFactory;
+
+  /**
+   * It creates a {@link MappingsAsyncDataProvider} defining the
+   * {@link AppRequestFactory} to use to get the data
+   * 
+   * @param requestFactory
+   */
+  public MappingsAsyncDataProvider(AppRequestFactory requestFactory) {
+    this.requestFactory = requestFactory;
+  }
+
+  @Override
+  protected void onRangeChanged(HasData<Mapping> display) {
+    final Range range = display.getVisibleRange();
+    Receiver<List<MappingProxy>> rec = new BasicReceiver<List<MappingProxy>>() {
+      /**
+       * It updates the data with the mappings received
+       * 
+       * @param mappings
+       */
+      public void onSuccess(List<MappingProxy> mappings) {
+        List<Mapping> mappingList = new ArrayList<Mapping>();
+        for (MappingProxy mapping : mappings) {
+          String userDomain = mapping.getUserAndDomain();
+          for (String mappingString : mapping.getMappings()) {
+            mappingList.add(new Mapping(userDomain, mappingString));
+          }
+        }
+
+        updateRowData(range.getStart(), mappingList);
+        updateRowCount(mappingList.size(), true);
+      }
+    };
+    this.requestFactory.createMappingRequest().listMappings().fire(rec);
+  }
+}
\ No newline at end of file

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.java
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.java?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.java (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.java Thu Jul  3 22:57:59 2014
@@ -0,0 +1,88 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.bond.client.manage.user;
+
+import org.apache.james.bond.client.manage.user.ManageUsersTabView.Presenter;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A {@link DialogBox} that allows the user to insert a new user
+ */
+
+public class AddUserView extends DialogBox {
+
+  private static AddUserViewUiBinder uiBinder = GWT
+      .create(AddUserViewUiBinder.class);
+  private Presenter listener;
+
+  interface AddUserViewUiBinder extends UiBinder<Widget, AddUserView> {
+  }
+
+  /**
+   * It creates a new {@link DialogBox} that is able to add a new user using the
+   * {@link Presenter}
+   * 
+   * @param listener
+   */
+  public AddUserView(Presenter listener) {
+    this.listener = listener;
+    setHTML("Add user");
+    setWidget(uiBinder.createAndBindUi(this));
+  }
+
+  @UiField
+  TextBox usernameTextBox;
+  @UiField
+  PasswordTextBox passwordTextBox;
+  @UiField
+  Button addButton;
+  @UiField
+  Button cancelButton;
+
+  /**
+   * Closes the {@link AddUserView}
+   * 
+   * @param e
+   */
+  @UiHandler("cancelButton")
+  void onCancelClick(ClickEvent e) {
+    this.hide();
+  }
+
+  /**
+   * Adds the user and closes the {@link AddUserView}
+   * 
+   * @param e
+   */
+  @UiHandler("addButton")
+  void onAddClick(ClickEvent e) {
+    listener.addUser(usernameTextBox.getText(), passwordTextBox.getText());
+    this.hide();
+  }
+}

Added: james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.ui.xml
URL: http://svn.apache.org/viewvc/james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.ui.xml?rev=1607764&view=auto
==============================================================================
--- james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.ui.xml (added)
+++ james/bond/trunk/src/main/java/org/apache/james/bond/client/manage/user/AddUserView.ui.xml Thu Jul  3 22:57:59 2014
@@ -0,0 +1,32 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+ -->
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+	xmlns:g="urn:import:com.google.gwt.user.client.ui">
+
+	<g:HTMLPanel>
+		<g:Label>Username: </g:Label>
+		<g:TextBox ui:field="usernameTextBox"></g:TextBox>
+		<g:Label>Password:</g:Label>
+		<g:PasswordTextBox ui:field="passwordTextBox"></g:PasswordTextBox>
+		<g:Label></g:Label>
+		<g:Button ui:field="cancelButton">Cancel</g:Button>
+		<g:Button ui:field="addButton">Add</g:Button>
+	</g:HTMLPanel>
+</ui:UiBinder> 
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org