james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r1522397 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui: FolderListView.java FolderListView.ui.xml LabelListView.java res/CssLabelListView.css
Date Thu, 12 Sep 2013 04:48:53 GMT
Author: dongxu
Date: Thu Sep 12 04:48:52 2013
New Revision: 1522397

URL: http://svn.apache.org/r1522397
Log:
fixed issue#67; fixed issue#69 (with default select inbox folder); fixed issue#70;

Modified:
    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/FolderListView.ui.xml
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css

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=1522397&r1=1522396&r2=1522397&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:48:52 2013
@@ -23,10 +23,14 @@ package org.apache.hupa.client.ui;
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hupa.client.HupaController;
+<<<<<<< HEAD
 import org.apache.hupa.client.activity.FolderListActivity;
 import org.apache.hupa.client.activity.MessageListActivity;
 import org.apache.hupa.client.activity.ToolBarActivity;
@@ -217,24 +221,55 @@ import java.util.logging.Logger;
 >>>>>>> add a logger to folder list view for logging the switching activity
 =======
 >>>>>>> scrub code
+=======
+>>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 import org.apache.hupa.client.activity.FolderListActivity;
+import org.apache.hupa.client.activity.MessageListActivity;
+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
 >>>>>>> integrate all of the views to their corresponding activities
and mappers
+=======
+import com.google.gwt.cell.client.AbstractCell;
+>>>>>>> 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;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.ProvidesKey;
+import com.google.gwt.view.client.SelectionChangeEvent;
+import com.google.gwt.view.client.SingleSelectionModel;
 import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
 
 public class FolderListView extends Composite implements FolderListActivity.Displayable {
-	@UiField SimplePanel thisView;
+	@UiField ScrollPanel thisView;
+	@Inject private HupaController controller;
+	@Inject private ToolBarActivity.Displayable toolBar;
+	@Inject private MessageListActivity.Displayable msgListDisplay;
+	@Inject private PlaceController placeController;
 	private CellTree cellTree;
-	private FoldersTreeViewModel viewModel; 
+//	private FoldersTreeViewModel viewModel; 
 
+<<<<<<< HEAD
 	@Inject
 	public FolderListView(final FoldersTreeViewModel viewModel) {
 		initWidget(binder.createAndBindUi(this));
@@ -281,21 +316,165 @@ public class FolderListView extends Comp
 >>>>>>> fixed issue#45, issue#47, issue#51. change the layout of composite,
don't use contact instead of folders list
 	}
 	public interface Resources extends CellTree.Resources {
+=======
+	public interface Resources extends CellList.Resources {
+>>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 
 		Resources INSTANCE = GWT.create(Resources.class);
 
-		@Source("res/CssFolderListView.css")
-		public Css cellTreeStyle();
+		@Source("res/CssLabelListView.css")
+		public CellList.Style cellListStyle();
+	}
+	@Inject
+	public FolderListView(final HupaRequestFactory rf) {
+		initWidget(binder.createAndBindUi(this));
+		
 
-		@Source("res/listicons.png")
-		public ImageResource listicons();
+		data = new ImapLabelListDataProvider(rf);
+		CellList<LabelNode> cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
+		cellList.setSelectionModel(selectionModel);
+		selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+			public void onSelectionChange(SelectionChangeEvent event) {
+				controller.showTopLoading("Loading...");
+				toolBar.enableAllTools(false);
+				placeController.goTo(new FolderPlace(selectionModel.getSelectedObject().getFolder().getFullName()));
+				msgListDisplay.refresh();
+			}
+		});
+		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();
+//		viewModel.refresh();
 	}
-	
+
+
+	public final SingleSelectionModel<LabelNode> selectionModel = new SingleSelectionModel<LabelNode>(
+			new ProvidesKey<LabelNode>() {
+				@Override
+				public Object getKey(LabelNode item) {
+					return item == null ? null : item.getPath();
+				}
+			});
+
+	static class LabelCell extends AbstractCell<LabelNode> {
+
+		public LabelCell() {
+		}
+
+		@Override
+		public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder
sb) {
+			if (value == null) {
+				return;
+			}
+
+			if (value.getFolder().getSubscribed()) {
+				sb.appendHtmlConstant(value.getNameForDisplay());
+			} else {
+				sb.appendHtmlConstant("<span style='color:gray;'>");
+				sb.appendHtmlConstant(value.getNameForDisplay());
+				sb.appendHtmlConstant("</span>");
+			}
+		}
+	}
+
+	private final ImapLabelListDataProvider data;
+	public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements
HasRefresh {
+
+		private HupaRequestFactory rf;
+		private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
+		HasData<LabelNode> display;
+
+		public List<LabelNode> getDataList() {
+			return folderNodes;
+		}
+
+		public ImapLabelListDataProvider(HupaRequestFactory rf) {
+			this.rf = rf;
+		}
+
+		@Override
+		public void addDataDisplay(HasData<LabelNode> display) {
+			super.addDataDisplay(display);
+			this.display = display;
+		}
+
+		@Override
+		protected void onRangeChanged(HasData<LabelNode> display) {
+
+			final int start = display.getVisibleRange().getStart();
+
+			rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>()
{
+
+				private String INTENTS = "&nbsp;&nbsp;&nbsp;&nbsp;";
+
+				@Override
+				public void onSuccess(List<ImapFolder> response) {
+					folderNodes.clear();
+					if (response == null || response.size() == 0) {
+						updateRowCount(-1, true);
+					} else {
+						for (ImapFolder folder : response) {
+							fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+						}
+						updateRowData(start, folderNodes);
+					}
+				}
+
+				private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode
parent,
+						String intents) {
+					LabelNode labelNode = new LabelNode();
+					labelNode.setFolder(curFolder);
+					labelNode.setName(curFolder.getName());
+					labelNode.setNameForDisplay(intents + curFolder.getName());
+					labelNode.setParent(parent);
+					labelNode.setPath(curFolder.getFullName());
+					folderNodes.add(labelNode);
+					if (curFolder.getHasChildren()) {
+						for (ImapFolder subFolder : curFolder.getChildren()) {
+							fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
+						}
+					}
+				}
+
+				@Override
+				public void onFailure(ServerFailure error) {
+					if (error.isFatal()) {
+						throw new RuntimeException(error.getMessage());
+					}
+				}
+
+			});
+		}
+
+		@Override
+		public void refresh() {
+			this.onRangeChanged(display);
+		}
+	}
+
 	interface FolderListUiBinder extends UiBinder<SimplePanel, FolderListView> {
 	}
 

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml?rev=1522397&r1=1522396&r2=1522397&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml
Thu Sep 12 04:48:52 2013
@@ -15,6 +15,7 @@
 <<<<<<< HEAD
 	xmlns:g='urn:import:com.google.gwt.user.client.ui'>
 <<<<<<< HEAD
+<<<<<<< HEAD
 	<g:SimplePanel ui:field="thisView" />
 =======
 =======
@@ -40,4 +41,7 @@
 >>>>>>> change message list view to make it not refresh the whole list
when click one of the messages
 	<g:SimplePanel ui:field="thisView" />
 >>>>>>> make compose panel left another widget rather than cell tree
+=======
+	<g:ScrollPanel ui:field="thisView" />
+>>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 </ui:UiBinder>
\ No newline at end of file

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java?rev=1522397&r1=1522396&r2=1522397&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java Thu
Sep 12 04:48:52 2013
@@ -338,6 +338,11 @@ public class LabelListView extends Compo
 					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);

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css?rev=1522397&r1=1522396&r2=1522397&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css
Thu Sep 12 04:48:52 2013
@@ -16,10 +16,15 @@
 .cellListWidget {
 	
 <<<<<<< HEAD
+<<<<<<< HEAD
 	cursor:default;
 	
 =======
 >>>>>>> add adjusted style to labels list in setting palce
+=======
+	cursor:default;
+	
+>>>>>>> fixed issue#67; fixed issue#69 (with default select inbox folder);
fixed issue#70;
 }
 
 .cellListEvenItem {



---------------------------------------------------------------------
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