binder = new Binder<>();
143 | binder.forField(cbMenuVisible).bind(DemoSettings::isMenuVisible, DemoSettings::setMenuVisible);
144 | binder.forField(cbSwipeOpen).bind(DemoSettings::isSwipeOpen, DemoSettings::setSwipeOpen);
145 | binder.forField(cbFixed).bind(DemoSettings::isFixed, DemoSettings::setFixed);
146 | binder.forField(cbReveals).bind(DemoSettings::isReveals, DemoSettings::setReveals);
147 | binder.forField(cbCompact).bind(DemoSettings::isCompact, DemoSettings::setCompact);
148 | binder.forField(cbPersistent).bind(DemoSettings::isDrawerPersistent, DemoSettings::setDrawerPersistent);
149 | binder.forField(cbBelowHeader).bind(DemoSettings::isDrawerBelowHeader, DemoSettings::setDrawerBelowHeader);
150 | binder.forField(cbRightAlignment).bind(DemoSettings::isDrawerRightAlignment, DemoSettings::setDrawerRightAlignment);
151 | binder.setBean(this.settings);
152 |
153 | VerticalLayout content =
154 | new VerticalLayout(cbMenuVisible, cbSwipeOpen, cbFixed, cbReveals, cbCompact, cbPersistent, cbBelowHeader, cbRightAlignment);
155 | content.setSpacing(false);
156 |
157 | HorizontalLayout buttons = new HorizontalLayout();
158 | Button btnOk =
159 | new Button(
160 | "OK",
161 | ev -> {
162 | applySettings();
163 | dialog.close();
164 | });
165 |
166 | Button btnCancel = new Button("Cancel", ev -> dialog.close());
167 | btnOk.getElement().setAttribute("theme", "primary");
168 | buttons.setSpacing(true);
169 | buttons.add(btnOk, btnCancel);
170 | buttons.setSpacing(true);
171 |
172 | dialog.add(content, buttons);
173 | dialog.setSizeUndefined();
174 | dialog.open();
175 | }
176 |
177 | private Image createLogoImage() {
178 | Image img = new Image("/frontend/images/applogo.png", "applogo");
179 | img.addClassName("applogo");
180 | return img;
181 | }
182 |
183 | private Component createAvatarComponent() {
184 | Div container = new Div();
185 | container.getElement().setAttribute("style", "text-align: center;");
186 | Image img = new Image("/frontend/images/avatar.png", "avatar");
187 | img.getStyle().set("width", "80px");
188 | img.getStyle().set("margin-top", "20px");
189 | Span userTitle = new Span("User");
190 | userTitle.setWidthFull();
191 | userTitle.getStyle().set("display", "block");
192 | userTitle.getStyle().set("font-size", "large");
193 | userTitle.getStyle().set("font-weight", "bold");
194 | container.add(img, userTitle);
195 | return container;
196 | }
197 |
198 | private void toggleSettings(MenuItem toggleSettings) {
199 | settings.setEnabled(!settings.isEnabled());
200 | miSettings.setEnabled(settings.isEnabled());
201 | app.setToolbarIconButtons(miSettings);
202 | if (settings.isEnabled()) {
203 | toggleSettings.setLabel("Disable settings");
204 | } else {
205 | toggleSettings.setLabel("Enable settings");
206 | }
207 | }
208 |
209 | private Component[] createMenuItems() {
210 |
211 | MenuItem miHello =
212 | new MenuItem("More content", () -> showContent("Hello!")).setIcon("settings");
213 |
214 | MenuItem miToggleSettings = new MenuItem().setIcon("settings");
215 | miToggleSettings.setCommand(() -> toggleSettings(miToggleSettings));
216 | toggleSettings(miToggleSettings);
217 |
218 | this.getElement().getStyle().set("--icon-spacing", "normal");
219 |
220 | return new Component[] {
221 |
222 | // left, middle and right commands
223 | new MenuItem("Click", VaadinIcon.POINTER)
224 | .setCommand(MouseButton.LEFT, () -> Notification.show("LEFT click"))
225 | .setCommand(MouseButton.MIDDLE, () -> Notification.show("MIDDLE click"))
226 | .setCommand(MouseButton.RIGHT, () -> Notification.show("RIGHT click")),
227 | new MenuItem("No icon"),
228 | new MenuItem("No icon, spaced").configure(mi -> mi.setIconBlank()),
229 |
230 | // menu item with custom content
231 | new MenuItem("Toggle").configure(mi -> mi.add(new PaperToggle())),
232 | new MenuItem("Toggle", VaadinIcon.BACKSPACE).configure(mi -> mi.add(new PaperToggle())),
233 | new MenuItem("Toggle", MenuItem.BLANK).configure(mi -> mi.add(new PaperToggle())),
234 | new MenuItem("External link").setHref("http://www.google.com"),
235 | new MenuItem("Internal Link", SampleInternalView.class),
236 |
237 | // icon as VaadinIcon enum
238 | new MenuItem("Content", VaadinIcon.BOOK, () -> showHamletContent())
239 | .setCommand(
240 | MouseButton.MIDDLE,
241 | () -> {
242 | getUI()
243 | .ifPresent(
244 | ui ->
245 | ui.getPage().executeJs("window.open(window.location.href, '_blank')"));
246 | }),
247 | miToggleSettings,
248 | miHello,
249 | new MenuItem("About", "cloud", () -> showContent("About")), // icon as string
250 | new MenuItem("Clear Items", "clear", () -> app.clearMenuItems()),
251 | new MenuItem(
252 | "Change Text & Icon",
253 | "cloud",
254 | () -> {
255 | if (miHello.getIcon().equals("star")) {
256 | miHello.setIcon("cloud");
257 | miHello.setLabel("Say hello modified");
258 | } else {
259 | miHello.setIcon("star");
260 | miHello.setLabel("Say hello");
261 | }
262 | }),
263 | new MenuItem("SubMenu")
264 | .setIcon("build")
265 | .setOpened(true)
266 | .add(
267 | new MenuItem("Hello Again", "inbox", () -> showContent("Hello Again!")),
268 | new MenuItem("And Again", () -> showContent("And Again!")),
269 | new MenuItem("SubMenu")
270 | .setOpened(true)
271 | .add(new MenuItem("Hello Again", () -> showContent("Hello Again!")))
272 | .add(new MenuItem("And Again", () -> showContent("And Again!")))),
273 | new MenuSeparator("Separator"),
274 | new MenuItem("Item 1"),
275 | new MenuItem("Item 2"),
276 | new MenuItem("Item 3"),
277 | new MenuItem("Item 4"),
278 | new MenuItem("Item 5"),
279 | new MenuItem("Item 6"),
280 | new MenuSeparator(),
281 | new MenuItem("Item 7"),
282 | new MenuItem("Item 8"),
283 | new MenuItem("Item 9"),
284 | new MenuItem("Item 10"),
285 | new MenuItem("Item 11"),
286 | new MenuItem("Item 12")
287 | };
288 | }
289 |
290 | private void showContent(String content) {
291 | container.setClassName("");
292 | container.removeAll();
293 | H3 label = new H3();
294 | label.setSizeFull();
295 | label.setText(content);
296 | PaperCard pc =
297 | new PaperCard(
298 | label,
299 | new MenuItem("Delete", () -> Notification.show("Delete action from card")),
300 | new MenuItem("Delete", () -> Notification.show("Delete action from card"))
301 | .setIcon("delete"));
302 | pc.setWidth("100%");
303 | container.add(pc);
304 | }
305 |
306 | private void showHamletContent() {
307 | InputStream in = this.getClass().getClassLoader().getResourceAsStream("hamlet");
308 | String text =
309 | new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
310 |
311 | container.removeAll();
312 | container.setClassName("hamlet");
313 | for (String block : text.split("\n\n")) {
314 | if (block.startsWith("$")) {
315 |
316 | } else if (block.startsWith("[")) {
317 | PaperCard card = new PaperCard();
318 | card.setCardContent(new Span(block.substring(1, block.indexOf("]"))));
319 | card.getElement().setAttribute("elevation", "0");
320 | container.add(card);
321 | } else {
322 | PaperCard card = new PaperCard();
323 | String ss[] = block.split("\\.", 2);
324 | card.setCardContent(new Div(new H5(ss[0]), new Span(ss[1])));
325 | if (ss[0].equals("Claudius")) {
326 | container.setHorizontalComponentAlignment(Alignment.END, card);
327 | card.addClassName("claudius");
328 | } else {
329 | container.setHorizontalComponentAlignment(Alignment.START, card);
330 | }
331 | container.add(card);
332 | }
333 | }
334 | }
335 | }
336 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/CustomAppLayout.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout;
21 |
22 | import com.vaadin.flow.component.html.Div;
23 | import com.vaadin.flow.component.html.Image;
24 | import com.vaadin.flow.component.html.Span;
25 |
26 | @SuppressWarnings("serial")
27 | public class CustomAppLayout extends AppLayout {
28 |
29 | public CustomAppLayout() {
30 | setMenuItems(new MenuItem("Item 1"), new MenuItem("Item 2"));
31 |
32 | // menu header
33 | Div container = new Div();
34 | container.getElement().setAttribute("style", "text-align: center;");
35 | Image img = new Image("frontend/images/avatar.png", "avatar");
36 | img.getStyle().set("width", "80px");
37 | img.getStyle().set("margin-top", "20px");
38 | Span userTitle = new Span("User");
39 | userTitle.setWidthFull();
40 | userTitle.getStyle().set("display", "block");
41 | userTitle.getStyle().set("font-size", "large");
42 | userTitle.getStyle().set("font-weight", "bold");
43 | container.add(img, userTitle);
44 | setMenuHeader(container);
45 |
46 | // logo
47 | Image imglogo = new Image("frontend/images/applogo.png", "applogo");
48 | imglogo.setWidth("25px");
49 | addToTitleSection(imglogo);
50 |
51 | // title
52 | addToTitleSection(new Div(new Span("Test Application")));
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/DemoSettings.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout;
21 |
22 | public class DemoSettings {
23 |
24 | private boolean enabled;
25 |
26 | private boolean menuVisible;
27 |
28 | private boolean swipeOpen;
29 |
30 | private boolean fixed;
31 |
32 | private boolean reveals;
33 |
34 | private boolean compact;
35 |
36 | private boolean drawerPersistent;
37 |
38 | private boolean drawerBelowHeader;
39 |
40 | private boolean drawerRightAlignment;
41 |
42 | public boolean isEnabled() {
43 | return enabled;
44 | }
45 |
46 | public void setEnabled(boolean enabled) {
47 | this.enabled = enabled;
48 | }
49 |
50 | public boolean isMenuVisible() {
51 | return menuVisible;
52 | }
53 |
54 | public void setMenuVisible(boolean menuVisible) {
55 | this.menuVisible = menuVisible;
56 | }
57 |
58 | public boolean isSwipeOpen() {
59 | return swipeOpen;
60 | }
61 |
62 | public void setSwipeOpen(boolean swipeOpen) {
63 | this.swipeOpen = swipeOpen;
64 | }
65 |
66 | public boolean isFixed() {
67 | return fixed;
68 | }
69 |
70 | public void setFixed(boolean fixed) {
71 | this.fixed = fixed;
72 | }
73 |
74 | public boolean isReveals() {
75 | return reveals;
76 | }
77 |
78 | public void setReveals(boolean reveals) {
79 | this.reveals = reveals;
80 | }
81 |
82 | public boolean isCompact() {
83 | return compact;
84 | }
85 |
86 | public void setCompact(boolean compact) {
87 | this.compact = compact;
88 | }
89 |
90 | public boolean isDrawerPersistent() {
91 | return drawerPersistent;
92 | }
93 |
94 | public void setDrawerPersistent(boolean drawerPersistent) {
95 | this.drawerPersistent = drawerPersistent;
96 | }
97 |
98 | public boolean isDrawerBelowHeader() {
99 | return drawerBelowHeader;
100 | }
101 |
102 | public void setDrawerBelowHeader(boolean drawerBelowHeader) {
103 | this.drawerBelowHeader = drawerBelowHeader;
104 | }
105 |
106 | public boolean isDrawerRightAlignment() {
107 | return drawerRightAlignment;
108 | }
109 |
110 | public void setDrawerRightAlignment(boolean drawerRightAlignment) {
111 | this.drawerRightAlignment = drawerRightAlignment;
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/SampleInternalView.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout;
21 |
22 | import com.vaadin.flow.component.html.Div;
23 | import com.vaadin.flow.component.html.Span;
24 | import com.vaadin.flow.router.Route;
25 | import org.junit.Ignore;
26 |
27 | @SuppressWarnings("serial")
28 | @Route("internal-view")
29 | @Ignore
30 | public class SampleInternalView extends Div {
31 |
32 | public SampleInternalView() {
33 | add(new Span("Internal view"));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/SampleView.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout;
21 |
22 | import com.vaadin.flow.component.dependency.Uses;
23 | import com.vaadin.flow.component.html.Div;
24 | import com.vaadin.flow.component.html.Span;
25 | import com.vaadin.flow.router.Route;
26 | import org.junit.Ignore;
27 |
28 | @SuppressWarnings("serial")
29 | @Route(value = "view", layout = CustomAppLayout.class)
30 | @Uses(AppLayout.class)
31 | @Ignore
32 | public class SampleView extends Div {
33 |
34 | {
35 | add(new Span("Hello world"));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/integration/AbstractViewTest.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.integration;
21 |
22 | import com.vaadin.testbench.ScreenshotOnFailureRule;
23 | import com.vaadin.testbench.TestBench;
24 | import com.vaadin.testbench.parallel.ParallelTest;
25 | import org.junit.Before;
26 | import org.junit.Rule;
27 | import org.openqa.selenium.chrome.ChromeDriver;
28 |
29 | /**
30 | * Base class for ITs
31 | *
32 | * The tests use Chrome driver (see pom.xml for integration-tests profile) to run integration
33 | * tests on a headless Chrome. If a property {@code test.use .hub} is set to true, {@code
34 | * AbstractViewTest} will assume that the TestBench test is running in a CI environment. In order to
35 | * keep the this class light, it makes certain assumptions about the CI environment (such as
36 | * available environment variables). It is not advisable to use this class as a base class for you
37 | * own TestBench tests.
38 | *
39 | *
To learn more about TestBench, visit Vaadin TestBench.
41 | */
42 | public abstract class AbstractViewTest extends ParallelTest {
43 | private static final int SERVER_PORT = 8080;
44 |
45 | private final String route;
46 |
47 | @Rule public ScreenshotOnFailureRule rule = new ScreenshotOnFailureRule(this, true);
48 |
49 | public AbstractViewTest() {
50 | this("");
51 | }
52 |
53 | protected AbstractViewTest(String route) {
54 | this.route = route;
55 | }
56 |
57 | @Before
58 | public void setup() throws Exception {
59 | if (isUsingHub()) {
60 | super.setup();
61 | } else {
62 | setDriver(TestBench.createDriver(new ChromeDriver()));
63 | }
64 | getDriver().get(getURL(route));
65 | }
66 |
67 | /**
68 | * Returns deployment host name concatenated with route.
69 | *
70 | * @return URL to route
71 | */
72 | private static String getURL(String route) {
73 | return String.format("http://%s:%d/%s", getDeploymentHostname(), SERVER_PORT, route);
74 | }
75 |
76 | /** Property set to true when running on a test hub. */
77 | private static final String USE_HUB_PROPERTY = "test.use.hub";
78 |
79 | /**
80 | * Returns whether we are using a test hub. This means that the starter is running tests in
81 | * Vaadin's CI environment, and uses TestBench to connect to the testing hub.
82 | *
83 | * @return whether we are using a test hub
84 | */
85 | private static boolean isUsingHub() {
86 | return Boolean.TRUE.toString().equals(System.getProperty(USE_HUB_PROPERTY));
87 | }
88 |
89 | /**
90 | * If running on CI, get the host name from environment variable HOSTNAME
91 | *
92 | * @return the host name
93 | */
94 | private static String getDeploymentHostname() {
95 | return isUsingHub() ? System.getenv("HOSTNAME") : "localhost";
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/integration/ViewIT.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.integration;
21 |
22 | import static org.hamcrest.Matchers.empty;
23 | import static org.hamcrest.Matchers.is;
24 | import static org.hamcrest.Matchers.not;
25 | import static org.junit.Assert.assertThat;
26 |
27 | import com.vaadin.testbench.TestBenchElement;
28 | import java.util.List;
29 | import org.hamcrest.Description;
30 | import org.hamcrest.Matcher;
31 | import org.hamcrest.TypeSafeDiagnosingMatcher;
32 | import org.junit.Test;
33 | import org.openqa.selenium.By;
34 | import org.openqa.selenium.WebElement;
35 |
36 | public class ViewIT extends AbstractViewTest {
37 |
38 | private Matcher hasBeenUpgradedToCustomElement =
39 | new TypeSafeDiagnosingMatcher() {
40 |
41 | @Override
42 | public void describeTo(Description description) {
43 | description.appendText("a custom element");
44 | }
45 |
46 | @Override
47 | protected boolean matchesSafely(TestBenchElement item, Description mismatchDescription) {
48 | String script = "let s=arguments[0].shadowRoot; return !!(s&&s.childElementCount)";
49 | if (!item.getTagName().contains("-")) return true;
50 | if ((Boolean) item.getCommandExecutor().executeScript(script, item)) return true;
51 | else {
52 | mismatchDescription.appendText(item.getTagName() + " ");
53 | mismatchDescription.appendDescriptionOf(is(not(this)));
54 | return false;
55 | }
56 | }
57 | };
58 |
59 | @Test
60 | public void componentWorks() {
61 | TestBenchElement header = $("app-header").first();
62 | TestBenchElement drawer = $("app-drawer").first();
63 |
64 | assertThat(header, hasBeenUpgradedToCustomElement);
65 | assertThat(drawer, hasBeenUpgradedToCustomElement);
66 |
67 | TestBenchElement toolbar = header.findElement(By.tagName("app-toolbar"));
68 | assertThat(toolbar, hasBeenUpgradedToCustomElement);
69 |
70 | TestBenchElement menu = toolbar.findElement(By.cssSelector("paper-icon-button[icon='menu']"));
71 | toolbar.findElement(By.cssSelector("img.applogo"));
72 | toolbar.findElement(By.cssSelector("div[main-title]"));
73 | toolbar.findElement(By.cssSelector("paper-icon-button[role='button'][icon='settings']"));
74 |
75 | assertThat(menu, hasBeenUpgradedToCustomElement);
76 |
77 | TestBenchElement listbox = drawer.findElement(By.cssSelector("paper-listbox"));
78 | assertThat(listbox, hasBeenUpgradedToCustomElement);
79 |
80 | List items = listbox.findElements(By.cssSelector("*"));
81 | assertThat(items, is(not(empty())));
82 |
83 | for (WebElement item : items) {
84 | assertThat((TestBenchElement) item, hasBeenUpgradedToCustomElement);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/menu/PaperButton.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.menu;
21 |
22 | import com.vaadin.flow.component.Component;
23 | import com.vaadin.flow.component.Tag;
24 | import com.vaadin.flow.component.dependency.JsModule;
25 | import com.vaadin.flow.component.dependency.NpmPackage;
26 | import com.vaadin.flow.server.Command;
27 |
28 | /**
29 | * Component that renders a paper-button
30 | *
31 | * @author mlopez
32 | */
33 | @SuppressWarnings("serial")
34 | @NpmPackage(value = "@polymer/paper-button", version = "3.0.1")
35 | @JsModule("@polymer/paper-button/paper-button.js")
36 | @Tag("paper-button")
37 | class PaperButton extends Component {
38 |
39 | public PaperButton(String label) {
40 | setLabel(label);
41 | }
42 |
43 | public PaperButton(String label, Command command) {
44 | this.setLabel(label);
45 | this.getElement().addEventListener("click", e -> command.execute());
46 | }
47 |
48 | public void setLabel(String label) {
49 | this.getElement().setText(label);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/menu/PaperCard.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.menu;
21 |
22 | import com.flowingcode.addons.applayout.MenuItem;
23 | import com.vaadin.flow.component.Component;
24 | import com.vaadin.flow.component.HasComponents;
25 | import com.vaadin.flow.component.HasSize;
26 | import com.vaadin.flow.component.HasStyle;
27 | import com.vaadin.flow.component.Tag;
28 | import com.vaadin.flow.component.dependency.JsModule;
29 | import com.vaadin.flow.component.dependency.NpmPackage;
30 | import com.vaadin.flow.component.html.Div;
31 | import com.vaadin.flow.component.orderedlayout.ThemableLayout;
32 | import com.vaadin.flow.dom.Element;
33 | import java.util.ArrayList;
34 | import java.util.List;
35 |
36 | /**
37 | * Component that renders a paper-card
38 | *
39 | * @author mlopez
40 | */
41 | @SuppressWarnings("serial")
42 | @NpmPackage(value = "@polymer/paper-card", version = "3.0.1")
43 | @JsModule("@polymer/paper-card/paper-card.js")
44 | @Tag("paper-card")
45 | public class PaperCard extends Component implements HasSize, HasStyle, ThemableLayout {
46 |
47 | private final Div cardContentDiv = new Div();
48 |
49 | private final Div cardActionsDiv = new Div();
50 |
51 | @SuppressWarnings("squid:S1604")
52 | private final HasComponents hasComponentsVersion =
53 | new HasComponents() {
54 | @Override
55 | public Element getElement() {
56 | return PaperCard.this.getElement();
57 | }
58 | };
59 |
60 | public PaperCard() {
61 | this(null);
62 | }
63 |
64 | public PaperCard(final Component cardContent, final MenuItem... cardActions) {
65 | cardContentDiv.setClassName("card-content");
66 | cardActionsDiv.setClassName("card-actions");
67 |
68 | hasComponentsVersion.add(cardContentDiv);
69 |
70 | if (cardContent != null) {
71 | setCardContent(cardContent);
72 | }
73 |
74 | setCardActions(cardActions);
75 | }
76 |
77 | public void setCardActions(final MenuItem... cardActions) {
78 | if (cardActions.length > 0) {
79 | final List buttons = new ArrayList<>();
80 | for (final MenuItem menuItem : cardActions) {
81 | if (menuItem.getIcon() != null) {
82 | buttons.add(menuItem);
83 | } else {
84 | buttons.add(menuItem);
85 | }
86 | }
87 | final Div inner = new Div();
88 | cardActionsDiv.add(inner);
89 | inner.addClassNames("horizontal", "justified");
90 | buttons.forEach(inner::add);
91 | hasComponentsVersion.add(cardActionsDiv);
92 | }
93 | }
94 |
95 | public void setCardContent(final Component content) {
96 | cardContentDiv.removeAll();
97 | cardContentDiv.add(content);
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/menu/PaperIconItem.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.menu;
21 |
22 | import java.util.Optional;
23 |
24 | import com.vaadin.flow.component.Component;
25 | import com.vaadin.flow.component.HasComponents;
26 | import com.vaadin.flow.component.HasSize;
27 | import com.vaadin.flow.component.HasText;
28 | import com.vaadin.flow.component.Tag;
29 | import com.vaadin.flow.component.Text;
30 | import com.vaadin.flow.component.dependency.JsModule;
31 | import com.vaadin.flow.component.dependency.NpmPackage;
32 | import com.vaadin.flow.component.icon.Icon;
33 | import com.vaadin.flow.dom.Element;
34 | import com.vaadin.flow.server.Command;
35 |
36 | /**
37 | * Component that renders a paper-item
38 | *
39 | * @author mlopez
40 | */
41 | @SuppressWarnings("serial")
42 | @NpmPackage(value = "@polymer/paper-item", version = "3.0.1")
43 | @JsModule("@polymer/paper-item/paper-icon-item.js")
44 | @Tag("paper-icon-item")
45 | class PaperIconItem extends Component implements HasComponents, HasText, HasSize {
46 |
47 | private com.vaadin.flow.component.icon.Icon icon;
48 | private Text text;
49 |
50 | public PaperIconItem(String title) {
51 | this.setText("");
52 | this.text = new Text(title);
53 | add(text);
54 | }
55 |
56 | public void addCommand(Command command) {
57 | if (command != null) {
58 | this.getElement()
59 | .addEventListener(
60 | "click",
61 | e -> {
62 | command.execute();
63 | ((Component) this)
64 | .getElement()
65 | .executeJs(
66 | "this.dispatchEvent(new CustomEvent('item-clicked', {bubbles: true}))");
67 | });
68 | }
69 | }
70 |
71 | public void setTitle(String title) {
72 | this.text.setText(title);
73 | }
74 |
75 | public void setIcon(String icon) {
76 | withIronIcon(icon != null)
77 | .ifPresent(
78 | e -> {
79 | e.removeAttribute("src");
80 | e.setAttribute("icon", icon);
81 | });
82 | }
83 |
84 | public void setImage(String image) {
85 | withIronIcon(image != null)
86 | .ifPresent(
87 | e -> {
88 | ;
89 | e.removeAttribute("icon");
90 | e.setAttribute("src", image);
91 | });
92 | }
93 |
94 | private Optional withIronIcon(boolean create) {
95 | if (create) {
96 | if (this.icon == null) {
97 | this.icon = new Icon("", "");
98 | icon.getElement().setAttribute("slot", "item-icon");
99 | add(icon);
100 | }
101 | return Optional.of(icon.getElement());
102 | } else {
103 | if (this.icon != null) {
104 | remove(icon);
105 | this.icon = null;
106 | }
107 | return Optional.empty();
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/menu/PaperToggle.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.menu;
21 |
22 | import com.vaadin.flow.component.Component;
23 | import com.vaadin.flow.component.Tag;
24 | import com.vaadin.flow.component.dependency.JsModule;
25 | import com.vaadin.flow.component.dependency.NpmPackage;
26 |
27 | @NpmPackage(value = "@polymer/paper-toggle-button", version = "3.0.1")
28 | @JsModule("@polymer/paper-toggle-button/paper-toggle-button.js")
29 | @Tag("paper-toggle-button")
30 | public class PaperToggle extends Component {}
31 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/addons/applayout/test/SerializationTest.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.addons.applayout.test;
21 |
22 | import com.flowingcode.addons.applayout.AppLayout;
23 | import com.flowingcode.addons.applayout.MenuItem;
24 | import java.io.ByteArrayInputStream;
25 | import java.io.ByteArrayOutputStream;
26 | import java.io.IOException;
27 | import java.io.ObjectInputStream;
28 | import java.io.ObjectOutputStream;
29 | import org.junit.Test;
30 |
31 | public class SerializationTest {
32 |
33 | private void testSerializationOf(Object obj) throws IOException, ClassNotFoundException {
34 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
35 | try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
36 | oos.writeObject(obj);
37 | }
38 | try (ObjectInputStream in =
39 | new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
40 | obj.getClass().cast(in.readObject());
41 | }
42 | }
43 |
44 | @Test
45 | public void testSerialization() throws ClassNotFoundException, IOException {
46 | AppLayout appLayout = new AppLayout("");
47 | appLayout.setMenuItems(new MenuItem("Item", () -> {}));
48 | testSerializationOf(appLayout);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/vaadin/addons/DemoLayout.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons;
21 |
22 | import com.vaadin.flow.component.html.Div;
23 | import com.vaadin.flow.router.RouterLayout;
24 |
25 | @SuppressWarnings("serial")
26 | public class DemoLayout extends Div implements RouterLayout {
27 |
28 | public DemoLayout() {
29 | setSizeFull();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/vaadin/addons/applayout/AppLayoutDemo.java:
--------------------------------------------------------------------------------
1 | package com.flowingcode.vaadin.addons.applayout;
2 |
3 | import com.flowingcode.vaadin.addons.demo.DemoSource;
4 | import com.vaadin.flow.component.html.Div;
5 | import com.vaadin.flow.component.html.IFrame;
6 | import com.vaadin.flow.router.PageTitle;
7 | import com.vaadin.flow.router.Route;
8 |
9 | @DemoSource("/src/test/java/com/flowingcode/addons/applayout/ApplayoutDemoView.java")
10 | @DemoSource("/frontend/styles/app-layout/demo-styles.css")
11 | @PageTitle("AppLayout Full Demo")
12 | @SuppressWarnings("serial")
13 | @Route(value = "applayout/applayout-demo", layout = AppLayoutDemoView.class)
14 | public class AppLayoutDemo extends Div {
15 |
16 | public AppLayoutDemo() {
17 | setClassName("wrap-iframe");
18 | IFrame iframe = new IFrame("/applayout-full");
19 | iframe.setClassName("frame");
20 | iframe.setSizeFull();
21 | iframe.getElement().setAttribute("frameBorder", "0");
22 | add(iframe);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/vaadin/addons/applayout/AppLayoutDemoView.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * Template Add-on
4 | * %%
5 | * Copyright (C) 2023 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.applayout;
21 |
22 | import com.flowingcode.vaadin.addons.DemoLayout;
23 | import com.flowingcode.vaadin.addons.GithubLink;
24 | import com.flowingcode.vaadin.addons.demo.TabbedDemo;
25 | import com.vaadin.flow.router.ParentLayout;
26 | import com.vaadin.flow.router.Route;
27 |
28 | @SuppressWarnings("serial")
29 | @ParentLayout(DemoLayout.class)
30 | @Route("applayout")
31 | @GithubLink("https://github.com/FlowingCode/AppLayoutAddon")
32 | public class AppLayoutDemoView extends TabbedDemo {
33 |
34 | public AppLayoutDemoView() {
35 | addDemo(AppLayoutDemo.class);
36 | addDemo(ExtendingAppLayoutDemo.class);
37 |
38 | setSizeFull();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/vaadin/addons/applayout/DemoView.java:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package com.flowingcode.vaadin.addons.applayout;
21 |
22 | import com.vaadin.flow.component.orderedlayout.VerticalLayout;
23 | import com.vaadin.flow.router.BeforeEnterEvent;
24 | import com.vaadin.flow.router.BeforeEnterObserver;
25 | import com.vaadin.flow.router.Route;
26 |
27 | @SuppressWarnings("serial")
28 | @Route("")
29 | public class DemoView extends VerticalLayout implements BeforeEnterObserver {
30 |
31 | @Override
32 | public void beforeEnter(BeforeEnterEvent event) {
33 | event.forwardTo(AppLayoutDemoView.class);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/com/flowingcode/vaadin/addons/applayout/ExtendingAppLayoutDemo.java:
--------------------------------------------------------------------------------
1 | package com.flowingcode.vaadin.addons.applayout;
2 |
3 | import com.flowingcode.vaadin.addons.demo.DemoSource;
4 | import com.vaadin.flow.component.html.Div;
5 | import com.vaadin.flow.component.html.IFrame;
6 | import com.vaadin.flow.router.PageTitle;
7 | import com.vaadin.flow.router.Route;
8 |
9 | @DemoSource("/src/test/java/com/flowingcode/addons/applayout/CustomAppLayout.java")
10 | @DemoSource("/src/test/java/com/flowingcode/addons/applayout/SampleView.java")
11 | @PageTitle("Extending AppLayout Demo")
12 | @SuppressWarnings("serial")
13 | @Route(value = "applayout/extending-applayout-demo", layout = AppLayoutDemoView.class)
14 | public class ExtendingAppLayoutDemo extends Div {
15 |
16 | public ExtendingAppLayoutDemo() {
17 | setClassName("wrap-iframe");
18 | IFrame iframe = new IFrame("/view");
19 | iframe.setClassName("frame");
20 | iframe.setSizeFull();
21 | iframe.getElement().setAttribute("frameBorder", "0");
22 | add(iframe);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/test/resources/META-INF/native-image/com.flowingcode.addons/app-layout/reflect-config.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name":"com.flowingcode.addons.applayout.ApplayoutDemoView"
4 | }
5 | ]
--------------------------------------------------------------------------------
/src/test/resources/META-INF/native-image/com.flowingcode.addons/app-layout/resource-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "resources":{
3 | "includes":[{
4 | "pattern":"\\Qhamlet\\E"
5 | }],
6 | "bundles":[]
7 | }}
--------------------------------------------------------------------------------
/src/test/resources/META-INF/resources/frontend/images/applogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlowingCode/AppLayoutAddon/ea9f4b2b704346bcd3468e9882c120314e265b25/src/test/resources/META-INF/resources/frontend/images/applogo.png
--------------------------------------------------------------------------------
/src/test/resources/META-INF/resources/frontend/images/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlowingCode/AppLayoutAddon/ea9f4b2b704346bcd3468e9882c120314e265b25/src/test/resources/META-INF/resources/frontend/images/avatar.png
--------------------------------------------------------------------------------
/src/test/resources/META-INF/resources/frontend/styles/app-layout/demo-styles.css:
--------------------------------------------------------------------------------
1 | /*-
2 | * #%L
3 | * App Layout Addon
4 | * %%
5 | * Copyright (C) 2018 - 2022 Flowing Code
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | html, body {
21 | margin: 0;
22 | font-family: 'Roboto', 'Noto', sans-serif;
23 | -webkit-font-smoothing: antialiased;
24 | background: #f1f1f1;
25 | max-height: 368px;
26 | max-width: 100%;
27 | }
28 |
29 | sample-content {
30 | padding-top: 64px;
31 | }
32 |
33 | app-drawer {
34 | --app-drawer-scrim-background: rgba(0, 0, 100, 0.8);
35 | --app-drawer-content-container: {
36 | background-color: #F1F1F1;
37 | }
38 | z-index: 1001;
39 | }
40 |
41 | app-drawer paper-listbox {
42 | background-color:transparent;
43 | }
44 |
45 | img.applogo {
46 | margin-right: 8px;
47 | width: 48px;
48 | height: 48px;
49 | }
50 |
51 | .compact img.applogo {
52 | width: 22px;
53 | height: 22px;
54 | }
55 |
56 | .hamlet {
57 | user-select: none;
58 | }
59 |
60 | .hamlet paper-card {
61 | max-width: 600px;
62 | min-width: 200px;
63 | }
64 |
65 | .hamlet paper-card.claudius {
66 | background: rgb(220,248,198);
67 | }
68 |
69 | .hamlet paper-card h5 {margin-top: 0.25em}
70 |
71 | .hamlet paper-card[elevation="0"] {
72 | background: rgb(254,244,197);
73 | border-radius: 8px;
74 | min-width: 30%;
75 | height: 42px;
76 | }
77 |
78 | .hamlet paper-card[elevation="0"] .card-content {
79 | padding: 8px;
80 | text-align: center;
81 | }
82 |
83 | menu-item vcf-toggle-button {
84 | padding-bottom: 2px;
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/src/test/resources/META-INF/resources/frontend/styles/shared-styles.html:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 |
81 |
82 |
--------------------------------------------------------------------------------
/src/test/resources/hamlet:
--------------------------------------------------------------------------------
1 | $Act IV, Scene 3
2 | $Elsinore. A room in the Castle.
3 |
4 | [Enter King]
5 |
6 | Claudius.
7 | I have sent to seek him and to find the body.
8 | How dangerous is it that this man goes loose!
9 | Yet must not we put the strong law on him.
10 | He's loved of the distracted multitude,
11 | Who like not in their judgment, but their eyes.
12 | And where 'tis so, th' offender's scourge is weighed,
13 | But never the offense. To bear all smooth and even,
14 | This sudden sending him away must seem
15 | Deliberate pause. Diseases desperate grown
16 | By desperate appliance are relieved,
17 | Or not at all.
18 |
19 | [Enter Rosencrantz]
20 |
21 | Claudius.
22 | How now, what hath befall'n?
23 |
24 | Rosencrantz.
25 | Where the dead body is bestowed, my lord,
26 | We cannot get from him.
27 |
28 | Claudius. But where is he?
29 |
30 | Rosencrantz. Without, my lord; guarded, to know your pleasure.
31 |
32 | Claudius. Bring him before us.
33 |
34 | Rosencrantz. Ho, Guildenstern! Bring in my lord.
35 |
36 | [Enter Hamlet and Guildenstern, with Attendants]
37 |
38 | Claudius. Now, Hamlet, where's Polonius?
39 |
40 | Hamlet. At supper.
41 |
42 | Claudius. At supper? Where?
43 |
44 | Hamlet. Not where he eats, but where he is eaten. A certain
45 | convocation of politic worms are e'en at him. Your worm is your
46 | only emperor for diet. We fat all creatures else to fat us, and
47 | we fat ourselves for maggots. Your fat king and your lean beggar
48 | is but variable service- two dishes, but to one table. That's the
49 | end.
50 |
51 | Claudius. Alas, alas!
52 |
53 | Hamlet. A man may fish with the worm that hath eat of a king, and eat
54 | of the fish that hath fed of that worm.
55 |
56 | Claudius. What dost thou mean by this?
57 |
58 | Hamlet. Nothing but to show you how a king may go a progress through
59 | the guts of a beggar.
60 |
61 | Claudius. Where is Polonius?
62 |
63 | Hamlet. In heaven. Send thither to see. If your messenger find him not
64 | there, seek him i' th' other place yourself. But indeed, if you
65 | find him not within this month, you shall nose him as you go up
66 | the stair, into the lobby.
67 |
68 | Claudius. Go seek him there.
69 |
70 | Hamlet. He will stay till you come.
71 |
72 | [Exeunt Attendants]
73 |
74 | Claudius. Hamlet, this deed, for thine especial safety,-
75 | Which we do tender as we dearly grieve
76 | For that which thou hast done,- must send thee hence
77 | With fiery quickness. Therefore prepare thyself.
78 | The bark is ready and the wind at help,
79 | Th' associates tend, and everything is bent
80 | For England.
81 |
82 | Hamlet. For England?
83 |
84 | Claudius. Ay, Hamlet.
85 |
86 | Hamlet. Good.
87 |
88 | Claudius. So is it, if thou knew'st our purposes.
89 |
90 | Hamlet. I see a cherub that sees them. But come, for England!
91 | Farewell, dear mother.
92 |
93 | Claudius. Thy loving father, Hamlet.
94 |
95 | Hamlet. My mother! Father and mother is man and wife; man and wife is
96 | one flesh; and so, my mother. Come, for England!
97 |
98 | [Hamlet exits]
99 |
100 | Claudius. Follow him at foot; tempt him with speed aboard.
101 | Delay it not; I'll have him hence to-night.
102 | Away! for everything is seal'd and done
103 | That else leans on th' affair. Pray you make haste.
104 |
105 | [Exeunt Rosencrantz and Guildenstern]
106 |
107 | Claudius. And, England, if my love thou hold'st at aught,-
108 | As my great power thereof may give thee sense,
109 | Since yet thy cicatrice looks raw and red
110 | After the Danish sword, and thy free awe
111 | Pays homage to us,- thou mayst not coldly set
112 | Our sovereign process, which imports at full,
113 | By letters congruing to that effect,
114 | The present death of Hamlet. Do it, England;
115 | For like the hectic in my blood he rages,
116 | And thou must cure me. Till I know 'tis done,
117 | Howe'er my haps, my joys were ne'er begun.
118 |
119 | [Claudius exits]
--------------------------------------------------------------------------------
/src/test/resources/vaadin-featureflags.properties:
--------------------------------------------------------------------------------
1 | # Use Webpack for front-end builds (Deprecated)
2 | com.vaadin.experimental.webpackForFrontendBuild=true
3 |
--------------------------------------------------------------------------------
/src/test/webjar-debug/META-INF/resources/README.txt:
--------------------------------------------------------------------------------
1 | This folder needs to exist for Jetty to start
2 |
--------------------------------------------------------------------------------
/src/test/webjar-debug/README.md:
--------------------------------------------------------------------------------
1 | This folder exists so you can unzip webjars here for debugging purposes.
2 | The webjar files should end up inside META-INF/resources/webjar/... to be loaded instead of the files inside the actual webjars.
3 | For instance `paper-slider.html` should be in `/src/test/webjar-debug/META-INNF/resources/webjars/paper-slider/paper-slider.html`
4 |
--------------------------------------------------------------------------------