labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r793299 - in /labs/hupa: ./ src/main/java/org/apache/hupa/client/ src/main/java/org/apache/hupa/client/events/ src/main/java/org/apache/hupa/client/mvp/ src/main/java/org/apache/hupa/client/widgets/ src/main/java/org/apache/hupa/server/ src...
Date Sun, 12 Jul 2009 09:12:08 GMT
Author: norman
Date: Sun Jul 12 09:12:07 2009
New Revision: 793299

URL: http://svn.apache.org/viewvc?rev=793299&view=rev
Log:
Displaying of "simple" emails now work

Added:
    labs/hupa/src/main/java/org/apache/hupa/client/events/
    labs/hupa/src/main/java/org/apache/hupa/client/events/ClickEvent.java
    labs/hupa/src/main/java/org/apache/hupa/client/events/ClickHandler.java
    labs/hupa/src/main/java/org/apache/hupa/client/events/HasClickHandlers.java
    labs/hupa/src/main/java/org/apache/hupa/client/widgets/MyFixedWithGrid.java
    labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEvent.java
    labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEventHandler.java
Modified:
    labs/hupa/.classpath
    labs/hupa/.project
    labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.java
    labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.properties
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.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/server/ExposeMessageHandler.java
    labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java
    labs/hupa/src/main/java/org/apache/hupa/shared/data/IMAPMessageAttachment.java
    labs/hupa/war/Hupa.css

Modified: labs/hupa/.classpath
URL: http://svn.apache.org/viewvc/labs/hupa/.classpath?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/.classpath (original)
+++ labs/hupa/.classpath Sun Jul 12 09:12:07 2009
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
-	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: labs/hupa/.project
URL: http://svn.apache.org/viewvc/labs/hupa/.project?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/.project (original)
+++ labs/hupa/.project Sun Jul 12 09:12:07 2009
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>Hupa</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.maven.ide.eclipse.maven2Nature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>com.google.gwt.eclipse.core.gwtNature</nature>
-		<nature>com.google.gdt.eclipse.core.webAppNature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Hupa</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.google.gwt.eclipse.core.gwtNature</nature>
+		<nature>com.google.gdt.eclipse.core.webAppNature</nature>
+	</natures>
+</projectDescription>

Modified: labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.java Sun Jul 12 09:12:07
2009
@@ -58,10 +58,9 @@
 	public String mailTableSubject();
 	public String mailTableDate();
 	
-	public String loading();
 	public String loginInvalid();
 
 	public String searchButton();
 
-	public String rowsPerPageLabel();
+	public String emptyMailTable();
 }

Modified: labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.properties
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.properties?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.properties (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/HupaConstants.properties Sun Jul 12 09:12:07
2009
@@ -17,7 +17,6 @@
 mailTableFrom=From
 mailTableSubject=Subject
 mailTableDate=Date
-loading=Loading....
 loginInvalid=Unable to login, please check username and password
 searchButton=Search in message
-rowsPerPageLabel=Emails per Page
\ No newline at end of file
+emptyMailTable=There are no emails to display
\ No newline at end of file

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/ClickEvent.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/ClickEvent.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/ClickEvent.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/ClickEvent.java Sun Jul 12 09:12:07
2009
@@ -0,0 +1,60 @@
+/****************************************************************
+ * 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.GwtEvent;
+
+public class ClickEvent<R> extends GwtEvent<ClickHandler>{
+
+	public static Type<ClickHandler> TYPE = new Type<ClickHandler>();
+	private int cell;
+	private int row;
+	private R value;
+
+	public ClickEvent(int row, int cell, R value) {
+		this.cell = cell;
+		this.row = row;
+		this.value = value;
+	}
+	
+	public int getCell() {
+		return cell;
+	}
+	
+	public int getRow() {
+		return row;
+	}
+	
+	public R getRowValue() {
+		return value;
+	}
+	
+	@Override
+	protected void dispatch(ClickHandler handler) {
+		handler.onClick(this);
+	}
+
+	@Override
+	public Type<ClickHandler> getAssociatedType() {
+		return TYPE;
+	}
+	
+}

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/ClickHandler.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/ClickHandler.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/ClickHandler.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/ClickHandler.java Sun Jul 12 09:12:07
2009
@@ -0,0 +1,26 @@
+/****************************************************************
+ * 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 ClickHandler<R> extends EventHandler{
+
+	public void onClick(ClickEvent<R> event);
+}

Added: labs/hupa/src/main/java/org/apache/hupa/client/events/HasClickHandlers.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/HasClickHandlers.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/events/HasClickHandlers.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/events/HasClickHandlers.java Sun Jul 12
09:12:07 2009
@@ -0,0 +1,26 @@
+/****************************************************************
+ * 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.HandlerRegistration;
+
+public interface HasClickHandlers {
+
+	public HandlerRegistration addClickHandler(ClickHandler handler);
+}

Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java Sun Jul
12 09:12:07 2009
@@ -1,17 +1,40 @@
+/****************************************************************
+ * 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 org.apache.hupa.client.events.ClickEvent;
+import org.apache.hupa.client.events.ClickHandler;
+import org.apache.hupa.client.events.HasClickHandlers;
 import org.apache.hupa.client.rpc.EventBus;
 import org.apache.hupa.shared.data.IMAPFolder;
+import org.apache.hupa.shared.data.IMAPMessage;
 import org.apache.hupa.shared.data.IMAPUser;
+import org.apache.hupa.shared.events.ExpandMessageEvent;
 import org.apache.hupa.shared.events.LoadMessagesEvent;
 import org.apache.hupa.shared.events.LoadMessagesEventHandler;
 import org.apache.hupa.shared.events.LoginEvent;
 import org.apache.hupa.shared.events.LoginEventHandler;
 
+import com.google.gwt.core.client.GWT;
 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.gwt.user.client.ui.HasWidgets;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
@@ -21,6 +44,7 @@
 	public interface Display {
 		public HasRowSelectionHandlers getDataTableSelection();
 		public HasPageLoadHandlers getDataTableLoad();
+		public HasClickHandlers getDataTableClick();
 		public void reloadData(IMAPUser user, IMAPFolder folder,String searchValue);
 	}
 
@@ -53,7 +77,9 @@
 		bus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
 
 			public void onLogin(LoginEvent event) {
-				display.reloadData(event.getUser(), new IMAPFolder(IMAPFolder.DEFAULT_INBOX), null);
+				user = event.getUser();
+				folder = new IMAPFolder(IMAPFolder.DEFAULT_INBOX);
+				display.reloadData(user, folder, null);
 			}
 
 			
@@ -62,18 +88,18 @@
 	
 	public void bind(final Display display) {
 		this.display = display;
-		updateDisplay();
-	}
-	
-	private void updateDisplay() {
-		display.getDataTableSelection().addRowSelectionHandler(new RowSelectionHandler() {
+		
+		display.getDataTableClick().addClickHandler(new ClickHandler<IMAPMessage>() {
 
-			public void onRowSelection(RowSelectionEvent event) {
+			public void onClick(ClickEvent<IMAPMessage> event) {
+				GWT.log("FIRE", null);
+				bus.fireEvent(new ExpandMessageEvent(user,folder,event.getRowValue()));
 			}
 			
 		});
 	}
 	
+	
 	public void go(HasWidgets w) {
 		w.add((Widget)display);
 	}

Modified: labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java Sun Jul 12
09:12:07 2009
@@ -30,6 +30,7 @@
 import org.apache.hupa.client.bundles.MyPagingOptionImages;
 import org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display;
 import org.apache.hupa.client.rpc.EventBus;
+import org.apache.hupa.client.widgets.MyFixedWithGrid;
 import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.IMAPMessage;
 import org.apache.hupa.shared.data.IMAPUser;
@@ -49,7 +50,6 @@
 import com.google.gwt.gen2.table.client.ColumnDefinition;
 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;
@@ -76,6 +76,7 @@
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
 
 public class IMAPMessageListView extends Composite implements Display{
@@ -88,6 +89,7 @@
 	
 	private PagingScrollTable<IMAPMessage> mailTable;
 	private EventBus bus;
+	private MyFixedWithGrid<IMAPMessage> dataTable = createDataTable();
 	
 	@Inject
 	public IMAPMessageListView(DispatchAsync dispatcher,EventBus bus) {
@@ -98,13 +100,13 @@
 
 		
 		mailTable = new PagingScrollTable<IMAPMessage>(
-				new IMAPMessageTableModel(), createDataTable(),
+				new IMAPMessageTableModel(), dataTable,
 				createHeaderTable(),
 				createTableDefinitation());
 		mailTable.setPageSize(20);
 		
 		
-		HTML emptyTable = new HTML("There is no data to display");
+		HTML emptyTable = new HTML(constants.emptyMailTable());
 		emptyTable.setHorizontalAlignment(HTML.ALIGN_CENTER);
 		emptyTable.setHeight("600px");
 		mailTable.setEmptyTableWidget(emptyTable);
@@ -121,6 +123,14 @@
 			public void onPageLoad(PageLoadEvent event) {
 				for (int i = 0; i < mailTable.getDataTable().getRowCount(); i++) {
 					mailTable.getDataTable().getRowFormatter().setStyleName(i,"hupa-Mailtable-row");
+					IMAPMessage msg = mailTable.getRowValue(i);
+					if (msg != null) {
+						if (msg.getIMAPFlags().contains(IMAPFlag.SEEN) == false) {
+							mailTable.getDataTable().getRowFormatter().addStyleName(i,"hupa-Mailtable-row-notseen");
+						} else {
+							mailTable.getDataTable().getRowFormatter().removeStyleName(i,"hupa-Mailtable-row-notseen");
+						}
+					}
 				}
 			}
 			
@@ -128,8 +138,27 @@
 		
 		
 		
+		dataTable.addClickHandler(new org.apache.hupa.client.events.ClickHandler<IMAPMessage>()
{
+
+			public void onClick(
+					org.apache.hupa.client.events.ClickEvent<IMAPMessage> event) {
+				Widget w = dataTable.getWidget(event.getRow(),event.getCell());
+				if (!(w instanceof Rating)) {
+					IMAPMessage m = event.getRowValue();
+					/*
+					if (m.getIMAPFlags().contains(IMAPFlag.SEEN) == false) {
+						mailTable.getDataTable().getRowFormatter().addStyleName(event.getRow(),"hupa-Mailtable-row-seen");
+						m.getIMAPFlags().add(IMAPFlag.SEEN);
+						mailTable.setRowValue(event.getRow(), m);
+					}
+					*/
+				}
+			}
+		});
+		
 		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");
@@ -157,7 +186,6 @@
 			public void onRowSelection(RowSelectionEvent event) {
 				if (mailTable.getDataTable().getSelectedRows().size() == 0) {
 					deleteMailButton.setEnabled(false);
-
 				} else {
 					deleteMailButton.setEnabled(true);
 				}
@@ -193,13 +221,12 @@
 	/**
 	   * @return the newly created data table.
 	   */
-	  private FixedWidthGrid createDataTable() {
-	    FixedWidthGrid dataTable = new FixedWidthGrid();
+	  private MyFixedWithGrid<IMAPMessage> createDataTable() {
+	    MyFixedWithGrid<IMAPMessage> dataTable = new MyFixedWithGrid<IMAPMessage>();
 	    dataTable.setSelectionPolicy(SelectionPolicy.CHECKBOX);
 	    return dataTable;
 	  }
 
-
 	private List<ColumnDefinition<IMAPMessage, ?>> createColumnDefinitionList()
{
 		List<ColumnDefinition<IMAPMessage, ?>> cList = new ArrayList<ColumnDefinition<IMAPMessage,
?>>();
 
@@ -374,5 +401,9 @@
 	public HasPageLoadHandlers getDataTableLoad() {
 		return mailTable;
 	}
+
+	public org.apache.hupa.client.events.HasClickHandlers getDataTableClick() {
+		return dataTable;
+	}
 	
 }

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=793299&r1=793298&r2=793299&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 Sun Jul 12
09:12:07 2009
@@ -61,6 +61,11 @@
 	public void bind(Display display) {
 		this.display = display;
 	}
+	
+	public void bind(IMAPMessage message) {
+		this.message = message;
+		updateDisplay();
+	}
 
 	private void updateDisplay() {
 		display.getFrom().setText(message.getIMAPHeader().getFrom());

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=793299&r1=793298&r2=793299&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 Sun Jul 12 09:12:07
2009
@@ -60,6 +60,10 @@
 		detailGrid.setText(1, 0, constants.headerTo() + ":");
 		detailGrid.setText(2, 0, constants.headerCc() + ":");
 		detailGrid.setText(3, 0, constants.headerSubject() + ":");
+		detailGrid.setWidget(0, 1, from);
+		detailGrid.setWidget(1, 1, to);
+		detailGrid.setWidget(2, 1, cc);
+		detailGrid.setWidget(3, 1, subject);
 		detailGrid.getCellFormatter().setVerticalAlignment(0, 0, VerticalPanel.ALIGN_TOP);
 		detailGrid.getCellFormatter().setVerticalAlignment(1, 0, VerticalPanel.ALIGN_TOP);
 		detailGrid.getCellFormatter().setVerticalAlignment(2, 0, VerticalPanel.ALIGN_TOP);

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=793299&r1=793298&r2=793299&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 Sun Jul 12 09:12:07
2009
@@ -28,9 +28,12 @@
 
 import org.apache.hupa.client.rpc.EventBus;
 import org.apache.hupa.client.widgets.IMAPTreeItem;
+import org.apache.hupa.server.ExposeMessageHandler;
 import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.IMAPMessage;
 import org.apache.hupa.shared.data.IMAPUser;
+import org.apache.hupa.shared.events.ExpandMessageEvent;
+import org.apache.hupa.shared.events.ExpandMessageEventHandler;
 import org.apache.hupa.shared.events.LoadMessagesEvent;
 import org.apache.hupa.shared.events.LoginEvent;
 import org.apache.hupa.shared.events.LoginEventHandler;
@@ -38,6 +41,8 @@
 import org.apache.hupa.shared.events.LogoutEventHandler;
 import org.apache.hupa.shared.events.MessagesReceivedEvent;
 import org.apache.hupa.shared.events.MessagesReceivedEventHandler;
+import org.apache.hupa.shared.rpc.ExposeMessage;
+import org.apache.hupa.shared.rpc.ExposeMessageResult;
 import org.apache.hupa.shared.rpc.FetchFolders;
 import org.apache.hupa.shared.rpc.FetchFoldersResult;
 import org.apache.hupa.shared.rpc.LogoutUser;
@@ -120,6 +125,24 @@
 			
 		});
 		
+		bus.addHandler(ExpandMessageEvent.TYPE, new ExpandMessageEventHandler() {
+
+			public void onExpandMessage(ExpandMessageEvent event) {
+				dispatcher.execute(new ExposeMessage(event.getUser(),event.getFolder(),event.getMessage()),
new AsyncCallback<ExposeMessageResult>() {
+
+					public void onFailure(Throwable caught) {
+						GWT.log("ERROR=", caught);
+					}
+
+					public void onSuccess(ExposeMessageResult result) {
+						showMessage(result.getMessage());
+					}
+					
+				});
+			}
+			
+		});
+		
 	}
 	
 	protected void loadTreeItems() {
@@ -199,7 +222,7 @@
 			public void onSelection(SelectionEvent<TreeItem> event) {
 				TreeItem item = event.getSelectedItem();
 				folder = (IMAPFolder) item.getUserObject();
-				GWT.log("HERE", null);
+				showMessageTable();
 				bus.fireEvent(new LoadMessagesEvent(user,folder));
 			}
 			
@@ -227,6 +250,7 @@
 	
 	private void showMessage(IMAPMessage message) {
 		display.getCenterContainer().clear();
+		messagePresenter.bind(message);
 		messagePresenter.go(display.getCenterContainer());
 	}
 	

Added: labs/hupa/src/main/java/org/apache/hupa/client/widgets/MyFixedWithGrid.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/widgets/MyFixedWithGrid.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/client/widgets/MyFixedWithGrid.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/client/widgets/MyFixedWithGrid.java Sun Jul 12
09:12:07 2009
@@ -0,0 +1,73 @@
+/****************************************************************
+ * 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.widgets;
+
+import org.apache.hupa.client.events.ClickEvent;
+import org.apache.hupa.client.events.ClickHandler;
+import org.apache.hupa.client.events.HasClickHandlers;
+
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.gen2.table.client.FixedWidthGrid;
+import com.google.gwt.gen2.table.client.PagingScrollTable;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+
+public class MyFixedWithGrid<R> extends FixedWidthGrid implements
+		HasClickHandlers {
+
+	private HandlerManager manager = new HandlerManager(this);
+
+	@Override
+	public void onBrowserEvent(Event event) {
+		super.onBrowserEvent(event);
+		super.onBrowserEvent(event);
+		Element targetRow = null;
+		Element targetCell = null;
+
+		switch (DOM.eventGetType(event)) {
+
+		case Event.ONCLICK: {
+
+			// Get the target row
+			targetCell = getEventTargetCell(event);
+			if (targetCell == null) {
+				return;
+			}
+			targetRow = DOM.getParent(targetCell);
+			int targetRowIndex = getRowIndex(targetRow);
+			int targetCellIndex = getCellIndex(targetRow, targetCell);
+
+			PagingScrollTable<R> parent = (PagingScrollTable<R>) getParent();
+			// Select the row
+			manager.fireEvent(new ClickEvent<R>(targetRowIndex,
+					targetCellIndex, parent.getRowValue(targetRowIndex)));
+		}
+
+		}
+
+	}
+
+	public HandlerRegistration addClickHandler(ClickHandler handler) {
+		return manager.addHandler(ClickEvent.TYPE, handler);
+	}
+
+}

Modified: labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/server/ExposeMessageHandler.java Sun Jul 12 09:12:07
2009
@@ -65,18 +65,21 @@
 	}
 	
 	protected IMAPMessage exposeMessage(IMAPUser user, IMAPFolder folder, IMAPMessage msg) throws
ActionException {
+
 		if (msg.isExposed()) {
 			return msg;
 		}
 		IMAPProtocol proto = null;
 		try {
 			proto = getProtocol(user);
+
+
 			proto.select(folder.getName());
 
 			IMAPMessageContent content = new IMAPMessageContent();
 
 			
-			
+
 			MimeTree mTree = proto.uidFetchBodystructure(msg.getUid());
 
 			MimePart textPart = mTree.getFirstTextPart("plain");
@@ -137,6 +140,7 @@
 			
 			    proto.uidStore(new SequenceSet(msg.getUid()), true, flagsRistretto);
 			}
+
 			return msg;
 		} catch (IOException e) {
 			e.printStackTrace();

Modified: labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java Sun Jul 12 09:12:07
2009
@@ -21,6 +21,7 @@
 
 import net.customware.gwt.dispatch.server.guice.ActionHandlerModule;
 
+import org.apache.hupa.server.ExposeMessageHandler;
 import org.apache.hupa.server.FetchFoldersHandler;
 import org.apache.hupa.server.FetchMessagesHandler;
 import org.apache.hupa.server.LoginUserHandler;
@@ -41,5 +42,6 @@
 		bindHandler(FetchFoldersHandler.class);
 		bindHandler(FetchMessagesHandler.class);
 		bindHandler(LogoutUserHandler.class);
+		bindHandler(ExposeMessageHandler.class);
 	}
 }

Modified: labs/hupa/src/main/java/org/apache/hupa/shared/data/IMAPMessageAttachment.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/shared/data/IMAPMessageAttachment.java?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/shared/data/IMAPMessageAttachment.java (original)
+++ labs/hupa/src/main/java/org/apache/hupa/shared/data/IMAPMessageAttachment.java Sun Jul
12 09:12:07 2009
@@ -31,7 +31,7 @@
 
 	public void setName(String name) {
 		this.name = name;
-		;
+		
 	}
 
 	public String getName() {

Added: labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEvent.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEvent.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEvent.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEvent.java Sun Jul
12 09:12:07 2009
@@ -0,0 +1,66 @@
+/****************************************************************
+ * 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.shared.events;
+
+import org.apache.hupa.shared.data.IMAPFolder;
+import org.apache.hupa.shared.data.IMAPMessage;
+import org.apache.hupa.shared.data.IMAPUser;
+
+import com.google.gwt.event.shared.GwtEvent;
+
+public class ExpandMessageEvent extends GwtEvent<ExpandMessageEventHandler>{
+
+	public static Type<ExpandMessageEventHandler> TYPE = new Type<ExpandMessageEventHandler>();
+	private IMAPMessage message;
+	private IMAPUser user;
+	private IMAPFolder folder;
+	
+	public ExpandMessageEvent(IMAPUser user, IMAPFolder folder, IMAPMessage message) {
+		this.message = message;
+		this.folder = folder;
+		this.user = user;
+	}
+	
+	public IMAPMessage getMessage() {
+		return message;
+	}
+	
+	public IMAPUser getUser () {
+		return user;
+	}
+	
+	public IMAPFolder getFolder () {
+		return folder;
+	}
+	
+	
+	@Override
+	protected void dispatch(ExpandMessageEventHandler handler) {
+		handler.onExpandMessage(this);
+	}
+
+	@Override
+	public com.google.gwt.event.shared.GwtEvent.Type<ExpandMessageEventHandler> getAssociatedType()
{
+		return TYPE;
+	}
+
+	
+
+}

Added: labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEventHandler.java
URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEventHandler.java?rev=793299&view=auto
==============================================================================
--- labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEventHandler.java (added)
+++ labs/hupa/src/main/java/org/apache/hupa/shared/events/ExpandMessageEventHandler.java Sun
Jul 12 09:12:07 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.shared.events;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface ExpandMessageEventHandler extends EventHandler{
+
+	public void onExpandMessage(ExpandMessageEvent event);
+}

Modified: labs/hupa/war/Hupa.css
URL: http://svn.apache.org/viewvc/labs/hupa/war/Hupa.css?rev=793299&r1=793298&r2=793299&view=diff
==============================================================================
--- labs/hupa/war/Hupa.css (original)
+++ labs/hupa/war/Hupa.css Sun Jul 12 09:12:07 2009
@@ -82,4 +82,5 @@
 
 .hupa-IMAPFolder-selected {
 	background:	      #E0ECFF;
+	width:			  120px;	
 }
\ No newline at end of file



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


Mime
View raw message