-package com.vaadin.tests.components.urifragmentutilty;\r
-\r
-import com.vaadin.tests.components.TestBase;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.UriFragmentUtility;\r
-import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent;\r
-import com.vaadin.ui.UriFragmentUtility.FragmentChangedListener;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class FragmentChangeLoop extends TestBase {\r
- VerticalLayout layout1 = new VerticalLayout();\r
- VerticalLayout layout2 = new VerticalLayout();\r
- VerticalLayout layoutCurrent = null;\r
- UriFragmentUtility uriFragmentUtility = new UriFragmentUtility();\r
- Integer i = 0;\r
- private Label status;\r
- private Button setToF;\r
- private Button addOne;\r
-\r
- @Override\r
- protected void setup() {\r
- uriFragmentUtility.addListener(new FragmentChangedListener() {\r
-\r
- public void fragmentChanged(FragmentChangedEvent source) {\r
- status.setValue(++i + " fragment events");\r
- VerticalLayout layoutNew = (layoutCurrent == layout1 ? layout2\r
- : layout1);\r
- replaceComponent(layoutCurrent, layoutNew);\r
- layoutCurrent = layoutNew;\r
-\r
- }\r
- });\r
-\r
- layout1.setCaption("Layout 1");\r
- layout2.setCaption("Layout 2");\r
- addComponent(layout1);\r
- layoutCurrent = layout1;\r
- status = new Label("0 fragment events");\r
- setToF = new Button("Set fragment to F", new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- uriFragmentUtility.setFragment("F");\r
- }\r
- });\r
- addOne = new Button("Append '1' to fragment",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- uriFragmentUtility.setFragment(uriFragmentUtility\r
- .getFragment() + "1");\r
- }\r
- });\r
- addComponent(status);\r
- addComponent(setToF);\r
- addComponent(addOne);\r
-\r
- addComponent(uriFragmentUtility);\r
-\r
- }\r
-\r
- @Override\r
- protected String getDescription() {\r
- return "Click the button to set the fragment to F. "\r
- + "This should cause the counter on the button to increase by one (unless the fragment is already F in case it should do nothing).";\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- return 8916;\r
- }\r
-\r
-}\r
+package com.vaadin.tests.components.urifragmentutilty;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UriFragmentUtility;
+import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent;
+import com.vaadin.ui.UriFragmentUtility.FragmentChangedListener;
+import com.vaadin.ui.VerticalLayout;
+
+public class FragmentChangeLoop extends TestBase {
+ VerticalLayout layout1 = new VerticalLayout();
+ VerticalLayout layout2 = new VerticalLayout();
+ VerticalLayout layoutCurrent = null;
+ UriFragmentUtility uriFragmentUtility = new UriFragmentUtility();
+ Integer i = 0;
+ private Label status;
+ private Button setToF;
+ private Button addOne;
+
+ @Override
+ protected void setup() {
+ uriFragmentUtility.addListener(new FragmentChangedListener() {
+
+ public void fragmentChanged(FragmentChangedEvent source) {
+ status.setValue(++i + " fragment events");
+ VerticalLayout layoutNew = (layoutCurrent == layout1 ? layout2
+ : layout1);
+ replaceComponent(layoutCurrent, layoutNew);
+ layoutCurrent = layoutNew;
+
+ }
+ });
+
+ layout1.setCaption("Layout 1");
+ layout2.setCaption("Layout 2");
+ addComponent(layout1);
+ layoutCurrent = layout1;
+ status = new Label("0 fragment events");
+ setToF = new Button("Set fragment to F", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ uriFragmentUtility.setFragment("F");
+ }
+ });
+ addOne = new Button("Append '1' to fragment",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ uriFragmentUtility.setFragment(uriFragmentUtility
+ .getFragment() + "1");
+ }
+ });
+ addComponent(status);
+ addComponent(setToF);
+ addComponent(addOne);
+
+ addComponent(uriFragmentUtility);
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Click the button to set the fragment to F. "
+ + "This should cause the counter on the button to increase by one (unless the fragment is already F in case it should do nothing).";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8916;
+ }
+
+}