From: Artur Signell Date: Wed, 25 Nov 2009 15:08:37 +0000 (+0000) Subject: Brought branch up to date with /versions/6.2 X-Git-Tag: 6.7.0.beta1~2241^2~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3de11ab062646763ce0fa1671ba35e6e7117fb24;p=vaadin-framework.git Brought branch up to date with /versions/6.2 svn changeset:10027/svn branch:event-framework-3234 --- 3de11ab062646763ce0fa1671ba35e6e7117fb24 diff --cc src/TestListeners.java index 0000000000,0000000000..1c415bd0aa new file mode 100644 --- /dev/null +++ b/src/TestListeners.java @@@ -1,0 -1,0 +1,136 @@@ ++import com.vaadin.Application; ++import com.vaadin.event.FieldEvents.BlurEvent; ++import com.vaadin.event.FieldEvents.BlurListener; ++import com.vaadin.event.FieldEvents.FocusEvent; ++import com.vaadin.event.FieldEvents.FocusListener; ++import com.vaadin.event.LayoutEvents.LayoutClickEvent; ++import com.vaadin.event.LayoutEvents.LayoutClickListener; ++import com.vaadin.event.MouseEvents.ClickEvent; ++import com.vaadin.event.MouseEvents.ClickListener; ++import com.vaadin.terminal.ExternalResource; ++import com.vaadin.ui.AbsoluteLayout; ++import com.vaadin.ui.Embedded; ++import com.vaadin.ui.GridLayout; ++import com.vaadin.ui.Label; ++import com.vaadin.ui.TextField; ++import com.vaadin.ui.Window; ++ ++public class TestListeners extends Application implements LayoutClickListener, ++ ClickListener, FocusListener { ++ ++ @Override ++ public void init() { ++ Window w = new Window("main window"); ++ setMainWindow(w); ++ ++ // Panel p = new Panel("My panel"); ++ // p.addListener(new ClickListener() { ++ // ++ // public void click(ClickEvent event) { ++ // getMainWindow().showNotification("Clicked!"); ++ // ++ // } ++ // }); ++ // w.addComponent(p); ++ // if (true) { ++ // return; ++ // } ++ // VerticalLayout vl = new VerticalLayout(); ++ ++ AbsoluteLayout al = new AbsoluteLayout(); ++ al.setWidth("200px"); ++ al.setHeight("200px"); ++ al.addComponent(new TextField("This is its caption", ++ "This is a textfield"), "top: 20px; left: 0px; width: 100px;"); ++ al.addComponent(new TextField("Antoerh caption", ++ "This is another textfield"), ++ "top: 120px; left: 0px; width: 100px;"); ++ al.addListener(new LayoutClickListener() { ++ ++ public void layoutClick(LayoutClickEvent event) { ++ System.out.println("Click on " + event.getChildComponent()); ++ ++ } ++ }); ++ ++ GridLayout vl = new GridLayout(); ++ vl.addComponent(al); ++ vl.setSpacing(true); ++ for (int i = 0; i < 10; i++) { ++ vl.addComponent(new Label("Component " + i)); ++ ExternalResource res = new ExternalResource( ++ "http://vaadin.com/image/image_gallery?uuid=07c1f6d5-2e94-4f4d-a707-b548bf22279d&groupId=10919&t=1241012632062"); ++ Embedded e = new Embedded("an image", res); ++ e.setType(Embedded.TYPE_IMAGE); ++ e.addListener(new ClickListener() { ++ ++ public void click(ClickEvent event) { ++ TestListeners.this.click(event); ++ ++ } ++ }); ++ // e.addListener(this); ++ vl.addComponent(e); ++ TextField tf = new TextField("tf"); ++ tf.setInputPrompt("Please enter a value"); ++ ++ // tf.addListener(this); ++ tf.addListener(new BlurListener() { ++ ++ public void blur(BlurEvent event) { ++ getMainWindow().showNotification( ++ "Blurred " + event.getComponent()); ++ ++ } ++ }); ++ tf.addListener(new FocusListener() { ++ ++ public void focus(FocusEvent event) { ++ getMainWindow().showNotification( ++ "Focused " + event.getComponent()); ++ ++ } ++ }); ++ vl.addComponent(tf); ++ } ++ ++ // vl.addListener(this); ++ vl.addListener(new LayoutClickListener() { ++ ++ public void layoutClick(LayoutClickEvent event) { ++ TestListeners.this.layoutClick(event); ++ ++ } ++ }); ++ vl.setMargin(true); ++ w.setContent(vl); ++ ++ } ++ ++ public void layoutClick(LayoutClickEvent event) { ++ if (event.getChildComponent() == null) { ++ getMainWindow().showNotification("You missed!"); ++ } else { ++ getMainWindow().showNotification( ++ "Clicked on " + event.getChildComponent() + "!"); ++ // getMainWindow().removeComponent(event.getChildComponent()); ++ ++ } ++ ++ } ++ ++ public void click(ClickEvent event) { ++ getMainWindow().showNotification( ++ "Clicked on " + event.getComponent() + " using " ++ + event.getButton()); ++ } ++ ++ public void focus(FocusEvent event) { ++ TextField tf = (TextField) event.getComponent(); ++ // tf.addStyleName("a"); ++ // tf.setValue(""); ++ getMainWindow().requestRepaintAll(); ++ ++ } ++ ++} diff --cc src/com/vaadin/ui/AbstractComponent.java index c72701b8ac,dbf988377f..9a3d84a803 --- a/src/com/vaadin/ui/AbstractComponent.java +++ b/src/com/vaadin/ui/AbstractComponent.java @@@ -836,8 -820,7 +836,8 @@@ public abstract class AbstractComponen * comment here, we use the default documentation from implemented * interface. */ - public void changeVariables(Object source, Map variables) { + public void changeVariables(Object source, Map variables) { + } /* General event framework */