Skip to content

Commit 6bb662f

Browse files
committed
Remove deprecated methods
1 parent f1ec4f1 commit 6bb662f

File tree

4 files changed

+11
-161
lines changed

4 files changed

+11
-161
lines changed

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

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

2222

2323

24-
import java.net.URL;
25-
import java.util.Optional;
26-
2724
import com.vaadin.flow.component.Component;
2825
import com.vaadin.flow.component.HasComponents;
2926
import com.vaadin.flow.component.HasSize;
@@ -44,18 +41,6 @@ public CollapseButton(String label, PaperItem[] items) {
4441
this(label, null, null, items);
4542
}
4643

47-
/** @deprecated (for removal) */
48-
@Deprecated
49-
public CollapseButton(String label, URL image, Component...items) {
50-
this(label, null, Optional.ofNullable(image).map(URL::toExternalForm).orElse(null), items);
51-
}
52-
53-
/** @deprecated (for removal) */
54-
@Deprecated
55-
public CollapseButton(String label, String icon, Component...items) {
56-
this(label,icon,null,items);
57-
}
58-
5944
public CollapseButton(String label, String icon, String image, Component...items) {
6045
if (icon==null && image==null) {
6146
PaperItem pi = new PaperItem(label);

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

Lines changed: 0 additions & 64 deletions
This file was deleted.

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

Lines changed: 3 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121

2222

2323

24-
import java.net.MalformedURLException;
25-
import java.net.URL;
2624
import java.util.ArrayList;
27-
import java.util.Arrays;
2825
import java.util.List;
2926
import java.util.Optional;
3027
import java.util.stream.Stream;
@@ -57,56 +54,17 @@ public MenuItem(String label) {
5754
this.setLabel(label);
5855
}
5956

60-
/** @deprecated (for removal) Use fluent API. */
61-
@Deprecated
62-
public MenuItem(String label, MenuItem... subMenuItems) {
63-
this.label = label;
64-
this.subMenuItems = Arrays.asList(subMenuItems);
65-
}
66-
67-
/** @deprecated (for removal) Use fluent API. */
68-
@Deprecated
69-
public MenuItem(String label, String icon, MenuItem... subMenuItems) {
70-
this.label = label;
71-
this.icon = icon;
72-
this.subMenuItems = Arrays.asList(subMenuItems);
73-
}
74-
75-
/** @deprecated (for removal) Use fluent API */
76-
@Deprecated
77-
public MenuItem(String label, URL image, MenuItem... subMenuItems) {
78-
this.label = label;
79-
this.setImageURL(image);
80-
this.subMenuItems = Arrays.asList(subMenuItems);
81-
}
82-
8357
/** Create a new instance of {@code MenuItem} with a label and left-button command. */
8458
public MenuItem(String label, Command command) {
8559
this.setLabel(label);
8660
this.setCommand(command);
8761
}
8862

89-
/** Create a new instance of {@code MenuItem} with a label, an icon, and left-button command.
90-
@deprecated (for removal) Use fluent API */
91-
@Deprecated
92-
public MenuItem(String label, String icon, Command command) {
93-
setLabel(label);
94-
setCommand(command);
95-
setIcon(icon);
96-
}
97-
98-
/** Create a new instance of {@code MenuItem} with a label, an image, and left-button command.
99-
* @deprecated (for removal) Use fluent API */
100-
@Deprecated
101-
public MenuItem(String label, URL image, Command command) {
102-
this.label = label;
103-
this.command = command;
104-
this.setImageURL(image);
105-
}
106-
10763
/** Create a new instance of {@code MenuItem} with a label, a {@code VaadinIcon}, and left-button command. */
10864
public MenuItem(String label, VaadinIcon icon, Command command) {
109-
this(label, getIconName(icon), command);
65+
this.label = label;
66+
this.command = command;
67+
setIcon(getIconName(icon));
11068
}
11169

11270
/**Adds the given menu items as children of this component.*/
@@ -160,15 +118,6 @@ public void setSubMenuItems(List<MenuItem> subMenuItems) {
160118
this.subMenuItems = subMenuItems;
161119
}
162120

163-
/**
164-
* @return true if this item has sub menu items
165-
* @deprecated (for removal)
166-
*/
167-
@Deprecated
168-
public boolean isSubMenuFolder() {
169-
return !getSubMenuItems().isEmpty();
170-
}
171-
172121
/**
173122
* This allows you to configure a callback that is called whenever you change the label and icon
174123
* @param refreshCallback
@@ -193,25 +142,5 @@ public MenuItem setImage(String image) {
193142
this.image = image;
194143
return this;
195144
}
196-
197-
/** @deprecated (for removal) Use {@link #getImage}*/
198-
@Deprecated
199-
public URL getImageURL() {
200-
if (this.image!=null) {
201-
try {
202-
return new URL(image);
203-
} catch (MalformedURLException e) {
204-
throw new IllegalStateException();
205-
}
206-
} else {
207-
return null;
208-
}
209-
}
210-
211-
/** @deprecated (for removal) Use {@link #setImage(String)}*/
212-
@Deprecated
213-
public void setImageURL(URL imageURL) {
214-
this.image = Optional.ofNullable(imageURL).map(URL::toExternalForm).orElse(null);
215-
}
216145

217146
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class DemoView extends VerticalLayout {
5252

5353
private VerticalLayout container = new VerticalLayout();
5454
private final AppLayout app = new AppLayout(createLogoImage(), createAvatarComponent(), "AppLayout Vaadin 10 Demo");
55-
private final MenuItem miSettings = new MenuItem("Settings", "settings", this::openSettings);
55+
private final MenuItem miSettings = new MenuItem("Settings", this::openSettings).setIcon("settings");
5656

5757
private final DemoSettings settings = new DemoSettings();
5858

@@ -162,7 +162,7 @@ private Component createAvatarComponent() {
162162
}
163163

164164
private MenuItem[] createMenuItems() {
165-
MenuItem mi = new MenuItem("Say hello", "star", () -> showContent("Hello!"));
165+
MenuItem mi = new MenuItem("Say hello", () -> showContent("Hello!")).setIcon("settings");
166166
MenuItem toggleSettings = new MenuItem().setIcon("settings");
167167
toggleSettings.setCommand(() -> {
168168
settings.setEnabled(!settings.isEnabled());
@@ -181,19 +181,19 @@ private MenuItem[] createMenuItems() {
181181
new MenuItem("Content", VaadinIcon.BOOK, () -> showHamletContent()),
182182
toggleSettings,
183183
mi,
184-
new MenuItem("About", "cloud", () -> showContent("About")),
185-
new MenuItem("Clear Items", "clear", () -> app.clearMenuItems()),
186-
new MenuItem("Change Text & Icon", "cloud", () -> {
184+
new MenuItem("About", () -> showContent("About")).setIcon("cloud"),
185+
new MenuItem("Clear Items", () -> app.clearMenuItems()).setIcon("clear"),
186+
new MenuItem("Change Text & Icon", () -> {
187187
if (mi.getIcon().equals("star")) {
188188
mi.setIcon("cloud");
189189
mi.setLabel("Say hello modified");
190190
} else {
191191
mi.setIcon("star");
192192
mi.setLabel("Say hello");
193193
}
194-
}),
194+
}).setIcon("cloud"),
195195
new MenuItem("SubMenu").setIcon("build").add(
196-
new MenuItem("Hello Again", "inbox",()->showContent("Hello Again!")),
196+
new MenuItem("Hello Again", ()->showContent("Hello Again!")).setIcon("inbox"),
197197
new MenuItem("And Again",()->showContent("And Again!")),
198198
new MenuItem("SubMenu").add(
199199
new MenuItem("Hello Again",()->showContent("Hello Again!")),
@@ -222,7 +222,7 @@ private void showContent(String content) {
222222
label.setSizeFull();
223223
label.setText(content);
224224
PaperCard pc = new PaperCard(label, new MenuItem("Delete", () -> Notification.show("Delete action from card")),
225-
new MenuItem("Delete", "delete", () -> Notification.show("Delete action from card")));
225+
new MenuItem("Delete", () -> Notification.show("Delete action from card")).setIcon("delete"));
226226
pc.setWidth("100%");
227227
container.add(pc);
228228
}

0 commit comments

Comments
 (0)