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

View File

@ -121,6 +121,7 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
log.log(Level.SEVERE, "", ex);
}
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)
@ -222,12 +223,16 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
onOk();
} else if (component.equals(bCancel)) {
super.onEvent(event);
cancelProcess();
onCancel();
}else {
super.onEvent(event);
}
}
private void onCancel() {
cancelProcess();
}
private void onOk() {
if (getParameterPanel().isWaitingForDialog())
{

View File

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

View File

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

View File

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

View File

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

View File

@ -293,16 +293,14 @@ public class CustomizeGridViewPanel extends Panel
public void onEvent(Event event) throws Exception {
if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_OK))) {
saveData();
onOk();
} else if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_CANCEL))) {
getParent().detach();
onCancel();
} else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) {
tableSeqs.clear();
loadData();
onReset();
}
}
}
};
confirmPanel.addActionListener(onClickListener);
@ -314,6 +312,28 @@ public class CustomizeGridViewPanel extends Panel
} // 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()
{
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;
ClientInfo.onClientInfo(this, this::onClientInfo);
}
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
protected void onClientInfo()
@ -621,8 +622,7 @@ public class WAttachment extends Window implements EventListener<Event>
dispose();
}
} else if (e.getTarget() == bCancel) {
// Cancel
dispose();
onCancel();
} else if (e.getTarget() == bDeleteAll) {
// Delete Attachment
deleteAttachment();
@ -644,6 +644,11 @@ public class WAttachment extends Window implements EventListener<Event>
} // onEvent
private void onCancel() {
// Cancel
dispose();
}
private void processUploadMedia(Media media) {
if (media != null && media.getByteData().length>0)
{

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@ import org.compiere.model.GridField;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Column;
import org.zkoss.zul.Columns;
@ -87,6 +88,7 @@ public class CustomizeGridViewDialog extends Window {
customizePanel.createUI();
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");
fieldResource.setMold("select");
fieldResource.setMold("select");
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit
/**
@ -465,8 +466,7 @@ public class InfoSchedule extends Window implements EventListener<Event>
m_cancel = false;
dispose();
} else if (event.getTarget().getId().equals("Cancel")) {
m_cancel = true;
dispose();
onCancel();
//
} else if (event.getTarget() == fieldResourceType)
{
@ -480,6 +480,11 @@ public class InfoSchedule extends Window implements EventListener<Event>
displayCalendar();
//
}
private void onCancel() {
m_cancel = true;
dispose();
}
private void doEdit(CalendarsEvent event) {
ListItem listItem = fieldResource.getSelectedItem();

View File

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

View File

@ -215,6 +215,8 @@ public class WAssignmentDialog extends Window implements EventListener<Event>
row = new Row();
row.appendCellChild(confirmPanel, 3);
rows.appendChild(row);
addEventListener(Events.ON_CANCEL, e -> onCancel());
//
} // jbInit
@ -397,8 +399,7 @@ public class WAssignmentDialog extends Window implements EventListener<Event>
// cancel - return
else if (e.getTarget().getId().equals("Cancel"))
{
m_cancel = true;
detach();
onCancel();
}
// 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()
{
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.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
@ -126,7 +127,7 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
private Borderlayout mainPanel = new Borderlayout();
private Textbox newText = new Textbox();
private ConfirmPanel confirmPanel = new ConfirmPanel(false);
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private Tree messageTree = new Tree();
private Button addButton;
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;
ClientInfo.onClientInfo(this, this::onClientInfo);
}
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
protected void onClientInfo()
@ -389,6 +391,13 @@ public class WChat extends Window implements EventListener<Event>, DialogEvents
} // actionPerformed
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

View File

@ -30,6 +30,7 @@ import org.compiere.wf.MWorkflow;
import org.zkforge.ckez.CKeditor;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Center;
@ -157,6 +158,7 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
} else {
setTitle(Msg.getElement(Env.getCtx(), "AD_CtxHelpSuggestion_ID"));
}
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
@Override
@ -164,10 +166,14 @@ public class WCtxHelpSuggestion extends Window implements EventListener<Event> {
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) {
onSave();
} else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) {
this.detach();
onCancel();
}
}
private void onCancel() {
this.detach();
}
private void onSave() {
String trxName = Trx.createTrxName();
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);
setAttachment(attachment);
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // commonInit
@ -272,7 +273,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lFrom);
row.appendChild(div);
row.appendChild(fFrom);
ZKUpdateUtil.setHflex(fFrom, "1");
ZKUpdateUtil.setWidth(fFrom, "100%");
row = new Row();
rows.appendChild(row);
@ -281,13 +282,13 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lTo);
row.appendChild(div);
row.appendChild(fUser.getComponent());
ZKUpdateUtil.setHflex(fUser.getComponent(), "1");
ZKUpdateUtil.setWidth(fUser.getComponent(), "100%");
row = new Row();
rows.appendChild(row);
row.appendChild(new Label(""));
row.appendChild(fTo);
ZKUpdateUtil.setHflex(fTo, "1");
ZKUpdateUtil.setWidth(fTo, "100%");
row = new Row();
rows.appendChild(row);
@ -296,13 +297,13 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lCc);
row.appendChild(div);
row.appendChild(fCcUser.getComponent());
ZKUpdateUtil.setHflex(fCcUser.getComponent(), "1");
ZKUpdateUtil.setWidth(fCcUser.getComponent(), "100%");
row = new Row();
rows.appendChild(row);
row.appendChild(new Label(""));
row.appendChild(fCc);
ZKUpdateUtil.setHflex(fCc, "1");
ZKUpdateUtil.setWidth(fCc, "100%");
row = new Row();
rows.appendChild(row);
@ -316,7 +317,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
div.appendChild(lSubject);
row.appendChild(div);
row.appendChild(fSubject);
ZKUpdateUtil.setHflex(fSubject, "1");
ZKUpdateUtil.setWidth(fSubject, "100%");
row = new Row();
rows.appendChild(row);
@ -376,7 +377,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
Borderlayout borderlayout = new Borderlayout();
this.appendChild(borderlayout);
ZKUpdateUtil.setHflex(borderlayout, "1");
ZKUpdateUtil.setWidth(borderlayout, "100%");
Center centerPane = new Center();
centerPane.setSclass("dialog-content");
@ -522,9 +523,7 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
*/
public void onEvent(Event event) throws Exception {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
onClose();
// Send
onCancel();
else if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
{
Clients.clearBusy();
@ -590,6 +589,10 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
addMailText();
}
private void onCancel() {
onClose();
}
/**
* @param dataSource
* @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

View File

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

View File

@ -19,6 +19,7 @@ import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
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.setSizable(true);
this.setMaximizable(true);
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
@Override
@ -132,10 +134,14 @@ public class WFieldSuggestion extends Window implements EventListener<Event> {
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_OK)) {
onSave();
} else if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL)) {
this.detach();
onCancel();
}
}
private void onCancel() {
this.detach();
}
private void onSave() {
MFieldSuggestion suggestion = new MFieldSuggestion(Env.getCtx(), 0, null);
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()))
{
this.detach();
onCancel();
}
}
}
private void onCancel() {
this.detach();
}
public void init()
{
@ -229,6 +233,7 @@ public class WGadgets extends Window implements EventListener<Event>{
vlayout.appendChild(panel);
this.appendChild(vlayout);
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("onSave", this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // init
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))
{
cancel = true;
detach();
onCancel();
}
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() {
if (image.getContent() != null)
{
@ -419,5 +424,14 @@ public class WImageDialog extends Window implements EventListener<Event>
*/
public void setDefaultNameForCaptureImage(String defaultNameForCaptureImage) {
this.defaultNameForCaptureImage = defaultNameForCaptureImage;
}
@Override
public void focus() {
super.focus();
if (fileButton != null)
fileButton.focus();
}
} // WImageDialog

View File

@ -512,6 +512,7 @@ public class WLocationDialog extends Window implements EventListener<Event>
southPane.appendChild(confirmPanel);
addEventListener("onSaveError", this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
/**
* 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))
{
m_change = false;
this.dispose();
onCancel();
}
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
private String validate_OK() {

View File

@ -300,6 +300,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
ZKUpdateUtil.setCSSWidth(this);
});
}
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
private void initLocator()
@ -677,8 +678,7 @@ public class WLocatorDialog extends Window implements EventListener<Event>
if (event.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
{
m_change = false;
this.detach();
onCancel();
}
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))
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(bCancel);
confirmPanel.setStyle("float: right;");
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
private void afterPageAttached() {
@ -316,8 +317,7 @@ public class WMediaDialog extends Window implements EventListener<Event>
else if (e.getTarget() == bCancel)
{
m_cancel = true;
dispose();
onCancel();
}
// clear data
@ -341,6 +341,11 @@ public class WMediaDialog extends Window implements EventListener<Event>
processUploadMedia(ue.getMedia());
}
} // onEvent
private void onCancel() {
m_cancel = true;
dispose();
}
private void processUploadMedia(Media media) {
if (media == null)
@ -385,6 +390,10 @@ public class WMediaDialog extends Window implements EventListener<Event>
public Object getData() {
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");
//
confirmPanel.addActionListener(Events.ON_CLICK, this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // init
/**
@ -808,10 +809,7 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
// Cancel
else if (e.getTarget().getId().equals("Cancel"))
{
m_changed = false;
m_M_AttributeSetInstance_ID = 0;
m_M_Locator_ID = 0;
dispose();
onCancel();
}
// Zoom M_Lot
else if (e.getTarget() == mZoom)
@ -822,6 +820,13 @@ public class WPAttributeDialog extends Window implements EventListener<Event>
log.log(Level.SEVERE, "not found - " + e);
} // actionPerformed
private void onCancel() {
m_changed = false;
m_M_AttributeSetInstance_ID = 0;
m_M_Locator_ID = 0;
dispose();
}
private void cmd_existingCombo() {
ListItem pp = existingCombo.getSelectedItem();
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.appendChild(confirmPanel);
confirmPanel.addActionListener(this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
} // jbInit
/** Table Column Layout Info */
@ -309,9 +310,7 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
detach();
else if (e.getTarget().getId().equals("Cancel"))
{
m_M_AttributeSetInstance_ID = -1;
m_M_AttributeSetInstanceName = null;
detach();
onCancel();
}
else if (e.getTarget() == showAll)
{
@ -322,6 +321,12 @@ public class WPAttributeInstance extends Window implements EventListener<Event>
enableButtons();
}
} // actionPerformed
private void onCancel() {
m_M_AttributeSetInstance_ID = -1;
m_M_AttributeSetInstanceName = null;
detach();
}
/**
* 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);
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 {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
detach();
onCancel();
} else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
if (editable) {
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) {
if (status != null && maxSize > 0) {
StringBuffer msg = new StringBuffer();

View File

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

View File

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

View File

@ -152,14 +152,14 @@ public class WReportUploadDialog extends Window implements EventListener<Event>
LayoutUtils.addSclass("dialog-footer", confirmPanel);
confirmPanel.addActionListener(this);
addEventListener(Events.ON_CANCEL, e -> onClose());
addEventListener(Events.ON_CANCEL, e -> onCancel());
this.setVflex("min");
}
@Override
public void onEvent(Event event) throws Exception {
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
onClose();
onCancel();
} else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
uploadFile();
} else if (event.getTarget() == cboType) {
@ -167,6 +167,10 @@ public class WReportUploadDialog extends Window implements EventListener<Event>
}
}
private void onCancel() {
onClose();
}
private void onOutputTypeSelectionChanged() {
Listitem li = cboType.getSelectedItem();
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());
}
}
@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);
setSizable(true);
setMaximizable(true);
addEventListener(Events.ON_CANCEL, e -> onCancel());
}
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 {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) {
cancelled = true;
detach();
onCancel();
} else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
if (editable) {
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) {
if (status != null && maxSize > 0) {