IDEMPIERE-4702 Messagebox enhancement: Esc key closes Dialog with cancel (#586)
action Co-authored-by: Andreas <sumerauer@kanzlei-wmv.de>
This commit is contained in:
parent
ff88459dc9
commit
6acc8e235d
|
@ -38,6 +38,7 @@ import org.zkoss.zk.ui.Page;
|
|||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.select.annotation.Listen;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Image;
|
||||
import org.zkoss.zul.Vbox;
|
||||
|
@ -47,6 +48,7 @@ import org.zkoss.zul.Vbox;
|
|||
*
|
||||
* @author Niraj Sohun
|
||||
* @date Jul 31, 2007
|
||||
* @contributor Andreas Sumerauer IDEMPIERE-4702
|
||||
*/
|
||||
|
||||
public class Messagebox extends Window implements EventListener<Event>
|
||||
|
@ -55,7 +57,7 @@ public class Messagebox extends Window implements EventListener<Event>
|
|||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8928526331932742124L;
|
||||
|
||||
|
||||
private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 230pt; max-width: 450pt;";
|
||||
private static final String SMALLER_MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 180pt; ";
|
||||
private String msg = new String("");
|
||||
|
@ -107,7 +109,7 @@ public class Messagebox extends Window implements EventListener<Event>
|
|||
public static final String QUESTION = "~./zul/img/msgbox/question-btn.png";
|
||||
|
||||
/** A symbol consisting of an exclamation point in a triangle with a yellow background. */
|
||||
public static final String EXCLAMATION = "~./zul/img/msgbox/warning-btn.png";
|
||||
public static final String EXCLAMATION = "~./zul/img/msgbox/warning-btn.png";
|
||||
|
||||
/** A symbol of a lowercase letter i in a circle. */
|
||||
public static final String INFORMATION = "~./zul/img/msgbox/info-btn.png";
|
||||
|
@ -353,6 +355,15 @@ public class Messagebox extends Window implements EventListener<Event>
|
|||
Messagebox msg = new Messagebox();
|
||||
return msg.show(message, title, buttons, icon, editor, callback, modal);
|
||||
}
|
||||
|
||||
// Andreas Sumerauer IDEMPIERE 4702
|
||||
@Listen("onCancel")
|
||||
public void onCancel() throws Exception
|
||||
{
|
||||
returnValue = CANCEL;
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
public void onEvent(Event event) throws Exception
|
||||
{
|
||||
|
@ -387,15 +398,18 @@ public class Messagebox extends Window implements EventListener<Event>
|
|||
{
|
||||
returnValue = IGNORE;
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
private void close() {
|
||||
try {
|
||||
this.detach();
|
||||
} catch (NullPointerException npe) {
|
||||
if (! (SessionManager.getSessionApplication() == null)) // IDEMPIERE-1937 - ignore when session was closed
|
||||
throw npe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onPageDetached(Page page) {
|
||||
|
|
Loading…
Reference in New Issue