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 [9/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/MessageListFooterView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,163 @@
+/****************************************************************
+ * 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;
+
+<<<<<<< HEAD
+import org.apache.hupa.client.activity.MessageListFooterActivity;
+=======
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hupa.client.activity.MessageListFooterActivity;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.domain.ImapFolder;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.cellview.client.SimplePager;
+import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
+import com.google.gwt.user.client.ui.Composite;
+<<<<<<< HEAD
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.inject.Inject;
+
+public class MessageListFooterView extends Composite implements MessageListFooterActivity.Displayable {
+
+ @UiField(provided = true)
+ SimplePager simplePager;
+
+ @Inject
+ public MessageListFooterView(final MessagesCellTable table) {
+ SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
+ simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+ simplePager.setDisplay(table);
+// simplePager.setRangeLimited(false);
+ initWidget(binder.createAndBindUi(this));
+=======
+import com.google.gwt.user.client.ui.HasVisibility;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+public class MessageListFooterView extends Composite implements MessageListFooterActivity.Displayable {
+
+ @UiField(provided = true) SimplePager simplePager;
+
+ @UiField ListBox labels;
+ @UiField SimplePanel labelsPanel;
+ private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
+
+ private static final String ROOT_PATH = "imap_root";
+
+ @Inject
+ public MessageListFooterView(final MessagesCellTable table, final HupaRequestFactory rf) {
+ SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
+ simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
+ simplePager.setDisplay(table);
+ // simplePager.setRangeLimited(false);
+ initWidget(binder.createAndBindUi(this));
+
+ 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) {
+ } else {
+ for (ImapFolder folder : response) {
+ fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+ }
+ }
+
+ makeParentList();
+ }
+
+ 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());
+ }
+ }
+
+ });
+ }
+
+ private void makeParentList() {
+ labels.clear();
+ labels.addItem("Move to...", ROOT_PATH);
+ for (LabelNode folderNode : this.folderNodes) {
+ labels.addItem(folderNode.getNameForDisplay().replace(" ", ". "), folderNode.getPath());
+ }
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ interface MessageListFooterUiBinder extends UiBinder<HorizontalPanel, MessageListFooterView> {
+ }
+
+ private static MessageListFooterUiBinder binder = GWT.create(MessageListFooterUiBinder.class);
+
+ @Override
+ public SimplePager getPager() {
+ return simplePager;
+ }
+
+<<<<<<< HEAD
+=======
+ @Override
+ public HasVisibility getLabelsPanel() {
+ return labelsPanel;
+ }
+
+ @Override
+ public ListBox getLabels() {
+ return labels;
+ }
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,32 @@
+<!-- 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:c='urn:import:com.google.gwt.user.cellview.client'>
+
+ <ui:style>
+ .moveMessage {
+ position:absolute;
+ right:20px;
+ }
+ </ui:style>
+ <g:HorizontalPanel>
+ <c:SimplePager ui:field="simplePager" />
+<<<<<<< HEAD
+ <g:SimplePanel addStyleNames="{style.moveMessage}">
+ <g:HTML>Hello</g:HTML>
+=======
+ <g:SimplePanel ui:field="labelsPanel" addStyleNames="{style.moveMessage}">
+ <g:ListBox ui:field="labels"></g:ListBox>
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ </g:SimplePanel>
+ </g:HorizontalPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,100 @@
+/****************************************************************
+ * 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 java.util.Set;
+
+import org.apache.hupa.client.activity.MessageListActivity;
+import org.apache.hupa.shared.domain.Message;
+
+import com.google.gwt.core.client.GWT;
+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.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.RequiresResize;
+import com.google.gwt.user.client.ui.SimpleLayoutPanel;
+import com.google.gwt.view.client.MultiSelectionModel;
+import com.google.inject.Inject;
+
+public class MessageListView extends Composite implements MessageListActivity.Displayable, RequiresResize {
+
+ @UiField SimpleLayoutPanel thisView;
+ private MessagesCellTable grid;
+
+ @Inject
+ public MessageListView(final EventBus eventBus, final MessagesCellTable table) {
+ initWidget(binder.createAndBindUi(this));
+ grid = table;
+ thisView.add(grid);
+ }
+
+ interface MessageListUiBinder extends UiBinder<SimpleLayoutPanel, MessageListView> {
+ }
+
+ private static MessageListUiBinder binder = GWT.create(MessageListUiBinder.class);
+
+ @Override
+ public MessagesCellTable getGrid() {
+ return grid;
+ }
+
+ @Override
+ public void refresh(){
+ grid.refresh();
+ }
+
+ @Override
+ public List<Long> getSelectedMessagesIds() {
+ List<Long> selecteds = new ArrayList<Long>();
+ MultiSelectionModel<? super Message> selectionModel = (MultiSelectionModel<? super Message>) grid
+ .getSelectionModel();
+ selectionModel.getSelectedSet();
+ for (Message msg : getSelectedMessages()) {
+ selecteds.add(msg.getUid());
+ }
+ return selecteds;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<Message> getSelectedMessages() {
+ MultiSelectionModel<? super Message> selectionModel = (MultiSelectionModel<? super Message>) grid
+ .getSelectionModel();
+ return (Set<Message>) selectionModel.getSelectedSet();
+ }
+
+ @Override
+ public void onResize() {
+ grid.onResize();
+ }
+<<<<<<< HEAD
+=======
+
+ @Override
+ public void setSearchValue(String searchValue){
+ grid.setSearchValue(searchValue);
+
+ }
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,15 @@
+<!-- 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:SimpleLayoutPanel ui:field="thisView" />
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageSendView.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageSendView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageSendView.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageSendView.java Wed Aug 21 14:08:19 2013
@@ -17,25 +17,13 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client.mvp;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.HasHTML;
-import com.google.gwt.user.client.ui.HasText;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
+package org.apache.hupa.client.ui;
import eu.maydu.gwt.validation.client.DefaultValidationProcessor;
import eu.maydu.gwt.validation.client.ValidationProcessor;
import eu.maydu.gwt.validation.client.i18n.ValidationMessages;
-import gwtupload.client.IFileInput.FileInputType;
import gwtupload.client.BaseUploadStatus;
+import gwtupload.client.IFileInput.FileInputType;
import gwtupload.client.IUploadStatus;
import gwtupload.client.IUploader;
import gwtupload.client.MultiUploader;
@@ -43,6 +31,7 @@ import gwtupload.client.MultiUploader;
import org.apache.hupa.client.HupaCSS;
import org.apache.hupa.client.HupaConstants;
import org.apache.hupa.client.HupaMessages;
+import org.apache.hupa.client.activity.MessageSendActivity;
import org.apache.hupa.client.validation.AddStyleAction;
import org.apache.hupa.client.validation.EmailListValidator;
import org.apache.hupa.client.validation.NotEmptyValidator;
@@ -53,17 +42,29 @@ import org.apache.hupa.client.widgets.Me
import org.apache.hupa.shared.SConsts;
import org.apache.hupa.shared.rpc.ContactsResult.Contact;
import org.apache.hupa.widgets.editor.Editor;
-import org.apache.hupa.widgets.ui.EnableHyperlink;
import org.apache.hupa.widgets.ui.HasEnable;
import org.apache.hupa.widgets.ui.Loading;
import org.apache.hupa.widgets.ui.MultiValueSuggestArea;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Focusable;
+import com.google.gwt.user.client.ui.HasHTML;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
/**
* View which displays a form which handle sending of mails
*
*
*/
-public class MessageSendView extends Composite implements MessageSendPresenter.Display {
+public class MessageSendView extends Composite implements MessageSendActivity.Displayable {
final VerticalPanel sendContainer = new VerticalPanel();
@@ -83,7 +84,7 @@ public class MessageSendView extends Com
private MultiUploader uploader = null;
private EnableButton sendButton;
- private EnableHyperlink backButton;
+ private Anchor backButton;
private Loading loading;
private ValidationProcessor validator;
@@ -92,7 +93,7 @@ public class MessageSendView extends Com
public MessageSendView(HupaConstants constants, HupaMessages messages) {
sendButton = new EnableButton(constants.sendButton());
- backButton = new EnableHyperlink(constants.backButton(),"");
+ backButton = new Anchor(constants.backButton());
headers = new MessageHeaders(constants);
loading = new Loading(constants.loading());
editor = new Editor(constants);
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,534 @@
+/****************************************************************
+ * 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;
+
+<<<<<<< HEAD
+import java.util.Date;
+import java.util.List;
+=======
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.HupaController;
+import org.apache.hupa.client.activity.ToolBarActivity;
+import org.apache.hupa.client.bundles.HupaImageBundle;
+import org.apache.hupa.client.place.FolderPlace;
+import org.apache.hupa.client.place.MessagePlace;
+import org.apache.hupa.client.rf.FetchMessagesRequest;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.data.MessageImpl.IMAPFlag;
+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;
+<<<<<<< HEAD
+=======
+import org.apache.hupa.shared.events.MessagesReceivedEvent;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+import com.google.gwt.cell.client.Cell.Context;
+import com.google.gwt.cell.client.CheckboxCell;
+import com.google.gwt.cell.client.DateCell;
+import com.google.gwt.cell.client.FieldUpdater;
+import com.google.gwt.cell.client.ImageResourceCell;
+import com.google.gwt.cell.client.TextCell;
+import com.google.gwt.cell.client.ValueUpdater;
+import com.google.gwt.core.client.GWT;
+<<<<<<< HEAD
+=======
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.InputElement;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.place.shared.Place;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.resources.client.ImageResource;
+<<<<<<< HEAD
+import com.google.gwt.user.cellview.client.Column;
+=======
+import com.google.gwt.storage.client.Storage;
+import com.google.gwt.user.cellview.client.Column;
+import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
+import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.user.cellview.client.DataGrid;
+import com.google.gwt.user.cellview.client.Header;
+import com.google.gwt.user.cellview.client.RowStyles;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.DefaultSelectionEventManager;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.MultiSelectionModel;
+import com.google.gwt.view.client.ProvidesKey;
+<<<<<<< HEAD
+=======
+import com.google.gwt.view.client.Range;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
+
+public class MessagesCellTable extends DataGrid<Message> {
+
+ @Inject private ToolBarActivity.Displayable toolBar;
+ @Inject protected HupaController hc;
+ @Inject EventBus eventBus;
+ private String folderName;
+ private String searchValue;
+
+<<<<<<< HEAD
+ public static final int PAGE_SIZE = 25;
+=======
+ public static final int PAGE_SIZE = 100;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ private HupaImageBundle imageBundle;
+ CheckboxColumn checkboxCol = new CheckboxColumn();
+ Column<Message, ?> fromCol = new FromColumn();
+ Column<Message, ?> subjectCol = new SubjectColumn();
+ Column<Message, ?> attachedCol = new AttachmentColumn();
+ Column<Message, ?> dateCol = new DateColumn();
+
+ public interface Resources extends DataGrid.Resources {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @Source("res/CssMessagesCellTable.css")
+ CustomStyle dataGridStyle();
+ }
+
+ public interface CustomStyle extends Style {
+ String fontBold();
+ String fontNormal();
+ }
+
+ public CheckboxColumn getCheckboxCol() {
+ return checkboxCol;
+ }
+
+ public final ProvidesKey<Message> KEY_PROVIDER = new ProvidesKey<Message>() {
+ @Override
+ public Object getKey(Message item) {
+ return item == null ? null : item.getUid();
+ }
+ };
+ private final MultiSelectionModel<? super Message> selectionModel = new MultiSelectionModel<Message>(KEY_PROVIDER);
+
+ PlaceController pc;
+ HupaRequestFactory rf;
+
+ private MessageListDataProvider dataProvider;
+<<<<<<< HEAD
+=======
+ public static final String CONTACTS_STORE = "hupa-contacts";
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ public class MessageListDataProvider extends AsyncDataProvider<Message> implements HasRefresh {
+
+ HasData<Message> display;
+
+ @Override
+ public void addDataDisplay(HasData<Message> display) {
+ super.addDataDisplay(display);
+ this.display = display;
+ }
+
+ @Override
+ public void refresh() {
+ this.onRangeChanged(display);
+ }
+
+<<<<<<< HEAD
+=======
+ Set<String> contacts = new LinkedHashSet<String>();
+ private Storage contactsStore = null;
+
+ private void cacheContacts(List<Message> messages) {
+ for (Message message : messages) {
+ message.getFrom();
+ message.getTo();
+ message.getCc();
+ message.getReplyto();
+
+ contacts.add(message.getFrom());
+ contacts.add(message.getReplyto());
+
+ for (String to : message.getTo()) {
+ contacts.add(to);
+ }
+ for (String cc : message.getCc()) {
+ contacts.add(cc);
+ }
+ }
+ saveToLocalStorage(contacts);
+ }
+ private void saveToLocalStorage(Set<String> contacts) {
+ contactsStore = Storage.getLocalStorageIfSupported();
+ if (contactsStore != null) {
+ String contactsString = contactsStore.getItem(CONTACTS_STORE);
+ if (null != contactsString) {
+ for (String contact : contactsString.split(",")) {
+ contacts.add(contact.replace("[", "").replace("]", "").trim());
+ }
+ }
+ contactsStore.setItem(CONTACTS_STORE, contacts.toString());
+ }
+ }
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ @Override
+ protected void onRangeChanged(HasData<Message> display) {
+ FetchMessagesRequest req = rf.messagesRequest();
+ FetchMessagesAction action = req.create(FetchMessagesAction.class);
+ final ImapFolder f = req.create(ImapFolder.class);
+<<<<<<< HEAD
+ final int start = display.getVisibleRange().getStart();
+=======
+ final int start = display.getVisibleRange().getStart();
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ f.setFullName(parseFolderName(pc));
+ action.setFolder(f);
+ action.setOffset(display.getVisibleRange().getLength());
+ action.setSearchString(searchValue);
+ action.setStart(start);
+ req.fetch(action).fire(new Receiver<FetchMessagesResult>() {
+ @Override
+ public void onSuccess(final FetchMessagesResult response) {
+ if (response == null || response.getRealCount() == 0) {
+ updateRowCount(-1, true);
+ } else {
+ updateRowCount(response.getRealCount(), true);
+ updateRowData(start, response.getMessages());
+<<<<<<< HEAD
+ }
+ hc.hideTopLoading();
+=======
+ getColumnSortList().push(dateCol);
+ }
+ hc.hideTopLoading();
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ public void execute() {
+ cacheContacts(response.getMessages());
+ eventBus.fireEvent(new MessagesReceivedEvent(f, response.getMessages()));
+ }
+ });
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ @Override
+ public void onFailure(ServerFailure error) {
+ if (error.isFatal()) {
+ throw new RuntimeException(error.getMessage());
+ }
+ hc.hideTopLoading();
+ }
+ });
+
+ }
+
+ }
+
+<<<<<<< HEAD
+=======
+ public void setSearchValue(String searchValue){
+ this.searchValue = searchValue;
+ }
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ public final class CheckboxHeader extends Header<Boolean> {
+
+ private final MultiSelectionModel<? super Message> selectionModel;
+ private final AsyncDataProvider<Message> provider;
+
+<<<<<<< HEAD
+ public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel,
+ AsyncDataProvider<Message> provider) {
+=======
+ public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel, AsyncDataProvider<Message> provider) {
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ super(new CheckboxCell());
+ this.selectionModel = selectionModel;
+ this.provider = provider;
+ }
+
+ @Override
+ public Boolean getValue() {
+<<<<<<< HEAD
+ if(selectionModel == null || provider==null){
+ return false;
+ }
+ if(selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() == 0){
+=======
+ if (selectionModel == null || provider == null) {
+ return false;
+ }
+ if (selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() == 0) {
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ return false;
+ }
+ boolean allItemsSelected = selectionModel.getSelectedSet().size() == provider.getDataDisplays().size();
+ return allItemsSelected;
+ }
+
+ @Override
+ public void onBrowserEvent(Context context, Element elem, NativeEvent event) {
+ InputElement input = elem.getFirstChild().cast();
+ Boolean isChecked = input.isChecked();
+ List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
+ for (Message element : displayedItems) {
+ selectionModel.setSelected(element, isChecked);
+ checkboxCol.getFieldUpdater().update(0, element, isChecked);
+ }
+ }
+
+ }
+
+ @Inject
+ public MessagesCellTable(final HupaImageBundle imageBundle, final HupaConstants constants,
+ final PlaceController pc, final HupaRequestFactory rf) {
+ super(PAGE_SIZE, Resources.INSTANCE);
+ this.pc = pc;
+ this.rf = rf;
+ this.imageBundle = imageBundle;
+
+ CheckboxCell headerCheckbox = new CheckboxCell();
+ ImageResourceCell headerAttached = new ImageResourceCell();
+ Header<Boolean> header = new Header<Boolean>(headerCheckbox) {
+ @Override
+ public Boolean getValue() {
+ return false;
+ }
+ };
+ Header<ImageResource> attachedPin = new Header<ImageResource>(headerAttached) {
+ @Override
+ public ImageResource getValue() {
+ return imageBundle.attachmentIcon();
+ }
+ };
+ header.setUpdater(new ValueUpdater<Boolean>() {
+ @Override
+ public void update(Boolean value) {
+ List<Message> displayedItems = MessagesCellTable.this.getVisibleItems();
+ for (Message msg : displayedItems) {
+ checkboxCol.getFieldUpdater().update(0, msg, value);
+ }
+ }
+ });
+
+ addColumn(checkboxCol, new CheckboxHeader(selectionModel, dataProvider));
+ setColumnWidth(checkboxCol, 3, Unit.EM);
+ addColumn(fromCol, constants.mailTableFrom());
+ setColumnWidth(fromCol, 40, Unit.PCT);
+ addColumn(subjectCol, constants.mailTableSubject());
+ setColumnWidth(subjectCol, 60, Unit.PCT);
+ addColumn(attachedCol, attachedPin);
+ setColumnWidth(attachedCol, 33, Unit.PX);
+ addColumn(dateCol, constants.mailTableDate());
+ setColumnWidth(dateCol, 10, Unit.EM);
+ setRowCount(PAGE_SIZE, false);
+ this.setStyleBaseOnTag();
+ // redraw();
+ setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
+ setAutoHeaderRefreshDisabled(true);
+
+ setSelectionModel(selectionModel, DefaultSelectionEventManager.<Message> createBlacklistManager(0));
+
+ if (dataProvider == null) {
+ dataProvider = new MessageListDataProvider();
+ dataProvider.addDataDisplay(this);
+ }
+<<<<<<< HEAD
+ refresh();
+ }
+
+ private String parseFolderName(final PlaceController pc) {
+=======
+
+ // make table sortable
+ AsyncHandler columnSortHandler = new AsyncHandler(this);
+ addColumnSortHandler(columnSortHandler);
+ fromCol.setSortable(true);
+ subjectCol.setSortable(true);
+ attachedCol.setSortable(true);
+ dateCol.setSortable(true);
+
+ refresh();
+ }
+
+ // TODO: this should be perform in the server side, but in the meanwhile it is useful
+ // some kind of sorting in client side.
+ @Override
+ public void setVisibleRangeAndClearData(Range range, boolean forceRangeChangeEvent) {
+ final ColumnSortInfo sortInfo = getColumnSortList().get(0);
+
+ List<Message> sortedList = new ArrayList<Message>(getVisibleItems());
+ Collections.sort(sortedList, new Comparator<Message>() {
+ public int compare(Message o1, Message o2) {
+ Column<?,?> column = sortInfo.getColumn();
+ Message a = sortInfo.isAscending() ? o1 : o2;
+ Message b = sortInfo.isAscending() ? o2 : o1;
+ if (fromCol.equals(column)) {
+ return a.getFrom().compareToIgnoreCase(b.getFrom());
+ }
+ if (attachedCol.equals(column)) {
+ return Boolean.valueOf(a.hasAttachment()).compareTo(Boolean.valueOf(b.hasAttachment()));
+ }
+ if (dateCol.equals(column)) {
+ return a.getReceivedDate().compareTo(b.getReceivedDate());
+ }
+ if (subjectCol.equals(column)) {
+ // Remove Re & Fwd, using ugly regex since replaceAll is not case-insensitive in client side.
+ String s1 = a.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
+ String s2 = b.getSubject().replaceAll("^([Rr][Ee]|[Ff][Ww][Dd]): (.+)$", "$2 ");
+ return s1.compareTo(s2);
+ }
+ return 0;
+ }
+ });
+ dataProvider.updateRowData(range.getStart(), sortedList);
+ }
+
+ public String parseFolderName(final PlaceController pc) {
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ Place place = pc.getWhere();
+ if (place instanceof FolderPlace) {
+ folderName = ((FolderPlace) place).getToken();
+ } else if (place instanceof MessagePlace) {
+ folderName = ((MessagePlace) place).getTokenWrapper().getFolder();
+ }
+ return folderName;
+ }
+
+ Message message; // the object selected by selectionModel
+
+ public String getMessageStyle(Message row) {
+ return haveRead(row) ? getReadStyle() : getUnreadStyle();
+ }
+ private String getUnreadStyle() {
+ return Resources.INSTANCE.dataGridStyle().fontBold();
+ }
+
+ private String getReadStyle() {
+ return Resources.INSTANCE.dataGridStyle().fontNormal();
+ }
+
+ private boolean haveRead(Message row) {
+ return row.getFlags().contains(IMAPFlag.SEEN);
+ }
+ public void markRead(final Message message, final boolean read) {
+ flush();
+ }
+
+ public class CheckboxColumn extends Column<Message, Boolean> {
+
+ public CheckboxColumn() {
+ super(new CheckboxCell(false, false));
+ setFieldUpdater(new FieldUpdater<Message, Boolean>() {
+ @Override
+ public void update(int index, Message object, Boolean value) {
+ selectionModel.setSelected(object, value);
+ int size = selectionModel.getSelectedSet().size();
+ if (size >= 1) {
+ toolBar.enableDealingTools(true);
+ toolBar.enableSendingTools(false);
+ } else {
+ toolBar.enableAllTools(false);
+ }
+ }
+ });
+ }
+
+ @Override
+ public Boolean getValue(Message object) {
+ return selectionModel.isSelected(object);
+ }
+ }
+
+ private class FromColumn extends Column<Message, String> {
+ public FromColumn() {
+ super(new TextCell());
+ }
+
+ @Override
+ public String getValue(Message object) {
+ return object.getFrom();
+ }
+ }
+
+ private class SubjectColumn extends Column<Message, String> {
+ public SubjectColumn() {
+ super(new TextCell());
+ }
+
+ @Override
+ public String getValue(Message object) {
+ return object.getSubject();
+ }
+ }
+
+ private class AttachmentColumn extends Column<Message, ImageResource> {
+ public AttachmentColumn() {
+ super(new ImageResourceCell());
+ }
+
+ @Override
+ public ImageResource getValue(Message object) {
+ return object.hasAttachment() ? imageBundle.attachmentIcon() : null;
+ }
+ }
+
+ private class DateColumn extends Column<Message, Date> {
+ private static final String DATE_FORMAT = "dd.MMM.yyyy";
+
+ public DateColumn() {
+ super(new DateCell(DateTimeFormat.getFormat(DATE_FORMAT)));
+ }
+
+ @Override
+ public Date getValue(Message object) {
+ return object.getReceivedDate();
+ }
+ }
+
+ public void setStyleBaseOnTag() {
+ setRowStyles(new RowStyles<Message>() {
+ @Override
+ public String getStyleNames(Message row, int rowIndex) {
+ return getMessageStyle(row);
+ }
+ });
+ }
+ public void refresh() {
+ dataProvider.refresh();
+ redrawHeaders();
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,136 @@
+/****************************************************************
+ * 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.NavigationActivity;
+import org.apache.hupa.client.place.ContactPlace;
+import org.apache.hupa.client.place.FolderPlace;
+import org.apache.hupa.client.place.SettingPlace;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+<<<<<<< HEAD
+=======
+import com.google.gwt.user.client.Window;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+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.SimplePanel;
+import com.google.inject.Inject;
+
+public class NavigationView extends Composite implements NavigationActivity.Displayable{
+
+ @Inject PlaceController placeController;
+ @UiField Anchor mail;
+ @UiField Anchor setting;
+ @UiField Anchor contact;
+ @UiField SimplePanel contactOuter;
+ @UiField SimplePanel mailOuter;
+ @UiField SimplePanel settingOuter;
+
+ @UiField Style style;
+
+
+ interface Style extends CssResource {
+ String selected();
+ String settingsInnerSelected();
+ String mailInnerSelected();
+ String contactInnerSelected();
+ }
+
+ public NavigationView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ @UiHandler("mail")
+ public void onMailClick(ClickEvent e){
+ mailOuter.addStyleName(style.selected());
+ mail.addStyleName(style.mailInnerSelected());
+
+ settingOuter.removeStyleName(style.selected());
+ setting.removeStyleName(style.settingsInnerSelected());
+
+ contactOuter.removeStyleName(style.selected());
+ contact.removeStyleName(style.contactInnerSelected());
+ //FIXME need the configure one
+ if(GWT.isProdMode()){
+ placeController.goTo(new FolderPlace("INBOX"));
+ }else{
+ placeController.goTo(new FolderPlace("Mock-Inbox"));
+ }
+ }
+
+
+
+ @UiHandler("setting")
+ public void onSettingClick(ClickEvent e){
+ mailOuter.removeStyleName(style.selected());
+ mail.removeStyleName(style.mailInnerSelected());
+ contactOuter.removeStyleName(style.selected());
+ contact.removeStyleName(style.contactInnerSelected());
+
+ settingOuter.addStyleName(style.selected());
+ setting.addStyleName(style.settingsInnerSelected());
+<<<<<<< HEAD
+ placeController.goTo(new SettingPlace("folders"));
+=======
+ placeController.goTo(new SettingPlace("labels"));
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+
+ @UiHandler("contact")
+ public void onContactClick(ClickEvent e){
+<<<<<<< HEAD
+ mailOuter.removeStyleName(style.selected());
+ mail.removeStyleName(style.mailInnerSelected());
+ contactOuter.addStyleName(style.selected());
+ contact.addStyleName(style.contactInnerSelected());
+
+ settingOuter.removeStyleName(style.selected());
+ setting.removeStyleName(style.settingsInnerSelected());
+ placeController.goTo(new ContactPlace("contacts"));
+=======
+ Window.alert("//TODO");
+// mailOuter.removeStyleName(style.selected());
+// mail.removeStyleName(style.mailInnerSelected());
+// contactOuter.addStyleName(style.selected());
+// contact.addStyleName(style.contactInnerSelected());
+//
+// settingOuter.removeStyleName(style.selected());
+// setting.removeStyleName(style.settingsInnerSelected());
+// placeController.goTo(new ContactPlace("contacts"));
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+
+
+ interface NavigationUiBinder extends UiBinder<DockLayoutPanel, NavigationView> {
+ }
+
+ private static NavigationUiBinder binder = GWT.create(NavigationUiBinder.class);
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,114 @@
+<!-- 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="buttons" src="res/buttons.png"/>
+ <ui:style type="org.apache.hupa.client.ui.NavigationView.Style">
+ @sprite .navigation .inner {
+ gwt-image: 'buttons';
+ display: inline-block;
+ font-size: 110%;
+ font-weight: normal;
+ text-shadow: 0px 1px 1px black;
+ padding: 5px 0 0 34px;
+ height: 19px;
+ cursor: pointer;
+ color: #eee;
+ }
+
+ .navigation {
+ display: inline-block;
+ height: 34px;
+ padding: 12px 10px 0 6px;
+ }
+
+ .selected {
+ background-color: #2c2c2c;
+ }
+
+ .navigation .mailInner {
+ background-position: 0 2px;
+ }
+
+ .navigation .mailInnerSelected {
+ background-position: 0 -22px;
+ color: #3cf;
+ }
+
+
+ .navigation mailInner:hover,.navigation .mailInner.selected {
+ background-position: 0 -22px;
+ }
+
+ .navigation .contactInner {
+ background-position: 0 -48px;
+ }
+ .navigation .contactInnerSelected {
+ background-position: 0 -72px;
+ }
+
+ .navigation a.contact:hover span.inner,.navigation a.contact.selected span.inner
+ {
+ background-position: 0 -72px;
+ }
+
+ .navigation .settingsInner {
+ background-position: 0 -96px;
+ }
+
+ .navigation .settingsInnerSelected {
+ background-position: 0 -120px;
+ }
+ .navigation a.settings:hover span.inner,.navigation a.settings.selected span.inner
+ {
+ background-position: 0 -120px;
+ }
+
+ .navigation a.calendar span.inner {
+ background-position: 0 -144px;
+ }
+
+ .navigation a.calendar:hover span.inner,.navigation a.calendar.selected span.inner
+ {
+ background-position: 0 -168px;
+ }
+ </ui:style>
+ <g:DockLayoutPanel unit="PX" ui:field="Navigation">
+ <g:west size="74">
+ <g:SimplePanel ui:field="mailOuter" addStyleNames="{style.navigation} {style.selected}">
+ <g:Anchor ui:field="mail"
+ addStyleNames="
+ {style.mailInnerSelected} {style.inner}">
+ Mail
+ </g:Anchor>
+ </g:SimplePanel>
+ </g:west>
+ <g:center>
+ <g:SimplePanel ui:field="contactOuter" addStyleNames="{style.navigation}">
+ <g:Anchor ui:field="contact"
+ addStyleNames="
+ {style.contactInner} {style.inner}">
+ Contacts
+ </g:Anchor>
+ </g:SimplePanel>
+ </g:center>
+ <g:east size="97">
+ <g:SimplePanel ui:field="settingOuter" addStyleNames="{style.navigation}">
+ <g:Anchor ui:field="setting"
+ addStyleNames="
+ {style.settingsInner} {style.inner}">
+ Settings
+ </g:Anchor>
+ </g:SimplePanel>
+ </g:east>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.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/NotificationView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.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/NotificationView.java Wed Aug 21 14:08:19 2013
@@ -17,34 +17,51 @@
* 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.activity.NotificationActivity;
-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.resources.client.CssResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+
+public class NotificationView extends Composite implements NotificationActivity.Displayable {
+
+ @UiField FlowPanel notificationContainer;
+ @UiField HTML notification;
+
+ @UiField Style style;
+
+
+ interface Style extends CssResource {
+ String hideNotification();
+ }
+
+
+ @Override
+ public void notice(String html){
+ this.notificationContainer.removeStyleName(style.hideNotification());
+ this.notification.setHTML(html);
+ }
+
+ @Override
+ public void hideNotification(){
+ this.notification.setHTML("");
+ this.notificationContainer.addStyleName(style.hideNotification());
+ }
+
+
+ public NotificationView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface NotificationUiBinder extends UiBinder<FlowPanel, NotificationView> {
+ }
-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 NotificationUiBinder binder = GWT.create(NotificationUiBinder.class);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NotificationView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,48 @@
+<!-- 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 type="org.apache.hupa.client.ui.NotificationView.Style">
+ .textCenter {
+ text-align: center;
+ }
+
+ .hideNotification {
+ display: none;
+ }
+
+ .fontFeel {
+ z-index: 9999;
+ position: relative;
+ display: inline-block;
+ border-color: #f0c36d;
+ background-color: #f9edbe;
+ padding: 3px 10px;
+ border: 1px solid transparent;
+ border-radius: 2px;
+ -webkit-border-radius: 2px;
+ -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+ color: black;
+ font-weight: bold;
+ }
+
+ .notificationPosition {
+ top: 10px;
+ }
+ </ui:style>
+ <g:FlowPanel addStyleNames="{style.hideNotification} {style.textCenter}"
+ ui:field="notificationContainer">
+ <g:HTML addStyleNames="{style.fontFeel} {style.notificationPosition}"
+ ui:field="notification" />
+ </g:FlowPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,125 @@
+/****************************************************************
+ * 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.activity.SearchBoxActivity;
+import org.apache.hupa.shared.domain.Message;
+
+import com.google.gwt.core.client.GWT;
+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;
+<<<<<<< HEAD
+=======
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasValue;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
+import com.google.gwt.user.client.ui.SuggestBox;
+<<<<<<< HEAD
+=======
+import com.google.gwt.user.client.ui.TextBox;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+public class SearchBoxView extends Composite implements SearchBoxActivity.Displayable {
+
+ private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@");
+<<<<<<< HEAD
+ private SuggestBox searchBox = new SuggestBox(oracle);
+ private Button searchButton = new Button("Search");
+ @UiField protected HorizontalPanel thisPanel;
+
+ public SearchBoxView() {
+ initWidget(binder.createAndBindUi(this));
+
+ searchBox.addKeyUpHandler(new KeyUpHandler() {
+ public void onKeyUp(KeyUpEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+=======
+ private TextBox searchBox = new TextBox();
+ private Button searchButton = new Button("Search");
+ @UiField protected HorizontalPanel thisPanel;
+
+ // @SuppressWarnings("deprecation")
+ public SearchBoxView() {
+ initWidget(binder.createAndBindUi(this));
+
+ // searchBox.addStyleName(HupaCSS.C_msg_search);
+
+ // searchBox.setAnimationEnabled(true);
+ // searchBox.setAutoSelectEnabled(false);
+ // searchBox.setLimit(20);
+ searchBox.getElement().setAttribute("type", "search");
+ searchBox.getElement().setAttribute("placeholder", "Search...");
+ searchBox.getElement().setAttribute("results", "10");
+ searchBox.getElement().setAttribute("incremental", "incremental");
+ searchBox.getElement().setAttribute("name", "s");
+ searchBox.addKeyUpHandler(new KeyUpHandler() {
+ public void onKeyUp(KeyUpEvent event) {
+ if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER || (event.getNativeKeyCode() == KeyCodes.KEY_BACKSPACE && searchBox.getText().trim().equals(""))) {
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ searchButton.click();
+ }
+ }
+ });
+ thisPanel.add(searchBox);
+ thisPanel.add(searchButton);
+ }
+
+ @Override
+ public HasClickHandlers getSearchClick() {
+ return searchButton;
+ }
+
+ @Override
+ public HasValue<String> getSearchValue() {
+ return searchBox;
+ }
+
+ @Override
+ 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("");
+ }
+
+ interface SearchBoxUiBinder extends UiBinder<HorizontalPanel, SearchBoxView> {
+ }
+
+ private static SearchBoxUiBinder binder = GWT.create(SearchBoxUiBinder.class);
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SearchBoxView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,16 @@
+<!-- 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:HorizontalPanel ui:field="thisPanel">
+ </g:HorizontalPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.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/SettingNavView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.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/SettingNavView.java Wed Aug 21 14:08:19 2013
@@ -17,34 +17,48 @@
* 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.activity.SettingNavActivity;
-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;
-
-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();
- }
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTMLPanel;
+
+public class SettingNavView extends Composite implements SettingNavActivity.Displayable {
+
+ @UiField Element navLabelsItem;
+ @UiField Anchor labelsAnchor;
+
+ public SettingNavView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface Binder extends UiBinder<HTMLPanel, SettingNavView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
+ @Override
+ public HasClickHandlers getLabelsAchor() {
+ return labelsAnchor;
+ }
+
+ @Override
+ public void singleSelect(int i) {
+ switch(i){
+ default:selectNavLabelItem();
+ }
+ }
+
+ private void selectNavLabelItem() {
+ String clazz = navLabelsItem.getAttribute("class");
+ navLabelsItem.setAttribute("class", clazz + " selected");
+ }
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,37 @@
+<!-- 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>
+ .selected {
+ font-weight: bold;
+ }
+ </ui:style>
+ <g:HTMLPanel ui:field="thisPanel">
+ <div id="settings-sections" class="uibox listbox">
+ <h2 class="boxtitle">Settings</h2>
+ <div id="settings-tabs" class="scroller">
+ <span class="listitem folders selected" ui:field="navLabelsItem">
+ <g:Anchor ui:field="labelsAnchor">Labels
+ </g:Anchor>
+ </span>
+ <!-- <span id="settingstabfolders" class="listitem preferences selected">
+ <a title="Manage folders" id="rcmbtn106" >Folders</a> </span> -->
+ <!-- <span id="settingstabidentities" class="listitem identities"> <a
+ title="Manage identities for this account" id="rcmbtn107" >Identities</a>
+ </span> -->
+
+ </div>
+ </div>
+
+ </g:HTMLPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ShowMorePagerPanel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ShowMorePagerPanel.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ShowMorePagerPanel.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ShowMorePagerPanel.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,118 @@
+package org.apache.hupa.client.ui;
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed 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 com.google.gwt.sample.showcase.client.content.cell;
+
+import com.google.gwt.event.dom.client.ScrollEvent;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.user.cellview.client.AbstractPager;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.view.client.HasRows;
+
+/**
+ * A scrolling pager that automatically increases the range every time the
+ * scroll bar reaches the bottom.
+ */
+public class ShowMorePagerPanel extends AbstractPager {
+
+ /**
+ * The default increment size.
+ */
+ private static final int DEFAULT_INCREMENT = 20;
+
+ /**
+ * The increment size.
+ */
+ private int incrementSize = DEFAULT_INCREMENT;
+
+ /**
+ * The last scroll position.
+ */
+ private int lastScrollPos = 0;
+
+ /**
+ * The scrollable panel.
+ */
+ private final ScrollPanel scrollable = new ScrollPanel();
+
+ /**
+ * Construct a new {@link ShowMorePagerPanel}.
+ */
+ public ShowMorePagerPanel() {
+ initWidget(scrollable);
+
+ // Do not let the scrollable take tab focus.
+ scrollable.getElement().setTabIndex(-1);
+
+ // Handle scroll events.
+ scrollable.addScrollHandler(new ScrollHandler() {
+ public void onScroll(ScrollEvent event) {
+ // If scrolling up, ignore the event.
+ int oldScrollPos = lastScrollPos;
+ lastScrollPos = scrollable.getVerticalScrollPosition();
+ if (oldScrollPos >= lastScrollPos) {
+ return;
+ }
+
+ HasRows display = getDisplay();
+ if (display == null) {
+ return;
+ }
+ int maxScrollTop = scrollable.getWidget().getOffsetHeight()
+ - scrollable.getOffsetHeight();
+ if (lastScrollPos >= maxScrollTop) {
+ // We are near the end, so increase the page size.
+ int newPageSize = Math.min(
+ display.getVisibleRange().getLength() + incrementSize,
+ display.getRowCount());
+ display.setVisibleRange(0, newPageSize);
+ }
+ }
+ });
+ }
+
+ /**
+ * Get the number of rows by which the range is increased when the scrollbar
+ * reaches the bottom.
+ *
+ * @return the increment size
+ */
+ public int getIncrementSize() {
+ return incrementSize;
+ }
+
+ @Override
+ public void setDisplay(HasRows display) {
+ assert display instanceof Widget : "display must extend Widget";
+ scrollable.setWidget((Widget) display);
+ super.setDisplay(display);
+ }
+
+ /**
+ * Set the number of rows by which the range is increased when the scrollbar
+ * reaches the bottom.
+ *
+ * @param incrementSize the incremental number of rows
+ */
+ public void setIncrementSize(int incrementSize) {
+ this.incrementSize = incrementSize;
+ }
+
+ @Override
+ protected void onRangeOrRowCountChanged() {
+ }
+}
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.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/StatusView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.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/StatusView.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.StatusActivity;
-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.HTMLPanel;
-import org.apache.hupa.shared.data.IMAPFolder;
+public class StatusView extends Composite implements StatusActivity.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 StatusView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface StatusUiBinder extends UiBinder<HTMLPanel, StatusView> {
+ }
+
+ private static StatusUiBinder binder = GWT.create(StatusUiBinder.class);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/StatusView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,16 @@
+<!-- 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:HTMLPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,422 @@
+/****************************************************************
+ * 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.ToolBarActivity;
+import org.apache.hupa.client.place.ComposePlace;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.domain.Message;
+import org.apache.hupa.shared.domain.MessageDetails;
+import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.events.DeleteClickEvent;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.EventBus;
+<<<<<<< HEAD
+import com.google.gwt.event.shared.HandlerRegistration;
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.resources.client.CssResource;
+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.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DecoratedPopupPanel;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class ToolBarView extends Composite implements ToolBarActivity.Displayable {
+
+ @Inject private PlaceController placeController;
+ @Inject private HupaRequestFactory requestFactory;
+ @Inject private EventBus eventBus;
+
+ @UiField Anchor refresh;
+ @UiField Anchor compose;
+ @UiField Anchor reply;
+ @UiField HTMLPanel replyAllGroup;
+ @UiField Anchor replyAll;
+ @UiField HTMLPanel forwardGroup;
+ @UiField Anchor forward;
+ @UiField Anchor delete;
+ @UiField Anchor mark;
+ @UiField Anchor more;
+
+ @UiField HTMLPanel replyAllTip;
+ @UiField HTMLPanel forwardTip;
+
+<<<<<<< HEAD
+ HandlerRegistration replyReg;
+ HandlerRegistration replyAllReg;
+ HandlerRegistration forwardReg;
+ HandlerRegistration deleteReg;
+ HandlerRegistration markReg;
+
+ @UiField Style style;
+=======
+ @UiField Style style;
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ interface Style extends CssResource {
+ String disabledButton();
+ String popupMenu();
+ String activeIcon();
+ String toolBarMenu();
+ String listicon();
+ String read();
+ String unread();
+ }
+
+ private VerticalPanel popup;
+ final DecoratedPopupPanel simplePopup = new DecoratedPopupPanel(true);
+ private Anchor markRead;
+ private Anchor markUnread;
+
+ private Parameters parameters;
+
+ public Parameters getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public void setParameters(Parameters parameters) {
+ this.parameters = parameters;
+ }
+
+ public static class Parameters {
+ private User user;
+ private String folderName;
+ private Message oldmessage;
+ private MessageDetails oldDetails;
+
+ public Parameters(User user, String folderName, Message oldmessage, MessageDetails oldDetails) {
+ this.user = user;
+ this.folderName = folderName;
+ this.oldmessage = oldmessage;
+ this.oldDetails = oldDetails;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public String getFolderName() {
+ return folderName;
+ }
+
+ public void setFolderName(String folderName) {
+ this.folderName = folderName;
+ }
+
+ public Message getOldmessage() {
+ return oldmessage;
+ }
+
+ public void setOldmessage(Message oldmessage) {
+ this.oldmessage = oldmessage;
+ }
+
+ public MessageDetails getOldDetails() {
+ return oldDetails;
+ }
+
+ public void setOldDetails(MessageDetails oldDetails) {
+ this.oldDetails = oldDetails;
+ }
+ }
+
+
+ public ToolBarView() {
+ initWidget(binder.createAndBindUi(this));
+ simplePopup.addStyleName(style.popupMenu());
+ mark.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ // Reposition the popup relative to the button
+ Widget source = (Widget) event.getSource();
+ int left = source.getAbsoluteLeft();
+ int top = source.getAbsoluteTop() + source.getOffsetHeight();
+ simplePopup.setPopupPosition(left, top);
+ // Show the popup
+ simplePopup.show();
+ }
+ });
+ popup = new VerticalPanel();
+ markRead = new Anchor("As Read");
+ markUnread = new Anchor("As Unread");
+ popup.addStyleName(style.toolBarMenu());
+ markRead.addStyleName(style.activeIcon());
+ markRead.addStyleName(style.listicon());
+ markRead.addStyleName(style.read());
+ markUnread.addStyleName(style.activeIcon());
+ markUnread.addStyleName(style.listicon());
+ markUnread.addStyleName(style.unread());
+ popup.add(markRead);
+ popup.add(markUnread);
+ simplePopup.setWidget(popup);
+
+<<<<<<< HEAD
+ markReg = mark.addClickHandler(markHandler);
+ deleteReg = delete.addClickHandler(deleteHandler);
+ replyReg = reply.addClickHandler(replyHandler);
+ replyAllReg = replyAll.addClickHandler(replyAllHandler);
+ forwardReg = forward.addClickHandler(forwardHandler);
+=======
+ mark.addClickHandler(markHandler);
+ delete.addClickHandler(deleteHandler);
+ reply.addClickHandler(replyHandler);
+ replyAll.addClickHandler(replyAllHandler);
+ forward.addClickHandler(forwardHandler);
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ @UiHandler("compose")
+ void handleClick(ClickEvent e) {
+ placeController.goTo(new ComposePlace("new").with(parameters));
+ }
+ private ClickHandler forwardHandler = new ClickHandler(){
+
+ @Override
+ public void onClick(ClickEvent event) {
+ placeController.goTo(new ComposePlace("forward").with(parameters));
+ }
+
+ };
+ private ClickHandler replyAllHandler = new ClickHandler(){
+
+ @Override
+ public void onClick(ClickEvent event) {
+ placeController.goTo(new ComposePlace("replyAll").with(parameters));
+ }
+
+ };
+ private ClickHandler replyHandler = new ClickHandler(){
+
+ @Override
+ public void onClick(ClickEvent event) {
+ placeController.goTo(new ComposePlace("reply").with(parameters));
+ }
+
+ };
+ private ClickHandler deleteHandler = new ClickHandler(){
+
+ @Override
+ public void onClick(ClickEvent event) {
+ eventBus.fireEvent(new DeleteClickEvent());
+ }
+ };
+ private ClickHandler markHandler = new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ Widget source = (Widget) event.getSource();
+ int left = source.getAbsoluteLeft();
+ int top = source.getAbsoluteTop() + source.getOffsetHeight();
+ simplePopup.setPopupPosition(left, top);
+ simplePopup.show();
+ }
+ };
+ @Override
+ public HasClickHandlers getMark() {
+ return mark;
+ }
+
+ @Override
+ public HasClickHandlers getMarkRead() {
+ return markRead;
+ }
+
+ @Override
+ public HasClickHandlers getMarkUnread() {
+ return markUnread;
+ }
+
+ @Override
+ public HasClickHandlers getCompose() {
+ return compose;
+ }
+ @Override
+ public HasClickHandlers getReply() {
+ return reply;
+ }
+
+ @Override
+ public HasClickHandlers getReplyAll() {
+ return replyAll;
+ }
+
+ @Override
+ public HasClickHandlers getForward() {
+ return forward;
+ }
+ @Override
+ public PopupPanel getPopup() {
+ return simplePopup;
+ }
+
+ @Override
+ public HasClickHandlers getDelete() {
+ return delete;
+ }
+
+ @Override
+ public void enableAllTools(boolean is) {
+ this.enableSendingTools(is);
+ this.enableDealingTools(is);
+ }
+ @Override
+ public void enableSendingTools(boolean is) {
+ if (is) {
+ removeSendingDisableds();
+ } else {
+ addSendingDisableds();
+ }
+ }
+
+ @Override
+ public void enableDealingTools(boolean is) {
+ if (is) {
+ removeDealingDisableds();
+ } else {
+ addDealingDisableds();
+ }
+ }
+
+ private void addSendingDisableds() {
+ reply.addStyleName(style.disabledButton());
+ replyAllGroup.addStyleName(style.disabledButton());
+ forwardGroup.addStyleName(style.disabledButton());
+ replyAllTip.addStyleName(style.disabledButton());
+ forwardTip.addStyleName(style.disabledButton());
+<<<<<<< HEAD
+// if(replyReg != null){
+// replyReg.removeHandler();
+// replyAllReg.removeHandler();
+// forwardReg.removeHandler();
+// replyReg = null;
+// replyAllReg = null;
+// forwardReg = null;
+// }
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ private void removeSendingDisableds() {
+ reply.removeStyleName(style.disabledButton());
+ replyAllGroup.removeStyleName(style.disabledButton());
+ forwardGroup.removeStyleName(style.disabledButton());
+ replyAllTip.removeStyleName(style.disabledButton());
+ forwardTip.removeStyleName(style.disabledButton());
+<<<<<<< HEAD
+
+// if(replyReg != null){
+// replyReg.removeHandler();
+// replyAllReg.removeHandler();
+// forwardReg.removeHandler();
+// }
+// replyReg = reply.addClickHandler(replyHandler);
+// replyAllReg = replyAll.addClickHandler(replyAllHandler);
+// forwardReg = forward.addClickHandler(forwardHandler);
+
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+
+
+ private void addDealingDisableds() {
+ delete.addStyleName(style.disabledButton());
+ mark.addStyleName(style.disabledButton());
+<<<<<<< HEAD
+
+// if(deleteReg != null){
+// deleteReg.removeHandler();
+// markReg.removeHandler();
+// deleteReg = null;
+// markReg = null;
+// }
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ private void removeDealingDisableds() {
+ delete.removeStyleName(style.disabledButton());
+ mark.removeStyleName(style.disabledButton());
+<<<<<<< HEAD
+
+// if(markReg != null){
+// deleteReg.removeHandler();
+// markReg.removeHandler();
+// }
+// markReg = mark.addClickHandler(markHandler);
+// deleteReg = delete.addClickHandler(deleteHandler);
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+
+ interface ToolBarUiBinder extends UiBinder<FlowPanel, ToolBarView> {
+ }
+
+ private static ToolBarUiBinder binder = GWT.create(ToolBarUiBinder.class);
+
+ @Override
+<<<<<<< HEAD
+ public HandlerRegistration getForwardReg() {
+ return forwardReg;
+ }
+
+ @Override
+ public HandlerRegistration getReplyAllReg() {
+ return replyAllReg;
+ }
+
+ @Override
+ public HandlerRegistration getReplyReg() {
+ return replyReg;
+ }
+
+ @Override
+ public HandlerRegistration getMarkReg() {
+ return markReg;
+ }
+
+ @Override
+ public HandlerRegistration getDeleteReg() {
+ return deleteReg;
+ }
+
+
+=======
+ public HasClickHandlers getRefresh() {
+ return refresh;
+ }
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org