Skip to content

Commit c5928ff

Browse files
committed
Don't process showOnAttach when null.
This is so we can neither show nor hide upon attachment.
1 parent 532f633 commit c5928ff

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSideNav.java

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class MaterialSideNav extends MaterialWidget implements HasType<SideNavTy
7676
private boolean closeOnClick = false;
7777
private boolean alwaysShowActivator = false;
7878
private boolean allowBodyScroll = false;
79-
private boolean showOnAttach = false;
79+
private Boolean showOnAttach = null;
8080
private boolean open;
8181

8282
private Element activator;
@@ -117,29 +117,31 @@ public void onLoad() {
117117
// Initialize the side nav
118118
initialize();
119119

120-
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
121-
@Override
122-
public void execute() {
123-
if(showOnAttach) {
124-
if (Window.getClientWidth() > 960) {
120+
if(showOnAttach != null) {
121+
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
122+
@Override
123+
public void execute() {
124+
if (showOnAttach) {
125+
if (Window.getClientWidth() > 960) {
126+
show();
127+
}
128+
} else {
125129
show();
126-
}
127-
} else {
128-
show();
129-
final HandlerRegistration[] openedHandler = new HandlerRegistration[1];
130-
openedHandler[0] = addOpenedHandler(new SideNavOpenedHandler() {
131-
@Override
132-
public void onSideNavOpened(SideNavOpenedEvent event) {
133-
hide();
134-
135-
if(openedHandler[0] != null) {
136-
openedHandler[0].removeHandler();
130+
final HandlerRegistration[] openedHandler = new HandlerRegistration[1];
131+
openedHandler[0] = addOpenedHandler(new SideNavOpenedHandler() {
132+
@Override
133+
public void onSideNavOpened(SideNavOpenedEvent event) {
134+
hide();
135+
136+
if (openedHandler[0] != null) {
137+
openedHandler[0].removeHandler();
138+
}
137139
}
138-
}
139-
});
140+
});
141+
}
140142
}
141-
}
142-
});
143+
});
144+
}
143145
}
144146

145147
/**
@@ -545,7 +547,7 @@ public void setAlwaysShowActivator(boolean alwaysShowActivator) {
545547
* Will the menu forcefully show on attachment.
546548
*/
547549
public boolean isShowOnAttach() {
548-
return showOnAttach;
550+
return showOnAttach != null && showOnAttach;
549551
}
550552

551553
/**

0 commit comments

Comments
 (0)