james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r1522384 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: activity/MessageContentActivity.java ui/MessageContentView.java ui/MessageContentView.ui.xml ui/MessageListView.java ui/__ContentPanel.java ui/__ContentPanel.ui.xml
Date Thu, 12 Sep 2013 04:44:37 GMT
Author: dongxu
Date: Thu Sep 12 04:44:36 2013
New Revision: 1522384

URL: http://svn.apache.org/r1522384
Log:
fixed issue#64, add attachments region in message content view

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
Thu Sep 12 04:44:36 2013
@@ -23,6 +23,9 @@ package org.apache.hupa.client.activity;
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#64, add attachments region in message content view
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -184,6 +187,7 @@ import org.apache.hupa.client.ui.WidgetD
 import org.apache.hupa.shared.domain.GetMessageDetailsAction;
 import org.apache.hupa.shared.domain.GetMessageDetailsResult;
 import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.MessageAttachment;
 
 import com.google.gwt.activity.shared.Activity;
 import com.google.gwt.event.shared.EventBus;
@@ -194,8 +198,7 @@ import com.google.web.bindery.requestfac
 
 public class MessageContentActivity extends AppBaseActivity {
 
-	private static final Logger log = Logger
-			.getLogger(MessageContentActivity.class.getName());
+	private static final Logger log = Logger.getLogger(MessageContentActivity.class.getName());
 
 	@Inject private Displayable display;
 	private String fullName;
@@ -204,10 +207,8 @@ public class MessageContentActivity exte
 	@Override
 	public void start(AcceptsOneWidget container, EventBus eventBus) {
 		if (isUidSet()) {
-			GetMessageDetailsRequest req = rf
-					.messageDetailsRequest();
-			GetMessageDetailsAction action = req
-					.create(GetMessageDetailsAction.class);
+			GetMessageDetailsRequest req = rf.messageDetailsRequest();
+			GetMessageDetailsAction action = req.create(GetMessageDetailsAction.class);
 			final ImapFolder f = req.create(ImapFolder.class);
 			f.setFullName(fullName);
 			action.setFolder(f);
@@ -215,8 +216,8 @@ public class MessageContentActivity exte
 			req.get(action).fire(new Receiver<GetMessageDetailsResult>() {
 				@Override
 				public void onSuccess(GetMessageDetailsResult response) {
-					display.fillMessageContent(response.getMessageDetails()
-							.getText());
+					display.fillMessageContent(response.getMessageDetails().getText());
+					display.setAttachments(response.getMessageDetails().getMessageAttachments(), fullName,
Long.parseLong(uid));
 				}
 
 				@Override
@@ -224,7 +225,7 @@ public class MessageContentActivity exte
 					if (error.isFatal()) {
 						log.log(Level.SEVERE, error.getMessage());
 						// TODO write the error message to status bar.
-						 throw new RuntimeException(error.getMessage());
+						throw new RuntimeException(error.getMessage());
 					}
 				}
 			});
@@ -250,10 +251,11 @@ public class MessageContentActivity exte
 >>>>>>> make reload message content work, use the same place with folder
list, while separated with slash, that looks like Gmail's
 	public interface Displayable extends WidgetDisplayable {
 		void fillMessageContent(String messageContent);
+		void setAttachments(List<MessageAttachment> attachements, String folder, long uid);
 	}
 
 	public Activity with(TokenWrapper tokenWrapper) {
-		fullName= tokenWrapper.getFolder();
+		fullName = tokenWrapper.getFolder();
 		uid = tokenWrapper.getUid();
 		return this;
 	}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
Thu Sep 12 04:44:36 2013
@@ -23,6 +23,7 @@ package org.apache.hupa.client.ui;
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 import java.util.List;
 
 import org.apache.hupa.client.HupaCSS;
@@ -65,10 +66,18 @@ public class MessageContentView extends 
 	@Inject
 =======
 =======
+=======
+import java.util.List;
+
+import org.apache.hupa.client.HupaCSS;
+>>>>>>> fixed issue#64, add attachments region in message content view
 import org.apache.hupa.client.activity.MessageContentActivity;
+import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.shared.domain.MessageAttachment;
 
 >>>>>>> integrate all of the views to their corresponding activities
and mappers
 import com.google.gwt.core.client.GWT;
+<<<<<<< HEAD
 =======
 import java.util.List;
 
@@ -86,11 +95,23 @@ import com.google.gwt.event.dom.client.H
 >>>>>>> prepare for message content panel
 =======
 >>>>>>> make message content work as expected partly
+=======
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+>>>>>>> fixed issue#64, add attachments region in message content view
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Anchor;
 import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.RootPanel;
 import com.google.inject.Inject;
 
 <<<<<<< HEAD
@@ -247,8 +268,9 @@ public class MessageContentView extends 
 public class MessageContentView extends Composite implements MessageContentActivity.Displayable
{
 >>>>>>> make message content work as expected partly
 
-	@UiField
-	HTML messageContent;
+	@UiField HTML messageContent;
+
+	@UiField FlowPanel attachments;
 
 <<<<<<< HEAD
 >>>>>>> prepare for message content panel
@@ -263,6 +285,7 @@ public class MessageContentView extends 
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 	@Override
 	public void fillMessageContent(String messageDetail) {
 		messageContentHTML.setHTML(messageDetail);
@@ -351,6 +374,9 @@ public class MessageContentView extends 
 =======
 	interface MessageContentUiBinder extends UiBinder<SimplePanel, MessageContentView>
{
 >>>>>>> beautify message list and content
+=======
+	interface MessageContentUiBinder extends UiBinder<DockLayoutPanel, MessageContentView>
{
+>>>>>>> fixed issue#64, add attachments region in message content view
 	}
 
 	private static MessageContentUiBinder binder = GWT.create(MessageContentUiBinder.class);
@@ -360,5 +386,46 @@ public class MessageContentView extends 
 		messageContent.setHTML(messageDetail);
 	}
 
+<<<<<<< HEAD
 >>>>>>> make login page as one part of the overall layout & splite
layout to little one
+=======
+	@Override
+	public void setAttachments(List<MessageAttachment> attachements, final String folder,
final long uid) {
+
+		attachments.clear();
+		final Element downloadIframe = RootPanel.get("__download").getElement();
+		if (attachements != null) {
+			for (final MessageAttachment messageAttachment : attachements) {
+				Label link = new Label(messageAttachment.getName() + " (" + messageAttachment.getSize()
/ 1024 + "kB)");
+				link.setStyleName(HupaCSS.C_hyperlink);
+				link.addClickHandler(new ClickHandler() {
+					public void onClick(ClickEvent event) {
+						String url = getUrl(messageAttachment, folder, uid, false);
+						if (downloadIframe == null)
+							Window.open(url, "_blank", "");
+						else
+							DOM.setElementAttribute(RootPanel.get("__download").getElement(), "src", url);
+					}
+				});
+				HorizontalPanel aPanel = new HorizontalPanel();
+				aPanel.addStyleName(HupaCSS.C_attachment);
+				// aPanel.add(new Image(imageBundle.attachmentIcon()));
+				aPanel.add(link);
+				if (messageAttachment.isImage()) {
+					Anchor viewImageLink = new Anchor("View", getUrl(messageAttachment, folder, uid, true),
"_blank");
+					viewImageLink.setStyleName(HupaCSS.C_attachment_view);
+					aPanel.add(viewImageLink);
+				}
+				attachments.add(aPanel);
+			}
+		}
+	}
+
+	private String getUrl(MessageAttachment messageAttachment, String folder, long uid, boolean
inline) {
+		return GWT.getModuleBaseURL() + SConsts.SERVLET_DOWNLOAD + "?" + SConsts.PARAM_NAME + "="
+				+ messageAttachment.getName() + "&" + SConsts.PARAM_FOLDER + "=" + folder + "&"
+ SConsts.PARAM_UID
+				+ "=" + uid + (inline ? "&" + SConsts.PARAM_MODE + "=inline" : "");
+	}
+
+>>>>>>> fixed issue#64, add attachments region in message content view
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
Thu Sep 12 04:44:36 2013
@@ -23,6 +23,9 @@
 			display: block;
 			background-color: white;
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#64, add attachments region in message content view
 			width: 100%;
 			height: 100%;
 		}
@@ -54,6 +57,7 @@
 			min-height: 200px;
 			background: #f0f0f0;
 			padding: 8px;
+<<<<<<< HEAD
 		}
 		
 		.moreHeaders {
@@ -120,4 +124,25 @@
 		<g:HTML ui:field="messageContent" />
 	</g:SimplePanel>
 >>>>>>> beautify message list and content
+=======
+		}
+	</ui:style>
+	<g:DockLayoutPanel unit="PX">
+		<g:north size="56">
+			<g:HTMLPanel addStyleNames="{style.previewheader} {style.messageheader}">
+			</g:HTMLPanel>
+		</g:north>
+		<g:center>
+			<g:DockLayoutPanel unit="PX">
+				<g:center>
+					<g:HTML ui:field="messageContent" addStyleNames="{style.messageContent}" />
+				</g:center>
+				<g:east size="216">
+					<g:FlowPanel ui:field="attachments" addStyleNames="{style.attachBox}">
+					</g:FlowPanel>
+				</g:east>
+			</g:DockLayoutPanel>
+		</g:center>
+	</g:DockLayoutPanel>
+>>>>>>> fixed issue#64, add attachments region in message content view
 </ui:UiBinder>
\ No newline at end of file

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java Thu
Sep 12 04:44:36 2013
@@ -104,7 +104,7 @@ import com.google.inject.Inject;
 
 public class MessageListView extends Composite implements MessageListActivity.Displayable
{
 
-	@UiField SimplePanel thisView;
+	@UiField SimpleLayoutPanel thisView;
 	private MessagesCellTable grid;
 
 	@Inject

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.java?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.java Thu
Sep 12 04:44:36 2013
@@ -38,7 +38,7 @@ public class __ContentPanel extends Comp
 	@UiField DockLayoutPanel messageListBox;
 	@UiField SimpleLayoutPanel messageListContainer;
 	@UiField SimplePanel messageListFooterContainer;
-	@UiField ScrollPanel messageContentContainer;
+	@UiField SimpleLayoutPanel messageContentContainer;
 	@UiField SimplePanel statusContainer;
 
 	@UiField HTMLPanel contactBox;

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml?rev=1522384&r1=1522383&r2=1522384&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml
Thu Sep 12 04:44:36 2013
@@ -87,7 +87,7 @@
 			<g:DockLayoutPanel unit="PX" addStyleNames="{style.box}"
 				ui:field="messageContentBox">
 				<g:center>
-					<g:ScrollPanel ui:field="messageContentContainer"
+					<g:SimpleLayoutPanel ui:field="messageContentContainer"
 						addStyleNames="{style.messageContentWorkAround}" />
 				</g:center>
 				<g:south size="25">



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message