svn changeset:8619/svn branch:6.1tags/6.7.0.beta1
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -8,6 +8,8 @@ import java.util.Date; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
@@ -15,8 +17,6 @@ import com.google.gwt.user.client.ui.FlexTable; | |||
import com.google.gwt.user.client.ui.MouseListener; | |||
import com.google.gwt.user.client.ui.MouseListenerCollection; | |||
import com.google.gwt.user.client.ui.SourcesMouseEvents; | |||
import com.google.gwt.user.client.ui.SourcesTableEvents; | |||
import com.google.gwt.user.client.ui.TableListener; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.DateTimeService; | |||
import com.vaadin.terminal.gwt.client.LocaleService; | |||
@@ -53,13 +53,13 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
datefield = parent; | |||
setStyleName(VDateField.CLASSNAME + "-calendarpanel"); | |||
// buildCalendar(true); | |||
days.addTableListener(new DateClickListener(this)); | |||
days.addClickHandler(new DateClickHandler(this)); | |||
} | |||
public VCalendarPanel(VDateField parent, Date min, Date max) { | |||
datefield = parent; | |||
setStyleName(VDateField.CLASSNAME + "-calendarpanel"); | |||
days.addTableListener(new DateClickListener(this)); | |||
days.addClickHandler(new DateClickHandler(this)); | |||
} | |||
@@ -263,7 +263,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
} | |||
/** | |||
* | |||
* | |||
* @param forceRedraw | |||
* Build all from scratch, in case of e.g. locale changes | |||
*/ | |||
@@ -426,8 +426,6 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
switch (DOM.eventGetType(event)) { | |||
case Event.ONMOUSEDOWN: | |||
case Event.ONMOUSEUP: | |||
case Event.ONMOUSEMOVE: | |||
case Event.ONMOUSEOVER: | |||
case Event.ONMOUSEOUT: | |||
if (mouseListeners != null) { | |||
mouseListeners.fireMouseEvent(this, event); | |||
@@ -437,21 +435,25 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
} | |||
} | |||
private class DateClickListener implements TableListener { | |||
private class DateClickHandler implements ClickHandler { | |||
private final VCalendarPanel cal; | |||
public DateClickListener(VCalendarPanel panel) { | |||
public DateClickHandler(VCalendarPanel panel) { | |||
cal = panel; | |||
} | |||
public void onCellClicked(SourcesTableEvents sender, int row, int col) { | |||
if (sender != cal.days || row < 1 || row > 6 | |||
public void onClick(ClickEvent event) { | |||
Object sender = event.getSource(); | |||
Cell cell = cal.days.getCellForEvent(event); | |||
if (sender != cal.days || cell == null || cell.getRowIndex() < 1 | |||
|| cell.getRowIndex() > 6 | |||
|| !cal.datefield.isEnabled() || cal.datefield.isReadonly()) { | |||
return; | |||
} | |||
final String text = cal.days.getText(row, col); | |||
final String text = cal.days.getText(cell.getRowIndex(), cell | |||
.getCellIndex()); | |||
if (text.equals(" ")) { | |||
return; | |||
} | |||
@@ -538,7 +540,7 @@ public class VCalendarPanel extends FlexTable implements MouseListener { | |||
/** | |||
* Sets focus to Calendar panel. | |||
* | |||
* | |||
* @param focus | |||
*/ | |||
public void setFocus(boolean focus) { |
@@ -23,6 +23,8 @@ import com.google.gwt.event.dom.client.KeyUpEvent; | |||
import com.google.gwt.event.dom.client.KeyUpHandler; | |||
import com.google.gwt.event.dom.client.LoadEvent; | |||
import com.google.gwt.event.dom.client.LoadHandler; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
@@ -32,7 +34,6 @@ import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.Image; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.TextBox; | |||
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; | |||
@@ -97,7 +98,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
} | |||
public class SuggestionPopup extends VOverlay implements PositionCallback, | |||
PopupListener { | |||
CloseHandler<PopupPanel> { | |||
private static final String Z_INDEX = "30000"; | |||
@@ -133,7 +134,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
DOM.appendChild(root, status); | |||
DOM.setElementProperty(status, "className", CLASSNAME + "-status"); | |||
addPopupListener(this); | |||
addCloseHandler(this); | |||
} | |||
public void showSuggestions( | |||
@@ -374,8 +375,8 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
return (lastAutoClosed > 0 && (now - lastAutoClosed) < 200); | |||
} | |||
public void onPopupClosed(PopupPanel sender, boolean autoClosed) { | |||
if (autoClosed) { | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
if (event.isAutoClosed()) { | |||
lastAutoClosed = (new Date()).getTime(); | |||
} | |||
} |
@@ -7,9 +7,9 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.ListBox; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
@@ -29,7 +29,7 @@ public class VListSelect extends VOptionGroupBase { | |||
super(new TooltipListBox(true), CLASSNAME); | |||
select = (TooltipListBox) optionsContainer; | |||
select.setSelect(this); | |||
select.addChangeListener(this); | |||
select.addChangeHandler(this); | |||
select.addClickHandler(this); | |||
select.setStyleName(CLASSNAME + "-select"); | |||
select.setVisibleItemCount(VISIBLE_COUNT); | |||
@@ -71,7 +71,7 @@ public class VListSelect extends VOptionGroupBase { | |||
} | |||
@Override | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
final int si = select.getSelectedIndex(); | |||
if (si == -1 && !isNullSelectionAllowed()) { | |||
select.setSelectedIndex(lastSelectedIndex); |
@@ -5,13 +5,14 @@ import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Stack; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.DeferredCommand; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.HasHTML; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.UIObject; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -19,7 +20,8 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
public class VMenuBar extends Widget implements Paintable, | |||
CloseHandler<PopupPanel> { | |||
/** Set the CSS class name to allow styling. */ | |||
public static final String CLASSNAME = "v-menubar"; | |||
@@ -81,7 +83,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* This method must be implemented to update the client-side component from | |||
* UIDL data received from server. | |||
* | |||
* | |||
* This method is called when the page is loaded for the first time, and | |||
* every time UI changes in the component are received from the server. | |||
*/ | |||
@@ -235,7 +237,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* This is called by the items in the menu and it communicates the | |||
* information to the server | |||
* | |||
* | |||
* @param clickedItemId | |||
* id of the item that was clicked | |||
*/ | |||
@@ -272,7 +274,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Returns the containing element of the menu | |||
* | |||
* | |||
* @return | |||
*/ | |||
public Element getContainingElement() { | |||
@@ -281,7 +283,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Returns a new child element to add an item to | |||
* | |||
* | |||
* @return | |||
*/ | |||
public Element getNewChildElement() { | |||
@@ -297,7 +299,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Add a new item to this menu | |||
* | |||
* | |||
* @param html | |||
* items text | |||
* @param cmd | |||
@@ -312,7 +314,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Add a new item to this menu | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void addItem(CustomMenuItem item) { | |||
@@ -324,7 +326,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Remove the given item from this menu | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void removeItem(CustomMenuItem item) { | |||
@@ -375,7 +377,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* When an item is clicked | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void itemClick(CustomMenuItem item) { | |||
@@ -400,7 +402,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* When the user hovers the mouse over the item | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void itemOver(CustomMenuItem item) { | |||
@@ -421,7 +423,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* When the mouse is moved away from an item | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void itemOut(CustomMenuItem item) { | |||
@@ -434,13 +436,13 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Shows the child menu of an item. The caller must ensure that the item has | |||
* a submenu. | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void showChildMenu(CustomMenuItem item) { | |||
popup = new VOverlay(true, false, true); | |||
popup.setWidget(item.getSubMenu()); | |||
popup.addPopupListener(this); | |||
popup.addCloseHandler(this); | |||
if (subMenu) { | |||
popup.setPopupPosition(item.getParentMenu().getAbsoluteLeft() | |||
@@ -461,7 +463,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Hides the submenu of an item | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void hideChildMenu(CustomMenuItem item) { | |||
@@ -509,7 +511,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Returns the parent menu of this menu, or null if this is the top-level | |||
* menu | |||
* | |||
* | |||
* @return | |||
*/ | |||
public VMenuBar getParentMenu() { | |||
@@ -518,7 +520,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Set the parent menu of this menu | |||
* | |||
* | |||
* @param parent | |||
*/ | |||
public void setParentMenu(VMenuBar parent) { | |||
@@ -528,7 +530,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Returns the currently selected item of this menu, or null if nothing is | |||
* selected | |||
* | |||
* | |||
* @return | |||
*/ | |||
public CustomMenuItem getSelected() { | |||
@@ -537,7 +539,7 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Set the currently selected item of this menu | |||
* | |||
* | |||
* @param item | |||
*/ | |||
public void setSelected(CustomMenuItem item) { | |||
@@ -556,9 +558,9 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
/** | |||
* Listener method, fired when this menu is closed | |||
*/ | |||
public void onPopupClosed(PopupPanel sender, boolean autoClosed) { | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
hideChildren(); | |||
if (autoClosed) { | |||
if (event.isAutoClosed()) { | |||
hideParents(); | |||
} | |||
// setSelected(null); | |||
@@ -568,9 +570,9 @@ public class VMenuBar extends Widget implements Paintable, PopupListener { | |||
} | |||
/** | |||
* | |||
* | |||
* A class to hold information on menu items | |||
* | |||
* | |||
*/ | |||
private class CustomMenuItem extends UIObject implements HasHTML { | |||
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -7,7 +7,7 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
@@ -23,7 +23,7 @@ public class VNativeSelect extends VOptionGroupBase implements Field { | |||
select = (TooltipListBox) optionsContainer; | |||
select.setSelect(this); | |||
select.setVisibleItemCount(1); | |||
select.addChangeListener(this); | |||
select.addChangeHandler(this); | |||
select.setStyleName(CLASSNAME + "-select"); | |||
} | |||
@@ -72,7 +72,7 @@ public class VNativeSelect extends VOptionGroupBase implements Field { | |||
} | |||
@Override | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
if (select.isMultipleSelect()) { | |||
client.updateVariable(id, "selected", getSelectedItems(), |
@@ -47,7 +47,7 @@ public class VOptionGroup extends VOptionGroupBase { | |||
op.setStyleName("v-radiobutton"); | |||
} | |||
op.addStyleName(CLASSNAME_OPTION); | |||
op.setChecked(opUidl.getBooleanAttribute("selected")); | |||
op.setValue(opUidl.getBooleanAttribute("selected")); | |||
op.setEnabled(!opUidl.getBooleanAttribute("disabled") | |||
&& !isReadonly() && !isDisabled()); | |||
op.addClickHandler(this); |
@@ -6,12 +6,13 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.Set; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.event.dom.client.ChangeHandler; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyCodes; | |||
import com.google.gwt.event.dom.client.KeyPressEvent; | |||
import com.google.gwt.event.dom.client.KeyPressHandler; | |||
import com.google.gwt.user.client.ui.ChangeListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.Panel; | |||
@@ -22,7 +23,7 @@ import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
ClickHandler, ChangeListener, KeyPressHandler, Focusable { | |||
ClickHandler, ChangeHandler, KeyPressHandler, Focusable { | |||
public static final String CLASSNAME_OPTION = "v-select-option"; | |||
@@ -194,7 +195,7 @@ abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
} | |||
} | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
if (multiselect) { | |||
client | |||
.updateVariable(id, "selected", getSelectedItems(), |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -6,9 +6,10 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.animation.client.Animation; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
@@ -41,7 +42,7 @@ public class VOverlay extends PopupPanel { | |||
/** | |||
* The HTML snippet that is used to render the actual shadow. In consists of | |||
* nine different DIV-elements with the following class names: | |||
* | |||
* | |||
* <pre> | |||
* .v-shadow[-stylename] | |||
* ---------------------------------------------- | |||
@@ -54,7 +55,7 @@ public class VOverlay extends PopupPanel { | |||
* | .bottom-left | .bottom | .bottom-right | | |||
* ---------------------------------------------- | |||
* </pre> | |||
* | |||
* | |||
* See default theme 'shadow.css' for implementation example. | |||
*/ | |||
private static final String SHADOW_HTML = "<div class=\"top-left\"></div><div class=\"top\"></div><div class=\"top-right\"></div><div class=\"left\"></div><div class=\"center\"></div><div class=\"right\"></div><div class=\"bottom-left\"></div><div class=\"bottom\"></div><div class=\"bottom-right\"></div>"; | |||
@@ -82,8 +83,8 @@ public class VOverlay extends PopupPanel { | |||
shadow.setInnerHTML(SHADOW_HTML); | |||
DOM.setStyleAttribute(shadow, "position", "absolute"); | |||
addPopupListener(new PopupListener() { | |||
public void onPopupClosed(PopupPanel sender, boolean autoClosed) { | |||
addCloseHandler(new CloseHandler<PopupPanel>() { | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
if (shadow.getParentElement() != null) { | |||
shadow.getParentElement().removeChild(shadow); | |||
} | |||
@@ -99,7 +100,7 @@ public class VOverlay extends PopupPanel { | |||
/** | |||
* Set the z-index (visual stack position) for this overlay. | |||
* | |||
* | |||
* @param zIndex | |||
* The new z-index | |||
*/ | |||
@@ -115,7 +116,7 @@ public class VOverlay extends PopupPanel { | |||
/** | |||
* Get the z-index (visual stack position) of this overlay. | |||
* | |||
* | |||
* @return The z-index for this overlay. | |||
*/ | |||
private int getZIndex() { | |||
@@ -162,7 +163,7 @@ public class VOverlay extends PopupPanel { | |||
private native void adjustIE6Frame(Element popup, int zindex) | |||
/*-{ | |||
// relies on PopupImplIE6 | |||
if(popup.__frame) | |||
if(popup.__frame) | |||
popup.__frame.style.zIndex = zindex; | |||
}-*/; | |||
@@ -186,7 +187,7 @@ public class VOverlay extends PopupPanel { | |||
* Sets the shadow style for this overlay. Will override any previous style | |||
* for the shadow. The default style name is defined by CLASSNAME_SHADOW. | |||
* The given style will be prefixed with CLASSNAME_SHADOW. | |||
* | |||
* | |||
* @param style | |||
* The new style name for the shadow element. Will be prefixed by | |||
* CLASSNAME_SHADOW, e.g. style=='foobar' -> actual style | |||
@@ -212,7 +213,7 @@ public class VOverlay extends PopupPanel { | |||
* be used to animate the shadow, using the 'progress' parameter (used to | |||
* animate the shadow in sync with GWT PopupPanel's default animation | |||
* 'PopupPanel.AnimationType.CENTER'). | |||
* | |||
* | |||
* @param progress | |||
* A value between 0.0 and 1.0, indicating the progress of the | |||
* animation (0=start, 1=end). |
@@ -6,11 +6,12 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.logical.shared.CloseEvent; | |||
import com.google.gwt.event.logical.shared.CloseHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.Button; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
@@ -18,7 +19,7 @@ import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
ClickHandler, PopupListener { | |||
ClickHandler, CloseHandler<PopupPanel> { | |||
private final Button calendarToggle; | |||
@@ -40,7 +41,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
popup = new VOverlay(true, true, true); | |||
popup.setStyleName(VDateField.CLASSNAME + "-popup"); | |||
popup.setWidget(calendar); | |||
popup.addPopupListener(this); | |||
popup.addCloseHandler(this); | |||
DOM.setElementProperty(calendar.getElement(), "id", | |||
"PID_VAADIN_POPUPCAL"); | |||
@@ -99,8 +100,8 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
} | |||
} | |||
public void onPopupClosed(PopupPanel sender, boolean autoClosed) { | |||
if (sender == popup) { | |||
public void onClose(CloseEvent<PopupPanel> event) { | |||
if (event.getSource() == popup) { | |||
buildDate(); | |||
// Sigh. | |||
Timer t = new Timer() { |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -9,12 +9,13 @@ import java.util.Iterator; | |||
import java.util.Set; | |||
import com.google.gwt.dom.client.Style; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.DeferredCommand; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.ComplexPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
@@ -95,7 +96,7 @@ public class VTabsheet extends VTabsheetBase { | |||
} | |||
class TabBar extends ComplexPanel implements ClickListener { | |||
class TabBar extends ComplexPanel implements ClickHandler { | |||
private final Element tr = DOM.createTR(); | |||
@@ -134,12 +135,12 @@ public class VTabsheet extends VTabsheetBase { | |||
setStyleName(div, CLASSNAME + "-tabitem"); | |||
DOM.appendChild(td, div); | |||
DOM.insertBefore(tr, td, spacerTd); | |||
c.addClickListener(this); | |||
c.addClickHandler(this); | |||
add(c, div); | |||
} | |||
public void onClick(Widget sender) { | |||
int index = getWidgetIndex(sender); | |||
public void onClick(ClickEvent event) { | |||
int index = getWidgetIndex((Widget) event.getSource()); | |||
onTabSelected(index); | |||
} | |||
@@ -195,12 +196,6 @@ public class VTabsheet extends VTabsheetBase { | |||
} | |||
} | |||
@Override | |||
public boolean remove(Widget w) { | |||
((VCaption) w).removeClickListener(this); | |||
return super.remove(w); | |||
} | |||
public TabSheetCaption getTab(int index) { | |||
if (index >= getWidgetCount()) { | |||
return null; |
@@ -6,14 +6,14 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.event.dom.client.ChangeHandler; | |||
import com.google.gwt.event.dom.client.FocusEvent; | |||
import com.google.gwt.event.dom.client.FocusHandler; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.ChangeListener; | |||
import com.google.gwt.user.client.ui.TextBoxBase; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
@@ -28,7 +28,7 @@ import com.vaadin.terminal.gwt.client.VTooltip; | |||
* | |||
*/ | |||
public class VTextField extends TextBoxBase implements Paintable, Field, | |||
ChangeListener, FocusHandler, BlurHandler { | |||
ChangeHandler, FocusHandler, BlurHandler { | |||
/** | |||
* The input node CSS classname. | |||
@@ -67,7 +67,7 @@ public class VTextField extends TextBoxBase implements Paintable, Field, | |||
DOM.setStyleAttribute(node, "marginBottom", "-1px"); | |||
} | |||
setStyleName(CLASSNAME); | |||
addChangeListener(this); | |||
addChangeHandler(this); | |||
addFocusHandler(this); | |||
addBlurHandler(this); | |||
sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
@@ -143,7 +143,7 @@ public class VTextField extends TextBoxBase implements Paintable, Field, | |||
return maxLength; | |||
} | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
if (client != null && id != null) { | |||
String newText = getText(); | |||
if (!prompting && newText != null | |||
@@ -180,7 +180,7 @@ public class VTextField extends TextBoxBase implements Paintable, Field, | |||
setText(inputPrompt); | |||
addStyleDependentName(CLASSNAME_PROMPT); | |||
} | |||
onChange((Widget) event.getSource()); | |||
onChange(null); | |||
} | |||
private void setPrompting(boolean prompting) { |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -6,12 +6,12 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.Date; | |||
import com.google.gwt.user.client.ui.ChangeListener; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.event.dom.client.ChangeHandler; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.ListBox; | |||
import com.google.gwt.user.client.ui.Widget; | |||
public class VTime extends FlowPanel implements ChangeListener { | |||
public class VTime extends FlowPanel implements ChangeHandler { | |||
private final VDateField datefield; | |||
@@ -45,7 +45,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
for (int i = 0; i < numHours; i++) { | |||
hours.addItem((i < 10) ? "0" + i : "" + i); | |||
} | |||
hours.addChangeListener(this); | |||
hours.addChangeHandler(this); | |||
if (thc) { | |||
ampm = new ListBox(); | |||
ampm.setStyleName(VNativeSelect.CLASSNAME); | |||
@@ -53,7 +53,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
.getAmPmStrings(); | |||
ampm.addItem(ampmText[0]); | |||
ampm.addItem(ampmText[1]); | |||
ampm.addChangeListener(this); | |||
ampm.addChangeHandler(this); | |||
} | |||
if (datefield.getCurrentResolution() >= VDateField.RESOLUTION_MIN) { | |||
@@ -62,7 +62,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
for (int i = 0; i < 60; i++) { | |||
mins.addItem((i < 10) ? "0" + i : "" + i); | |||
} | |||
mins.addChangeListener(this); | |||
mins.addChangeHandler(this); | |||
} | |||
if (datefield.getCurrentResolution() >= VDateField.RESOLUTION_SEC) { | |||
sec = new ListBox(); | |||
@@ -70,7 +70,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
for (int i = 0; i < 60; i++) { | |||
sec.addItem((i < 10) ? "0" + i : "" + i); | |||
} | |||
sec.addChangeListener(this); | |||
sec.addChangeHandler(this); | |||
} | |||
if (datefield.getCurrentResolution() == VDateField.RESOLUTION_MSEC) { | |||
msec = new ListBox(); | |||
@@ -84,7 +84,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
msec.addItem("" + i); | |||
} | |||
} | |||
msec.addChangeListener(this); | |||
msec.addChangeHandler(this); | |||
} | |||
final String delimiter = datefield.getDateTimeService() | |||
@@ -246,7 +246,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
readonly = datefield.isReadonly(); | |||
} | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
if (datefield.getCurrentDate() == null) { | |||
// was null on server, need to set | |||
Date now = datefield.getShowingDate(); | |||
@@ -272,7 +272,7 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
datefield.getClient().updateVariable(datefield.getId(), "msec", | |||
datefield.getMilliseconds(), false); | |||
} | |||
if (sender == hours) { | |||
if (event.getSource() == hours) { | |||
int h = hours.getSelectedIndex(); | |||
if (datefield.getDateTimeService().isTwelveHourClock()) { | |||
h = h + ampm.getSelectedIndex() * 12; | |||
@@ -282,28 +282,28 @@ public class VTime extends FlowPanel implements ChangeListener { | |||
datefield.getClient().updateVariable(datefield.getId(), "hour", h, | |||
datefield.isImmediate()); | |||
updateTime(false); | |||
} else if (sender == mins) { | |||
} else if (event.getSource() == mins) { | |||
final int m = mins.getSelectedIndex(); | |||
datefield.getCurrentDate().setMinutes(m); | |||
datefield.getShowingDate().setMinutes(m); | |||
datefield.getClient().updateVariable(datefield.getId(), "min", m, | |||
datefield.isImmediate()); | |||
updateTime(false); | |||
} else if (sender == sec) { | |||
} else if (event.getSource() == sec) { | |||
final int s = sec.getSelectedIndex(); | |||
datefield.getCurrentDate().setSeconds(s); | |||
datefield.getShowingDate().setSeconds(s); | |||
datefield.getClient().updateVariable(datefield.getId(), "sec", s, | |||
datefield.isImmediate()); | |||
updateTime(false); | |||
} else if (sender == msec) { | |||
} else if (event.getSource() == msec) { | |||
final int ms = msec.getSelectedIndex(); | |||
datefield.setMilliseconds(ms); | |||
datefield.setShowingMilliseconds(ms); | |||
datefield.getClient().updateVariable(datefield.getId(), "msec", ms, | |||
datefield.isImmediate()); | |||
updateTime(false); | |||
} else if (sender == ampm) { | |||
} else if (event.getSource() == ampm) { | |||
final int h = hours.getSelectedIndex() + ampm.getSelectedIndex() | |||
* 12; | |||
datefield.getCurrentDate().setHours(h); |
@@ -12,6 +12,8 @@ import java.util.Set; | |||
import com.google.gwt.dom.client.DivElement; | |||
import com.google.gwt.dom.client.Document; | |||
import com.google.gwt.event.logical.shared.ResizeEvent; | |||
import com.google.gwt.event.logical.shared.ResizeHandler; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.DeferredCommand; | |||
@@ -19,8 +21,6 @@ import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Timer; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.WindowCloseListener; | |||
import com.google.gwt.user.client.WindowResizeListener; | |||
import com.google.gwt.user.client.ui.RootPanel; | |||
import com.google.gwt.user.client.ui.SimplePanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
@@ -37,7 +37,7 @@ import com.vaadin.terminal.gwt.client.Util; | |||
* | |||
*/ | |||
public class VView extends SimplePanel implements Container, | |||
WindowResizeListener, WindowCloseListener { | |||
ResizeHandler, Window.ClosingHandler { | |||
private static final String CLASSNAME = "v-view"; | |||
@@ -183,10 +183,9 @@ public class VView extends SimplePanel implements Container, | |||
final String url = open.getStringAttribute("src"); | |||
final String target = open.getStringAttribute("name"); | |||
if (target == null) { | |||
// This window is closing. Send close event before | |||
// going to the new url | |||
// This window is closing. Nothing was done in the close event, | |||
// so don't need to call it before going to the new url | |||
isClosed = true; | |||
onWindowClosed(); | |||
goTo(url); | |||
} else { | |||
String options; | |||
@@ -332,11 +331,11 @@ public class VView extends SimplePanel implements Container, | |||
// Add window listeners on first paint, to prevent premature | |||
// variablechanges | |||
if (firstPaint) { | |||
Window.addWindowCloseListener(this); | |||
Window.addWindowResizeListener(this); | |||
Window.addWindowClosingHandler(this); | |||
Window.addResizeHandler(this); | |||
} | |||
onWindowResized(Window.getClientWidth(), Window.getClientHeight()); | |||
onResize(Window.getClientWidth(), Window.getClientHeight()); | |||
if (BrowserInfo.get().isSafari()) { | |||
Util.runWebkitOverflowAutoFix(getElement()); | |||
@@ -386,7 +385,11 @@ public class VView extends SimplePanel implements Container, | |||
} | |||
} | |||
public void onWindowResized(int width, int height) { | |||
public void onResize(ResizeEvent event) { | |||
onResize(event.getWidth(), event.getHeight()); | |||
} | |||
public void onResize(int wwidth, int wheight) { | |||
if (BrowserInfo.get().isIE()) { | |||
/* | |||
* IE will give us some false resized events due bugs with | |||
@@ -398,17 +401,17 @@ public class VView extends SimplePanel implements Container, | |||
@Override | |||
public void run() { | |||
boolean changed = false; | |||
if (VView.this.width != getOffsetWidth()) { | |||
VView.this.width = getOffsetWidth(); | |||
if (width != getOffsetWidth()) { | |||
width = getOffsetWidth(); | |||
changed = true; | |||
ApplicationConnection.getConsole().log( | |||
"window w" + VView.this.width); | |||
"window w" + width); | |||
} | |||
if (VView.this.height != getOffsetHeight()) { | |||
VView.this.height = getOffsetHeight(); | |||
if (height != getOffsetHeight()) { | |||
height = getOffsetHeight(); | |||
changed = true; | |||
ApplicationConnection.getConsole().log( | |||
"window h" + VView.this.height); | |||
"window h" + height); | |||
} | |||
if (changed) { | |||
ApplicationConnection | |||
@@ -426,14 +429,14 @@ public class VView extends SimplePanel implements Container, | |||
} | |||
resizeTimer.schedule(200); | |||
} else { | |||
if (width == VView.this.width && height == VView.this.height) { | |||
if (wwidth == width && wheight == height) { | |||
// No point in doing resize operations if window size has not | |||
// changed | |||
return; | |||
} | |||
VView.this.width = Window.getClientWidth(); | |||
VView.this.height = Window.getClientHeight(); | |||
width = Window.getClientWidth(); | |||
height = Window.getClientHeight(); | |||
ApplicationConnection.getConsole().log( | |||
"Running layout functions due window resize"); | |||
@@ -459,11 +462,7 @@ public class VView extends SimplePanel implements Container, | |||
$wnd.location = url; | |||
}-*/; | |||
public void onWindowClosed() { | |||
} | |||
public String onWindowClosing() { | |||
public void onWindowClosing(Window.ClosingEvent event) { | |||
// Change focus on this window in order to ensure that all state is | |||
// collected from textfields | |||
VTextField.flushChangesFromFocusedTextField(); | |||
@@ -471,8 +470,6 @@ public class VView extends SimplePanel implements Container, | |||
// Send the closing state to server | |||
connection.updateVariable(id, "close", true, false); | |||
connection.sendPendingVariableChangesSync(); | |||
return null; | |||
} | |||
private final RenderSpace myRenderSpace = new RenderSpace() { |
@@ -6,17 +6,19 @@ package com.vaadin.terminal.gwt.client.ui.richtextarea; | |||
import com.google.gwt.event.dom.client.BlurEvent; | |||
import com.google.gwt.event.dom.client.BlurHandler; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.event.dom.client.ChangeHandler; | |||
import com.google.gwt.event.dom.client.KeyPressEvent; | |||
import com.google.gwt.event.dom.client.KeyPressHandler; | |||
import com.google.gwt.event.shared.HandlerRegistration; | |||
import com.google.gwt.user.client.Command; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.DeferredCommand; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.ui.ChangeListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.KeyboardListener; | |||
import com.google.gwt.user.client.ui.RichTextArea; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.BrowserInfo; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
@@ -31,7 +33,7 @@ import com.vaadin.terminal.gwt.client.ui.Field; | |||
* | |||
*/ | |||
public class VRichTextArea extends Composite implements Paintable, Field, | |||
ChangeListener, BlurHandler, KeyboardListener { | |||
ChangeHandler, BlurHandler, KeyPressHandler { | |||
/** | |||
* The input node CSS classname. | |||
@@ -61,6 +63,8 @@ public class VRichTextArea extends Composite implements Paintable, Field, | |||
private int toolbarNaturalWidth = 500; | |||
private HandlerRegistration keyPressHandler; | |||
public VRichTextArea() { | |||
fp.add(formatter); | |||
@@ -116,17 +120,18 @@ public class VRichTextArea extends Composite implements Paintable, Field, | |||
.getIntAttribute("maxLength") : -1; | |||
if (newMaxLength >= 0) { | |||
if (maxLength == -1) { | |||
rta.addKeyboardListener(this); | |||
keyPressHandler = rta.addKeyPressHandler(this); | |||
} | |||
maxLength = newMaxLength; | |||
} else if (maxLength != -1) { | |||
getElement().setAttribute("maxlength", ""); | |||
maxLength = -1; | |||
rta.removeKeyboardListener(this); | |||
keyPressHandler.removeHandler(); | |||
} | |||
} | |||
public void onChange(Widget sender) { | |||
// TODO is this really used, or does everything go via onBlur() only? | |||
public void onChange(ChangeEvent event) { | |||
if (client != null && id != null) { | |||
client.updateVariable(id, "text", rta.getText(), immediate); | |||
} | |||
@@ -225,11 +230,7 @@ public class VRichTextArea extends Composite implements Paintable, Field, | |||
} | |||
} | |||
public void onKeyDown(Widget sender, char keyCode, int modifiers) { | |||
// NOP | |||
} | |||
public void onKeyPress(Widget sender, char keyCode, int modifiers) { | |||
public void onKeyPress(KeyPressEvent event) { | |||
if (maxLength >= 0) { | |||
DeferredCommand.addCommand(new Command() { | |||
public void execute() { | |||
@@ -241,8 +242,4 @@ public class VRichTextArea extends Composite implements Paintable, Field, | |||
} | |||
} | |||
public void onKeyUp(Widget sender, char keyCode, int modifiers) { | |||
// NOP | |||
} | |||
} |
@@ -16,6 +16,8 @@ | |||
package com.vaadin.terminal.gwt.client.ui.richtextarea; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.event.dom.client.ChangeEvent; | |||
import com.google.gwt.event.dom.client.ChangeHandler; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyUpEvent; | |||
@@ -23,7 +25,6 @@ import com.google.gwt.event.dom.client.KeyUpHandler; | |||
import com.google.gwt.i18n.client.Constants; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.AbstractImagePrototype; | |||
import com.google.gwt.user.client.ui.ChangeListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.ImageBundle; | |||
@@ -31,7 +32,6 @@ import com.google.gwt.user.client.ui.ListBox; | |||
import com.google.gwt.user.client.ui.PushButton; | |||
import com.google.gwt.user.client.ui.RichTextArea; | |||
import com.google.gwt.user.client.ui.ToggleButton; | |||
import com.google.gwt.user.client.ui.Widget; | |||
/** | |||
* A modified version of sample toolbar for use with {@link RichTextArea}. It | |||
@@ -180,13 +180,14 @@ public class VRichTextToolbar extends Composite { | |||
} | |||
/** | |||
* We use an inner EventListener class to avoid exposing event methods on | |||
* the RichTextToolbar itself. | |||
* We use an inner EventHandler class to avoid exposing event methods on the | |||
* RichTextToolbar itself. | |||
*/ | |||
private class EventListener implements ClickHandler, ChangeListener, | |||
private class EventHandler implements ClickHandler, ChangeHandler, | |||
KeyUpHandler { | |||
public void onChange(Widget sender) { | |||
public void onChange(ChangeEvent event) { | |||
Object sender = event.getSource(); | |||
if (sender == backColors) { | |||
basic.setBackColor(backColors.getValue(backColors | |||
.getSelectedIndex())); | |||
@@ -283,7 +284,7 @@ public class VRichTextToolbar extends Composite { | |||
private final Images images = (Images) GWT.create(Images.class); | |||
private final Strings strings = (Strings) GWT.create(Strings.class); | |||
private final EventListener listener = new EventListener(); | |||
private final EventHandler listener = new EventHandler(); | |||
private final RichTextArea richText; | |||
private final RichTextArea.BasicFormatter basic; | |||
@@ -392,7 +393,7 @@ public class VRichTextToolbar extends Composite { | |||
private ListBox createColorList(String caption) { | |||
final ListBox lb = new ListBox(); | |||
lb.addChangeListener(listener); | |||
lb.addChangeHandler(listener); | |||
lb.setVisibleItemCount(1); | |||
lb.addItem(caption); | |||
@@ -407,7 +408,7 @@ public class VRichTextToolbar extends Composite { | |||
private ListBox createFontList() { | |||
final ListBox lb = new ListBox(); | |||
lb.addChangeListener(listener); | |||
lb.addChangeHandler(listener); | |||
lb.setVisibleItemCount(1); | |||
lb.addItem(strings.font(), ""); | |||
@@ -423,7 +424,7 @@ public class VRichTextToolbar extends Composite { | |||
private ListBox createFontSizes() { | |||
final ListBox lb = new ListBox(); | |||
lb.addChangeListener(listener); | |||
lb.addChangeHandler(listener); | |||
lb.setVisibleItemCount(1); | |||
lb.addItem(strings.size()); |