summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/minitutorials
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-01-04 11:03:56 +0200
committerArtur Signell <artur@vaadin.com>2013-01-04 11:03:56 +0200
commitbcc7fda715e689f6611f904d52e3fa41a331e63d (patch)
treef1c16e4ed9baad2197897efa17ec048b9382b9f8 /uitest/src/com/vaadin/tests/minitutorials
parenta0b0daa16f52e33fe07567fe87920eb660eb786c (diff)
downloadvaadin-framework-bcc7fda715e689f6611f904d52e3fa41a331e63d.tar.gz
vaadin-framework-bcc7fda715e689f6611f904d52e3fa41a331e63d.zip
CRLF -> LF
Change-Id: I864e3ad465539a5b7fee212390a723773f6930ac
Diffstat (limited to 'uitest/src/com/vaadin/tests/minitutorials')
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java40
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java104
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java120
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java118
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView__LastNavigatorExample.java58
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/MessageView.java56
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/NavigationtestUI.java154
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/SassyUI.java54
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/SecretView.java30
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java256
10 files changed, 495 insertions, 495 deletions
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
index 6e4b2d790d..7aaf810355 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
@@ -1,21 +1,21 @@
-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) {
-
- }
-
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
index a0cb6bacba..3aa3e42a58 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
@@ -1,52 +1,52 @@
-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;
+
+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
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
index c08803e549..3a1a685bbe 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
@@ -1,61 +1,61 @@
-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) {
-
- }
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
index 55b936f144..0eac6a042e 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
@@ -1,60 +1,60 @@
-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) {
-
- }
-
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView__LastNavigatorExample.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView__LastNavigatorExample.java
index 91d495cb24..5344a06a31 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView__LastNavigatorExample.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView__LastNavigatorExample.java
@@ -1,29 +1,29 @@
-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;
+
+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) {
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MessageView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MessageView.java
index fbb28b6f4a..e8612888e9 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MessageView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MessageView.java
@@ -1,29 +1,29 @@
-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));
- }
- }
- }
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/NavigationtestUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/NavigationtestUI.java
index c31bbef748..62941443b2 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/NavigationtestUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/NavigationtestUI.java
@@ -1,77 +1,77 @@
-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;
+
+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;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SassyUI.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SassyUI.java
index a167522eeb..0b7ad16657 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SassyUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SassyUI.java
@@ -1,28 +1,28 @@
-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);
- }
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SecretView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SecretView.java
index 93dbe0b9e3..68eb91fcc5 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SecretView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SecretView.java
@@ -1,16 +1,16 @@
-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."));
- }
-
+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
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
index 1e026fe641..61492adc39 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
@@ -1,129 +1,129 @@
-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
-
- }
-
+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