Skip to content

Commit 50197d0

Browse files
committed
Fixed - MaterialWindow change default clickHandler for close icon #217
1 parent dbd999f commit 50197d0

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/main/java/gwt/material/design/addins/client/window/MaterialWindow.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public class MaterialWindow extends MaterialPanel implements HasCloseHandlers<Bo
108108

109109
private MaterialDnd dnd;
110110
private boolean initialized;
111+
private boolean preventClose;
111112

112113
private HandlerRegistration toolbarAttachHandler;
113114

@@ -169,10 +170,12 @@ protected void initialize() {
169170
// Add handlers to action buttons
170171
iconMaximize.addClickHandler(event -> toggleMaximize());
171172
iconClose.addClickHandler(event -> {
172-
if (!isOpen()) {
173-
open();
174-
} else {
175-
close();
173+
if (!preventClose) {
174+
if (!isOpen()) {
175+
open();
176+
} else {
177+
close();
178+
}
176179
}
177180
});
178181

@@ -184,6 +187,10 @@ protected void initialize() {
184187
dnd.ignoreFrom(".content, .window-action");
185188
}
186189

190+
protected void onClose() {
191+
192+
}
193+
187194
protected void toggleMaximize() {
188195
setMaximize(!isMaximized());
189196
}
@@ -399,6 +406,14 @@ public void setPaddingBottom(double padding) {
399406
content.setPaddingBottom(padding);
400407
}
401408

409+
public boolean isPreventClose() {
410+
return preventClose;
411+
}
412+
413+
public void setPreventClose(boolean preventClose) {
414+
this.preventClose = preventClose;
415+
}
416+
402417
/**
403418
* Set the area for the drag and drop, can be an {@link Element}
404419
* or a {@link String} selector.

0 commit comments

Comments
 (0)