IDEMPIERE-4410 Review Shortcuts (probably ESC) for all popovers, moda… (#795)

* IDEMPIERE-4410 Review Shortcuts (probably ESC) for all popovers, modals, dialogs

add esc shortcut for customize grid view, attachment, csv import loader,
export, file import loader, chat and post it dialogs.

* IDEMPIERE-4410 Review Shortcuts (probably ESC) for all popovers, modals, dialogs

- add esc handling to more dialog and popup.

* IDEMPIERE-4410 Review Shortcuts (probably ESC) for all popovers, modals, dialogs

- add esc shortcut to process modal dialog.

* IDEMPIERE-4410 Review Shortcuts (probably ESC) for all popovers, modals, dialogs

- Fix esc handling for numberbox, image dialog, email dialog, media
dialog and cloud upload dialog.
This commit is contained in:
hengsin 2021-07-28 03:43:28 +08:00 committed by GitHub
parent 42a4ccd93b
commit 3e7dd1f7f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 266 additions and 61 deletions

View File

@ -48,6 +48,7 @@ import org.compiere.util.Env;
import org.compiere.util.Login; import org.compiere.util.Login;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
@ -241,7 +242,8 @@ public class ValuePreference extends Window implements EventListener<Event>
LayoutUtils.openOverlappedWindow(ref, this, "after_start"); LayoutUtils.openOverlappedWindow(ref, this, "after_start");
} else { } else {
AEnv.showCenterScreen(this); AEnv.showCenterScreen(this);
} }
Executions.schedule(getDesktop(), e -> confirmPanel.getOKButton().focus(), new Event("onPostOpenValuePreferenceDialog"));
} // ValuePreference } // ValuePreference
@ -467,6 +469,7 @@ public class ValuePreference extends Window implements EventListener<Event>
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
bDelete = confirmPanel.getButton("Delete"); bDelete = confirmPanel.getButton("Delete");
setExplanation(); setExplanation();
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // dynInit } // dynInit
/** /**
@ -477,7 +480,7 @@ public class ValuePreference extends Window implements EventListener<Event>
{ {
if (e.getTarget().getId().equals("Cancel")) if (e.getTarget().getId().equals("Cancel"))
{ {
this.detach(); onCancel();
} }
else if (e.getTarget().getId().equals("Ok")) else if (e.getTarget().getId().equals("Ok"))
{ {
@ -497,6 +500,10 @@ public class ValuePreference extends Window implements EventListener<Event>
setExplanation(); setExplanation();
} // actionPerformed } // actionPerformed
private void onCancel() {
this.detach();
}
/** /**
* Set Explanation * Set Explanation
*/ */

View File

@ -121,6 +121,7 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
log.log(Level.SEVERE, "", ex); log.log(Level.SEVERE, "", ex);
} }
addEventListener(ON_OK_ECHO, this); addEventListener(ON_OK_ECHO, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
public ProcessModalDialog (int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart) public ProcessModalDialog (int WindowNo, int AD_Process_ID, int tableId, int recordId, boolean autoStart)
@ -222,12 +223,16 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
onOk(); onOk();
} else if (component.equals(bCancel)) { } else if (component.equals(bCancel)) {
super.onEvent(event); super.onEvent(event);
cancelProcess(); onCancel();
}else { }else {
super.onEvent(event); super.onEvent(event);
} }
} }
private void onCancel() {
cancelProcess();
}
private void onOk() { private void onOk() {
if (getParameterPanel().isWaitingForDialog()) if (getParameterPanel().isWaitingForDialog())
{ {

View File

@ -444,6 +444,8 @@ public class NumberBox extends Div
popup.appendChild(vbox); popup.appendChild(vbox);
popup.setWidgetListener("onOpen", "calc.clearAll('" + txtCalcId + "')"); popup.setWidgetListener("onOpen", "calc.clearAll('" + txtCalcId + "')");
popup.addEventListener(Events.ON_CANCEL, e -> popup.close());
return popup; return popup;
} }

View File

@ -230,6 +230,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
{ {
win.setPage(page); win.setPage(page);
win.doModal(); win.doModal();
win.focus();
} }
else else
{ {
@ -281,6 +282,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
win.setPage(page); win.setPage(page);
win.doPopup(); win.doPopup();
win.focus();
} }
/** /**
@ -297,6 +299,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
win.setPage(page); win.setPage(page);
win.doOverlapped(); win.doOverlapped();
win.focus();
} }
/** /**
@ -313,6 +316,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
win.setPage(page); win.setPage(page);
win.doHighlighted(); win.doHighlighted();
win.focus();
} }
protected List<Object> getWindows(){ protected List<Object> getWindows(){

View File

@ -181,9 +181,10 @@ public class WBinaryEditor extends WEditor
content.getComponent().getParent().appendChild(dialog); content.getComponent().getParent().appendChild(dialog);
content.showBusyMask(dialog); content.showBusyMask(dialog);
LayoutUtils.openOverlappedWindow(content.getComponent().getParent(), dialog, "middle_center"); LayoutUtils.openOverlappedWindow(content.getComponent().getParent(), dialog, "middle_center");
dialog.focus();
} else { } else {
AEnv.showWindow(dialog); AEnv.showWindow(dialog);
} }
} }
} }
} }

View File

@ -171,6 +171,7 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
ZKUpdateUtil.setWidth(centerPanel, "100%"); ZKUpdateUtil.setWidth(centerPanel, "100%");
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
if (ClientInfo.isMobile()) if (ClientInfo.isMobile())
{ {
@ -525,10 +526,14 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
// Cancel pressed // Cancel pressed
else if (e.getTarget() == confirmPanel.getButton("Cancel")) else if (e.getTarget() == confirmPanel.getButton("Cancel"))
this.detach(); onCancel();
} }
private void onCancel() {
this.detach();
}
@Override @Override
public void detach() { public void detach() {
super.detach(); super.detach();

View File

@ -293,16 +293,14 @@ public class CustomizeGridViewPanel extends Panel
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event.getTarget().equals( if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_OK))) { confirmPanel.getButton(ConfirmPanel.A_OK))) {
saveData(); onOk();
} else if (event.getTarget().equals( } else if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_CANCEL))) { confirmPanel.getButton(ConfirmPanel.A_CANCEL))) {
getParent().detach(); onCancel();
} else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) { } else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) {
tableSeqs.clear(); onReset();
loadData();
} }
} }
}; };
confirmPanel.addActionListener(onClickListener); confirmPanel.addActionListener(onClickListener);
@ -314,6 +312,28 @@ public class CustomizeGridViewPanel extends Panel
} // init } // init
/**
* reset form
*/
public void onReset() {
tableSeqs.clear();
loadData();
}
/**
* save changes
*/
public void onOk() {
saveData();
}
/**
* cancel form
*/
public void onCancel() {
getParent().detach();
}
public void loadData() public void loadData()
{ {
m_tabcust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null); m_tabcust = MTabCustomization.get(Env.getCtx(), m_AD_User_ID, m_AD_Tab_ID, null);

View File

@ -372,6 +372,7 @@ public class WAttachment extends Window implements EventListener<Event>
orientation = ClientInfo.get().orientation; orientation = ClientInfo.get().orientation;
ClientInfo.onClientInfo(this, this::onClientInfo); ClientInfo.onClientInfo(this, this::onClientInfo);
} }
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
protected void onClientInfo() protected void onClientInfo()
@ -621,8 +622,7 @@ public class WAttachment extends Window implements EventListener<Event>
dispose(); dispose();
} }
} else if (e.getTarget() == bCancel) { } else if (e.getTarget() == bCancel) {
// Cancel onCancel();
dispose();
} else if (e.getTarget() == bDeleteAll) { } else if (e.getTarget() == bDeleteAll) {
// Delete Attachment // Delete Attachment
deleteAttachment(); deleteAttachment();
@ -644,6 +644,11 @@ public class WAttachment extends Window implements EventListener<Event>
} // onEvent } // onEvent
private void onCancel() {
// Cancel
dispose();
}
private void processUploadMedia(Media media) { private void processUploadMedia(Media media) {
if (media != null && media.getByteData().length>0) if (media != null && media.getByteData().length>0)
{ {

View File

@ -199,6 +199,7 @@ public class CSVImportAction implements EventListener<Event>
LayoutUtils.addSclass("dialog-footer", confirmPanel); LayoutUtils.addSclass("dialog-footer", confirmPanel);
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
winImportFile.addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
panel.getComponent().getParent().appendChild(winImportFile); panel.getComponent().getParent().appendChild(winImportFile);
@ -222,7 +223,7 @@ public class CSVImportAction implements EventListener<Event>
UploadEvent ue = (UploadEvent) event; UploadEvent ue = (UploadEvent) event;
processUploadMedia(ue.getMedia()); processUploadMedia(ue.getMedia());
} else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { } else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
winImportFile.onClose(); onCancel();
} else if (event.getTarget() == fTemplates) { } else if (event.getTarget() == fTemplates) {
if (m_file_istream != null) { if (m_file_istream != null) {
m_file_istream.close(); m_file_istream.close();
@ -242,6 +243,10 @@ public class CSVImportAction implements EventListener<Event>
} }
} }
private void onCancel() {
winImportFile.onClose();
}
private void fillImportMode() { private void fillImportMode() {
final String sql= "" final String sql= ""
+ "SELECT MAX(IsAllowInsert), " + "SELECT MAX(IsAllowInsert), "

View File

@ -167,6 +167,7 @@ public class ExportAction implements EventListener<Event>
LayoutUtils.addSclass("dialog-footer", confirmPanel); LayoutUtils.addSclass("dialog-footer", confirmPanel);
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
winExportFile.addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
displayExportTabSelection(); displayExportTabSelection();
panel.getComponent().getParent().appendChild(winExportFile); panel.getComponent().getParent().appendChild(winExportFile);
@ -230,7 +231,7 @@ public class ExportAction implements EventListener<Event>
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
winExportFile.onClose(); onCancel();
else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) else if(event.getTarget().getId().equals(ConfirmPanel.A_OK))
exportFile(); exportFile();
else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) { else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) {
@ -262,6 +263,10 @@ public class ExportAction implements EventListener<Event>
winExportFile.onClose(); winExportFile.onClose();
} }
} }
private void onCancel() {
winExportFile.onClose();
}
/** /**
* get info of window export, * get info of window export,

View File

@ -217,6 +217,7 @@ public class FileImportAction implements EventListener<Event>
LayoutUtils.addSclass("dialog-footer", confirmPanel); LayoutUtils.addSclass("dialog-footer", confirmPanel);
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
winImportFile.addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
panel.getComponent().getParent().appendChild(winImportFile); panel.getComponent().getParent().appendChild(winImportFile);
@ -233,7 +234,7 @@ public class FileImportAction implements EventListener<Event>
UploadEvent ue = (UploadEvent) event; UploadEvent ue = (UploadEvent) event;
processUploadMedia(ue.getMedia()); processUploadMedia(ue.getMedia());
} else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { } else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
winImportFile.onClose(); onCancel();
} else if (event.getTarget() == fCharset) { } else if (event.getTarget() == fCharset) {
if (m_file_istream != null) { if (m_file_istream != null) {
m_file_istream.close(); m_file_istream.close();
@ -254,6 +255,10 @@ public class FileImportAction implements EventListener<Event>
} }
} }
private void onCancel() {
winImportFile.onClose();
}
private void processUploadMedia(Media media) { private void processUploadMedia(Media media) {
if (media == null) if (media == null)
return; return;

View File

@ -18,6 +18,7 @@ import org.compiere.model.GridField;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Column; import org.zkoss.zul.Column;
import org.zkoss.zul.Columns; import org.zkoss.zul.Columns;
@ -87,6 +88,7 @@ public class CustomizeGridViewDialog extends Window {
customizePanel.createUI(); customizePanel.createUI();
customizePanel.query(); customizePanel.query();
} }
addEventListener(Events.ON_CANCEL, e -> customizePanel.onCancel());
} }
/** /**

View File

@ -236,7 +236,8 @@ public class InfoSchedule extends Window implements EventListener<Event>
} }
fieldResourceType.setMold("select"); fieldResourceType.setMold("select");
fieldResource.setMold("select"); fieldResource.setMold("select");
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit } // jbInit
/** /**
@ -465,8 +466,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
m_cancel = false; m_cancel = false;
dispose(); dispose();
} else if (event.getTarget().getId().equals("Cancel")) { } else if (event.getTarget().getId().equals("Cancel")) {
m_cancel = true; onCancel();
dispose();
// //
} else if (event.getTarget() == fieldResourceType) } else if (event.getTarget() == fieldResourceType)
{ {
@ -480,6 +480,11 @@ public class InfoSchedule extends Window implements EventListener<Event>
displayCalendar(); displayCalendar();
// //
} }
private void onCancel() {
m_cancel = true;
dispose();
}
private void doEdit(CalendarsEvent event) { private void doEdit(CalendarsEvent event) {
ListItem listItem = fieldResource.getSelectedItem(); ListItem listItem = fieldResource.getSelectedItem();

View File

@ -308,6 +308,8 @@ public final class WAccountDialog extends Window
if (ClientInfo.isMobile()) { if (ClientInfo.isMobile()) {
ClientInfo.onClientInfo(this, this::onClientInfo); ClientInfo.onClientInfo(this, this::onClientInfo);
} }
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit } // jbInit
/** /**
@ -777,8 +779,7 @@ public final class WAccountDialog extends Window
} }
else if (event.getTarget().getId().equals("Cancel")) else if (event.getTarget().getId().equals("Cancel"))
{ {
m_changed = false; onCancel();
dispose();
} }
// //
else if (event.getTarget() == bSave) else if (event.getTarget() == bSave)
@ -790,6 +791,11 @@ public final class WAccountDialog extends Window
action_Find (true); action_Find (true);
} }
private void onCancel() {
m_changed = false;
dispose();
}
boolean needConfirm(WEditor editor, MAccount combiOrg) boolean needConfirm(WEditor editor, MAccount combiOrg)
{ {
if (editor != null ) { if (editor != null ) {

View File

@ -215,6 +215,8 @@ public class WAssignmentDialog extends Window implements EventListener<Event>
row = new Row(); row = new Row();
row.appendCellChild(confirmPanel, 3); row.appendCellChild(confirmPanel, 3);
rows.appendChild(row); rows.appendChild(row);
addEventListener(Events.ON_CANCEL, e -> onCancel());
// //
} // jbInit } // jbInit
@ -397,8 +399,7 @@ public class WAssignmentDialog extends Window implements EventListener<Event>
// cancel - return // cancel - return
else if (e.getTarget().getId().equals("Cancel")) else if (e.getTarget().getId().equals("Cancel"))
{ {
m_cancel = true; onCancel();
detach();
} }
// delete - delete and return // delete - delete and return
@ -422,6 +423,11 @@ public class WAssignmentDialog extends Window implements EventListener<Event>
} }
} }
private void onCancel() {
m_cancel = true;
detach();
}
public void onShowSchedule() public void onShowSchedule()
{ {
InfoSchedule is = new InfoSchedule (m_mAssignment, true, this, new Callback<MResourceAssignment>() { InfoSchedule is = new InfoSchedule (m_mAssignment, true, this, new Callback<MResourceAssignment>() {

View File

@ -44,6 +44,7 @@ import org.compiere.util.Util;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
@ -126,7 +127,7 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
private Borderlayout mainPanel = new Borderlayout(); private Borderlayout mainPanel = new Borderlayout();
private Textbox newText = new Textbox(); private Textbox newText = new Textbox();
private ConfirmPanel confirmPanel = new ConfirmPanel(false); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Tree messageTree = new Tree(); private Tree messageTree = new Tree();
private Button addButton; private Button addButton;
private Map<Integer, Component> entryMap = new HashMap<Integer, Component>(); private Map<Integer, Component> entryMap = new HashMap<Integer, Component>();
@ -198,6 +199,7 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
orientation = ClientInfo.get().orientation; orientation = ClientInfo.get().orientation;
ClientInfo.onClientInfo(this, this::onClientInfo); ClientInfo.onClientInfo(this, this::onClientInfo);
} }
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
protected void onClientInfo() protected void onClientInfo()
@ -389,6 +391,13 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
} // actionPerformed } // actionPerformed
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
actionPerformed(event); if (event.getTarget() == confirmPanel.getOKButton())
actionPerformed(event);
else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
onCancel();
}
private void onCancel() {
this.detach();
} }
} // WChat } // WChat

View File

@ -30,6 +30,7 @@ import org.compiere.wf.MWorkflow;
import org.zkforge.ckez.CKeditor; import org.zkforge.ckez.CKeditor;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell; import org.zkoss.zul.Cell;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
@ -157,6 +158,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
} else { } else {
setTitle(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID")); setTitle(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
} }
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
@Override @Override
@ -164,10 +166,14 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) { if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) {
onSave(); onSave();
} else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) { } else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) {
this.detach(); onCancel();
} }
} }
private void onCancel() {
this.detach();
}
private void onSave() { private void onSave() {
String trxName = Trx.createTrxName(); String trxName = Trx.createTrxName();
Trx trx = Trx.get(trxName, true); Trx trx = Trx.get(trxName, true);

View File

@ -175,6 +175,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
set(from, to, subject, message); set(from, to, subject, message);
setAttachment(attachment); setAttachment(attachment);
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // commonInit } // commonInit
@ -272,7 +273,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lFrom); div.appendChild(lFrom);
row.appendChild(div); row.appendChild(div);
row.appendChild(fFrom); row.appendChild(fFrom);
ZKUpdateUtil.setHflex(fFrom, "1"); ZKUpdateUtil.setWidth(fFrom, "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
@ -281,13 +282,13 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lTo); div.appendChild(lTo);
row.appendChild(div); row.appendChild(div);
row.appendChild(fUser.getComponent()); row.appendChild(fUser.getComponent());
ZKUpdateUtil.setHflex(fUser.getComponent(), "1"); ZKUpdateUtil.setWidth(fUser.getComponent(), "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(new Label("")); row.appendChild(new Label(""));
row.appendChild(fTo); row.appendChild(fTo);
ZKUpdateUtil.setHflex(fTo, "1"); ZKUpdateUtil.setWidth(fTo, "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
@ -296,13 +297,13 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lCc); div.appendChild(lCc);
row.appendChild(div); row.appendChild(div);
row.appendChild(fCcUser.getComponent()); row.appendChild(fCcUser.getComponent());
ZKUpdateUtil.setHflex(fCcUser.getComponent(), "1"); ZKUpdateUtil.setWidth(fCcUser.getComponent(), "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(new Label("")); row.appendChild(new Label(""));
row.appendChild(fCc); row.appendChild(fCc);
ZKUpdateUtil.setHflex(fCc, "1"); ZKUpdateUtil.setWidth(fCc, "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
@ -316,7 +317,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lSubject); div.appendChild(lSubject);
row.appendChild(div); row.appendChild(div);
row.appendChild(fSubject); row.appendChild(fSubject);
ZKUpdateUtil.setHflex(fSubject, "1"); ZKUpdateUtil.setWidth(fSubject, "100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
@ -376,7 +377,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
Borderlayout borderlayout = new Borderlayout(); Borderlayout borderlayout = new Borderlayout();
this.appendChild(borderlayout); this.appendChild(borderlayout);
ZKUpdateUtil.setHflex(borderlayout, "1"); ZKUpdateUtil.setWidth(borderlayout, "100%");
Center centerPane = new Center(); Center centerPane = new Center();
centerPane.setSclass("dialog-content"); centerPane.setSclass("dialog-content");
@ -522,9 +523,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
*/ */
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
onClose(); onCancel();
// Send
else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) else if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
{ {
Clients.clearBusy(); Clients.clearBusy();
@ -590,6 +589,10 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
addMailText(); addMailText();
} }
private void onCancel() {
onClose();
}
/** /**
* @param dataSource * @param dataSource
* @param removeable * @param removeable
@ -861,4 +864,13 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
} }
} }
@Override
public void focus() {
super.focus();
if (fUser != null)
fUser.getComponent().focus();
}
} // WEMailDialog } // WEMailDialog

View File

@ -163,6 +163,7 @@ public class WFieldRecordInfo extends Window implements EventListener<Event>
south.appendChild(confirmPanel); south.appendChild(confirmPanel);
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
setSclass("field-record-info-dialog"); setSclass("field-record-info-dialog");
} // init } // init
@ -362,6 +363,11 @@ public class WFieldRecordInfo extends Window implements EventListener<Event>
* @param event * @param event
*/ */
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
onCancel();
}
private void onCancel() {
this.detach(); this.detach();
} }

View File

@ -19,6 +19,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Label; import org.zkoss.zul.Label;
@ -125,6 +126,7 @@ public class WFieldSuggestion extends Window implements EventListener<Event> {
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
this.setSizable(true); this.setSizable(true);
this.setMaximizable(true); this.setMaximizable(true);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
@Override @Override
@ -132,10 +134,14 @@ public class WFieldSuggestion extends Window implements EventListener<Event> {
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) { if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) {
onSave(); onSave();
} else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) { } else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) {
this.detach(); onCancel();
} }
} }
private void onCancel() {
this.detach();
}
private void onSave() { private void onSave() {
MFieldSuggestion suggestion = new MFieldSuggestion(Env.getCtx(), 0, null); MFieldSuggestion suggestion = new MFieldSuggestion(Env.getCtx(), 0, null);
suggestion.setClientOrg(0, 0); suggestion.setClientOrg(0, 0);

View File

@ -119,11 +119,15 @@ public class WGadgets extends Window implements EventListener<Event>{
} }
else if (panel.getButton("Cancel").equals(event.getTarget())) else if (panel.getButton("Cancel").equals(event.getTarget()))
{ {
this.detach(); onCancel();
} }
} }
} }
private void onCancel() {
this.detach();
}
public void init() public void init()
{ {
@ -229,6 +233,7 @@ public class WGadgets extends Window implements EventListener<Event>{
vlayout.appendChild(panel); vlayout.appendChild(panel);
this.appendChild(vlayout); this.appendChild(vlayout);
this.setBorder("normal"); this.setBorder("normal");
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }

View File

@ -240,6 +240,7 @@ public class WImageDialog extends Window implements EventListener<Event>
addEventListener(Events.ON_UPLOAD, this); addEventListener(Events.ON_UPLOAD, this);
addEventListener("onSave", this); addEventListener("onSave", this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // init } // init
public void onEvent(Event e) throws Exception { public void onEvent(Event e) throws Exception {
@ -255,8 +256,7 @@ public class WImageDialog extends Window implements EventListener<Event>
} }
else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
cancel = true; onCancel();
detach();
} }
else if (e.getTarget().getId().equals(ConfirmPanel.A_RESET)) else if (e.getTarget().getId().equals(ConfirmPanel.A_RESET))
{ {
@ -325,6 +325,11 @@ public class WImageDialog extends Window implements EventListener<Event>
} }
} }
private void onCancel() {
cancel = true;
detach();
}
private void onSave() { private void onSave() {
if (image.getContent() != null) if (image.getContent() != null)
{ {
@ -419,5 +424,14 @@ public class WImageDialog extends Window implements EventListener<Event>
*/ */
public void setDefaultNameForCaptureImage(String defaultNameForCaptureImage) { public void setDefaultNameForCaptureImage(String defaultNameForCaptureImage) {
this.defaultNameForCaptureImage = defaultNameForCaptureImage; this.defaultNameForCaptureImage = defaultNameForCaptureImage;
}
@Override
public void focus() {
super.focus();
if (fileButton != null)
fileButton.focus();
} }
} // WImageDialog } // WImageDialog

View File

@ -512,6 +512,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
southPane.appendChild(confirmPanel); southPane.appendChild(confirmPanel);
addEventListener("onSaveError", this); addEventListener("onSaveError", this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
/** /**
* Dynamically add fields to the Location dialog box * Dynamically add fields to the Location dialog box
@ -756,8 +757,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
} }
else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
{ {
m_change = false; onCancel();
this.dispose();
} }
else if (toLink.equals(event.getTarget())) else if (toLink.equals(event.getTarget()))
{ {
@ -930,6 +930,11 @@ public class WLocationDialog extends Window implements EventListener<Event>
} }
} }
private void onCancel() {
m_change = false;
this.dispose();
}
// LCO - address 1, region and city required // LCO - address 1, region and city required
private String validate_OK() { private String validate_OK() {

View File

@ -300,6 +300,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
ZKUpdateUtil.setCSSWidth(this); ZKUpdateUtil.setCSSWidth(this);
}); });
} }
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
private void initLocator() private void initLocator()
@ -677,8 +678,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
{ {
m_change = false; onCancel();
this.detach();
} }
else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK))
{ {
@ -695,4 +695,9 @@ public class WLocatorDialog extends Window implements EventListener<Event>
&& (event.getTarget() == lstWarehouse || event.getTarget() == txtAisleX || event.getTarget() == txtBinY || event.getTarget() == txtLevelZ)) && (event.getTarget() == lstWarehouse || event.getTarget() == txtAisleX || event.getTarget() == txtBinY || event.getTarget() == txtLevelZ))
createValue(); createValue();
} }
private void onCancel() {
m_change = false;
this.detach();
}
} }

View File

@ -211,6 +211,7 @@ public class WMediaDialog extends Window implements EventListener<Event>
confirmPanel.appendChild(bOk); confirmPanel.appendChild(bOk);
confirmPanel.appendChild(bCancel); confirmPanel.appendChild(bCancel);
confirmPanel.setStyle("float: right;"); confirmPanel.setStyle("float: right;");
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
private void afterPageAttached() { private void afterPageAttached() {
@ -316,8 +317,7 @@ public class WMediaDialog extends Window implements EventListener<Event>
else if (e.getTarget() == bCancel) else if (e.getTarget() == bCancel)
{ {
m_cancel = true; onCancel();
dispose();
} }
// clear data // clear data
@ -341,6 +341,11 @@ public class WMediaDialog extends Window implements EventListener<Event>
processUploadMedia(ue.getMedia()); processUploadMedia(ue.getMedia());
} }
} // onEvent } // onEvent
private void onCancel() {
m_cancel = true;
dispose();
}
private void processUploadMedia(Media media) { private void processUploadMedia(Media media) {
if (media == null) if (media == null)
@ -385,6 +390,10 @@ public class WMediaDialog extends Window implements EventListener<Event>
public Object getData() { public Object getData() {
return m_data; return m_data;
} }
@Override
public void focus() {
super.focus();
bLoad.focus();
}
} }

View File

@ -235,6 +235,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
centerLayout.setOddRowSclass("even"); centerLayout.setOddRowSclass("even");
// //
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // init } // init
/** /**
@ -808,10 +809,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
// Cancel // Cancel
else if (e.getTarget().getId().equals("Cancel")) else if (e.getTarget().getId().equals("Cancel"))
{ {
m_changed = false; onCancel();
m_M_AttributeSetInstance_ID = 0;
m_M_Locator_ID = 0;
dispose();
} }
// Zoom M_Lot // Zoom M_Lot
else if (e.getTarget() == mZoom) else if (e.getTarget() == mZoom)
@ -822,6 +820,13 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
log.log(Level.SEVERE, "not found - " + e); log.log(Level.SEVERE, "not found - " + e);
} // actionPerformed } // actionPerformed
private void onCancel() {
m_changed = false;
m_M_AttributeSetInstance_ID = 0;
m_M_Locator_ID = 0;
dispose();
}
private void cmd_existingCombo() { private void cmd_existingCombo() {
ListItem pp = existingCombo.getSelectedItem(); ListItem pp = existingCombo.getSelectedItem();
if (pp != null && (Integer)pp.getValue() != -1) if (pp != null && (Integer)pp.getValue() != -1)

View File

@ -169,6 +169,7 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
south.setParent(mainLayout); south.setParent(mainLayout);
south.appendChild(confirmPanel); south.appendChild(confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit } // jbInit
/** Table Column Layout Info */ /** Table Column Layout Info */
@ -309,9 +310,7 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
detach(); detach();
else if (e.getTarget().getId().equals("Cancel")) else if (e.getTarget().getId().equals("Cancel"))
{ {
m_M_AttributeSetInstance_ID = -1; onCancel();
m_M_AttributeSetInstanceName = null;
detach();
} }
else if (e.getTarget() == showAll) else if (e.getTarget() == showAll)
{ {
@ -322,6 +321,12 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
enableButtons(); enableButtons();
} }
} // actionPerformed } // actionPerformed
private void onCancel() {
m_M_AttributeSetInstance_ID = -1;
m_M_AttributeSetInstanceName = null;
detach();
}
/** /**
* Enable/Set Buttons and set ID * Enable/Set Buttons and set ID

View File

@ -168,6 +168,7 @@ public class WPostIt extends Window implements EventListener<Event>{
} }
tabbox.addEventListener(Events.ON_SELECT, this); tabbox.addEventListener(Events.ON_SELECT, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
/** /**
@ -175,7 +176,7 @@ public class WPostIt extends Window implements EventListener<Event>{
*/ */
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
detach(); onCancel();
} else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) { } else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
if (editable) { if (editable) {
m_postIt.setText(textBox.getText()); m_postIt.setText(textBox.getText());
@ -201,6 +202,10 @@ public class WPostIt extends Window implements EventListener<Event>{
} }
} }
private void onCancel() {
detach();
}
private void updateStatus(int newLength) { private void updateStatus(int newLength) {
if (status != null && maxSize > 0) { if (status != null && maxSize > 0) {
StringBuffer msg = new StringBuffer(); StringBuffer msg = new StringBuffer();

View File

@ -253,6 +253,7 @@ public class WRecordInfo extends Window implements EventListener<Event>
hbox.appendChild(confirmPanel); hbox.appendChild(confirmPanel);
confirmPanel.addActionListener(Events.ON_CLICK, this); confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit } // jbInit
@ -541,6 +542,11 @@ public class WRecordInfo extends Window implements EventListener<Event>
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
onCancel();
}
private void onCancel() {
this.detach(); this.detach();
} }

View File

@ -40,6 +40,7 @@ import org.compiere.util.Msg;
import org.zkoss.util.media.AMedia; import org.zkoss.util.media.AMedia;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Filedownload; import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
@ -119,16 +120,21 @@ public class WReportExportDialog extends Window implements EventListener<Event>
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
LayoutUtils.addSclass("dialog-footer", confirmPanel); LayoutUtils.addSclass("dialog-footer", confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
onClose(); onCancel();
else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) else if(event.getTarget().getId().equals(ConfirmPanel.A_OK))
exportFile(); exportFile();
} }
private void onCancel() {
onClose();
}
private void exportFile() private void exportFile()
{ {
try try

View File

@ -152,14 +152,14 @@ public class WReportUploadDialog extends Window implements EventListener<Event>
LayoutUtils.addSclass("dialog-footer", confirmPanel); LayoutUtils.addSclass("dialog-footer", confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
addEventListener(Events.ON_CANCEL, e -> onClose()); addEventListener(Events.ON_CANCEL, e -> onCancel());
this.setVflex("min"); this.setVflex("min");
} }
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
onClose(); onCancel();
} else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) { } else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
uploadFile(); uploadFile();
} else if (event.getTarget() == cboType) { } else if (event.getTarget() == cboType) {
@ -167,6 +167,10 @@ public class WReportUploadDialog extends Window implements EventListener<Event>
} }
} }
private void onCancel() {
onClose();
}
private void onOutputTypeSelectionChanged() { private void onOutputTypeSelectionChanged() {
Listitem li = cboType.getSelectedItem(); Listitem li = cboType.getSelectedItem();
String ext = li.getValue().toString(); String ext = li.getValue().toString();
@ -302,4 +306,13 @@ public class WReportUploadDialog extends Window implements EventListener<Event>
FDialog.error(-1, this, "Error", e.getMessage(), this.getTitle()); FDialog.error(-1, this, "Error", e.getMessage(), this.getTitle());
} }
} }
@Override
public void focus() {
super.focus();
if (cboType != null)
cboType.focus();
}
} }

View File

@ -185,6 +185,7 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
setClosable(true); setClosable(true);
setSizable(true); setSizable(true);
setMaximizable(true); setMaximizable(true);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} }
private void createEditor(org.zkoss.zul.Tabpanel tabPanel) { private void createEditor(org.zkoss.zul.Tabpanel tabPanel) {
@ -213,8 +214,7 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
*/ */
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
cancelled = true; onCancel();
detach();
} else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) { } else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
if (editable) { if (editable) {
if (tabbox.getSelectedIndex() == 0) { if (tabbox.getSelectedIndex() == 0) {
@ -249,6 +249,11 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
} }
} }
} }
private void onCancel() {
cancelled = true;
detach();
}
private void updateStatus(int newLength) { private void updateStatus(int newLength) {
if (status != null && maxSize > 0) { if (status != null && maxSize > 0) {