Skip to content

Commit 29606f1

Browse files
committed
chore: remove @HtmlImport
1 parent db64396 commit 29606f1

File tree

11 files changed

+16
-58
lines changed

11 files changed

+16
-58
lines changed

src/main/java/com/flowingcode/addons/applayout/AppDrawer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.vaadin.flow.component.Component;
2323
import com.vaadin.flow.component.HasComponents;
2424
import com.vaadin.flow.component.Tag;
25-
import com.vaadin.flow.component.dependency.HtmlImport;
2625
import com.vaadin.flow.component.dependency.JsModule;
2726
import com.vaadin.flow.component.dependency.NpmPackage;
2827
import com.vaadin.flow.component.html.H4;
@@ -38,8 +37,6 @@
3837
*/
3938
@SuppressWarnings("serial")
4039
@Tag("app-drawer")
41-
@HtmlImport("bower_components/app-layout/app-drawer/app-drawer.html")
42-
@HtmlImport("bower_components/iron-scroll-target-behavior/iron-scroll-target-behavior.html")
4340
@NpmPackage(value = "@polymer/app-layout", version = AppLayout.NPM_VERSION)
4441
@JsModule("@polymer/app-layout/app-drawer/app-drawer.js")
4542
public class AppDrawer extends Component implements HasComponents {

src/main/java/com/flowingcode/addons/applayout/AppHeader.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.vaadin.flow.component.Component;
2323
import com.vaadin.flow.component.HasComponents;
2424
import com.vaadin.flow.component.Tag;
25-
import com.vaadin.flow.component.dependency.HtmlImport;
2625
import com.vaadin.flow.component.dependency.JsModule;
2726
import com.vaadin.flow.component.dependency.NpmPackage;
2827
import com.vaadin.flow.component.html.Image;
@@ -33,7 +32,6 @@
3332
* @author mlopez
3433
*/
3534
@SuppressWarnings("serial")
36-
@HtmlImport("bower_components/app-layout/app-header/app-header.html")
3735
@NpmPackage(value = "@polymer/app-layout", version = AppLayout.NPM_VERSION)
3836
@JsModule("@polymer/app-layout/app-header/app-header.js")
3937
@Tag("app-header")

src/main/java/com/flowingcode/addons/applayout/AppLayout.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.vaadin.flow.component.Component;
2323
import com.vaadin.flow.component.dependency.CssImport;
24-
import com.vaadin.flow.component.dependency.HtmlImport;
2524
import com.vaadin.flow.component.dependency.JsModule;
2625
import com.vaadin.flow.component.dependency.NpmPackage;
2726
import com.vaadin.flow.component.html.Div;
@@ -37,9 +36,6 @@
3736
* @author mlopez
3837
*/
3938
@SuppressWarnings("serial")
40-
@HtmlImport("bower_components/font-roboto/roboto.html")
41-
@HtmlImport("bower_components/app-layout/app-scroll-effects/app-scroll-effects.html")
42-
@HtmlImport("frontend://styles/applayout-styles.html")
4339
@NpmPackage(value = "@polymer/app-layout", version = AppLayout.NPM_VERSION)
4440
@NpmPackage(value = "@polymer/font-roboto", version = "^3.0")
4541
@JsModule("@polymer/app-layout/app-scroll-effects/app-scroll-effects.js")

src/main/java/com/flowingcode/addons/applayout/AppToolbar.java

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
*/
2020
package com.flowingcode.addons.applayout;
2121

22+
import java.util.stream.Stream;
23+
2224
import com.vaadin.flow.component.Component;
2325
import com.vaadin.flow.component.HasOrderedComponents;
2426
import com.vaadin.flow.component.Tag;
25-
import com.vaadin.flow.component.dependency.HtmlImport;
2627
import com.vaadin.flow.component.dependency.JsModule;
2728
import com.vaadin.flow.component.dependency.NpmPackage;
2829
import com.vaadin.flow.component.html.Div;
@@ -35,8 +36,6 @@
3536
* @author mlopez
3637
*/
3738
@SuppressWarnings("serial")
38-
@HtmlImport("bower_components/app-layout/app-toolbar/app-toolbar.html")
39-
@HtmlImport("bower_components/iron-icons/iron-icons.html")
4039
@NpmPackage(value = "@polymer/app-layout", version = AppLayout.NPM_VERSION)
4140
@NpmPackage(value = "@polymer/iron-icons", version = "^3.0.0")
4241
@JsModule("@polymer/app-layout/app-toolbar/app-toolbar.js")
@@ -48,36 +47,18 @@ public class AppToolbar extends Component {
4847
private Div divTitle;
4948
private int index;
5049

51-
private HasOrderedComponents<AppToolbar> hasOrderedComponents =
52-
new HasOrderedComponents<AppToolbar>() {
53-
@Override
54-
public Element getElement() {
55-
return AppToolbar.this.getElement();
56-
}
57-
58-
@Override
59-
public int getComponentCount() {
60-
return (int) getChildren().count();
61-
}
62-
63-
@Override
64-
public Component getComponentAt(int index) {
65-
if (index < 0) {
66-
throw new IllegalArgumentException(
67-
"The 'index' argument should be greater than or equal to 0. It was: " + index);
68-
}
69-
return getChildren()
70-
.sequential()
71-
.skip(index)
72-
.findFirst()
73-
.orElseThrow(
74-
() ->
75-
new IllegalArgumentException(
76-
"The 'index' argument should not be greater than or equals to the number of children components. It was: "
77-
+ index));
78-
}
79-
};
50+
private HasOrderedComponents hasOrderedComponents = new HasOrderedComponents() {
51+
@Override
52+
public Element getElement() {
53+
return AppToolbar.this.getElement();
54+
}
55+
56+
@Override
57+
public Stream<Component> getChildren() {
58+
return ((Component) AppToolbar.this).getChildren();
59+
}
8060

61+
};
8162
public AppToolbar(String title, AppDrawer drawer) {
8263
this(null, title, drawer);
8364
}

src/main/java/com/flowingcode/addons/applayout/MenuItem.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040
@JsModule("./iron-collapse-button/iron-collapse-button.js")
4141
@JsModule("./fc-applayout/fc-menuitem.js")
4242
@Tag("fc-menuitem")
43-
public class MenuItem extends SlottedMenuItem
44-
implements HasOrderedComponents<MenuItem>,
45-
HasMenuItemCommands<MenuItem>,
46-
HasMenuItemIcon<MenuItem> {
43+
public class MenuItem extends SlottedMenuItem implements HasOrderedComponents, HasMenuItemCommands<MenuItem>, HasMenuItemIcon<MenuItem> {
4744

4845
static final String BLANK = "fc-menuitem-icons:empty";
4946

src/main/java/com/flowingcode/addons/applayout/PaperListbox.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.vaadin.flow.component.Component;
2323
import com.vaadin.flow.component.HasOrderedComponents;
2424
import com.vaadin.flow.component.Tag;
25-
import com.vaadin.flow.component.dependency.HtmlImport;
2625
import com.vaadin.flow.component.dependency.JsModule;
2726
import com.vaadin.flow.component.dependency.NpmPackage;
2827
import java.util.List;
@@ -33,11 +32,10 @@
3332
* @author mlopez
3433
*/
3534
@SuppressWarnings("serial")
36-
@HtmlImport("bower_components/paper-listbox/paper-listbox.html")
3735
@NpmPackage(value = "@polymer/paper-listbox", version = "3.0.1")
3836
@JsModule("@polymer/paper-listbox/paper-listbox.js")
3937
@Tag("paper-listbox")
40-
class PaperListbox extends Component implements HasOrderedComponents<PaperListbox> {
38+
class PaperListbox extends Component implements HasOrderedComponents {
4139

4240
public PaperListbox(List<Component> components) {
4341
components.stream().forEach(this::add);

src/main/java/com/flowingcode/addons/applayout/ToolbarIconButton.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121

2222
import com.vaadin.flow.component.HasEnabled;
2323
import com.vaadin.flow.component.Tag;
24-
import com.vaadin.flow.component.dependency.HtmlImport;
2524
import com.vaadin.flow.component.dependency.JsModule;
2625
import com.vaadin.flow.component.dependency.NpmPackage;
2726
import com.vaadin.flow.component.icon.IconFactory;
2827
import com.vaadin.flow.server.Command;
2928

3029
/** Toolbar menu item component. */
3130
@SuppressWarnings("serial")
32-
@HtmlImport("bower_components/paper-icon-button/paper-icon-button.html")
3331
@NpmPackage(value = "@polymer/paper-icon-button", version = "3.0.2")
3432
@JsModule("@polymer/paper-icon-button/paper-icon-button.js")
3533
@Tag("paper-icon-button")

src/test/java/com/flowingcode/addons/applayout/ApplayoutDemoView.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
*/
2020
package com.flowingcode.addons.applayout;
2121

22+
2223
import com.flowingcode.addons.applayout.MouseClickEvent.MouseButton;
2324
import com.flowingcode.addons.applayout.menu.PaperCard;
2425
import com.flowingcode.addons.applayout.menu.PaperToggle;
2526
import com.flowingcode.vaadin.addons.DemoLayout;
2627
import com.vaadin.flow.component.Component;
2728
import com.vaadin.flow.component.button.Button;
2829
import com.vaadin.flow.component.checkbox.Checkbox;
29-
import com.vaadin.flow.component.dependency.HtmlImport;
3030
import com.vaadin.flow.component.dependency.StyleSheet;
3131
import com.vaadin.flow.component.dialog.Dialog;
3232
import com.vaadin.flow.component.html.Div;
@@ -48,7 +48,6 @@
4848

4949
@SuppressWarnings("serial")
5050
@Route(value = "applayout", layout = DemoLayout.class)
51-
@HtmlImport("frontend://styles/shared-styles.html")
5251
@StyleSheet("context://frontend/styles/app-layout/demo-styles.css")
5352
public class ApplayoutDemoView extends VerticalLayout {
5453

src/test/java/com/flowingcode/addons/applayout/menu/PaperButton.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.vaadin.flow.component.Component;
2323
import com.vaadin.flow.component.Tag;
24-
import com.vaadin.flow.component.dependency.HtmlImport;
2524
import com.vaadin.flow.component.dependency.JsModule;
2625
import com.vaadin.flow.component.dependency.NpmPackage;
2726
import com.vaadin.flow.server.Command;
@@ -32,7 +31,6 @@
3231
* @author mlopez
3332
*/
3433
@SuppressWarnings("serial")
35-
@HtmlImport("bower_components/paper-button/paper-button.html")
3634
@NpmPackage(value = "@polymer/paper-button", version = "3.0.1")
3735
@JsModule("@polymer/paper-button/paper-button.js")
3836
@Tag("paper-button")

src/test/java/com/flowingcode/addons/applayout/menu/PaperCard.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.vaadin.flow.component.HasSize;
2626
import com.vaadin.flow.component.HasStyle;
2727
import com.vaadin.flow.component.Tag;
28-
import com.vaadin.flow.component.dependency.HtmlImport;
2928
import com.vaadin.flow.component.dependency.JsModule;
3029
import com.vaadin.flow.component.dependency.NpmPackage;
3130
import com.vaadin.flow.component.html.Div;
@@ -40,7 +39,6 @@
4039
* @author mlopez
4140
*/
4241
@SuppressWarnings("serial")
43-
@HtmlImport("bower_components/paper-card/paper-card.html")
4442
@NpmPackage(value = "@polymer/paper-card", version = "3.0.1")
4543
@JsModule("@polymer/paper-card/paper-card.js")
4644
@Tag("paper-card")

0 commit comments

Comments
 (0)