james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r1522401 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: activity/FolderListActivity.java activity/ToolBarActivity.java ui/FolderListView.java ui/ToolBarView.java
Date Thu, 12 Sep 2013 04:50:12 GMT
Author: dongxu
Date: Thu Sep 12 04:50:12 2013
New Revision: 1522401

URL: http://svn.apache.org/r1522401
Log:
done issue#72, get back the unread count

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java?rev=1522401&r1=1522400&r2=1522401&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
Thu Sep 12 04:50:12 2013
@@ -23,6 +23,7 @@ package org.apache.hupa.client.activity;
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 import org.apache.hupa.shared.events.RefreshUnreadEvent;
 import org.apache.hupa.shared.events.RefreshUnreadEventHandler;
 
@@ -41,6 +42,11 @@ import com.google.gwt.event.shared.Event
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
 >>>>>>> integrate all of the views to their corresponding activities
and mappers
 =======
+=======
+import org.apache.hupa.shared.events.RefreshUnreadEvent;
+import org.apache.hupa.shared.events.RefreshUnreadEventHandler;
+
+>>>>>>> done issue#72, get back the unread count
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
 import com.google.gwt.user.client.ui.IsWidget;
@@ -91,6 +97,17 @@ public class FolderListActivity extends 
 	@Override
 	public void start(AcceptsOneWidget container, EventBus eventBus) {
 		container.setWidget(display.asWidget());
+		bindTo(eventBus);
+	}
+
+	private void bindTo(EventBus eventBus) {
+
+		eventBus.addHandler(RefreshUnreadEvent.TYPE, new RefreshUnreadEventHandler() {
+			@Override
+			public void onRefreshEvent(RefreshUnreadEvent event) {
+				display.refresh();
+			}
+		});
 	}
 
 <<<<<<< HEAD

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java?rev=1522401&r1=1522400&r2=1522401&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
Thu Sep 12 04:50:12 2013
@@ -200,7 +200,6 @@ import com.google.gwt.event.dom.client.C
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
 import com.google.gwt.user.client.ui.IsWidget;
 import com.google.gwt.user.client.ui.PopupPanel;
@@ -301,11 +300,6 @@ public class ToolBarActivity extends App
 	public interface Displayable extends IsWidget {
 >>>>>>> replace with IsWidget
 		void enableSendingTools(boolean is);
-		HandlerRegistration getForwardReg();
-		HandlerRegistration getReplyAllReg();
-		HandlerRegistration getReplyReg();
-		HandlerRegistration getMarkReg();
-		HandlerRegistration getDeleteReg();
 		void enableDealingTools(boolean is);
 		void enableAllTools(boolean is);
 		HasClickHandlers getReply();

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java?rev=1522401&r1=1522400&r2=1522401&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java Thu
Sep 12 04:50:12 2013
@@ -228,10 +228,6 @@ import org.apache.hupa.client.activity.M
 import org.apache.hupa.client.activity.ToolBarActivity;
 import org.apache.hupa.client.place.FolderPlace;
 import org.apache.hupa.client.rf.HupaRequestFactory;
-import org.apache.hupa.client.ui.LabelListView.ImapLabelListDataProvider;
-import org.apache.hupa.client.ui.LabelListView.LabelCell;
-import org.apache.hupa.client.ui.LabelListView.Resources;
-import org.apache.hupa.client.ui.RightCellTree.Css;
 import org.apache.hupa.shared.domain.ImapFolder;
 
 <<<<<<< HEAD
@@ -241,13 +237,10 @@ import com.google.gwt.cell.client.Abstra
 >>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.place.shared.PlaceController;
-import com.google.gwt.resources.client.ImageResource;
-import com.google.gwt.resources.client.ClientBundle.Source;
 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.cellview.client.CellList;
-import com.google.gwt.user.cellview.client.CellTree;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.ScrollPanel;
 import com.google.gwt.user.client.ui.SimplePanel;
@@ -266,8 +259,7 @@ public class FolderListView extends Comp
 	@Inject private ToolBarActivity.Displayable toolBar;
 	@Inject private MessageListActivity.Displayable msgListDisplay;
 	@Inject private PlaceController placeController;
-	private CellTree cellTree;
-//	private FoldersTreeViewModel viewModel; 
+	private CellList<LabelNode> cellList;
 
 <<<<<<< HEAD
 	@Inject
@@ -325,13 +317,13 @@ public class FolderListView extends Comp
 		@Source("res/CssLabelListView.css")
 		public CellList.Style cellListStyle();
 	}
+
 	@Inject
 	public FolderListView(final HupaRequestFactory rf) {
 		initWidget(binder.createAndBindUi(this));
-		
 
 		data = new ImapLabelListDataProvider(rf);
-		CellList<LabelNode> cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
+		cellList = new CellList<LabelNode>(new FolderCell(), Resources.INSTANCE);
 		cellList.setSelectionModel(selectionModel);
 		selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
 			public void onSelectionChange(SelectionChangeEvent event) {
@@ -343,34 +335,13 @@ public class FolderListView extends Comp
 		});
 		data.addDataDisplay(cellList);
 		thisView.setWidget(cellList);
-		
-//		this.viewModel = viewModel;
-		
-//		cellTree = new CellTree(viewModel,null,Resources.INSTANCE);
-		
-		
-		
-		
-//		cellTree.setAnimationEnabled(true);
-//		thisView.add(cellTree);
 	}
-//	public interface Resources extends CellTree.Resources {
-//
-//		Resources INSTANCE = GWT.create(Resources.class);
-//
-//		@Source("res/CssFolderListView.css")
-//		public Css cellTreeStyle();
-//
-//		@Source("res/listicons.png")
-//		public ImageResource listicons();
-//	}
-	
+
 	@Override
-	public void refresh(){
-//		viewModel.refresh();
+	public void refresh() {
+		data.refresh();
 	}
 
-
 	public final SingleSelectionModel<LabelNode> selectionModel = new SingleSelectionModel<LabelNode>(
 			new ProvidesKey<LabelNode>() {
 				@Override
@@ -379,28 +350,26 @@ public class FolderListView extends Comp
 				}
 			});
 
-	static class LabelCell extends AbstractCell<LabelNode> {
-
-		public LabelCell() {
+	class FolderCell extends AbstractCell<LabelNode> {
+		public FolderCell(String... consumedEvents) {
+			super(consumedEvents);
 		}
-
+		// TODO different images for each folder
 		@Override
-		public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder
sb) {
-			if (value == null) {
-				return;
+		public void render(Context context, LabelNode value, SafeHtmlBuilder sb) {
+			if (value != null) {
+				sb.appendEscaped(value.getName());
 			}
-
-			if (value.getFolder().getSubscribed()) {
-				sb.appendHtmlConstant(value.getNameForDisplay());
-			} else {
-				sb.appendHtmlConstant("<span style='color:gray;'>");
-				sb.appendHtmlConstant(value.getNameForDisplay());
-				sb.appendHtmlConstant("</span>");
+			if (value.getFolder().getUnseenMessageCount() > 0) {
+				sb.appendHtmlConstant("<span style='position:absolute;right:6px;top:3px;font-weight:bold;'>(");
+				sb.appendHtmlConstant("" + value.getFolder().getUnseenMessageCount());
+				sb.appendHtmlConstant(")</span>");
 			}
 		}
 	}
 
 	private final ImapLabelListDataProvider data;
+
 	public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements
HasRefresh {
 
 		private HupaRequestFactory rf;

Modified: 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=1522401&r1=1522400&r2=1522401&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java Thu Sep
12 04:50:12 2013
@@ -71,6 +71,7 @@ import com.google.gwt.event.dom.client.C
 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 org.apache.hupa.shared.domain.User;
@@ -93,6 +94,8 @@ import com.google.gwt.event.dom.client.H
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.event.shared.HandlerRegistration;
 >>>>>>> fixed issue#57 - really disable the tools in toolbar
+=======
+>>>>>>> done issue#72, get back the unread count
 import com.google.gwt.place.shared.PlaceController;
 import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.uibinder.client.UiBinder;
@@ -426,12 +429,6 @@ public class ToolBarView extends Composi
 	@UiField HTMLPanel replyAllTip;
 	@UiField HTMLPanel forwardTip;
 
-	HandlerRegistration replyReg;
-	HandlerRegistration replyAllReg;
-	HandlerRegistration forwardReg;
-	HandlerRegistration deleteReg;
-	HandlerRegistration markReg;
-
 	@UiField Style style;
 
 	interface Style extends CssResource {
@@ -551,6 +548,7 @@ public class ToolBarView extends Composi
 >>>>>>> 1.do not select the message which is being focused on. 2.create
the mark popup menu
 =======
 
+<<<<<<< HEAD
 		markReg = mark.addClickHandler(markHandler);
 		deleteReg = delete.addClickHandler(deleteHandler);
 		replyReg = reply.addClickHandler(replyHandler);
@@ -563,6 +561,13 @@ public class ToolBarView extends Composi
 		enableAllTools(false);
 =======
 >>>>>>> try to make messages list better for user experience
+=======
+		mark.addClickHandler(markHandler);
+		delete.addClickHandler(deleteHandler);
+		reply.addClickHandler(replyHandler);
+		replyAll.addClickHandler(replyAllHandler);
+		forward.addClickHandler(forwardHandler);
+>>>>>>> done issue#72, get back the unread count
 	}
 
 	@UiHandler("compose")
@@ -682,14 +687,6 @@ public class ToolBarView extends Composi
 		forwardGroup.addStyleName(style.disabledButton());
 		replyAllTip.addStyleName(style.disabledButton());
 		forwardTip.addStyleName(style.disabledButton());
-//		if(replyReg != null){
-//			replyReg.removeHandler();
-//			replyAllReg.removeHandler();
-//			forwardReg.removeHandler();	
-//			replyReg = null;
-//			replyAllReg = null;
-//			forwardReg = null;
-//		}
 	}
 
 	private void removeSendingDisableds() {
@@ -698,16 +695,6 @@ public class ToolBarView extends Composi
 		forwardGroup.removeStyleName(style.disabledButton());
 		replyAllTip.removeStyleName(style.disabledButton());
 		forwardTip.removeStyleName(style.disabledButton());
-
-//		if(replyReg != null){
-//			replyReg.removeHandler();
-//			replyAllReg.removeHandler();
-//			forwardReg.removeHandler();	
-//		}
-//		replyReg = reply.addClickHandler(replyHandler);
-//		replyAllReg = replyAll.addClickHandler(replyAllHandler);
-//		forwardReg = forward.addClickHandler(forwardHandler);
-		
 	}
 	
 	
@@ -715,13 +702,6 @@ public class ToolBarView extends Composi
 	private void addDealingDisableds() {
 		delete.addStyleName(style.disabledButton());
 		mark.addStyleName(style.disabledButton());
-		
-//		if(deleteReg != null){
-//			deleteReg.removeHandler();
-//			markReg.removeHandler();
-//			deleteReg = null;
-//			markReg = null;
-//		}
 	}
 
 	private void removeDealingDisableds() {
@@ -732,6 +712,7 @@ public class ToolBarView extends Composi
 		mark.removeStyleName(style.disabledButton());
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 >>>>>>> 1.do not select the message which is being focused on. 2.create
the mark popup menu
 =======
 		
@@ -754,12 +735,15 @@ public class ToolBarView extends Composi
 //		markReg = mark.addClickHandler(markHandler);
 //		deleteReg = delete.addClickHandler(deleteHandler);
 >>>>>>> make folders list view refresh automatically according to the
actual unread message
+=======
+>>>>>>> done issue#72, get back the unread count
 	}
 
 	interface ToolBarUiBinder extends UiBinder<FlowPanel, ToolBarView> {
 	}
 
 	private static ToolBarUiBinder binder = GWT.create(ToolBarUiBinder.class);
+<<<<<<< HEAD
 
 <<<<<<< HEAD
 <<<<<<< HEAD
@@ -810,4 +794,6 @@ public class ToolBarView extends Composi
 >>>>>>> fixed issue#57 - really disable the tools in toolbar
 
 >>>>>>> scrub code
+=======
+>>>>>>> done issue#72, get back the unread count
 }



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


Mime
View raw message