Author: norman
Date: Mon Jul 27 17:52:39 2009
New Revision: 798236

URL: http://svn.apache.org/viewvc?rev=798236&view=rev
Log:
Some better formatting of Received-Date header 
Make sure the IMAPMessageListView is not displayed after the rpc call returns 
if the user is currently composing a new message or is reading one

Modified:
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
    labs/hupa/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java

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=798236&r1=798235&r2=798236&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 
Mon Jul 27 17:52:39 2009
@@ -63,6 +63,7 @@
 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.AbstractScrollTable.SortPolicy;
 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;
@@ -176,6 +177,7 @@
                                });
                
                mailTable.getDataTable().setCellSpacing(0);
+               mailTable.setSortPolicy(SortPolicy.DISABLED);
 
        
                // This is only needed as workaround in pagingscrolltable
@@ -325,11 +327,33 @@
                date.setColumnTruncatable(true);
                date.setCellRenderer(new CellRenderer<IMAPMessage, Date>() {
 
-                       
+                       @SuppressWarnings("deprecation")
                        public void renderRowValue(IMAPMessage rowValue,
                                        ColumnDefinition<IMAPMessage, Date> 
columnDef,
                                        AbstractCellView<IMAPMessage> view) {
-                               
view.setHTML(DateTimeFormat.getShortTimeFormat().format(rowValue.getHeader().getReceivedDate()));
+                               DateTimeFormat dtformat;
+                               Date rDate = 
rowValue.getHeader().getReceivedDate();
+                               int rYear = rDate.getYear();
+                               int rMonth = rDate.getMonth();
+                               int rDay = rDate.getDate();
+                               
+                               Date now = new Date();
+                               int nowYear = now.getYear();
+                               int nowMonth = now.getMonth();
+                               int nowDay = now.getDate();
+                               
+                               if (rYear < nowYear) {
+                                       dtformat = 
DateTimeFormat.getFormat("dd.MMM.yyyy");
+                               } else if (rMonth < nowMonth || (rMonth == 
nowMonth && rDay < nowDay)) {
+                                       dtformat = 
DateTimeFormat.getFormat("dd.MMM.");
+                               } else if (rDay == nowDay){
+                                       dtformat = 
DateTimeFormat.getFormat("HH:mm");
+                               } else {
+
+                                       dtformat = 
DateTimeFormat.getFormat("dd.MMM.yyyy HH:mm");
+                               }
+                       
+                               view.setHTML(dtformat.format(rDate));
                                
view.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
                        }
                        

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=798236&r1=798235&r2=798236&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 Mon 
Jul 27 17:52:39 2009
@@ -227,9 +227,9 @@
                eventBus.addHandler(MessagesReceivedEvent.TYPE, new 
MessagesReceivedEventHandler() {
 
                        public void onMessagesReceived(MessagesReceivedEvent 
event) {
-                               // fill the oracle and display the messagetable
+                               
+                               // fill the oracle
                                display.fillOracle(event.getMessages());
-                               showMessageTable();
                        }
                        
                });



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to