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 do...@apache.org on 2013/08/21 16:08:29 UTC
svn commit: r1516164 [8/20] - in /james/hupa/trunk: ./ client/
client/src/main/java/com/ client/src/main/java/com/google/
client/src/main/java/com/google/web/
client/src/main/java/com/google/web/bindery/
client/src/main/java/com/google/web/bindery/requ...
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,69 @@
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:hupa='urn:import:org.apache.hupa.client.ui'>
+ <ui:image field="buttons" src="res/buttons.png" />
+ <ui:image field="originLogo" src="res/hupa-logo-original-transparent.png" />
+ <ui:style>
+ .minWidth {
+ min-width: 700px;
+ }
+
+ .feature {
+ height: 46px;
+ margin-bottom: 10px;
+ padding: 0 0 0 10px;
+ background: -moz-linear-gradient(top, #404040 0%, #060606 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #404040),
+ color-stop(100%, #060606) );
+ background: -o-linear-gradient(top, #404040 0%, #060606 100%);
+ background: -ms-linear-gradient(top, #404040 0%, #060606 100%);
+ background: linear-gradient(top, #404040 0%, #060606 100%);
+ }
+ </ui:style>
+ <g:LayoutPanel addStyleNames="{style.minWidth}">
+ <g:layer left='0' right='0' top='0' height='92px'>
+ <g:DockLayoutPanel unit="PX" ui:field="Header">
+ <g:north size="23">
+ <g:SimplePanel ui:field="topBarContainer" />
+ </g:north>
+ <g:center>
+ <g:LayoutPanel addStyleNames="{style.feature}"
+ ui:field="HupaFeature">
+
+ <g:layer width="177px" left="10px">
+ <g:SimplePanel ui:field="logoContainer" />
+ </g:layer>
+ <g:layer>
+ <g:SimplePanel ui:field="notificationContainer" />
+ </g:layer>
+ <g:layer width="287px" right="0">
+ <g:SimpleLayoutPanel ui:field="navigationContainer" />
+ </g:layer>
+ </g:LayoutPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:layer>
+ <g:layer left='10px' right='10px' top='84px' bottom="20px">
+ <g:DockLayoutPanel>
+ <g:north size="44">
+ <hupa:_ToolPanel ui:field="toolPanel" />
+ </g:north>
+ <g:center>
+ <g:LayoutPanel ui:field="mainBox">
+ <g:layer left="0%" width="100%" top="0%" height="100%">
+ <hupa:_CenterPanel ui:field="centerPanel" />
+ </g:layer>
+ <g:layer left="0%" width="0%" top="0%" height="0%">
+ <hupa:_CenterSettingPanel ui:field="settingPanel" />
+ </g:layer>
+ <g:layer left="0%" width="0%" top="0%" height="0%">
+ <hupa:_CenterContactPanel ui:field="contactPanel" />
+ </g:layer>
+ <g:layer left="0%" width="0%" top="0%" height="0%">
+ <hupa:_CenterComposePanel ui:field="composePanel" />
+ </g:layer>
+ </g:LayoutPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:layer>
+ </g:LayoutPanel>
+</ui:UiBinder>
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GenericResult.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GenericResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GenericResult.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java Wed Aug 21 14:08:19 2013
@@ -17,46 +17,50 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.shared.rpc;
+package org.apache.hupa.client.ui;
-import java.io.Serializable;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
-import net.customware.gwt.dispatch.shared.Result;
+public interface HupaLayoutable extends Layoutable {
+ AcceptsOneWidget getTopBarView();
-public class GenericResult implements Result, Serializable {
-
- private static final long serialVersionUID = 405509532584299203L;
- private String message = null;
- private boolean success = true;
-
- public GenericResult() {
- }
-
- public GenericResult(String message, boolean success) {
- this.message = message;
- this.success = success;
- }
-
- public String getMessage() {
- return message;
- }
-
- public boolean isSuccess() {
- return success;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void setSuccess(boolean success) {
- this.success = success;
- }
-
- public void setError(String message) {
- setMessage(message);
- setSuccess(false);
- }
-
+ AcceptsOneWidget getLogoView();
+ AcceptsOneWidget getNavigationView();
+
+ AcceptsOneWidget getToolBarView();
+
+ AcceptsOneWidget getFolderListView();
+
+ AcceptsOneWidget getMessageListView();
+
+ AcceptsOneWidget getMessageListFooterView();
+
+ AcceptsOneWidget getMessageContentView();
+
+ AcceptsOneWidget getStatusView();
+
+ AcceptsOneWidget getComposeToolBarView();
+
+ AcceptsOneWidget getComposeView();
+
+ AcceptsOneWidget getNotificationView();
+
+ AcceptsOneWidget getLabelListView();
+ AcceptsOneWidget getContactListView();
+
+ AcceptsOneWidget getLabelPropertiesView();
+
+ void switchTo(int layout);
+
+ AcceptsOneWidget getContactPropertiesView();
+
+ AcceptsOneWidget getContactsListView();
+
+ AcceptsOneWidget getSearchBoxView();
+<<<<<<< HEAD
+=======
+
+ AcceptsOneWidget getSettingNavView();
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/IMAPMessageListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/IMAPMessageListView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/IMAPMessageListView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/IMAPMessageListView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,709 @@
+/****************************************************************
+ * 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.hupa.client.ui;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.HupaMessages;
+import org.apache.hupa.client.activity.IMAPMessageListActivity;
+import org.apache.hupa.client.rf.FetchMessagesRequest;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.client.widgets.ConfirmDialogBox;
+import org.apache.hupa.client.widgets.EnableButton;
+import org.apache.hupa.client.widgets.HasDialog;
+import org.apache.hupa.shared.data.ImapFolderImpl;
+import org.apache.hupa.shared.domain.FetchMessagesAction;
+import org.apache.hupa.shared.domain.FetchMessagesResult;
+import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.Message;
+import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.events.ExpandMessageEvent;
+import org.apache.hupa.shared.events.FolderSelectionEvent;
+import org.apache.hupa.shared.events.FolderSelectionEventHandler;
+import org.apache.hupa.shared.events.LoadMessagesEvent;
+import org.apache.hupa.shared.events.LoadMessagesEventHandler;
+import org.apache.hupa.shared.events.LoginEvent;
+import org.apache.hupa.shared.events.LoginEventHandler;
+import org.apache.hupa.shared.events.LogoutEvent;
+import org.apache.hupa.shared.events.LogoutEventHandler;
+import org.apache.hupa.shared.events.MessagesReceivedEvent;
+import org.apache.hupa.widgets.ui.HasEnable;
+import org.apache.hupa.widgets.ui.Loading;
+import org.cobogw.gwt.user.client.ui.Button;
+import org.cobogw.gwt.user.client.ui.ButtonBar;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.HasChangeHandlers;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
+import com.google.gwt.user.client.ui.SuggestBox;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.view.client.CellPreviewEvent;
+import com.google.gwt.view.client.CellPreviewEvent.Handler;
+import com.google.gwt.view.client.MultiSelectionModel;
+import com.google.gwt.view.client.ProvidesKey;
+import com.google.gwt.view.client.RangeChangeEvent;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SelectionModel;
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+@SuppressWarnings("deprecation")
+public class IMAPMessageListView extends Composite implements IMAPMessageListActivity.Displayable {
+
+ @SuppressWarnings("unused") private HupaMessages messages;
+
+ private EnableButton deleteMailButton;
+ private Button newMailButton;
+ private Button deleteAllMailButton;
+ private ConfirmDialogBox confirmBox = new ConfirmDialogBox();
+ private ConfirmDialogBox confirmDeleteAllBox = new ConfirmDialogBox();
+ private EnableButton markSeenButton;
+ private EnableButton markUnSeenButton;
+
+ private ListBox pageBox = new ListBox();
+ private Anchor allLink;
+ private Anchor noneLink;
+ private Anchor refreshLink;
+ private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@");
+ private SuggestBox searchBox = new SuggestBox(oracle);
+ private Button searchButton;
+ private Loading loading;
+
+ private SimplePager pager;
+ private EventBus eventBus;
+
+ private User user;
+ private ImapFolder folder;
+ private String searchValue;
+ private HupaRequestFactory requestFactory;
+ public final ProvidesKey<Message> KEY_PROVIDER = new ProvidesKey<Message>() {
+ @Override
+ public Object getKey(Message item) {
+ return item == null ? null : item.getUid();
+ }
+ };
+ private SelectionModel<? super Message> selectionModel;
+
+ public void fetch(final int start) {
+ FetchMessagesRequest messagesRequest = requestFactory.messagesRequest();
+ FetchMessagesAction action = messagesRequest.create(FetchMessagesAction.class);
+ final ImapFolder folder1 = messagesRequest.create(ImapFolder.class);
+ folder1.setChildren(folder.getChildren());
+ folder1.setDelimiter(folder.getDelimiter());
+ folder1.setFullName(folder.getFullName());
+ folder1.setMessageCount(folder.getMessageCount());
+ folder1.setName(folder.getName());
+ folder1.setSubscribed(folder.getSubscribed());
+ folder1.setUnseenMessageCount(folder.getUnseenMessageCount());
+ action.setFolder(folder1);
+ action.setOffset(table.getPageSize());
+ action.setSearchString(searchValue);
+ action.setStart(start);
+ messagesRequest.fetch(action).fire(new Receiver<FetchMessagesResult>() {
+
+ @Override
+ public void onFailure(ServerFailure error) {
+ if (error.isFatal()) {
+ throw new RuntimeException(error.getMessage());
+ }
+ }
+
+ @Override
+ public void onSuccess(final FetchMessagesResult result) {
+ assert result != null;
+ // folder.setMessageCount(result.getRealCount());// TODO if do
+ // this, there will be auto bean has been frozen.
+ // folder.setUnseenMessageCount(result.getRealUnreadCount());
+ table.setRowCount(result.getRealCount());
+ table.setRowData(start, result.getMessages());
+
+ pager.setPageStart(start);
+ eventBus.fireEvent(new MessagesReceivedEvent(folder1, result.getMessages()));
+ }
+ });
+ }
+
+ private MessagesCellTable table;
+ private boolean pending;
+
+ @Inject
+ public IMAPMessageListView(final HupaConstants constants, final HupaMessages messages, final EventBus eventBus,
+ final HupaRequestFactory requestFactory, final MessagesCellTable table) {
+ this.table = table;
+ this.eventBus = eventBus;
+ this.requestFactory = requestFactory;
+ selectionModel = table.getSelectionModel();
+ table.addCellPreviewHandler(new Handler<Message>() {
+ @Override
+ public void onCellPreview(CellPreviewEvent<Message> event) {
+ if (hasClickedButFirstCol(event)) {
+ setExpandLoading(true);
+ eventBus.fireEvent(new ExpandMessageEvent(user, folder, event.getValue()));
+ }
+ }
+ private boolean hasClickedButFirstCol(CellPreviewEvent<Message> event) {
+ return "click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn();
+ }
+
+ });
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ @Override
+ public void onSelectionChange(SelectionChangeEvent event) {
+ if (selectedCount() == 0) {
+ toggleButtons(false);
+ } else {
+ toggleButtons(true);
+ }
+ }
+ });
+// table.getCheckboxCol().setFieldUpdater(new FieldUpdater<Message, Boolean>() {
+// @Override
+// public void update(int index, Message object, Boolean value) {
+// selectionModel.setSelected(object, value);
+// if (selectedCount() == 0) {
+// toggleButtons(false);
+// } else {
+// toggleButtons(true);
+// }
+// }
+//
+// private int selectedCount() {
+// return getSelectedMessages().size();
+// }
+//
+// private void toggleButtons(boolean b) {
+// getDeleteEnable().setEnabled(b);
+// getMarkSeenEnable().setEnabled(b);
+// getMarkUnseenEnable().setEnabled(b);
+// }
+// });
+
+ table.addRangeChangeHandler(new RangeChangeEvent.Handler() {
+ @Override
+ public void onRangeChange(RangeChangeEvent event) {
+ fetch(event.getNewRange().getStart());
+ }
+ });
+ // bind some Events
+ eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler() {
+ public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
+ user = loadMessagesEvent.getUser();
+ folder = loadMessagesEvent.getFolder();
+ searchValue = loadMessagesEvent.getSearchValue();
+ fetch(0);
+
+ }
+ });
+ eventBus.addHandler(FolderSelectionEvent.TYPE, new FolderSelectionEventHandler() {
+ public void onFolderSelectionEvent(FolderSelectionEvent event) {
+ user = event.getUser();
+ folder = event.getFolder();
+ searchValue = null;
+ }
+ });
+ eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
+ public void onLogin(LoginEvent event) {
+ user = event.getUser();
+ folder = new ImapFolderImpl(user.getSettings().getInboxFolderName());
+ searchValue = null;
+ if (!pending) {
+ pending = true;
+ Scheduler.get().scheduleFinally(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ pending = false;
+ fetch(0);
+ }
+ });
+ }
+ }
+ });
+ eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
+ public void onLogout(LogoutEvent logoutEvent) {
+ user = null;
+ folder = null;
+ searchValue = null;
+ }
+ });
+
+ this.messages = messages;
+ this.eventBus = eventBus;
+
+ SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
+ pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+ pager.setDisplay(table);
+
+ deleteMailButton = new EnableButton(constants.deleteMailButton());
+ newMailButton = new Button(constants.newMailButton());
+ deleteAllMailButton = new Button(constants.deleteAll());
+ markSeenButton = new EnableButton(constants.markSeen());
+ markUnSeenButton = new EnableButton(constants.markUnseen());
+ allLink = new Anchor(constants.all());
+ noneLink = new Anchor(constants.none());
+ refreshLink = new Anchor(constants.refresh());
+ searchButton = new Button(constants.searchButton());
+ loading = new Loading(constants.loading());
+
+ DockLayoutPanel solidCenterPanel = new DockLayoutPanel(Unit.EM);
+ // solidCenterPanel.addStyleName(HupaCSS.C_msg_list_container);
+
+ HorizontalPanel buttonBar = new HorizontalPanel();
+ buttonBar.addStyleName(HupaCSS.C_buttons);
+
+ ButtonBar navigatorBar = new ButtonBar();
+ navigatorBar.add(newMailButton);
+ deleteMailButton.setEnabled(false);
+ navigatorBar.add(deleteMailButton);
+ buttonBar.add(navigatorBar);
+ buttonBar.add(deleteAllMailButton);
+
+ ButtonBar markButtonBar = new ButtonBar();
+ markButtonBar.add(markSeenButton);
+ markButtonBar.add(markUnSeenButton);
+ buttonBar.add(markButtonBar);
+ // buttonBar.add(refreshLink); TODO
+
+ pageBox.addItem("" + MessagesCellTable.PAGE_SIZE);
+ pageBox.addItem("" + (MessagesCellTable.PAGE_SIZE * 2));
+ pageBox.addItem("" + (MessagesCellTable.PAGE_SIZE * 4));
+ pageBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent event) {
+ // if (pageBox.getSelectedIndex() > 0)
+ table.setVisibleRange(0, Integer.parseInt(pageBox.getItemText(pageBox.getSelectedIndex())));
+ // mailTable.setPageSize(Integer.parseInt(pageBox.getItemText(pageBox.getSelectedIndex())));
+ }
+ });
+
+ HorizontalPanel searchPanel = new HorizontalPanel();
+ searchPanel.addStyleName(HupaCSS.C_buttons);
+
+ searchBox.addStyleName(HupaCSS.C_msg_search);
+ searchBox.setAnimationEnabled(true);
+ searchBox.setAutoSelectEnabled(false);
+ searchBox.setLimit(20);
+ searchBox.addKeyUpHandler(new KeyUpHandler() {
+ public void onKeyUp(KeyUpEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ searchButton.click();
+ }
+ }
+ });
+ searchPanel.add(searchBox);
+ searchPanel.add(searchButton);
+
+ HorizontalPanel hPanel = new HorizontalPanel();
+ hPanel.addStyleName(HupaCSS.C_msg_top_bar);
+ hPanel.add(buttonBar);
+ hPanel.add(searchPanel);
+ hPanel.setCellHorizontalAlignment(searchPanel, HorizontalPanel.ALIGN_RIGHT);
+
+ HorizontalPanel pagerBar = new HorizontalPanel();
+
+ pagerBar.add(pager);
+ pagerBar.add(pageBox);
+
+ solidCenterPanel.addNorth(hPanel, 3);
+ solidCenterPanel.addSouth(pagerBar, 2);
+ solidCenterPanel.add(table);
+
+ // msgListContainer.add(mailTable);
+
+ confirmBox.setText(messages.confirmDeleteMessages());
+ confirmDeleteAllBox.setText(messages.confirmDeleteAllMessages());
+ initWidget(solidCenterPanel);
+ }
+
+ private int selectedCount() {
+ return getSelectedMessages().size();
+ }
+
+ private void toggleButtons(boolean b) {
+ getDeleteEnable().setEnabled(b);
+ getMarkSeenEnable().setEnabled(b);
+ getMarkUnseenEnable().setEnabled(b);
+ }
+ public void reloadData() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#reset()
+ */
+ public void reset() {
+ pageBox.setSelectedIndex(0);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.customware.gwt.presenter.client.widget.WidgetDisplay#asWidget()
+ */
+ public Widget asWidget() {
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getDeleteClick
+ * ()
+ */
+ public HasClickHandlers getDeleteClick() {
+ return deleteMailButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getNewClick()
+ */
+ public HasClickHandlers getNewClick() {
+ return newMailButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getData(int)
+ */
+ public Message getData(int rowIndex) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getConfirmDialog
+ * ()
+ */
+ public HasDialog getConfirmDeleteDialog() {
+ return confirmBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getConfirmDeleteDialogClick()
+ */
+ public HasClickHandlers getConfirmDeleteDialogClick() {
+ return confirmBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getConfirmDeleteAllDialog()
+ */
+ public HasDialog getConfirmDeleteAllDialog() {
+ return confirmDeleteAllBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getConfirmDeleteAllDialogClick()
+ */
+ public HasClickHandlers getConfirmDeleteAllDialogClick() {
+ return confirmDeleteAllBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * deselectAllMessages()
+ */
+ public void deselectAllMessages() {
+ // mailTable.getDataTable().deselectAllRows();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getSelectAllClick
+ * ()
+ */
+ public HasClickHandlers getSelectAllClick() {
+ return allLink;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getSelectNoneClick()
+ */
+ public HasClickHandlers getSelectNoneClick() {
+ return noneLink;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#selectAllMessages
+ * ()
+ */
+ public void selectAllMessages() {
+ // mailTable.getDataTable().selectAllRows();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getSelectedMessages()
+ */
+ @SuppressWarnings("unchecked")
+ public Set<Message> getSelectedMessages() {
+ return ((MultiSelectionModel<Message>) (table.getSelectionModel())).getSelectedSet();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#removeMessages
+ * (java.util.ArrayList)
+ */
+ public void removeMessages(List<Message> messages) {
+ // mailTable.removeRows(messages);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * setPostFetchMessageCount(int)
+ */
+ public void setPostFetchMessageCount(int count) {
+ // cTableModel.setPostCachedRowCount(count);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#redraw()
+ */
+ public void redraw() {
+ // mailTable.reloadPage();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getDeleteAllClick
+ * ()
+ */
+ public HasClickHandlers getDeleteAllClick() {
+ return deleteAllMailButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getMarkSeenClick
+ * ()
+ */
+ public HasClickHandlers getMarkSeenClick() {
+ return markSeenButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getMarkUnseenClick()
+ */
+ public HasClickHandlers getMarkUnseenClick() {
+ return markUnSeenButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getDeleteEnable
+ * ()
+ */
+ public HasEnable getDeleteEnable() {
+ return deleteMailButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getMarkSeenEnable
+ * ()
+ */
+ public HasEnable getMarkSeenEnable() {
+ return markSeenButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getMarkUnseenEnable()
+ */
+ public HasEnable getMarkUnseenEnable() {
+ return markUnSeenButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getRefreshClick
+ * ()
+ */
+ public HasClickHandlers getRefreshClick() {
+ return refreshLink;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#goToPage(int)
+ */
+ public void goToPage(int page) {
+ // if (page != mailTable.getCurrentPage()) {
+ // mailTable.gotoPage(page, false);
+ // }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getCurrentPage
+ * ()
+ */
+ public int getCurrentPage() {
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getRowsPerPageIndex()
+ */
+ public int getRowsPerPageIndex() {
+ return pageBox.getSelectedIndex();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#
+ * getRowsPerPageChange()
+ */
+ public HasChangeHandlers getRowsPerPageChange() {
+ return pageBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.MainPresenter.Display#getSearchClick()
+ */
+ public HasClickHandlers getSearchClick() {
+ return searchButton;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.hupa.client.mvp.MainPresenter.Display#getSearchValue()
+ */
+ public HasValue<String> getSearchValue() {
+ return searchBox;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.hupa.client.mvp.MainPresenter.Display#fillSearchOracle(java
+ * .util.ArrayList)
+ */
+ public void fillSearchOracle(List<Message> messages) {
+ for (Message m : messages) {
+ String subject = m.getSubject();
+ String from = m.getFrom();
+ if (subject != null && subject.trim().length() > 0) {
+ oracle.add(subject.trim());
+ }
+ if (from != null && from.trim().length() > 0) {
+ oracle.add(from.trim());
+ }
+ }
+ // searchBox.setText("");
+ }
+
+ public void setExpandLoading(boolean expanding) {
+ if (expanding) {
+ loading.show();
+ } else {
+ loading.hide();
+ }
+ }
+
+ @Override
+ public MessagesCellTable getTable() {
+ return table;
+ }
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelCell.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelCell.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelCell.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelCell.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,25 @@
+package org.apache.hupa.client.ui;
+
+import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+
+public class LabelCell extends AbstractCell<LabelNode> {
+
+ public LabelCell() {
+ }
+
+ @Override
+ public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder sb) {
+ if (value == null) {
+ return;
+ }
+
+ if (value.getFolder().getSubscribed()) {
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ } else {
+ sb.appendHtmlConstant("<span style='color:gray;'>");
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ sb.appendHtmlConstant("</span>");
+ }
+ }
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,235 @@
+/****************************************************************
+ * 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.hupa.client.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hupa.client.activity.LabelListActivity;
+import org.apache.hupa.client.activity.LabelPropertiesActivity;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.domain.ImapFolder;
+
+<<<<<<< HEAD
+import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+=======
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+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.CellList;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.ProvidesKey;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+public class LabelListView extends Composite implements LabelListActivity.Displayable {
+
+ @Inject LabelPropertiesActivity.Displayable labelProperties;
+ @UiField ScrollPanel thisView;
+
+ @UiField Button add;
+ @UiField Button delete;
+
+ public interface Resources extends CellList.Resources {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @Source("res/CssLabelListView.css")
+ public CellList.Style cellListStyle();
+ }
+ @UiHandler("add")
+ public void handleAdd(ClickEvent e) {
+ labelProperties.cascade(selectionModel.getSelectedObject(), data.getDataList(), CASCADE_TYPE_ADD);
+ }
+
+ private final ImapLabelListDataProvider data;
+
+ @Inject
+ public LabelListView(final HupaRequestFactory rf) {
+ initWidget(binder.createAndBindUi(this));
+ data = new ImapLabelListDataProvider(rf);
+ CellList<LabelNode> cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
+<<<<<<< HEAD
+=======
+ cellList.setPageSize(100);// assume one's labels are under one hundred, otherwise we need a pager
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ cellList.setSelectionModel(selectionModel);
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ public void onSelectionChange(SelectionChangeEvent event) {
+ labelProperties.cascade(selectionModel.getSelectedObject(), data.getDataList(), CASCADE_TYPE_RENAME);
+ }
+ });
+ data.addDataDisplay(cellList);
+ thisView.setWidget(cellList);
+ }
+
+ @Override
+ public SingleSelectionModel<LabelNode> getSelectionModel() {
+ return this.selectionModel;
+ }
+
+ public final SingleSelectionModel<LabelNode> selectionModel = new SingleSelectionModel<LabelNode>(
+ new ProvidesKey<LabelNode>() {
+ @Override
+ public Object getKey(LabelNode item) {
+ return item == null ? null : item.getPath();
+ }
+ });
+
+<<<<<<< HEAD
+ static class LabelCell extends AbstractCell<LabelNode> {
+
+ public LabelCell() {
+ }
+
+ @Override
+ public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder sb) {
+ if (value == null) {
+ return;
+ }
+
+ if (value.getFolder().getSubscribed()) {
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ } else {
+ sb.appendHtmlConstant("<span style='color:gray;'>");
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ sb.appendHtmlConstant("</span>");
+ }
+ }
+ }
+
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements HasRefresh {
+
+ private HupaRequestFactory rf;
+ private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
+ HasData<LabelNode> display;
+
+ public List<LabelNode> getDataList() {
+ return folderNodes;
+ }
+
+ public ImapLabelListDataProvider(HupaRequestFactory rf) {
+ this.rf = rf;
+ }
+
+ @Override
+ public void addDataDisplay(HasData<LabelNode> display) {
+ super.addDataDisplay(display);
+ this.display = display;
+ }
+
+ @Override
+ protected void onRangeChanged(HasData<LabelNode> display) {
+
+ final int start = display.getVisibleRange().getStart();
+
+ rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>() {
+
+ private String INTENTS = " ";
+
+ @Override
+ public void onSuccess(List<ImapFolder> response) {
+ folderNodes.clear();
+ if (response == null || response.size() == 0) {
+ updateRowCount(-1, true);
+ } else {
+ for (ImapFolder folder : response) {
+ fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+ }
+ updateRowData(start, folderNodes);
+ }
+ }
+
+ private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent,
+ String intents) {
+ LabelNode labelNode = new LabelNode();
+ labelNode.setFolder(curFolder);
+ labelNode.setName(curFolder.getName());
+ labelNode.setNameForDisplay(intents + curFolder.getName());
+ labelNode.setParent(parent);
+ labelNode.setPath(curFolder.getFullName());
+ folderNodes.add(labelNode);
+ if("inbox".equalsIgnoreCase(curFolder.getName())){
+ if(selectionModel.getSelectedObject() == null){
+ selectionModel.setSelected(labelNode, true);
+ }
+ }
+ if (curFolder.getHasChildren()) {
+ for (ImapFolder subFolder : curFolder.getChildren()) {
+ fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(ServerFailure error) {
+ if (error.isFatal()) {
+ throw new RuntimeException(error.getMessage());
+ }
+ }
+
+ });
+ }
+
+ @Override
+ public void refresh() {
+ this.onRangeChanged(display);
+ }
+ }
+
+ interface LabelListUiBinder extends UiBinder<DockLayoutPanel, LabelListView> {
+ }
+
+ private static LabelListUiBinder binder = GWT.create(LabelListUiBinder.class);
+
+ @Override
+ public HasClickHandlers getAdd() {
+ return add;
+ }
+
+ @Override
+ public HasClickHandlers getDelete() {
+ return delete;
+ }
+
+ @Override
+ public void refresh() {
+ data.refresh();
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,25 @@
+<!-- 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:DockLayoutPanel>
+ <g:center>
+ <g:ScrollPanel ui:field="thisView" />
+ </g:center>
+ <g:south size="43">
+ <g:FlowPanel ui:field="folderOpButtons">
+ <g:Button ui:field="add">Add</g:Button>
+ <g:Button ui:field="delete">Delete</g:Button>
+ </g:FlowPanel>
+ </g:south>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelNode.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelNode.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelNode.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelNode.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,56 @@
+package org.apache.hupa.client.ui;
+
+import org.apache.hupa.shared.domain.ImapFolder;
+
+public class LabelNode implements Comparable<LabelNode> {
+
+ public static LabelNode ROOT = new LabelNode("---");
+
+ private ImapFolder folder;
+ private String name;
+ private String nameForDisplay;
+ private String path;
+ private LabelNode parent;
+
+ public LabelNode(){}
+ public LabelNode(String name){this.name = name;}
+
+
+ public String getNameForDisplay() {
+ return nameForDisplay;
+ }
+ public void setNameForDisplay(String nameForDisplay) {
+ this.nameForDisplay = nameForDisplay;
+ }
+ public ImapFolder getFolder() {
+ return folder;
+ }
+ public void setFolder(ImapFolder folder) {
+ this.folder = folder;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPath() {
+ return path;
+ }
+ public void setPath(String path) {
+ this.path = path;
+ }
+ public LabelNode getParent() {
+ return parent;
+ }
+ public void setParent(LabelNode parent) {
+ this.parent = parent;
+ }
+ @Override
+ public int compareTo(LabelNode o) {
+ if(name == null) return -1;
+ if(o == null) return 1;
+ return name.compareTo(o.name);
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,192 @@
+/****************************************************************
+ * 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.hupa.client.ui;
+
+import java.util.List;
+
+import org.apache.hupa.client.HupaController;
+import org.apache.hupa.client.activity.LabelListActivity;
+import org.apache.hupa.client.activity.LabelPropertiesActivity;
+import org.apache.hupa.client.rf.CreateFolderRequest;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.client.rf.RenameFolderRequest;
+import org.apache.hupa.shared.domain.CreateFolderAction;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.RenameFolderAction;
+import org.apache.hupa.shared.events.RefreshLabelListEvent;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.EventBus;
+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.CaptionPanel;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+public class LabelPropertiesView extends Composite implements LabelPropertiesActivity.Displayable {
+
+ @Inject HupaRequestFactory rf;
+ @Inject HupaController hc;
+ @Inject EventBus eventBus;
+
+ @UiField TextBox name;
+ private String path;
+
+ @UiField ListBox parent;
+ @UiField Button save;
+
+ @UiField VerticalPanel propContainer;
+ @UiField CaptionPanel information;
+ private static final String ROOT_PATH = "imap_root";
+
+ private int state;
+
+ ImapFolder folder;
+
+ @UiHandler("save")
+ void handleSave(ClickEvent e) {
+ hc.showTopLoading("Saving...");
+ if (state == LabelListActivity.Displayable.CASCADE_TYPE_RENAME) {
+ RenameFolderRequest req = rf.renameFolderRequest();
+ RenameFolderAction action = req.create(RenameFolderAction.class);
+ final ImapFolder f = req.create(ImapFolder.class);
+ f.setFullName(folder.getFullName());
+ action.setFolder(f);
+
+ if (ROOT_PATH.equals(parent.getValue(parent.getSelectedIndex()))) {
+ action.setNewName(name.getText());
+ } else {
+ action.setNewName(parent.getValue(parent.getSelectedIndex()) + "/" + name.getText());
+ }
+ req.rename(action).fire(new Receiver<GenericResult>() {
+ @Override
+ public void onSuccess(GenericResult response) {
+ hc.hideTopLoading();
+ eventBus.fireEvent(new RefreshLabelListEvent());
+ hc.showNotice("The label \"" + f.getFullName() + "\" has been renamed to " + name.getText(), 10000);
+ }
+ @Override
+ public void onFailure(ServerFailure error) {
+ hc.hideTopLoading();
+ hc.showNotice(error.getMessage(), 10000);
+ }
+ });
+ } else if (state == LabelListActivity.Displayable.CASCADE_TYPE_ADD) {
+ CreateFolderRequest req = rf.createFolderRequest();
+ CreateFolderAction action = req.create(CreateFolderAction.class);
+ final ImapFolder f = req.create(ImapFolder.class);
+ f.setFullName(path + "/" + name.getText());
+ action.setFolder(f);
+ req.create(action).fire(new Receiver<GenericResult>() {
+ @Override
+ public void onSuccess(GenericResult response) {
+ hc.hideTopLoading();
+ eventBus.fireEvent(new RefreshLabelListEvent());
+ hc.showNotice("The label \"" + f.getName() + "\" was created.", 10000);
+ }
+ @Override
+ public void onFailure(ServerFailure error) {
+ hc.hideTopLoading();
+ hc.showNotice(error.getMessage(), 10000);
+ }
+ });
+
+ }
+ }
+ public LabelPropertiesView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface Binder extends UiBinder<DecoratorPanel, LabelPropertiesView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
+ @Override
+ public void cascade(LabelNode labelNode, List<LabelNode> wholeList, int type) {
+ state = type;
+ switch (type) {
+ case LabelListActivity.Displayable.CASCADE_TYPE_ADD:
+ makeParentList(labelNode, true, wholeList);
+ name.setText("");
+ path = labelNode.getPath();
+ information.setVisible(false);
+ break;
+ case LabelListActivity.Displayable.CASCADE_TYPE_RENAME:
+ name.setText(labelNode.getName());
+ path = labelNode.getPath();
+ makeParentList(labelNode, false, wholeList);
+ information.setVisible(true);
+ break;
+ default:
+ name.setText("");
+ }
+ folder = labelNode.getFolder();
+ if (!(labelNode.getFolder().getSubscribed())) {
+ name.setEnabled(false);
+ } else {
+ name.setEnabled(true);
+ }
+ }
+ private void makeParentList(LabelNode labelNode, boolean isParent, List<LabelNode> wholeList) {
+ parent.clear();
+ parent.addItem("---", ROOT_PATH);
+ for (LabelNode folderNode : wholeList) {
+ if (isItself(labelNode, isParent, folderNode) || isItsDecendant(labelNode, isParent, folderNode)) {
+ continue;
+ }
+ parent.addItem(folderNode.getNameForDisplay().replace(" ", ". "), folderNode.getPath());
+ }
+
+ int parentIndex = wholeList.indexOf(isParent ? labelNode : labelNode.getParent());
+ parent.setSelectedIndex(parentIndex < 0 ? 0 : parentIndex + 1);
+ }
+ private boolean isItself(LabelNode labelNode, boolean isParent, LabelNode folderNode) {
+ return !isParent && labelNode.compareTo(folderNode) == 0;
+ }
+ private boolean isItsDecendant(LabelNode labelNode, boolean isParent, LabelNode folderNode) {
+ return !isParent && isKinship(labelNode, folderNode);
+ }
+
+ private boolean isKinship(LabelNode labelNode, LabelNode folderNode) {
+ if (folderNode == null) {
+ return false;
+ }
+ if (labelNode.compareTo(folderNode.getParent()) == 0)
+ return true;
+ return isKinship(labelNode, folderNode.getParent());
+ }
+ @Override
+ public HasClickHandlers getSave() {
+ return save;
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml Wed Aug 21 14:08:19 2013
@@ -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. -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
+ ui:generateLocales='default'>
+ <ui:style>
+ .propform fieldset {
+ margin-bottom: 20px;
+ border: 0;
+ padding: 0;
+ }
+
+ .propform fieldset legend {
+ display: block;
+ font-size: 14px;
+ font-weight: bold;
+ padding-bottom: 10px;
+ margin-bottom: 0;
+ }
+
+ .propform fieldset fieldset legend {
+ color: #666;
+ font-size: 12px;
+ }
+
+ fieldset.floating {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ }
+
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ }
+
+ table.attribute {
+ border-spacing: 0;
+ border-collapse: collapse;
+ }
+
+ table.attribute td {
+ width: 80%;
+ padding: 4px 10px;
+ background: #eee;
+ border-bottom: 2px solid #fff;
+ }
+
+ table.noBorder td {
+ border: 0;
+ }
+ </ui:style>
+ <g:DecoratorPanel addStyleNames="{style.propform}">
+ <g:CaptionPanel captionText="Properties">
+ <g:VerticalPanel ui:field="propContainer">
+ <g:CaptionPanel captionText="Location">
+ <g:VerticalPanel addStyleNames="{style.attribute}">
+ <g:HorizontalPanel addStyleNames="{style.noBorder}">
+ <g:Label>
+ <ui:msg key='folderName'>Folder Name:</ui:msg>
+ </g:Label>
+ <g:TextBox ui:field='name' name="_name" />
+ </g:HorizontalPanel>
+ <g:HorizontalPanel addStyleNames="{style.noBorder}">
+ <g:Label>
+ <ui:msg key='parentFolder'>Parent Folder:</ui:msg>
+ </g:Label>
+ <g:ListBox ui:field='parent'>
+ <g:item value="1">---</g:item>
+ </g:ListBox>
+ </g:HorizontalPanel>
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ <g:CaptionPanel ui:field="information" captionText="Information">
+ <g:VerticalPanel addStyleNames="{style.attribute}">
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ <g:Button ui:field="save">Save</g:Button>
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ </g:DecoratorPanel>
+
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Layoutable.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Layoutable.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Layoutable.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Layoutable.java Wed Aug 21 14:08:19 2013
@@ -17,14 +17,10 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client.mvp;
+package org.apache.hupa.client.ui;
-public interface NameAwareWidgetDisplay {
+import com.google.gwt.user.client.ui.LayoutPanel;
- /**
- * Return the name for the Display to show
- *
- * @return name
- */
- public String getName();
+public interface Layoutable {
+ LayoutPanel get();
}
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.java Wed Aug 21 14:08:19 2013
@@ -17,34 +17,46 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client;
+package org.apache.hupa.client.ui;
-import net.customware.gwt.presenter.client.place.PlaceManager;
-
-import org.apache.hupa.client.gin.HupaGinjector;
-import org.apache.hupa.client.mvp.AppPresenter;
-
-import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.gwt.user.client.ui.LayoutPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class LoginLayout implements LoginLayoutable {
+
+ @UiField SimplePanel loginContainer;
+
+ private LayoutPanel loginMainPanel;
+
+ public LoginLayout() {
+ this.loginMainPanel = binder.createAndBindUi(this);
+ }
+
+ @Override
+ public AcceptsOneWidget getLoginView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ loginContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+
+ @Override
+ public LayoutPanel get() {
+ return loginMainPanel;
+ }
+
+ interface LoginLayoutUiBinder extends UiBinder<LayoutPanel, LoginLayout> {
+ }
-public class Hupa implements EntryPoint{
- private final HupaGinjector injector = GWT.create(HupaGinjector.class);
-
- public void onModuleLoad() {
- // remove the loading message from the browser
- com.google.gwt.user.client.Element loading = DOM.getElementById("loading");
-
- DOM.removeChild(RootPanel.getBodyElement(), loading);
-
- AppPresenter aPres = injector.getAppPresenter();
- aPres.bind();
-
- RootPanel.get().add(aPres.getDisplay().asWidget());
-
- PlaceManager placeManager = injector.getPlaceManager();
- placeManager.fireCurrentPlace();
- }
+ private static LoginLayoutUiBinder binder = GWT
+ .create(LoginLayoutUiBinder.class);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayout.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,13 @@
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:hupa='urn:import:org.apache.hupa.client.ui'>
+ <ui:style>
+ .minWidth {
+ min-width: 1150px;
+ }
+ </ui:style>
+ <g:LayoutPanel addStyleNames="{style.minWidth}">
+ <g:layer>
+ <g:SimplePanel ui:field="loginContainer"/>
+ </g:layer>
+ </g:LayoutPanel>
+</ui:UiBinder>
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayoutable.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayoutable.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayoutable.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginLayoutable.java Wed Aug 21 14:08:19 2013
@@ -17,14 +17,10 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client.mvp;
+package org.apache.hupa.client.ui;
-public interface NameAwareWidgetDisplay {
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
- /**
- * Return the name for the Display to show
- *
- * @return name
- */
- public String getName();
+public interface LoginLayoutable extends Layoutable{
+ AcceptsOneWidget getLoginView();
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,239 @@
+/****************************************************************
+ * 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.hupa.client.ui;
+
+import org.apache.hupa.client.activity.LoginActivity;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.resources.client.CssResource.NotStrict;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.FormPanel;
+import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
+import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.PasswordTextBox;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.SubmitButton;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class LoginView extends Composite implements KeyUpHandler,
+ LoginActivity.Displayable {
+
+ /*
+ * invoke style lived in ui.xml should use this unique name, otherwise
+ * define by ourselves
+ */
+ public interface Style extends CssResource {
+ String loading();
+
+ String hidden();
+
+ String display();
+ }
+
+ @UiField Style style;
+ @UiField FlowPanel mainContainer;
+ @UiField FlowPanel innerBox;
+ @UiField Button loginButton;
+ @UiField FlexTable flexTable;
+ @UiField FlowPanel boxBottom;
+ @UiField FlowPanel messageBox;
+ @UiField FlowPanel bottomLine;
+ @UiField FormPanel formPanel;
+ @UiField HTMLPanel message;
+ Resources.Css css = Resources.INSTANCE.stylesheet();
+ private SubmitButton submitButton;
+ PPanel buttonBar = new PPanel();
+
+ /*
+ * We wrap login/password boxes with a form which must be in the html
+ * document, in this way, the browser knows that we are sending a login form
+ * and offers the save password dialog to the user
+ */
+ private TextBox usernameTextBox = TextBox.wrap(DOM.getElementById("email"));
+ private PasswordTextBox passwordTextBox = PasswordTextBox.wrap(DOM
+ .getElementById("password"));
+
+ public interface Resources extends ClientBundle {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @NotStrict
+ @Source("res/CssLoginView.css")
+ public Css stylesheet();
+
+ public interface Css extends CssResource {
+ String loginForm();
+
+ String boxInner();
+
+ String tdTitle();
+
+ String tdInput();
+
+ String pFormbuttons();
+
+ String submitButton();
+
+ String boxBottom();
+
+ String messageBox();
+
+ String bottomLine();
+ }
+ }
+
+ @Inject
+ public LoginView() {
+ initWidget(binder.createAndBindUi(this));
+ mainContainer.addStyleName(css.loginForm());
+ innerBox.addStyleName(css.boxInner());
+ formPanel = FormPanel.wrap(DOM.getElementById("loginForm"), true);
+ submitButton = new SubmitButton("Login");
+ submitButton.setStyleName(css.submitButton());
+ bottomLine.addStyleName(css.bottomLine());
+ buttonBar.add(submitButton);
+ buttonBar.addStyleName(css.pFormbuttons());
+ createLoginPrompt();
+ flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
+ flexTable.setWidget(2, 0, buttonBar);
+
+ formPanel.add(flexTable);
+ innerBox.add(formPanel);
+
+ usernameTextBox.addKeyUpHandler(this);
+ usernameTextBox.setFocus(true);
+ passwordTextBox.addKeyUpHandler(this);
+
+ /*
+ * The user submits the form so as the browser detect it and displays
+ * the save password dialog. Then we click on the hidden loginButton
+ * which stores the presenter clickHandler.
+ */
+ formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
+ public void onSubmit(SubmitEvent event) {
+ if (!usernameTextBox.getValue().trim().isEmpty()
+ && !passwordTextBox.getValue().trim().isEmpty()) {
+ loginButton.click();
+ }
+ // event.cancel();
+ }
+ });
+ innerBox.add(loginButton);
+ loginButton.setVisible(false);
+ setLoading(false);
+ }
+
+ private void createLoginPrompt() {
+ Label userNameLabel = new Label("username");
+ Label passWordLabel = new Label("password");
+ userNameLabel.addStyleName(css.tdTitle());
+ passWordLabel.addStyleName(css.tdTitle());
+ flexTable.setWidget(0, 0, userNameLabel);
+ flexTable.setWidget(0, 1, usernameTextBox);
+ flexTable.setWidget(1, 0, passWordLabel);
+ flexTable.setWidget(1, 1, passwordTextBox);
+ flexTable.getCellFormatter().addStyleName(0, 0, css.tdTitle());
+ flexTable.getCellFormatter().addStyleName(1, 0, css.tdTitle());
+ flexTable.getCellFormatter().addStyleName(0, 1, css.tdInput());
+ flexTable.getCellFormatter().addStyleName(1, 1, css.tdInput());
+ }
+
+ public class PPanel extends SimplePanel {
+ public PPanel() {
+ super(Document.get().createPElement());
+ }
+ }
+
+ @Override
+ public void onKeyUp(KeyUpEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ if (event.getSource().equals(usernameTextBox)) {
+ passwordTextBox.setFocus(true);
+ } else if (event.getSource().equals(passwordTextBox)) {
+ submitButton.click();
+ // formPanel.submit();
+ }
+ }
+
+ }
+
+ @Override
+ public HasClickHandlers getLoginClick() {
+ return loginButton;
+ }
+
+ @Override
+ public HasValue<String> getUserNameValue() {
+ return usernameTextBox;
+ }
+
+ @Override
+ public HasValue<String> getPasswordValue() {
+ return passwordTextBox;
+ }
+
+ @Override
+ public Focusable getUserNameFocus() {
+ return usernameTextBox;
+ }
+
+ // FIXME the ajax loader will not hidden after normal logout
+ @Override
+ public void setLoading(boolean load) {
+ if (load) {
+ message.addStyleName(style.loading());
+ message.addStyleName(style.display());
+ } else {
+ message.removeStyleName(style.loading());
+ message.removeStyleName(style.display());
+ message.addStyleName(style.hidden());
+ }
+ }
+
+ @Override
+ public Widget asWidget() {
+ return this;
+ }
+
+ interface LoginViewUiBinder extends UiBinder<FlowPanel, LoginView> {
+ }
+
+ private static LoginViewUiBinder binder = GWT
+ .create(LoginViewUiBinder.class);
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,84 @@
+<!-- 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:image field='logo' src='res/hupa-logo-64-transparent.png' />
+ <ui:image field="shadow" src="res/loginShadow.png" />
+ <ui:image field="messages" src="res/messages.png" />
+ <ui:image field="loading" src="res/ajaxloader.gif" />
+ <ui:style type="org.apache.hupa.client.ui.LoginView.Style">
+ @sprite .boxBottom {
+ gwt-image: 'shadow';
+ background-position: top center;
+ width: auto;
+ height: auto;
+ margin-top: -3px;
+ padding-top: 10px;
+ }
+
+ .message {
+ min-height: 40px;
+ padding: 5px 25px;
+ text-align: center;
+ }
+
+ @sprite .notice {
+ gwt-image: 'messages';
+ background-position: 0 5px;
+ width: auto;
+ height: auto;
+ color: #555;
+ font-weight: bold;
+ padding: 6px 30px 6px 25px;
+ display: inline-block;
+ white-space: nowrap;
+ text-align: center;
+ cursor: default;
+ }
+
+ .hidden {
+ display: none;
+ }
+
+ .display {
+ display: inline-block;
+ }
+
+ @sprite .loading {
+ gwt-image: 'loading';
+ }
+ </ui:style>
+ <g:FlowPanel ui:field="mainContainer">
+ <g:FlowPanel ui:field="innerBox">
+ <g:Image resource='{logo}'></g:Image>
+ <g:FormPanel ui:field="formPanel">
+ <g:FlexTable ui:field="flexTable" />
+ </g:FormPanel>
+ <g:Button ui:field="loginButton"></g:Button>
+ </g:FlowPanel>
+ <g:FlowPanel ui:field="boxBottom" styleName="{style.boxBottom}">
+ <g:FlowPanel ui:field="messageBox" addStyleNames="{style.message}">
+ <g:HTMLPanel ui:field="message" addStyleNames="{style.notice}{style.hidden}">
+ </g:HTMLPanel>
+ </g:FlowPanel>
+ </g:FlowPanel>
+ <g:FlowPanel ui:field="bottomLine">
+ <g:HTML>
+ You're using
+ <b>Hupa</b>
+ WebMail which is part of the
+ <a target='_blank' href='http://james.apache.org'>Apache-James</a>
+ project.
+ </g:HTML>
+ </g:FlowPanel>
+ </g:FlowPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessage.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessage.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessage.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.java Wed Aug 21 14:08:19 2013
@@ -17,29 +17,24 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.shared.rpc;
+package org.apache.hupa.client.ui;
-import java.io.Serializable;
+import org.apache.hupa.client.activity.LogoActivity;
-import net.customware.gwt.dispatch.shared.Action;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.SimplePanel;
-import org.apache.hupa.shared.data.IMAPFolder;
+public class LogoView extends Composite implements LogoActivity.Displayable {
-public class DeleteMessage implements Action<DeleteMessageResult>, Serializable {
-
- private static final long serialVersionUID = 801294103124082592L;
- private IMAPFolder folder;
-
- public DeleteMessage(IMAPFolder folder) {
- this.folder = folder;
- }
-
- protected DeleteMessage() {
-
- }
-
- public IMAPFolder getFolder() {
- return folder;
- }
+ public LogoView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface LogoUiBinder extends UiBinder<SimplePanel, LogoView> {
+ }
+
+ private static LogoUiBinder binder = GWT.create(LogoUiBinder.class);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LogoView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,18 @@
+<!-- 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:image field="logoImg" src="res/hupa_logo_49_transparent.png" />
+ <g:SimplePanel ui:field="Logo">
+ <g:Image resource='{logoImg}' />
+ </g:SimplePanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,168 @@
+/****************************************************************
+ * 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.hupa.client.ui;
+
+import java.util.List;
+
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.activity.MessageContentActivity;
+import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.shared.domain.MessageAttachment;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+<<<<<<< HEAD
+=======
+import com.google.gwt.event.dom.client.HasClickHandlers;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+<<<<<<< HEAD
+=======
+import com.google.gwt.user.client.ui.HasVisibility;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+<<<<<<< HEAD
+=======
+import com.google.gwt.user.client.ui.SimplePanel;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.inject.Inject;
+
+public class MessageContentView extends Composite implements MessageContentActivity.Displayable {
+ @UiField ScrollPanel messageContent;
+ HTML messageContentHTML = new HTML();
+
+ //TODO should use a scrolled panel which can contain multiple children
+ @UiField FlowPanel attachments;
+<<<<<<< HEAD
+=======
+ @UiField DockLayoutPanel thisPanel;
+ @UiField Anchor rawButton;
+ @UiField SimplePanel rawPanel;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ @Inject
+ public MessageContentView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+<<<<<<< HEAD
+ interface MessageContentUiBinder extends UiBinder<DockLayoutPanel, MessageContentView> {
+ }
+
+ private static MessageContentUiBinder binder = GWT.create(MessageContentUiBinder.class);
+
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ @Override
+ public void fillMessageContent(String messageDetail) {
+ messageContentHTML.setHTML(messageDetail);
+ messageContent.add(messageContentHTML);
+ }
+<<<<<<< HEAD
+
+ @Override
+ public void setAttachments(List<MessageAttachment> attachements, final String folder, final long uid) {
+
+=======
+
+ @Override
+ public void showAttachmentPanel(boolean is){
+ if(is){
+ thisPanel.setWidgetSize(attachments, 216);
+ }else{
+ thisPanel.setWidgetSize(attachments, 0);
+ }
+ }
+
+ @Override
+ public void setAttachments(List<MessageAttachment> attachements, final String folder, final long uid) {
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ attachments.clear();
+ final Element downloadIframe = RootPanel.get("__download").getElement();
+ if (attachements != null) {
+ for (final MessageAttachment messageAttachment : attachements) {
+ Label link = new Label(messageAttachment.getName() + " (" + messageAttachment.getSize() / 1024 + "kB)");
+ link.setStyleName(HupaCSS.C_hyperlink);
+ link.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ String url = getUrl(messageAttachment, folder, uid, false);
+ if (downloadIframe == null)
+ Window.open(url, "_blank", "");
+ else
+ DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
+ }
+ });
+ HorizontalPanel aPanel = new HorizontalPanel();
+ aPanel.addStyleName(HupaCSS.C_attachment);
+ // aPanel.add(new Image(imageBundle.attachmentIcon()));
+ aPanel.add(link);
+ if (messageAttachment.isImage()) {
+ Anchor viewImageLink = new Anchor("View", getUrl(messageAttachment, folder, uid, true), "_blank");
+ viewImageLink.setStyleName(HupaCSS.C_attachment_view);
+ aPanel.add(viewImageLink);
+ }
+ attachments.add(aPanel);
+ }
+ }
+ }
+
+ private String getUrl(MessageAttachment messageAttachment, String folder, long uid, boolean inline) {
+ return GWT.getModuleBaseURL() + SConsts.SERVLET_DOWNLOAD + "?" + SConsts.PARAM_NAME + "="
+ + messageAttachment.getName() + "&" + SConsts.PARAM_FOLDER + "=" + folder + "&" + SConsts.PARAM_UID
+ + "=" + uid + (inline ? "&" + SConsts.PARAM_MODE + "=inline" : "");
+ }
+
+ @Override
+ public void clearContent() {
+ messageContentHTML.setHTML("");
+ }
+
+<<<<<<< HEAD
+=======
+
+ interface Binder extends UiBinder<DockLayoutPanel, MessageContentView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
+ @Override
+ public HasClickHandlers getRaw() {
+ return rawButton;
+ }
+
+ @Override
+ public HasVisibility getRawPanel() {
+ return rawPanel;
+ }
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,113 @@
+<!-- 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'>
+<<<<<<< HEAD
+=======
+ <ui:image field="buttons" src="res/buttons.png" />
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ <ui:style>
+ .messageContent {
+ display: block;
+ background-color: white;
+ width: 100%;
+ height: 100%;
+ }
+
+ .previewheader {
+ position: relative;
+ height: auto;
+ min-height: 52px;
+ padding: 0 0 3px 26px;
+ }
+
+ .messageheader {
+ position: relative;
+ padding: 3px 0;
+ background: #f9f9f9;
+ background: -moz-linear-gradient(top, #fff 0%, #f0f0f0 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff),
+ color-stop(100%, #f0f0f0) );
+ background: -o-linear-gradient(top, #fff 0%, #f0f0f0 100%);
+ background: -ms-linear-gradient(top, #fff 0%, #f0f0f0 100%);
+ background: linear-gradient(top, #fff 0%, #f0f0f0 100%);
+ border-bottom: 1px solid #dfdfdf;
+ }
+
+ .attachBox {
+ float: right;
+ width: 230px;
+ margin: 8px;
+ min-height: 200px;
+ background: #f0f0f0;
+ padding: 8px;
+ }
+<<<<<<< HEAD
+ </ui:style>
+ <g:DockLayoutPanel unit="PX">
+ <g:north size="0">
+ <g:HTMLPanel addStyleNames="{style.previewheader} {style.messageheader}">
+ </g:HTMLPanel>
+ </g:north>
+ <g:center>
+ <g:DockLayoutPanel unit="PX">
+ <g:center>
+ <g:ScrollPanel ui:field="messageContent" addStyleNames="{style.messageContent}" />
+ </g:center>
+ <g:east size="216">
+=======
+
+ .moreHeaders {
+ position: absolute;
+ top: 8px;
+ cursor: pointer;
+ right: 18px;
+ width: 18em;
+ text-align: right;
+ white-space: nowrap;
+ }
+
+ @sprite .inner {
+ gwt-image: 'buttons';
+ background-position: -29px -271px;
+ display: inline-block;
+ width: 16px;
+ height: 13px;
+ text-indent: 1000px;
+ overflow: hidden;
+ }
+ </ui:style>
+ <g:DockLayoutPanel unit="PX">
+ <g:center>
+ <g:DockLayoutPanel unit="PX" ui:field="thisPanel">
+ <g:north size="30">
+ <g:FlowPanel addStyleNames="{style.previewheader} {style.messageheader}">
+ <g:SimplePanel ui:field="rawPanel" addStyleNames="{style.moreHeaders}">
+
+ <g:Anchor ui:field="rawButton" addStyleNames="{style.inner}">Raw
+ </g:Anchor>
+ </g:SimplePanel>
+ </g:FlowPanel>
+ </g:north>
+ <g:center>
+ <g:ScrollPanel ui:field="messageContent"
+ addStyleNames="{style.messageContent}" />
+ </g:center>
+ <g:east size="0">
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ <g:FlowPanel ui:field="attachments" addStyleNames="{style.attachBox}">
+ </g:FlowPanel>
+ </g:east>
+ </g:DockLayoutPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+</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