Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTree.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTree.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTree.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTree.java Thu Mar 20 08:16:02 2014 @@ -1,69 +1,69 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.hupa.widgets.ui; - -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.ui.Tree; -import com.google.gwt.user.client.ui.TreeItem; - -/** - * Tree which can holds EditableTreeItem instances - * - * - */ -public class EditableTree extends Tree { - public EditableTree(Tree.Resources images, boolean leaf) { - super(images, leaf); - } - - public EditableTree() { - super(); - } - - public EditableTree(Tree.Resources images) { - super(images); - } - - /** - * Prevent Event.ONCLICK, Event.ONMOUSEDOWN, Event.ONKEYDOWN from bubble down if the item is in editing mode - */ - public void onBrowserEvent(Event event) { - TreeItem item = getSelectedItem(); - - // Check if the selectedItem is Editable and if so make sure the events are not fired - if (item instanceof HasEditable) { - if (item != null && ((HasEditable) item).isEdit()) { - int type = DOM.eventGetType(event); - switch (type) { - case Event.ONCLICK: - return; - case Event.ONMOUSEDOWN: - return; - case Event.ONKEYDOWN: - return; - default: - break; - } - } - } - super.onBrowserEvent(event); - } -} +/**************************************************************** + * 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; + +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Tree; +import com.google.gwt.user.client.ui.TreeItem; + +/** + * Tree which can holds EditableTreeItem instances + * + * + */ +public class EditableTree extends Tree { + public EditableTree(Tree.Resources images, boolean leaf) { + super(images, leaf); + } + + public EditableTree() { + super(); + } + + public EditableTree(Tree.Resources images) { + super(images); + } + + /** + * Prevent Event.ONCLICK, Event.ONMOUSEDOWN, Event.ONKEYDOWN from bubble down if the item is in editing mode + */ + public void onBrowserEvent(Event event) { + TreeItem item = getSelectedItem(); + + // Check if the selectedItem is Editable and if so make sure the events are not fired + if (item instanceof HasEditable) { + if (item != null && ((HasEditable) item).isEdit()) { + int type = DOM.eventGetType(event); + switch (type) { + case Event.ONCLICK: + return; + case Event.ONMOUSEDOWN: + return; + case Event.ONKEYDOWN: + return; + default: + break; + } + } + } + super.onBrowserEvent(event); + } +}
Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTreeItem.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTreeItem.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTreeItem.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EditableTreeItem.java Thu Mar 20 08:16:02 2014 @@ -1,173 +1,173 @@ -/**************************************************************** - * 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; - -import org.apache.hupa.widgets.event.EditEvent; -import org.apache.hupa.widgets.event.EditHandler; - -import com.google.gwt.event.dom.client.BlurEvent; -import com.google.gwt.event.dom.client.BlurHandler; -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.event.shared.HandlerManager; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.HasText; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.TreeItem; -import com.google.gwt.user.client.ui.Widget; - -/** - * TreeItem which supports editing - * - * - */ -public class EditableTreeItem extends TreeItem implements HasEditable,HasEditHandlers{ - protected TextBox editBox = new TextBox(); - protected String oldValue; - protected Widget normalItem = new Label(); - protected HandlerManager manager = new HandlerManager(this); - public EditableTreeItem() { - editBox.setWidth("100px"); - editBox.addKeyDownHandler(new KeyDownHandler() { - - public void onKeyDown(KeyDownEvent event) { - int code = event.getNativeKeyCode(); - switch (code) { - // handle ENTER and ESCAPE keys - case KeyCodes.KEY_ENTER: - stopEdit(); - break; - case KeyCodes.KEY_ESCAPE: - cancelEdit(); - break; - - default: - break; - } - - } - - }); - - // Just cancel the editing if the user click outside the TextBox - editBox.addBlurHandler(new BlurHandler() { - - public void onBlur(BlurEvent event) { - cancelEdit(); - } - - }); - super.setWidget(normalItem); - } - - - @Override - public void setText(String text) { - editBox.setText(text); - ((HasText)normalItem).setText(text); - } - - - @Override - public void setWidget(Widget newWidget) { - if (newWidget instanceof HasText) { - normalItem = newWidget; - super.setWidget(newWidget); - } else { - throw new IllegalArgumentException("Widget need to implement HasText"); - } - } - - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEditable#cancelEdit() - */ - public void cancelEdit() { - showItem(oldValue); - manager.fireEvent(new EditEvent(EditEvent.EventType.Start,oldValue,null)); - } - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEditable#isEdit() - */ - public boolean isEdit() { - return getWidget().equals(editBox); - } - - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEditable#startEdit() - */ - public void startEdit() { - oldValue = getText(); - showEditBox(oldValue); - manager.fireEvent(new EditEvent(EditEvent.EventType.Start,oldValue,null)); - } - - /** - * Show the editbox filled with the given value - * - * @param value - */ - protected void showEditBox(String value) { - super.setWidget(editBox); - editBox.setText(value); - editBox.setCursorPos(value.length()); - editBox.setFocus(true); - } - - - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEditable#stopEdit() - */ - public void stopEdit() { - showItem(editBox.getText()); - manager.fireEvent(new EditEvent(EditEvent.EventType.Stop,oldValue,editBox.getText())); - } - - /** - * Show the "normal" item with the given text - * - * @param text - */ - protected void showItem(String text) { - ((HasText)normalItem).setText(text); - setWidget(normalItem); - } - - @Override - public String getText() { - return ((HasText)normalItem).getText(); - } - - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEditHandlers#addEditHandler(org.apache.hupa.client.widgets.EditHandler) - */ - public HandlerRegistration addEditHandler(EditHandler handler) { - return manager.addHandler(EditEvent.TYPE, handler); - } - - - -} +/**************************************************************** + * 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; + +import org.apache.hupa.widgets.event.EditEvent; +import org.apache.hupa.widgets.event.EditHandler; + +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; +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.event.shared.HandlerManager; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.ui.HasText; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.TreeItem; +import com.google.gwt.user.client.ui.Widget; + +/** + * TreeItem which supports editing + * + * + */ +public class EditableTreeItem extends TreeItem implements HasEditable,HasEditHandlers{ + protected TextBox editBox = new TextBox(); + protected String oldValue; + protected Widget normalItem = new Label(); + protected HandlerManager manager = new HandlerManager(this); + public EditableTreeItem() { + editBox.setWidth("100px"); + editBox.addKeyDownHandler(new KeyDownHandler() { + + public void onKeyDown(KeyDownEvent event) { + int code = event.getNativeKeyCode(); + switch (code) { + // handle ENTER and ESCAPE keys + case KeyCodes.KEY_ENTER: + stopEdit(); + break; + case KeyCodes.KEY_ESCAPE: + cancelEdit(); + break; + + default: + break; + } + + } + + }); + + // Just cancel the editing if the user click outside the TextBox + editBox.addBlurHandler(new BlurHandler() { + + public void onBlur(BlurEvent event) { + cancelEdit(); + } + + }); + super.setWidget(normalItem); + } + + + @Override + public void setText(String text) { + editBox.setText(text); + ((HasText)normalItem).setText(text); + } + + + @Override + public void setWidget(Widget newWidget) { + if (newWidget instanceof HasText) { + normalItem = newWidget; + super.setWidget(newWidget); + } else { + throw new IllegalArgumentException("Widget need to implement HasText"); + } + } + + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEditable#cancelEdit() + */ + public void cancelEdit() { + showItem(oldValue); + manager.fireEvent(new EditEvent(EditEvent.EventType.Start,oldValue,null)); + } + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEditable#isEdit() + */ + public boolean isEdit() { + return getWidget().equals(editBox); + } + + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEditable#startEdit() + */ + public void startEdit() { + oldValue = getText(); + showEditBox(oldValue); + manager.fireEvent(new EditEvent(EditEvent.EventType.Start,oldValue,null)); + } + + /** + * Show the editbox filled with the given value + * + * @param value + */ + protected void showEditBox(String value) { + super.setWidget(editBox); + editBox.setText(value); + editBox.setCursorPos(value.length()); + editBox.setFocus(true); + } + + + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEditable#stopEdit() + */ + public void stopEdit() { + showItem(editBox.getText()); + manager.fireEvent(new EditEvent(EditEvent.EventType.Stop,oldValue,editBox.getText())); + } + + /** + * Show the "normal" item with the given text + * + * @param text + */ + protected void showItem(String text) { + ((HasText)normalItem).setText(text); + setWidget(normalItem); + } + + @Override + public String getText() { + return ((HasText)normalItem).getText(); + } + + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEditHandlers#addEditHandler(org.apache.hupa.client.widgets.EditHandler) + */ + public HandlerRegistration addEditHandler(EditHandler handler) { + return manager.addHandler(EditEvent.TYPE, handler); + } + + + +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EnableHyperlink.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EnableHyperlink.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EnableHyperlink.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/EnableHyperlink.java Thu Mar 20 08:16:02 2014 @@ -1,137 +1,137 @@ -/**************************************************************** - * 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; - - -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.HasHTML; -import com.google.gwt.user.client.ui.HasText; -import com.google.gwt.user.client.ui.Hyperlink; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.Widget; - -import org.apache.hupa.widgets.WidgetsCSS; - -/** - * Hyperlink which can get enabled/disabled. - * - * CSS rules: - * <pre> - .hupa-hyperlink .gwt-Hyperlink { - color: #0d0eb0; - text-decoration: underline; - cursor: default; - } - .hupa-hyperlink .gwt-Hyperlink-disabled { - color: #8d8d8d; - } - * </pre> - */ -public class EnableHyperlink extends Composite implements HasClickHandlers,HasHTML,HasText, HasEnable{ - - private SimplePanel panel = new SimplePanel(); - private Widget link; - private HTML html; - - public EnableHyperlink(String text) { - this(text, false, null); - } - - public EnableHyperlink(String text, String historyToken) { - this(text, false, historyToken); - } - - public EnableHyperlink(String text, boolean asHTML, String historyToken) { - - link = historyToken != null ? new Hyperlink(text, asHTML, historyToken) : new Anchor(text); - html = new HTML(); - - panel.setStyleName(WidgetsCSS.C_hyperlink); - html.setStyleName(link.getStyleName()); - html.addStyleDependentName("disabled"); - - if (asHTML) { - html.setHTML(text); - } else { - html.setText(text); - } - - panel.setWidget(link); - initWidget(panel); - } - /* - * (non-Javadoc) - * @see com.google.gwt.event.dom.client.HasClickHandlers#addClickHandler(com.google.gwt.event.dom.client.ClickHandler) - */ - public HandlerRegistration addClickHandler(ClickHandler handler) { - return ((HasClickHandlers)link).addClickHandler(handler); - } - - /* - * (non-Javadoc) - * @see com.google.gwt.user.client.ui.HasText#getText() - */ - public String getText() { - return ((HasHTML)link).getText(); - } - - /* - * (non-Javadoc) - * @see com.google.gwt.user.client.ui.HasText#setText(java.lang.String) - */ - public void setText(String text) { - ((HasHTML)link).setText(text); - html.setText(text); - } - - /* - * (non-Javadoc) - * @see com.google.gwt.user.client.ui.HasHTML#getHTML() - */ - public String getHTML() { - return ((HasHTML)link).getHTML(); - } - - /* - * (non-Javadoc) - * @see com.google.gwt.user.client.ui.HasHTML#setHTML(java.lang.String) - */ - public void setHTML(String html) { - this.html.setHTML(html); - } - - /* - * (non-Javadoc) - * @see org.apache.hupa.client.widgets.HasEnable#setEnabled(boolean) - */ - public void setEnabled(boolean enable) { - if (enable) { - panel.setWidget(link); - } else { - panel.setWidget(html); - } - } - -} +/**************************************************************** + * 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; + + +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.ui.Anchor; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.HasHTML; +import com.google.gwt.user.client.ui.HasText; +import com.google.gwt.user.client.ui.Hyperlink; +import com.google.gwt.user.client.ui.SimplePanel; +import com.google.gwt.user.client.ui.Widget; + +import org.apache.hupa.widgets.WidgetsCSS; + +/** + * Hyperlink which can get enabled/disabled. + * + * CSS rules: + * <pre> + .hupa-hyperlink .gwt-Hyperlink { + color: #0d0eb0; + text-decoration: underline; + cursor: default; + } + .hupa-hyperlink .gwt-Hyperlink-disabled { + color: #8d8d8d; + } + * </pre> + */ +public class EnableHyperlink extends Composite implements HasClickHandlers,HasHTML,HasText, HasEnable{ + + private SimplePanel panel = new SimplePanel(); + private Widget link; + private HTML html; + + public EnableHyperlink(String text) { + this(text, false, null); + } + + public EnableHyperlink(String text, String historyToken) { + this(text, false, historyToken); + } + + public EnableHyperlink(String text, boolean asHTML, String historyToken) { + + link = historyToken != null ? new Hyperlink(text, asHTML, historyToken) : new Anchor(text); + html = new HTML(); + + panel.setStyleName(WidgetsCSS.C_hyperlink); + html.setStyleName(link.getStyleName()); + html.addStyleDependentName("disabled"); + + if (asHTML) { + html.setHTML(text); + } else { + html.setText(text); + } + + panel.setWidget(link); + initWidget(panel); + } + /* + * (non-Javadoc) + * @see com.google.gwt.event.dom.client.HasClickHandlers#addClickHandler(com.google.gwt.event.dom.client.ClickHandler) + */ + public HandlerRegistration addClickHandler(ClickHandler handler) { + return ((HasClickHandlers)link).addClickHandler(handler); + } + + /* + * (non-Javadoc) + * @see com.google.gwt.user.client.ui.HasText#getText() + */ + public String getText() { + return ((HasHTML)link).getText(); + } + + /* + * (non-Javadoc) + * @see com.google.gwt.user.client.ui.HasText#setText(java.lang.String) + */ + public void setText(String text) { + ((HasHTML)link).setText(text); + html.setText(text); + } + + /* + * (non-Javadoc) + * @see com.google.gwt.user.client.ui.HasHTML#getHTML() + */ + public String getHTML() { + return ((HasHTML)link).getHTML(); + } + + /* + * (non-Javadoc) + * @see com.google.gwt.user.client.ui.HasHTML#setHTML(java.lang.String) + */ + public void setHTML(String html) { + this.html.setHTML(html); + } + + /* + * (non-Javadoc) + * @see org.apache.hupa.client.widgets.HasEnable#setEnabled(boolean) + */ + public void setEnabled(boolean enable) { + if (enable) { + panel.setWidget(link); + } else { + panel.setWidget(html); + } + } + +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditHandlers.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditHandlers.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditHandlers.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditHandlers.java Thu Mar 20 08:16:02 2014 @@ -1,29 +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.widgets.ui; - -import org.apache.hupa.widgets.event.EditHandler; - -import com.google.gwt.event.shared.HandlerRegistration; - -public interface HasEditHandlers { - - public HandlerRegistration addEditHandler(EditHandler handler); -} +/**************************************************************** + * 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; + +import org.apache.hupa.widgets.event.EditHandler; + +import com.google.gwt.event.shared.HandlerRegistration; + +public interface HasEditHandlers { + + public HandlerRegistration addEditHandler(EditHandler handler); +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditable.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditable.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditable.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEditable.java Thu Mar 20 08:16:02 2014 @@ -1,50 +1,50 @@ -/**************************************************************** - * 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; - -/** - * Classes which implements this interface support editing - * - * - */ -public interface HasEditable { - - /** - * Start editing - */ - public void startEdit(); - - /** - * Cancel editing - */ - public void cancelEdit(); - - /** - * Stop editing - */ - public void stopEdit(); - - /** - * Return if editing is currently active - * - * @return editing - */ - public boolean isEdit(); -} +/**************************************************************** + * 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; + +/** + * Classes which implements this interface support editing + * + * + */ +public interface HasEditable { + + /** + * Start editing + */ + public void startEdit(); + + /** + * Cancel editing + */ + public void cancelEdit(); + + /** + * Stop editing + */ + public void stopEdit(); + + /** + * Return if editing is currently active + * + * @return editing + */ + public boolean isEdit(); +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEnable.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEnable.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEnable.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/HasEnable.java Thu Mar 20 08:16:02 2014 @@ -20,14 +20,14 @@ package org.apache.hupa.widgets.ui; /** - * Support enable/disable + * Support enable/disable * */ public interface HasEnable { /** - * Enable or disable - * + * Enable or disable + * * @param enable */ public void setEnabled(boolean enable); Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/Loading.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/Loading.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/Loading.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/Loading.java Thu Mar 20 08:16:02 2014 @@ -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; - -import org.apache.hupa.widgets.WidgetsCSS; - -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTML; - -/** - * Widget which shows a Loading state - * - */ -public class Loading extends Composite { - - public Loading(String loadingMsg) { - initWidget(new HTML(loadingMsg)); - addStyleName(WidgetsCSS.C_loading); - } - - public Loading() { - this(""); - } - - /** - * Show the Loading image - */ - public void show() { - setVisible(true); - } - - /** - * Hide the Loading image - */ - public void hide() { - setVisible(false); - } - -} +/**************************************************************** + * 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; + +import org.apache.hupa.widgets.WidgetsCSS; + +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTML; + +/** + * Widget which shows a Loading state + * + */ +public class Loading extends Composite { + + public Loading(String loadingMsg) { + initWidget(new HTML(loadingMsg)); + addStyleName(WidgetsCSS.C_loading); + } + + public Loading() { + this(""); + } + + /** + * Show the Loading image + */ + public void show() { + setVisible(true); + } + + /** + * Hide the Loading image + */ + public void hide() { + setVisible(false); + } + +} 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=1579559&r1=1579558&r2=1579559&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 Thu Mar 20 08:16:02 2014 @@ -34,7 +34,7 @@ import com.google.gwt.user.client.ui.Tex /** * A text-area which shows a pop-up with suggestions. * Different values in the text area are separated by comma. - * + * * @author manolo */ public class MultiValueSuggestArea extends Composite implements HasText, Focusable { @@ -42,7 +42,7 @@ public class MultiValueSuggestArea exten /** * It is necessary to modify the behavior of the default SuggestBox, because * it look for items which match the entire text in the box. - * + * * @author manolo */ private class CustomSuggestBox extends SuggestBox { @@ -52,7 +52,7 @@ 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. @@ -66,12 +66,12 @@ public class MultiValueSuggestArea exten } String search = null; - + @Override public String getText() { return search = super.getText().replaceFirst("\\s+$", "").replaceFirst("^\\s+","").replaceAll("[\\s;]", ",").replaceFirst("^.+,", ""); } - + @Override public void setText(String text) { if (text.trim().length() > 0) { @@ -79,12 +79,12 @@ public class MultiValueSuggestArea exten super.setText(actual + text + ", "); } } - + }); } // We have to use getValue and setValue to get/set the entire text of the textarea - // because setText and getText have different behavior since we have modified + // because setText and getText have different behavior since we have modified // this methods in the the box implementation @Override public String getValue() { Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/NumberOnlyTextBox.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/NumberOnlyTextBox.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/NumberOnlyTextBox.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/NumberOnlyTextBox.java Thu Mar 20 08:16:02 2014 @@ -24,12 +24,12 @@ import com.google.gwt.event.dom.client.K import com.google.gwt.user.client.ui.TextBox; /** - * TextBox which only allows numbers to get entered - * + * TextBox which only allows numbers to get entered + * * */ public class NumberOnlyTextBox extends TextBox implements KeyPressHandler{ - + public NumberOnlyTextBox() { addKeyPressHandler(this); } @@ -42,7 +42,7 @@ public class NumberOnlyTextBox extends T char keyCode = event.getCharCode(); if (!Character.isDigit(keyCode)) { cancelKey(); - } + } } - + } Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RndPanel.java Thu Mar 20 08:16:02 2014 @@ -1,75 +1,75 @@ -/**************************************************************** - * 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; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Widget; - -import org.apache.hupa.widgets.ui.impl.RndPanelGenerator; - -/** - * Widget which renders a rounded panel. - * - * This is here because IE doesn't support rounded borders in css, - * so it is needed to wrap the container with additional html elements. - * - * For other browsers this class just produces a class-named FlowPanel. - * - */ -public class RndPanel extends Composite { - - private static final RndPanelGenerator impl = GWT.create(RndPanelGenerator.class); - - private FlowPanel panel = new FlowPanel(); - - public RndPanel() { - panel = impl.createPanel(); - initWidget(impl.roundPanel(panel)); - } - - public void add(Widget child) { - panel.add(child); - } - - public void insert(Widget w, int beforeIndex) { - panel.insert(w, beforeIndex); - } - - public void clear() { - panel.clear(); - } - - public boolean remove(Widget w) { - return panel.remove(w); - } - - public void setWidget(Widget w) { - panel.clear(); - panel.add(w); - } - - @Override - public void addStyleName(String style) { - getWidget().addStyleName(style); - } - -} +/**************************************************************** + * 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; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.Widget; + +import org.apache.hupa.widgets.ui.impl.RndPanelGenerator; + +/** + * Widget which renders a rounded panel. + * + * This is here because IE doesn't support rounded borders in css, + * so it is needed to wrap the container with additional html elements. + * + * For other browsers this class just produces a class-named FlowPanel. + * + */ +public class RndPanel extends Composite { + + private static final RndPanelGenerator impl = GWT.create(RndPanelGenerator.class); + + private FlowPanel panel = new FlowPanel(); + + public RndPanel() { + panel = impl.createPanel(); + initWidget(impl.roundPanel(panel)); + } + + public void add(Widget child) { + panel.add(child); + } + + public void insert(Widget w, int beforeIndex) { + panel.insert(w, beforeIndex); + } + + public void clear() { + panel.clear(); + } + + public boolean remove(Widget w) { + return panel.remove(w); + } + + public void setWidget(Widget w) { + panel.clear(); + panel.add(w); + } + + @Override + public void addStyleName(String style) { + getWidget().addStyleName(style); + } + +} Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/ToolTip.java URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/ToolTip.java?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/ToolTip.java (original) +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/ToolTip.java Thu Mar 20 08:16:02 2014 @@ -38,7 +38,7 @@ import com.google.gwt.user.client.ui.Wid /** * A ToolTip which is shown a configured time before get destroyed - * + * * */ public class ToolTip extends Label { @@ -52,7 +52,7 @@ public class ToolTip extends Label { popup.setPopupPosition(y,x); popup.show(); } - + }; public <T extends Widget & HasMouseOverHandlers & HasMouseOutHandlers & HasMouseMoveHandlers> ToolTip(final T w) { @@ -61,7 +61,7 @@ public class ToolTip extends Label { public void onMouseOver(MouseOverEvent event) { showTimer.schedule(1000); } - + }); w.addMouseOutHandler(new MouseOutHandler() { @@ -70,7 +70,7 @@ public class ToolTip extends Label { showTimer.cancel(); popup.hide(); } - + }); w.addMouseMoveHandler(new MouseMoveHandler() { @@ -79,25 +79,25 @@ public class ToolTip extends Label { y = event.getScreenY(); x = w.getAbsoluteTop() + w.getOffsetHeight(); } - + }); popup.addCloseHandler(new CloseHandler<PopupPanel>() { public void onClose(CloseEvent<PopupPanel> event) { showTimer.cancel(); } - + }); addStyleName("hupa-ToolTip"); popup.addStyleName("hupa-ToolTip"); popup.setAnimationEnabled(true); popup.setAutoHideEnabled(true); } - + public void setText(String text) { super.setText(text); popup.setWidget(this); } - - + + } 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=1579559&r1=1579558&r2=1579559&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 Thu Mar 20 08:16:02 2014 @@ -27,11 +27,11 @@ import com.google.gwt.user.client.ui.Pan /** * 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: 1px solid #7FAAFF; * border-radius: 8px; * } * </pre> Modified: james/hupa/trunk/widgets/src/site/site.xml URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/site/site.xml?rev=1579559&r1=1579558&r2=1579559&view=diff ============================================================================== --- james/hupa/trunk/widgets/src/site/site.xml (original) +++ james/hupa/trunk/widgets/src/site/site.xml Thu Mar 20 08:16:02 2014 @@ -1,27 +1,27 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- - 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. ---> -<project name="Hupa"> - <body> - <!-- This is a "dummy" site because of this bug: --> - <!-- http://jira.codehaus.org/browse/MSITE-345 --> - <menu ref="parent" /> - <menu ref="reports" /> - </body> -</project> +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + 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. +--> +<project name="Hupa"> + <body> + <!-- This is a "dummy" site because of this bug: --> + <!-- http://jira.codehaus.org/browse/MSITE-345 --> + <menu ref="parent" /> + <menu ref="reports" /> + </body> +</project> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
