-package com.vaadin.server;\r
-\r
-import java.io.Serializable;\r
-import java.util.Locale;\r
-\r
-public class SystemMessagesInfo implements Serializable {\r
-\r
- private Locale locale;\r
- private VaadinRequest request;\r
- private VaadinService service;\r
-\r
- /**\r
- * The locale of the UI related to the {@link SystemMessages} request.\r
- * \r
- * @return The Locale or null if the locale is not known\r
- */\r
- public Locale getLocale() {\r
- return locale;\r
- }\r
-\r
- public void setLocale(Locale locale) {\r
- this.locale = locale;\r
- }\r
-\r
- /**\r
- * Gets the request currently in progress.\r
- * \r
- * @return The request currently in progress or null if no request is in\r
- * progress.\r
- */\r
- public VaadinRequest getRequest() {\r
- return request;\r
- }\r
-\r
- public void setRequest(VaadinRequest request) {\r
- this.request = request;\r
- }\r
-\r
- /**\r
- * Returns the service this SystemMessages request comes from.\r
- * \r
- * @return The service which triggered this request or null of not triggered\r
- * from a service.\r
- */\r
- public VaadinService getService() {\r
- return service;\r
- }\r
-\r
- public void setService(VaadinService service) {\r
- this.service = service;\r
- }\r
-\r
-}\r
+package com.vaadin.server;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public class SystemMessagesInfo implements Serializable {
+
+ private Locale locale;
+ private VaadinRequest request;
+ private VaadinService service;
+
+ /**
+ * The locale of the UI related to the {@link SystemMessages} request.
+ *
+ * @return The Locale or null if the locale is not known
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ /**
+ * Gets the request currently in progress.
+ *
+ * @return The request currently in progress or null if no request is in
+ * progress.
+ */
+ public VaadinRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(VaadinRequest request) {
+ this.request = request;
+ }
+
+ /**
+ * Returns the service this SystemMessages request comes from.
+ *
+ * @return The service which triggered this request or null of not triggered
+ * from a service.
+ */
+ public VaadinService getService() {
+ return service;
+ }
+
+ public void setService(VaadinService service) {
+ this.service = service;
+ }
+
+}
-package com.vaadin.tests.applicationservlet;\r
-\r
-import java.util.Locale;\r
-\r
-import com.vaadin.data.Property.ValueChangeEvent;\r
-import com.vaadin.data.Property.ValueChangeListener;\r
-import com.vaadin.server.CustomizedSystemMessages;\r
-import com.vaadin.server.SystemMessages;\r
-import com.vaadin.server.SystemMessagesInfo;\r
-import com.vaadin.server.SystemMessagesProvider;\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.tests.components.AbstractTestUI;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Button.ClickListener;\r
-import com.vaadin.ui.NativeSelect;\r
-\r
-public class SystemMessagesTest extends AbstractTestUI {\r
-\r
- public class MyButton extends Button {\r
- private boolean fail = false;\r
-\r
- @Override\r
- public void beforeClientResponse(boolean initial) {\r
- super.beforeClientResponse(initial);\r
- if (fail) {\r
- throw new RuntimeException("Failed on purpose");\r
- }\r
- }\r
-\r
- }\r
-\r
- @Override\r
- protected void setup(VaadinRequest request) {\r
- final NativeSelect localeSelect = new NativeSelect("UI locale");\r
- localeSelect.setImmediate(true);\r
- localeSelect.addItem(new Locale("en", "US"));\r
- localeSelect.addItem(new Locale("fi", "FI"));\r
- localeSelect.addItem(Locale.GERMANY);\r
- localeSelect.addValueChangeListener(new ValueChangeListener() {\r
-\r
- @Override\r
- public void valueChange(ValueChangeEvent event) {\r
- setLocale((Locale) localeSelect.getValue());\r
- getSession().getService().setSystemMessagesProvider(\r
- new SystemMessagesProvider() {\r
-\r
- @Override\r
- public SystemMessages getSystemMessages(\r
- SystemMessagesInfo systemMessagesInfo) {\r
- CustomizedSystemMessages csm = new CustomizedSystemMessages();\r
- // csm.setInternalErrorCaption("Request query string: "\r
- // + ((VaadinServletRequest) systemMessagesInfo\r
- // .getRequest()).getQueryString());\r
- csm.setInternalErrorMessage("MessagesInfo locale: "\r
- + systemMessagesInfo.getLocale());\r
- return csm;\r
-\r
- }\r
- });\r
- }\r
- });\r
- localeSelect.setValue(new Locale("fi", "FI"));\r
- addComponent(localeSelect);\r
- final MyButton failButton = new MyButton();\r
- failButton.setCaption("Generate server side error");\r
- failButton.addClickListener(new ClickListener() {\r
-\r
- @Override\r
- public void buttonClick(ClickEvent event) {\r
- failButton.fail = true;\r
- failButton.markAsDirty();\r
- }\r
- });\r
- addComponent(failButton);\r
-\r
- }\r
-\r
- @Override\r
- protected String getTestDescription() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
-}\r
+package com.vaadin.tests.applicationservlet;
+
+import java.util.Locale;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.CustomizedSystemMessages;
+import com.vaadin.server.SystemMessages;
+import com.vaadin.server.SystemMessagesInfo;
+import com.vaadin.server.SystemMessagesProvider;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.NativeSelect;
+
+public class SystemMessagesTest extends AbstractTestUI {
+
+ public class MyButton extends Button {
+ private boolean fail = false;
+
+ @Override
+ public void beforeClientResponse(boolean initial) {
+ super.beforeClientResponse(initial);
+ if (fail) {
+ throw new RuntimeException("Failed on purpose");
+ }
+ }
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final NativeSelect localeSelect = new NativeSelect("UI locale");
+ localeSelect.setImmediate(true);
+ localeSelect.addItem(new Locale("en", "US"));
+ localeSelect.addItem(new Locale("fi", "FI"));
+ localeSelect.addItem(Locale.GERMANY);
+ localeSelect.addValueChangeListener(new ValueChangeListener() {
+
+ @Override
+ public void valueChange(ValueChangeEvent event) {
+ setLocale((Locale) localeSelect.getValue());
+ getSession().getService().setSystemMessagesProvider(
+ new SystemMessagesProvider() {
+
+ @Override
+ public SystemMessages getSystemMessages(
+ SystemMessagesInfo systemMessagesInfo) {
+ CustomizedSystemMessages csm = new CustomizedSystemMessages();
+ // csm.setInternalErrorCaption("Request query string: "
+ // + ((VaadinServletRequest) systemMessagesInfo
+ // .getRequest()).getQueryString());
+ csm.setInternalErrorMessage("MessagesInfo locale: "
+ + systemMessagesInfo.getLocale());
+ return csm;
+
+ }
+ });
+ }
+ });
+ localeSelect.setValue(new Locale("fi", "FI"));
+ addComponent(localeSelect);
+ final MyButton failButton = new MyButton();
+ failButton.setCaption("Generate server side error");
+ failButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ failButton.fail = true;
+ failButton.markAsDirty();
+ }
+ });
+ addComponent(failButton);
+
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
-package com.vaadin.tests.components.tabsheet;\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.Component;\r
-import com.vaadin.ui.TabSheet;\r
-import com.vaadin.ui.TextField;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class TabsheetShouldUpdateHeight extends TestBase {\r
-\r
- @Override\r
- public void setup() {\r
- final TabSheet tabsOuter = new TabSheet();\r
- final TabSheet tabsInner = new TabSheet();\r
-\r
- final Component tab2;\r
-\r
- tabsInner.addTab(tab2 = getLayoutWithComponents(6, "tab2"), "Tab 2");\r
- tabsInner.addTab(getLayoutWithComponents(8, "tab3"), "Tab 3");\r
-\r
- tabsOuter.addTab(tabsInner, "Inner tabs");\r
- tabsOuter.addTab(getLayoutWithComponents(10, "tab1"), "Tab 1");\r
-\r
- final Button btnSwitch = new Button("switch to Tab2",\r
- new Button.ClickListener() {\r
-\r
- @Override\r
- public void buttonClick(final ClickEvent inEvent) {\r
- tabsOuter.setSelectedTab(tabsInner);\r
- tabsInner.setSelectedTab(tab2);\r
- }\r
- });\r
-\r
- addComponent(tabsOuter);\r
- addComponent(btnSwitch);\r
- }\r
-\r
- private VerticalLayout getLayoutWithComponents(final int inAmount, String id) {\r
- final VerticalLayout v = new VerticalLayout();\r
- v.setDebugId(id);\r
- v.setSpacing(true);\r
- v.setMargin(true);\r
- for (int i = 0; i < inAmount; i++) {\r
- v.addComponent(new TextField("Text field:"));\r
- }\r
- return v;\r
- }\r
-\r
- @Override\r
- protected String getDescription() {\r
- return "click with mouse first on tab 3 and then on tab 1. now click on the button 'switch to tab2'. then click on tab 3 again and the scrollbars appear";\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- return 9275;\r
- }\r
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class TabsheetShouldUpdateHeight extends TestBase {
+
+ @Override
+ public void setup() {
+ final TabSheet tabsOuter = new TabSheet();
+ final TabSheet tabsInner = new TabSheet();
+
+ final Component tab2;
+
+ tabsInner.addTab(tab2 = getLayoutWithComponents(6, "tab2"), "Tab 2");
+ tabsInner.addTab(getLayoutWithComponents(8, "tab3"), "Tab 3");
+
+ tabsOuter.addTab(tabsInner, "Inner tabs");
+ tabsOuter.addTab(getLayoutWithComponents(10, "tab1"), "Tab 1");
+
+ final Button btnSwitch = new Button("switch to Tab2",
+ new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(final ClickEvent inEvent) {
+ tabsOuter.setSelectedTab(tabsInner);
+ tabsInner.setSelectedTab(tab2);
+ }
+ });
+
+ addComponent(tabsOuter);
+ addComponent(btnSwitch);
+ }
+
+ private VerticalLayout getLayoutWithComponents(final int inAmount, String id) {
+ final VerticalLayout v = new VerticalLayout();
+ v.setDebugId(id);
+ v.setSpacing(true);
+ v.setMargin(true);
+ for (int i = 0; i < inAmount; i++) {
+ v.addComponent(new TextField("Text field:"));
+ }
+ return v;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "click with mouse first on tab 3 and then on tab 1. now click on the button 'switch to tab2'. then click on tab 3 again and the scrollbars appear";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9275;
+ }
}
\ No newline at end of file
-package com.vaadin.tests.components.ui;\r
-\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.tests.components.AbstractTestUI;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Window;\r
-\r
-public class EmptyWindow extends AbstractTestUI {\r
-\r
- @Override\r
- protected void setup(VaadinRequest request) {\r
- addWindow(new Window("My empty window"));\r
- setContent(new Label("UI"));\r
- }\r
-\r
- @Override\r
- protected String getTestDescription() {\r
- return "There should be an empty window on the screen. Currently it should have the min width defined in VWindow";\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- return 10325;\r
- }\r
-\r
-}\r
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class EmptyWindow extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addWindow(new Window("My empty window"));
+ setContent(new Label("UI"));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "There should be an empty window on the screen. Currently it should have the min width defined in VWindow";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10325;
+ }
+
+}
-package com.vaadin.tests.components.ui;\r
-\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.tests.components.AbstractTestUI;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Window;\r
-\r
-public class WindowWithLabel extends AbstractTestUI {\r
-\r
- @Override\r
- protected void setup(VaadinRequest request) {\r
- setContent(new Label("UI"));\r
- Window window = new Window("A window");\r
- addWindow(window);\r
- }\r
-\r
- @Override\r
- protected String getTestDescription() {\r
- return "Resize the window. It should work.";\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- return 10375;\r
- }\r
-\r
-}\r
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Window;
+
+public class WindowWithLabel extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ setContent(new Label("UI"));
+ Window window = new Window("A window");
+ addWindow(window);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Resize the window. It should work.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10375;
+ }
+
+}
-package com.vaadin.tests.errorhandler;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-\r
-import com.vaadin.event.ListenerMethod.MethodException;\r
-import com.vaadin.server.DefaultErrorHandler;\r
-import com.vaadin.server.ErrorHandler;\r
-import com.vaadin.server.ServerRpcManager.RpcInvocationException;\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.tests.components.AbstractTestUI;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Button.ClickListener;\r
-import com.vaadin.ui.Component;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Notification;\r
-import com.vaadin.ui.Notification.Type;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class ErrorHandlers extends AbstractTestUI {\r
-\r
- public static class NotificationErrorHandler implements ErrorHandler {\r
-\r
- @Override\r
- public void error(com.vaadin.server.ErrorEvent event) {\r
- Notification.show(getErrorMessage(event), Type.ERROR_MESSAGE);\r
- }\r
-\r
- }\r
-\r
- @Override\r
- protected void setup(VaadinRequest request) {\r
- addComponent(runtimeExceptionOnClick(new Button("Standard button")));\r
- addComponent(npeOnClick(new Button("Standard button with NPE")));\r
- Button customErrorButton = notificationErrorHandler(new Button(\r
- "Button with notification error handler"));\r
- addComponent(runtimeExceptionOnClick(customErrorButton));\r
-\r
- final VerticalLayout layoutWithErrorHandler = new VerticalLayout(\r
- runtimeExceptionOnClick(new Button("Error handler on parent")));\r
- ErrorHandler e = new ErrorHandler() {\r
-\r
- @Override\r
- public void error(com.vaadin.server.ErrorEvent event) {\r
- layoutWithErrorHandler.addComponent(new Label("Layout error: "\r
- + getErrorMessage(event)));\r
- }\r
-\r
- };\r
- layoutWithErrorHandler.setErrorHandler(e);\r
- layoutWithErrorHandler\r
- .addComponent(notificationErrorHandler(npeOnClick(new Button(\r
- "Error handler on button and parent"))));\r
- addComponent(layoutWithErrorHandler);\r
- }\r
-\r
- private Button notificationErrorHandler(Button button) {\r
- button.setErrorHandler(new NotificationErrorHandler());\r
- return button;\r
- }\r
-\r
- protected static String getErrorMessage(com.vaadin.server.ErrorEvent event) {\r
- Component c = DefaultErrorHandler.findAbstractComponent(event);\r
- String errorMsg = "Error: '" + getMessage(event) + "' in ";\r
- errorMsg += c.getClass().getSimpleName() + " with caption '"\r
- + c.getCaption() + "'";\r
- return errorMsg;\r
- }\r
-\r
- private static String getMessage(com.vaadin.server.ErrorEvent event) {\r
- Throwable e = getUserCodeException(event);\r
- if (e.getMessage() != null) {\r
- return e.getMessage();\r
- } else {\r
- return e.getClass().getSimpleName();\r
- }\r
- }\r
-\r
- private static Throwable getUserCodeException(\r
- com.vaadin.server.ErrorEvent event) {\r
- Throwable t = event.getThrowable();\r
- if (t instanceof RpcInvocationException) {\r
- t = t.getCause();\r
- }\r
- if (t instanceof InvocationTargetException) {\r
- t = t.getCause();\r
- }\r
- if (t instanceof MethodException) {\r
- t = t.getCause();\r
- }\r
-\r
- return t;\r
-\r
- }\r
-\r
- private Button runtimeExceptionOnClick(Button customErrorButton) {\r
- customErrorButton.setCaption("RE: " + customErrorButton.getCaption());\r
-\r
- customErrorButton.addClickListener(new ClickListener() {\r
-\r
- @Override\r
- public void buttonClick(ClickEvent event) {\r
- throw new RuntimeException("Fail in click event");\r
- }\r
- });\r
- return customErrorButton;\r
- }\r
-\r
- private Button npeOnClick(Button customErrorButton) {\r
- customErrorButton.setCaption("NPE: " + customErrorButton.getCaption());\r
- customErrorButton.addClickListener(new ClickListener() {\r
-\r
- @Override\r
- public void buttonClick(ClickEvent event) {\r
- Integer i = null;\r
- i += 2;\r
- }\r
- });\r
- return customErrorButton;\r
- }\r
-\r
- @Override\r
- protected String getTestDescription() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- protected Integer getTicketNumber() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
-}\r
+package com.vaadin.tests.errorhandler;
+
+import java.lang.reflect.InvocationTargetException;
+
+import com.vaadin.event.ListenerMethod.MethodException;
+import com.vaadin.server.DefaultErrorHandler;
+import com.vaadin.server.ErrorHandler;
+import com.vaadin.server.ServerRpcManager.RpcInvocationException;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Notification.Type;
+import com.vaadin.ui.VerticalLayout;
+
+public class ErrorHandlers extends AbstractTestUI {
+
+ public static class NotificationErrorHandler implements ErrorHandler {
+
+ @Override
+ public void error(com.vaadin.server.ErrorEvent event) {
+ Notification.show(getErrorMessage(event), Type.ERROR_MESSAGE);
+ }
+
+ }
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ addComponent(runtimeExceptionOnClick(new Button("Standard button")));
+ addComponent(npeOnClick(new Button("Standard button with NPE")));
+ Button customErrorButton = notificationErrorHandler(new Button(
+ "Button with notification error handler"));
+ addComponent(runtimeExceptionOnClick(customErrorButton));
+
+ final VerticalLayout layoutWithErrorHandler = new VerticalLayout(
+ runtimeExceptionOnClick(new Button("Error handler on parent")));
+ ErrorHandler e = new ErrorHandler() {
+
+ @Override
+ public void error(com.vaadin.server.ErrorEvent event) {
+ layoutWithErrorHandler.addComponent(new Label("Layout error: "
+ + getErrorMessage(event)));
+ }
+
+ };
+ layoutWithErrorHandler.setErrorHandler(e);
+ layoutWithErrorHandler
+ .addComponent(notificationErrorHandler(npeOnClick(new Button(
+ "Error handler on button and parent"))));
+ addComponent(layoutWithErrorHandler);
+ }
+
+ private Button notificationErrorHandler(Button button) {
+ button.setErrorHandler(new NotificationErrorHandler());
+ return button;
+ }
+
+ protected static String getErrorMessage(com.vaadin.server.ErrorEvent event) {
+ Component c = DefaultErrorHandler.findAbstractComponent(event);
+ String errorMsg = "Error: '" + getMessage(event) + "' in ";
+ errorMsg += c.getClass().getSimpleName() + " with caption '"
+ + c.getCaption() + "'";
+ return errorMsg;
+ }
+
+ private static String getMessage(com.vaadin.server.ErrorEvent event) {
+ Throwable e = getUserCodeException(event);
+ if (e.getMessage() != null) {
+ return e.getMessage();
+ } else {
+ return e.getClass().getSimpleName();
+ }
+ }
+
+ private static Throwable getUserCodeException(
+ com.vaadin.server.ErrorEvent event) {
+ Throwable t = event.getThrowable();
+ if (t instanceof RpcInvocationException) {
+ t = t.getCause();
+ }
+ if (t instanceof InvocationTargetException) {
+ t = t.getCause();
+ }
+ if (t instanceof MethodException) {
+ t = t.getCause();
+ }
+
+ return t;
+
+ }
+
+ private Button runtimeExceptionOnClick(Button customErrorButton) {
+ customErrorButton.setCaption("RE: " + customErrorButton.getCaption());
+
+ customErrorButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ throw new RuntimeException("Fail in click event");
+ }
+ });
+ return customErrorButton;
+ }
+
+ private Button npeOnClick(Button customErrorButton) {
+ customErrorButton.setCaption("NPE: " + customErrorButton.getCaption());
+ customErrorButton.addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Integer i = null;
+ i += 2;
+ }
+ });
+ return customErrorButton;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Panel;\r
-\r
-public class CountView extends Panel implements View {\r
- public static final String NAME = "count";\r
-\r
- private static int count = 1;\r
-\r
- public CountView() {\r
- setContent(new Label("Created: " + count++));\r
- }\r
-\r
- public void enter(ViewChangeEvent event) {\r
-\r
- }\r
-\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+
+public class CountView extends Panel implements View {
+ public static final String NAME = "count";
+
+ private static int count = 1;
+
+ public CountView() {
+ setContent(new Label("Created: " + count++));
+ }
+
+ public void enter(ViewChangeEvent event) {
+
+ }
+
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.Navigator;\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.Notification;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.PasswordField;\r
-import com.vaadin.ui.TextField;\r
-import com.vaadin.ui.UI;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class LoginView extends Panel implements View {\r
-\r
- public static final String NAME = "login";\r
-\r
- public LoginView(final Navigator navigator,\r
- final String fragmentAndParameters) {\r
- Layout layout = new VerticalLayout();\r
-\r
- final TextField email = new TextField("Email");\r
- layout.addComponent(email);\r
-\r
- final PasswordField password = new PasswordField("Password");\r
- layout.addComponent(password);\r
-\r
- final Button login = new Button("Login", new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- Notification.show("Ok, let's pretend you're " + email);\r
-\r
- // indicate the user is logged in\r
- ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(email\r
- .getValue());\r
-\r
- // navigate back to the intended place\r
- navigator.navigateTo(fragmentAndParameters);\r
- }\r
- });\r
- layout.addComponent(login);\r
- setContent(layout);\r
-\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-}\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+public class LoginView extends Panel implements View {
+
+ public static final String NAME = "login";
+
+ public LoginView(final Navigator navigator,
+ final String fragmentAndParameters) {
+ Layout layout = new VerticalLayout();
+
+ final TextField email = new TextField("Email");
+ layout.addComponent(email);
+
+ final PasswordField password = new PasswordField("Password");
+ layout.addComponent(password);
+
+ final Button login = new Button("Login", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Notification.show("Ok, let's pretend you're " + email);
+
+ // indicate the user is logged in
+ ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(email
+ .getValue());
+
+ // navigate back to the intended place
+ navigator.navigateTo(fragmentAndParameters);
+ }
+ });
+ layout.addComponent(login);
+ setContent(layout);
+
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+}
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.Navigator;\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.server.ExternalResource;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Link;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.UI;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class MainView extends Panel implements View {\r
-\r
- public static final String NAME = "";\r
-\r
- private Button logOut;\r
-\r
- public MainView(final Navigator navigator) {\r
-\r
- VerticalLayout layout = new VerticalLayout();\r
-\r
- Link lnk = new Link("Count",\r
- new ExternalResource("#!" + CountView.NAME));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Message: Hello", new ExternalResource("#!"\r
- + MessageView.NAME + "/Hello"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Message: Bye", new ExternalResource("#!"\r
- + MessageView.NAME + "/Bye/Goodbye"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Private message: Secret", new ExternalResource("#!"\r
- + SecretView.NAME + "/Secret"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Private message: Topsecret", new ExternalResource("#!"\r
- + SecretView.NAME + "/Topsecret"));\r
- layout.addComponent(lnk);\r
-\r
- logOut = new Button("Logout", new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
-\r
- ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(null);\r
- logOut.setCaption("Login");\r
- navigator.navigateTo(LoginView.NAME);\r
-\r
- }\r
- });\r
- layout.addComponent(logOut);\r
- setContent(layout);\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
-\r
- }\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.server.ExternalResource;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+public class MainView extends Panel implements View {
+
+ public static final String NAME = "";
+
+ private Button logOut;
+
+ public MainView(final Navigator navigator) {
+
+ VerticalLayout layout = new VerticalLayout();
+
+ Link lnk = new Link("Count",
+ new ExternalResource("#!" + CountView.NAME));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Message: Hello", new ExternalResource("#!"
+ + MessageView.NAME + "/Hello"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Message: Bye", new ExternalResource("#!"
+ + MessageView.NAME + "/Bye/Goodbye"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Private message: Secret", new ExternalResource("#!"
+ + SecretView.NAME + "/Secret"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Private message: Topsecret", new ExternalResource("#!"
+ + SecretView.NAME + "/Topsecret"));
+ layout.addComponent(lnk);
+
+ logOut = new Button("Logout", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+
+ ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(null);
+ logOut.setCaption("Login");
+ navigator.navigateTo(LoginView.NAME);
+
+ }
+ });
+ layout.addComponent(logOut);
+ setContent(layout);
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+
+ }
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.server.ExternalResource;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.Link;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.UI;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class MainViewEarlierExample extends Panel implements View {\r
-\r
- public static final String NAME = "";\r
-\r
- public MainViewEarlierExample() {\r
-\r
- VerticalLayout layout = new VerticalLayout();\r
-\r
- Link lnk = new Link("Count",\r
- new ExternalResource("#!" + CountView.NAME));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Message: Hello", new ExternalResource("#!"\r
- + MessageView.NAME + "/Hello"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Message: Bye", new ExternalResource("#!"\r
- + MessageView.NAME + "/Bye/Goodbye"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Private message: Secret", new ExternalResource("#!"\r
- + SecretView.NAME + "/Secret"));\r
- layout.addComponent(lnk);\r
-\r
- lnk = new Link("Private message: Topsecret", new ExternalResource("#!"\r
- + SecretView.NAME + "/Topsecret"));\r
- layout.addComponent(lnk);\r
-\r
- // login/logout toggle so we can test this\r
- Button logInOut = new Button("Toggle login",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- Object user = ((NavigationtestUI) UI.getCurrent())\r
- .getLoggedInUser();\r
- ((NavigationtestUI) UI.getCurrent())\r
- .setLoggedInUser(user == null ? "Smee" : null);\r
- }\r
- });\r
- layout.addComponent(logInOut);\r
- setContent(layout);\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
-\r
- }\r
-\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.server.ExternalResource;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+public class MainViewEarlierExample extends Panel implements View {
+
+ public static final String NAME = "";
+
+ public MainViewEarlierExample() {
+
+ VerticalLayout layout = new VerticalLayout();
+
+ Link lnk = new Link("Count",
+ new ExternalResource("#!" + CountView.NAME));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Message: Hello", new ExternalResource("#!"
+ + MessageView.NAME + "/Hello"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Message: Bye", new ExternalResource("#!"
+ + MessageView.NAME + "/Bye/Goodbye"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Private message: Secret", new ExternalResource("#!"
+ + SecretView.NAME + "/Secret"));
+ layout.addComponent(lnk);
+
+ lnk = new Link("Private message: Topsecret", new ExternalResource("#!"
+ + SecretView.NAME + "/Topsecret"));
+ layout.addComponent(lnk);
+
+ // login/logout toggle so we can test this
+ Button logInOut = new Button("Toggle login",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Object user = ((NavigationtestUI) UI.getCurrent())
+ .getLoggedInUser();
+ ((NavigationtestUI) UI.getCurrent())
+ .setLoggedInUser(user == null ? "Smee" : null);
+ }
+ });
+ layout.addComponent(logInOut);
+ setContent(layout);
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+
+ }
+
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.Navigator;\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.server.ExternalResource;\r
-import com.vaadin.ui.Link;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class MainView__LastNavigatorExample extends Panel implements View {\r
-\r
- public static final String NAME = "";\r
-\r
- public MainView__LastNavigatorExample(final Navigator navigator) {\r
-\r
- Link lnk = new Link("Settings", new ExternalResource("#!"\r
- + SettingsView.NAME));\r
- VerticalLayout vl = new VerticalLayout();\r
- vl.addComponent(lnk);\r
- setContent(vl);\r
-\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
-\r
- }\r
-}\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.server.ExternalResource;
+import com.vaadin.ui.Link;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+
+public class MainView__LastNavigatorExample extends Panel implements View {
+
+ public static final String NAME = "";
+
+ public MainView__LastNavigatorExample(final Navigator navigator) {
+
+ Link lnk = new Link("Settings", new ExternalResource("#!"
+ + SettingsView.NAME));
+ VerticalLayout vl = new VerticalLayout();
+ vl.addComponent(lnk);
+ setContent(vl);
+
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+
+ }
+}
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-public class MessageView extends Panel implements View {\r
- public static final String NAME = "message";\r
- private Layout layout;\r
-\r
- public MessageView() {\r
- super(new VerticalLayout());\r
- setCaption("Messages");\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
- if (event.getParameters() != null) {\r
- // split at "/", add each part as a label\r
- String[] msgs = event.getParameters().split("/");\r
- for (String msg : msgs) {\r
- ((Layout) getContent()).addComponent(new Label(msg));\r
- }\r
- }\r
- }\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+
+public class MessageView extends Panel implements View {
+ public static final String NAME = "message";
+ private Layout layout;
+
+ public MessageView() {
+ super(new VerticalLayout());
+ setCaption("Messages");
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+ if (event.getParameters() != null) {
+ // split at "/", add each part as a label
+ String[] msgs = event.getParameters().split("/");
+ for (String msg : msgs) {
+ ((Layout) getContent()).addComponent(new Label(msg));
+ }
+ }
+ }
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.annotations.PreserveOnRefresh;\r
-import com.vaadin.navigator.Navigator;\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.ui.UI;\r
-\r
-@PreserveOnRefresh\r
-public class NavigationtestUI extends UI {\r
-\r
- Navigator navigator;\r
-\r
- String loggedInUser;\r
-\r
- @Override\r
- public void init(VaadinRequest request) {\r
- // Create Navigator, make it control the ViewDisplay\r
- navigator = new Navigator(this, this);\r
-\r
- // Add some Views\r
- // no fragment for main view\r
- navigator.addView(MainView__LastNavigatorExample.NAME,\r
- new MainView__LastNavigatorExample(navigator));\r
-\r
- // #settings\r
- navigator.addView(SettingsView.NAME, new SettingsView(navigator));\r
-\r
- // #count will be a new instance each time we navigate to it, counts:\r
- /*\r
- * Commented away from other example // no fragment for main view\r
- * navigator.addView(MainView.NAME, new MainView(navigator));\r
- * \r
- * navigator.addView(CountView.NAME, CountView.class);\r
- * \r
- * // #message adds a label with whatever it receives as a parameter\r
- * navigator.addView(MessageView.NAME, new MessageView());\r
- * \r
- * // #secret works as #message, but you need to be logged in\r
- * navigator.addView(SecretView.NAME, new SecretView());\r
- * \r
- * // #login will navigate to the main view if invoked via this\r
- * mechanism navigator.addView(LoginView.NAME, new LoginView(navigator,\r
- * MainView.NAME));\r
- * \r
- * // we'll handle permissions with a listener here, you could also do\r
- * // that in the View itself. navigator.addViewChangeListener(new\r
- * ViewChangeListener() {\r
- * \r
- * @Override public boolean beforeViewChange(ViewChangeEvent event) { if\r
- * (((NavigationtestUI)UI.getCurrent()).getLoggedInUser() == null) { //\r
- * Show to LoginView instead, pass intended view String\r
- * fragmentAndParameters = event.getViewName(); if\r
- * (event.getParameters() != null) { fragmentAndParameters += "/";\r
- * fragmentAndParameters += event.getParameters(); }\r
- * navigator.getDisplay().showView(new LoginView(navigator,\r
- * fragmentAndParameters)); return false;\r
- * \r
- * } else { return true; } }\r
- * \r
- * @Override public void afterViewChange(ViewChangeEvent event) {\r
- * \r
- * } });\r
- */\r
- // react to initial fragment, received before we created the Navigator\r
-\r
- // This was removed in beta10\r
- // navigator.navigate();\r
- }\r
-\r
- public String getLoggedInUser() {\r
- return loggedInUser;\r
- }\r
-\r
- public void setLoggedInUser(String user) {\r
- loggedInUser = user;\r
- }\r
-}\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.annotations.PreserveOnRefresh;
+import com.vaadin.navigator.Navigator;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+
+@PreserveOnRefresh
+public class NavigationtestUI extends UI {
+
+ Navigator navigator;
+
+ String loggedInUser;
+
+ @Override
+ public void init(VaadinRequest request) {
+ // Create Navigator, make it control the ViewDisplay
+ navigator = new Navigator(this, this);
+
+ // Add some Views
+ // no fragment for main view
+ navigator.addView(MainView__LastNavigatorExample.NAME,
+ new MainView__LastNavigatorExample(navigator));
+
+ // #settings
+ navigator.addView(SettingsView.NAME, new SettingsView(navigator));
+
+ // #count will be a new instance each time we navigate to it, counts:
+ /*
+ * Commented away from other example // no fragment for main view
+ * navigator.addView(MainView.NAME, new MainView(navigator));
+ *
+ * navigator.addView(CountView.NAME, CountView.class);
+ *
+ * // #message adds a label with whatever it receives as a parameter
+ * navigator.addView(MessageView.NAME, new MessageView());
+ *
+ * // #secret works as #message, but you need to be logged in
+ * navigator.addView(SecretView.NAME, new SecretView());
+ *
+ * // #login will navigate to the main view if invoked via this
+ * mechanism navigator.addView(LoginView.NAME, new LoginView(navigator,
+ * MainView.NAME));
+ *
+ * // we'll handle permissions with a listener here, you could also do
+ * // that in the View itself. navigator.addViewChangeListener(new
+ * ViewChangeListener() {
+ *
+ * @Override public boolean beforeViewChange(ViewChangeEvent event) { if
+ * (((NavigationtestUI)UI.getCurrent()).getLoggedInUser() == null) { //
+ * Show to LoginView instead, pass intended view String
+ * fragmentAndParameters = event.getViewName(); if
+ * (event.getParameters() != null) { fragmentAndParameters += "/";
+ * fragmentAndParameters += event.getParameters(); }
+ * navigator.getDisplay().showView(new LoginView(navigator,
+ * fragmentAndParameters)); return false;
+ *
+ * } else { return true; } }
+ *
+ * @Override public void afterViewChange(ViewChangeEvent event) {
+ *
+ * } });
+ */
+ // react to initial fragment, received before we created the Navigator
+
+ // This was removed in beta10
+ // navigator.navigate();
+ }
+
+ public String getLoggedInUser() {
+ return loggedInUser;
+ }
+
+ public void setLoggedInUser(String user) {
+ loggedInUser = user;
+ }
+}
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.annotations.Theme;\r
-import com.vaadin.server.VaadinRequest;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.UI;\r
-import com.vaadin.ui.VerticalLayout;\r
-\r
-@Theme("sassy")\r
-public class SassyUI extends UI {\r
- @Override\r
- public void init(VaadinRequest request) {\r
- Button b = new Button("Reindeer");\r
- Layout layout = new VerticalLayout();\r
- layout.addComponent(b);\r
-\r
- b = new Button("important");\r
- b.addStyleName("important");\r
- layout.addComponent(b);\r
-\r
- b = new Button("More important");\r
- b.setPrimaryStyleName("my-button");\r
- layout.addComponent(b);\r
-\r
- setContent(layout);\r
- }\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+@Theme("sassy")
+public class SassyUI extends UI {
+ @Override
+ public void init(VaadinRequest request) {
+ Button b = new Button("Reindeer");
+ Layout layout = new VerticalLayout();
+ layout.addComponent(b);
+
+ b = new Button("important");
+ b.addStyleName("important");
+ layout.addComponent(b);
+
+ b = new Button("More important");
+ b.setPrimaryStyleName("my-button");
+ layout.addComponent(b);
+
+ setContent(layout);
+ }
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.ui.Label;\r
-import com.vaadin.ui.Layout;\r
-\r
-public class SecretView extends MessageView implements View {\r
- public static final String NAME = "secret";\r
-\r
- public SecretView() {\r
- setCaption("Private messages");\r
-\r
- ((Layout) getContent()).addComponent(new Label("Some private stuff."));\r
- }\r
-\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import com.vaadin.navigator.View;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+
+public class SecretView extends MessageView implements View {
+ public static final String NAME = "secret";
+
+ public SecretView() {
+ setCaption("Private messages");
+
+ ((Layout) getContent()).addComponent(new Label("Some private stuff."));
+ }
+
}
\ No newline at end of file
-package com.vaadin.tests.minitutorials.v7b9;\r
-\r
-import java.util.Date;\r
-\r
-import com.vaadin.data.Property.ValueChangeEvent;\r
-import com.vaadin.data.Property.ValueChangeListener;\r
-import com.vaadin.data.util.ObjectProperty;\r
-import com.vaadin.navigator.Navigator;\r
-import com.vaadin.navigator.View;\r
-import com.vaadin.navigator.ViewChangeListener;\r
-import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\r
-import com.vaadin.ui.Button;\r
-import com.vaadin.ui.Button.ClickEvent;\r
-import com.vaadin.ui.DateField;\r
-import com.vaadin.ui.InlineDateField;\r
-import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.Notification;\r
-import com.vaadin.ui.Notification.Type;\r
-import com.vaadin.ui.Panel;\r
-import com.vaadin.ui.VerticalLayout;\r
-import com.vaadin.ui.themes.Reindeer;\r
-\r
-public class SettingsView extends Panel implements View {\r
-\r
- public static String NAME = "settings";\r
-\r
- Navigator navigator;\r
- DateField date;\r
- Button apply;\r
- Button cancel;\r
-\r
- String pendingViewAndParameters = null;\r
-\r
- public SettingsView(final Navigator navigator) {\r
- this.navigator = navigator;\r
- Layout layout = new VerticalLayout();\r
-\r
- date = new InlineDateField("Birth date");\r
- date.setImmediate(true);\r
- layout.addComponent(date);\r
- // pretend we have a datasource:\r
- date.setPropertyDataSource(new ObjectProperty<Date>(new Date()));\r
- date.setBuffered(true);\r
- // show buttons when date is changed\r
- date.addValueChangeListener(new ValueChangeListener() {\r
- public void valueChange(ValueChangeEvent event) {\r
- hideOrShowButtons();\r
- pendingViewAndParameters = null;\r
- }\r
- });\r
-\r
- // commit the TextField changes when "Save" is clicked\r
- apply = new Button("Apply", new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- date.commit();\r
- hideOrShowButtons();\r
- processPendingView();\r
- }\r
- });\r
- layout.addComponent(apply);\r
-\r
- // Discard the TextField changes when "Cancel" is clicked\r
- cancel = new Button("Cancel", new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- date.discard();\r
- hideOrShowButtons();\r
- processPendingView();\r
- }\r
- });\r
- cancel.setStyleName(Reindeer.BUTTON_LINK);\r
- layout.addComponent(cancel);\r
-\r
- // attach a listener so that we'll get asked isViewChangeAllowed?\r
- navigator.addViewChangeListener(new ViewChangeListener() {\r
- public boolean beforeViewChange(ViewChangeEvent event) {\r
- if (event.getOldView() == SettingsView.this\r
- && date.isModified()) {\r
-\r
- // save the View where the user intended to go\r
- pendingViewAndParameters = event.getViewName();\r
- if (event.getParameters() != null) {\r
- pendingViewAndParameters += "/";\r
- pendingViewAndParameters += event.getParameters();\r
- }\r
-\r
- // Prompt the user to save or cancel if the name is changed\r
- Notification.show("Please apply or cancel your changes",\r
- Type.WARNING_MESSAGE);\r
-\r
- return false;\r
- } else {\r
- return true;\r
- }\r
- }\r
-\r
- public void afterViewChange(ViewChangeEvent event) {\r
- pendingViewAndParameters = null;\r
- }\r
- });\r
-\r
- setContent(layout);\r
-\r
- }\r
-\r
- // Hide or show buttons depending on whether date is modified or not\r
- private void hideOrShowButtons() {\r
- apply.setVisible(date.isModified());\r
- cancel.setVisible(date.isModified());\r
- }\r
-\r
- // if there is a pending view change, do it now\r
- private void processPendingView() {\r
- if (pendingViewAndParameters != null) {\r
- navigator.navigateTo(pendingViewAndParameters);\r
- pendingViewAndParameters = null;\r
- }\r
- }\r
-\r
- public void navigateTo(String fragmentParameters) {\r
- hideOrShowButtons();\r
- }\r
-\r
- @Override\r
- public void enter(ViewChangeEvent event) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
+package com.vaadin.tests.minitutorials.v7b9;
+
+import java.util.Date;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Notification.Type;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+public class SettingsView extends Panel implements View {
+
+ public static String NAME = "settings";
+
+ Navigator navigator;
+ DateField date;
+ Button apply;
+ Button cancel;
+
+ String pendingViewAndParameters = null;
+
+ public SettingsView(final Navigator navigator) {
+ this.navigator = navigator;
+ Layout layout = new VerticalLayout();
+
+ date = new InlineDateField("Birth date");
+ date.setImmediate(true);
+ layout.addComponent(date);
+ // pretend we have a datasource:
+ date.setPropertyDataSource(new ObjectProperty<Date>(new Date()));
+ date.setBuffered(true);
+ // show buttons when date is changed
+ date.addValueChangeListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ hideOrShowButtons();
+ pendingViewAndParameters = null;
+ }
+ });
+
+ // commit the TextField changes when "Save" is clicked
+ apply = new Button("Apply", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ date.commit();
+ hideOrShowButtons();
+ processPendingView();
+ }
+ });
+ layout.addComponent(apply);
+
+ // Discard the TextField changes when "Cancel" is clicked
+ cancel = new Button("Cancel", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ date.discard();
+ hideOrShowButtons();
+ processPendingView();
+ }
+ });
+ cancel.setStyleName(Reindeer.BUTTON_LINK);
+ layout.addComponent(cancel);
+
+ // attach a listener so that we'll get asked isViewChangeAllowed?
+ navigator.addViewChangeListener(new ViewChangeListener() {
+ public boolean beforeViewChange(ViewChangeEvent event) {
+ if (event.getOldView() == SettingsView.this
+ && date.isModified()) {
+
+ // save the View where the user intended to go
+ pendingViewAndParameters = event.getViewName();
+ if (event.getParameters() != null) {
+ pendingViewAndParameters += "/";
+ pendingViewAndParameters += event.getParameters();
+ }
+
+ // Prompt the user to save or cancel if the name is changed
+ Notification.show("Please apply or cancel your changes",
+ Type.WARNING_MESSAGE);
+
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public void afterViewChange(ViewChangeEvent event) {
+ pendingViewAndParameters = null;
+ }
+ });
+
+ setContent(layout);
+
+ }
+
+ // Hide or show buttons depending on whether date is modified or not
+ private void hideOrShowButtons() {
+ apply.setVisible(date.isModified());
+ cancel.setVisible(date.isModified());
+ }
+
+ // if there is a pending view change, do it now
+ private void processPendingView() {
+ if (pendingViewAndParameters != null) {
+ navigator.navigateTo(pendingViewAndParameters);
+ pendingViewAndParameters = null;
+ }
+ }
+
+ public void navigateTo(String fragmentParameters) {
+ hideOrShowButtons();
+ }
+
+ @Override
+ public void enter(ViewChangeEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+
}
\ No newline at end of file