svn changeset:8580/svn branch:6.1tags/6.7.0.beta1
@@ -1,5 +1,6 @@ | |||
package com.vaadin.demo.sampler.gwt.client.ui; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.MouseListener; | |||
@@ -41,7 +42,7 @@ public class VActiveLink extends VLink { | |||
/** | |||
* Sends variables, returns true if default handler should be called (i.e if | |||
* server is listening and the link was claimed to be opened by the client) | |||
* | |||
* | |||
* @return | |||
*/ | |||
private boolean sendVariables() { | |||
@@ -63,11 +64,11 @@ public class VActiveLink extends VLink { | |||
} | |||
@Override | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
if (sendVariables()) { | |||
// run default if not listening, or we claimed link was opened | |||
super.onClick(sender); | |||
super.onClick(event); | |||
} | |||
} | |||
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -8,6 +8,8 @@ import java.util.List; | |||
import java.util.Set; | |||
import com.google.gwt.core.client.JsArray; | |||
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.Element; | |||
import com.google.gwt.user.client.Event; | |||
@@ -16,7 +18,6 @@ import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.Window.Location; | |||
import com.google.gwt.user.client.ui.Button; | |||
import com.google.gwt.user.client.ui.CheckBox; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.HorizontalPanel; | |||
@@ -109,8 +110,8 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
panel.add(new HTML("<i>" + help + "</i>")); | |||
clear.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
clear.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
int width = panel.getOffsetWidth(); | |||
int height = panel.getOffsetHeight(); | |||
panel = new FlowPanel(); | |||
@@ -121,8 +122,8 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
} | |||
}); | |||
restart.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
restart.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
String queryString = Window.Location.getQueryString(); | |||
if (queryString != null | |||
@@ -148,14 +149,14 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
} | |||
}); | |||
forceLayout.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
forceLayout.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
VDebugConsole.this.client.forceLayout(); | |||
} | |||
}); | |||
analyzeLayout.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
analyzeLayout.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
List<ApplicationConnection> runningApplications = ApplicationConfiguration | |||
.getRunningApplications(); | |||
for (ApplicationConnection applicationConnection : runningApplications) { | |||
@@ -291,7 +292,7 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.vaadin.terminal.gwt.client.Console#log(java.lang.String) | |||
*/ | |||
public void log(String msg) { | |||
@@ -302,7 +303,7 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.vaadin.terminal.gwt.client.Console#error(java.lang.String) | |||
*/ | |||
public void error(String msg) { | |||
@@ -313,7 +314,7 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.vaadin.terminal.gwt.client.Console#printObject(java.lang. | |||
* Object) | |||
*/ | |||
@@ -324,7 +325,7 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.vaadin.terminal.gwt.client.Console#dirUIDL(com.vaadin | |||
* .terminal.gwt.client.UIDL) | |||
*/ | |||
@@ -345,7 +346,7 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
$wnd.console.log(u); | |||
} | |||
} | |||
}-*/; | |||
private static native void consoleLog(String msg) | |||
@@ -418,12 +419,12 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
+ " inside " + Util.getSimpleName(layout))); | |||
final CheckBox emphasisInUi = new CheckBox( | |||
"Emphasis components parent in UI (actual component is not visible)"); | |||
emphasisInUi.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
emphasisInUi.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
if (paintable != null) { | |||
Element element2 = ((Widget) layout).getElement(); | |||
Widget.setStyleName(element2, "invalidlayout", | |||
emphasisInUi.isChecked()); | |||
emphasisInUi.getValue()); | |||
} | |||
} | |||
}); | |||
@@ -450,12 +451,12 @@ public final class VDebugConsole extends VOverlay implements Console { | |||
+ valueMap.getString("widthMsg"))); | |||
} | |||
final CheckBox emphasisInUi = new CheckBox("Emphasis component in UI"); | |||
emphasisInUi.addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
emphasisInUi.addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
if (paintable != null) { | |||
Element element2 = ((Widget) paintable).getElement(); | |||
Widget.setStyleName(element2, "invalidlayout", emphasisInUi | |||
.isChecked()); | |||
.getValue()); | |||
} | |||
} | |||
}); |
@@ -5,10 +5,11 @@ import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.Set; | |||
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.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; | |||
@@ -124,7 +125,7 @@ public class VAccordion extends VTabsheetBase implements | |||
* same StackItem is used for rendering this time. E.g. if the first tab has | |||
* been removed all tabs which contain cached content must be moved 1 step | |||
* up to preserve the cached content. | |||
* | |||
* | |||
* @param item | |||
* @param newIndex | |||
* @param tabUidl | |||
@@ -352,9 +353,9 @@ public class VAccordion extends VTabsheetBase implements | |||
} | |||
/** | |||
* | |||
* | |||
*/ | |||
protected class StackItem extends ComplexPanel implements ClickListener { | |||
protected class StackItem extends ComplexPanel implements ClickHandler { | |||
public void setHeight(int height) { | |||
if (height == -1) { | |||
@@ -395,7 +396,7 @@ public class VAccordion extends VTabsheetBase implements | |||
/** | |||
* Returns caption width including padding | |||
* | |||
* | |||
* @return | |||
*/ | |||
public int getCaptionWidth() { | |||
@@ -433,7 +434,7 @@ public class VAccordion extends VTabsheetBase implements | |||
public StackItem(UIDL tabUidl) { | |||
setElement(DOM.createDiv()); | |||
caption = new VCaption(null, client); | |||
caption.addClickListener(this); | |||
caption.addClickHandler(this); | |||
if (BrowserInfo.get().isIE6()) { | |||
DOM.setEventListener(captionNode, this); | |||
DOM.sinkEvents(captionNode, Event.BUTTON_LEFT); | |||
@@ -523,7 +524,7 @@ public class VAccordion extends VTabsheetBase implements | |||
} | |||
} | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
onSelectTab(this); | |||
} | |||
@@ -1,14 +1,14 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
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.user.client.DOM; | |||
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.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
@@ -34,13 +34,13 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements | |||
public VCheckBox() { | |||
setStyleName(CLASSNAME); | |||
addClickListener(new ClickListener() { | |||
addClickHandler(new ClickHandler() { | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
if (id == null || client == null) { | |||
return; | |||
} | |||
client.updateVariable(id, "state", isChecked(), immediate); | |||
client.updateVariable(id, "state", getValue(), immediate); | |||
} | |||
}); | |||
@@ -97,15 +97,15 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements | |||
// Set text | |||
setText(uidl.getStringAttribute("caption")); | |||
setChecked(uidl.getBooleanVariable("state")); | |||
setValue(uidl.getBooleanVariable("state")); | |||
immediate = uidl.getBooleanAttribute("immediate"); | |||
} | |||
@Override | |||
public void onBrowserEvent(Event event) { | |||
if (icon != null && (event.getTypeInt() == Event.ONCLICK) | |||
&& (event.getTarget() == icon.getElement())) { | |||
setChecked(!isChecked()); | |||
&& (DOM.eventGetTarget(event) == icon.getElement())) { | |||
setValue(!getValue()); | |||
} | |||
super.onBrowserEvent(event); | |||
if (event.getTypeInt() == Event.ONLOAD) { |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -10,18 +10,23 @@ 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.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.dom.client.KeyUpEvent; | |||
import com.google.gwt.event.dom.client.KeyUpHandler; | |||
import com.google.gwt.user.client.Command; | |||
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.Window; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.FocusListener; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.Image; | |||
import com.google.gwt.user.client.ui.KeyboardListener; | |||
import com.google.gwt.user.client.ui.LoadListener; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
@@ -38,11 +43,11 @@ import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
/** | |||
* | |||
* | |||
* TODO needs major refactoring (to be extensible etc) | |||
*/ | |||
public class VFilterSelect extends Composite implements Paintable, Field, | |||
KeyboardListener, ClickListener, FocusListener, Focusable { | |||
KeyDownHandler, KeyUpHandler, ClickHandler, FocusListener, Focusable { | |||
public class FilterSelectSuggestion implements Suggestion, Command { | |||
@@ -276,7 +281,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see | |||
* com.google.gwt.user.client.ui.PopupPanel$PositionCallback#setPosition | |||
* (int, int) | |||
@@ -599,11 +604,12 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
panel.add(popupOpener); | |||
initWidget(panel); | |||
setStyleName(CLASSNAME); | |||
tb.addKeyboardListener(this); | |||
tb.addKeyDownHandler(this); | |||
tb.addKeyUpHandler(this); | |||
tb.setStyleName(CLASSNAME + "-input"); | |||
tb.addFocusListener(this); | |||
popupOpener.setStyleName(CLASSNAME + "-button"); | |||
popupOpener.addClickListener(this); | |||
popupOpener.addClickHandler(this); | |||
} | |||
public boolean hasNextPage() { | |||
@@ -840,22 +846,22 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
marginTop + "px"); | |||
} | |||
public void onKeyDown(Widget sender, char keyCode, int modifiers) { | |||
public void onKeyDown(KeyDownEvent event) { | |||
if (enabled) { | |||
if (suggestionPopup.isAttached()) { | |||
popupKeyDown(keyCode); | |||
popupKeyDown(event); | |||
} else { | |||
inputFieldKeyDown(keyCode); | |||
inputFieldKeyDown(event); | |||
} | |||
} | |||
} | |||
private void inputFieldKeyDown(char keyCode) { | |||
switch (keyCode) { | |||
case KeyboardListener.KEY_DOWN: | |||
case KeyboardListener.KEY_UP: | |||
case KeyboardListener.KEY_PAGEDOWN: | |||
case KeyboardListener.KEY_PAGEUP: | |||
private void inputFieldKeyDown(KeyDownEvent event) { | |||
switch (event.getNativeKeyCode()) { | |||
case KeyCodes.KEY_DOWN: | |||
case KeyCodes.KEY_UP: | |||
case KeyCodes.KEY_PAGEDOWN: | |||
case KeyCodes.KEY_PAGEUP: | |||
if (suggestionPopup.isAttached()) { | |||
break; | |||
} else { | |||
@@ -869,53 +875,49 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
} | |||
private void popupKeyDown(char keyCode) { | |||
switch (keyCode) { | |||
case KeyboardListener.KEY_DOWN: | |||
private void popupKeyDown(KeyDownEvent event) { | |||
switch (event.getNativeKeyCode()) { | |||
case KeyCodes.KEY_DOWN: | |||
suggestionPopup.selectNextItem(); | |||
DOM.eventPreventDefault(DOM.eventGetCurrentEvent()); | |||
break; | |||
case KeyboardListener.KEY_UP: | |||
case KeyCodes.KEY_UP: | |||
suggestionPopup.selectPrevItem(); | |||
DOM.eventPreventDefault(DOM.eventGetCurrentEvent()); | |||
break; | |||
case KeyboardListener.KEY_PAGEDOWN: | |||
case KeyCodes.KEY_PAGEDOWN: | |||
if (hasNextPage()) { | |||
filterOptions(currentPage + 1, lastFilter); | |||
} | |||
break; | |||
case KeyboardListener.KEY_PAGEUP: | |||
case KeyCodes.KEY_PAGEUP: | |||
if (currentPage > 0) { | |||
filterOptions(currentPage - 1, lastFilter); | |||
} | |||
break; | |||
case KeyboardListener.KEY_ENTER: | |||
case KeyboardListener.KEY_TAB: | |||
case KeyCodes.KEY_ENTER: | |||
case KeyCodes.KEY_TAB: | |||
suggestionPopup.menu.doSelectedItemAction(); | |||
break; | |||
} | |||
} | |||
public void onKeyPress(Widget sender, char keyCode, int modifiers) { | |||
} | |||
public void onKeyUp(Widget sender, char keyCode, int modifiers) { | |||
public void onKeyUp(KeyUpEvent event) { | |||
if (enabled) { | |||
switch (keyCode) { | |||
case KeyboardListener.KEY_ENTER: | |||
case KeyboardListener.KEY_TAB: | |||
case KeyboardListener.KEY_SHIFT: | |||
case KeyboardListener.KEY_CTRL: | |||
case KeyboardListener.KEY_ALT: | |||
case KeyboardListener.KEY_DOWN: | |||
case KeyboardListener.KEY_UP: | |||
case KeyboardListener.KEY_PAGEDOWN: | |||
case KeyboardListener.KEY_PAGEUP: | |||
switch (event.getNativeKeyCode()) { | |||
case KeyCodes.KEY_ENTER: | |||
case KeyCodes.KEY_TAB: | |||
case KeyCodes.KEY_SHIFT: | |||
case KeyCodes.KEY_CTRL: | |||
case KeyCodes.KEY_ALT: | |||
case KeyCodes.KEY_DOWN: | |||
case KeyCodes.KEY_UP: | |||
case KeyCodes.KEY_PAGEDOWN: | |||
case KeyCodes.KEY_PAGEUP: | |||
; // NOP | |||
break; | |||
case KeyboardListener.KEY_ESCAPE: | |||
case KeyCodes.KEY_ESCAPE: | |||
reset(); | |||
break; | |||
default: | |||
@@ -941,7 +943,7 @@ public class VFilterSelect extends Composite implements Paintable, Field, | |||
/** | |||
* Listener for popupopener | |||
*/ | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
if (enabled) { | |||
// ask suggestionPopup if it was just closed, we are using GWT | |||
// Popup's auto close feature |
@@ -1,23 +1,23 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
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.user.client.DOM; | |||
import com.google.gwt.user.client.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.Window; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.HTML; | |||
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; | |||
import com.vaadin.terminal.gwt.client.Util; | |||
import com.vaadin.terminal.gwt.client.VTooltip; | |||
public class VLink extends HTML implements Paintable, ClickListener { | |||
public class VLink extends HTML implements Paintable, ClickHandler { | |||
public static final String CLASSNAME = "v-link"; | |||
@@ -53,7 +53,7 @@ public class VLink extends HTML implements Paintable, ClickListener { | |||
super(); | |||
getElement().appendChild(anchor); | |||
anchor.appendChild(captionElement); | |||
addClickListener(this); | |||
addClickHandler(this); | |||
sinkEvents(VTooltip.TOOLTIP_EVENTS); | |||
setStyleName(CLASSNAME); | |||
} | |||
@@ -120,7 +120,7 @@ public class VLink extends HTML implements Paintable, ClickListener { | |||
} | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
if (enabled && !readonly) { | |||
if (target == null) { | |||
target = "_self"; |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -30,7 +30,7 @@ public class VListSelect extends VOptionGroupBase { | |||
select = (TooltipListBox) optionsContainer; | |||
select.setSelect(this); | |||
select.addChangeListener(this); | |||
select.addClickListener(this); | |||
select.addClickHandler(this); | |||
select.setStyleName(CLASSNAME + "-select"); | |||
select.setVisibleItemCount(VISIBLE_COUNT); | |||
} |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -8,6 +8,7 @@ import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.Map; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.user.client.ui.CheckBox; | |||
import com.google.gwt.user.client.ui.HasFocus; | |||
import com.google.gwt.user.client.ui.Panel; | |||
@@ -49,7 +50,7 @@ public class VOptionGroup extends VOptionGroupBase { | |||
op.setChecked(opUidl.getBooleanAttribute("selected")); | |||
op.setEnabled(!opUidl.getBooleanAttribute("disabled") | |||
&& !isReadonly() && !isDisabled()); | |||
op.addClickListener(this); | |||
op.addClickHandler(this); | |||
optionsToKeys.put(op, opUidl.getStringAttribute("key")); | |||
panel.add(op); | |||
} | |||
@@ -61,11 +62,11 @@ public class VOptionGroup extends VOptionGroupBase { | |||
} | |||
@Override | |||
public void onClick(Widget sender) { | |||
super.onClick(sender); | |||
if (sender instanceof CheckBox) { | |||
final boolean selected = ((CheckBox) sender).isChecked(); | |||
final String key = (String) optionsToKeys.get(sender); | |||
public void onClick(ClickEvent event) { | |||
super.onClick(event); | |||
if (event.getSource() instanceof CheckBox) { | |||
final boolean selected = ((CheckBox) event.getSource()).getValue(); | |||
final String key = (String) optionsToKeys.get(event.getSource()); | |||
if (!isMultiselect()) { | |||
selectedKeys.clear(); | |||
} |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -6,11 +6,14 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.Set; | |||
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.ClickListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.KeyboardListener; | |||
import com.google.gwt.user.client.ui.Panel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
@@ -19,7 +22,7 @@ import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
ClickListener, ChangeListener, KeyboardListener, Focusable { | |||
ClickHandler, ChangeListener, KeyPressHandler, Focusable { | |||
public static final String CLASSNAME_OPTION = "v-select-option"; | |||
@@ -157,9 +160,9 @@ abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
if (newItemField == null) { | |||
newItemButton = new VNativeButton(); | |||
newItemButton.setText("+"); | |||
newItemButton.addClickListener(this); | |||
newItemButton.addClickHandler(this); | |||
newItemField = new VTextField(); | |||
newItemField.addKeyboardListener(this); | |||
newItemField.addKeyPressHandler(this); | |||
} | |||
newItemField.setEnabled(!disabled && !readonly); | |||
newItemButton.setEnabled(!disabled && !readonly); | |||
@@ -183,8 +186,9 @@ abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
abstract protected void setTabIndex(int tabIndex); | |||
public void onClick(Widget sender) { | |||
if (sender == newItemButton && !newItemField.getText().equals("")) { | |||
public void onClick(ClickEvent event) { | |||
if (event.getSource() == newItemButton | |||
&& !newItemField.getText().equals("")) { | |||
client.updateVariable(id, "newitem", newItemField.getText(), true); | |||
newItemField.setText(""); | |||
} | |||
@@ -201,20 +205,13 @@ abstract class VOptionGroupBase extends Composite implements Paintable, Field, | |||
} | |||
} | |||
public void onKeyPress(Widget sender, char keyCode, int modifiers) { | |||
if (sender == newItemField && keyCode == KeyboardListener.KEY_ENTER) { | |||
public void onKeyPress(KeyPressEvent event) { | |||
if (event.getSource() == newItemField | |||
&& event.getCharCode() == KeyCodes.KEY_ENTER) { | |||
newItemButton.click(); | |||
} | |||
} | |||
public void onKeyUp(Widget sender, char keyCode, int modifiers) { | |||
// Ignore, subclasses may override | |||
} | |||
public void onKeyDown(Widget sender, char keyCode, int modifiers) { | |||
// Ignore, subclasses may override | |||
} | |||
protected abstract void buildOptions(UIDL uidl); | |||
protected abstract Object[] getSelectedItems(); |
@@ -1,24 +1,24 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
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.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.ClickListener; | |||
import com.google.gwt.user.client.ui.PopupListener; | |||
import com.google.gwt.user.client.ui.PopupPanel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; | |||
import com.vaadin.terminal.gwt.client.ApplicationConnection; | |||
import com.vaadin.terminal.gwt.client.Paintable; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
ClickListener, PopupListener { | |||
ClickHandler, PopupListener { | |||
private final Button calendarToggle; | |||
@@ -33,7 +33,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
calendarToggle = new Button(); | |||
calendarToggle.setStyleName(CLASSNAME + "-button"); | |||
calendarToggle.setText(""); | |||
calendarToggle.addClickListener(this); | |||
calendarToggle.addClickHandler(this); | |||
add(calendarToggle); | |||
calendar = new VCalendarPanel(this); | |||
@@ -60,8 +60,8 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
calendarToggle.setEnabled(enabled); | |||
} | |||
public void onClick(Widget sender) { | |||
if (sender == calendarToggle && !open) { | |||
public void onClick(ClickEvent event) { | |||
if (event.getSource() == calendarToggle && !open) { | |||
open = true; | |||
calendar.updateCalendar(); | |||
// clear previous values | |||
@@ -115,7 +115,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, | |||
/** | |||
* Sets focus to Calendar panel. | |||
* | |||
* | |||
* @param focus | |||
*/ | |||
public void setFocus(boolean focus) { |
@@ -3,10 +3,11 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.HashSet; | |||
import java.util.Set; | |||
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.Element; | |||
import com.google.gwt.user.client.Event; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.HasFocus; | |||
import com.google.gwt.user.client.ui.Label; | |||
@@ -53,8 +54,8 @@ public class VPopupView extends HTML implements Container { | |||
popup.setWidget(loading); | |||
// When we click to open the popup... | |||
addClickListener(new ClickListener() { | |||
public void onClick(Widget sender) { | |||
addClickHandler(new ClickHandler() { | |||
public void onClick(ClickEvent event) { | |||
updateState(true); | |||
} | |||
}); | |||
@@ -71,8 +72,8 @@ public class VPopupView extends HTML implements Container { | |||
} | |||
/** | |||
* | |||
* | |||
* | |||
* | |||
* @see com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL, | |||
* com.vaadin.terminal.gwt.client.ApplicationConnection) | |||
*/ | |||
@@ -127,7 +128,7 @@ public class VPopupView extends HTML implements Container { | |||
/** | |||
* Update popup visibility to server | |||
* | |||
* | |||
* @param visibility | |||
*/ | |||
private void updateState(boolean visible) { | |||
@@ -184,7 +185,7 @@ public class VPopupView extends HTML implements Container { | |||
/** | |||
* Make sure that we remove the popup when the main widget is removed. | |||
* | |||
* | |||
* @see com.google.gwt.user.client.ui.Widget#onUnload() | |||
*/ | |||
@Override | |||
@@ -194,7 +195,7 @@ public class VPopupView extends HTML implements Container { | |||
} | |||
private static native void nativeBlur(Element e) | |||
/*-{ | |||
/*-{ | |||
if(e && e.blur) { | |||
e.blur(); | |||
} | |||
@@ -321,13 +322,13 @@ public class VPopupView extends HTML implements Container { | |||
} | |||
/* | |||
* | |||
* | |||
* We need a hack make popup act as a child of VPopupView in Vaadin's | |||
* component tree, but work in default GWT manner when closing or | |||
* opening. | |||
* | |||
* | |||
* (non-Javadoc) | |||
* | |||
* | |||
* @see com.google.gwt.user.client.ui.Widget#getParent() | |||
*/ | |||
@Override | |||
@@ -364,7 +365,7 @@ public class VPopupView extends HTML implements Container { | |||
/** | |||
* Calculate extra space taken by the popup decorations | |||
* | |||
* | |||
* @return | |||
*/ | |||
protected Size calculatePopupExtra() { |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -9,11 +9,12 @@ import java.util.HashMap; | |||
import java.util.Iterator; | |||
import java.util.Set; | |||
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.Window; | |||
import com.google.gwt.user.client.ui.Button; | |||
import com.google.gwt.user.client.ui.ClickListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.Grid; | |||
import com.google.gwt.user.client.ui.HTML; | |||
@@ -31,7 +32,7 @@ import com.vaadin.terminal.gwt.client.UIDL; | |||
* style table which will be much lighter than VScrollTable is. | |||
*/ | |||
public class VTablePaging extends Composite implements Table, Paintable, | |||
ClickListener { | |||
ClickHandler { | |||
private final Grid tBody = new Grid(); | |||
private final Button nextPage = new Button(">"); | |||
@@ -72,13 +73,13 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
pager = new HorizontalPanel(); | |||
pager.add(firstPage); | |||
firstPage.addClickListener(this); | |||
firstPage.addClickHandler(this); | |||
pager.add(prevPage); | |||
prevPage.addClickListener(this); | |||
prevPage.addClickHandler(this); | |||
pager.add(nextPage); | |||
nextPage.addClickListener(this); | |||
nextPage.addClickHandler(this); | |||
pager.add(lastPage); | |||
lastPage.addClickListener(this); | |||
lastPage.addClickHandler(this); | |||
panel.add(pager); | |||
panel.add(tBody); | |||
@@ -168,10 +169,10 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
/** | |||
* Updates row data from uidl. UpdateFromUIDL delegates updating tBody to | |||
* this method. | |||
* | |||
* | |||
* Updates may be to different part of tBody, depending on update type. It | |||
* can be initial row data, scroll up, scroll down... | |||
* | |||
* | |||
* @param uidl | |||
* which contains row data | |||
*/ | |||
@@ -245,7 +246,8 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
return false; | |||
} | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
Object sender = event.getSource(); | |||
if (sender instanceof Button) { | |||
if (sender == firstPage) { | |||
client.updateVariable(id, "firstvisible", 0, true); | |||
@@ -286,7 +288,7 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
HeaderCell(String pid, String caption) { | |||
super(); | |||
cid = pid; | |||
addClickListener(VTablePaging.this); | |||
addClickHandler(VTablePaging.this); | |||
setText(caption); | |||
// TODO remove debug color | |||
DOM.setStyleAttribute(getElement(), "color", "brown"); | |||
@@ -297,7 +299,7 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
/** | |||
* Abstraction of table cell content. In needs to know on which row it is in | |||
* case of context click. | |||
* | |||
* | |||
* @author mattitahvonen | |||
*/ | |||
public class BodyCell extends SimplePanel { | |||
@@ -353,7 +355,7 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
/** | |||
* This method is used to set row status. Does not change value on | |||
* server. | |||
* | |||
* | |||
* @param selected | |||
*/ | |||
public void setSelected(boolean sel) { | |||
@@ -377,7 +379,7 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
/** | |||
* Toggles rows select state. Also updates state to server according to | |||
* tables immediate flag. | |||
* | |||
* | |||
*/ | |||
public void toggleSelected() { | |||
if (selected) { | |||
@@ -394,7 +396,7 @@ public class VTablePaging extends Composite implements Table, Paintable, | |||
/** | |||
* Shows context menu for this row. | |||
* | |||
* | |||
* @param event | |||
* Event which triggered context menu. Correct place for | |||
* context menu can be determined with it. |
@@ -1,4 +1,4 @@ | |||
/* | |||
/* | |||
@ITMillApache2LicenseForJavaFiles@ | |||
*/ | |||
@@ -7,12 +7,12 @@ package com.vaadin.terminal.gwt.client.ui; | |||
import java.util.ArrayList; | |||
import java.util.Iterator; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.user.client.DOM; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.HTML; | |||
import com.google.gwt.user.client.ui.ListBox; | |||
import com.google.gwt.user.client.ui.Panel; | |||
import com.google.gwt.user.client.ui.Widget; | |||
import com.vaadin.terminal.gwt.client.UIDL; | |||
public class VTwinColSelect extends VOptionGroupBase { | |||
@@ -40,9 +40,9 @@ public class VTwinColSelect extends VOptionGroupBase { | |||
public VTwinColSelect() { | |||
super(CLASSNAME); | |||
options = new ListBox(); | |||
options.addClickListener(this); | |||
options.addClickHandler(this); | |||
selections = new ListBox(); | |||
selections.addClickListener(this); | |||
selections.addClickHandler(this); | |||
options.setVisibleItemCount(VISIBLE_COUNT); | |||
selections.setVisibleItemCount(VISIBLE_COUNT); | |||
options.setStyleName(CLASSNAME + "-options"); | |||
@@ -51,10 +51,10 @@ public class VTwinColSelect extends VOptionGroupBase { | |||
buttons.setStyleName(CLASSNAME + "-buttons"); | |||
add = new VButton(); | |||
add.setText(">>"); | |||
add.addClickListener(this); | |||
add.addClickHandler(this); | |||
remove = new VButton(); | |||
remove.setText("<<"); | |||
remove.addClickListener(this); | |||
remove.addClickHandler(this); | |||
panel = ((Panel) optionsContainer); | |||
panel.add(options); | |||
buttons.add(add); | |||
@@ -143,9 +143,9 @@ public class VTwinColSelect extends VOptionGroupBase { | |||
} | |||
@Override | |||
public void onClick(Widget sender) { | |||
super.onClick(sender); | |||
if (sender == add) { | |||
public void onClick(ClickEvent event) { | |||
super.onClick(event); | |||
if (event.getSource() == add) { | |||
final boolean[] sel = getItemsToAdd(); | |||
for (int i = 0; i < sel.length; i++) { | |||
if (sel[i]) { | |||
@@ -165,7 +165,7 @@ public class VTwinColSelect extends VOptionGroupBase { | |||
client.updateVariable(id, "selected", selectedKeys.toArray(), | |||
isImmediate()); | |||
} else if (sender == remove) { | |||
} else if (event.getSource() == remove) { | |||
final boolean[] sel = getItemsToRemove(); | |||
for (int i = 0; i < sel.length; i++) { | |||
if (sel[i]) { | |||
@@ -183,13 +183,13 @@ public class VTwinColSelect extends VOptionGroupBase { | |||
} | |||
client.updateVariable(id, "selected", selectedKeys.toArray(), | |||
isImmediate()); | |||
} else if (sender == options) { | |||
} else if (event.getSource() == options) { | |||
// unselect all in other list, to avoid mistakes (i.e wrong button) | |||
final int c = selections.getItemCount(); | |||
for (int i = 0; i < c; i++) { | |||
selections.setItemSelected(i, false); | |||
} | |||
} else if (sender == selections) { | |||
} else if (event.getSource() == selections) { | |||
// unselect all in other list, to avoid mistakes (i.e wrong button) | |||
final int c = options.getItemCount(); | |||
for (int i = 0; i < c; i++) { |
@@ -1,12 +1,12 @@ | |||
/* | |||
* Copyright 2007 Google Inc. | |||
* | |||
* | |||
* Licensed 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 | |||
@@ -16,15 +16,17 @@ | |||
package com.vaadin.terminal.gwt.client.ui.richtextarea; | |||
import com.google.gwt.core.client.GWT; | |||
import com.google.gwt.event.dom.client.ClickEvent; | |||
import com.google.gwt.event.dom.client.ClickHandler; | |||
import com.google.gwt.event.dom.client.KeyUpEvent; | |||
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.ClickListener; | |||
import com.google.gwt.user.client.ui.Composite; | |||
import com.google.gwt.user.client.ui.FlowPanel; | |||
import com.google.gwt.user.client.ui.ImageBundle; | |||
import com.google.gwt.user.client.ui.KeyboardListener; | |||
import com.google.gwt.user.client.ui.ListBox; | |||
import com.google.gwt.user.client.ui.PushButton; | |||
import com.google.gwt.user.client.ui.RichTextArea; | |||
@@ -181,8 +183,8 @@ public class VRichTextToolbar extends Composite { | |||
* We use an inner EventListener class to avoid exposing event methods on | |||
* the RichTextToolbar itself. | |||
*/ | |||
private class EventListener implements ClickListener, ChangeListener, | |||
KeyboardListener { | |||
private class EventListener implements ClickHandler, ChangeListener, | |||
KeyUpHandler { | |||
public void onChange(Widget sender) { | |||
if (sender == backColors) { | |||
@@ -203,7 +205,8 @@ public class VRichTextToolbar extends Composite { | |||
} | |||
} | |||
public void onClick(Widget sender) { | |||
public void onClick(ClickEvent event) { | |||
Object sender = event.getSource(); | |||
if (sender == bold) { | |||
basic.toggleBold(); | |||
} else if (sender == italic) { | |||
@@ -259,17 +262,11 @@ public class VRichTextToolbar extends Composite { | |||
} | |||
} | |||
public void onKeyDown(Widget sender, char keyCode, int modifiers) { | |||
} | |||
public void onKeyPress(Widget sender, char keyCode, int modifiers) { | |||
} | |||
public void onKeyUp(Widget sender, char keyCode, int modifiers) { | |||
if (sender == richText) { | |||
public void onKeyUp(KeyUpEvent event) { | |||
if (event.getSource() == richText) { | |||
// We use the RichTextArea's onKeyUp event to update the toolbar | |||
// status. | |||
// This will catch any cases where the user moves the cursur | |||
// This will catch any cases where the user moves the cursor | |||
// using the | |||
// keyboard, or uses one of the browser's built-in keyboard | |||
// shortcuts. | |||
@@ -321,7 +318,7 @@ public class VRichTextToolbar extends Composite { | |||
/** | |||
* Creates a new toolbar that drives the given rich text area. | |||
* | |||
* | |||
* @param richText | |||
* the rich text area to be controlled | |||
*/ | |||
@@ -388,8 +385,8 @@ public class VRichTextToolbar extends Composite { | |||
// We only use these listeners for updating status, so don't hook | |||
// them up | |||
// unless at least basic editing is supported. | |||
richText.addKeyboardListener(listener); | |||
richText.addClickListener(listener); | |||
richText.addKeyUpHandler(listener); | |||
richText.addClickHandler(listener); | |||
} | |||
} | |||
@@ -442,7 +439,7 @@ public class VRichTextToolbar extends Composite { | |||
private PushButton createPushButton(AbstractImagePrototype img, String tip) { | |||
final PushButton pb = new PushButton(img.createImage()); | |||
pb.addClickListener(listener); | |||
pb.addClickHandler(listener); | |||
pb.setTitle(tip); | |||
return pb; | |||
} | |||
@@ -450,7 +447,7 @@ public class VRichTextToolbar extends Composite { | |||
private ToggleButton createToggleButton(AbstractImagePrototype img, | |||
String tip) { | |||
final ToggleButton tb = new ToggleButton(img.createImage()); | |||
tb.addClickListener(listener); | |||
tb.addClickHandler(listener); | |||
tb.setTitle(tip); | |||
return tb; | |||
} |