Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshLabelListEventHandler.java Wed Aug 21 14:08:19 2013 @@ -17,13 +17,11 @@ * under the License. * ****************************************************************/ -package org.apache.hupa.shared.rpc; +package org.apache.hupa.shared.events; -public class MoveMessageResult extends GenericResult{ +import com.google.gwt.event.shared.EventHandler; - /** - * - */ - private static final long serialVersionUID = 341407423455525004L; +public interface RefreshLabelListEventHandler extends EventHandler{ + public void onRefreshEvent(RefreshLabelListEvent event); }
Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEvent.java Wed Aug 21 14:08:19 2013 @@ -19,31 +19,30 @@ package org.apache.hupa.shared.events; -import org.apache.hupa.shared.data.User; - import com.google.gwt.event.shared.GwtEvent; -public class LoginEvent extends GwtEvent<LoginEventHandler>{ +public class RefreshMessagesEvent extends GwtEvent<RefreshMessagesEventHandler> { + public final static Type<RefreshMessagesEventHandler> TYPE = new Type<RefreshMessagesEventHandler>(); + + private String searchValue; - public final static Type<LoginEventHandler> TYPE = new Type<LoginEventHandler>(); - private User user; - - public LoginEvent(User user) { - this.user = user; - } - - public User getUser() { - return user; - } - - @Override - public Type<LoginEventHandler> getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(LoginEventHandler handler) { - handler.onLogin(this); - } + public String getSearchValue() { + return searchValue; + } + + public RefreshMessagesEvent() { + } + public RefreshMessagesEvent(String searchValue) { + this.searchValue = searchValue; + } + @Override + protected void dispatch(RefreshMessagesEventHandler handler) { + handler.onRefresh(this); + } + + @Override + public com.google.gwt.event.shared.GwtEvent.Type<RefreshMessagesEventHandler> getAssociatedType() { + return TYPE; + } } Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshMessagesEventHandler.java Wed Aug 21 14:08:19 2013 @@ -17,13 +17,11 @@ * under the License. * ****************************************************************/ -package org.apache.hupa.shared.rpc; +package org.apache.hupa.shared.events; -public class MoveMessageResult extends GenericResult{ +import com.google.gwt.event.shared.EventHandler; - /** - * - */ - private static final long serialVersionUID = 341407423455525004L; +public interface RefreshMessagesEventHandler extends EventHandler{ + public void onRefresh(RefreshMessagesEvent event); } Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEvent.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEvent.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEvent.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/LoginEvent.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEvent.java Wed Aug 21 14:08:19 2013 @@ -19,31 +19,18 @@ package org.apache.hupa.shared.events; -import org.apache.hupa.shared.data.User; - import com.google.gwt.event.shared.GwtEvent; -public class LoginEvent extends GwtEvent<LoginEventHandler>{ - - public final static Type<LoginEventHandler> TYPE = new Type<LoginEventHandler>(); - private User user; - - public LoginEvent(User user) { - this.user = user; - } - - public User getUser() { - return user; - } - +public class RefreshUnreadEvent extends GwtEvent<RefreshUnreadEventHandler>{ + public final static Type<RefreshUnreadEventHandler> TYPE = new Type<RefreshUnreadEventHandler>(); @Override - public Type<LoginEventHandler> getAssociatedType() { - return TYPE; + protected void dispatch(RefreshUnreadEventHandler handler) { + handler.onRefreshEvent(this); } @Override - protected void dispatch(LoginEventHandler handler) { - handler.onLogin(this); + public com.google.gwt.event.shared.GwtEvent.Type<RefreshUnreadEventHandler> getAssociatedType() { + return TYPE; } } Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEventHandler.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEventHandler.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEventHandler.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEventHandler.java Wed Aug 21 14:08:19 2013 @@ -17,13 +17,11 @@ * under the License. * ****************************************************************/ -package org.apache.hupa.shared.rpc; +package org.apache.hupa.shared.events; -public class MoveMessageResult extends GenericResult{ +import com.google.gwt.event.shared.EventHandler; - /** - * - */ - private static final long serialVersionUID = 341407423455525004L; +public interface RefreshUnreadEventHandler extends EventHandler{ + public void onRefreshEvent(RefreshUnreadEvent event); } Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ReplyMessageEvent.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ReplyMessageEvent.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ReplyMessageEvent.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ReplyMessageEvent.java Wed Aug 21 14:08:19 2013 @@ -19,10 +19,10 @@ package org.apache.hupa.shared.events; -import org.apache.hupa.shared.data.IMAPFolder; -import org.apache.hupa.shared.data.Message; -import org.apache.hupa.shared.data.MessageDetails; -import org.apache.hupa.shared.data.User; +import org.apache.hupa.shared.domain.ImapFolder; +import org.apache.hupa.shared.domain.Message; +import org.apache.hupa.shared.domain.MessageDetails; +import org.apache.hupa.shared.domain.User; import com.google.gwt.event.shared.GwtEvent; @@ -30,7 +30,7 @@ public class ReplyMessageEvent extends G public final static Type<ReplyMessageEventHandler> TYPE = new Type<ReplyMessageEventHandler>(); private User user; - private IMAPFolder folder; + private ImapFolder folder; private Message message; private MessageDetails details; private boolean replyAll; @@ -45,7 +45,7 @@ public class ReplyMessageEvent extends G return TYPE; } - public ReplyMessageEvent(User user, IMAPFolder folder, Message message, MessageDetails details, boolean replyAll) { + public ReplyMessageEvent(User user, ImapFolder folder, Message message, MessageDetails details, boolean replyAll) { this.user = user; this.folder = folder; this.message = message; @@ -57,7 +57,7 @@ public class ReplyMessageEvent extends G return user; } - public IMAPFolder getFolder() { + public ImapFolder getFolder() { return folder; } Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SessionExpireEvent.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SessionExpireEvent.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SessionExpireEvent.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SessionExpireEvent.java Wed Aug 21 14:08:19 2013 @@ -19,7 +19,7 @@ package org.apache.hupa.shared.events; -import org.apache.hupa.shared.data.User; +import org.apache.hupa.shared.domain.User; import com.google.gwt.event.shared.GwtEvent; Copied: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/HupaException.java (from r1375909, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GetMessageDetailsResult.java) URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/HupaException.java?p2=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/HupaException.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GetMessageDetailsResult.java&r1=1375909&r2=1516164&rev=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GetMessageDetailsResult.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/HupaException.java Wed Aug 21 14:08:19 2013 @@ -1,49 +1,59 @@ -/**************************************************************** - * 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 org.apache.hupa.shared.data.MessageDetails; - -import net.customware.gwt.dispatch.shared.Result; - -public class GetMessageDetailsResult implements Result, Serializable { - - /** - * - */ - private static final long serialVersionUID = 6738085246457556043L; - private MessageDetails message; - - @SuppressWarnings("unused") - private GetMessageDetailsResult() { - - } - - public GetMessageDetailsResult(MessageDetails message) { - this.message = message; - } - - public MessageDetails getMessageDetails() { - return message; - } - -} +/**************************************************************** + * 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.exception; + +import java.io.Serializable; + +/** + * An abstract superclass for exceptions that can be thrown by the Hupa system. + * + * @author echo + */ +@SuppressWarnings("serial") +public class HupaException extends Exception implements Serializable { + + private String causeClassname; + + protected HupaException() { + } + + public HupaException(String message) { + super(message); + } + + public HupaException(Throwable cause) { + super(cause.getMessage()); + this.causeClassname = cause.getClass().getName(); + } + + public HupaException(String message, Throwable cause) { + super(message + " (" + cause.getMessage() + ")"); + this.causeClassname = cause.getClass().getName(); + } + + public String getCauseClassname() { + return causeClassname; + } + + @Override public String toString() { + return super.toString() + (causeClassname != null ? " [cause: " + causeClassname + "]" : ""); + } + +} Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java Wed Aug 21 14:08:19 2013 @@ -1,37 +1,29 @@ -/**************************************************************** - * 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.exception; - -import net.customware.gwt.dispatch.shared.ActionException; - -/** - * - */ -public class InvalidSessionException extends ActionException{ - - /** - * - */ - private static final long serialVersionUID = 995112620968798947L; - - public InvalidSessionException(String msg) { - super(msg); - } -} +/**************************************************************** + * 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.exception; + +public class InvalidSessionException extends HupaException{ + + private static final long serialVersionUID = 995112620968798947L; + + public InvalidSessionException(String message) { + super(message); + } +} Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java (original) +++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ContactsResult.java Wed Aug 21 14:08:19 2013 @@ -21,12 +21,14 @@ package org.apache.hupa.shared.rpc; import java.io.Serializable; -import net.customware.gwt.dispatch.shared.Result; +import com.google.gwt.user.client.rpc.IsSerializable; -public class ContactsResult implements Result, Serializable { - public static class Contact implements Result, Serializable { - private static final long serialVersionUID = -8632580327693416473L; + +public class ContactsResult{ + + public static class Contact implements IsSerializable, Serializable{ + private static final long serialVersionUID = -8632580327693416473L; public String mail; public String realname; @@ -64,7 +66,6 @@ public class ContactsResult implements R } - private static final long serialVersionUID = -8740775403377441876L; private Contact[] contacts; public ContactsResult() { Modified: james/hupa/trunk/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/james/hupa/trunk/src/site/xdoc/index.xml?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/src/site/xdoc/index.xml (original) +++ james/hupa/trunk/src/site/xdoc/index.xml Wed Aug 21 14:08:19 2013 @@ -32,14 +32,14 @@ <section name="Releases"> <p> - Last release is Hupa 0.0.3:<br/> - <a href='http://repo1.maven.org/maven2/org/apache/james/hupa/hupa/0.0.3/hupa-0.0.3.war'> binary </a> : ready to run or to deploy in any servlet container.<br/> - <a href='http://repo1.maven.org/maven2/org/apache/james/hupa/hupa-parent/0.0.3/hupa-parent-0.0.3-source-release.zip'> sources </a>. + Last release is Hupa 0.0.2:<br/> + <a href='http://repo1.maven.org/maven2/org/apache/james/hupa/hupa/0.0.2/hupa-0.0.2.war'> binary </a> : ready to run or to deploy in any servlet container.<br/> + <a href='http://repo1.maven.org/maven2/org/apache/james/hupa/hupa-parent/0.0.2/hupa-parent-0.0.2-source-release.zip'> sources </a>. </p> <p> Current trunk:<br/> - <a href='https://builds.apache.org/job/hupa-trunk/lastBuild/org.apache.james.hupa$hupa/artifact/org.apache.james.hupa/hupa/0.0.4-SNAPSHOT/hupa-0.0.4-SNAPSHOT.war'> - 0.4-SNAPSHOT + <a href='https://builds.apache.org/job/hupa-trunk/lastBuild/org.apache.james.hupa$hupa/artifact/org.apache.james.hupa/hupa/0.0.3-SNAPSHOT/hupa-0.0.3-SNAPSHOT.war'> + 0.3-SNAPSHOT </a> from our continuous integration server. </p> Modified: james/hupa/trunk/widgets/pom.xml URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/pom.xml?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/pom.xml (original) +++ james/hupa/trunk/widgets/pom.xml Wed Aug 21 14:08:19 2013 @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.james.hupa</groupId> <artifactId>hupa-parent</artifactId> - <version>0.0.4-SNAPSHOT</version> + <version>0.0.5-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>hupa-widgets</artifactId> Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/Widgets.gwt.xml URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/Widgets.gwt.xml?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/Widgets.gwt.xml (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/Widgets.gwt.xml Wed Aug 21 14:08:19 2013 @@ -18,9 +18,6 @@ <module> <inherits name='com.google.gwt.user.User'/> <inherits name='com.google.gwt.widgetideas.WidgetIdeas'/> - <inherits name='com.google.gwt.gen2.commonwidget.CommonWidget' /> - <inherits name='com.google.gwt.gen2.table.override.Override'/> - <inherits name='com.google.gwt.gen2.table.ScrollTable'/> <inherits name='org.cobogw.gwt.user.User' /> <source path="widgets"/> Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java Wed Aug 21 14:08:19 2013 @@ -31,185 +31,195 @@ import com.google.gwt.event.logical.shar import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Timer; +import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.HasHTML; import com.google.gwt.user.client.ui.RichTextArea; -import com.google.gwt.user.client.ui.VerticalPanel; - /** * Wysiwyg editor for composing and editing emails in Hupa */ -public class Editor extends VerticalPanel implements HasHTML, Focusable { - - RichTextArea area = new RichTextArea(); - boolean isNewMessage = true; - - public Editor() { - this((ToolbarConstants)GWT.create(ToolbarConstants.class)); - } - - public Editor(ToolbarConstants constants) { - area.ensureDebugId("hupa-editor-area"); - area.setSize("100%", "234px"); - - Toolbar toolbar = new Toolbar(area, constants); - toolbar.ensureDebugId("hupa-editor-toolbar"); - - super.setStyleName("hupa-editor"); - super.add(toolbar); - super.add(area); - super.setWidth("100%"); - - // Note: rich-area is created in an iframe, so Hupa's style sheets - // are not available, unless we inject them to the generated iframe - // - // When body is available, we put the default style for messages: - area.addInitializeHandler(new InitializeHandler() { - public void onInitialize(InitializeEvent event) { - setBodyStyleAttribute("fontFamily", "arial"); - setBodyStyleAttribute("fontSize", "12px"); - } - }); - - // When the users writes in-line comments in replies, the text has to be leftIdented. - // Right now, I've implemented this feature only in gecko browsers, for other browsers - // the user has to push the leftIdent button. - if (getUA().equals("ff")) - addNewlineHandlersForFireFox(); - - } - - @Override - public void setSize(String width, String height) { - area.setSize(width, height); - } - - @Override - public void setWidth(String width){ - area.setWidth(width); - } - - @Override - public void setHeight(String height){ - area.setHeight(height); - } - - public String getHTML() { - return area.getHTML(); - } - - public void setHTML(String html) { - isNewMessage = html.trim().length() > 0; - area.setHTML(html); - } - - public String getText() { - return area.getText(); - } - - public void setText(String text) { - area.setText(text); - } - - public void setBodyStyleAttribute(final String key, final String value) { - DOM.setStyleAttribute(getBody(area.getElement()), key, value); - } - - public int getTabIndex() { - return area.getTabIndex(); - } - - public void setAccessKey(char key) { - area.setAccessKey(key); - } - - public void setFocus(boolean focused) { - area.setFocus(focused); - } - - public void setTabIndex(int index) { - area.setTabIndex(index); - } - - // isEnabled and setEnabled dont work in richtextarea due to a bug, - // I've sent a patch to gwt, when it is accepted this native methods can be - // removed - public void setEnabled(boolean b) { - setEnabled(area.getElement(), b); - } - - public boolean isEnabled() { - return isEnabled(area.getElement()); - } - - private native void setEnabled(Element iframe, boolean b) /*-{ - var doc = iframe.contentWindow.document; - if (doc.body.contentEditable) - doc.body.contentEditable = b; - else - doc.designMode = b ? 'On' : 'Off'; - }-*/; - - private native boolean isEnabled(Element iframe) /*-{ - var doc = iframe.contentWindow.document; - alert((doc.designMode.toUpperCase()) == 'ON'); - if (doc.body.contentEditable) { - alert("editable ???"); - return doc.body.contentEditable; - } else { - var ret = (((doc.designMode).toUpperCase()) == 'ON') ? true : false; - alert(ret); - return ret; - } - }-*/; - - private native Element getBody(Element frame) /*-{ - return frame.contentWindow.document.body; - }-*/; - - private void addNewlineHandlersForFireFox() { - area.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - doNline = true; - } - }); - area.addFocusHandler(new FocusHandler() { - public void onFocus(FocusEvent event) { - doNline = true; - } - }); - area.addKeyPressHandler(new KeyPressHandler() { - public void onKeyPress(KeyPressEvent event) { - if (!isNewMessage) { - if (doNline && event.getCharCode() == KeyCodes.KEY_ENTER) { - doNline = false; - leftIdentTimer.schedule(10); - event.preventDefault(); - } - if (!doNline && (event.getCharCode() == KeyCodes.KEY_DOWN || event.getCharCode() == KeyCodes.KEY_UP)) { - doNline = true; - } - } - } - }); - - } - - boolean doNline = true; - private Timer leftIdentTimer = new Timer(){ - public void run() { - area.getFormatter().insertHTML("<br/>\n"); - area.getFormatter().leftIndent(); - } - }; - - private native String getUA() /*-{ - var ua = navigator.userAgent.toLowerCase(); - if (ua.indexOf("gecko") != -1) - return "ff"; - return "other"; - }-*/; +public class Editor extends FlowPanel implements HasHTML, Focusable { + + RichTextArea area = new RichTextArea(); + boolean isNewMessage = true; + + public Editor() { + this((ToolbarConstants) GWT.create(ToolbarConstants.class)); + } + + public Editor(ToolbarConstants constants) { + area.ensureDebugId("hupa-editor-area"); + area.setHeight("100%"); + +// Toolbar toolbar = new Toolbar(area, constants); +// toolbar.ensureDebugId("hupa-editor-toolbar"); + +// super.add(toolbar); + super.add(area); + setWidth("100%"); + setHeight("100%"); + + /* + * Note: rich-area is created in an iframe, so Hupa's style sheets are + * not available, unless we inject them to the generated iframe + * + * When body is available, we put the default style for messages: + */ + area.addInitializeHandler(new InitializeHandler() { + public void onInitialize(InitializeEvent event) { + setBodyStyleAttribute("fontFamily", "arial"); + setBodyStyleAttribute("fontSize", "12px"); + } + }); + + /* + * When the users writes in-line comments in replies, the text has to be + * leftIdented. Right now, I've implemented this feature only in gecko + * browsers, for other browsers the user has to push the leftIdent + * button. + */ + if (getUA().equals("ff")) + addNewlineHandlersForFireFox(); + + } + + public RichTextArea getArea(){ + return area; + } + + @Override + public void setSize(String width, String height) { + area.setSize(width, height); + } + + @Override + public void setWidth(String width) { + super.setWidth(width); + area.setWidth(width); + } + + @Override + public void setHeight(String height) { + super.setHeight(height); + area.setHeight(height); + } + + public String getHTML() { + return area.getHTML(); + } + + public void setHTML(String html) { + isNewMessage = html.trim().length() > 0; + area.setHTML(html); + } + + public String getText() { + return area.getText(); + } + + public void setText(String text) { + area.setText(text); + } + + public void setBodyStyleAttribute(final String key, final String value) { + DOM.setStyleAttribute(getBody(area.getElement()), key, value); + } + + public int getTabIndex() { + return area.getTabIndex(); + } + + public void setAccessKey(char key) { + area.setAccessKey(key); + } + + public void setFocus(boolean focused) { + area.setFocus(focused); + } + + public void setTabIndex(int index) { + area.setTabIndex(index); + } + + // isEnabled and setEnabled dont work in richtextarea due to a bug, + // I've sent a patch to gwt, when it is accepted this native methods can be + // removed + public void setEnabled(boolean b) { + setEnabled(area.getElement(), b); + } + + public boolean isEnabled() { + return isEnabled(area.getElement()); + } + + private native void setEnabled(Element iframe, boolean b) /*-{ + var doc = iframe.contentWindow.document; + if (doc.body.contentEditable) + doc.body.contentEditable = b; + else + doc.designMode = b ? 'On' : 'Off'; + }-*/; + + private native boolean isEnabled(Element iframe) /*-{ + var doc = iframe.contentWindow.document; + alert((doc.designMode.toUpperCase()) == 'ON'); + if (doc.body.contentEditable) { + alert("editable ???"); + return doc.body.contentEditable; + } else { + var ret = (((doc.designMode).toUpperCase()) == 'ON') ? true : false; + alert(ret); + return ret; + } + }-*/; + + private native Element getBody(Element frame) /*-{ + return frame.contentWindow.document.body; + }-*/; + + private void addNewlineHandlersForFireFox() { + area.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent event) { + doNline = true; + } + }); + area.addFocusHandler(new FocusHandler() { + public void onFocus(FocusEvent event) { + doNline = true; + } + }); + area.addKeyPressHandler(new KeyPressHandler() { + public void onKeyPress(KeyPressEvent event) { + if (!isNewMessage) { + if (doNline && event.getCharCode() == KeyCodes.KEY_ENTER) { + doNline = false; + leftIdentTimer.schedule(10); + event.preventDefault(); + } + if (!doNline + && (event.getCharCode() == KeyCodes.KEY_DOWN || event.getCharCode() == KeyCodes.KEY_UP)) { + doNline = true; + } + } + } + }); + + } + + boolean doNline = true; + private Timer leftIdentTimer = new Timer() { + public void run() { + area.getFormatter().insertHTML("<br/>\n"); + area.getFormatter().leftIndent(); + } + }; + + private native String getUA() /*-{ + var ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf("gecko") != -1) + return "ff"; + return "other"; + }-*/; - } Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/MultiValueSuggestArea.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/MultiValueSuggestArea.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/MultiValueSuggestArea.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/MultiValueSuggestArea.java Wed Aug 21 14:08:19 2013 @@ -19,6 +19,9 @@ package org.apache.hupa.widgets.ui; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Focusable; @@ -49,6 +52,18 @@ public class MultiValueSuggestArea exten // instead of overriding getText and setText from SuggestBox because a bug in the implementation // I've sent a patch to gwt. super(oracle, new TextArea() { + + { + // Avoid entering a new-line when selecting a suggestion element + // TODO: I think this is a bug in GWT SuggestBox which should be reported. + addKeyDownHandler(new KeyDownHandler() { + public void onKeyDown(KeyDownEvent event) { + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + event.preventDefault(); + } + } + }); + } String search = null; @@ -73,12 +88,12 @@ public class MultiValueSuggestArea exten // this methods in the the box implementation @Override public String getValue() { - return DOM.getElementProperty(getTextBox().getElement(), "value"); + return DOM.getElementProperty(getValueBox().getElement(), "value"); } @Override public void setValue(String text) { - DOM.setElementProperty(getTextBox().getElement(), "value", text); + DOM.setElementProperty(getValueBox().getElement(), "value", text); } } Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorCss3.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorCss3.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorCss3.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorCss3.java Wed Aug 21 14:08:19 2013 @@ -1,56 +1,56 @@ -/**************************************************************** - * 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.widgets.ui.impl; - -import org.apache.hupa.widgets.WidgetsCSS; - -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Panel; - -/** - * Simple generator of rounded panels using css. - * It works in FF, safari, chrome and opera. - * - * It is needed to define this in your css. - * <pre> - * div.hupa-rounded { - * border: 1px solid #7FAAFF; - * border-radius: 8px; - * } - * </pre> - * - */ -public class RndPanelGeneratorCss3 implements RndPanelGenerator { - - public Panel roundPanel(Panel panel) { - panel.addStyleName(WidgetsCSS.C_hupa_rnd_container); - return panel; - } - - public FlowPanel createPanel() { - return new FlowPanel() { - @Override - public void setStyleName(String style) { - super.setStyleName(style); - super.addStyleName(WidgetsCSS.C_hupa_rnd_container); - } - }; - } -} +/**************************************************************** + * 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.widgets.ui.impl; + +import org.apache.hupa.widgets.WidgetsCSS; + +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Panel; + +/** + * Simple generator of rounded panels using css. + * It works in FF, safari, chrome and opera. + * + * It is needed to define this in your css. + * <pre> + * div.hupa-rounded { + * border: 1px solid #7FAAFF; + * border-radius: 8px; + * } + * </pre> + * + */ +public class RndPanelGeneratorCss3 implements RndPanelGenerator { + + public Panel roundPanel(Panel panel) { + panel.addStyleName(WidgetsCSS.C_hupa_rnd_container); + return panel; + } + + public FlowPanel createPanel() { + return new FlowPanel() { + @Override + public void setStyleName(String style) { + super.setStyleName(style); + super.addStyleName(WidgetsCSS.C_hupa_rnd_container); + } + }; + } +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorDecorator.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorDecorator.java?rev=1516164&r1=1516163&r2=1516164&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorDecorator.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorDecorator.java Wed Aug 21 14:08:19 2013 @@ -1,40 +1,40 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.hupa.widgets.ui.impl; - -import com.google.gwt.user.client.ui.DecoratorPanel; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Panel; - -/** - * Simple generator of rounded panels using DecoratedPanels in GWT 2.0. - * It works in all browsers - */ -public class RndPanelGeneratorDecorator implements RndPanelGenerator { - public Panel roundPanel(Panel panel) { - DecoratorPanel ret = new DecoratorPanel(); - ret.setWidget(panel); - return ret; - } - - public FlowPanel createPanel() { - return new FlowPanel(); - } -} +/**************************************************************** + * 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.widgets.ui.impl; + +import com.google.gwt.user.client.ui.DecoratorPanel; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Panel; + +/** + * Simple generator of rounded panels using DecoratedPanels in GWT 2.0. + * It works in all browsers + */ +public class RndPanelGeneratorDecorator implements RndPanelGenerator { + public Panel roundPanel(Panel panel) { + DecoratorPanel ret = new DecoratorPanel(); + ret.setWidget(panel); + return ret; + } + + public FlowPanel createPanel() { + return new FlowPanel(); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org