IDEMPIERE-5275 - Tabular Report Re-Query button/close paramater window (#1306)

* IDEMPIERE-5275 - Tabular Report Re-Query button/close paramater window

* IDEMPIERE-5275 - fix bug with asynch. threads

* IDEMPIERE-5275 - BusyMask not showing correctly fix

* IDEMPIERE-5275 - icons added

* IDEMPIERE-5275 - sysconfig added

* IDEMPIERE-5275 - patch 1306_PeerReview applied

* IDEMPIERE-5275 - requested changes applied

* IDEMPIERE-5275 - small fixes

* IDEMPIERE-5275 - fixed wrong merge
This commit is contained in:
PeterTakacs300 2022-05-13 16:14:59 +02:00 committed by GitHub
parent 6edaf7374d
commit 13e0c8e1a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 221 additions and 13 deletions

View File

@ -0,0 +1,18 @@
-- IDEMPIERE-5275
SELECT register_migration_script('202205120916_IDEMPIERE-5275.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- May 12, 2022, 9:16:37 AM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200199,0,0,TO_TIMESTAMP('2022-05-12 09:16:36','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-05-12 09:16:36','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_REPORT_TABLE_OPEN_IN_NEW_TAB','N','If set to ''N'', the report opens in the same tab, if ''Y'', it opens a new tab','D','C','7d2126fa-f45a-4aeb-ad0f-21c6e096a2c3')
;
-- May 12, 2022, 10:12:31 AM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('M','Run it again with new parameters',0,0,'Y',TO_TIMESTAMP('2022-05-12 10:12:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-05-12 10:12:31','YYYY-MM-DD HH24:MI:SS'),100,200750,'ReRun','D','144c6c0e-e253-459f-acda-c23f55fa1962')
;
-- May 12, 2022, 11:56:24 AM CEST
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_ToolBarButton_UU,Action,IsAdvancedButton,IsAddSeparator,EntityType,IsShowMore) VALUES (0,0,TO_TIMESTAMP('2022-05-12 11:56:24','YYYY-MM-DD HH24:MI:SS'),100,'ReRun','Y',200120,'Report - ReRun',TO_TIMESTAMP('2022-05-12 11:56:24','YYYY-MM-DD HH24:MI:SS'),100,'N',0,0,'e4cf7b03-7c64-406d-a0bb-636618104786','R','N','N','D','N')
;

View File

@ -0,0 +1,15 @@
-- IDEMPIERE-5275
SELECT register_migration_script('202205120916_IDEMPIERE-5275.sql') FROM dual;
-- May 12, 2022, 9:16:37 AM CEST
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200199,0,0,TO_TIMESTAMP('2022-05-12 09:16:36','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2022-05-12 09:16:36','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','ZK_REPORT_TABLE_OPEN_IN_NEW_TAB','N','If set to ''N'', the report opens in the same tab, if ''Y'', it opens a new tab','D','C','7d2126fa-f45a-4aeb-ad0f-21c6e096a2c3')
;
-- May 12, 2022, 10:12:31 AM CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('M','Run it again with new parameters',0,0,'Y',TO_TIMESTAMP('2022-05-12 10:12:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2022-05-12 10:12:31','YYYY-MM-DD HH24:MI:SS'),100,200750,'ReRun','D','144c6c0e-e253-459f-acda-c23f55fa1962')
;
-- May 12, 2022, 11:56:24 AM CEST
INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,KeyStroke_KeyCode,KeyStroke_Modifiers,AD_ToolBarButton_UU,"action",IsAdvancedButton,IsAddSeparator,EntityType,IsShowMore) VALUES (0,0,TO_TIMESTAMP('2022-05-12 11:56:24','YYYY-MM-DD HH24:MI:SS'),100,'ReRun','Y',200120,'Report - ReRun',TO_TIMESTAMP('2022-05-12 11:56:24','YYYY-MM-DD HH24:MI:SS'),100,'N',0,0,'e4cf7b03-7c64-406d-a0bb-636618104786','R','N','N','D','N')
;

View File

@ -44,7 +44,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = -4977677634921011590L;
private static final long serialVersionUID = -8518931184171552658L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@ -219,6 +219,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_REPORT_FORM_OUTPUT_TYPE = "ZK_REPORT_FORM_OUTPUT_TYPE";
public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE";
public static final String ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW = "ZK_REPORT_ONLY_PRINTFORMAT_LINKEDTO_REPORTVIEW";
public static final String ZK_REPORT_TABLE_OPEN_IN_NEW_TAB = "ZK_REPORT_TABLE_OPEN_IN_NEW_TAB";
public static final String ZK_REPORT_TABLE_OUTPUT_TYPE = "ZK_REPORT_TABLE_OUTPUT_TYPE";
public static final String ZK_ROOT_FOLDER_BROWSER = "ZK_ROOT_FOLDER_BROWSER";
public static final String ZK_SEARCH_AUTO_COMPLETE_MAX_ROWS = "ZK_SEARCH_AUTO_COMPLETE_MAX_ROWS";

View File

@ -238,6 +238,8 @@ public class ReportEngine implements PrintServiceAttributeListener
private String m_name = null;
private boolean m_isReplaceTabContent = false;
/**
* store all column has same css rule into a list
* for IDEMPIERE-2640
@ -2390,6 +2392,22 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
return reportType;
}
/**
* Determines, if current tab content should be replaced, or a new tab should be opened
* @return
*/
public boolean isReplaceTabContent() {
return m_isReplaceTabContent;
}
/**
* Sets, if current tab content should be replaced, or a new tab should be opened
* @param m_isReplaceTabContent
*/
public void setIsReplaceTabContent(boolean m_isReplaceTabContent) {
this.m_isReplaceTabContent = m_isReplaceTabContent;
}
/**
* build css for table from mapCssInfo
* @param doc

View File

@ -29,6 +29,7 @@ import org.compiere.model.MPInstance;
import org.compiere.model.MPInstancePara;
import org.compiere.model.MProcess;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.util.CLogger;
@ -151,7 +152,10 @@ public class ProcessInfo implements Serializable
/** Export File */
private File m_exportFile = null;
/** Report Override Tab */
private boolean m_IsReplaceTabContent = false;
/** Row count */
private int m_rowCount;
@ -938,5 +942,20 @@ public class ProcessInfo implements Serializable
public IProcessUI getProcessUI() {
return processUI;
}
/**
* Determines, if current tab content should be replaced, or a new tab should be opened
* @return true, if current tab content should be replaced
*/
public boolean isReplaceTabContent() {
return m_IsReplaceTabContent;
}
/**
* Sets, if current tab content should be replaced, or a new tab should be opened
*/
public void setReplaceTabContent() {
this.m_IsReplaceTabContent = !(MSysConfig.getBooleanValue(MSysConfig.ZK_REPORT_TABLE_OPEN_IN_NEW_TAB, false, Env.getAD_Client_ID(Env.getCtx())));
}
} // ProcessInfo

View File

@ -56,5 +56,6 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
<!-- this js module doesn't actually exists and it is here for default theme version -->
<!-- since loading of js module is on demand, it doesn't cause any error as long as you don't try to load it -->
<javascript-module name="idempiere.theme.default" version="202204191045" />
<javascript-module name="idempiere.theme.default" version="202205121159" />
</language>

View File

@ -201,8 +201,11 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
this.setTitle(m_Name);
// Move from APanel.actionButton
if (m_pi == null)
if (m_pi == null) {
m_pi = new WProcessInfo(m_Name, AD_Process_ID);
// Set Replace Tab Content
m_pi.setReplaceTabContent();
}
m_pi.setAD_User_ID (Env.getAD_User_ID(Env.getCtx()));
m_pi.setAD_Client_ID(Env.getAD_Client_ID(Env.getCtx()));
m_pi.setTitle(m_Name);
@ -573,7 +576,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
setReportTypeAndPrintFormat(getLastRun());
}
private MPInstance getLastRun() {
protected MPInstance getLastRun() {
final String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
return new Query(Env.getCtx(), MPInstance.Table_Name, where, null)
.setOnlyActiveRecords(true).setClient_ID()
@ -796,7 +799,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
}
private void loadSavedParams(MPInstance instance) {
protected void loadSavedParams(MPInstance instance) {
getParameterPanel().loadParameters(instance);
setReportTypeAndPrintFormat(instance);
}

View File

@ -312,10 +312,12 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
{
if (mask != null && mask.getParent() != null) {
mask.detach();
StringBuilder script = new StringBuilder("(function(){let w=zk.Widget.$('#");
script.append(getParent().getUuid()).append("');w.busy=false;");
script.append("})()");
Clients.response(new AuScript(script.toString()));
if(getParent() != null) {
StringBuilder script = new StringBuilder("(function(){let w=zk.Widget.$('#");
script.append(getParent().getUuid()).append("');w.busy=false;");
script.append("})()");
Clients.response(new AuScript(script.toString()));
}
}
}

View File

@ -23,6 +23,7 @@ import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MPInstance;
import org.compiere.print.MPrintFormat;
import org.compiere.process.ProcessInfo;
import org.compiere.util.CLogger;
@ -68,6 +69,26 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
this(null, WindowNo, pi, autoStart);
}
/**
* @param listener
* @param WindowNo
* @param pi
*/
public ProcessModalDialog(EventListener<Event> listener, int WindowNo, ProcessInfo pi)
{
this(WindowNo, pi, false);
MPInstance instance = getLastRun();
if(instance != null) {
loadSavedParams(instance);
chooseSaveParameter(fSavedName.getRawText(), true);
}
if (listener != null)
{
addEventListener(ON_WINDOW_CLOSE, listener);
addEventListener(ON_BEFORE_RUN_PROCESS, listener);
}
}
/**
* @param listener
* @param WindowNo

View File

@ -59,6 +59,8 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
public static final String INSERT_END = "insertEnd";
/*** Insert next to the active tab of the tabbed window container ***/
public static final String INSERT_NEXT = "insertNext";
/*** Replace current tab content ***/
public static final String REPLACE = "replace";
public Window()
{

View File

@ -282,6 +282,8 @@ public abstract class TabbedDesktop extends AbstractDesktop {
preOpenNewTab();
if (Window.INSERT_NEXT.equals(window.getAttribute(Window.INSERT_POSITION_KEY)))
windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, title, true, true, null);
else if(Window.REPLACE.equals(window.getAttribute(Window.INSERT_POSITION_KEY)))
windowContainer.replace(windowContainer.getSelectedTab(), window, title);
else
windowContainer.addWindow(tabPanel, title, true, null);
if (window instanceof IHelpContext)

View File

@ -16,6 +16,8 @@ package org.adempiere.webui.part;
import java.util.List;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.adwindow.AbstractADWindowContent;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.component.Menupopup;
import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tab.DecorateInfo;
@ -25,11 +27,13 @@ import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.TabbedDesktop;
import org.adempiere.webui.panel.IHelpContext;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.ZkReportViewer;
import org.compiere.model.MSysConfig;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.Env;
@ -636,6 +640,44 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
return insertBefore((Tab)refTab.getNextSibling(), comp, title, closeable, enable, decorateInfo);
}
/**
* IDEMPIERE-5275 - Tabular Report Re-Run button/close parameter window
* @param refTab
* @param comp
* @param title
* @return
*/
public Tab replace(Tab refTab, Window comp, String title) {
if (refTab == null)
{
throw new IllegalArgumentException();
}
else
{
org.zkoss.zul.Tabpanel refpanel = refTab.getLinkedPanel();
Component firstChild = refpanel.getFirstChild();
if(firstChild instanceof Window) {
if(firstChild instanceof ProcessDialog)
((ProcessDialog)firstChild).unlockUI(null);
else if(firstChild instanceof ZkReportViewer)
((ZkReportViewer)firstChild).hideBusyMask();
else if(firstChild instanceof AbstractADWindowContent)
((AbstractADWindowContent)firstChild).hideBusyMask();
((Window) firstChild).onClose();
comp.setParent(refpanel);
}
else {
firstChild.detach();
comp.setParent(refpanel);
}
}
if (title != null)
{
setTabTitle(title, refTab);
}
return refTab;
}
/**
*
* @param tab

View File

@ -41,6 +41,7 @@ import org.adempiere.webui.Extensions;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.ProcessModalDialog;
import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.apps.form.WReportCustomization;
import org.adempiere.webui.component.Checkbox;
@ -83,6 +84,7 @@ import org.compiere.model.X_AD_ToolBarButton;
import org.compiere.print.ArchiveEngine;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.tools.FileUtil;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -194,6 +196,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
protected Listbox previewType = new Listbox();
private ToolBarButton bRefresh = new ToolBarButton();
private ToolBarButton bReRun = new ToolBarButton();
private Iframe iframe;
private Checkbox summary = new Checkbox();
@ -694,7 +697,30 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
bRefresh.addEventListener(Events.ON_CLICK, this);
if (ThemeManager.isUseFontIconForImage())
LayoutUtils.addSclass("medium-toolbarbutton", bRefresh);
MPrintFormat pf = m_reportEngine.getPrintFormat();
if (pf != null) {
if((!pf.isForm()) && (pf.getAD_ReportView_ID() > 0)) {
bReRun.setName("ReRun");
if (ThemeManager.isUseFontIconForImage())
bReRun.setIconSclass("z-icon-ReRun");
else
bReRun.setImage(ThemeManager.getThemeResource("images/ReRun24.png"));
bReRun.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ReRun")));
if (toolbarPopup != null)
{
toolbarPopupLayout.appendChild(bReRun);
bReRun.setLabel(bReRun.getTooltiptext());
}
else
toolBar.appendChild(bReRun);
bReRun.addEventListener(Events.ON_CLICK, this);
if (ThemeManager.isUseFontIconForImage())
LayoutUtils.addSclass("medium-toolbarbutton", bReRun);
}
}
bWizard.setName("Wizard");
if (ThemeManager.isUseFontIconForImage())
bWizard.setIconSclass("z-icon-Wizard");
@ -1217,6 +1243,11 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
this.onCtrlKeyEvent(keyEvent);
}
}
else if (event.getTarget() instanceof ProcessModalDialog)
{
if(DialogEvents.ON_WINDOW_CLOSE.equals(event.getName()))
hideBusyMask();
}
}
private void cmd_upload() {
@ -1274,6 +1305,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
cmd_Wizard();
else if (e.getTarget() == bRefresh)
cmd_report();
else if (e.getTarget() == bReRun)
cmd_reRun();
//
else if (e.getTarget() == m_ddM)
cmd_window(m_ddQ);
@ -1458,6 +1491,30 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
postRenderReportEvent();
} // cmd_report
/**
* Refresh With Parameters
*/
private void cmd_reRun() {
int AD_Process_ID = m_reportEngine.getPrintInfo() != null ? m_reportEngine.getPrintInfo().getAD_Process_ID() : 0;
if(AD_Process_ID <= 0)
return;
ProcessInfo pi = new ProcessInfo("RefreshWithParameters", AD_Process_ID);
pi.setReplaceTabContent();
ProcessModalDialog processModalDialog = new ProcessModalDialog(this, m_WindowNo, pi);
ZKUpdateUtil.setWindowWidthX(processModalDialog, 850);
this.getParent().appendChild(processModalDialog);
if (ClientInfo.isMobile())
{
processModalDialog.doHighlighted();
}
else
{
showBusyMask(processModalDialog);
LayoutUtils.openOverlappedWindow(this, processModalDialog, "middle_center");
}
processModalDialog.focus();
} // cmd_reRun
protected void setLanguage (){
if (MClient.get(m_ctx).isMultiLingualDocument() && wLanguage.getValue() != null){
MLanguage language = new MLanguage (m_ctx, (int)wLanguage.getValue(), null);
@ -1585,7 +1642,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
});
setupFindwindow(find);
}
getParent().appendChild(find);
getParent().appendChild(find);
LayoutUtils.openHighlightedWindow(toolBar, find, "after_start");
LayoutUtils.sameWidth(find, this);
}
@ -1698,7 +1755,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
} else {
script.append("w.busy=true;");
}
script.append("})()");
script.append("})()");
Clients.response(new AuScript(script.toString()));
}

View File

@ -52,6 +52,9 @@ public class ZkReportViewerProvider implements ReportViewerProvider {
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
if(report.isReplaceTabContent())
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.REPLACE);
viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE);
SessionManager.getAppDesktop().showWindow(viewer);
}

View File

@ -265,6 +265,9 @@
.z-icon-Request:before {
content: "\f046";
}
.z-icon-ReRun:before {
content: "\f144";
}
.z-icon-Reset:before {
content: "\f0e2";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -266,6 +266,7 @@ public class ReportCtl
}
re.setLanguageID(pi.getLanguageID());
re.setWindowNo(WindowNo);
re.setIsReplaceTabContent(pi.isReplaceTabContent());
createOutput(re, pi.isPrintPreview(), null);
return true;
} // startStandardReport