File tree Expand file tree Collapse file tree 8 files changed +9
-15
lines changed
src/main/java/com/flowingcode/addons/applayout Expand file tree Collapse file tree 8 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 2222
2323
2424import java .util .ArrayList ;
25- import java .util .Arrays ;
25+ import java .util .Collections ;
2626import java .util .List ;
2727
2828import com .flowingcode .addons .applayout .menu .MenuItem ;
4343@ HtmlImport ("bower_components/app-layout/app-drawer/app-drawer.html" )
4444public class AppDrawer extends Component implements HasComponents {
4545
46- private PaperListbox pm = new PaperListbox (Arrays . asList ( new Component [] {} ));
46+ private PaperListbox pm = new PaperListbox (Collections . emptyList ( ));
4747 private Component header ;
4848
4949 public AppDrawer (String title ) {
Original file line number Diff line number Diff line change @@ -75,10 +75,10 @@ public void setToolbarIconButtons(MenuItem[] menuItems) {
7575 this .add (menu );
7676 if (ctitle !=null ) this .add (ctitle );
7777 if (divTitle !=null ) this .add (divTitle );
78- toolbarIconButtons .forEach (tib -> this . add ( tib ) );
78+ toolbarIconButtons .forEach (this :: add );
7979 }
8080
81- private List <PaperIconButton > createToolbarIconButtons (MenuItem [] menuItems ) {
81+ private static List <PaperIconButton > createToolbarIconButtons (MenuItem [] menuItems ) {
8282 List <PaperIconButton > result = new ArrayList <>();
8383 for (MenuItem menuItem : menuItems ) {
8484 PaperIconButton paperIconButton = new PaperIconButton (menuItem .getIcon (),menuItem .getCommand ());
Original file line number Diff line number Diff line change @@ -43,9 +43,7 @@ public PaperButton(String label) {
4343
4444 public PaperButton (String label , Command command ) {
4545 this .setLabel (label );
46- this .getElement ().addEventListener ("click" , e ->{
47- command .execute ();
48- });
46+ this .getElement ().addEventListener ("click" , e ->command .execute ());
4947 }
5048
5149 public void setLabel (String label ) {
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public void setCardActions(final MenuItem... cardActions) {
8787 final Div inner = new Div ();
8888 cardActionsDiv .add (inner );
8989 inner .addClassNames ("horizontal" , "justified" );
90- buttons .forEach (b -> inner . add ( b ) );
90+ buttons .forEach (inner :: add );
9191 hasComponentsVersion .add (cardActionsDiv );
9292 }
9393 }
Original file line number Diff line number Diff line change @@ -44,9 +44,7 @@ public PaperIconButton(String icon) {
4444
4545 public PaperIconButton (String icon , Command command ) {
4646 this .setIcon (icon );
47- this .getElement ().addEventListener ("click" , e ->{
48- command .execute ();
49- });
47+ this .getElement ().addEventListener ("click" , e ->command .execute ());
5048 }
5149
5250 public void setIcon (String icon ) {
Original file line number Diff line number Diff line change 2020package com .flowingcode .addons .applayout ;
2121
2222
23-
2423import com .vaadin .flow .component .Component ;
2524import com .vaadin .flow .component .HasComponents ;
2625import com .vaadin .flow .component .HasSize ;
2726import com .vaadin .flow .component .HasText ;
2827import com .vaadin .flow .component .Tag ;
2928import com .vaadin .flow .component .Text ;
30- import com .vaadin .flow .component .UI ;
3129import com .vaadin .flow .component .dependency .HtmlImport ;
3230import com .vaadin .flow .server .Command ;
3331
Original file line number Diff line number Diff line change 4040public class PaperListbox extends Component implements HasComponents {
4141
4242 public PaperListbox (List <Component > components ) {
43- components .stream ().forEach (c -> this . add ( c ) );
43+ components .stream ().forEach (this :: add );
4444 }
4545
4646 public PaperListbox (String label , PaperItem ...items ) {
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ public void setSubMenuItems(List<MenuItem> subMenuItems) {
115115 * @return true if this item has sub menu items
116116 */
117117 public boolean isSubMenuFolder () {
118- return getSubMenuItems ().size () > 0 ;
118+ return ! getSubMenuItems ().isEmpty () ;
119119 }
120120
121121 /**
You can’t perform that action at this time.
0 commit comments