Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AppLayout demos compatible with addons demo #125

Merged
merged 11 commits into from
Oct 28, 2024
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<drivers.dir>${project.basedir}/drivers</drivers.dir>
<flowingcode.commons.demo.version>4.0.0</flowingcode.commons.demo.version>
<jetty.version>11.0.14</jetty.version>
</properties>
<organization>
Expand Down Expand Up @@ -54,6 +55,11 @@
<scope>import</scope>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.flowingcode.vaadin.addons.demo</groupId>
<artifactId>commons-demo</artifactId>
<version>${flowingcode.commons.demo.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -105,6 +111,11 @@
<version>6.0.9</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.flowingcode.vaadin.addons.demo</groupId>
<artifactId>commons-demo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
import org.junit.Ignore;

@SuppressWarnings("serial")
@Route(value = "applayout", layout = DemoLayout.class)
@Route(value = "applayout-full", layout = DemoLayout.class)
javier-godoy marked this conversation as resolved.
Show resolved Hide resolved
@StyleSheet("context://frontend/styles/app-layout/demo-styles.css")
@Ignore
public class ApplayoutDemoView extends VerticalLayout {

private VerticalLayout container = new VerticalLayout();
Expand Down Expand Up @@ -232,7 +231,7 @@ private Component[] createMenuItems() {
new MenuItem("Toggle", VaadinIcon.BACKSPACE).configure(mi -> mi.add(new PaperToggle())),
new MenuItem("Toggle", MenuItem.BLANK).configure(mi -> mi.add(new PaperToggle())),
new MenuItem("External link").setHref("http://www.google.com"),
new MenuItem("Internal Link", InternalView.class),
new MenuItem("Internal Link", SampleInternalView.class),

// icon as VaadinIcon enum
new MenuItem("Content", VaadinIcon.BOOK, () -> showHamletContent())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
import com.vaadin.flow.component.html.Image;
import com.vaadin.flow.component.html.Span;

public class AbstractLayoutDemo extends AppLayout {
@SuppressWarnings("serial")
public class CustomAppLayout extends AppLayout {

public AbstractLayoutDemo() {
public CustomAppLayout() {
setMenuItems(new MenuItem("Item 1"), new MenuItem("Item 2"));

// menu header
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
import com.vaadin.flow.router.Route;
import org.junit.Ignore;

@SuppressWarnings("serial")
@Route("internal-view")
@Ignore
public class InternalView extends Div {
public class SampleInternalView extends Div {

public InternalView() {
public SampleInternalView() {
add(new Span("Internal view"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import com.vaadin.flow.router.Route;
import org.junit.Ignore;

@Route(value = "view", layout = AbstractLayoutDemo.class)
@Ignore
public class AbstractLayoutView extends Div {
@SuppressWarnings("serial")
@Route(value = "view", layout = CustomAppLayout.class)
public class SampleView extends Div {

{
add(new Span("Hello world"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.flowingcode.vaadin.addons.applayout;

import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.IFrame;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

@DemoSource("/src/test/java/com/flowingcode/addons/applayout/ApplayoutDemoView.java")
@DemoSource("/frontend/styles/app-layout/demo-styles.css")
@PageTitle("AppLayout Full Demo")
@SuppressWarnings("serial")
@Route(value = "applayout/applayout-demo", layout = AppLayoutDemoView.class)
public class AppLayoutDemo extends Div {

public AppLayoutDemo() {
setClassName("wrap-iframe");
IFrame iframe = new IFrame("/applayout-full");
iframe.setClassName("frame");
iframe.setSizeFull();
iframe.getElement().setAttribute("frameBorder", "0");
add(iframe);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*-
* #%L
* Template Add-on
* %%
* Copyright (C) 2023 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.addons.applayout;

import com.flowingcode.vaadin.addons.DemoLayout;
import com.flowingcode.vaadin.addons.GithubLink;
import com.flowingcode.vaadin.addons.demo.TabbedDemo;
import com.vaadin.flow.router.ParentLayout;
import com.vaadin.flow.router.Route;

@SuppressWarnings("serial")
@ParentLayout(DemoLayout.class)
@Route("applayout")
@GithubLink("https://github.com/FlowingCode/ExtendedLoginAddon")
public class AppLayoutDemoView extends TabbedDemo {
mlopezFC marked this conversation as resolved.
Show resolved Hide resolved

public AppLayoutDemoView() {
addDemo(AppLayoutDemo.class);
addDemo(ExtendingAppLayoutDemo.class);

setSizeFull();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* limitations under the License.
* #L%
*/
package com.flowingcode.addons.applayout;
package com.flowingcode.vaadin.addons.applayout;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.BeforeEnterEvent;
Expand All @@ -30,6 +30,6 @@ public class DemoView extends VerticalLayout implements BeforeEnterObserver {

@Override
public void beforeEnter(BeforeEnterEvent event) {
event.forwardTo(ApplayoutDemoView.class);
event.forwardTo(AppLayoutDemoView.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.flowingcode.vaadin.addons.applayout;

import com.flowingcode.vaadin.addons.demo.DemoSource;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.IFrame;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;

@DemoSource("/src/test/java/com/flowingcode/addons/applayout/CustomAppLayout.java")
@DemoSource("/src/test/java/com/flowingcode/addons/applayout/SampleView.java")
@PageTitle("Extending AppLayout Demo")
@SuppressWarnings("serial")
@Route(value = "applayout/extending-applayout-demo", layout = AppLayoutDemoView.class)
public class ExtendingAppLayoutDemo extends Div {

public ExtendingAppLayoutDemo() {
setClassName("wrap-iframe");
IFrame iframe = new IFrame("/view");
iframe.setClassName("frame");
iframe.setSizeFull();
iframe.getElement().setAttribute("frameBorder", "0");
add(iframe);
}
}
Loading