Skip to content

Commit 38778be

Browse files
committed
Allow configuration of swipe-open
1 parent ee379ab commit 38778be

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To see the demo, navigate to http://localhost:8080/
3434
- **Version 1.0.2** Added support for sub-menus and icons in the menus
3535
- **Version 1.0.3** Added support for changing the label and icon of a MenuItem dinamically.
3636
- **Version 1.0.4** Added support for: placing a logo in the application header, changing icons in the toolbar, setting a custom component to the menu header (such as logged-in user account details), setting visibility of side menu and button and dynamically clearing menu items.
37-
- **Version 1.0.5** Added support for: setting the header title and height, configuring the header behavior on scroll, and disabling menu items.
37+
- **Version 1.0.5** Added support for: setting the header title and height, and configuring the header behavior on scroll, the drawer swipe-open behavior, and disabling menu items.
3838

3939
## Roadmap
4040

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ public AppDrawer(String title) {
5353
public AppDrawer(Component headerComponent) {
5454
this.header = headerComponent;
5555
getElement().setAttribute("id", "drawer");
56-
getElement().setAttribute("swipe-open", true);
56+
setSwipeOpen(true);
5757
this.add(headerComponent);
5858
this.add(pm);
5959
}
60-
61-
public void setMenuItems(List<MenuItem> menuItems) {
60+
61+
public void setSwipeOpen(boolean swipeOpen) {
62+
getElement().setAttribute("swipe-open", swipeOpen);
63+
}
64+
65+
public void setMenuItems(List<MenuItem> menuItems) {
6266
Component[] components = createComponents(menuItems);
6367
pm.removeAll();
6468
pm.add(components);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,9 @@ public void setFixed(boolean fixed) {
118118
public void setReveals(boolean reveals) {
119119
header.setReveals(reveals);
120120
}
121+
122+
/**Create an area at the edge of the screen to swipe open the app-drawer*/
123+
public void setSwipeOpen(boolean swipeOpen) {
124+
drawer.setSwipeOpen(swipeOpen);
125+
}
121126
}

0 commit comments

Comments
 (0)