From: Marc Englund Date: Thu, 26 Feb 2009 14:16:42 +0000 (+0000) Subject: Fixes #2635 by removing reference manual links. X-Git-Tag: 6.7.0.beta1~3082 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=57033f860aed919eafda23fbaba9bf9d56588329;p=vaadin-framework.git Fixes #2635 by removing reference manual links. svn changeset:6974/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/demo/sampler/FeatureSet.java b/src/com/itmill/toolkit/demo/sampler/FeatureSet.java index 6de029b807..c36086c3dd 100644 --- a/src/com/itmill/toolkit/demo/sampler/FeatureSet.java +++ b/src/com/itmill/toolkit/demo/sampler/FeatureSet.java @@ -76,13 +76,12 @@ import com.itmill.toolkit.demo.sampler.features.trees.TreeActions; import com.itmill.toolkit.demo.sampler.features.trees.TreeMouseEvents; import com.itmill.toolkit.demo.sampler.features.trees.TreeMultiSelect; import com.itmill.toolkit.demo.sampler.features.trees.TreeSingleSelect; -import com.itmill.toolkit.demo.sampler.features.windows.WindowChild; -import com.itmill.toolkit.demo.sampler.features.windows.WindowChildAutosize; -import com.itmill.toolkit.demo.sampler.features.windows.WindowChildModal; -import com.itmill.toolkit.demo.sampler.features.windows.WindowChildPositionSize; -import com.itmill.toolkit.demo.sampler.features.windows.WindowChildScrollable; -import com.itmill.toolkit.demo.sampler.features.windows.WindowNativeNew; -import com.itmill.toolkit.demo.sampler.features.windows.WindowNativeShared; +import com.itmill.toolkit.demo.sampler.features.windows.Subwindow; +import com.itmill.toolkit.demo.sampler.features.windows.SubwindowAutoSized; +import com.itmill.toolkit.demo.sampler.features.windows.SubwindowClose; +import com.itmill.toolkit.demo.sampler.features.windows.SubwindowModal; +import com.itmill.toolkit.demo.sampler.features.windows.SubwindowPositioned; +import com.itmill.toolkit.demo.sampler.features.windows.SubwindowSized; /** * Contains the FeatureSet implementation and the structure for the feature @@ -302,16 +301,20 @@ public class FeatureSet extends Feature { public static class Windows extends FeatureSet { public Windows() { - super("Windows", new Feature[] { - // - new WindowNativeShared(), // - new WindowNativeNew(), // - new WindowChild(), // - new WindowChildAutosize(), // - new WindowChildModal(), // - new WindowChildPositionSize(), // - new WindowChildScrollable(), // - }); + super( + "Windows", + "Windows", + "Windows can for instance organize the UI, save space (popup windows), focus attention (modal windows), provide multiple views for multitasking (native browser windows).", + new Feature[] { + // + new Subwindow(), // + new SubwindowModal(), // + new SubwindowAutoSized(), // + new SubwindowSized(), // + new SubwindowPositioned(), // + new SubwindowClose(), // + // new NativeWindow(), // in progress + }); } } diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChild.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChild.png deleted file mode 100644 index ab9b46b2d0..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChild.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildAutosize.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildAutosize.png deleted file mode 100644 index a875d8f6e8..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildAutosize.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildModal.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildModal.png deleted file mode 100644 index bc7c695339..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildModal.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildPositionSize.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildPositionSize.png deleted file mode 100644 index 414de9a69c..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildPositionSize.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildScrollable.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildScrollable.png deleted file mode 100644 index 534fe5355c..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowChildScrollable.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeNew.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeNew.png deleted file mode 100644 index df94bafa38..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeNew.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeShared.png b/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeShared.png deleted file mode 100644 index e9278aaf2b..0000000000 Binary files a/src/com/itmill/toolkit/demo/sampler/features/windows/75-WindowNativeShared.png and /dev/null differ diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindow.java b/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindow.java new file mode 100644 index 0000000000..d82a2c3d12 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindow.java @@ -0,0 +1,37 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class NativeWindow extends Feature { + + @Override + public String getName() { + return "Subwindow"; + } + + @Override + public String getDescription() { + return "A Subwindow is a popup-window within the browser window." + + " There can be multiple subwindows in one (native) browser" + + " window."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindowExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindowExample.java new file mode 100644 index 0000000000..80c377fb11 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/NativeWindowExample.java @@ -0,0 +1,54 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.terminal.ExternalResource; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Window.CloseEvent; + +public class NativeWindowExample extends VerticalLayout { + + Window window; + + public NativeWindowExample() { + + // Create the window + window = new Window("Automatically sized subwindow"); + // Native windows should be explicitly removed from the application + // when appropriate; in this case when closed: + window.addListener(new Window.CloseListener() { + // inline close-listener + public void windowClose(CloseEvent e) { + getApplication().removeWindow(window); + } + }); + + // Configure the windows layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) window.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + // make it undefined for auto-sizing window + layout.setSizeUndefined(); + + // Add some content; + window.addComponent(new Label("This is is native (browser) window.")); + + // Add a button for opening the window + Button open = new Button("Open native window", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + getApplication().addWindow(window); + getApplication().getMainWindow().open( + new ExternalResource(window.getURL()), + "NativeWindowExample", 500, 500, + Window.BORDER_NONE); + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/Subwindow.java b/src/com/itmill/toolkit/demo/sampler/features/windows/Subwindow.java new file mode 100644 index 0000000000..27a053f66a --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/Subwindow.java @@ -0,0 +1,37 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class Subwindow extends Feature { + + @Override + public String getName() { + return "Subwindow"; + } + + @Override + public String getDescription() { + return "A Subwindow is a popup-window within the browser window." + + " There can be multiple subwindows in one (native) browser" + + " window."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSized.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSized.java new file mode 100644 index 0000000000..97c44fe885 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSized.java @@ -0,0 +1,38 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class SubwindowAutoSized extends Feature { + + @Override + public String getName() { + return "Window, automatic size"; + } + + @Override + public String getDescription() { + return "The window will be automatically sized to fit the contents," + + " if the size of the window (and it's layout) is undefined.
" + + " Note that by default Window contains a VerticalLayout that" + + " is 100% wide."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSizedExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSizedExample.java new file mode 100644 index 0000000000..cf7515d38b --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowAutoSizedExample.java @@ -0,0 +1,65 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.TextField; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SubwindowAutoSizedExample extends VerticalLayout { + + Window subwindow; + + public SubwindowAutoSizedExample() { + + // Create the window + subwindow = new Window("Automatically sized subwindow"); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + // make it undefined for auto-sizing window + layout.setSizeUndefined(); + + // Add some content; + for (int i = 0; i < 7; i++) { + TextField tf = new TextField(); + tf.setWidth("400px"); + subwindow.addComponent(tf); + } + + Button close = new Button("Close", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + // close the window by removing it from the main window + getApplication().getMainWindow().removeWindow(subwindow); + } + }); + // The components added to the window are actually added to the window's + // layout; you can use either. Alignments are set using the layout + layout.addComponent(close); + layout.setComponentAlignment(close, "right bottom"); + + // Add a button for opening the subwindow + Button open = new Button("Open sized window", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + if (subwindow.getParent() != null) { + // window is already showing + getWindow().showNotification( + "Window is already open"); + } else { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowClose.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowClose.java new file mode 100644 index 0000000000..4b86dedb7e --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowClose.java @@ -0,0 +1,35 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class SubwindowClose extends Feature { + + @Override + public String getName() { + return "Subwindow"; + } + + @Override + public String getDescription() { + return "Using a CloseListener one can detect when a window is closed."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowCloseExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowCloseExample.java new file mode 100644 index 0000000000..7543af2c4a --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowCloseExample.java @@ -0,0 +1,52 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; +import com.itmill.toolkit.ui.Window.CloseEvent; + +public class SubwindowCloseExample extends VerticalLayout { + + Window subwindow; + + public SubwindowCloseExample() { + + // Create the window + subwindow = new Window("A subwindow w/ close-listener"); + subwindow.addListener(new Window.CloseListener() { + // inline close-listener + public void windowClose(CloseEvent e) { + getApplication().getMainWindow().showNotification( + "Window closed"); + } + }); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + + // Add some content; a label and a close-button + Label message = new Label("This is a subwindow with a close-listener."); + subwindow.addComponent(message); + + // Add a button for opening the subwindow + Button open = new Button("Open window", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + if (subwindow.getParent() != null) { + // window is already showing + getWindow().showNotification("Window is already open"); + } else { + // Open the subwindow by adding it to the main window + getApplication().getMainWindow().addWindow(subwindow); + } + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowExample.java new file mode 100644 index 0000000000..8702171055 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowExample.java @@ -0,0 +1,56 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SubwindowExample extends VerticalLayout { + + Window subwindow; + + public SubwindowExample() { + + // Create the window + subwindow = new Window("A subwindow"); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + + // Add some content; a label and a close-button + Label message = new Label("This is a subwindow"); + subwindow.addComponent(message); + + Button close = new Button("Close", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + // close the window by removing it from the main window + getApplication().getMainWindow().removeWindow(subwindow); + } + }); + // The components added to the window are actually added to the window's + // layout; you can use either. Alignments are set using the layout + layout.addComponent(close); + layout.setComponentAlignment(close, "right"); + + // Add a button for opening the subwindow + Button open = new Button("Open subwindow", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + if (subwindow.getParent() != null) { + // window is already showing + getWindow().showNotification("Window is already open"); + } else { + // Open the subwindow by adding it to the main window + getApplication().getMainWindow().addWindow(subwindow); + } + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModal.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModal.java new file mode 100644 index 0000000000..5625e0b44e --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModal.java @@ -0,0 +1,48 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.demo.sampler.features.blueprints.ProminentPrimaryAction; +import com.itmill.toolkit.ui.Window; + +public class SubwindowModal extends Feature { + + @Override + public String getName() { + return "Modal window"; + } + + @Override + public String getDescription() { + return "A modal window blocks access to the rest of the application, " + + "until the window is closed (or made non-modal).
" + + " Use modal windows when the user must finish the task in the" + + " window before continuing."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { + // + Subwindow.class, // + ProminentPrimaryAction.class, // + }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return new NamedExternalResource[] { + // + new NamedExternalResource("Wikipedia: Modal window", + "http://en.wikipedia.org/wiki/Modal_window"), // + + }; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModalExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModalExample.java new file mode 100644 index 0000000000..279c7851f8 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowModalExample.java @@ -0,0 +1,62 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SubwindowModalExample extends VerticalLayout { + + Window subwindow; + + public SubwindowModalExample() { + + // Create the window... + subwindow = new Window("A modal subwindow"); + // ...and make it modal + subwindow.setModal(true); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + + // Add some content; a label and a close-button + Label message = new Label("This is a modal subwindow."); + subwindow.addComponent(message); + + Button close = new Button("Close", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + // close the window by removing it from the main window + getApplication().getMainWindow().removeWindow(subwindow); + } + }); + // The components added to the window are actually added to the window's + // layout; you can use either. Alignments are set using the layout + layout.addComponent(close); + layout.setComponentAlignment(close, "right"); + + // Add a button for opening the subwindow + Button open = new Button("Open modal window", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + if (subwindow.getParent() != null) { + // window is already showing + getWindow().showNotification( + "Window is already open"); + } else { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositioned.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositioned.java new file mode 100644 index 0000000000..a14383ee6b --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositioned.java @@ -0,0 +1,35 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class SubwindowPositioned extends Feature { + + @Override + public String getName() { + return "Window position"; + } + + @Override + public String getDescription() { + return "The position of a window can be specified, or it can be centered."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositionedExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositionedExample.java new file mode 100644 index 0000000000..54550b9b62 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowPositionedExample.java @@ -0,0 +1,90 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SubwindowPositionedExample extends VerticalLayout { + + Window subwindow; + + public SubwindowPositionedExample() { + setSpacing(true); + + // Create the window + subwindow = new Window("A positioned subwindow"); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + // make it fill the whole window + layout.setSizeFull(); + + // Add some content; a label and a close-button + Label message = new Label("This is a positioned window"); + subwindow.addComponent(message); + + Button close = new Button("Close", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + // close the window by removing it from the main window + getApplication().getMainWindow().removeWindow(subwindow); + } + }); + // The components added to the window are actually added to the window's + // layout; you can use either. Alignments are set using the layout + layout.addComponent(close); + layout.setComponentAlignment(close, "right bottom"); + + // Add buttons for opening the subwindow + Button fifty = new Button("Open positioned window at 50x50", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + subwindow.setPositionX(50); + subwindow.setPositionY(50); + if (subwindow.getParent() == null) { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(fifty); + Button onefifty = new Button("Open positioned window at 150x150", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + subwindow.setPositionX(150); + subwindow.setPositionY(150); + if (subwindow.getParent() == null) { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(onefifty); + Button center = new Button("Open centered window", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + subwindow.center(); + if (subwindow.getParent() == null) { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(center); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSized.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSized.java new file mode 100644 index 0000000000..cb77a54803 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSized.java @@ -0,0 +1,36 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.demo.sampler.APIResource; +import com.itmill.toolkit.demo.sampler.Feature; +import com.itmill.toolkit.demo.sampler.NamedExternalResource; +import com.itmill.toolkit.ui.Window; + +public class SubwindowSized extends Feature { + + @Override + public String getName() { + return "Window, explicit size"; + } + + @Override + public String getDescription() { + return "The size of a window can be specified - here the width is set" + + " in pixels, and the height in percent."; + } + + @Override + public APIResource[] getRelatedAPI() { + return new APIResource[] { new APIResource(Window.class) }; + } + + @Override + public Class[] getRelatedFeatures() { + return new Class[] { SubwindowModal.class }; + } + + @Override + public NamedExternalResource[] getRelatedResources() { + return null; + } + +} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSizedExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSizedExample.java new file mode 100644 index 0000000000..6c5485bb02 --- /dev/null +++ b/src/com/itmill/toolkit/demo/sampler/features/windows/SubwindowSizedExample.java @@ -0,0 +1,64 @@ +package com.itmill.toolkit.demo.sampler.features.windows; + +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class SubwindowSizedExample extends VerticalLayout { + + Window subwindow; + + public SubwindowSizedExample() { + + // Create the window + subwindow = new Window("A sized subwindow"); + subwindow.setWidth("500px"); + subwindow.setHeight("80%"); + + // Configure the windws layout; by default a VerticalLayout + VerticalLayout layout = (VerticalLayout) subwindow.getLayout(); + layout.setMargin(true); + layout.setSpacing(true); + // make it fill the whole window + layout.setSizeFull(); + + // Add some content; a label and a close-button + Label message = new Label("This is a sized window"); + subwindow.addComponent(message); + + Button close = new Button("Close", new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + // close the window by removing it from the main window + getApplication().getMainWindow().removeWindow(subwindow); + } + }); + // The components added to the window are actually added to the window's + // layout; you can use either. Alignments are set using the layout + layout.addComponent(close); + layout.setComponentAlignment(close, "right bottom"); + + // Add a button for opening the subwindow + Button open = new Button("Open sized window", + new Button.ClickListener() { + // inline click-listener + public void buttonClick(ClickEvent event) { + if (subwindow.getParent() != null) { + // window is already showing + getWindow().showNotification( + "Window is already open"); + } else { + // Open the subwindow by adding it to the main + // window + getApplication().getMainWindow().addWindow( + subwindow); + } + } + }); + addComponent(open); + + } + +} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChild.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChild.java deleted file mode 100644 index 83e07a6fca..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChild.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowChild extends Feature { - - @Override - public String getName() { - return "Child window"; - } - - @Override - public String getDescription() { - return "Creates and opens a new floating child window with its own state." - + "
Child windows are typically used for Dialog Windows and" - + " Multiple Document Interface applications."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowNativeNew.class, - WindowChildAutosize.class, WindowChildModal.class, - WindowChildPositionSize.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildAutosize.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildAutosize.java deleted file mode 100644 index 9780713241..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildAutosize.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Component; -import com.itmill.toolkit.ui.Window; - -public class WindowChildAutosize extends Feature { - - @Override - public String getName() { - return "Window autosizing"; - } - - @Override - public String getDescription() { - return "Creates and opens a new floating child window with its own state." - + "
The size of this child window will be adjusted automatically" - + " to fit the content (in this example, the caption). This is default" - + " behavior for a child window."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowNativeNew.class, - WindowChild.class, WindowChildModal.class, - WindowChildPositionSize.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Component getExample() { - return new WindowChildExample(); - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildExample.java deleted file mode 100644 index 69e2a3d890..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildExample.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowChildExample extends VerticalLayout implements - Window.CloseListener { - - private Button b1; - private Button b2; - private Label l; - - public WindowChildExample() { - setSpacing(true); - - b1 = new Button( - "Create and open a new child window with its own state", this, - "openButtonClick"); - addComponent(b1); - - l = new Label("Amount of child windows attached to the main window: x"); - addComponent(l); - - b2 = new Button("Refresh", this, "refreshButtonClick"); - addComponent(b2); - } - - public void openButtonClick(ClickEvent event) { - Window w = new Window("New child window"); - Label desc = new Label("This is a new child window with its own state." - + " The child window is added to the main window" - + " instead of the application."); - w.addComponent(desc); - w.addListener(this); - w.setResizable(false); - getApplication().getMainWindow().addWindow(w); - } - - public void refreshButtonClick(ClickEvent event) { - l.setValue("Amount of child windows attached to the main window: " - + getApplication().getMainWindow().getChildWindows().size()); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will be removed after closing - getApplication().getMainWindow().removeWindow(e.getWindow()); - System.err.println("Sampler->WindowChildExample: Window close event"); - } - -} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModal.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModal.java deleted file mode 100644 index 5d47c1fe88..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModal.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowChildModal extends Feature { - - @Override - public String getName() { - return "Window modality"; - } - - @Override - public String getDescription() { - return "Creates and opens a new modal child window with its own state." - + "
Child window modality means that you cannot access the" - + " underlying window(s) while the modal window is displayed."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowNativeNew.class, - WindowChild.class, WindowChildAutosize.class, - WindowChildPositionSize.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModalExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModalExample.java deleted file mode 100644 index 4e0dc89ba5..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildModalExample.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowChildModalExample extends VerticalLayout implements - Window.CloseListener { - - private Button b; - - public WindowChildModalExample() { - setSpacing(true); - - b = new Button("Create and open a new modal child window", this, - "openButtonClick"); - addComponent(b); - } - - public void openButtonClick(ClickEvent event) { - Window w = new Window("Modal child window"); - Label desc = new Label( - "This is a modal child window with its own state." - + " You cannot access the main window while the modal child" - + " window is shown."); - w.addComponent(desc); - w.addListener(this); - w.setResizable(false); - w.setModal(true); - getApplication().getMainWindow().addWindow(w); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will be removed after closing - getApplication().getMainWindow().removeWindow(e.getWindow()); - System.err - .println("Sampler->WindowChildModalExample: Window close event"); - } - -} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSize.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSize.java deleted file mode 100644 index 05851c5752..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSize.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowChildPositionSize extends Feature { - - @Override - public String getName() { - return "Window position and size"; - } - - @Override - public String getDescription() { - return "Creates and opens a new floating child window with specified" - + " size and position attributes. This child window is also" - + " set to allow resizing."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowNativeNew.class, - WindowChild.class, WindowChildAutosize.class, - WindowChildModal.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSizeExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSizeExample.java deleted file mode 100644 index 6b4e196f95..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildPositionSizeExample.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowChildPositionSizeExample extends VerticalLayout implements - Window.CloseListener { - - private Button b1; - private Button b2; - private Label l; - - public WindowChildPositionSizeExample() { - setSpacing(true); - - b1 = new Button("Create and open a new child window", this, - "openButtonClick"); - addComponent(b1); - - l = new Label("Amount of child windows attached to the main window: x"); - addComponent(l); - - b2 = new Button("Refresh", this, "refreshButtonClick"); - addComponent(b2); - } - - public void openButtonClick(ClickEvent event) { - Window w = new Window("New child window"); - Label desc = new Label("This is a new child window with a preset" - + " width, height and position. Resizing has also been" - + " enabled for this window."); - w.addComponent(desc); - w.addListener(this); - - // Set window position - w.setPositionX(300); - w.setPositionY(300); - - // Set window size - w.setWidth(300, UNITS_PIXELS); - w.setHeight(300, UNITS_PIXELS); - - // Enable resizing - w.setResizable(true); - - getApplication().getMainWindow().addWindow(w); - } - - public void refreshButtonClick(ClickEvent event) { - l.setValue("Amount of child windows attached to the main window: " - + getApplication().getMainWindow().getChildWindows().size()); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will be removed after closing - getApplication().getMainWindow().removeWindow(e.getWindow()); - System.err - .println("Sampler->WindowChildPositionSizeExample: Window close event"); - } - -} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollable.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollable.java deleted file mode 100644 index df16dbb24a..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollable.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowChildScrollable extends Feature { - - @Override - public String getName() { - return "Window - Scrollable"; - } - - @Override - public String getDescription() { - return "Creates and opens a new floating child window with specified" - + " size and position attributes. The content for this window" - + " is too big to fit in the specified size. Therefore you can" - + " use the scrollbars to view different part of the content."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowNativeNew.class, - WindowChild.class, WindowChildAutosize.class, - WindowChildModal.class, WindowChildPositionSize.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollableExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollableExample.java deleted file mode 100644 index 94e9829f8e..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowChildScrollableExample.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowChildScrollableExample extends VerticalLayout implements - Window.CloseListener { - - private Button b1; - private Button b2; - private Label l; - - public WindowChildScrollableExample() { - setSpacing(true); - - b1 = new Button("Create and open a scrollable child window", this, - "openButtonClick"); - addComponent(b1); - - l = new Label("Amount of child windows attached to the main window: x"); - addComponent(l); - - b2 = new Button("Refresh", this, "refreshButtonClick"); - addComponent(b2); - } - - public void openButtonClick(ClickEvent event) { - Window w = new Window("Scroll"); - Label desc = new Label( - "This is a new child window with a preset" - + " width, height and position. Resizing has been" - + " disabled for this window. Additionally, this text label" - + " is intentionally too large to fit the window. You can" - + " use the scrollbars to view different parts of the window content."); - w.addComponent(desc); - w.addListener(this); - - // Set window position - w.setPositionX(300); - w.setPositionY(300); - - // Set window size - w.setWidth(170, UNITS_PIXELS); - w.setHeight(100, UNITS_PIXELS); - - // Disable resizing - w.setResizable(false); - - getApplication().getMainWindow().addWindow(w); - } - - public void refreshButtonClick(ClickEvent event) { - l.setValue("Amount of child windows attached to the main window: " - + getApplication().getMainWindow().getChildWindows().size()); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will be removed after closing - getApplication().getMainWindow().removeWindow(e.getWindow()); - System.err - .println("Sampler->WindowChildScrollableExample: Window close event"); - } - -} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNew.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNew.java deleted file mode 100644 index a254e4783a..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNew.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowNativeNew extends Feature { - - @Override - public String getName() { - return "Native window - Unique"; - } - - @Override - public String getDescription() { - return "Creates and opens a new native browser window with its own state." - + "
Native browser" - + " windows can either share the same state (instance) or have their own" - + " internal state (instance). In practice the former option means that the" - + " URL of the window will always be same (pointing to the same Window object" - + ", whereas using the latter option generates a new URL (and Window instance)" - + " for each new window." - + "
It is essential to remember to remove the closed windows from the" - + " application e.g. by implementing the Window.CloseListener interface."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeShared.class, WindowChild.class, - WindowChildAutosize.class, WindowChildModal.class, - WindowChildPositionSize.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNewExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNewExample.java deleted file mode 100644 index cd91e0e2eb..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeNewExample.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.terminal.ExternalResource; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowNativeNewExample extends VerticalLayout implements - Window.CloseListener { - - private Button b1; - private Button b2; - private Label l; - - public WindowNativeNewExample() { - setSpacing(true); - - b1 = new Button( - "Create and open a new native window with its own state", this, - "openButtonClick"); - addComponent(b1); - - l = new Label("Amount of windows in memory:"); - addComponent(l); - - b2 = new Button("Refresh", this, "refreshButtonClick"); - addComponent(b2); - } - - public void openButtonClick(ClickEvent event) { - Window w = new Window("Native subwindow"); - Label desc = new Label( - "This is a new native window with its own state." - + " You'll notice that if you open a new window several" - + " times, the URL will be unique for each window, and the" - + " amount of windows in memory will increase by one." - + " When you close this window, the amount of windows in" - + " memory should decrease by one." - + " The window is added to the application and then" - + " opened through its unique URL."); - w.addComponent(desc); - w.addListener(this); - getApplication().addWindow(w); - getApplication().getMainWindow().open(new ExternalResource(w.getURL()), - "_blank"); - } - - public void refreshButtonClick(ClickEvent event) { - l.setValue("Amount of windows in memory: " - + getApplication().getWindows().size()); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will be removed after closing, - getApplication().removeWindow(e.getWindow()); - System.err - .println("Sampler->WindowNativeNewExample: Window close event"); - } - -} \ No newline at end of file diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeShared.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeShared.java deleted file mode 100644 index 62229d4ee9..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeShared.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import com.itmill.toolkit.demo.sampler.APIResource; -import com.itmill.toolkit.demo.sampler.Feature; -import com.itmill.toolkit.demo.sampler.NamedExternalResource; -import com.itmill.toolkit.ui.Window; - -public class WindowNativeShared extends Feature { - - @Override - public String getName() { - return "Native window - Shared"; - } - - @Override - public String getDescription() { - return "Creates and opens a new native browser window with shared state. If the" - + " window object has already been created, it will only be reopened." - + "
Native browser" - + " windows can either share the same state (instance) or have their own" - + " internal state (instance). In practice the former option means that the" - + " URL of the window will always be same (pointing to the same Window object" - + ", whereas using the latter option generates a new URL (and Window instance)" - + " for each new window." - + "
When using the latter option it is essential to remember to remove" - + " the closed windows from the" - + " application e.g. by implementing the Window.CloseListener interface."; - } - - @Override - public APIResource[] getRelatedAPI() { - return new APIResource[] { new APIResource(Window.class) }; - } - - @Override - public Class[] getRelatedFeatures() { - return new Class[] { WindowNativeNew.class, WindowChild.class, - WindowChildAutosize.class, WindowChildModal.class, - WindowChildPositionSize.class, WindowChildScrollable.class }; - } - - @Override - public NamedExternalResource[] getRelatedResources() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeSharedExample.java b/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeSharedExample.java deleted file mode 100644 index 1166d3ecf1..0000000000 --- a/src/com/itmill/toolkit/demo/sampler/features/windows/WindowNativeSharedExample.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.itmill.toolkit.demo.sampler.features.windows; - -import java.net.URL; - -import com.itmill.toolkit.terminal.ExternalResource; -import com.itmill.toolkit.ui.Button; -import com.itmill.toolkit.ui.Label; -import com.itmill.toolkit.ui.VerticalLayout; -import com.itmill.toolkit.ui.Window; -import com.itmill.toolkit.ui.Button.ClickEvent; -import com.itmill.toolkit.ui.Window.CloseEvent; - -public class WindowNativeSharedExample extends VerticalLayout implements - Window.CloseListener { - - private URL nativeWindowURL = null; - private Button b1; - private Button b2; - private Label l; - - public WindowNativeSharedExample() { - setSpacing(true); - - b1 = new Button("Create/open a new native window with shared state", - this, "openButtonClick"); - addComponent(b1); - - l = new Label("Amount of windows in memory:"); - addComponent(l); - - b2 = new Button("Refresh", this, "refreshButtonClick"); - addComponent(b2); - } - - public void openButtonClick(ClickEvent event) { - if (nativeWindowURL == null) { - final Window w = new Window("Native subwindow"); - final Label desc = new Label( - "This is a new native window with a shared state." - + " You'll notice that even if you open this several" - + " times, the URL will always be the same, and the" - + " amount of windows in memory will not increase. " - + " The window is added to the application and then" - + " opened through its unique URL."); - w.addComponent(desc); - w.addListener(this); - getApplication().addWindow(w); - nativeWindowURL = w.getURL(); - } - getApplication().getMainWindow().open( - new ExternalResource(nativeWindowURL), "_blank"); - } - - public void refreshButtonClick(ClickEvent event) { - l.setValue("Amount of windows in memory: " - + getApplication().getWindows().size()); - } - - public void windowClose(CloseEvent e) { - // In this example, the window will not be removed after closing, - // in order to preserve the window's URL functional. Normally you would - // remove the window after closing as follows: - // getApplication().removeWindow(e.getWindow()); - - System.err - .println("Sampler->WindowNativeSharedExample: Window close event"); - } - -} \ No newline at end of file