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 do...@apache.org on 2013/08/21 16:08:29 UTC
svn commit: r1516164 [7/20] - in /james/hupa/trunk: ./ client/
client/src/main/java/com/ client/src/main/java/com/google/
client/src/main/java/com/google/web/
client/src/main/java/com/google/web/bindery/
client/src/main/java/com/google/web/bindery/requ...
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendMessageRequest.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendMessageRequest.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendMessageRequest.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendMessageRequest.java Wed Aug 21 14:08:19 2013
@@ -1,40 +1,34 @@
-/****************************************************************
- * 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.rf;
-
-import org.apache.hupa.server.rf.Subject;
-
-import com.google.web.bindery.requestfactory.shared.InstanceRequest;
-import com.google.web.bindery.requestfactory.shared.Request;
-import com.google.web.bindery.requestfactory.shared.RequestContext;
-import com.google.web.bindery.requestfactory.shared.Service;
-
-@Service(Subject.class)
-public interface SubjectRequest extends RequestContext {
-
- Request<java.lang.Long> countSubjects();
-
- Request<SubjectProxy> findSubject(Long id);
-
- InstanceRequest<SubjectProxy, java.lang.Void> remove();
-
- InstanceRequest<SubjectProxy, java.lang.Void> persist();
-
- Request<String> echo(SubjectProxy subject, String from, String to);
-}
+/****************************************************************
+ * 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.rf;
+
+import org.apache.hupa.server.ioc.IocRfServiceLocator;
+import org.apache.hupa.server.service.SendMessageService;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.SendMessageAction;
+
+import com.google.web.bindery.requestfactory.shared.Request;
+import com.google.web.bindery.requestfactory.shared.RequestContext;
+import com.google.web.bindery.requestfactory.shared.Service;
+
+@Service(value = SendMessageService.class, locator = IocRfServiceLocator.class)
+public interface SendMessageRequest extends RequestContext {
+ Request<GenericResult> send(SendMessageAction action);
+}
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendReplyMessageRequest.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CheckSessionResult.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendReplyMessageRequest.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendReplyMessageRequest.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CheckSessionResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CheckSessionResult.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SendReplyMessageRequest.java Wed Aug 21 14:08:19 2013
@@ -17,30 +17,18 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.shared.rpc;
+package org.apache.hupa.client.rf;
-import java.io.Serializable;
-
-import org.apache.hupa.shared.data.User;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-public class CheckSessionResult implements Result, Serializable {
-
- private static final long serialVersionUID = -4785233314922498952L;
- boolean valid = false;
-
- private User user;
-
- public User getUser() {
- return user;
- }
-
- public void setUser(User user) {
- this.user = user;
- }
-
- public boolean isValid() {
- return user != null && user.getAuthenticated();
- }
+import org.apache.hupa.server.ioc.IocRfServiceLocator;
+import org.apache.hupa.server.service.SendReplyMessageService;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.SendReplyMessageAction;
+
+import com.google.web.bindery.requestfactory.shared.Request;
+import com.google.web.bindery.requestfactory.shared.RequestContext;
+import com.google.web.bindery.requestfactory.shared.Service;
+
+@Service(value = SendReplyMessageService.class, locator = IocRfServiceLocator.class)
+public interface SendReplyMessageRequest extends RequestContext {
+ Request<GenericResult> send(SendReplyMessageAction action);
}
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SetFlagRequest.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SetFlagRequest.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SetFlagRequest.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SetFlagRequest.java Wed Aug 21 14:08:19 2013
@@ -1,40 +1,34 @@
-/****************************************************************
- * 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.rf;
-
-import org.apache.hupa.server.rf.Subject;
-
-import com.google.web.bindery.requestfactory.shared.InstanceRequest;
-import com.google.web.bindery.requestfactory.shared.Request;
-import com.google.web.bindery.requestfactory.shared.RequestContext;
-import com.google.web.bindery.requestfactory.shared.Service;
-
-@Service(Subject.class)
-public interface SubjectRequest extends RequestContext {
-
- Request<java.lang.Long> countSubjects();
-
- Request<SubjectProxy> findSubject(Long id);
-
- InstanceRequest<SubjectProxy, java.lang.Void> remove();
-
- InstanceRequest<SubjectProxy, java.lang.Void> persist();
-
- Request<String> echo(SubjectProxy subject, String from, String to);
-}
+/****************************************************************
+ * 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.rf;
+
+import org.apache.hupa.server.ioc.IocRfServiceLocator;
+import org.apache.hupa.server.service.SetFlagService;
+import org.apache.hupa.shared.domain.GenericResult;
+import org.apache.hupa.shared.domain.SetFlagAction;
+
+import com.google.web.bindery.requestfactory.shared.Request;
+import com.google.web.bindery.requestfactory.shared.RequestContext;
+import com.google.web.bindery.requestfactory.shared.Service;
+
+@Service(value = SetFlagService.class, locator = IocRfServiceLocator.class)
+public interface SetFlagRequest extends RequestContext {
+ Request<GenericResult> set(SetFlagAction action);
+}
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayout.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFolders.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayout.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayout.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFolders.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFolders.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayout.java Wed Aug 21 14:08:19 2013
@@ -1,33 +1,32 @@
-/****************************************************************
- * 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.rpc;
-
-import java.io.Serializable;
-
-import net.customware.gwt.dispatch.shared.Action;
-
-
-public class FetchFolders implements Action<FetchFoldersResult>, Serializable {
-
- private static final long serialVersionUID = 8515539585915762904L;
-
- public FetchFolders() {
- }
-}
+/****************************************************************
+ * 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.ui;
+
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+
+public interface AppLayout {
+ DockLayoutPanel getAppLayoutPanel();
+ AcceptsOneWidget getNorthContainer();
+ AcceptsOneWidget getWestContainer();
+ AcceptsOneWidget getCenterContainer();
+ void setLoginLayout();
+ void setDefaultLayout();
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,118 @@
+/****************************************************************
+ * 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.ui;
+
+import org.apache.hupa.client.HupaCSS;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.gwt.user.client.ui.LayoutPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+public class AppLayoutImpl implements AppLayout {
+
+ private final DockLayoutPanel appLayoutPanel;
+
+ interface AppLayoutUiBinder extends UiBinder<DockLayoutPanel, AppLayoutImpl> {
+ }
+
+ private static AppLayoutUiBinder binder = GWT.create(AppLayoutUiBinder.class);
+
+ @UiField LayoutPanel northPanel;
+ @UiField HTMLPanel southPanel;
+ @UiField SimplePanel westPanel;
+ @UiField SimplePanel eastPanel;
+ @UiField LayoutPanel centerPanel;
+ @UiField SimplePanel logoContainer;
+ @UiField SimplePanel topContainer;
+
+ @Inject
+ public AppLayoutImpl() {
+ appLayoutPanel = binder.createAndBindUi(this);
+ logoContainer.addStyleName(HupaCSS.C_logo_container);
+ setLoginLayout();
+ }
+
+ @Override
+ public DockLayoutPanel getAppLayoutPanel() {
+ return appLayoutPanel;
+ }
+
+ @Override
+ public AcceptsOneWidget getNorthContainer() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ Widget widget = Widget.asWidgetOrNull(w);
+ if(widget != null){
+ topContainer.add(widget);
+ }
+ }
+ };
+ }
+ @Override
+ public AcceptsOneWidget getWestContainer() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ Widget widget = Widget.asWidgetOrNull(w);
+ westPanel.setWidget(widget);
+ }
+ };
+ }
+
+ @Override
+ public AcceptsOneWidget getCenterContainer() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ Widget widget = Widget.asWidgetOrNull(w);
+ if(centerPanel.getWidgetCount() > 0){
+ centerPanel.remove(0);
+ }
+ if(widget != null){
+ centerPanel.add(widget);
+ }
+ }
+ };
+ }
+
+ public void setDefaultLayout() {
+ arrangeLayoutSize(8, 2, 15, 0);
+ }
+
+ public void setLoginLayout() {
+ arrangeLayoutSize(0, 2, 0, 0);
+ }
+
+ private void arrangeLayoutSize(double n, double s, double w, double e){
+ appLayoutPanel.setWidgetSize(northPanel, n);
+ appLayoutPanel.setWidgetSize(southPanel, s);
+ appLayoutPanel.setWidgetSize(westPanel, w);
+ appLayoutPanel.setWidgetSize(eastPanel, e);
+ }
+}
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AppLayoutImpl.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,39 @@
+<!-- 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. -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <ui:style>
+ </ui:style>
+ <g:DockLayoutPanel unit='EM'>
+ <g:north size='8'>
+ <g:LayoutPanel ui:field="northPanel">
+ <g:layer left="0px" width="84px" top="0px" height="64">
+ <g:SimplePanel ui:field="logoContainer"/></g:layer>
+ <g:layer right="12px" width="37%" >
+ <g:SimplePanel ui:field="topContainer" /></g:layer>
+ </g:LayoutPanel>
+ </g:north>
+ <g:south size='2'>
+ <g:HTMLPanel ui:field="southPanel">
+ </g:HTMLPanel>
+ </g:south>
+ <g:west size='12'>
+ <g:SimplePanel ui:field="westPanel"/>
+ </g:west>
+ <g:east size='0'>
+ <g:SimplePanel ui:field="eastPanel" />
+ </g:east>
+ <g:center>
+ <g:LayoutPanel ui:field="centerPanel"/>
+ </g:center>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.java Wed Aug 21 14:08:19 2013
@@ -17,34 +17,39 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client;
+package org.apache.hupa.client.ui;
-import net.customware.gwt.presenter.client.place.PlaceManager;
+import org.apache.hupa.client.activity.ComposeToolBarActivity;
-import org.apache.hupa.client.gin.HupaGinjector;
-import org.apache.hupa.client.mvp.AppPresenter;
-
-import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.event.dom.client.ClickEvent;
+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.Window;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+
+public class ComposeToolBarView extends Composite implements
+ ComposeToolBarActivity.Displayable {
+
+ @UiField Anchor attach;
+
+ @UiHandler("attach")
+ void handleClick(ClickEvent e) {
+ Window.alert("//TODO this should be a model window for attachments.");
+ }
+
+ public ComposeToolBarView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface ComposeToolBarUiBinder extends
+ UiBinder<FlowPanel, ComposeToolBarView> {
+ }
-public class Hupa implements EntryPoint{
- private final HupaGinjector injector = GWT.create(HupaGinjector.class);
-
- public void onModuleLoad() {
- // remove the loading message from the browser
- com.google.gwt.user.client.Element loading = DOM.getElementById("loading");
-
- DOM.removeChild(RootPanel.getBodyElement(), loading);
-
- AppPresenter aPres = injector.getAppPresenter();
- aPres.bind();
-
- RootPanel.get().add(aPres.getDisplay().asWidget());
-
- PlaceManager placeManager = injector.getPlaceManager();
- placeManager.fireCurrentPlace();
- }
+ private static ComposeToolBarUiBinder binder = GWT
+ .create(ComposeToolBarUiBinder.class);
}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,105 @@
+<!-- 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. -->
+
+<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>
+ .bar {
+ position: absolute;
+ display: block;
+ top: -2px;
+ right: 390px;
+ left: 0;
+ height: 40px;
+ white-space: nowrap;
+ z-index: 10;
+ }
+
+ @sprite .button {
+ gwt-image: 'buttons';
+ text-align: center;
+ font-size: 10px;
+ color: #555;
+ min-width: 50px;
+ max-width: 75px;
+ height: 13px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ padding: 28px 2px 0 2px;
+ text-shadow: 0px 1px 1px #EEE;
+ box-shadow: none;
+ -webkit-box-shadow: none;
+ background-position: -100px 0;
+ border: 0;
+ display: inline-block;
+ margin: 0 2px;
+ border-radius: 4px;
+ text-decoration: none;
+ cursor: pointer;
+ }
+
+ .dropButton {
+ display: inline-block;
+ position: relative;
+ }
+
+ .dropButton .button {
+ margin-left: 0;
+ padding-left: 0;
+ margin-right: 0;
+ padding-right: 0;
+ }
+
+ @sprite .dropButton .dropButtonTip {
+ gwt-image: 'buttons';
+ display: block;
+ position: absolute;
+ right: 0;
+ top: 0;
+ height: 42px;
+ width: 18px;
+ background-position: 0 -1255px;
+ cursor: pointer;
+ }
+
+ .spellCheck {
+ min-width: 64px;
+ background-position: left -930px;
+ }
+
+ .attach {
+ background-position: center -890px;
+ }
+
+ .signature {
+ background-position: center -1135px;
+ }
+
+ .disabledButton {
+ opacity: 0.4;
+ cursor: default;
+ }
+ </ui:style>
+
+ <g:FlowPanel addStyleNames="{style.bar}" ui:field="ToolBar">
+ <g:HTMLPanel ui:field="forwardGroup" tag="span"
+ addStyleNames="{style.dropButton} {style.disabledButton}">
+ <g:Anchor ui:field="spell" addStyleNames="{style.button} {style.spellCheck}">Spell
+ </g:Anchor>
+ <g:HTMLPanel tag="span" addStyleNames="{style.dropButtonTip}"></g:HTMLPanel>
+ </g:HTMLPanel>
+ <g:Anchor ui:field="attach" addStyleNames="{style.button} {style.attach}">Attach</g:Anchor>
+ <g:Anchor ui:field="signature"
+ addStyleNames="{style.button} {style.signature} {style.disabledButton}">Signature</g:Anchor>
+ </g:FlowPanel>
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,459 @@
+/****************************************************************
+ * 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.ui;
+
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.HupaMessages;
+import org.apache.hupa.client.activity.ComposeActivity;
+import org.apache.hupa.client.validation.AddStyleAction;
+import org.apache.hupa.client.validation.EmailListValidator;
+import org.apache.hupa.client.validation.NotEmptyValidator;
+import org.apache.hupa.client.validation.SetFocusAction;
+import org.apache.hupa.shared.SConsts;
+import org.apache.hupa.widgets.editor.Editor;
+import org.apache.hupa.widgets.editor.Toolbar;
+import org.apache.hupa.widgets.ui.MultiValueSuggestArea;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTMLTable.RowFormatter;
+import com.google.gwt.user.client.ui.HasHTML;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.inject.Inject;
+
+import eu.maydu.gwt.validation.client.DefaultValidationProcessor;
+import eu.maydu.gwt.validation.client.ValidationProcessor;
+import eu.maydu.gwt.validation.client.i18n.ValidationMessages;
+import gwtupload.client.BaseUploadStatus;
+import gwtupload.client.IFileInput.FileInputType;
+import gwtupload.client.IUploadStatus;
+import gwtupload.client.IUploader;
+import gwtupload.client.MultiUploader;
+
+public class ComposeView extends Composite implements ComposeActivity.Displayable {
+
+ @UiField protected DockLayoutPanel thisPanel;
+ @UiField protected SimplePanel header;
+ @UiField protected FlexTable headerTable;
+ @UiField protected SimplePanel editorToolBar;
+ @UiField protected SimplePanel composeEditor;
+ @UiField protected FlowPanel attach;
+ @UiField protected Style style;
+ private ListBox selectFrom;
+ /* we only need one instance for all suggestion-boxes */
+ private MultiValueSuggestArea toSuggest = new MultiValueSuggestArea(" ,@<>");
+ private MultiValueSuggestArea ccSuggest = new MultiValueSuggestArea(toSuggest.getOracle());
+ private MultiValueSuggestArea bccSuggest = new MultiValueSuggestArea(toSuggest.getOracle());
+ private TextBox subject = new TextBox();
+
+ private Button sendButton;
+ private Button saveButton;
+ private Button cancelButton;
+
+ private Anchor addCcButton;
+ private Anchor addBccButton;
+ private Anchor addReplyButton;
+ private Anchor addFollowupButton;
+
+ private Anchor _CcButton = new Anchor("x");
+ private Anchor _BccButton = new Anchor("x");
+ private Anchor _ReplyButton = new Anchor("x");
+ private Anchor _FollowupButton = new Anchor("x");
+
+ private FlexCellFormatter cellFormatter;
+ private RowFormatter rowFormatter;
+
+ private Editor editor;
+
+ private ValidationProcessor validator;
+ private MultiUploader uploader = null;
+
+ private static final int ROW_FROM = 0;
+ private static final int ROW_TO = 1;
+ private static final int ROW_CC = 2;
+ private static final int ROW_BCC = 3;
+ private static final int ROW_REPLY = 4;
+ private static final int ROW_FOLLOWUP = 5;
+ private static final int ROW_SWITCH = 6;
+ private static final int ROW_SUBJECT = 7;
+
+ private static final int ROW_HEIGHT = 33;
+
+ interface Style extends CssResource {
+ String show();
+ String hide();
+ String iconlink();
+ String add();
+ String cancel();
+ String formlinks();
+ String left();
+ String right();
+ String operation();
+ }
+
+ @Inject
+ public ComposeView(HupaConstants constants, HupaMessages messages) {
+ initWidget(binder.createAndBindUi(this));
+ initFormatters();
+ createFirstColumn();
+ createSecondColumn();
+ bindValidators(messages);
+ createEditor(constants);
+ }
+
+ private void createEditor(HupaConstants constants) {
+ editor = new Editor();
+ BaseUploadStatus uploadStatus = new BaseUploadStatus();
+ uploadStatus.setCancelConfiguration(IUploadStatus.DEFAULT_CANCEL_CFG);
+ uploader = new MultiUploader(FileInputType.ANCHOR, uploadStatus);
+ uploader.setServletPath(GWT.getModuleBaseURL() + SConsts.SERVLET_UPLOAD);
+ uploader.avoidRepeatFiles(true);
+ uploader.setI18Constants(constants);
+ attach.add(uploader);
+
+ Toolbar toolbar = new Toolbar(editor.getArea(), constants);
+ toolbar.ensureDebugId("hupa-editor-toolbar");
+ editorToolBar.add(toolbar);
+ composeEditor.add(editor);
+ }
+
+ private void bindValidators(HupaMessages messages) {
+ SetFocusAction fAction = new SetFocusAction();
+ AddStyleAction sAction = new AddStyleAction(HupaCSS.C_validate, 3000);
+ validator = new DefaultValidationProcessor(new ValidationMessages(messages));
+ validator.addValidators("cc",
+ new EmailListValidator(getCc()).addActionForFailure(sAction).addActionForFailure(fAction));
+ validator.addValidators("bcc", new EmailListValidator(getBcc()).addActionForFailure(sAction)
+ .addActionForFailure(fAction));
+ validator.addValidators("to",
+ new EmailListValidator(getTo()).addActionForFailure(sAction).addActionForFailure(fAction),
+ new NotEmptyValidator(getTo()).addActionForFailure(sAction).addActionForFailure(fAction));
+ }
+
+ private void initFormatters() {
+ cellFormatter = headerTable.getFlexCellFormatter();
+ rowFormatter = headerTable.getRowFormatter();
+ }
+
+ private void createSecondColumn() {
+ selectFrom = new ListBox();
+ sendButton = new Button("Send message");
+ saveButton = new Button("Save as draft");
+ cancelButton = new Button("Cancel");
+ FlowPanel operationPanel = new FlowPanel();
+ FlowPanel contactPanel = new FlowPanel();
+ FlowPanel buttonPanel = new FlowPanel();
+ contactPanel.add(selectFrom);
+ contactPanel.addStyleName(style.left());
+ // buttonPanel.add(new Anchor("Edit identities"));
+ buttonPanel.add(sendButton);
+ buttonPanel.add(saveButton);
+ buttonPanel.add(cancelButton);
+ buttonPanel.addStyleName(style.right());
+ operationPanel.add(contactPanel);
+ operationPanel.add(buttonPanel);
+ operationPanel.addStyleName(style.operation());
+ headerTable.setWidget(ROW_FROM, 1, operationPanel);
+ headerTable.setWidget(ROW_TO, 1, toSuggest);
+ headerTable.setWidget(ROW_CC, 1, ccSuggest);
+ headerTable.setWidget(ROW_BCC, 1, bccSuggest);
+ headerTable.setWidget(ROW_REPLY, 1, create());
+ headerTable.setWidget(ROW_FOLLOWUP, 1, create());
+ headerTable.setWidget(ROW_SWITCH, 1, createOpsPanel());
+ cellFormatter.addStyleName(ROW_SWITCH, 1, style.formlinks());
+ headerTable.setWidget(ROW_SUBJECT, 1, subject);
+ rowFormatter.addStyleName(ROW_CC, style.hide());
+ rowFormatter.addStyleName(ROW_BCC, style.hide());
+ rowFormatter.addStyleName(ROW_REPLY, style.hide());
+ rowFormatter.addStyleName(ROW_FOLLOWUP, style.hide());
+ }
+
+ private void createFirstColumn() {
+ headerTable.setWidget(ROW_FROM, 0, new Label("From"));
+ headerTable.setWidget(ROW_TO, 0, new Label("To"));
+ headerTable.setWidget(ROW_CC, 0, createCell("Cc", _CcButton));
+ headerTable.setWidget(ROW_BCC, 0, createCell("Bcc", _BccButton));
+ headerTable.setWidget(ROW_REPLY, 0, createCell("Reply", _ReplyButton));
+ headerTable.setWidget(ROW_FOLLOWUP, 0, createCell("Follow", _FollowupButton));
+ headerTable.setWidget(ROW_SWITCH, 0, new Label(""));
+ headerTable.setWidget(ROW_SUBJECT, 0, new Label("Subject"));
+ }
+
+ private FlowPanel createCell(String labelText, Anchor w) {
+ FlowPanel ccCell = new FlowPanel();
+ Label cc = new Label(labelText);
+ cc.addStyleName(style.left());
+ ccCell.add(cc);
+ w.addStyleName(style.iconlink());
+ w.addStyleName(style.cancel());
+ ccCell.add(w);
+ return ccCell;
+ }
+
+ private FlowPanel createOpsPanel() {
+ FlowPanel addOpsPanel = new FlowPanel();
+ addCcButton = new Anchor("Add Cc");
+ addCcButton.addStyleName(style.iconlink());
+ addCcButton.addStyleName(style.add());
+ addBccButton = new Anchor("Add Bcc");
+ addBccButton.addStyleName(style.iconlink());
+ addBccButton.addStyleName(style.add());
+ addReplyButton = new Anchor("Add Reply-To");
+ addReplyButton.addStyleName(style.iconlink());
+ addReplyButton.addStyleName(style.add());
+ addFollowupButton = new Anchor("Add Followup-To");
+ addFollowupButton.addStyleName(style.iconlink());
+ addFollowupButton.addStyleName(style.add());
+ addOpsPanel.add(addCcButton);
+ addOpsPanel.add(addBccButton);
+ // TODO the other operations
+ // addOpsPanel.add(addReplyButton);
+ // addOpsPanel.add(addFollowupButton);
+ return addOpsPanel;
+ }
+
+ HasText emptyText = new HasText() {
+ @Override
+ public String getText() {
+ return "";
+ }
+ @Override
+ public void setText(String text) {
+ }
+ };
+
+ @Override
+ public HasText getTo() {
+ return toSuggest;
+ }
+
+ @Override
+ public HasText getCc() {
+ if (isShowing(ROW_CC))
+ return ccSuggest;
+ else
+ return emptyText;
+ }
+
+ @Override
+ public HasText getBcc() {
+ if (isShowing(ROW_BCC))
+ return bccSuggest;
+ else
+ return emptyText;
+ }
+
+ @Override
+ public HasClickHandlers getSendClick() {
+ return sendButton;
+ }
+
+ @Override
+ public HasClickHandlers getCancelClick(){
+ return cancelButton;
+ }
+
+ @Override
+ public HasClickHandlers getCcClick() {
+ return addCcButton;
+ }
+
+ @Override
+ public HasClickHandlers get_CcClick() {
+ return _CcButton;
+ }
+
+ @Override
+ public HasClickHandlers getBccClick() {
+ return addBccButton;
+ }
+
+ @Override
+ public HasClickHandlers get_BccClick() {
+ return _BccButton;
+ }
+
+ @Override
+ public HasClickHandlers getReplyClick() {
+ return addReplyButton;
+ }
+
+ @Override
+ public HasClickHandlers get_ReplyClick() {
+ return _ReplyButton;
+ }
+
+ @Override
+ public HasClickHandlers getFollowupClick() {
+ return addFollowupButton;
+ }
+
+ @Override
+ public HasClickHandlers get_FollowupClick() {
+ return _FollowupButton;
+ }
+
+ @Override
+ public HasText getSubject() {
+ return subject;
+ }
+
+ @Override
+ public boolean validate() {
+ return this.validator.validate();
+ }
+
+ @Override
+ public String getFromText() {
+ // TODO hardcode to the first identifier
+ return selectFrom.getItemText(0);
+ }
+
+ @Override
+ public ListBox getFromList() {
+ return selectFrom;
+ }
+
+ @Override
+ public HasText getMessage() {
+ return editor;
+ }
+
+ @Override
+ public HasHTML getMessageHTML() {
+ return editor;
+ }
+
+ @Override
+ public IUploader getUploader() {
+ return uploader;
+ }
+
+ @Override
+ public void showCc() {
+ showRow(ROW_CC);
+ // hide(addCcButton);
+ }
+
+ @Override
+ public void hideCc() {
+ hideRow(ROW_CC);
+ // show(addCcButton);
+ }
+
+ @Override
+ public void showBcc() {
+ showRow(ROW_BCC);
+ // hide(addBccButton);
+ }
+
+ @Override
+ public void hideBcc() {
+ hideRow(ROW_BCC);
+ // show(addBccButton);
+ }
+
+ @Override
+ public void showReply() {
+ showRow(ROW_REPLY);
+ // hide(addReplyButton);
+ }
+
+ @Override
+ public void hideReply() {
+ hideRow(ROW_REPLY);
+ // show(addReplyButton);
+ }
+
+ @Override
+ public void showFollowup() {
+ showRow(ROW_FOLLOWUP);
+ // hide(addFollowupButton);
+ }
+
+ @Override
+ public void hideFollowup() {
+ hideRow(ROW_FOLLOWUP);
+ // show(addFollowupButton);
+ }
+<<<<<<< HEAD
+=======
+
+
+ @Override
+ public void fillContactList(String[] contacts){
+ toSuggest.fillOracle(contacts);
+ }
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ private void showRow(int row) {
+ if (isShowing(row)) {
+ return;
+ }
+ rowFormatter.removeStyleName(row, style.hide());
+ rowFormatter.addStyleName(row, style.show());
+ thisPanel.setWidgetSize(header, thisPanel.getWidgetSize(header) + ROW_HEIGHT);
+ }
+
+ private void hideRow(int row) {
+ if (isHiding(row)) {
+ return;
+ }
+ rowFormatter.removeStyleName(row, style.show());
+ rowFormatter.addStyleName(row, style.hide());
+ thisPanel.setWidgetSize(header, thisPanel.getWidgetSize(header) - ROW_HEIGHT);
+ }
+
+ private boolean isShowing(int row) {
+ return rowFormatter.getStyleName(row).contains(style.show());
+ }
+
+ private boolean isHiding(int row) {
+ return rowFormatter.getStyleName(row).contains(style.hide());
+ }
+
+ // TODO
+ private TextArea create() {
+ TextArea t = new TextArea();
+ return t;
+ }
+
+ interface ComposeUiBinder extends UiBinder<DockLayoutPanel, ComposeView> {
+ }
+
+ private static ComposeUiBinder binder = GWT.create(ComposeUiBinder.class);
+
+}
Added: 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=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,225 @@
+<!-- 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. -->
+
+<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;
+ border-radius: 4px;
+ overflow: hidden;
+ box-shadow: 0 0 2px #999;
+ -o-box-shadow: 0 0 2px #999;
+ -webkit-box-shadow: 0 0 2px #999;
+ -moz-box-shadow: 0 0 2px #999;
+ background: white;
+ }
+
+ .header {
+ border-radius: 4px 4px 0 0;
+ -webkit-box-shadow: 0 2px 3px 0 #999;
+ -moz-box-shadow: 0 2px 3px 0 #999;
+ box-shadow: 0 2px 3px 0 #999;
+ border-bottom: 0;
+ 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;
+ }
+
+ .header td {
+ padding: 3px 8px;
+ }
+
+ .header td textarea,.header td input {
+ width: 100%;
+ height: 13px;
+ resize: none;
+ font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ }
+
+ .mailviewbottom {
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ height: 26px;
+ }
+
+ @sprite .iconlink {
+ gwt-image: 'buttons';
+ background-position: -1000px 0;
+ width: auto;
+ height: auto;
+ display: inline-block;
+ color: #888;
+ text-decoration: none;
+ white-space: nowrap;
+ }
+
+ .left {
+ float: left;
+ }
+
+ .right {
+ float: right;
+ }
+
+ .operation {
+ margin: 0 -1px;
+ }
+
+ .add {
+ background-position: -7px -357px;
+ margin-right: 6px;
+ padding: 2px 8px 2px 20px;
+ }
+
+ .cancel {
+ background-position: -7px -377px;
+ float: right;
+ position: relative;
+ text-indent: -5000px;
+ top: -2px;
+ width: 15px;
+ height: 17px;
+ }
+
+ .formlinks {
+ padding: 0 4px;
+ }
+
+ .hide {
+ display: none;
+ }
+
+ .show {
+ display: inner-block;
+ }
+
+ .headerTable {
+ display: table;
+ border-collapse: separate;
+ border-spacing: 2px;
+ border-color: gray;
+ width: 99%;
+ margin: 4px 0;
+ }
+
+ .headerTable td {
+ color: #666;
+ cursor: default;
+ }
+
+ .composeoptionsbox {
+ padding: 4px 8px 0 8px;
+ background: #d2d2d2;
+ border-bottom: 1px solid #e8e8e8;
+ -webkit-box-shadow: 0 2px 3px 0 #999;
+ -moz-box-shadow: 0 2px 3px 0 #999;
+ box-shadow: 0 2px 3px 0 #999;
+ white-space: nowrap;
+ }
+
+ .composeattachments {
+ position: absolute;
+ right: 0;
+ top: 1px;
+ bottom: 0;
+ width: 240px;
+ background: #f0f0f0;
+ border-left: 1px solid #ddd;
+ padding: 8px;
+ overflow: auto;
+ }
+
+ .composebodycontainer {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 260px;
+ bottom: 0;
+ }
+
+ .statusbar {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ height: 27px;
+ padding-left: 8px;
+ border-top: 1px solid #ddd;
+ border-radius: 0 0 4px 4px;
+ background: #eaeaea;
+ background: -moz-linear-gradient(top, #eaeaea 0%, #c8c8c8 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eaeaea),
+ color-stop(100%, #c8c8c8) );
+ 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{}
+ </ui:style>
+ <g:DockLayoutPanel ui:field="thisPanel" unit="PX"
+ addStyleNames="{style.box}">
+ <g:north size="135">
+ <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: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
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,81 @@
+/****************************************************************
+ * 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.ui;
+
+import java.util.List;
+
+import org.apache.hupa.client.HupaController;
+import org.apache.hupa.client.activity.ContactPropertiesActivity;
+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.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.EventBus;
+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.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.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.inject.Inject;
+
+public class ContactPropertiesView extends Composite implements ContactPropertiesActivity.Displayable {
+
+ @Inject HupaRequestFactory rf;
+ @Inject HupaController hc;
+ @Inject EventBus eventBus;
+
+ @UiField TextBox name;
+
+ @UiField ListBox parent;
+ @UiField Button save;
+
+ @UiField VerticalPanel propContainer;
+ @UiField CaptionPanel information;
+
+
+ ImapFolder folder;
+
+ @UiHandler("save")
+ void handleSave(ClickEvent e) {}
+ public ContactPropertiesView() {
+ initWidget(binder.createAndBindUi(this));
+ }
+
+ interface Binder extends UiBinder<DecoratorPanel, ContactPropertiesView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
+ @Override
+ public void cascade(LabelNode labelNode, List<LabelNode> wholeList, int type) {}
+
+ @Override
+ public HasClickHandlers getSave() {
+ return save;
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactPropertiesView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,92 @@
+<!-- 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. -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
+ ui:generateLocales='default'>
+ <ui:style>
+ .propform fieldset {
+ margin-bottom: 20px;
+ border: 0;
+ padding: 0;
+ }
+
+ .propform fieldset legend {
+ display: block;
+ font-size: 14px;
+ font-weight: bold;
+ padding-bottom: 10px;
+ margin-bottom: 0;
+ }
+
+ .propform fieldset fieldset legend {
+ color: #666;
+ font-size: 12px;
+ }
+
+ fieldset.floating {
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ }
+
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ }
+
+ table.attribute {
+ border-spacing: 0;
+ border-collapse: collapse;
+ }
+
+ table.attribute td {
+ width: 80%;
+ padding: 4px 10px;
+ background: #eee;
+ border-bottom: 2px solid #fff;
+ }
+
+ table.noBorder td {
+ 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>
+
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,219 @@
+/****************************************************************
+ * 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.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hupa.client.activity.ContactsListActivity;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.domain.ImapFolder;
+
+import com.google.gwt.cell.client.AbstractCell;
+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.safehtml.shared.SafeHtmlBuilder;
+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.cellview.client.CellList;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.ProvidesKey;
+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 ContactsListView extends Composite implements ContactsListActivity.Displayable {
+
+ @UiField ScrollPanel thisView;
+
+ @UiField Button add;
+ @UiField Button delete;
+
+ public interface Resources extends CellList.Resources {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @Source("res/CssLabelListView.css")
+ public CellList.Style cellListStyle();
+ }
+ @UiHandler("add")
+ public void handleAdd(ClickEvent e) {
+ }
+
+ private final ImapLabelListDataProvider data;
+
+ @Inject
+ public ContactsListView(final HupaRequestFactory rf) {
+ initWidget(binder.createAndBindUi(this));
+ data = new ImapLabelListDataProvider(rf);
+ CellList<LabelNode> 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() {
+ public void onSelectionChange(SelectionChangeEvent event) {
+ }
+ });
+ data.addDataDisplay(cellList);
+ thisView.setWidget(cellList);
+ }
+
+ @Override
+ public SingleSelectionModel<LabelNode> getSelectionModel() {
+ return this.selectionModel;
+ }
+
+ public final SingleSelectionModel<LabelNode> selectionModel = new SingleSelectionModel<LabelNode>(
+ new ProvidesKey<LabelNode>() {
+ @Override
+ public Object getKey(LabelNode item) {
+ return item == null ? null : item.getPath();
+ }
+ });
+
+ static class LabelCell extends AbstractCell<LabelNode> {
+
+ public LabelCell() {
+ }
+
+ @Override
+ public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder sb) {
+ if (value == null) {
+ return;
+ }
+
+ if (value.getFolder().getSubscribed()) {
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ } else {
+ sb.appendHtmlConstant("<span style='color:gray;'>");
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ sb.appendHtmlConstant("</span>");
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+
+ interface Binder extends UiBinder<DockLayoutPanel, ContactsListView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
+ @Override
+ public HasClickHandlers getAdd() {
+ return add;
+ }
+
+ @Override
+ public HasClickHandlers getDelete() {
+ return delete;
+ }
+
+ @Override
+ public void refresh() {
+ data.refresh();
+ }
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ContactsListView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,25 @@
+<!-- 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. -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+ <g:DockLayoutPanel>
+ <g:center>
+ <g:ScrollPanel ui:field="thisView" />
+ </g:center>
+ <g:south size="43">
+ <g:FlowPanel ui:field="folderOpButtons">
+ <g:Button ui:field="add">Add</g:Button>
+ <g:Button ui:field="delete">Delete</g:Button>
+ </g:FlowPanel>
+ </g:south>
+ </g:DockLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Displayable.java (from r1375909, james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Displayable.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Displayable.java&p1=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java&r1=1375909&r2=1516164&rev=1516164&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/Displayable.java Wed Aug 21 14:08:19 2013
@@ -17,14 +17,8 @@
* under the License. *
****************************************************************/
-package org.apache.hupa.client.mvp;
+package org.apache.hupa.client.ui;
-public interface NameAwareWidgetDisplay {
+public interface Displayable {
- /**
- * Return the name for the Display to show
- *
- * @return name
- */
- public String getName();
}
Added: 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=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,307 @@
+/****************************************************************
+ * 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.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hupa.client.HupaController;
+import org.apache.hupa.client.activity.FolderListActivity;
+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;
+<<<<<<< HEAD
+import org.apache.hupa.client.ui.LabelListView.ImapLabelListDataProvider;
+import org.apache.hupa.client.ui.LabelListView.LabelCell;
+import org.apache.hupa.client.ui.LabelListView.Resources;
+import org.apache.hupa.client.ui.RightCellTree.Css;
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import org.apache.hupa.shared.domain.ImapFolder;
+
+import com.google.gwt.cell.client.AbstractCell;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.place.shared.PlaceController;
+<<<<<<< HEAD
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.resources.client.ClientBundle.Source;
+=======
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.cellview.client.CellList;
+<<<<<<< HEAD
+import com.google.gwt.user.cellview.client.CellTree;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.ScrollPanel;
+=======
+import com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy.KeyboardPagingPolicy;
+import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
+import com.google.gwt.user.client.ui.Composite;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.gwt.view.client.ProvidesKey;
+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 {
+<<<<<<< HEAD
+ @UiField ScrollPanel thisView;
+=======
+ @UiField SimplePanel thisView;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ @Inject private HupaController controller;
+ @Inject private ToolBarActivity.Displayable toolBar;
+ @Inject private MessageListActivity.Displayable msgListDisplay;
+ @Inject private PlaceController placeController;
+<<<<<<< HEAD
+ private CellTree cellTree;
+// private FoldersTreeViewModel viewModel;
+=======
+ private CellList<LabelNode> cellList;
+ private ShowMorePagerPanel pagerPanel;
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+
+ public interface Resources extends CellList.Resources {
+
+ Resources INSTANCE = GWT.create(Resources.class);
+
+ @Source("res/CssLabelListView.css")
+ public CellList.Style cellListStyle();
+ }
+<<<<<<< HEAD
+ @Inject
+ public FolderListView(final HupaRequestFactory rf) {
+ initWidget(binder.createAndBindUi(this));
+
+
+ data = new ImapLabelListDataProvider(rf);
+ CellList<LabelNode> cellList = new CellList<LabelNode>(new LabelCell(), Resources.INSTANCE);
+=======
+
+ public static final ProvidesKey<LabelNode> KEY_PROVIDER = new ProvidesKey<LabelNode>() {
+ @Override
+ public Object getKey(LabelNode item) {
+ return item == null ? null : item.getPath();
+ }
+ };
+
+ @Inject
+ public FolderListView(final HupaRequestFactory rf) {
+ initWidget(binder.createAndBindUi(this));
+
+ data = new ImapLabelListDataProvider(rf);
+ pagerPanel = new ShowMorePagerPanel();
+ cellList = new CellList<LabelNode>(new FolderCell(), Resources.INSTANCE, KEY_PROVIDER);
+ cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
+ cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);
+ cellList.setPageSize(100);// ShowMorePagerPanel does not work at present. Therefore, assume one's labels are under one hundred
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ cellList.setSelectionModel(selectionModel);
+ selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+ public void onSelectionChange(SelectionChangeEvent event) {
+ controller.showTopLoading("Loading...");
+ toolBar.enableAllTools(false);
+ placeController.goTo(new FolderPlace(selectionModel.getSelectedObject().getFolder().getFullName()));
+ msgListDisplay.refresh();
+ }
+ });
+ data.addDataDisplay(cellList);
+<<<<<<< HEAD
+ thisView.setWidget(cellList);
+
+// this.viewModel = viewModel;
+
+// cellTree = new CellTree(viewModel,null,Resources.INSTANCE);
+
+
+
+
+// cellTree.setAnimationEnabled(true);
+// thisView.add(cellTree);
+ }
+// public interface Resources extends CellTree.Resources {
+//
+// Resources INSTANCE = GWT.create(Resources.class);
+//
+// @Source("res/CssFolderListView.css")
+// public Css cellTreeStyle();
+//
+// @Source("res/listicons.png")
+// public ImageResource listicons();
+// }
+
+ @Override
+ public void refresh(){
+// viewModel.refresh();
+ }
+
+
+=======
+ pagerPanel.setDisplay(cellList);
+ thisView.setWidget(pagerPanel);
+ }
+
+ @Override
+ public void refresh() {
+ data.refresh();
+ }
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ public final SingleSelectionModel<LabelNode> selectionModel = new SingleSelectionModel<LabelNode>(
+ new ProvidesKey<LabelNode>() {
+ @Override
+ public Object getKey(LabelNode item) {
+ return item == null ? null : item.getPath();
+ }
+ });
+
+<<<<<<< HEAD
+ static class LabelCell extends AbstractCell<LabelNode> {
+
+ public LabelCell() {
+ }
+
+ @Override
+ public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder sb) {
+ if (value == null) {
+ return;
+ }
+
+ if (value.getFolder().getSubscribed()) {
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ } else {
+ sb.appendHtmlConstant("<span style='color:gray;'>");
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ sb.appendHtmlConstant("</span>");
+=======
+ class FolderCell extends AbstractCell<LabelNode> {
+ public FolderCell(String... consumedEvents) {
+ super(consumedEvents);
+ }
+ // TODO different images for each folder
+ @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 {
+ sb.appendHtmlConstant(value.getNameForDisplay());
+ }
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ }
+ }
+ }
+
+ private final ImapLabelListDataProvider data;
+<<<<<<< HEAD
+=======
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ 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 (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);
+ }
+ }
+
+ interface FolderListUiBinder extends UiBinder<SimplePanel, FolderListView> {
+ }
+
+ private static FolderListUiBinder binder = GWT.create(FolderListUiBinder.class);
+
+}
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.ui.xml Wed Aug 21 14:08:19 2013
@@ -0,0 +1,19 @@
+<!-- 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. -->
+
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
+ xmlns:g='urn:import:com.google.gwt.user.client.ui'>
+<<<<<<< HEAD
+ <g:ScrollPanel ui:field="thisView" />
+=======
+ <g:SimplePanel ui:field="thisView" />
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+</ui:UiBinder>
\ No newline at end of file
Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HasRefresh.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HasRefresh.java?rev=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HasRefresh.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HasRefresh.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,5 @@
+package org.apache.hupa.client.ui;
+
+public interface HasRefresh{
+ void refresh();
+}
\ No newline at end of file
Added: 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=1516164&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java Wed Aug 21 14:08:19 2013
@@ -0,0 +1,225 @@
+/****************************************************************
+ * 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.ui;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.gwt.user.client.ui.LayoutPanel;
+import com.google.gwt.user.client.ui.SimpleLayoutPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class HupaLayout implements HupaLayoutable {
+
+ /*
+ * The flag of layout can be defined as any single bit. such as: 0b0001
+ * 0b0010 0b0100, namely, 0x01 0x02 0x04 respectively
+ */
+ public static final int LAYOUT_MESSAGE = 0x01;
+ public static final int LAYOUT_COMPOSE = 0x02;
+ 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;
+
+ private LayoutPanel hupaMainPanel;
+
+ public HupaLayout() {
+ hupaMainPanel = binder.createAndBindUi(this);
+ }
+
+ @Override
+ public LayoutPanel get() {
+ return hupaMainPanel;
+ }
+
+ @Override
+ public void switchTo(int layout) {
+ arrangeLayout(layout);
+ }
+
+ @Override
+ public AcceptsOneWidget getTopBarView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ topBarContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+
+ @Override
+ public AcceptsOneWidget getLogoView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ logoContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+
+ @Override
+ public AcceptsOneWidget getNotificationView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ notificationContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+ @Override
+ public AcceptsOneWidget getNavigationView() {
+ return new AcceptsOneWidget() {
+ @Override
+ public void setWidget(IsWidget w) {
+ navigationContainer.setWidget(Widget.asWidgetOrNull(w));
+ }
+ };
+ }
+
+ @Override
+ public AcceptsOneWidget getToolBarView() {
+ return toolPanel.getToolBarView();
+ }
+
+ @Override
+ public AcceptsOneWidget getComposeView() {
+ return composePanel.getComposeView();
+ }
+
+ @Override
+ public AcceptsOneWidget getComposeToolBarView() {
+ return toolPanel.getComposeToolBarView();
+ }
+<<<<<<< HEAD
+
+=======
+
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ @Override
+ public AcceptsOneWidget getSearchBoxView() {
+ return toolPanel.getSearchBoxView();
+ }
+ @Override
+ public AcceptsOneWidget getFolderListView() {
+ return centerPanel.getFolderListView();
+ }
+ @Override
+ public AcceptsOneWidget getContactListView() {
+ return composePanel.getContactListView();
+ }
+
+ @Override
+ public AcceptsOneWidget getMessageListView() {
+ return centerPanel.getMessageListView();
+ }
+
+ @Override
+ public AcceptsOneWidget getMessageListFooterView() {
+ return centerPanel.getMessageListFooterView();
+ }
+
+ @Override
+ public AcceptsOneWidget getMessageContentView() {
+ return centerPanel.getMessageContentView();
+ }
+
+ @Override
+ public AcceptsOneWidget getStatusView() {
+ return centerPanel.getStatusView();
+ }
+
+ @Override
+ public AcceptsOneWidget getLabelListView() {
+ return settingPanel.getLabelListView();
+ }
+
+ @Override
+<<<<<<< HEAD
+=======
+ public AcceptsOneWidget getSettingNavView() {
+ return settingPanel.getSettingNavView();
+ }
+
+ @Override
+>>>>>>> 7635f4a0e76a4bbbeb6a4029aff92087f00eb09f
+ public AcceptsOneWidget getLabelPropertiesView() {
+ return settingPanel.getLabelPropertiesView();
+ }
+
+ @Override
+ public AcceptsOneWidget getContactsListView() {
+ return contactPanel.getContactListView();
+ }
+
+ @Override
+ public AcceptsOneWidget getContactPropertiesView() {
+ return contactPanel.getContactPropertiesView();
+ }
+
+ private void arrangeLayout(int 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);
+ }
+
+ 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> {
+ }
+
+ private static HupaLayoutUiBinder binder = GWT.create(HupaLayoutUiBinder.class);
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org