labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r792876 - in /labs/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 Fri, 10 Jul 2009 10:36:59 GMT
Author: norman
Date: Fri Jul 10 10:36:58 2009
New Revision: 792876

URL: http://svn.apache.org/viewvc?rev=792876&view=rev
Log:
Fix some layout bugs
Fill the oracle again

Added:
    labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEvent.java
    labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEventHandler.java
Modified:
    labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.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

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEvent.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEvent.java?rev=792876&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEvent.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEvent.java Fri Jul
10 10:36:58 2009
@@ -0,0 +1,30 @@
+package org.apache.hupa.client.events;
+
+import java.util.ArrayList;
+
+import org.apache.hupa.client.data.IMAPMessage;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+public class MessagesReceivedEvent extends GwtEvent<MessagesReceivedEventHandler>{
+	public static Type<MessagesReceivedEventHandler> TYPE = new Type<MessagesReceivedEventHandler>();
+	private ArrayList<IMAPMessage> messages;
+	
+	public MessagesReceivedEvent(ArrayList<IMAPMessage> messages) {
+		this.messages = messages;
+	}
+	
+	public ArrayList<IMAPMessage> getMessages() {
+		return messages;
+	}
+	@Override
+	protected void dispatch(MessagesReceivedEventHandler handler) {
+		handler.onMessagesReceived(this);
+	}
+
+	@Override
+	public com.google.gwt.event.shared.GwtEvent.Type<MessagesReceivedEventHandler> getAssociatedType()
{
+		return TYPE;
+	}
+
+}

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEventHandler.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEventHandler.java?rev=792876&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEventHandler.java
(added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/MessagesReceivedEventHandler.java
Fri Jul 10 10:36:58 2009
@@ -0,0 +1,8 @@
+package org.apache.hupa.client.events;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface MessagesReceivedEventHandler extends EventHandler{
+
+	public void onMessagesReceived(MessagesReceivedEvent event);
+}

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=792876&r1=792875&r2=792876&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 Fri Jul 10 10:36:58
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.IMAPMessagePresenter;
 import org.apache.hupa.client.mvp.IMAPMessageView;
 import org.apache.hupa.client.mvp.LoginPresenter;
 import org.apache.hupa.client.mvp.LoginView;
@@ -43,6 +44,7 @@
 		bind(MainView.class).in(Singleton.class);
 		bind(MainPresenter.class).in(Singleton.class);
 		bind(IMAPMessageView.class).in(Singleton.class);
+		bind(IMAPMessagePresenter.class).in(Singleton.class);
 	}
 
 }

Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java?rev=792876&r1=792875&r2=792876&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java Fri Jul 10
10:36:58 2009
@@ -1,17 +1,52 @@
 package org.apache.hupa.client.mvp;
 
+import org.apache.hupa.client.data.IMAPFolder;
+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 com.google.gwt.gen2.table.event.client.HasPageLoadHandlers;
 import com.google.gwt.gen2.table.event.client.HasRowSelectionHandlers;
 import com.google.gwt.gen2.table.event.client.RowSelectionEvent;
 import com.google.gwt.gen2.table.event.client.RowSelectionHandler;
+import com.google.inject.Inject;
 
 public class IMAPMessagePresenter {
 	
 	public interface Display {
 		public HasRowSelectionHandlers getDataTableSelection();
+		public HasPageLoadHandlers getDataTableLoad();
+		public void reloadData(IMAPUser user, IMAPFolder folder,String searchValue);
 	}
+
+
+	private Display display;	
+	private EventBus bus;
+	protected IMAPUser user;
+	protected IMAPFolder folder;
+	protected String searchValue;
 	
+	@Inject
+	public IMAPMessagePresenter(EventBus bus) {
+		this.bus = bus;
+		bindHandlers();
+	}
 	
-	public void bind(Display display) {
+	private void bindHandlers() {
+		bus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler() {
+
+			public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
+				user = loadMessagesEvent.getUser();
+				folder = loadMessagesEvent.getFolder();
+				searchValue = loadMessagesEvent.getSearchValue();
+				display.reloadData(user, folder, searchValue);
+			}
+			
+		});
+	}
+	public void bind(final Display display) {
+		this.display = display;
 		display.getDataTableSelection().addRowSelectionHandler(new RowSelectionHandler() {
 
 			public void onRowSelection(RowSelectionEvent event) {

Modified: 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=792876&r1=792875&r2=792876&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageView.java Fri Jul 10 10:36:58
2009
@@ -20,6 +20,7 @@
 package org.apache.hupa.client.mvp;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 
@@ -31,8 +32,7 @@
 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.events.MessagesReceivedEvent;
 import org.apache.hupa.client.mvp.IMAPMessagePresenter.Display;
 import org.apache.hupa.client.rpc.FetchMessages;
 import org.apache.hupa.client.rpc.FetchMessagesResult;
@@ -40,11 +40,10 @@
 import org.cobogw.gwt.user.client.ui.ButtonBar;
 
 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.logical.shared.ResizeEvent;
 import com.google.gwt.event.logical.shared.ResizeHandler;
 import com.google.gwt.gen2.table.client.AbstractColumnDefinition;
+import com.google.gwt.gen2.table.client.CellRenderer;
 import com.google.gwt.gen2.table.client.ColumnDefinition;
 import com.google.gwt.gen2.table.client.DefaultTableDefinition;
 import com.google.gwt.gen2.table.client.FixedWidthFlexTable;
@@ -55,21 +54,25 @@
 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.ColumnResizePolicy;
 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.PagingOptions.PagingOptionsImages;
 import com.google.gwt.gen2.table.client.SelectionGrid.SelectionPolicy;
+import com.google.gwt.gen2.table.client.TableDefinition.AbstractCellView;
 import com.google.gwt.gen2.table.client.TableModelHelper.Request;
+import com.google.gwt.gen2.table.event.client.HasPageLoadHandlers;
 import com.google.gwt.gen2.table.event.client.HasRowSelectionHandlers;
 import com.google.gwt.gen2.table.event.client.PageLoadEvent;
 import com.google.gwt.gen2.table.event.client.PageLoadHandler;
+import com.google.gwt.gen2.table.event.client.RowSelectionEvent;
+import com.google.gwt.gen2.table.event.client.RowSelectionHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.Window;
 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.HorizontalPanel;
-import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.inject.Inject;
 
@@ -80,91 +83,100 @@
 	private IMAPUser user;
 	private IMAPFolder folder;
 	private String searchValue;
-
+	
 	private PagingScrollTable<IMAPMessage> mailTable;
+	private EventBus bus;
 	
 	@Inject
 	public IMAPMessageView(DispatchAsync dispatcher,EventBus bus) {
+		this.bus = 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.getTableModel().setRowCount(0);
-				mailTable.reloadPage();
-			}
-			
-		});
+		
 		
 		
 		VerticalPanel vPanel = new VerticalPanel();
 
+		
 		mailTable = new PagingScrollTable<IMAPMessage>(
 				new IMAPMessageTableModel(), createDataTable(),
 				createHeaderTable(),
 				createTableDefinitation());
 		mailTable.setPageSize(20);
 		HTML emptyTable = new HTML("There is no data to display");
-		emptyTable.setHeight("300px");
+		emptyTable.setHorizontalAlignment(HTML.ALIGN_CENTER);
+		emptyTable.setHeight("600px");
 		mailTable.setEmptyTableWidget(emptyTable);
 		FixedWidthGridBulkRenderer<IMAPMessage> bulkRenderer = new FixedWidthGridBulkRenderer<IMAPMessage>(mailTable.getDataTable(),mailTable);
 		mailTable.setBulkRenderer(bulkRenderer);
 		
 		mailTable.setCellPadding(0);
 		mailTable.setResizePolicy(ResizePolicy.FILL_WIDTH);
+		mailTable.setColumnResizePolicy(ColumnResizePolicy.MULTI_CELL);
 		mailTable.setScrollPolicy(ScrollPolicy.DISABLED);
-		mailTable.setSize(Window.getClientWidth() - 200 + "px", "600px");
+		
 		mailTable.addPageLoadHandler(new PageLoadHandler() {
 
 			public void onPageLoad(PageLoadEvent event) {
 				for (int i = 0; i < mailTable.getDataTable().getRowCount(); i++) {
 					mailTable.getDataTable().getRowFormatter().setStyleName(i,"hupa-Mailtable-row");
-					mailTable.getDataTable().getCellFormatter().setWordWrap(i, 0,false);
-					mailTable.getDataTable().getCellFormatter().setWordWrap(i, 1,false);
-					mailTable.getDataTable().getCellFormatter().setWordWrap(i, 2,false);
-					
-					mailTable.getDataTable().getCellFormatter().addStyleName(i,0,"hupa-Mailtable");
-					mailTable.getDataTable().getCellFormatter().addStyleName(i,1,"hupa-Mailtable");
-					mailTable.getDataTable().getCellFormatter().addStyleName(i,2,"hupa-Mailtable");
-					//mailTable.getDataTable().getCellFormatter().addStyleName(i,2,"hupa-Mailtable-cell-date");
-
+					mailTable.getDataTable().getCellFormatter().addStyleName(i,2,"hupa-Mailtable-cell-date");
 				}
 			}
 			
 		});
+		
+		
+		
 		mailTable.getDataTable().setCellSpacing(0);
+
+		// This is only needed as workaround in pagingscrolltable
+		// See http://code.google.com/p/google-web-toolkit-incubator/wiki/PagingScrollTable
+		mailTable.setWidth(Window.getClientWidth() -150 -40+"px");
+		mailTable.setHeight("600px");
 		Window.addResizeHandler(new ResizeHandler() {
 
 			public void onResize(ResizeEvent event) {
-				int width = event.getWidth() - 200;
-				mailTable.setWidth(width + "px");
-		
+				mailTable.setWidth(Window.getClientWidth() -150 -40+"px");
 			}
+			
 		});
-		
 		mailTable.fillWidth();
-		PagingOptions options = new PagingOptions(mailTable, (PagingOptionsImages) GWT.create(MyPagingOptionImages.class));
 		
+		PagingOptions options = new PagingOptions(mailTable,(PagingOptionsImages) GWT.create(MyPagingOptionImages.class));
 		ButtonBar navigatorBar = new ButtonBar();
 		Button newMailButton = new Button(constants.newMailButton());
 		navigatorBar.add(newMailButton);
-		Button deleteMailButton = new Button(constants.deleteMailButton());
+		final Button deleteMailButton = new Button(constants.deleteMailButton());
+		deleteMailButton.setEnabled(false);
 		navigatorBar.add(deleteMailButton);
+		
+		
+		mailTable.getDataTable().addRowSelectionHandler(new RowSelectionHandler() {
 
+			public void onRowSelection(RowSelectionEvent event) {
+				if (mailTable.getDataTable().getSelectedRows().size() == 0) {
+					deleteMailButton.setEnabled(false);
+
+				} else {
+					deleteMailButton.setEnabled(true);
+				}
+			}
+			
+		});
+		
 		HorizontalPanel hPanel = new HorizontalPanel();
 		hPanel.setStyleName("hupa-MailTableControl");
 		hPanel.setSpacing(10);
 		hPanel.add(navigatorBar);
 		hPanel.add(options);
+	
+		
 		hPanel.setWidth("100%");
 		hPanel.setHeight("100%");
 		vPanel.add(hPanel);
 		vPanel.add(mailTable);
 		initWidget(vPanel);
 	}
-	
 
 	private TableDefinition<IMAPMessage> createTableDefinitation() {
 		DefaultTableDefinition<IMAPMessage> def = new DefaultTableDefinition<IMAPMessage>(createColumnDefinitionList());
@@ -174,55 +186,7 @@
 	private FixedWidthFlexTable createHeaderTable() {
 		FixedWidthFlexTable headerTable = new FixedWidthFlexTable();
 		return headerTable;
-		/*
-		final CheckBox box = new CheckBox();
-		box.addClickHandler(new ClickHandler() {
-
-			public void onClick(ClickEvent event) {
-				CheckBox headerCheckbox = (CheckBox) event.getSource();
-				if (headerCheckbox.getValue()) {
-					mailTable.getDataTable().selectAllRows();
-				} else {
-					mailTable.getDataTable().deselectAllRows();
-				}
-				
-				for (int i = 0; i < mailTable.getDataTable().getRowCount(); i++) {
-					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 = mailTable.getRowValue(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");
-					}
-					
-				}
-			}
-
-		});
-		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;
-		*/
+		
 	}
 	
 	/**
@@ -241,17 +205,34 @@
 		FromColumnDefination from = new FromColumnDefination();
 		from.setColumnTruncatable(true);
 		from.setPreferredColumnWidth(250);
+		from.setMinimumColumnWidth(150);
+		from.setMaximumColumnWidth(300);
+
 		cList.add(from);
 
 		
 		SubjectColumnDefination subject =new SubjectColumnDefination();
 		subject.setColumnTruncatable(true);
-		from.setPreferredColumnWidth(800);
+		subject.setPreferredColumnWidth(800);
+		subject.setMinimumColumnWidth(600);
+		subject.setMaximumColumnWidth(1000);
 		cList.add(subject);
 		
 		DateColumnDefination date = new DateColumnDefination();
 		date.setColumnTruncatable(true);
+		date.setCellRenderer(new CellRenderer<IMAPMessage, Date>() {
 
+			
+			public void renderRowValue(IMAPMessage rowValue,
+					ColumnDefinition<IMAPMessage, Date> columnDef,
+					AbstractCellView<IMAPMessage> view) {
+				view.setHTML(DateTimeFormat.getShortTimeFormat().format(rowValue.getIMAPHeader().getReceivedDate()));
+			}
+			
+		});
+		date.setPreferredColumnWidth(100);
+		date.setMinimumColumnWidth(50);
+		date.setMaximumColumnWidth(150);
 		cList.add(date);
 		
 		return cList;
@@ -263,7 +244,7 @@
 		public void requestRows(
 				final Request request,
 				final com.google.gwt.gen2.table.client.TableModel.Callback<IMAPMessage> callback)
{
-			GWT.log("HERE", null);
+			
 			if (user == null || folder == null) {
 				setRowCount(0);
 				callback.onRowsReady(request, new TableModelHelper.Response<IMAPMessage>() {
@@ -283,6 +264,7 @@
 				}
 
 				public void onSuccess(final FetchMessagesResult result) {
+					bus.fireEvent(new MessagesReceivedEvent(result.getMessages()));
 					 TableModelHelper.Response<IMAPMessage> response = new TableModelHelper.Response<IMAPMessage>()
{
 
 						@Override
@@ -329,17 +311,16 @@
 		
 	}
 	
-	private final class DateColumnDefination extends AbstractColumnDefinition<IMAPMessage,
String> {
+	private final class DateColumnDefination extends AbstractColumnDefinition<IMAPMessage,
Date> {
 
 		@Override
-		public String getCellValue(IMAPMessage rowValue) {
-			return ""; //rowValue.getIMAPHeader().getReceivedDate().toString();
+		public Date getCellValue(IMAPMessage rowValue) {
+			return rowValue.getIMAPHeader().getReceivedDate();
 		}
 
 		@Override
-		public void setCellValue(IMAPMessage rowValue, String cellValue) {
-			rowValue.getIMAPHeader().setReceivedDate(null);
-
+		public void setCellValue(IMAPMessage rowValue, Date cellValue) {
+			rowValue.getIMAPHeader().setReceivedDate(cellValue);
 		}
 		
 	}
@@ -347,4 +328,17 @@
 	public HasRowSelectionHandlers getDataTableSelection() {
 		return mailTable.getDataTable();
 	}
+	
+	public void reloadData(IMAPUser user, IMAPFolder folder,String searchValue) {
+		this.user = user;
+		this.folder = folder;
+		this.searchValue = searchValue;
+		mailTable.getTableModel().setRowCount(0);
+		mailTable.reloadPage();
+	}
+
+	public HasPageLoadHandlers getDataTableLoad() {
+		return mailTable;
+	}
+	
 }

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=792876&r1=792875&r2=792876&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 Fri Jul 10 10:36:58
2009
@@ -8,6 +8,7 @@
 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;
@@ -15,6 +16,8 @@
 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.events.MessagesReceivedEvent;
+import org.apache.hupa.client.events.MessagesReceivedEventHandler;
 import org.apache.hupa.client.rpc.FetchFolders;
 import org.apache.hupa.client.rpc.FetchFoldersResult;
 import org.apache.hupa.client.rpc.LogoutUser;
@@ -40,13 +43,11 @@
 	public interface Display {
 		public HasClickHandlers getLogoutClick();
 		public HasSelectionHandlers<TreeItem> getTree();
-		public HasClickHandlers getSearchClick();
-		public HasValue<String> getSearchValue();
-		
 		//public HasRowSelectionHandlers getTableClick();
 		public void bindTreeItems(List<IMAPTreeItem> treeList);
-		//public void bindMessages(List<IMAPMessage> messageList);
-
+		public HasClickHandlers getSearchClick();
+		public HasValue<String> getSearchValue();
+		public void fillOracle(ArrayList<IMAPMessage> messages);
 	}
 	
 	private DispatchAsync dispatcher;
@@ -80,6 +81,15 @@
 			}
 			
 		});
+		
+		bus.addHandler(MessagesReceivedEvent.TYPE, new MessagesReceivedEventHandler() {
+
+			public void onMessagesReceived(MessagesReceivedEvent event) {
+				display.fillOracle(event.getMessages());
+			}
+			
+		});
+		
 	}
 	
 	protected void loadTreeItems() {
@@ -160,7 +170,6 @@
 				TreeItem item = event.getSelectedItem();
 				folder = (IMAPFolder) item.getUserObject();
 				bus.fireEvent(new LoadMessagesEvent(user,folder));
-				
 			}
 			
 		});
@@ -182,7 +191,7 @@
 
 	private void reset() {
 		//display.bindMessages(new ArrayList<IMAPMessage>());
-		display.bindTreeItems(new ArrayList<IMAPTreeItem>());
 		display.getSearchValue().setValue("");
+		display.bindTreeItems(new ArrayList<IMAPTreeItem>());
 	}
 }

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=792876&r1=792875&r2=792876&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 Fri Jul 10 10:36:58 2009
@@ -1,5 +1,6 @@
 package org.apache.hupa.client.mvp;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hupa.client.HupaConstants;
@@ -8,7 +9,6 @@
 import org.apache.hupa.client.data.IMAPMessage;
 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;
@@ -24,7 +24,6 @@
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
 import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.Tree;
 import com.google.gwt.user.client.ui.TreeItem;
 import com.google.gwt.user.client.ui.VerticalPanel;
@@ -38,19 +37,19 @@
 	private RoundedPanel west;
 	private IMAPTreeImages tImages = GWT.create(IMAPTreeImages.class);
 	private Tree folderTree = new Tree(tImages,true);
-	
 	private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(" ,@");  
 	private SuggestBox searchBox = new SuggestBox(oracle);
 	private Button searchButton = new Button(constants.searchButton());
+	
+
 	private Button logoutButton = new Button(constants.logoutButton());
-	private VerticalPanel centerVP = new VerticalPanel();
-	private TextBox rowsPerPageBox = new TextBox();
 	private RoundedPanel center;
 	private IMAPMessageView messageView;
 	
 	@Inject
-	public MainView(IMAPMessageView messageView) {
+	public MainView(IMAPMessageView messageView,IMAPMessagePresenter presenter) {
 		this.messageView = messageView;
+		presenter.bind(messageView);
 		dockPanel = new DockPanel();
 		
 		dockPanel.setSpacing(10);
@@ -70,12 +69,10 @@
 	}
 
 	private void createWest() {
-			west = new RoundedPanel(RoundedPanel.ALL);
+			west = new RoundedPanel(RoundedPanel.ALL,1);
 			west.add(folderTree);
 			west.setWidth("150px");	
 			folderTree.setAnimationEnabled(true);
-			
-		
 	}
 	private void createNorth() {
 		north = new VerticalPanel();
@@ -97,8 +94,11 @@
 		HorizontalPanel hPanel = new HorizontalPanel();
 		hPanel.setSpacing(5);
 		hPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
+	
 		
-		searchBox.setWidth("150px");
+		searchBox.setAnimationEnabled(true);
+		searchBox.setAutoSelectEnabled(false);
+		searchBox.setWidth("250px");
 		searchBox.setLimit(20);
 		searchBox.addKeyUpHandler(new KeyUpHandler() {
 
@@ -120,18 +120,12 @@
 	}
 
 	private void createCenter() {
-		center = new RoundedPanel(RoundedPanel.ALL, 3);
+		center = new RoundedPanel(RoundedPanel.ALL, 1);
 		center.setBorderColor("#C3D9FF");
-		
 		center.add(messageView);
-		center.setWidth("100%");
 
 	}
 
-	private void fillOracle(IMAPMessage msg) {
-		oracle.add(msg.getIMAPHeader().getFrom());
-		oracle.add(msg.getIMAPHeader().getSubject());
-	}
 
 	public HasClickHandlers getLogoutClick() {
 		return logoutButton;
@@ -140,6 +134,7 @@
 		return folderTree;
 	}
 	
+	
 	public HasClickHandlers getSearchClick() {
 		return searchButton;
 	}
@@ -147,6 +142,7 @@
 		return searchBox;
 	}
 	
+	
 	public void bindTreeItems(List<IMAPTreeItem> treeList) {
 		folderTree.clear();
 		
@@ -160,4 +156,12 @@
 			}
 		}
 	}
+
+	public void fillOracle(ArrayList<IMAPMessage> messages) {
+		for (int i = 0; i < messages.size();i++) {
+			oracle.add(messages.get(i).getIMAPHeader().getSubject());
+			oracle.add(messages.get(i).getIMAPHeader().getFrom());
+		}
+		searchBox.setText("");
+	}
 }

Modified: labs/hupa/war/Hupa.css
URL: http://svn.apache.org/viewvc/labs/hupa/war/Hupa.css?rev=792876&r1=792875&r2=792876&view=diff
==============================================================================
--- labs/hupa/war/Hupa.css (original)
+++ labs/hupa/war/Hupa.css Fri Jul 10 10:36:58 2009
@@ -37,18 +37,6 @@
 	background-color:	#E0ECFF;
 }
 
-.hupa-Mailtable{
-    border-top:      1pt solid silver;
-}
-
-.hupa-Mailtable-Header {
-	background-color:	#E0ECFF;
-	text-align: 		center;
-	border-top:         1pt solid grey;
-	border-bottom:      1pt solid grey;
-	
-}
-
 .hupa-Mailtable-row-notseen {
 	  font-weight: 		bold;
 }
@@ -57,11 +45,28 @@
 	  background-color:	#F0E68C;
 	  text-align: 		left;
 	  vertical-align: 	top;
-	padding: 			0px 10px 0px 10px;
+	  padding: 			0px 10px 0px 10px;
 	  font-size: 	    80%;
 	  cursor:           hand;
 }
 
+.gwt-ScrollTable .dataTable td {
+  border-color: #silver;
+  border-style: solid;
+  border-width: 1px 0px 0px 0px;
+  white-space: nowrap;
+  overflow: hidden;
+}
+
+
+.gwt-ScrollTable .dataTable tr.highlighted {
+  background:           #FAD163;
+}
+
+.gwt-ScrollTable .dataTable tr.selected td {
+  background:           #FFF7D7;
+}
+
 .hupa-Mailtable-row {
     text-align: 		left;
 	vertical-align: 	top;
@@ -72,7 +77,6 @@
 
 .hupa-Mailtable-cell-date {
 	text-align: 		right;
-	vertical-align:		top;
 }
 
 .hupa-IMAPFolder-selected {



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


Mime
View raw message