labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r792137 - in /labs/hupa: src/main/java/org/apache/hupa/ src/main/java/org/apache/hupa/client/events/ src/main/java/org/apache/hupa/client/gin/ src/main/java/org/apache/hupa/client/mvp/ war/
Date Wed, 08 Jul 2009 13:44:22 GMT
Author: norman
Date: Wed Jul  8 13:44:20 2009
New Revision: 792137

URL: http://svn.apache.org/viewvc?rev=792137&view=rev
Log:
Commit first version of supporting paging for the MailTable. Its still ugly and the MVP pattern
needs some review, but at least it work.

Added:
    labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEvent.java
    labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEventHandler.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java
Removed:
    labs/hupa/src/main/java/org/apache/hupa/client/events/IMAPFolderChangeEvent.java
Modified:
    labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml
    labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java
    labs/hupa/war/Hupa.css

Modified: labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml?rev=792137&r1=792136&r2=792137&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml (original)
+++ labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml Wed Jul  8 13:44:20 2009
@@ -13,7 +13,10 @@
 
   <!-- Other module inherits                                      -->
   <inherits name='org.cobogw.gwt.user.User' /> 
-
+  <inherits name='com.google.gwt.widgetideas.WidgetIdeas'/>
+  <inherits name='com.google.gwt.gen2.commonwidget.CommonWidget' />
+  <inherits name='com.google.gwt.gen2.table.override.Override'/>
+  <inherits name='com.google.gwt.gen2.table.ScrollTable'/>
   <inherits name='net.customware.gwt.dispatch.Dispatch' />
   <inherits name="com.google.gwt.inject.Inject"/>
   

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEvent.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEvent.java?rev=792137&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEvent.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEvent.java Wed Jul 
8 13:44:20 2009
@@ -0,0 +1,64 @@
+
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.client.events;
+
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPUser;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+public class LoadMessagesEvent extends GwtEvent<LoadMessagesEventHandler>{
+	public static Type<LoadMessagesEventHandler> TYPE = new Type<LoadMessagesEventHandler>();
+	private IMAPUser user;
+	private IMAPFolder folder;
+	private String searchValue;
+	
+	public LoadMessagesEvent(IMAPUser user, IMAPFolder folder) {
+		this(user,folder,null);
+	}
+	
+	public LoadMessagesEvent(IMAPUser user, IMAPFolder folder, String searchValue) {
+		this.user = user;
+		this.folder = folder;
+		this.searchValue = searchValue;
+	}
+	public IMAPUser getUser() {
+		return user;
+	}
+	public IMAPFolder getFolder() {
+		return folder;
+	}
+	
+	public String getSearchValue() {
+		return searchValue;
+	}
+	
+	@Override
+	protected void dispatch(LoadMessagesEventHandler handler) {
+		handler.onLoadMessagesEvent(this);
+	}
+
+	@Override
+	public com.google.gwt.event.shared.GwtEvent.Type<LoadMessagesEventHandler> getAssociatedType()
{
+		return TYPE;
+	}
+
+}

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEventHandler.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEventHandler.java?rev=792137&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEventHandler.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/LoadMessagesEventHandler.java Wed
Jul  8 13:44:20 2009
@@ -0,0 +1,27 @@
+/****************************************************************
+ * 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.events;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface LoadMessagesEventHandler extends EventHandler{
+
+	public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent);
+}

Modified: labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java?rev=792137&r1=792136&r2=792137&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java Wed Jul  8 13:44:20
2009
@@ -22,6 +22,7 @@
 import org.apache.hupa.client.events.EventBus;
 import org.apache.hupa.client.mvp.AppPresenter;
 import org.apache.hupa.client.mvp.AppView;
+import org.apache.hupa.client.mvp.IMAPMessageView;
 import org.apache.hupa.client.mvp.LoginPresenter;
 import org.apache.hupa.client.mvp.LoginView;
 import org.apache.hupa.client.mvp.MainPresenter;
@@ -41,6 +42,7 @@
 		bind(AppPresenter.class).in(Singleton.class);
 		bind(MainView.class).in(Singleton.class);
 		bind(MainPresenter.class).in(Singleton.class);
+		bind(IMAPMessageView.class).in(Singleton.class);
 	}
 
 }

Added: labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java?rev=792137&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java Wed Jul  8 13:44:20
2009
@@ -0,0 +1,278 @@
+/****************************************************************
+ * 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.mvp;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.customware.gwt.dispatch.client.DispatchAsync;
+
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.data.IMAPFolder;
+import org.apache.hupa.client.data.IMAPMessage;
+import org.apache.hupa.client.data.IMAPUser;
+import org.apache.hupa.client.events.EventBus;
+import org.apache.hupa.client.events.LoadMessagesEvent;
+import org.apache.hupa.client.events.LoadMessagesEventHandler;
+import org.apache.hupa.client.rpc.FetchMessages;
+import org.apache.hupa.client.rpc.FetchMessagesResult;
+
+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.gen2.table.client.AbstractColumnDefinition;
+import com.google.gwt.gen2.table.client.ColumnDefinition;
+import com.google.gwt.gen2.table.client.DefaultRowRenderer;
+import com.google.gwt.gen2.table.client.DefaultTableDefinition;
+import com.google.gwt.gen2.table.client.FixedWidthFlexTable;
+import com.google.gwt.gen2.table.client.FixedWidthGrid;
+import com.google.gwt.gen2.table.client.FixedWidthGridBulkRenderer;
+import com.google.gwt.gen2.table.client.PagingOptions;
+import com.google.gwt.gen2.table.client.PagingScrollTable;
+import com.google.gwt.gen2.table.client.TableDefinition;
+import com.google.gwt.gen2.table.client.TableModel;
+import com.google.gwt.gen2.table.client.TableModelHelper;
+import com.google.gwt.gen2.table.client.AbstractScrollTable.ResizePolicy;
+import com.google.gwt.gen2.table.client.AbstractScrollTable.ScrollPolicy;
+import com.google.gwt.gen2.table.client.SelectionGrid.SelectionPolicy;
+import com.google.gwt.gen2.table.client.TableDefinition.AbstractRowView;
+import com.google.gwt.gen2.table.client.TableModelHelper.Request;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.inject.Inject;
+
+public class IMAPMessageView extends Composite{
+
+	private HupaConstants constants = GWT.create(HupaConstants.class);
+	private DispatchAsync dispatcher;
+	private IMAPUser user;
+	private IMAPFolder folder;
+	private String searchValue;
+
+	private PagingScrollTable<IMAPMessage> mailTable = new PagingScrollTable<IMAPMessage>(
+			new IMAPMessageTableModel(), createDataTable(),
+			createHeaderTable(),
+			createTableDefinitation());
+	
+	@Inject
+	public IMAPMessageView(DispatchAsync dispatcher,EventBus bus) {
+		this.dispatcher = dispatcher;
+		bus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler() {
+
+			public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
+				user = loadMessagesEvent.getUser();
+				folder = loadMessagesEvent.getFolder();
+				searchValue = loadMessagesEvent.getSearchValue();
+				mailTable.reloadPage();
+			}
+			
+		});
+		
+		VerticalPanel vPanel = new VerticalPanel();
+
+		final CheckBox headerCheckbox = new CheckBox();
+		headerCheckbox.addClickHandler(new ClickHandler() {
+
+			public void onClick(ClickEvent event) {
+				mailTable.getDataTable();
+				/*
+				for (int i = 1; i < mailTable.getDataTable().getRowCount(); i++) {
+					((CheckBox) mailTable.getDataTable().getWidget(i, 0))
+							.setValue(headerCheckbox.getValue());
+					if(headerCheckbox.getValue() == true) {
+						mailTable.getDataTable().getRowFormatter().setStyleName(i, "hupa-Mailtable-row-selected");
+					} else {
+						mailTable.getDataTable().getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-selected");
+
+					}
+				
+					IMAPMessage message = mMap.get(i);
+					if (message.getIMAPFlags().contains(IMAPFlag.SEEN) == false) {
+						mailTable.getDataTable().getRowFormatter().addStyleName(i,
+								"hupa-Mailtable-row-notseen");
+					} else {
+						mailTable.getDataTable().getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-notseen");
+					}
+				}
+				*/
+			}
+
+		});
+		
+
+		mailTable.setPageSize(20);
+		mailTable.setEmptyTableWidget(new HTML("There is no data to display"));
+		FixedWidthGridBulkRenderer<IMAPMessage> bulkRenderer = new FixedWidthGridBulkRenderer<IMAPMessage>(mailTable.getDataTable(),mailTable);
+		mailTable.setBulkRenderer(bulkRenderer);
+		
+		mailTable.setCellPadding(0);
+		mailTable.setResizePolicy(ResizePolicy.FILL_WIDTH);
+		mailTable.setScrollPolicy(ScrollPolicy.DISABLED);
+		mailTable.setSize("900px", "600px");
+
+		PagingOptions options = new PagingOptions(mailTable);
+		vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
+		vPanel.add(options);
+		vPanel.add(mailTable);
+		//vPanel.add(options);
+		initWidget(vPanel);
+	}
+
+	private TableDefinition<IMAPMessage> createTableDefinitation() {
+		DefaultTableDefinition<IMAPMessage> def = new DefaultTableDefinition<IMAPMessage>(createColumnDefinitionList());
+		def.setRowRenderer(new DefaultRowRenderer<IMAPMessage>() {
+
+			@Override
+			public void renderRowValue(IMAPMessage rowValue,
+					AbstractRowView<IMAPMessage> view) {
+				super.renderRowValue(rowValue, view);
+			}
+			
+		});
+		return def;
+	}
+
+	private FixedWidthFlexTable createHeaderTable() {
+		FixedWidthFlexTable headerTable = new FixedWidthFlexTable();
+		final CheckBox box = new CheckBox();
+		headerTable.setWidget(0, 0, box);
+		headerTable.setText(0, 1, constants.headerFrom());
+		headerTable.setText(0, 2, constants.mailTableSubject());
+		headerTable.setText(0, 3, constants.mailTableDate());
+
+		headerTable.setCellSpacing(0);
+
+		headerTable.getRowFormatter().setStyleName(0,"hupa-Mailtable-Header");
+
+		headerTable.getFlexCellFormatter().addStyleName(0,0,"hupa-Mailtable-Header");
+		headerTable.getFlexCellFormatter().addStyleName(0,1,"hupa-Mailtable-Header");
+		headerTable.getFlexCellFormatter().addStyleName(0,2,"hupa-Mailtable-Header");
+		headerTable.getFlexCellFormatter().addStyleName(0,3,"hupa-Mailtable-Header");
+		return headerTable;
+	}
+	
+	/**
+	   * @return the newly created data table.
+	   */
+	  private FixedWidthGrid createDataTable() {
+	    FixedWidthGrid dataTable = new FixedWidthGrid();
+	    dataTable.setSelectionPolicy(SelectionPolicy.CHECKBOX);
+	    return dataTable;
+	  }
+
+
+	private List<ColumnDefinition<IMAPMessage, ?>> createColumnDefinitionList()
{
+		List<ColumnDefinition<IMAPMessage, ?>> cList = new ArrayList<ColumnDefinition<IMAPMessage,
?>>();
+
+		FromColumnDefination from = new FromColumnDefination();
+		from.setMinimumColumnWidth(200);
+		cList.add(from);
+
+		
+		SubjectColumnDefination subject =new SubjectColumnDefination();
+		subject.setMinimumColumnWidth(500);
+
+		
+		cList.add(subject);
+		
+		DateColumnDefination date = new DateColumnDefination();
+		date.setMinimumColumnWidth(100);
+		
+		cList.add(date);
+		
+		return cList;
+	}
+	
+	private final class IMAPMessageTableModel extends TableModel<IMAPMessage> {
+
+		@Override
+		public void requestRows(
+				final Request request,
+				final com.google.gwt.gen2.table.client.TableModel.Callback<IMAPMessage> callback)
{
+			dispatcher.execute(new FetchMessages(user,folder,request.getStartRow(),request.getStartRow()
+ request.getNumRows(),searchValue), new AsyncCallback<FetchMessagesResult>() {
+
+				public void onFailure(Throwable caught) {
+					callback.onFailure(caught);
+				}
+
+				public void onSuccess(final FetchMessagesResult result) {
+					callback.onRowsReady(request, new TableModelHelper.Response<IMAPMessage>() {
+
+						@Override
+						public Iterator<IMAPMessage> getRowValues() {
+							return result.getMessages().iterator();
+						}
+						
+					});
+				}
+				
+			});
+		}
+		
+	}
+
+	private final class FromColumnDefination extends AbstractColumnDefinition<IMAPMessage,
String> {
+
+		@Override
+		public String getCellValue(IMAPMessage rowValue) {
+			return rowValue.getIMAPHeader().getFrom();
+		}
+
+		@Override
+		public void setCellValue(IMAPMessage rowValue, String cellValue) {
+			rowValue.getIMAPHeader().setFrom(cellValue);
+		}
+		
+	}
+	
+	private final class SubjectColumnDefination extends AbstractColumnDefinition<IMAPMessage,
String> {
+
+		@Override
+		public String getCellValue(IMAPMessage rowValue) {
+			return rowValue.getIMAPHeader().getSubject();
+		}
+
+		@Override
+		public void setCellValue(IMAPMessage rowValue, String cellValue) {
+			rowValue.getIMAPHeader().setSubject(cellValue);
+
+		}
+		
+	}
+	
+	private final class DateColumnDefination extends AbstractColumnDefinition<IMAPMessage,
String> {
+
+		@Override
+		public String getCellValue(IMAPMessage rowValue) {
+			return rowValue.getIMAPHeader().getReceivedDate().toString();
+		}
+
+		@Override
+		public void setCellValue(IMAPMessage rowValue, String cellValue) {
+			rowValue.getIMAPHeader().setReceivedDate(null);
+
+		}
+		
+	}
+}

Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java?rev=792137&r1=792136&r2=792137&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java Wed Jul  8 13:44:20
2009
@@ -5,37 +5,30 @@
 import java.util.Comparator;
 import java.util.List;
 
+import net.customware.gwt.dispatch.client.DispatchAsync;
+
 import org.apache.hupa.client.data.IMAPFolder;
-import org.apache.hupa.client.data.IMAPMessage;
 import org.apache.hupa.client.data.IMAPUser;
 import org.apache.hupa.client.events.EventBus;
+import org.apache.hupa.client.events.LoadMessagesEvent;
 import org.apache.hupa.client.events.LoginEvent;
 import org.apache.hupa.client.events.LoginEventHandler;
 import org.apache.hupa.client.events.LogoutEvent;
 import org.apache.hupa.client.events.LogoutEventHandler;
 import org.apache.hupa.client.rpc.FetchFolders;
 import org.apache.hupa.client.rpc.FetchFoldersResult;
-import org.apache.hupa.client.rpc.FetchMessages;
-import org.apache.hupa.client.rpc.FetchMessagesResult;
 import org.apache.hupa.client.rpc.LogoutUser;
 import org.apache.hupa.client.rpc.LogoutUserResult;
 import org.apache.hupa.client.widgets.IMAPTreeItem;
 
-import net.customware.gwt.dispatch.client.DispatchAsync;
-
 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.HasAllKeyHandlers;
 import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
 import com.google.gwt.event.logical.shared.HasSelectionHandlers;
 import com.google.gwt.event.logical.shared.SelectionEvent;
 import com.google.gwt.event.logical.shared.SelectionHandler;
 import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.HTMLTable;
 import com.google.gwt.user.client.ui.HasValue;
 import com.google.gwt.user.client.ui.TreeItem;
 import com.google.gwt.user.client.ui.HTMLTable.Cell;
@@ -49,11 +42,10 @@
 		public HasSelectionHandlers<TreeItem> getTree();
 		public HasClickHandlers getSearchClick();
 		public HasValue<String> getSearchValue();
-		public HasAllKeyHandlers getRowsPerPage();
-		public HasValue<String> getRowsPerPageValue();
-		public HasClickHandlers getTableClick();
+		
+		//public HasRowSelectionHandlers getTableClick();
 		public void bindTreeItems(List<IMAPTreeItem> treeList);
-		public void bindMessages(List<IMAPMessage> messageList);
+		//public void bindMessages(List<IMAPMessage> messageList);
 
 	}
 	
@@ -62,7 +54,7 @@
 	private Display display;
 	private IMAPUser user;
 	private IMAPFolder folder;
-	private String searchValue = null;
+	
 	protected Cell cell;
 	
 	@Inject
@@ -84,11 +76,12 @@
 		bus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
 
 			public void onLogout(LogoutEvent logoutEvent) {
-				display.bindTreeItems(new ArrayList<IMAPTreeItem>());
+				reset();
 			}
 			
 		});
 	}
+	
 	protected void loadTreeItems() {
 		dispatcher.execute(new FetchFolders(user), new AsyncCallback<FetchFoldersResult>()
{
 
@@ -166,8 +159,7 @@
 			public void onSelection(SelectionEvent<TreeItem> event) {
 				TreeItem item = event.getSelectedItem();
 				folder = (IMAPFolder) item.getUserObject();
-				fetchMessages();
-
+				bus.fireEvent(new LoadMessagesEvent(user,folder));
 				
 			}
 			
@@ -176,61 +168,20 @@
 		display.getSearchClick().addClickHandler(new ClickHandler() {
 
 			public void onClick(ClickEvent event) {
-				
+				String searchValue = null;
 				if (display.getSearchValue().getValue().trim().length() >0) {
 					searchValue = display.getSearchValue().getValue().trim();
 				}
-				fetchMessages();
-
-				
+				bus.fireEvent(new LoadMessagesEvent(user,folder,searchValue));
 			}
 			
 		});
-		
-		display.getRowsPerPage().addKeyUpHandler(new KeyUpHandler() {
-
-
-			public void onKeyUp(KeyUpEvent event) {
-				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
-					fetchMessages();
-				}
-			}
 			
-		});
-		
-		display.getTableClick().addClickHandler(new ClickHandler() {
-
-			public void onClick(ClickEvent event) {
-				HTMLTable table = (HTMLTable) event.getSource();
-				cell = table.getCellForEvent(event);
-				if (cell.getRowIndex() > 0 && cell.getCellIndex() != 0) {
-
-				
-				}
-
-			}
-
-		});
 	}
-	
-	private void fetchMessages() {
-		int rowsPerPage = Integer.parseInt(display.getRowsPerPageValue().getValue());
-		dispatcher.execute(new FetchMessages(user,folder,0,0+rowsPerPage,searchValue), new AsyncCallback<FetchMessagesResult>()
{
 
-			public void onFailure(Throwable caught) {
-				GWT.log("ERROR",caught);				
-			}
 
-			public void onSuccess(FetchMessagesResult result) {
-				display.bindMessages(result.getMessages());
-			}
-			
-		});
-		
-	}
-	
 	private void reset() {
-		display.bindMessages(new ArrayList<IMAPMessage>());
+		//display.bindMessages(new ArrayList<IMAPMessage>());
 		display.bindTreeItems(new ArrayList<IMAPTreeItem>());
 		display.getSearchValue().setValue("");
 	}

Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java?rev=792137&r1=792136&r2=792137&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainView.java Wed Jul  8 13:44:20 2009
@@ -1,32 +1,23 @@
 package org.apache.hupa.client.mvp;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.hupa.client.HupaConstants;
 import org.apache.hupa.client.bundles.IMAPTreeImages;
 import org.apache.hupa.client.data.IMAPMessage;
-import org.apache.hupa.client.data.IMAPMessage.IMAPFlag;
 import org.apache.hupa.client.widgets.IMAPTreeItem;
 import org.cobogw.gwt.user.client.ui.Button;
 import org.cobogw.gwt.user.client.ui.ButtonBar;
 import org.cobogw.gwt.user.client.ui.RoundedPanel;
 
 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.HasAllKeyHandlers;
 import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.event.dom.client.KeyUpEvent;
 import com.google.gwt.event.dom.client.KeyUpHandler;
 import com.google.gwt.event.logical.shared.HasSelectionHandlers;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.user.client.ui.CheckBox;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.DockPanel;
-import com.google.gwt.user.client.ui.FlexTable;
 import com.google.gwt.user.client.ui.HasValue;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Label;
@@ -36,6 +27,7 @@
 import com.google.gwt.user.client.ui.Tree;
 import com.google.gwt.user.client.ui.TreeItem;
 import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.inject.Inject;
 
 public class MainView extends Composite implements MainPresenter.Display{
 	
@@ -52,12 +44,12 @@
 	private Button logoutButton = new Button(constants.logoutButton());
 	private VerticalPanel centerVP = new VerticalPanel();
 	private TextBox rowsPerPageBox = new TextBox();
-	private FlexTable mailTable = new FlexTable();
-	private Map<Integer, IMAPMessage> mMap = new HashMap<Integer, IMAPMessage>();
 	private RoundedPanel center;
-	private DateTimeFormat dFormat = DateTimeFormat.getShortDateTimeFormat();
+	private IMAPMessageView messageView;
 	
-	public MainView() {
+	@Inject
+	public MainView(IMAPMessageView messageView) {
+		this.messageView = messageView;
 		dockPanel = new DockPanel();
 		
 		dockPanel.setSpacing(10);
@@ -77,12 +69,11 @@
 	}
 
 	private void createWest() {
-		
-		
 			west = new RoundedPanel(RoundedPanel.ALL);
 			west.add(folderTree);
 			west.setWidth("30%");	
 			folderTree.setAnimationEnabled(true);
+			
 		
 	}
 	private void createNorth() {
@@ -148,54 +139,12 @@
 		navPanel.add(rowsPerPageBox);
 		navPanel.add(new Label(constants.rowsPerPageLabel()));
 		centerVP.add(navPanel);
-		
-		final CheckBox headerCheckbox = new CheckBox();
-		headerCheckbox.addClickHandler(new ClickHandler() {
-
-			public void onClick(ClickEvent event) {
-				for (int i = 1; i < mailTable.getRowCount(); i++) {
-					((CheckBox) mailTable.getWidget(i, 0))
-							.setValue(headerCheckbox.getValue());
-					if(headerCheckbox.getValue() == true) {
-						mailTable.getRowFormatter().setStyleName(i, "hupa-Mailtable-row-selected");
-					} else {
-						mailTable.getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-selected");
-
-					}
-					IMAPMessage message = mMap.get(i);
-					if (message.getIMAPFlags().contains(IMAPFlag.SEEN) == false) {
-						mailTable.getRowFormatter().addStyleName(i,
-								"hupa-Mailtable-row-notseen");
-					} else {
-						mailTable.getRowFormatter().removeStyleName(i, "hupa-Mailtable-row-notseen");
-					}
-				}
-			}
-
-		});
-		
-		mailTable.setCellSpacing(0);
-		mailTable.setWidget(0, 0, headerCheckbox);
-		mailTable.getFlexCellFormatter().setWidth(0, 0, "15px");
-		mailTable.setText(0, 1, constants.mailTableFrom());
-		mailTable.getFlexCellFormatter().setWidth(0, 1, "200px");
-		mailTable.setText(0, 2, constants.mailTableSubject());
-		mailTable.getFlexCellFormatter().setWidth(0, 2, "500px");
-		mailTable.setText(0, 3, constants.mailTableDate());
-		mailTable.getFlexCellFormatter().setWidth(0, 3, "200px");
-		mailTable.getRowFormatter().setStyleName(0,"hupa-Mailtable-Header");
-
-		mailTable.getFlexCellFormatter().addStyleName(0,0,"hupa-Mailtable-Header");
-		mailTable.getFlexCellFormatter().addStyleName(0,1,"hupa-Mailtable-Header");
-		mailTable.getFlexCellFormatter().addStyleName(0,2,"hupa-Mailtable-Header");
-		mailTable.getFlexCellFormatter().addStyleName(0,3,"hupa-Mailtable-Header");
-
-
-		
-		centerVP.add(mailTable);
+		//messageView.setPixelSize(900, 600);
+		centerVP.add(messageView);
 		center = new RoundedPanel();
 		center.add(centerVP);
 		center.setWidth("100%");
+
 	}
 	private String truncate(String rawString) {
 		if (rawString.length() > 50) {
@@ -204,15 +153,6 @@
 			return rawString;
 		}
 	}
-	private void clearMailTableEntries() {
-	       // clear table
-        int a = 0;
-        while ((a = mailTable.getRowCount()) != 1) {
-            mailTable.removeRow(a - 1);
-        }
-
-        mMap.clear();
-	}
 	
 	private void fillOracle(IMAPMessage msg) {
 		oracle.add(msg.getIMAPHeader().getFrom());
@@ -232,13 +172,6 @@
 	public HasValue<String> getSearchValue() {
 		return searchBox;
 	}
-	public HasValue<String> getRowsPerPageValue() {
-		return rowsPerPageBox;
-	}
-	
-	public HasAllKeyHandlers getRowsPerPage() {
-		return rowsPerPageBox;
-	}
 	
 	public void bindTreeItems(List<IMAPTreeItem> treeList) {
 		folderTree.clear();
@@ -249,6 +182,7 @@
 		}
 	}
 	
+	/*
 	public void bindMessages(List<IMAPMessage> result) {
 		// clear table
 		clearMailTableEntries();
@@ -259,12 +193,12 @@
 			mCheckbox.addClickHandler(new ClickHandler() {
 
 				public void onClick(ClickEvent event) {
-					int row = mailTable.getCellForEvent(event).getRowIndex();
+					int row =1;//=  mailTable.getDataTable().getSelectedRows();
 
 					if(mCheckbox.getValue() == true) {
-						mailTable.getRowFormatter().setStyleName(row, "hupa-Mailtable-row-selected");
+						mailTable.getDataTable().getRowFormatter().setStyleName(row, "hupa-Mailtable-row-selected");
 					} else {
-						mailTable.getRowFormatter().removeStyleName(row, "hupa-Mailtable-row-selected");
+						mailTable.getDataTable().getRowFormatter().removeStyleName(row, "hupa-Mailtable-row-selected");
 
 					}
 					
@@ -274,45 +208,47 @@
 			IMAPMessage message = result.get(i);
 			fillOracle(message);
 			mMap.put(rows, message);
-			mailTable.setWidget(rows, 0, mCheckbox);
-			mailTable.setText(rows, 1, truncate(message.getIMAPHeader()
+			mailTable.getDataTable().setWidget(rows, 0, mCheckbox);
+			mailTable.getDataTable().setText(rows, 1, truncate(message.getIMAPHeader()
 					.getFrom()));
-			mailTable.setText(rows, 2, truncate(message.getIMAPHeader()
+			mailTable.getDataTable().setText(rows, 2, truncate(message.getIMAPHeader()
 					.getSubject()));
-			mailTable.setText(rows, 3, dFormat.format(message
+			mailTable.getDataTable().setText(rows, 3, dFormat.format(message
 					.getIMAPHeader().getReceivedDate()));
 			
 			if (rows % 2 == 0) {
-				mailTable.getRowFormatter().setStyleName(rows,
+				mailTable.getDataTable().getRowFormatter().setStyleName(rows,
 						"hupa-Mailtable-row1");
 			} else {
-				mailTable.getRowFormatter().setStyleName(rows,
+				mailTable.getDataTable().getRowFormatter().setStyleName(rows,
 						"hupa-Mailtable-row2");
 			}
 			if (message.getIMAPFlags().contains(IMAPFlag.SEEN) == false) {
-				mailTable.getRowFormatter().addStyleName(rows,
+				mailTable.getDataTable().getRowFormatter().addStyleName(rows,
 						"hupa-Mailtable-row-notseen");
 			} else {
-				mailTable.getRowFormatter().removeStyleName(rows, "hupa-Mailtable-row-notseen");
+				mailTable.getDataTable().getRowFormatter().removeStyleName(rows, "hupa-Mailtable-row-notseen");
 			}
-			mailTable.getCellFormatter().setWordWrap(rows, 1,
+			mailTable.getDataTable().getCellFormatter().setWordWrap(rows, 1,
 					false);
-			mailTable.getCellFormatter().setWordWrap(rows, 2,
+			mailTable.getDataTable().getCellFormatter().setWordWrap(rows, 2,
 					false);
-			mailTable.getCellFormatter().setWordWrap(rows, 3,
+			mailTable.getDataTable().getCellFormatter().setWordWrap(rows, 3,
 					false);
-			mailTable.getFlexCellFormatter().addStyleName(rows,0,"hupa-Mailtable");
-			mailTable.getFlexCellFormatter().addStyleName(rows,1,"hupa-Mailtable");
-			mailTable.getFlexCellFormatter().addStyleName(rows,2,"hupa-Mailtable");
-			mailTable.getFlexCellFormatter().addStyleName(rows,3,"hupa-Mailtable");
-			mailTable.getFlexCellFormatter().addStyleName(rows,3,"hupa-Mailtable-cell-date");
+			mailTable.getDataTable().getCellFormatter().addStyleName(rows,0,"hupa-Mailtable");
+			mailTable.getDataTable().getCellFormatter().addStyleName(rows,1,"hupa-Mailtable");
+			mailTable.getDataTable().getCellFormatter().addStyleName(rows,2,"hupa-Mailtable");
+			mailTable.getDataTable().getCellFormatter().addStyleName(rows,3,"hupa-Mailtable");
+			mailTable.getDataTable().getCellFormatter().addStyleName(rows,3,"hupa-Mailtable-cell-date");
 
 
 			rows++;
 		}
 	}
 
-	public HasClickHandlers getTableClick() {
-		return mailTable;
+	public HasRowSelectionHandlers getTableClick() {
+		return mailTable.getDataTable();
 	}
+
+	*/
 }

Modified: labs/hupa/war/Hupa.css
URL: http://svn.apache.org/viewvc/labs/hupa/war/Hupa.css?rev=792137&r1=792136&r2=792137&view=diff
==============================================================================
--- labs/hupa/war/Hupa.css (original)
+++ labs/hupa/war/Hupa.css Wed Jul  8 13:44:20 2009
@@ -6,6 +6,23 @@
   text-align: center;
 }
 
+.gwt-GlassPanel {
+
+    /* Override glass panel color to be `green` */
+    background-color: green !important;
+
+    /* Override glass panel to 10% opacity (= 90% transparency) */
+    filter: alpha(opacity = 10) !important; /* IE */
+    opacity: 0.1 !important; /* non-IE */
+
+    /*
+      NOTE: Please do NOT use either CSS 'width' or 'height' here, as
+      this would defeat much of the effort that went into GlassPanel
+      in order to get it to work consistently in a variety of
+      circumstances. Specifically, please resist the urge to use
+      'width/height: 100%' or similar constructs.
+    */
+  }
 
 .cbg-RP { 
 	background-color:	#E6E6FA; 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message