You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2014/03/02 13:12:27 UTC
svn commit: r1573291 [3/8] - in /james/hupa/trunk: ./ client/
client/src/main/java/org/apache/hupa/
client/src/main/java/org/apache/hupa/client/
client/src/main/java/org/apache/hupa/client/activity/
client/src/main/java/org/apache/hupa/client/ioc/ clie...
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml Sun Mar 2 12:12:22 2014
@@ -12,6 +12,7 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:image field="buttons" src="res/buttons.png" />
+
<ui:style type="org.apache.hupa.client.ui.ComposeView.Style">
.box {
border: 1px solid #A3A3A3;
@@ -46,7 +47,7 @@
padding: 3px 8px;
}
- .header td textarea,.header td input {
+ .header td textarea,.header td input[type="text"] {
width: 100%;
height: 13px;
resize: none;
@@ -166,6 +167,13 @@
padding-left: 8px;
border-top: 1px solid #ddd;
border-radius: 0 0 4px 4px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ @external .gwt-RichTextToolbar;
+ .gwt-RichTextToolbar,.statusbar {
background: #eaeaea;
background: -moz-linear-gradient(top, #eaeaea 0%, #c8c8c8 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eaeaea),
@@ -173,53 +181,109 @@
background: -o-linear-gradient(top, #eaeaea 0%, #c8c8c8 100%);
background: -ms-linear-gradient(top, #eaeaea 0%, #c8c8c8 100%);
background: linear-gradient(top, #eaeaea 0%, #c8c8c8 100%);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
}
- .uploader{
-
-}
-.uploaderCancel{}
-.uploaderFilename{}
+ .uploader {
+
+ }
+
+ .uploaderCancel {
+
+ }
+
+ .uploaderFilename {
+
+ }
+
+ .attachButton {
+ width: 130px;
+ height: 27px;
+ outline: none;
+ }
+
+ @sprite .attachImage {
+ gwt-image: 'buttons';
+ background-position: -7px -353px;
+ width: 26px;
+ }
+
+ @sprite .attachClip {
+ gwt-image: 'buttons';
+ background-position: center -890px;
+ width: 24px;
+ margin-left: 6px;
+ margin-top: -4px;
+ }
+
+ .attachImage,.attachText {
+ height: 27px;
+ cursor: pointer;
+ color: blue;
+ float: left;
+ padding-top: 7px;
+ }
+
+ .attachClip,.attachClipText {
+ height: 27px;
+ cursor: pointer;
+ float: left;
+ padding-top: 7px;
+ }
</ui:style>
- <g:DockLayoutPanel ui:field="thisPanel" unit="PX"
- addStyleNames="{style.box}">
- <g:north size="135">
+
+ <g:SplitLayoutPanel ui:field="thisPanel">
+ <g:north size="150">
<g:SimplePanel ui:field="header" addStyleNames="{style.header}">
<g:FlexTable ui:field="headerTable" addStyleNames="{style.headerTable}" />
</g:SimplePanel>
</g:north>
<g:center>
- <g:SimpleLayoutPanel ui:field="composeContentContainer">
- <g:DockLayoutPanel unit="PX">
- <g:north size="23">
- <g:HTMLPanel addStyleNames="{style.composeoptionsbox}">composeOption</g:HTMLPanel>
- </g:north>
- <g:east size="257">
- <g:FlowPanel ui:field="attach" addStyleNames="{style.composeattachments}">
- </g:FlowPanel>
- </g:east>
- <g:center>
- <g:DockLayoutPanel>
- <g:north size="23">
- <g:SimplePanel ui:field="editorToolBar" />
- </g:north>
- <g:center>
- <g:SimplePanel ui:field="composeEditor"
- addStyleNames="{style.composebodycontainer}" />
- </g:center>
- </g:DockLayoutPanel>
- </g:center>
- </g:DockLayoutPanel>
- </g:SimpleLayoutPanel>
+ <g:DockLayoutPanel unit="PX" addStyleNames="{style.box}">
+ <!-- <g:north size="23"> -->
+ <!-- <g:HTMLPanel addStyleNames="{style.composeoptionsbox}">composeOption</g:HTMLPanel> -->
+ <!-- </g:north> -->
+ <g:east size="257">
+ <g:DockLayoutPanel>
+ <g:north size="25">
+ <g:HTMLPanel addStyleNames="{style.statusbar}">
+ <div class="{style.attachClip}" />
+ <div class="{style.attachClipText}">Attachments</div>
+ </g:HTMLPanel>
+ </g:north>
+ <g:center>
+ <g:FlowPanel ui:field="attach" addStyleNames="{style.composeattachments}">
+ <g:VerticalPanel>
+ <g:FocusPanel ui:field="attachButton"
+ addStyleNames="{style.attachButton}">
+ <g:HTMLPanel>
+ <div class="{style.attachImage}" />
+ <div class="{style.attachText}">Attach a File ...</div>
+ </g:HTMLPanel>
+ </g:FocusPanel>
+ </g:VerticalPanel>
+ </g:FlowPanel>
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:east>
+ <g:center>
+ <g:DockLayoutPanel>
+ <g:north size="23">
+ <g:SimplePanel ui:field="editorToolBar" />
+ </g:north>
+ <g:center>
+ <g:SimplePanel ui:field="composeEditor"
+ addStyleNames="{style.composebodycontainer}" />
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:center>
+ <g:south size="28">
+ <g:SimplePanel ui:field="composeStatusContainer"
+ addStyleNames="{style.mailviewbottom} {style.box}">
+ <g:HTMLPanel addStyleNames="{style.statusbar}"></g:HTMLPanel>
+ </g:SimplePanel>
+ </g:south>
+ </g:DockLayoutPanel>
</g:center>
- <g:south size="28">
- <g:SimplePanel ui:field="composeStatusContainer"
- addStyleNames="{style.mailviewbottom}{style.box}">
- <g:HTMLPanel addStyleNames="{style.statusbar}">composeStatus</g:HTMLPanel>
- </g:SimplePanel>
- </g:south>
- </g:DockLayoutPanel>
-</ui:UiBinder>
\ No newline at end of file
+
+ </g:SplitLayoutPanel>
+</ui:UiBinder>
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java Sun Mar 2 12:12:22 2014
@@ -27,12 +27,14 @@ import org.apache.hupa.client.activity.F
import org.apache.hupa.client.activity.MessageListActivity;
import org.apache.hupa.client.activity.ToolBarActivity;
import org.apache.hupa.client.place.FolderPlace;
-import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.client.storage.HupaStorage;
import org.apache.hupa.shared.domain.ImapFolder;
import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.core.client.Duration;
import com.google.gwt.core.client.GWT;
import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.query.client.Function;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@@ -47,8 +49,6 @@ import com.google.gwt.view.client.Provid
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
import com.google.inject.Inject;
-import com.google.web.bindery.requestfactory.shared.Receiver;
-import com.google.web.bindery.requestfactory.shared.ServerFailure;
public class FolderListView extends Composite implements FolderListActivity.Displayable {
@UiField SimplePanel thisView;
@@ -56,6 +56,8 @@ public class FolderListView extends Comp
@Inject private ToolBarActivity.Displayable toolBar;
@Inject private MessageListActivity.Displayable msgListDisplay;
@Inject private PlaceController placeController;
+ @Inject private HupaStorage hupaStorage;
+
private CellList<LabelNode> cellList;
private ShowMorePagerPanel pagerPanel;
@@ -73,12 +75,19 @@ public class FolderListView extends Comp
return item == null ? null : item.getPath();
}
};
+
+ protected void onAttach() {
+ super.onAttach();
+ // Delay getting data until the widget has been attached, to use injected objects.
+ if (data.getDataDisplays().size() == 0) {
+ data.addDataDisplay(cellList);
+ }
+ };
- @Inject
- public FolderListView(final HupaRequestFactory rf) {
+ public FolderListView() {
initWidget(binder.createAndBindUi(this));
- data = new ImapLabelListDataProvider(rf);
+ data = new ImapLabelListDataProvider();
pagerPanel = new ShowMorePagerPanel();
cellList = new CellList<LabelNode>(new FolderCell(), Resources.INSTANCE, KEY_PROVIDER);
cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
@@ -93,7 +102,6 @@ public class FolderListView extends Comp
msgListDisplay.refresh();
}
});
- data.addDataDisplay(cellList);
pagerPanel.setDisplay(cellList);
thisView.setWidget(pagerPanel);
}
@@ -119,14 +127,14 @@ public class FolderListView extends Comp
@Override
public void render(Context context, LabelNode value, SafeHtmlBuilder sb) {
if (value != null) {
- if (value.getFolder().getUnseenMessageCount() > 0) {
- sb.appendHtmlConstant("<span style='right:6px;top:3px;font-weight:bold;'>");
- sb.appendHtmlConstant(value.getNameForDisplay());
- sb.appendHtmlConstant(" (" + value.getFolder().getUnseenMessageCount());
- sb.appendHtmlConstant(")</span>");
- } else {
+// if (value.getFolder().getUnseenMessageCount() > 0) {
+// sb.appendHtmlConstant("<span style='right:6px;top:3px;font-weight:bold;'>");
+// sb.appendHtmlConstant(value.getNameForDisplay());
+// sb.appendHtmlConstant(" (" + value.getFolder().getUnseenMessageCount());
+// sb.appendHtmlConstant(")</span>");
+// } else {
sb.appendHtmlConstant(value.getNameForDisplay());
- }
+// }
}
}
}
@@ -135,7 +143,6 @@ public class FolderListView extends Comp
public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements HasRefresh {
- private HupaRequestFactory rf;
private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
HasData<LabelNode> display;
@@ -143,69 +150,59 @@ public class FolderListView extends Comp
return folderNodes;
}
- public ImapLabelListDataProvider(HupaRequestFactory rf) {
- this.rf = rf;
- }
-
@Override
public void addDataDisplay(HasData<LabelNode> display) {
super.addDataDisplay(display);
this.display = display;
}
-
- @Override
- protected void onRangeChanged(HasData<LabelNode> display) {
-
- final int start = display.getVisibleRange().getStart();
-
- rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>() {
-
- private String INTENTS = " ";
-
- @Override
- public void onSuccess(List<ImapFolder> response) {
- folderNodes.clear();
- if (response == null || response.size() == 0) {
- updateRowCount(-1, true);
- } else {
- for (ImapFolder folder : response) {
- fillCellList(folderNodes, folder, LabelNode.ROOT, "");
- }
- updateRowData(start, folderNodes);
- }
- }
-
- private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent,
- String intents) {
- LabelNode labelNode = new LabelNode();
- labelNode.setFolder(curFolder);
- labelNode.setName(curFolder.getName());
- labelNode.setNameForDisplay(intents + curFolder.getName());
- labelNode.setParent(parent);
- labelNode.setPath(curFolder.getFullName());
- folderNodes.add(labelNode);
- if (curFolder.getHasChildren()) {
- for (ImapFolder subFolder : curFolder.getChildren()) {
- fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
- }
- }
- }
-
- @Override
- public void onFailure(ServerFailure error) {
- if (error.isFatal()) {
- throw new RuntimeException(error.getMessage());
- }
- }
-
- });
- }
-
- @Override
- public void refresh() {
- this.onRangeChanged(display);
- }
+
+ protected void onRangeChanged(HasData<LabelNode> display) {
+ onRangeChanged(display, false);
+ }
+
+ protected void onRangeChanged(HasData<LabelNode> display, boolean skipCache) {
+ hupaStorage
+ .gettingFolders(skipCache)
+ .done(new Function(){public void f() {
+ List<ImapFolder> response = arguments(0);
+ folderNodes.clear();
+ for (ImapFolder folder : response) {
+ fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+ }
+ // For some reason removing a row does not update the display correctly
+ updateRowCount(folderNodes.size(), true);
+ updateRowData(0, folderNodes);
+ }});
+ }
+
+ private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent, String intents) {
+ LabelNode labelNode = new LabelNode();
+ labelNode.setFolder(curFolder);
+ labelNode.setName(curFolder.getName());
+ labelNode.setNameForDisplay(intents + curFolder.getName());
+ labelNode.setParent(parent);
+ labelNode.setPath(curFolder.getFullName());
+ folderNodes.add(labelNode);
+ if (curFolder.getHasChildren()) {
+ for (ImapFolder subFolder : curFolder.getChildren()) {
+ // FIXME: don't use intents, it will be much better user experience to use cellTree
+ fillCellList(folderNodes, subFolder, labelNode, intents + " ");
+ }
+ }
+ }
+
+ Double last = 0d;
+ @Override
+ public void refresh(){
+ Double now = Duration.currentTimeMillis();
+ if (now - last > 1 * 60 * 1000) {
+ this.onRangeChanged(display, true);
+ last = now;
+ }
+ }
}
+
+
interface FolderListUiBinder extends UiBinder<SimplePanel, FolderListView> {
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java Sun Mar 2 12:12:22 2014
@@ -19,8 +19,10 @@
package org.apache.hupa.client.ui;
+import org.apache.hupa.client.place.SettingPlace;
+
import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.query.client.GQuery;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
@@ -41,23 +43,35 @@ public class HupaLayout implements HupaL
public static final int LAYOUT_CONTACT = 0x04;
public static final int LAYOUT_SETTING = 0x08;
- @UiField SimplePanel topBarContainer;
- @UiField SimplePanel logoContainer;
- @UiField SimplePanel notificationContainer;
- @UiField SimpleLayoutPanel navigationContainer;
- @UiField _ToolPanel toolPanel;
-
- @UiField LayoutPanel mainBox;
-
- @UiField _CenterPanel centerPanel;
- @UiField _CenterComposePanel composePanel;
- @UiField _CenterSettingPanel settingPanel;
- @UiField _CenterContactPanel contactPanel;
+ @UiField public SimplePanel topBarContainer;
+ @UiField public SimplePanel logoContainer;
+ @UiField public SimplePanel notificationContainer;
+ @UiField public SimpleLayoutPanel navigationContainer;
+ @UiField public _ToolPanel toolPanel;
+
+ @UiField public LayoutPanel mainBox;
+
+ @UiField public _CenterPanel centerPanel;
+ @UiField public _CenterComposePanel composePanel;
+ @UiField public _CenterSettingPanel settingPanel;
+ @UiField public _CenterContactPanel contactPanel;
+
+ protected LayoutPanel hupaMainPanel;
+
+ interface HupaLayoutUiBinder extends UiBinder<LayoutPanel, HupaLayout> {
+ }
- private LayoutPanel hupaMainPanel;
+ @SuppressWarnings("rawtypes")
+ protected static UiBinder binder;
+ @SuppressWarnings("unchecked")
public HupaLayout() {
- hupaMainPanel = binder.createAndBindUi(this);
+ initBinder();
+ hupaMainPanel = (LayoutPanel) binder.createAndBindUi(this);
+ }
+
+ protected void initBinder() {
+ binder = GWT.create(HupaLayoutUiBinder.class);
}
@Override
@@ -133,8 +147,8 @@ public class HupaLayout implements HupaL
return centerPanel.getFolderListView();
}
@Override
- public AcceptsOneWidget getContactListView() {
- return composePanel.getContactListView();
+ public AcceptsOneWidget getAddressListView() {
+ return composePanel.getAddressListView();
}
@Override
@@ -166,7 +180,7 @@ public class HupaLayout implements HupaL
public AcceptsOneWidget getSettingNavView() {
return settingPanel.getSettingNavView();
}
-
+
@Override
public AcceptsOneWidget getLabelPropertiesView() {
return settingPanel.getLabelPropertiesView();
@@ -183,36 +197,18 @@ public class HupaLayout implements HupaL
}
private void arrangeLayout(int lyt) {
+ GQuery.console.log("HupaLayout arrangeLayout " + lyt);
toolPanel.toggleTo(lyt);
- showOrHideMessage(lyt);
- showOrHideCompose(lyt);
- showOrHideSetting(lyt);
- showOrHideContact(lyt);
- }
-
- private void showOrHideContact(int lyt) {
- mainBox.setWidgetLeftWidth(contactPanel, 0, Unit.PCT, (lyt & LAYOUT_CONTACT) / LAYOUT_CONTACT * 100, Unit.PCT);
- mainBox.setWidgetTopHeight(contactPanel, 0, Unit.PCT, (lyt & LAYOUT_CONTACT) / LAYOUT_CONTACT * 100, Unit.PCT);
- }
-
- private void showOrHideSetting(int lyt) {
- mainBox.setWidgetLeftWidth(settingPanel, 0, Unit.PCT, (lyt & LAYOUT_SETTING) / LAYOUT_SETTING * 100, Unit.PCT);
- mainBox.setWidgetTopHeight(settingPanel, 0, Unit.PCT, (lyt & LAYOUT_SETTING) / LAYOUT_SETTING * 100, Unit.PCT);
- }
-
- private void showOrHideCompose(int lyt) {
- mainBox.setWidgetLeftWidth(composePanel, 0, Unit.PCT, (lyt & LAYOUT_COMPOSE) / LAYOUT_COMPOSE * 100, Unit.PCT);
- mainBox.setWidgetTopHeight(composePanel, 0, Unit.PCT, (lyt & LAYOUT_COMPOSE) / LAYOUT_COMPOSE * 100, Unit.PCT);
+ mainBox.setWidgetVisible(contactPanel, lyt == LAYOUT_CONTACT);
+ mainBox.setWidgetVisible(settingPanel, lyt == LAYOUT_SETTING);
+ mainBox.setWidgetVisible(composePanel, lyt == LAYOUT_COMPOSE);
+ mainBox.setWidgetVisible(centerPanel, lyt == LAYOUT_MESSAGE);
}
- private void showOrHideMessage(int lyt) {
- mainBox.setWidgetLeftWidth(centerPanel, 0, Unit.PCT, (lyt & LAYOUT_MESSAGE) / LAYOUT_MESSAGE * 100, Unit.PCT);
- mainBox.setWidgetTopHeight(centerPanel, 0, Unit.PCT, (lyt & LAYOUT_MESSAGE) / LAYOUT_MESSAGE * 100, Unit.PCT);
- }
-
- interface HupaLayoutUiBinder extends UiBinder<LayoutPanel, HupaLayout> {
+ @Override
+ public void arrangeSettingLayout(SettingPlace sp) {
+ GQuery.console.log("HupaLayout arrangeSettingLayout " + sp);
+ settingPanel.swithTo(sp);
}
- private static HupaLayoutUiBinder binder = GWT.create(HupaLayoutUiBinder.class);
-
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml Sun Mar 2 12:12:22 2014
@@ -35,7 +35,7 @@
<g:layer>
<g:SimplePanel ui:field="notificationContainer" />
</g:layer>
- <g:layer width="287px" right="0">
+ <g:layer width="171px" right="0">
<g:SimpleLayoutPanel ui:field="navigationContainer" />
</g:layer>
</g:LayoutPanel>
@@ -52,13 +52,13 @@
<g:layer left="0%" width="100%" top="0%" height="100%">
<hupa:_CenterPanel ui:field="centerPanel" />
</g:layer>
- <g:layer left="0%" width="0%" top="0%" height="0%">
+ <g:layer left="0%" width="100%" top="0%" height="100%">
<hupa:_CenterSettingPanel ui:field="settingPanel" />
</g:layer>
- <g:layer left="0%" width="0%" top="0%" height="0%">
+ <g:layer left="0%" width="100%" top="0%" height="100%">
<hupa:_CenterContactPanel ui:field="contactPanel" />
</g:layer>
- <g:layer left="0%" width="0%" top="0%" height="0%">
+ <g:layer left="0%" width="100%" top="0%" height="100%">
<hupa:_CenterComposePanel ui:field="composePanel" />
</g:layer>
</g:LayoutPanel>
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java Sun Mar 2 12:12:22 2014
@@ -19,6 +19,8 @@
package org.apache.hupa.client.ui;
+import org.apache.hupa.client.place.SettingPlace;
+
import com.google.gwt.user.client.ui.AcceptsOneWidget;
public interface HupaLayoutable extends Layoutable {
@@ -47,7 +49,7 @@ public interface HupaLayoutable extends
AcceptsOneWidget getNotificationView();
AcceptsOneWidget getLabelListView();
- AcceptsOneWidget getContactListView();
+ AcceptsOneWidget getAddressListView();
AcceptsOneWidget getLabelPropertiesView();
@@ -60,4 +62,6 @@ public interface HupaLayoutable extends
AcceptsOneWidget getSearchBoxView();
AcceptsOneWidget getSettingNavView();
+
+ void arrangeSettingLayout(SettingPlace sp);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaPlugins.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaPlugins.java?rev=1573291&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaPlugins.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaPlugins.java Sun Mar 2 12:12:22 2014
@@ -0,0 +1,12 @@
+package org.apache.hupa.client.ui;
+
+public interface HupaPlugins {
+
+ public static class HupaDefaultPlugins implements HupaPlugins {
+
+ }
+
+
+
+
+}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java Sun Mar 2 12:12:22 2014
@@ -25,11 +25,13 @@ import java.util.List;
import org.apache.hupa.client.activity.LabelListActivity;
import org.apache.hupa.client.activity.LabelPropertiesActivity;
import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.client.storage.HupaStorage;
import org.apache.hupa.shared.domain.ImapFolder;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.query.client.Function;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
@@ -44,16 +46,16 @@ import com.google.gwt.view.client.Provid
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
import com.google.inject.Inject;
-import com.google.web.bindery.requestfactory.shared.Receiver;
-import com.google.web.bindery.requestfactory.shared.ServerFailure;
public class LabelListView extends Composite implements LabelListActivity.Displayable {
@Inject LabelPropertiesActivity.Displayable labelProperties;
+ @Inject private HupaStorage hupaStorage;
@UiField ScrollPanel thisView;
@UiField Button add;
@UiField Button delete;
+ private CellList<LabelNode> cellList;
public interface Resources extends CellList.Resources {
@@ -68,12 +70,20 @@ public class LabelListView extends Compo
}
private final ImapLabelListDataProvider data;
+
+ protected void onAttach() {
+ super.onAttach();
+ // Delay getting data until the widget has been attached, to use injected objects.
+ if (data.getDataDisplays().size() == 0) {
+ data.addDataDisplay(cellList);
+ }
+ };
@Inject
public LabelListView(final HupaRequestFactory rf) {
initWidget(binder.createAndBindUi(this));
- data = new ImapLabelListDataProvider(rf);
- CellList<LabelNode> cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
+ data = new ImapLabelListDataProvider();
+ cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
cellList.setPageSize(100);// assume one's labels are under one hundred, otherwise we need a pager
cellList.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@@ -81,7 +91,6 @@ public class LabelListView extends Compo
labelProperties.cascade(selectionModel.getSelectedObject(), data.getDataList(), CASCADE_TYPE_RENAME);
}
});
- data.addDataDisplay(cellList);
thisView.setWidget(cellList);
}
@@ -98,84 +107,60 @@ public class LabelListView extends Compo
}
});
- public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements HasRefresh {
-
- private HupaRequestFactory rf;
- private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
- HasData<LabelNode> display;
-
- public List<LabelNode> getDataList() {
- return folderNodes;
- }
-
- public ImapLabelListDataProvider(HupaRequestFactory rf) {
- this.rf = rf;
- }
-
- @Override
- public void addDataDisplay(HasData<LabelNode> display) {
- super.addDataDisplay(display);
- this.display = display;
- }
-
- @Override
- protected void onRangeChanged(HasData<LabelNode> display) {
-
- final int start = display.getVisibleRange().getStart();
-
- rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>() {
-
- private String INTENTS = " ";
-
- @Override
- public void onSuccess(List<ImapFolder> response) {
- folderNodes.clear();
- if (response == null || response.size() == 0) {
- updateRowCount(-1, true);
- } else {
- for (ImapFolder folder : response) {
- fillCellList(folderNodes, folder, LabelNode.ROOT, "");
- }
- updateRowData(start, folderNodes);
- }
- }
-
- private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent,
- String intents) {
- LabelNode labelNode = new LabelNode();
- labelNode.setFolder(curFolder);
- labelNode.setName(curFolder.getName());
- labelNode.setNameForDisplay(intents + curFolder.getName());
- labelNode.setParent(parent);
- labelNode.setPath(curFolder.getFullName());
- folderNodes.add(labelNode);
- if("inbox".equalsIgnoreCase(curFolder.getName())){
- if(selectionModel.getSelectedObject() == null){
- selectionModel.setSelected(labelNode, true);
- }
- }
- if (curFolder.getHasChildren()) {
- for (ImapFolder subFolder : curFolder.getChildren()) {
- fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
- }
- }
- }
-
- @Override
- public void onFailure(ServerFailure error) {
- if (error.isFatal()) {
- throw new RuntimeException(error.getMessage());
- }
- }
-
- });
- }
-
- @Override
- public void refresh() {
- this.onRangeChanged(display);
- }
- }
+ // FIXME: almost the code in this class is identical to FolderListView, duplicated code in GWT is bad
+ // because explodes js size !!!
+ public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements HasRefresh {
+
+ private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
+ HasData<LabelNode> display;
+
+ public List<LabelNode> getDataList() {
+ return folderNodes;
+ }
+
+ @Override
+ public void addDataDisplay(HasData<LabelNode> display) {
+ super.addDataDisplay(display);
+ this.display = display;
+ }
+
+ @Override
+ protected void onRangeChanged(HasData<LabelNode> display) {
+ hupaStorage
+ .gettingFolders()
+ .done(new Function(){public void f() {
+ List<ImapFolder> response = arguments(0);
+ folderNodes.clear();
+ for (ImapFolder folder : response) {
+ fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+ }
+ // For some reason removing a row does not update the display correctly
+ updateRowCount(folderNodes.size(), true);
+ updateRowData(0, folderNodes);
+ }});
+ }
+
+ private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent, String intents) {
+ LabelNode labelNode = new LabelNode();
+ labelNode.setFolder(curFolder);
+ labelNode.setName(curFolder.getName());
+ labelNode.setNameForDisplay(intents + curFolder.getName());
+ labelNode.setParent(parent);
+ labelNode.setPath(curFolder.getFullName());
+ folderNodes.add(labelNode);
+ if (curFolder.getHasChildren()) {
+ for (ImapFolder subFolder : curFolder.getChildren()) {
+ // FIXME: don't use intents, it will be much better user experience to use cellTree
+ fillCellList(folderNodes, subFolder, labelNode, intents + " ");
+ }
+ }
+ }
+
+ @Override
+ public void refresh() {
+ this.onRangeChanged(display);
+ }
+ }
interface LabelListUiBinder extends UiBinder<DockLayoutPanel, LabelListView> {
}
@@ -194,6 +179,8 @@ public class LabelListView extends Compo
@Override
public void refresh() {
+ System.out.println("REFRESH");
+ hupaStorage.expireFolders();
data.refresh();
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java Sun Mar 2 12:12:22 2014
@@ -43,8 +43,8 @@ import com.google.gwt.uibinder.client.Ui
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.inject.Inject;
@@ -110,7 +110,7 @@ public class LabelPropertiesView extends
public void onSuccess(GenericResult response) {
hc.hideTopLoading();
eventBus.fireEvent(new RefreshLabelListEvent());
- hc.showNotice("The label \"" + f.getName() + "\" was created.", 10000);
+ hc.showNotice("The label \"" + f.getFullName() + "\" was created.", 10000);
}
@Override
public void onFailure(ServerFailure error) {
@@ -125,7 +125,7 @@ public class LabelPropertiesView extends
initWidget(binder.createAndBindUi(this));
}
- interface Binder extends UiBinder<DecoratorPanel, LabelPropertiesView> {
+ interface Binder extends UiBinder<ScrollPanel, LabelPropertiesView> {
}
private static Binder binder = GWT.create(Binder.class);
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml Sun Mar 2 12:12:22 2014
@@ -59,34 +59,35 @@
border: 0;
}
</ui:style>
- <g:DecoratorPanel addStyleNames="{style.propform}">
- <g:CaptionPanel captionText="Properties">
- <g:VerticalPanel ui:field="propContainer">
- <g:CaptionPanel captionText="Location">
- <g:VerticalPanel addStyleNames="{style.attribute}">
- <g:HorizontalPanel addStyleNames="{style.noBorder}">
- <g:Label>
- <ui:msg key='folderName'>Folder Name:</ui:msg>
- </g:Label>
- <g:TextBox ui:field='name' name="_name" />
- </g:HorizontalPanel>
- <g:HorizontalPanel addStyleNames="{style.noBorder}">
- <g:Label>
- <ui:msg key='parentFolder'>Parent Folder:</ui:msg>
- </g:Label>
- <g:ListBox ui:field='parent'>
- <g:item value="1">---</g:item>
- </g:ListBox>
- </g:HorizontalPanel>
- </g:VerticalPanel>
- </g:CaptionPanel>
- <g:CaptionPanel ui:field="information" captionText="Information">
- <g:VerticalPanel addStyleNames="{style.attribute}">
- </g:VerticalPanel>
- </g:CaptionPanel>
- <g:Button ui:field="save">Save</g:Button>
- </g:VerticalPanel>
- </g:CaptionPanel>
- </g:DecoratorPanel>
-
+ <g:ScrollPanel>
+ <g:DecoratorPanel addStyleNames="{style.propform}">
+ <g:CaptionPanel captionText="">
+ <g:VerticalPanel ui:field="propContainer">
+ <g:CaptionPanel captionText="Location">
+ <g:VerticalPanel addStyleNames="{style.attribute}">
+ <g:HorizontalPanel addStyleNames="{style.noBorder}">
+ <g:Label>
+ <ui:msg key='folderName'>Folder Name:</ui:msg>
+ </g:Label>
+ <g:TextBox ui:field='name' name="_name" />
+ </g:HorizontalPanel>
+ <g:HorizontalPanel addStyleNames="{style.noBorder}">
+ <g:Label>
+ <ui:msg key='parentFolder'>Parent Folder:</ui:msg>
+ </g:Label>
+ <g:ListBox ui:field='parent'>
+ <g:item value="1">---</g:item>
+ </g:ListBox>
+ </g:HorizontalPanel>
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ <g:CaptionPanel ui:field="information" captionText="Information">
+ <g:VerticalPanel addStyleNames="{style.attribute}">
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ <g:Button ui:field="save">Save</g:Button>
+ </g:VerticalPanel>
+ </g:CaptionPanel>
+ </g:DecoratorPanel>
+ </g:ScrollPanel>
</ui:UiBinder>
\ No newline at end of file
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java Sun Mar 2 12:12:22 2014
@@ -20,220 +20,194 @@
package org.apache.hupa.client.ui;
import org.apache.hupa.client.activity.LoginActivity;
+import org.apache.hupa.shared.domain.Settings;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ClickEvent;
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.resources.client.ClientBundle;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.resources.client.CssResource.NotStrict;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasValue;
-import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
-import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.SubmitButton;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-public class LoginView extends Composite implements KeyUpHandler,
- LoginActivity.Displayable {
-
- /*
- * invoke style lived in ui.xml should use this unique name, otherwise
- * define by ourselves
- */
- public interface Style extends CssResource {
- String loading();
-
- String hidden();
-
- String display();
- }
-
- @UiField Style style;
- @UiField FlowPanel mainContainer;
- @UiField FlowPanel innerBox;
- @UiField Button loginButton;
- @UiField FlexTable flexTable;
- @UiField FlowPanel boxBottom;
- @UiField FlowPanel messageBox;
- @UiField FlowPanel bottomLine;
- @UiField FormPanel formPanel;
- @UiField HTMLPanel message;
- Resources.Css css = Resources.INSTANCE.stylesheet();
- private SubmitButton submitButton;
- PPanel buttonBar = new PPanel();
-
- /*
- * We wrap login/password boxes with a form which must be in the html
- * document, in this way, the browser knows that we are sending a login form
- * and offers the save password dialog to the user
- */
- private TextBox usernameTextBox = TextBox.wrap(DOM.getElementById("email"));
- private PasswordTextBox passwordTextBox = PasswordTextBox.wrap(DOM
- .getElementById("password"));
-
- public interface Resources extends ClientBundle {
-
- Resources INSTANCE = GWT.create(Resources.class);
-
- @NotStrict
- @Source("res/CssLoginView.css")
- public Css stylesheet();
-
- public interface Css extends CssResource {
- String loginForm();
-
- String boxInner();
-
- String tdTitle();
-
- String tdInput();
-
- String pFormbuttons();
-
- String submitButton();
-
- String boxBottom();
-
- String messageBox();
-
- String bottomLine();
- }
- }
-
- @Inject
- public LoginView() {
- initWidget(binder.createAndBindUi(this));
- mainContainer.addStyleName(css.loginForm());
- innerBox.addStyleName(css.boxInner());
- formPanel = FormPanel.wrap(DOM.getElementById("loginForm"), true);
- submitButton = new SubmitButton("Login");
- submitButton.setStyleName(css.submitButton());
- bottomLine.addStyleName(css.bottomLine());
- buttonBar.add(submitButton);
- buttonBar.addStyleName(css.pFormbuttons());
- createLoginPrompt();
- flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
- flexTable.setWidget(2, 0, buttonBar);
-
- formPanel.add(flexTable);
- innerBox.add(formPanel);
-
- usernameTextBox.addKeyUpHandler(this);
- usernameTextBox.setFocus(true);
- passwordTextBox.addKeyUpHandler(this);
-
- /*
- * The user submits the form so as the browser detect it and displays
- * the save password dialog. Then we click on the hidden loginButton
- * which stores the presenter clickHandler.
- */
- formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
- public void onSubmit(SubmitEvent event) {
- if (!usernameTextBox.getValue().trim().isEmpty()
- && !passwordTextBox.getValue().trim().isEmpty()) {
- loginButton.click();
- }
- // event.cancel();
- }
- });
- innerBox.add(loginButton);
- loginButton.setVisible(false);
- setLoading(false);
- }
-
- private void createLoginPrompt() {
- Label userNameLabel = new Label("username");
- Label passWordLabel = new Label("password");
- userNameLabel.addStyleName(css.tdTitle());
- passWordLabel.addStyleName(css.tdTitle());
- flexTable.setWidget(0, 0, userNameLabel);
- flexTable.setWidget(0, 1, usernameTextBox);
- flexTable.setWidget(1, 0, passWordLabel);
- flexTable.setWidget(1, 1, passwordTextBox);
- flexTable.getCellFormatter().addStyleName(0, 0, css.tdTitle());
- flexTable.getCellFormatter().addStyleName(1, 0, css.tdTitle());
- flexTable.getCellFormatter().addStyleName(0, 1, css.tdInput());
- flexTable.getCellFormatter().addStyleName(1, 1, css.tdInput());
- }
-
- public class PPanel extends SimplePanel {
- public PPanel() {
- super(Document.get().createPElement());
- }
- }
-
- @Override
- public void onKeyUp(KeyUpEvent event) {
- if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- if (event.getSource().equals(usernameTextBox)) {
- passwordTextBox.setFocus(true);
- } else if (event.getSource().equals(passwordTextBox)) {
- submitButton.click();
- // formPanel.submit();
- }
- }
-
- }
-
- @Override
- public HasClickHandlers getLoginClick() {
- return loginButton;
- }
-
- @Override
- public HasValue<String> getUserNameValue() {
- return usernameTextBox;
- }
-
- @Override
- public HasValue<String> getPasswordValue() {
- return passwordTextBox;
- }
-
- @Override
- public Focusable getUserNameFocus() {
- return usernameTextBox;
- }
-
- // FIXME the ajax loader will not hidden after normal logout
- @Override
- public void setLoading(boolean load) {
- if (load) {
- message.addStyleName(style.loading());
- message.addStyleName(style.display());
- } else {
- message.removeStyleName(style.loading());
- message.removeStyleName(style.display());
- message.addStyleName(style.hidden());
- }
- }
-
- @Override
- public Widget asWidget() {
- return this;
- }
-
- interface LoginViewUiBinder extends UiBinder<FlowPanel, LoginView> {
- }
-
- private static LoginViewUiBinder binder = GWT
- .create(LoginViewUiBinder.class);
+public class LoginView extends Composite implements LoginActivity.Displayable {
+ @UiField FlowPanel innerBox;
+ @UiField HTMLPanel message;
+ @UiField SubmitButton submitButton;
+ @UiField Button setupButton;
+
+ @UiField PopupPanel settingsPopup;
+ @UiField TextBox imapServer;
+ @UiField TextBox imapPort;
+ @UiField CheckBox imapSecure;
+ @UiField TextBox smtpServer;
+ @UiField TextBox smtpPort;
+ @UiField CheckBox smtpSecure;
+ private LoginActivity activity;
+
+ /*
+ * We wrap login/password boxes with a form which must be in the html
+ * document, in this way, the browser knows that we are sending a login form
+ * and offers the save password dialog to the user
+ */
+ @UiField(provided = true) TextBox usernameTextBox;
+ @UiField(provided = true) PasswordTextBox passwordTextBox;
+
+ public LoginView() {
+ // Wrapped elements from the html document
+ usernameTextBox = TextBox.wrap(DOM.getElementById("email"));
+ passwordTextBox = PasswordTextBox.wrap(DOM.getElementById("password"));
+
+ initWidget(binder.createAndBindUi(this));
+ imapPort.setText("");
+ smtpPort.setText("");
+
+ usernameTextBox.setFocus(true);
+
+ setLoading(false);
+
+ settingsPopup.setVisible(false);
+ }
+
+ @UiHandler("usernameTextBox")
+ protected void onUser(KeyPressEvent e) {
+ if (e.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
+ new Timer() {
+ public void run() {
+ passwordTextBox.setFocus(true);
+ }
+ }.schedule(100);
+ }
+ }
+
+ @UiHandler("usernameTextBox")
+ protected void onUser(ChangeEvent e) {
+ activity.loadSettings();
+ }
+
+ @UiHandler("passwordTextBox")
+ protected void onPassword(KeyDownEvent e) {
+ if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ submitButton.click();
+ }
+ }
+
+ @UiHandler("submitButton")
+ protected void onSubmit(ClickEvent e) {
+ System.out.println("ON sub");
+ if (!usernameTextBox.getValue().isEmpty() &&
+ !passwordTextBox.getValue().isEmpty()) {
+ if (!settingsPopup.isShowing() &&
+ (imapServer.getValue().isEmpty()
+ || smtpServer.getValue().isEmpty()
+ || imapPort.getValue().isEmpty()
+ || smtpPort.getValue().isEmpty()
+ )) {
+ settingsPopup.showRelativeTo(setupButton);
+ } else {
+ setLoading(true);
+ activity.doLogin();
+ }
+ }
+ }
+
+ @UiHandler("setupButton")
+ protected void onSetup(ClickEvent e) {
+ if (settingsPopup.isShowing()) {
+ settingsPopup.hide();
+ } else {
+ settingsPopup.showRelativeTo(setupButton);
+ }
+ }
+
+ @Override
+ public HasValue<String> getUserNameValue() {
+ return usernameTextBox;
+ }
+
+ @Override
+ public HasValue<String> getPasswordValue() {
+ return passwordTextBox;
+ }
+
+ @Override
+ public void setLoading(boolean load) {
+ if (load) {
+ message.setVisible(true);
+ submitButton.setEnabled(false);
+ } else {
+ message.setVisible(false);
+ submitButton.setEnabled(true);
+ }
+ }
+
+ @Override
+ public Widget asWidget() {
+ return this;
+ }
+
+ interface LoginViewUiBinder extends UiBinder<FlowPanel, LoginView> {
+ }
+
+ private static LoginViewUiBinder binder = GWT.create(LoginViewUiBinder.class);
+
+ interface Style extends CssResource {
+ String imapSetting();
+ }
+
+ @Override
+ public void setSettings(Settings s) {
+ System.out.println("Settings " + settingsPopup.isShowing());
+ imapServer.setValue(s.getImapServer());
+ imapPort.setValue("" + (s.getImapPort() > 0 ? s.getImapPort() : ""));
+ imapSecure.setValue(s.getImapSecure());
+ smtpServer.setValue(s.getSmtpServer());
+ smtpPort.setValue("" + (s.getSmtpPort() > 0 ? s.getSmtpPort() : ""));
+ smtpSecure.setValue(s.getSmtpSecure());
+ }
+
+ @Override
+ public Settings getSettings(Settings s) {
+ s.setImapServer(imapServer.getValue());
+ imapPort.setValue(imapPort.getValue().replaceAll("[^\\d]+", ""));
+ if(imapPort.getValue().matches("\\d+"))
+ s.setImapPort(Integer.valueOf(imapPort.getValue()));
+ s.setImapSecure(imapSecure.getValue());
+ s.setSmtpServer(smtpServer.getValue());
+ smtpPort.setValue(smtpPort.getValue().replaceAll("[^\\d]+", ""));
+ if(smtpPort.getValue().matches("\\d+"))
+ s.setSmtpPort(Integer.valueOf(smtpPort.getValue()));
+ s.setSmtpSecure(smtpSecure.getValue());
+ return s;
+ }
+
+ @Override
+ public void setActivity(LoginActivity loginActivity) {
+ activity = loginActivity;
+ }
+
+ @Override
+ protected void onAttach() {
+ super.onAttach();
+ new Timer() {public void run() {
+ activity.loadSettings();
+ }}.schedule(800);
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml Sun Mar 2 12:12:22 2014
@@ -1,84 +1,296 @@
<!-- 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. -->
+ 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:image field='logo' src='res/hupa-logo-64-transparent.png' />
- <ui:image field="shadow" src="res/loginShadow.png" />
- <ui:image field="messages" src="res/messages.png" />
- <ui:image field="loading" src="res/ajaxloader.gif" />
- <ui:style type="org.apache.hupa.client.ui.LoginView.Style">
- @sprite .boxBottom {
- gwt-image: 'shadow';
- background-position: top center;
- width: auto;
- height: auto;
- margin-top: -3px;
- padding-top: 10px;
- }
-
- .message {
- min-height: 40px;
- padding: 5px 25px;
- text-align: center;
- }
-
- @sprite .notice {
- gwt-image: 'messages';
- background-position: 0 5px;
- width: auto;
- height: auto;
- color: #555;
- font-weight: bold;
- padding: 6px 30px 6px 25px;
- display: inline-block;
- white-space: nowrap;
- text-align: center;
- cursor: default;
- }
-
- .hidden {
- display: none;
- }
-
- .display {
- display: inline-block;
- }
-
- @sprite .loading {
- gwt-image: 'loading';
- }
- </ui:style>
- <g:FlowPanel ui:field="mainContainer">
- <g:FlowPanel ui:field="innerBox">
- <g:Image resource='{logo}'></g:Image>
- <g:FormPanel ui:field="formPanel">
- <g:FlexTable ui:field="flexTable" />
- </g:FormPanel>
- <g:Button ui:field="loginButton"></g:Button>
- </g:FlowPanel>
- <g:FlowPanel ui:field="boxBottom" styleName="{style.boxBottom}">
- <g:FlowPanel ui:field="messageBox" addStyleNames="{style.message}">
- <g:HTMLPanel ui:field="message" addStyleNames="{style.notice}{style.hidden}">
- </g:HTMLPanel>
- </g:FlowPanel>
- </g:FlowPanel>
- <g:FlowPanel ui:field="bottomLine">
- <g:HTML>
- You're using
- <b>Hupa</b>
- WebMail which is part of the
- <a target='_blank' href='http://james.apache.org'>Apache-James</a>
- project.
- </g:HTML>
- </g:FlowPanel>
- </g:FlowPanel>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <ui:image field='logo' src='res/hupa-logo-64-transparent.png' />
+ <ui:image field="shadow" src="res/loginShadow.png" />
+ <ui:image field="messages" src="res/messages.png" />
+ <ui:image field="spinner" src="res/ajaxloader.gif" />
+ <ui:image field="buttons" src="res/buttons.png" />
+
+ <ui:style>
+ .imapSetting {
+ width: auto;
+ background: #444;
+ border: 1px solid #999;
+ padding: 11px;
+ z-index: 240;
+ color: #cecece;
+ border-radius: 4px;
+ box-shadow: 0 2px 6px 0 #333;
+ -moz-box-shadow: 0 2px 6px 0 #333;
+ -webkit-box-shadow: 0 2px 6px 0 #333;
+ -o-box-shadow: 0 2px 6px 0 #333;
+ }
+
+ .imapSetting table td{
+ border-spacing: 0;
+ border-collapse: collapse;
+ padding: 3px;
+ }
+
+ /*** Login form ***/
+ .loginForm {
+ position: relative;
+ width: 580px;
+ margin: 20ex auto 2ex auto;
+ }
+
+ .loginForm .boxInner {
+ background: url(images/linen_login.jpg) top left no-repeat #5c5c5c;
+ width: 430px;
+ margin: 0 50px;
+ padding: 10px 24px 24px 24px;
+ border: 1px solid #333;
+ border-radius: 5px;
+ box-shadow: inset 0 0 1px #ccc;
+ -o-box-shadow: inset 0 0 1px #ccc;
+ -webkit-box-shadow: inset 0 0 1px #ccc;
+ -moz-box-shadow: inset 0 0 1px #ccc;
+ }
+
+ .loginForm .tdInput {
+ width: 80%;
+ padding: 8px;
+ }
+
+ .loginForm input[type="text"],.loginForm input[type="password"] {
+ background-color: white;
+ width: 100%;
+ border-color: #666;
+ }
+
+ .loginForm input.button {
+ color: #444;
+ text-shadow: 0px 1px 1px #fff;
+ border-color: #f9f9f9;
+ background: #f9f9f9;
+ background: -moz-linear-gradient(top, #f9f9f9 0%, #e2e2e2 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f9f9f9),
+ color-stop(100%, #e2e2e2) );
+ background: -o-linear-gradient(top, #f9f9f9 0%, #e2e2e2 100%);
+ background: -ms-linear-gradient(top, #f9f9f9 0%, #e2e2e2 100%);
+ background: linear-gradient(top, #f9f9f9 0%, #e2e2e2 100%);
+ box-shadow: inset 0 1px 0 0 #fff;
+ -moz-box-shadow: inset 0 1px 0 0 #fff;
+ -webkit-box-shadow: inset 0 1px 0 0 #fff;
+ -o-box-shadow: inset 0 1px 0 0 #fff;
+ }
+
+ .loginForm input.button:hover,.loginForm input.button:focus {
+ box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0 #fff;
+ -moz-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0
+ #fff;
+ -webkit-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0
+ #fff;
+ -o-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0 #fff;
+ }
+
+ .loginForm input.button:active {
+ color: #333;
+ background: -moz-linear-gradient(top, #dcdcdc 0%, #f9f9f9 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #dcdcdc),
+ color-stop(100%, #f9f9f9) );
+ background: -o-linear-gradient(top, #dcdcdc 0%, #f9f9f9 100%);
+ background: -ms-linear-gradient(top, #dcdcdc 0%, #f9f9f9 100%);
+ background: linear-gradient(top, #dcdcdc 0%, #f9f9f9 100%);
+ }
+
+ .loginForm form table {
+ width: 98%;
+ }
+
+ .loginForm .tdTitle {
+ white-space: nowrap;
+ color: #cecece;
+ text-shadow: 0px 1px 1px black;
+ text-align: right;
+ padding-right: 1em;
+ }
+
+ .loginForm .pFormbuttons {
+ margin-top: 2em;
+ text-align: center;
+ border-radius: 5px;
+ }
+
+ .loginForm .submitButton {
+ background-color: white;
+ font-size: 110%;
+ font-weight: bold;
+ padding: 4px 12px;
+ color: #000;
+ text-decoration: hand;
+ border: 1px solid #DDD;
+ text-align: center;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -o-border-radius: 5px;
+ border-radius: 5px;
+ }
+
+ .loginForm .submitButton:hover {
+ box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0 #fff;
+ -moz-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0
+ #fff;
+ -webkit-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0
+ #fff;
+ -o-box-shadow: 0 0 5px 2px rgba(71, 135, 177, 0.9), inset 0 1px 0 0 #fff;
+ }
+
+ .loginForm #logo {
+ margin-bottom: 20px;
+ }
+
+ .loginForm .messagebox {
+ min-height: 40px;
+ padding: 5px 25px;
+ text-align: center;
+ }
+
+ .loginForm .messageBox div {
+ display: inline-block;
+ padding-right: 0;
+ }
+
+ .bottomLine {
+ font-size: 90%;
+ text-align: center;
+ margin-top: 2em;
+ }
+ /*** boxBottom ***/
+ @sprite .boxBottom {
+ gwt-image: 'shadow';
+ background-position: top center;
+ width: auto;
+ height: auto;
+ margin-top: -3px;
+ padding-top: 10px;
+ }
+
+ .message {
+ min-height: 40px;
+ padding: 5px 25px;
+ text-align: center;
+ }
+
+ @sprite .notice {
+ gwt-image: 'messages';
+ background-position: 0 5px;
+ width: auto;
+ height: auto;
+ color: #555;
+ font-weight: bold;
+ padding: 6px 30px 6px 25px;
+ display: inline-block;
+ white-space: nowrap;
+ text-align: center;
+ cursor: default;
+ }
+
+ @sprite .spinner {
+ gwt-image: 'spinner';
+ }
+
+ @external .loading;
+ .loading {
+ display: none;
+ }
+
+ @sprite .settingIcon {
+ gwt-image: 'buttons';
+ background-position: 0 -96px;
+ width: 33px;
+ height: 27px;
+ cursor: pointer;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -o-border-radius: 3px;
+ border-radius: 3px;
+ }
+ </ui:style>
+ <g:FlowPanel addStyleNames="{style.loginForm}">
+ <g:FlowPanel ui:field="innerBox" addStyleNames="{style.boxInner}">
+ <g:Image resource='{logo}'></g:Image>
+ <g:HTMLPanel>
+ <table>
+ <tr>
+ <td class="{style.tdTitle}">
+ <div class="{style.tdTitle}">username</div>
+ </td>
+ <td class="{style.tdInput}">
+ <g:TextBox ui:field="usernameTextBox" />
+ </td>
+ </tr>
+ <tr>
+ <td class="{style.tdTitle}">
+ <div class="{style.tdTitle}">password</div>
+ </td>
+ <td class="{style.tdInput}">
+ <g:PasswordTextBox ui:field="passwordTextBox" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p class="{style.pFormbuttons}">
+ <g:Button ui:field="setupButton" addStyleNames="{style.settingIcon}"></g:Button>
+ </p>
+ </td>
+ <td>
+ <p class="{style.pFormbuttons}">
+ <g:SubmitButton ui:field="submitButton"
+ addStyleNames="{style.submitButton}">Login</g:SubmitButton>
+ </p>
+ </td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:FlowPanel>
+ <g:FlowPanel styleName="{style.boxBottom}">
+ <g:FlowPanel addStyleNames="{style.message}">
+ <g:HTMLPanel ui:field="message"
+ addStyleNames="{style.notice} {style.spinner} {style.message} ">
+ </g:HTMLPanel>
+ </g:FlowPanel>
+ </g:FlowPanel>
+ <g:FlowPanel addStyleNames="{style.bottomLine}">
+ <g:HTML>
+ You're using
+ <b>Hupa</b>
+ WebMail which is part of the
+ <a target='_blank' href='http://james.apache.org'>Apache-James</a>
+ project.
+ </g:HTML>
+ </g:FlowPanel>
+ <g:PopupPanel ui:field="settingsPopup" styleName="{style.imapSetting}"
+ modal="true" autoHideEnabled="true" glassEnabled="true" >
+ <g:HTMLPanel>
+ <table>
+ <tr>
+ <td>IMAP Server:</td>
+ <td><g:TextBox ui:field="imapServer" visibleLength='15'/></td>
+ <td>Port:</td>
+ <td><g:TextBox ui:field="imapPort" maxLength='5' visibleLength='4'/></td>
+ <td><g:CheckBox ui:field="imapSecure"/> Secure</td>
+ </tr>
+ <tr>
+ <td>SMTP Server:</td>
+ <td><g:TextBox ui:field="smtpServer" visibleLength='15'/></td>
+ <td>Port:</td>
+ <td><g:TextBox ui:field="smtpPort" maxLength='5' visibleLength='4'/></td>
+ <td><g:CheckBox ui:field="smtpSecure"/> Secure</td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:PopupPanel>
+ </g:FlowPanel>
</ui:UiBinder>
\ No newline at end of file
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=1573291&r1=1573290&r2=1573291&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 Sun Mar 2 12:12:22 2014
@@ -22,15 +22,17 @@ package org.apache.hupa.client.ui;
import java.util.List;
import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
import org.apache.hupa.client.activity.MessageContentActivity;
import org.apache.hupa.shared.SConsts;
import org.apache.hupa.shared.domain.MessageAttachment;
+import org.apache.hupa.widgets.editor.Editor;
+import org.apache.hupa.widgets.editor.Toolbar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.DOM;
@@ -40,51 +42,73 @@ import com.google.gwt.user.client.ui.Com
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.HasVisibility;
+import com.google.gwt.user.client.ui.HasHTML;
+import com.google.gwt.user.client.ui.HasText;
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.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.SimpleLayoutPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.inject.Inject;
public class MessageContentView extends Composite implements MessageContentActivity.Displayable {
- @UiField ScrollPanel messageContent;
- HTML messageContentHTML = new HTML();
+
+
+ private Editor editor = new Editor();
- //TODO should use a scrolled panel which can contain multiple children
+ // TODO should use a scrolled panel which can contain multiple children
+ @UiField HTML messageContent = new HTML();
@UiField FlowPanel attachments;
@UiField DockLayoutPanel thisPanel;
- @UiField Anchor rawButton;
- @UiField SimplePanel rawPanel;
+ @UiField FlowPanel tmpWrapper;
+ @UiField DockLayoutPanel messageUpdateContent;
+ @UiField SimplePanel updateToolBar;
+ @UiField SimplePanel updateEditor;
+ @UiField SimpleLayoutPanel centerPanel;
+
+ String messageDetail = "";
@Inject
- public MessageContentView() {
+ public MessageContentView(HupaConstants constants) {
initWidget(binder.createAndBindUi(this));
- }
-
- @Override
- public void fillMessageContent(String messageDetail) {
- messageContentHTML.setHTML(messageDetail);
- messageContent.add(messageContentHTML);
+
+ Toolbar toolbar = new Toolbar(editor.getArea(), constants);
+ toolbar.ensureDebugId("hupa-editor-toolbar");
+
+ tmpWrapper.removeFromParent();
+
+
+ updateToolBar.setWidget(toolbar);
+ updateEditor.setWidget(editor);
+
+ clearContent();
}
@Override
- public void showAttachmentPanel(boolean is){
- if(is){
- thisPanel.setWidgetSize(attachments, 216);
- }else{
- thisPanel.setWidgetSize(attachments, 0);
+ public void fillMessageContent(String messageDetail, boolean isEditable) {
+ this.messageDetail = messageDetail;
+ if (isEditable) {
+ editor.setHTML(messageDetail);
+ centerPanel.setWidget(messageUpdateContent);
+ } else {
+ messageContent.setHTML(messageDetail);
+ centerPanel.setWidget(messageContent);
}
}
@Override
public void setAttachments(List<MessageAttachment> attachements, final String folder, final long uid) {
+ thisPanel.setWidgetHidden(attachments, false);
+
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)");
+ int s = messageAttachment.getSize() / 1024;
+ String size = s < 100 ? "" : ("(" + s + " kB)");
+ String name = messageAttachment.getName() + size;
+ Label link = new Label(name);
+ link.setTitle(name);
link.setStyleName(HupaCSS.C_hyperlink);
link.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
@@ -117,22 +141,17 @@ public class MessageContentView extends
@Override
public void clearContent() {
- messageContentHTML.setHTML("");
+ fillMessageContent("<div class='emptyMsg' style='position absolute; height: 100%'/>", false);
+ thisPanel.setWidgetHidden(attachments, true);
}
-
interface Binder extends UiBinder<DockLayoutPanel, MessageContentView> {
}
private static Binder binder = GWT.create(Binder.class);
@Override
- public HasClickHandlers getRaw() {
- return rawButton;
- }
-
- @Override
- public HasVisibility getRawPanel() {
- return rawPanel;
+ public HasHTML getMessageHTML() {
+ return editor;
}
}
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=1573291&r1=1573290&r2=1573291&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 Sun Mar 2 12:12:22 2014
@@ -1,95 +1,69 @@
<!-- 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. -->
+ 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. -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:image field="buttons" src="res/buttons.png" />
- <ui:style>
- .messageContent {
- display: block;
- background-color: white;
- width: 100%;
- height: 100%;
- }
-
- .previewheader {
- position: relative;
- height: auto;
- min-height: 52px;
- padding: 0 0 3px 26px;
- }
-
- .messageheader {
- position: relative;
- padding: 3px 0;
- background: #f9f9f9;
- background: -moz-linear-gradient(top, #fff 0%, #f0f0f0 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff),
- color-stop(100%, #f0f0f0) );
- background: -o-linear-gradient(top, #fff 0%, #f0f0f0 100%);
- background: -ms-linear-gradient(top, #fff 0%, #f0f0f0 100%);
- background: linear-gradient(top, #fff 0%, #f0f0f0 100%);
- border-bottom: 1px solid #dfdfdf;
- }
-
- .attachBox {
- float: right;
- width: 230px;
- margin: 8px;
- min-height: 200px;
- background: #f0f0f0;
- padding: 8px;
- }
-
- .moreHeaders {
- position: absolute;
- top: 8px;
- right: 18px;
- width: 18em;
- text-align: right;
- white-space: nowrap;
- }
-
- @sprite .inner {
- gwt-image: 'buttons';
- background-position: -29px -271px;
- display: inline-block;
- width: 16px;
- height: 13px;
- text-indent: 1000px;
- overflow: hidden;
- cursor: pointer;
- }
- </ui:style>
- <g:DockLayoutPanel unit="PX">
- <g:center>
- <g:DockLayoutPanel unit="PX" ui:field="thisPanel">
- <g:north size="30">
- <g:FlowPanel addStyleNames="{style.previewheader} {style.messageheader}">
- <g:SimplePanel ui:field="rawPanel" addStyleNames="{style.moreHeaders}">
-
- <g:Anchor ui:field="rawButton" addStyleNames="{style.inner}">Raw
- </g:Anchor>
- </g:SimplePanel>
- </g:FlowPanel>
- </g:north>
- <g:center>
- <g:ScrollPanel ui:field="messageContent"
- addStyleNames="{style.messageContent}" />
- </g:center>
- <g:east size="0">
- <g:FlowPanel ui:field="attachments" addStyleNames="{style.attachBox}">
- </g:FlowPanel>
- </g:east>
- </g:DockLayoutPanel>
- </g:center>
- </g:DockLayoutPanel>
-</ui:UiBinder>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <ui:image field="originLogo" src="res/hupa-logo-original-transparent.png" />
+ <ui:style>
+ .messageContent {
+ display: block;
+ background-color: white;
+ height: 100%;
+ padding: 10px;
+ overflow: auto;
+ }
+
+ .attachBox {
+ float: right;
+ width: 230px;
+ margin: 8px;
+ min-height: 200px;
+ background: #f0f0f0;
+ padding: 8px;
+ }
+ .composebodycontainer {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 260px;
+ bottom: 0;
+ }
+
+ @external .emptyMsg;
+ @sprite .emptyMsg {
+ gwt-image: 'originLogo';
+ background-position: center center;
+ width: auto;
+ }
+
+ </ui:style>
+ <g:DockLayoutPanel unit="PX" ui:field="thisPanel">
+ <g:center>
+ <g:SimpleLayoutPanel ui:field="centerPanel">
+ <g:FlowPanel ui:field="tmpWrapper">
+ <g:HTML ui:field="messageContent" addStyleNames="{style.messageContent}" />
+ <g:DockLayoutPanel ui:field="messageUpdateContent">
+ <g:north size="23">
+ <g:SimplePanel ui:field="updateToolBar" />
+ </g:north>
+ <g:center>
+ <g:SimplePanel ui:field="updateEditor" addStyleNames="{style.composebodycontainer}" />
+ </g:center>
+ </g:DockLayoutPanel>
+ </g:FlowPanel>
+ </g:SimpleLayoutPanel>
+ </g:center>
+ <g:east size="215">
+ <g:FlowPanel ui:field="attachments" addStyleNames="{style.attachBox}">
+ </g:FlowPanel>
+ </g:east>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java Sun Mar 2 12:12:22 2014
@@ -19,12 +19,8 @@
package org.apache.hupa.client.ui;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.hupa.client.activity.MessageListFooterActivity;
import org.apache.hupa.client.rf.HupaRequestFactory;
-import org.apache.hupa.shared.domain.ImapFolder;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
@@ -37,8 +33,6 @@ import com.google.gwt.user.client.ui.Hor
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.inject.Inject;
-import com.google.web.bindery.requestfactory.shared.Receiver;
-import com.google.web.bindery.requestfactory.shared.ServerFailure;
public class MessageListFooterView extends Composite implements MessageListFooterActivity.Displayable {
@@ -46,9 +40,6 @@ public class MessageListFooterView exten
@UiField ListBox labels;
@UiField SimplePanel labelsPanel;
- private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
-
- private static final String ROOT_PATH = "imap_root";
@Inject
public MessageListFooterView(final MessagesCellTable table, final HupaRequestFactory rf) {
@@ -57,62 +48,9 @@ public class MessageListFooterView exten
simplePager.setDisplay(table);
// simplePager.setRangeLimited(false);
initWidget(binder.createAndBindUi(this));
-
- rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>() {
-
- private String INTENTS = " ";
-
- @Override
- public void onSuccess(List<ImapFolder> response) {
- folderNodes.clear();
- if (response == null || response.size() == 0) {
- } else {
- for (ImapFolder folder : response) {
- fillCellList(folderNodes, folder, LabelNode.ROOT, "");
- }
- }
-
- makeParentList();
- }
-
- private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode parent,
- String intents) {
- LabelNode labelNode = new LabelNode();
- labelNode.setFolder(curFolder);
- labelNode.setName(curFolder.getName());
- labelNode.setNameForDisplay(intents + curFolder.getName());
- labelNode.setParent(parent);
- labelNode.setPath(curFolder.getFullName());
- folderNodes.add(labelNode);
- if ("inbox".equalsIgnoreCase(curFolder.getName())) {
- // if(selectionModel.getSelectedObject() == null){
- // selectionModel.setSelected(labelNode, true);
- // }
- }
- if (curFolder.getHasChildren()) {
- for (ImapFolder subFolder : curFolder.getChildren()) {
- fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
- }
- }
- }
-
- @Override
- public void onFailure(ServerFailure error) {
- if (error.isFatal()) {
- throw new RuntimeException(error.getMessage());
- }
- }
-
- });
- }
-
- private void makeParentList() {
- labels.clear();
- labels.addItem("Move to...", ROOT_PATH);
- for (LabelNode folderNode : this.folderNodes) {
- labels.addItem(folderNode.getNameForDisplay().replace(" ", ". "), folderNode.getPath());
- }
-
+
+ // FIXME: make it work
+ labels.setVisible(false);
}
interface MessageListFooterUiBinder extends UiBinder<HorizontalPanel, MessageListFooterView> {
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=1573291&r1=1573290&r2=1573291&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 Sun Mar 2 12:12:22 2014
@@ -24,8 +24,10 @@ import java.util.List;
import java.util.Set;
import org.apache.hupa.client.activity.MessageListActivity;
+import org.apache.hupa.client.ui.MessagesCellTable.MessageListDataProvider;
import org.apache.hupa.shared.domain.Message;
+import com.google.gwt.core.client.Duration;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.uibinder.client.UiBinder;
@@ -59,8 +61,14 @@ public class MessageListView extends Com
}
@Override
+ public MessageListDataProvider getDataProvider() {
+ return grid.dataProvider;
+ }
+
+
+ @Override
public void refresh(){
- grid.refresh();
+ grid.refresh();
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org