IDEMPIERE-144 Performance: Reduce use of modal dialog

This commit is contained in:
Heng Sin Low 2012-06-07 17:40:47 +08:00
parent fff6937a7c
commit 020741dc09
26 changed files with 393 additions and 177 deletions

View File

@ -383,4 +383,9 @@ public class VCreateFromInvoiceUI extends CreateFromInvoice implements ActionLis
{ {
dialog.dispose(); dialog.dispose();
} }
@Override
public Object getWindow() {
return dialog;
}
} }

View File

@ -195,4 +195,9 @@ public class VCreateFromRMAUI extends CreateFromRMA implements VetoableChangeLis
{ {
dialog.dispose(); dialog.dispose();
} }
@Override
public Object getWindow() {
return dialog;
}
} }

View File

@ -547,4 +547,9 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL
} }
@Override
public Object getWindow() {
return dialog;
}
} }

View File

@ -339,4 +339,9 @@ public class VCreateFromStatementUI extends CreateFromStatement implements Actio
{ {
dialog.dispose(); dialog.dispose();
} }
@Override
public Object getWindow() {
return dialog;
}
} }

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -58,16 +59,11 @@ import org.zkoss.zul.Html;
* @author arboleda - globalqss * @author arboleda - globalqss
* - Implement ShowHelp option on processes and reports * - Implement ShowHelp option on processes and reports
*/ */
public class ProcessModalDialog extends Window implements EventListener<Event>, IProcessMonitor public class ProcessModalDialog extends Window implements EventListener<Event>, IProcessMonitor, DialogEvents
{ {
private static final String ON_STATUS_UPDATE = "onStatusUpdate"; private static final String ON_STATUS_UPDATE = "onStatusUpdate";
private static final String ON_COMPLETE = "onComplete"; private static final String ON_COMPLETE = "onComplete";
/**
* on modal close event, use this for highlight mode modal dialog to perform action after the modal dialog closed.
*/
public final static String ON_MODAL_CLOSE = "onModalClose";
/** /**
* generated serial version ID * generated serial version ID
*/ */

View File

@ -49,10 +49,8 @@ import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventListener, ValueChangeListener, SystemIDs public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventListener<Event>, ValueChangeListener, SystemIDs
{ {
private static final long serialVersionUID = 1L;
private WCreateFromWindow window; private WCreateFromWindow window;
public WCreateFromInvoiceUI(GridTab tab) public WCreateFromInvoiceUI(GridTab tab)
@ -379,4 +377,9 @@ public class WCreateFromInvoiceUI extends CreateFromInvoice implements EventList
{ {
window.dispose(); window.dispose();
} }
@Override
public Object getWindow() {
return window;
}
} }

View File

@ -42,8 +42,6 @@ import org.zkoss.zul.Center;
public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListener, SystemIDs public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListener, SystemIDs
{ {
private static final long serialVersionUID = 1L;
private WCreateFromWindow window; private WCreateFromWindow window;
public WCreateFromRMAUI(GridTab tab) public WCreateFromRMAUI(GridTab tab)
@ -190,4 +188,9 @@ public class WCreateFromRMAUI extends CreateFromRMA implements ValueChangeListen
{ {
window.dispose(); window.dispose();
} }
@Override
public Object getWindow() {
return window;
}
} }

View File

@ -39,12 +39,10 @@ import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
import org.compiere.grid.CreateFromShipment; import org.compiere.grid.CreateFromShipment;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MInvoice;
import org.compiere.model.MLocatorLookup; import org.compiere.model.MLocatorLookup;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MProduct; import org.compiere.model.MProduct;
import org.compiere.model.MRMA;
import org.compiere.model.SystemIDs; import org.compiere.model.SystemIDs;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
@ -58,7 +56,7 @@ import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener, ValueChangeListener, SystemIDs public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener<Event>, ValueChangeListener, SystemIDs
{ {
private WCreateFromWindow window; private WCreateFromWindow window;
@ -111,10 +109,6 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
protected WLocatorEditor locatorField = new WLocatorEditor(); protected WLocatorEditor locatorField = new WLocatorEditor();
protected Label upcLabel = new Label(); protected Label upcLabel = new Label();
protected WStringEditor upcField = new WStringEditor(); protected WStringEditor upcField = new WStringEditor();
/** Loaded Invoice */
private MInvoice m_invoice = null;
/** Loaded RMA */
private MRMA m_rma = null;
/** /**
* Dynamic Init * Dynamic Init
@ -270,7 +264,6 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
invoiceField.setSelectedIndex(-1); invoiceField.setSelectedIndex(-1);
rmaField.setSelectedIndex(-1); rmaField.setSelectedIndex(-1);
loadOrder(C_Order_ID, false, locatorField.getValue()!=null?((Integer)locatorField.getValue()).intValue():0); loadOrder(C_Order_ID, false, locatorField.getValue()!=null?((Integer)locatorField.getValue()).intValue():0);
m_invoice = null;
} }
} }
// Invoice // Invoice
@ -554,4 +547,9 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
{ {
window.dispose(); window.dispose();
} }
@Override
public Object getWindow() {
return window;
}
} }

View File

@ -56,10 +56,8 @@ import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
public class WCreateFromStatementUI extends CreateFromStatement implements EventListener, SystemIDs public class WCreateFromStatementUI extends CreateFromStatement implements EventListener<Event>, SystemIDs
{ {
private static final long serialVersionUID = 1L;
private WCreateFromWindow window; private WCreateFromWindow window;
public WCreateFromStatementUI(GridTab tab) public WCreateFromStatementUI(GridTab tab)
@ -306,4 +304,9 @@ public class WCreateFromStatementUI extends CreateFromStatement implements Event
{ {
window.dispose(); window.dispose();
} }
@Override
public Object getWindow() {
return window;
}
} }

View File

@ -21,6 +21,7 @@ import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.WAppsAction; import org.adempiere.webui.component.WAppsAction;
import org.adempiere.webui.component.WListbox; import org.adempiere.webui.component.WListbox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.WTableModelEvent; import org.adempiere.webui.event.WTableModelEvent;
import org.adempiere.webui.event.WTableModelListener; import org.adempiere.webui.event.WTableModelListener;
import org.adempiere.webui.panel.StatusBarPanel; import org.adempiere.webui.panel.StatusBarPanel;
@ -30,13 +31,14 @@ import org.compiere.util.Trx;
import org.compiere.util.TrxRunnable; import org.compiere.util.TrxRunnable;
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.North; import org.zkoss.zul.North;
import org.zkoss.zul.South; import org.zkoss.zul.South;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
public class WCreateFromWindow extends Window implements EventListener, WTableModelListener public class WCreateFromWindow extends Window implements EventListener<Event>, WTableModelListener, DialogEvents
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -47,6 +49,8 @@ public class WCreateFromWindow extends Window implements EventListener, WTableMo
private ConfirmPanel confirmPanel = new ConfirmPanel(true); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private StatusBarPanel statusBar = new StatusBarPanel(); private StatusBarPanel statusBar = new StatusBarPanel();
private WListbox dataTable = ListboxFactory.newDataTable(); private WListbox dataTable = ListboxFactory.newDataTable();
private boolean isCancel;
public static final String SELECT_ALL = "SelectAll"; public static final String SELECT_ALL = "SelectAll";
@ -115,6 +119,7 @@ public class WCreateFromWindow extends Window implements EventListener, WTableMo
// OK - Save // OK - Save
if (e.getTarget().getId().equals(ConfirmPanel.A_OK)) if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
{ {
isCancel = false;
try try
{ {
Trx.run(new TrxRunnable() Trx.run(new TrxRunnable()
@ -132,11 +137,14 @@ public class WCreateFromWindow extends Window implements EventListener, WTableMo
{ {
FDialog.error(windowNo, this, "Error", ex.getLocalizedMessage()); FDialog.error(windowNo, this, "Error", ex.getLocalizedMessage());
} }
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
} }
// Cancel // Cancel
else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{ {
isCancel = true;
dispose(); dispose();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
} }
// Select All // Select All
// Trifon // Trifon
@ -215,4 +223,9 @@ public class WCreateFromWindow extends Window implements EventListener, WTableMo
{ {
return confirmPanel; return confirmPanel;
} }
public boolean isCancel()
{
return isCancel;
}
} }

View File

@ -46,6 +46,7 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WDateEditor; import org.adempiere.webui.editor.WDateEditor;
import org.adempiere.webui.editor.WNumberEditor; import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MCash; import org.compiere.model.MCash;
@ -71,6 +72,7 @@ import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuEcho; import org.zkoss.zk.au.out.AuEcho;
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.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
@ -110,7 +112,7 @@ import org.zkoss.zul.Space;
* <li>BF [ 1789949 ] VPayment: is displaying just "CashNotCreated" * <li>BF [ 1789949 ] VPayment: is displaying just "CashNotCreated"
*/ */
public class WPayment extends Window public class WPayment extends Window
implements EventListener implements EventListener<Event>, DialogEvents
{ {
/** /**
* *
@ -129,7 +131,6 @@ public class WPayment extends Window
{ {
super(); super();
this.setTitle(Msg.getMsg(Env.getCtx(), "Payment")); this.setTitle(Msg.getMsg(Env.getCtx(), "Payment"));
this.setAttribute("mode", "modal");
m_WindowNo = WindowNo; m_WindowNo = WindowNo;
m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx")); m_isSOTrx = "Y".equals(Env.getContext(Env.getCtx(), WindowNo, "IsSOTrx"));
m_mTab = mTab; m_mTab = mTab;
@ -772,7 +773,7 @@ public class WPayment extends Window
* Load Bank Accounts * Load Bank Accounts
*/ */
SQL = MRole.getDefault().addAccessSQL( SQL = MRole.getDefault().addAccessSQL(
"SELECT C_BankAccount_ID, Name || ' ' || AccountNo, IsDefault " "SELECT C_BankAccount_ID, ba.Name || ' ' || AccountNo, IsDefault "
+ "FROM C_BankAccount ba" + "FROM C_BankAccount ba"
+ " INNER JOIN C_Bank b ON (ba.C_Bank_ID=b.C_Bank_ID) " + " INNER JOIN C_Bank b ON (ba.C_Bank_ID=b.C_Bank_ID) "
+ "WHERE b.IsActive='Y'", + "WHERE b.IsActive='Y'",
@ -939,6 +940,13 @@ public class WPayment extends Window
} }
} // actionPerformed } // actionPerformed
@Override
public void dispose() {
super.dispose();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
}
public void lockUI() { public void lockUI() {
if (m_isLocked) return; if (m_isLocked) return;

View File

@ -0,0 +1,28 @@
/******************************************************************************
* Copyright (C) 2012 Heng Sin Low *
* Copyright (C) 2012 Trek Global *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.event;
/**
*
* @author hengsin
*
*/
public interface DialogEvents {
/**
* on modal close event, use this for highlight mode modal dialog to perform action after the modal dialog closed.
*/
public final static String ON_MODAL_CLOSE = "onModalClose";
}

View File

@ -38,6 +38,7 @@ import org.adempiere.webui.apps.BusyDialogTemplate;
import org.adempiere.webui.apps.ProcessModalDialog; import org.adempiere.webui.apps.ProcessModalDialog;
import org.adempiere.webui.apps.WReport; import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.apps.form.WCreateFromFactory; import org.adempiere.webui.apps.form.WCreateFromFactory;
import org.adempiere.webui.apps.form.WCreateFromWindow;
import org.adempiere.webui.apps.form.WPayment; import org.adempiere.webui.apps.form.WPayment;
import org.adempiere.webui.component.CWindowToolbar; import org.adempiere.webui.component.CWindowToolbar;
import org.adempiere.webui.component.IADTab; import org.adempiere.webui.component.IADTab;
@ -47,11 +48,13 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.event.ActionEvent; import org.adempiere.webui.event.ActionEvent;
import org.adempiere.webui.event.ActionListener; import org.adempiere.webui.event.ActionListener;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.panel.action.ExportAction; import org.adempiere.webui.panel.action.ExportAction;
import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.util.Callback;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.adempiere.webui.window.FindWindow; import org.adempiere.webui.window.FindWindow;
import org.adempiere.webui.window.WChat; import org.adempiere.webui.window.WChat;
@ -172,6 +175,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
private boolean m_findCreateNew; private boolean m_findCreateNew;
private boolean m_queryInitiating;
/** /**
* Constructor for non-embedded mode * Constructor for non-embedded mode
* @param ctx * @param ctx
@ -519,6 +524,15 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
} }
private void initQueryOnNew(MQuery result) {
if (curTab.isHighVolume() && m_findCreateNew)
onNew();
else if (result == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo))
onNew();
else if (!curTab.isReadOnly() && curTab.isQueryNewRecord())
onNew();
}
/** /**
* @param query * @param query
* @param tabIndex * @param tabIndex
@ -526,26 +540,39 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
protected void initTab(MQuery query, int tabIndex) { protected void initTab(MQuery query, int tabIndex) {
gridWindow.initTab(tabIndex); gridWindow.initTab(tabIndex);
GridTab gTab = gridWindow.getTab(tabIndex); final GridTab gTab = gridWindow.getTab(tabIndex);
Env.setContext(ctx, curWindowNo, tabIndex, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel())); Env.setContext(ctx, curWindowNo, tabIndex, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel()));
// Query first tab // Query first tab
if (tabIndex == 0) if (tabIndex == 0)
{ {
query = initialQuery(query, gTab); m_queryInitiating = true;
if (gTab.isHighVolume() && m_findCancelled) initialQuery(query, gTab, new Callback<MQuery>() {
return; @Override
public void onCallback(MQuery result) {
if (query != null && query.getRecordCount() <= 1) m_queryInitiating = false;
{
// goSingleRow = true; if (m_findCancelled) {
} SessionManager.getAppDesktop().closeWindow(curWindowNo);
// Set initial Query on first tab return;
if (query != null) }
{
m_onlyCurrentRows = false; // Set initial Query on first tab
gTab.setQuery(query); if (result != null)
} {
m_onlyCurrentRows = false;
gTab.setQuery(result);
}
if (curTabpanel != null)
{
initFirstTabpanel();
initQueryOnNew(result);
}
}
});
curTab = gTab; curTab = gTab;
curTabIndex = tabIndex; curTabIndex = tabIndex;
@ -565,8 +592,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (tabIndex == 0) { if (tabIndex == 0) {
curTabpanel = sortTab; curTabpanel = sortTab;
curTabpanel.createUI(); curTabpanel.createUI();
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); if (!m_queryInitiating)
curTabpanel.activate(true); {
initFirstTabpanel();
}
} }
gTab.addDataStatusListener(this); gTab.addDataStatusListener(this);
} }
@ -598,20 +627,23 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (tabIndex == 0) { if (tabIndex == 0) {
fTabPanel.createUI(); fTabPanel.createUI();
curTabpanel = fTabPanel; curTabpanel = fTabPanel;
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); if (!m_queryInitiating)
curTabpanel.activate(true); {
initFirstTabpanel();
}
} }
} }
if (!m_queryInitiating && tabIndex == 0)
{
initQueryOnNew(query);
}
} }
}
if (tabIndex == 0) { private void initFirstTabpanel() {
if (curTab.isHighVolume() && m_findCreateNew) curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
onNew(); curTabpanel.activate(true);
else if (query == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo))
onNew();
else if (!curTab.isReadOnly() && curTab.isQueryNewRecord())
onNew();
}
} }
/** /**
@ -623,11 +655,15 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
* tab * tab
* @return query or null * @return query or null
*/ */
private MQuery initialQuery(MQuery query, GridTab mTab) private void initialQuery(final MQuery query, GridTab mTab, final Callback<MQuery> callback)
{ {
// We have a (Zoom) query // We have a (Zoom) query
if (query != null && query.isActive() && query.getRecordCount() < 10) if (query != null && query.isActive() && query.getRecordCount() < 10)
return query; {
callback.onCallback(query);
return;
}
// //
StringBuffer where = new StringBuffer(); StringBuffer where = new StringBuffer();
// Query automatically if high volume and no query // Query automatically if high volume and no query
@ -665,26 +701,32 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
m_findCancelled = false; m_findCancelled = false;
m_findCreateNew = false; m_findCreateNew = false;
GridField[] findFields = mTab.getFields(); GridField[] findFields = mTab.getFields();
FindWindow find = new FindWindow(curWindowNo, final FindWindow find = new FindWindow(curWindowNo,
mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10 where.toString(), findFields, 10, mTab.getAD_Tab_ID()); // no query below 10
if (find.getTitle() != null && find.getTitle().length() > 0) { find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
// Title is not set when the number of rows is below the minRecords parameter (10) @Override
if (!find.isCancel()) public void onEvent(Event event) throws Exception {
{ if (!find.isCancel())
m_findCreateNew = find.isCreateNew(); {
if (!m_findCreateNew) m_findCreateNew = find.isCreateNew();
{ MQuery result = m_findCreateNew ? query : find.getQuery();
query = find.getQuery(); callback.onCallback(result);
} }
} else
else {
m_findCancelled = true; m_findCancelled = true;
find = null; callback.onCallback(null);
} }
}
});
AEnv.showWindow(find);
}
else
{
callback.onCallback(query);
} }
return query;
} // initialQuery } // initialQuery
public String getTitle() public String getTitle()
@ -819,12 +861,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (curTab.needSave(true, true) && !onSave(false)) if (curTab.needSave(true, true) && !onSave(false))
return; return;
WOnlyCurrentDays ocd = new WOnlyCurrentDays(); final WOnlyCurrentDays ocd = new WOnlyCurrentDays();
m_onlyCurrentDays = ocd.getCurrentDays(); ocd.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
history(m_onlyCurrentDays); public void onEvent(Event event) throws Exception {
} m_onlyCurrentDays = ocd.getCurrentDays();
focusToActivePanel(); history(m_onlyCurrentDays);
focusToActivePanel();
}
});
AEnv.showWindow(ocd);
}
} }
private void history(int onlyCurrentDays) private void history(int onlyCurrentDays)
@ -898,10 +945,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
String description = infoName + ": " + infoDisplay; String description = infoName + ": " + infoDisplay;
new WChat(curWindowNo, curTab.getCM_ChatID(), curTab.getAD_Table_ID(), recordId, description, null); WChat chat = new WChat(curWindowNo, curTab.getCM_ChatID(), curTab.getAD_Table_ID(), recordId, description, null);
curTab.loadChats(); chat.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
toolbar.getButton("Chat").setPressed(curTab.hasChat()); @Override
focusToActivePanel(); public void onEvent(Event event) throws Exception {
curTab.loadChats();
toolbar.getButton("Chat").setPressed(curTab.hasChat());
focusToActivePanel();
}
});
chat.showWindow();
} }
/** /**
@ -1473,25 +1526,31 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
// Gets Fields from AD_Field_v // Gets Fields from AD_Field_v
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID()); GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(), final FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
curTab.getAD_Table_ID(), curTab.getTableName(), curTab.getAD_Table_ID(), curTab.getTableName(),
curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID()); curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID());
if (!find.isCancel()) find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
{ @Override
MQuery query = find.getQuery(); public void onEvent(Event event) throws Exception {
if (!find.isCancel())
{
MQuery query = find.getQuery();
// Confirmed query // Confirmed query
if (query != null) if (query != null)
{ {
m_onlyCurrentRows = false; // search history too m_onlyCurrentRows = false; // search history too
curTab.setQuery(query); curTab.setQuery(query);
curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize
} }
curTab.dataRefresh(false); // Elaine 2008/07/25 curTab.dataRefresh(false); // Elaine 2008/07/25
} }
focusToActivePanel(); focusToActivePanel();
}
});
AEnv.showWindow(find);
} }
/** /**
@ -1655,7 +1714,15 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
//show table with deletion rows -> value, name... //show table with deletion rows -> value, name...
final Window messagePanel = new Window(); final Window messagePanel = new Window() {
private static final long serialVersionUID = 3954976581821972619L;
@Override
public void detach() {
super.detach();
focusToActivePanel();
}
};
messagePanel.setBorder("normal"); messagePanel.setBorder("normal");
messagePanel.setWidth("600px"); messagePanel.setWidth("600px");
messagePanel.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title); messagePanel.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
@ -1820,9 +1887,11 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
}); });
hbox.appendChild(btnCancel); hbox.appendChild(btnCancel);
hbox.setPack("end");
hbox.setHflex("1");
AEnv.showWindow(messagePanel); messagePanel.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
focusToActivePanel(); AEnv.showWindow(messagePanel);
} }
// //
@ -2012,7 +2081,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
* Start Button Process * Start Button Process
* @param vButton button * @param vButton button
*/ */
private void actionButton (WButtonEditor wButton) private void actionButton (final WButtonEditor wButton)
{ {
if (curTab.hasChangedCurrentTabAndParents()) { if (curTab.hasChangedCurrentTabAndParents()) {
String msg = CLogger.retrieveErrorString("Please ReQuery Window"); String msg = CLogger.retrieveErrorString("Please ReQuery Window");
@ -2043,7 +2112,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
return; return;
} }
int table_ID = curTab.getAD_Table_ID(); final int table_ID = curTab.getAD_Table_ID();
// Record_ID // Record_ID
@ -2074,32 +2143,32 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
boolean isProcessMandatory = false; boolean isProcessMandatory = false;
// Pop up Payment Rules // Pop up Payment Rules
if (col.equals("PaymentRule")) if (col.equals("PaymentRule"))
{ {
WPayment vp = new WPayment(curWindowNo, curTab, wButton); final WPayment vp = new WPayment(curWindowNo, curTab, wButton);
if (vp.isInitOK()) // may not be allowed if (vp.isInitOK()) // may not be allowed
{ {
vp.setVisible(true); vp.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showCenterScreen(vp); vp.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
} @Override
//vp.dispose(); public void onEvent(Event event) throws Exception {
if (vp.needSave())
if (vp.needSave()) {
{ onSave(false);
onSave(false); onRefresh(false);
onRefresh(false); }
} }
});
AEnv.showWindow(vp);
}
return;
} // PaymentRule } // PaymentRule
// Pop up Document Action (Workflow) // Pop up Document Action (Workflow)
else if (col.equals("DocAction")) else if (col.equals("DocAction"))
{ {
isProcessMandatory = true; final WDocActionPanel win = new WDocActionPanel(curTab);
WDocActionPanel win = new WDocActionPanel(curTab);
if (win.getNumberOfOptions() == 0) if (win.getNumberOfOptions() == 0)
{ {
logger.info("DocAction - No Options"); logger.info("DocAction - No Options");
@ -2107,15 +2176,22 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
} }
else else
{ {
AEnv.showCenterScreen(win); final int recordIdParam = record_ID;
win.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
if (!win.isStartProcess()) win.setPosition("center");
return; win.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
//batch = win.isBatch(); if (!win.isStartProcess()) {
startWOasking = true; return;
//vda.dispose(); }
} boolean startWOasking = true;
boolean isProcessMandatory = true;
executeButtonProcess(wButton, startWOasking, table_ID, recordIdParam, isProcessMandatory);
}
});
AEnv.showWindow(win);
return;
}
} // DocAction } // DocAction
// Pop up Create From // Pop up Create From
@ -2128,8 +2204,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
if(cf.isInitOK()) if(cf.isInitOK())
{ {
cf.showWindow(); final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
curTab.dataRefresh(); window.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
window.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (!window.isCancel()) {
curTab.dataRefresh();
}
}
});
cf.showWindow();
} }
return; return;
} }
@ -2196,6 +2281,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
return; return;
} // Posted } // Posted
executeButtonProcess(wButton, startWOasking, table_ID, record_ID,
isProcessMandatory);
} // actionButton
private void executeButtonProcess(final WButtonEditor wButton,
boolean startWOasking, int table_ID, int record_ID,
boolean isProcessMandatory) {
/** /**
* Start Process ---- * Start Process ----
*/ */
@ -2248,7 +2340,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
dialog.setVisible(true); dialog.setVisible(true);
dialog.setPosition("center"); dialog.setPosition("center");
dialog.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); dialog.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
dialog.addEventListener(ProcessModalDialog.ON_MODAL_CLOSE, new EventListener<Event>() { dialog.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
onRefresh(false); onRefresh(false);
@ -2261,7 +2353,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
onRefresh(false); onRefresh(false);
} }
} }
} // actionButton }
/** /**
* @param event * @param event

View File

@ -27,6 +27,7 @@ import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MTable; import org.compiere.model.MTable;
@ -48,7 +49,7 @@ import org.zkoss.zul.Space;
public class WDocActionPanel extends Window implements EventListener public class WDocActionPanel extends Window implements EventListener<Event>, DialogEvents
{ {
/** /**
* *
@ -299,12 +300,14 @@ public class WDocActionPanel extends Window implements EventListener
m_OKpressed = true; m_OKpressed = true;
setValue(); setValue();
this.detach(); this.detach();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
} }
else if (confirmPanel.getButton("Cancel").equals(event.getTarget())) else if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
{ {
m_OKpressed = false; m_OKpressed = false;
this.detach(); this.detach();
} Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
}
} }
else if (Events.ON_SELECT.equals(event.getName())) else if (Events.ON_SELECT.equals(event.getName()))
{ {

View File

@ -19,9 +19,9 @@ package org.adempiere.webui.panel;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -39,7 +39,7 @@ import org.zkoss.zul.Separator;
* @date September 24, 2007 * @date September 24, 2007
*/ */
public class WOnlyCurrentDays extends Window implements EventListener public class WOnlyCurrentDays extends Window implements EventListener<Event>, DialogEvents
{ {
/** /**
* *
@ -65,8 +65,7 @@ public class WOnlyCurrentDays extends Window implements EventListener
log.log(Level.SEVERE, "VOnlyCurrentDays", e); log.log(Level.SEVERE, "VOnlyCurrentDays", e);
} }
this.setVisible(true); this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(this);
} // WOnlyCurrentDays } // WOnlyCurrentDays
private Hbox mainPanel = new Hbox(); private Hbox mainPanel = new Hbox();
@ -116,7 +115,6 @@ public class WOnlyCurrentDays extends Window implements EventListener
this.setBorder("normal"); this.setBorder("normal");
this.setTitle(Msg.getMsg(Env.getCtx(), "VOnlyCurrentDays")); this.setTitle(Msg.getMsg(Env.getCtx(), "VOnlyCurrentDays"));
this.setClosable(true); this.setClosable(true);
this.setAttribute("mode", "modal");
this.appendChild(new Separator()); this.appendChild(new Separator());
this.appendChild(mainPanel); this.appendChild(mainPanel);
@ -149,4 +147,9 @@ public class WOnlyCurrentDays extends Window implements EventListener
this.detach(); this.detach();
} }
@Override
public void detach() {
super.detach();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
}
} }

View File

@ -51,7 +51,7 @@ import org.zkoss.zul.Vbox;
* @author hengsin * @author hengsin
* *
*/ */
public class ExportAction implements EventListener public class ExportAction implements EventListener<Event>
{ {
private AbstractADWindowPanel panel; private AbstractADWindowPanel panel;
@ -109,7 +109,7 @@ public class ExportAction implements EventListener
cboType.setSelectedIndex(0); cboType.setSelectedIndex(0);
Vbox vb = new Vbox(); Vbox vb = new Vbox();
vb.setWidth("390px"); vb.setWidth("100%");
winExportFile.appendChild(vb); winExportFile.appendChild(vb);
Hbox hb = new Hbox(); Hbox hb = new Hbox();
@ -131,7 +131,8 @@ public class ExportAction implements EventListener
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
} }
AEnv.showCenterScreen(winExportFile); winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(winExportFile);
} }
@Override @Override

View File

@ -0,0 +1,25 @@
/******************************************************************************
* Copyright (C) 2012 Heng Sin Low *
* Copyright (C) 2012 Trek Global *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.adempiere.webui.util;
/**
*
* @author hengsin
*
* @param <T>
*/
public interface Callback<T> {
public void onCallback(T result);
}

View File

@ -34,7 +34,6 @@ import java.util.regex.Pattern;
import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Columns;
@ -57,6 +56,7 @@ import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WNumberEditor; import org.adempiere.webui.editor.WNumberEditor;
import org.adempiere.webui.editor.WStringEditor; import org.adempiere.webui.editor.WStringEditor;
import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.part.MultiTabPart; import org.adempiere.webui.part.MultiTabPart;
@ -81,6 +81,7 @@ import org.compiere.util.SecureEngine;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent;
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.zk.ui.event.Events;
@ -99,7 +100,7 @@ import org.zkoss.zul.Hbox;
* @author Sendy Yagambrum * @author Sendy Yagambrum
* @date June 27, 2007 * @date June 27, 2007
*/ */
public class FindWindow extends Window implements EventListener<Event>,ValueChangeListener, SystemIDs public class FindWindow extends Window implements EventListener<Event>, ValueChangeListener, SystemIDs, DialogEvents
{ {
/** /**
* *
@ -207,12 +208,10 @@ public class FindWindow extends Window implements EventListener<Event>,ValueChan
this.setWidth("750px"); this.setWidth("750px");
this.setHeight("350px"); this.setHeight("350px");
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title); this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
this.setAttribute(Window.MODE_KEY, Window.MODE_MODAL); this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
this.setClosable(false); this.setClosable(false);
this.setSizable(true); this.setSizable(true);
this.setMaximizable(true);
this.setVisible(true);
AEnv.showWindow(this);
} }
/** /**
* initialise lookup record tab * initialise lookup record tab
@ -360,6 +359,7 @@ public class FindWindow extends Window implements EventListener<Event>,ValueChan
Hbox confirmPanel = new Hbox(); Hbox confirmPanel = new Hbox();
confirmPanel.appendChild(pnlButtonRight); confirmPanel.appendChild(pnlButtonRight);
confirmPanel.setWidth("100%"); confirmPanel.setWidth("100%");
confirmPanel.setPack("end");
advancedPanel = new Listbox(); advancedPanel = new Listbox();
advancedPanel.setSizedByContent(true); advancedPanel.setSizedByContent(true);
@ -1141,6 +1141,8 @@ public class FindWindow extends Window implements EventListener<Event>,ValueChan
listcell.setLabel(""); listcell.setLabel("");
listcell.getChildren().clear(); listcell.getChildren().clear();
listcell.appendChild(component); listcell.appendChild(component);
((HtmlBasedComponent)component).setHflex("1");
listcell.invalidate();
} // addComponent } // addComponent
/** /**
@ -1325,6 +1327,8 @@ public class FindWindow extends Window implements EventListener<Event>,ValueChan
m_targetFields = null; m_targetFields = null;
// //
super.dispose(); super.dispose();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
} // dispose } // dispose
/** /**

View File

@ -28,6 +28,7 @@ import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.compiere.model.MChat; import org.compiere.model.MChat;
import org.compiere.model.MChatEntry; import org.compiere.model.MChatEntry;
import org.compiere.model.MUser; import org.compiere.model.MUser;
@ -39,6 +40,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;
@ -56,7 +58,7 @@ import org.zkoss.zul.Treerow;
* @author Jorg Janke * @author Jorg Janke
* @version $Id: AChat.java,v 1.3 2006/07/30 00:51:27 jjanke Exp $ * @version $Id: AChat.java,v 1.3 2006/07/30 00:51:27 jjanke Exp $
*/ */
public class WChat extends Window implements EventListener public class WChat extends Window implements EventListener<Event>, DialogEvents
{ {
/** /**
* *
@ -104,15 +106,14 @@ public class WChat extends Window implements EventListener
m_chat = new MChat (Env.getCtx(), CM_Chat_ID, trxName); m_chat = new MChat (Env.getCtx(), CM_Chat_ID, trxName);
loadChat(); loadChat();
// //
try
{
newText.focus();
AEnv.showCenterScreen(this);
}
catch (Exception e)
{
}
} // Attachment } // Attachment
public void showWindow()
{
this.setAttribute(MODE_KEY, MODE_HIGHLIGHTED);
AEnv.showWindow(this);
newText.focus();
}
/** Window No */ /** Window No */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -350,4 +351,9 @@ public class WChat extends Window implements EventListener
actionPerformed(event); actionPerformed(event);
} }
@Override
public void detach() {
super.detach();
Events.sendEvent(this, new Event(ON_MODAL_CLOSE, this, null));
}
} // AChat } // AChat

View File

@ -132,7 +132,8 @@ public class WEMailDialog extends Window implements EventListener<Event>, ValueC
} }
set(from, to, subject, message); set(from, to, subject, message);
setAttachment(attachment); setAttachment(attachment);
AEnv.showCenterScreen(this); setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(this);
} // commonInit } // commonInit

View File

@ -41,6 +41,7 @@ import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabs; import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.DrillEvent; import org.adempiere.webui.event.DrillEvent;
import org.adempiere.webui.event.ZoomEvent; import org.adempiere.webui.event.ZoomEvent;
import org.adempiere.webui.panel.ITabOnCloseHandler; import org.adempiere.webui.panel.ITabOnCloseHandler;
@ -786,19 +787,20 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
hb.appendChild(cboType); hb.appendChild(cboType);
cboType.setWidth("100%"); cboType.setWidth("100%");
hb.setVflex("1"); hb.setVflex("1");
hb.setStyle("margin-top: 10px");
Vbox vb = new Vbox(); Vbox vb = new Vbox();
vb.setVflex("1"); vb.setVflex("1");
vb.setWidth("100%"); vb.setWidth("100%");
winExportFile.appendChild(vb); winExportFile.appendChild(vb);
vb.appendChild(hb); vb.appendChild(hb);
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
confirmPanel.addActionListener(this); confirmPanel.addActionListener(this);
confirmPanel.setVflex("0"); confirmPanel.setVflex("0");
} }
AEnv.showCenterScreen(winExportFile); winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(winExportFile);
} // cmd_export } // cmd_export
private void exportFile() private void exportFile()
@ -1023,18 +1025,23 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
bFind.setVisible(false); bFind.setVisible(false);
else else
{ {
FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID); final FindWindow find = new FindWindow(m_WindowNo, title, AD_Table_ID, tableName,m_reportEngine.getWhereExtended(), findFields, 1, AD_Tab_ID);
if (!find.isCancel()) find.addEventListener(DialogEvents.ON_MODAL_CLOSE, new EventListener<Event>() {
{ @Override
m_reportEngine.setQuery(find.getQuery()); public void onEvent(Event event) throws Exception {
try { if (!find.isCancel())
renderReport(); {
} catch (Exception e) { m_reportEngine.setQuery(find.getQuery());
throw new AdempiereException("Failed to render report", e); try {
} renderReport();
revalidate(); } catch (Exception e) {
} throw new AdempiereException("Failed to render report", e);
find = null; }
revalidate();
}
}
});
AEnv.showWindow(find);
} }
} // cmd_find } // cmd_find

View File

@ -53,7 +53,7 @@ import org.compiere.util.Msg;
* <li>BF [ 1896947 ] Generate invoice from Order error * <li>BF [ 1896947 ] Generate invoice from Order error
* <li>BF [ 2007837 ] VCreateFrom.save() should run in trx * <li>BF [ 2007837 ] VCreateFrom.save() should run in trx
*/ */
public class CreateFromInvoice extends CreateFrom public abstract class CreateFromInvoice extends CreateFrom
{ {
/** /**
* Protected Constructor * Protected Constructor

View File

@ -35,7 +35,7 @@ import org.compiere.util.Msg;
* @author Teo Sarca, www.arhipac.ro * @author Teo Sarca, www.arhipac.ro
* <li>BF [ 2007837 ] VCreateFrom.save() should run in trx * <li>BF [ 2007837 ] VCreateFrom.save() should run in trx
*/ */
public class CreateFromRMA extends CreateFrom { public abstract class CreateFromRMA extends CreateFrom {
public CreateFromRMA(GridTab mTab) public CreateFromRMA(GridTab mTab)
{ {

View File

@ -50,7 +50,7 @@ import org.compiere.util.Msg;
* <li>BF [ 1896947 ] Generate invoice from Order error * <li>BF [ 1896947 ] Generate invoice from Order error
* <li>BF [ 2007837 ] VCreateFrom.save() should run in trx * <li>BF [ 2007837 ] VCreateFrom.save() should run in trx
*/ */
public class CreateFromShipment extends CreateFrom public abstract class CreateFromShipment extends CreateFrom
{ {
/** Loaded Invoice */ /** Loaded Invoice */
private MInvoice m_invoice = null; private MInvoice m_invoice = null;

View File

@ -42,7 +42,7 @@ import org.compiere.util.Msg;
* @author Teo Sarca, www.arhipac.ro * @author Teo Sarca, www.arhipac.ro
* <li>BF [ 2007837 ] VCreateFrom.save() should run in trx * <li>BF [ 2007837 ] VCreateFrom.save() should run in trx
*/ */
public class CreateFromStatement extends CreateFrom public abstract class CreateFromStatement extends CreateFrom
{ {
public MBankAccount bankAccount; public MBankAccount bankAccount;

View File

@ -20,4 +20,6 @@ public interface ICreateFrom
public void showWindow(); public void showWindow();
public void closeWindow(); public void closeWindow();
public Object getWindow();
} }