IDEMPIERE-2389:Print format and Report type selection on process dialog
remove duplicate code (IDEMPIERE-1882) remain some issue relate UI
This commit is contained in:
parent
5b56659483
commit
57c729ea5b
|
@ -2428,7 +2428,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
|
||||
if (dialog.isValid()) {
|
||||
dialog.setWidth("500px");
|
||||
//dialog.setWidth("500px");
|
||||
dialog.setBorder("normal");
|
||||
getComponent().getParent().appendChild(dialog);
|
||||
showBusyMask(dialog);
|
||||
|
@ -2936,7 +2936,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
if (dialog.isValid())
|
||||
{
|
||||
dialog.setWidth("500px");
|
||||
//dialog.setWidth("500px");
|
||||
dialog.setBorder("normal");
|
||||
getComponent().getParent().appendChild(dialog);
|
||||
showBusyMask(dialog);
|
||||
|
|
|
@ -29,24 +29,28 @@ import org.adempiere.util.Callback;
|
|||
import org.adempiere.util.ContextRunnable;
|
||||
import org.adempiere.util.IProcessUI;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ComboItem;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
import org.adempiere.webui.process.WProcessInfo;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.adempiere.webui.window.MultiFileDownloadDialog;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLookup;
|
||||
|
@ -54,29 +58,41 @@ import org.compiere.model.MLookupFactory;
|
|||
import org.compiere.model.MLookupInfo;
|
||||
import org.compiere.model.MNote;
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSysConfig;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.MUser;
|
||||
import org.compiere.model.Query;
|
||||
import org.compiere.model.X_AD_ReportView;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.au.out.AuEcho;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Desktop;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hlayout;
|
||||
import org.zkoss.zul.Html;
|
||||
import org.zkoss.zul.Space;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
|
||||
public abstract class AbstractProcessDialog extends Window implements IProcessUI, EventListener<Event>
|
||||
{
|
||||
|
@ -97,7 +113,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
private boolean m_disposeOnComplete;
|
||||
|
||||
private Html message = null;
|
||||
private Panel centerPanel = null;
|
||||
|
||||
private ProcessParameterPanel parameterPanel = null;
|
||||
private Checkbox runAsJobField = null;
|
||||
|
@ -121,10 +136,21 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
{
|
||||
super();
|
||||
message = new Html();
|
||||
centerPanel = new Panel();
|
||||
}
|
||||
|
||||
protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, String innerWidth, boolean autoStart, boolean isDisposeOnComplete)
|
||||
/**
|
||||
* layout as below
|
||||
*
|
||||
* @param ctx
|
||||
* @param WindowNo
|
||||
* @param AD_Process_ID
|
||||
* @param pi
|
||||
* @param innerWidth
|
||||
* @param autoStart
|
||||
* @param isDisposeOnComplete
|
||||
* @return
|
||||
*/
|
||||
protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, boolean autoStart, boolean isDisposeOnComplete)
|
||||
{
|
||||
m_ctx = ctx;
|
||||
m_WindowNo = WindowNo;
|
||||
|
@ -194,11 +220,9 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
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);
|
||||
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi, innerWidth);
|
||||
centerPanel.getChildren().clear();
|
||||
if ( parameterPanel.init() ) {
|
||||
centerPanel.appendChild(parameterPanel);
|
||||
} else {
|
||||
|
||||
parameterPanel = new ProcessParameterPanel(m_WindowNo, m_pi);
|
||||
if ( !parameterPanel.init() ) {
|
||||
if (m_ShowHelp != null && m_ShowHelp.equals("N"))
|
||||
autoStart = true;
|
||||
|
||||
|
@ -216,11 +240,83 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
return true;
|
||||
}
|
||||
|
||||
layout();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected HtmlBasedComponent topParameterLayout;
|
||||
protected HtmlBasedComponent bottomParameterLayout;
|
||||
protected HtmlBasedComponent mainParameterLayout;
|
||||
private WTableDirEditor fPrintFormat;
|
||||
private Listbox freportType;
|
||||
private Checkbox chbIsSummary;
|
||||
protected Button bOK;
|
||||
protected Button bCancel;
|
||||
protected Combobox fSavedName=new Combobox();
|
||||
private Button bSave=ButtonFactory.createNamedButton("Save");
|
||||
private Button bDelete=ButtonFactory.createNamedButton("Delete");
|
||||
private List<MPInstance> savedParams;
|
||||
private Label lSaved;
|
||||
|
||||
protected void layout(){
|
||||
overalLayout();
|
||||
topLayout(topParameterLayout);
|
||||
bottomLayout(bottomParameterLayout);
|
||||
|
||||
}
|
||||
|
||||
protected void overalLayout(){
|
||||
mainParameterLayout = new Div();
|
||||
mainParameterLayout.setSclass("main-parameter-layout");
|
||||
this.appendChild(mainParameterLayout);
|
||||
// header and input component
|
||||
topParameterLayout = new Vlayout();
|
||||
topParameterLayout.setSclass("top-parameter-layout");
|
||||
mainParameterLayout.appendChild(topParameterLayout);
|
||||
topParameterLayout.setVflex("true");
|
||||
// button and advanced control
|
||||
bottomParameterLayout = new Vlayout();
|
||||
bottomParameterLayout.setSclass("bottom-parameter-layout");
|
||||
mainParameterLayout.appendChild(bottomParameterLayout);
|
||||
}
|
||||
|
||||
protected void topLayout(HtmlBasedComponent topParameterLayout) {
|
||||
// message
|
||||
setHeadMessage (topParameterLayout, getMessageText().toString());
|
||||
|
||||
// input component
|
||||
HtmlBasedComponent inputParameterLayout = new Div();
|
||||
inputParameterLayout.setSclass("input-paramenter-layout");
|
||||
topParameterLayout.appendChild(inputParameterLayout);
|
||||
|
||||
// input parameter content
|
||||
inputParameterLayout(inputParameterLayout);
|
||||
}
|
||||
|
||||
protected HtmlBasedComponent setHeadMessage (HtmlBasedComponent parent, String contentMsg){
|
||||
// message
|
||||
HtmlBasedComponent messageParameterLayout = new Vlayout();
|
||||
parent.appendChild(messageParameterLayout);
|
||||
messageParameterLayout.setSclass("message-parameter-layout");
|
||||
|
||||
// header content
|
||||
HtmlBasedComponent messageDiv = new Div();
|
||||
Html content = new Html(contentMsg);
|
||||
messageDiv.appendChild(content);
|
||||
messageDiv.setSclass("message-paramenter");
|
||||
messageParameterLayout.appendChild(messageDiv);
|
||||
|
||||
return messageParameterLayout;
|
||||
}
|
||||
|
||||
protected void inputParameterLayout (HtmlBasedComponent parent) {
|
||||
parent.appendChild(parameterPanel);
|
||||
|
||||
if (MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_ALLOWED, false))
|
||||
{
|
||||
Grid grid = GridFactory.newGridLayout();
|
||||
centerPanel.appendChild(grid);
|
||||
grid.setInnerWidth(innerWidth);
|
||||
parent.appendChild(grid);
|
||||
|
||||
Columns columns = new Columns();
|
||||
grid.appendChild(columns);
|
||||
|
@ -270,8 +366,195 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
runAsJobField.setChecked(MSysConfig.getBooleanValue(MSysConfig.BACKGROUND_JOB_BY_DEFAULT, false));
|
||||
notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
protected void bottomLayout(HtmlBasedComponent bottomParameterLayout) {
|
||||
reportOptionLayout(bottomParameterLayout);
|
||||
|
||||
HtmlBasedComponent bottomContainer = new Div ();
|
||||
bottomContainer.setSclass("bottom-container");
|
||||
bottomParameterLayout.appendChild(bottomContainer);
|
||||
|
||||
MProcess process = MProcess.get(Env.getCtx(), m_AD_Process_ID);
|
||||
int count = process.getParameters().length;
|
||||
if (count > 0)
|
||||
savePrameterLayout (bottomContainer);
|
||||
|
||||
buttonLayout (bottomContainer);
|
||||
}
|
||||
|
||||
protected void reportOptionLayout(HtmlBasedComponent bottomParameterLayout) {
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
boolean isReport = pr.isReport() && pr.getJasperReport() == null;
|
||||
if (!isReport)
|
||||
return;//if not a report not need show this pannel
|
||||
|
||||
// option control
|
||||
HtmlBasedComponent reportOptionLayout = new Hlayout();
|
||||
reportOptionLayout.setSclass("report-option-container");
|
||||
bottomParameterLayout.appendChild(reportOptionLayout);
|
||||
|
||||
freportType = new Listbox();
|
||||
freportType.setSclass("option-input-parameter");
|
||||
chbIsSummary = new Checkbox();
|
||||
chbIsSummary.setSclass("option-input-parameter");
|
||||
Label lPrintFormat = new Label(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
|
||||
lPrintFormat.setSclass("option-input-parameter");
|
||||
Label lreportType = new Label(Msg.translate(Env.getCtx(), "view.report"));
|
||||
lreportType.setSclass("option-input-parameter");
|
||||
Label lIsSummary = new Label(Msg.translate(Env.getCtx(), "Summary"));
|
||||
lIsSummary.setSclass("option-input-parameter");
|
||||
|
||||
listPrintFormat();
|
||||
|
||||
reportOptionLayout.appendChild(lPrintFormat);
|
||||
reportOptionLayout.appendChild(fPrintFormat.getComponent());
|
||||
fPrintFormat.getComponent().setSclass("option-input-parameter");
|
||||
reportOptionLayout.appendChild(lreportType);
|
||||
reportOptionLayout.appendChild(freportType);
|
||||
reportOptionLayout.appendChild(lIsSummary);
|
||||
reportOptionLayout.appendChild(chbIsSummary);
|
||||
}
|
||||
|
||||
protected void savePrameterLayout(HtmlBasedComponent bottomParameterLayout) {
|
||||
HtmlBasedComponent savePrameterLayout = new Div();
|
||||
savePrameterLayout.setSclass("save-parameter-container");
|
||||
bottomParameterLayout.appendChild(savePrameterLayout);
|
||||
|
||||
lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter"));
|
||||
savePrameterLayout.appendChild(lSaved);
|
||||
fSavedName = new Combobox();
|
||||
fSavedName.addEventListener(Events.ON_CHANGE, this);
|
||||
savePrameterLayout.appendChild(fSavedName);
|
||||
|
||||
bSave.setEnabled(false);
|
||||
bSave.addActionListener(this);
|
||||
savePrameterLayout.appendChild(bSave);
|
||||
|
||||
bDelete.setEnabled(false);
|
||||
bDelete.addActionListener(this);
|
||||
savePrameterLayout.appendChild(bDelete);
|
||||
|
||||
querySaved();
|
||||
}
|
||||
|
||||
protected void querySaved()
|
||||
{
|
||||
//user query
|
||||
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"));
|
||||
fSavedName.removeAllItems();
|
||||
for (MPInstance instance : savedParams)
|
||||
{
|
||||
String queries = instance.get_ValueAsString("Name");
|
||||
fSavedName.appendItem(queries);
|
||||
}
|
||||
|
||||
fSavedName.setValue("");
|
||||
}
|
||||
|
||||
protected void buttonLayout (HtmlBasedComponent bottomParameterLayout) {
|
||||
HtmlBasedComponent confParaPanel =new Div();
|
||||
confParaPanel.setSclass("button-container");
|
||||
bottomParameterLayout.appendChild(confParaPanel);
|
||||
|
||||
// Invert - Unify OK/Cancel IDEMPIERE-77
|
||||
bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
|
||||
bOK.setId("Ok");
|
||||
bOK.addEventListener(Events.ON_CLICK, this);
|
||||
confParaPanel.appendChild(bOK);
|
||||
|
||||
bCancel = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL, true, true);
|
||||
bCancel.setId("Cancel");
|
||||
bCancel.addEventListener(Events.ON_CLICK, this);
|
||||
confParaPanel.appendChild(bCancel);
|
||||
|
||||
}
|
||||
|
||||
private void listPrintFormat()
|
||||
{
|
||||
int AD_Column_ID = 0;
|
||||
boolean m_isCanExport = false;
|
||||
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
int table_ID = 0;
|
||||
try
|
||||
{
|
||||
if (pr.getAD_ReportView_ID() > 0)
|
||||
{
|
||||
X_AD_ReportView m_Reportview = new X_AD_ReportView(m_ctx, pr.getAD_ReportView_ID(), null);
|
||||
table_ID = m_Reportview.getAD_Table_ID();
|
||||
}
|
||||
else if (pr.getAD_PrintFormat_ID() > 0)
|
||||
{
|
||||
MPrintFormat format = new MPrintFormat(m_ctx, pr.getAD_PrintFormat_ID(), null);
|
||||
table_ID = format.getAD_Table_ID();
|
||||
}
|
||||
String valCode = null;
|
||||
if (table_ID > 0)
|
||||
{
|
||||
valCode = "AD_PrintFormat.AD_Table_ID=" + table_ID;
|
||||
m_isCanExport = MRole.getDefault().isCanExport(table_ID);
|
||||
}
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), m_WindowNo,
|
||||
AD_Column_ID, DisplayType.TableDir,
|
||||
Env.getLanguage(Env.getCtx()), "AD_PrintFormat_ID", 0, false,
|
||||
valCode);
|
||||
|
||||
fPrintFormat = new WTableDirEditor("AD_PrintFormat_ID", false, false, true, lookup);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
freportType.removeAllItems();
|
||||
freportType.setMold("select");
|
||||
freportType.appendItem("HTML", "HTML");
|
||||
|
||||
if (m_isCanExport)
|
||||
{
|
||||
freportType.appendItem("PDF", "PDF");
|
||||
freportType.appendItem("Excel", "XLS");
|
||||
}
|
||||
freportType.setSelectedIndex(0);
|
||||
|
||||
String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
|
||||
|
||||
MPInstance lastrun = MTable.get(Env.getCtx(), MPInstance.Table_Name).createQuery(where, null).setOnlyActiveRecords(true).setClient_ID()
|
||||
.setParameters(m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), "#AD_User_ID")).setOrderBy("Created DESC").first();
|
||||
|
||||
setReportTypeAndPrintFormat(lastrun);
|
||||
}
|
||||
|
||||
private void setReportTypeAndPrintFormat(MPInstance instance)
|
||||
{
|
||||
if (fPrintFormat != null && instance != null) {
|
||||
fPrintFormat.setValue((Integer) instance.getAD_PrintFormat_ID());
|
||||
}
|
||||
|
||||
if (freportType != null && instance != null) {
|
||||
if (instance.getReportType() == null)
|
||||
freportType.setValue("HTML");
|
||||
else
|
||||
freportType.setValue(instance.getReportType());
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
chbIsSummary.setSelected(instance.getIsSummary());
|
||||
}
|
||||
|
||||
protected void saveReportOption (){
|
||||
if(freportType.getSelectedItem() != null) {
|
||||
getProcessInfo().setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
}
|
||||
if(fPrintFormat != null && fPrintFormat.getValue() != null) {
|
||||
MPrintFormat format = new MPrintFormat(m_ctx, (Integer) fPrintFormat.getValue(), null);
|
||||
if (format != null) {
|
||||
getProcessInfo().setSerializableObject(format);
|
||||
}
|
||||
}
|
||||
|
||||
getProcessInfo().setIsSummary(chbIsSummary.isChecked());
|
||||
}
|
||||
|
||||
protected void autoStart()
|
||||
|
@ -285,12 +568,121 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
if (component == runAsJobField && event.getName().equals(Events.ON_CHECK))
|
||||
{
|
||||
notificationTypeField.getComponent().getParent().setVisible(runAsJobField.isChecked());
|
||||
centerPanel.invalidate();
|
||||
|
||||
}
|
||||
else if (event.getName().equals(ON_COMPLETE))
|
||||
onComplete();
|
||||
else if (event.getName().equals(ON_STATUS_UPDATE))
|
||||
onStatusUpdate(event);
|
||||
else if (event.getTarget().equals(bSave) || event.getTarget().equals(bDelete) || event.getTarget().equals(fSavedName)){
|
||||
String saveName = null;
|
||||
boolean lastRun = false;
|
||||
if (fSavedName.getRawText() != null) {
|
||||
saveName = fSavedName.getRawText();
|
||||
lastRun = ("** " + Msg.getMsg(Env.getCtx(), "LastRun") + " **")
|
||||
.equals(saveName);
|
||||
}
|
||||
if (bSave.equals(event.getTarget()))
|
||||
updateSaveParameter(saveName);
|
||||
else if (bDelete.equals(event.getTarget()))
|
||||
deleteSaveParameter(saveName);
|
||||
else
|
||||
chooseSaveParameter(saveName, lastRun);
|
||||
}else if (event.getTarget().equals(bOK)){
|
||||
saveReportOption();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateSaveParameter(String saveName) {
|
||||
// Update existing
|
||||
if (fSavedName.getSelectedIndex() > -1 && savedParams != null) {
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(saveName)) {
|
||||
getProcessInfo().setAD_PInstance_ID(savedParams.get(i)
|
||||
.getAD_PInstance_ID());
|
||||
for (MPInstancePara para : savedParams.get(i)
|
||||
.getParameters()) {
|
||||
para.deleteEx(true);
|
||||
}
|
||||
getParameterPanel().saveParameters();
|
||||
savedParams.get(i).setAD_PrintFormat_ID((Integer)fPrintFormat.getValue());
|
||||
savedParams.get(i).setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
savedParams.get(i).setIsSummary(chbIsSummary.isSelected());
|
||||
savedParams.get(i).saveEx();
|
||||
}
|
||||
}
|
||||
}
|
||||
// create new
|
||||
else {
|
||||
MPInstance instance = null;
|
||||
try {
|
||||
instance = new MPInstance(Env.getCtx(),
|
||||
getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID());
|
||||
instance.setName(saveName);
|
||||
instance.setAD_PrintFormat_ID((Integer) fPrintFormat.getValue());
|
||||
instance.setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
instance.setIsSummary(chbIsSummary.isSelected());
|
||||
instance.saveEx();
|
||||
getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID());
|
||||
// Get Parameters
|
||||
if (getParameterPanel() != null) {
|
||||
if (!getParameterPanel().saveParameters()) {
|
||||
throw new AdempiereSystemError(Msg.getMsg(
|
||||
Env.getCtx(), "SaveParameterError"));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
|
||||
}
|
||||
}
|
||||
querySaved();
|
||||
fSavedName.setSelectedItem(getComboItem(saveName));
|
||||
}
|
||||
|
||||
public Comboitem getComboItem( String value) {
|
||||
Comboitem item = null;
|
||||
for (int i = 0; i < fSavedName.getItems().size(); i++) {
|
||||
if (fSavedName.getItems().get(i) != null) {
|
||||
item = (Comboitem)fSavedName.getItems().get(i);
|
||||
if (value.equals(item.getLabel().toString())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
protected void deleteSaveParameter(String saveName) {
|
||||
Object o = fSavedName.getSelectedItem();
|
||||
if (savedParams != null && o != null) {
|
||||
String selected = fSavedName.getSelectedItem().getLabel();
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(selected)) {
|
||||
savedParams.get(i).deleteEx(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
querySaved();
|
||||
}
|
||||
|
||||
protected void chooseSaveParameter(String saveName, boolean lastRun) {
|
||||
if (savedParams != null && saveName != null) {
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(saveName)) {
|
||||
loadSavedParams(savedParams.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean enabled = !Util.isEmpty(saveName);
|
||||
bSave.setEnabled(enabled && !lastRun);
|
||||
bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1
|
||||
&& !lastRun);
|
||||
|
||||
}
|
||||
|
||||
private void loadSavedParams(MPInstance instance) {
|
||||
getParameterPanel().loadParameters(instance);
|
||||
setReportTypeAndPrintFormat(instance);
|
||||
}
|
||||
|
||||
protected void startProcess()
|
||||
|
@ -560,11 +952,6 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
return message;
|
||||
}
|
||||
|
||||
public Panel getCenterPanel()
|
||||
{
|
||||
return centerPanel;
|
||||
}
|
||||
|
||||
public ProcessParameterPanel getParameterPanel()
|
||||
{
|
||||
return parameterPanel;
|
||||
|
|
|
@ -23,27 +23,14 @@ import java.io.FileOutputStream;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Combobox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.DocumentLink;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Mask;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.desktop.IDesktop;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
import org.adempiere.webui.panel.IHelpContext;
|
||||
import org.adempiere.webui.part.WindowContainer;
|
||||
import org.adempiere.webui.process.WProcessInfo;
|
||||
|
@ -51,26 +38,15 @@ import org.adempiere.webui.session.SessionManager;
|
|||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.adempiere.webui.window.SimplePDFViewer;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.X_AD_CtxHelp;
|
||||
import org.compiere.model.X_AD_ReportView;
|
||||
import org.compiere.print.MPrintFormat;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoLog;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.util.AdempiereSystemError;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zhtml.Table;
|
||||
import org.zkoss.zhtml.Td;
|
||||
import org.zkoss.zhtml.Text;
|
||||
|
@ -83,14 +59,8 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.A;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.North;
|
||||
import org.zkoss.zul.South;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.pdf.PdfContentByte;
|
||||
|
@ -117,27 +87,16 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
|
||||
public static final String ON_INITIAL_FOCUS_EVENT = "onInitialFocus";
|
||||
|
||||
private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto; margin: 10px;";
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(ProcessDialog.class);
|
||||
//
|
||||
|
||||
private Div messageDiv;
|
||||
private Center center;
|
||||
private Table logMessageTable;
|
||||
private North north;
|
||||
|
||||
private int[] m_ids = null;
|
||||
private Button bOK = null;
|
||||
|
||||
private boolean isParameterPage = true;
|
||||
private Mask mask;
|
||||
|
||||
private boolean showLastRun = false;
|
||||
|
||||
private Grid southRowPanel = GridFactory.newGridLayout();
|
||||
|
||||
/**
|
||||
* Dialog to start a process/report
|
||||
* @param ctx
|
||||
|
@ -156,17 +115,10 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
int WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||
this.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, WindowNo);
|
||||
Env.setContext(Env.getCtx(), WindowNo, "IsSOTrx", isSOTrx ? "Y" : "N");
|
||||
m_ctx = Env.getCtx();
|
||||
m_AD_Process_ID = AD_Process_ID;
|
||||
|
||||
try
|
||||
{
|
||||
MProcess process = MProcess.get(Env.getCtx(), AD_Process_ID);
|
||||
int count = process.getParameters().length;
|
||||
if (count > 0)
|
||||
showLastRun = true;
|
||||
|
||||
initComponents();
|
||||
init(Env.getCtx(), WindowNo, AD_Process_ID, null, "70%", false, false);
|
||||
init(Env.getCtx(), WindowNo, AD_Process_ID, null, false, false);
|
||||
querySaved();
|
||||
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
|
||||
addEventListener(ON_INITIAL_FOCUS_EVENT, this);
|
||||
|
@ -177,202 +129,6 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
}
|
||||
} // ProcessDialog
|
||||
|
||||
private void listPrintFormat()
|
||||
{
|
||||
int AD_Column_ID = 0;
|
||||
boolean m_isCanExport = false;
|
||||
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
int table_ID = 0;
|
||||
try
|
||||
{
|
||||
if (pr.getAD_ReportView_ID() > 0)
|
||||
{
|
||||
X_AD_ReportView m_Reportview = new X_AD_ReportView(m_ctx, pr.getAD_ReportView_ID(), null);
|
||||
table_ID = m_Reportview.getAD_Table_ID();
|
||||
}
|
||||
else if (pr.getAD_PrintFormat_ID() > 0)
|
||||
{
|
||||
MPrintFormat format = new MPrintFormat(m_ctx, pr.getAD_PrintFormat_ID(), null);
|
||||
table_ID = format.getAD_Table_ID();
|
||||
}
|
||||
String valCode = null;
|
||||
if (table_ID > 0)
|
||||
{
|
||||
valCode = "AD_PrintFormat.AD_Table_ID=" + table_ID;
|
||||
m_isCanExport = MRole.getDefault().isCanExport(table_ID);
|
||||
}
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), m_WindowNo,
|
||||
AD_Column_ID, DisplayType.TableDir,
|
||||
Env.getLanguage(Env.getCtx()), "AD_PrintFormat_ID", 0, false,
|
||||
valCode);
|
||||
|
||||
fPrintFormat = new WTableDirEditor("AD_PrintFormat_ID", false, false, true, lookup);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
freportType.removeAllItems();
|
||||
freportType.setMold("select");
|
||||
freportType.appendItem("HTML", "HTML");
|
||||
|
||||
if (m_isCanExport)
|
||||
{
|
||||
freportType.appendItem("PDF", "PDF");
|
||||
freportType.appendItem("Excel", "XLS");
|
||||
}
|
||||
freportType.setSelectedIndex(0);
|
||||
|
||||
String where = "AD_Process_ID = ? AND AD_User_ID = ? AND Name IS NULL ";
|
||||
|
||||
MPInstance lastrun = MTable.get(Env.getCtx(), MPInstance.Table_Name).createQuery(where, null).setOnlyActiveRecords(true).setClient_ID()
|
||||
.setParameters(m_AD_Process_ID, Env.getContextAsInt(Env.getCtx(), "#AD_User_ID")).setOrderBy("Created DESC").first();
|
||||
|
||||
setReportTypeAndPrintFormat(lastrun);
|
||||
}
|
||||
|
||||
private void querySaved()
|
||||
{
|
||||
//user query
|
||||
savedParams = MPInstance.get(Env.getCtx(), getAD_Process_ID(), Env.getContextAsInt(Env.getCtx(), "#AD_User_ID"));
|
||||
fSavedName.removeAllItems();
|
||||
for (MPInstance instance : savedParams)
|
||||
{
|
||||
String queries = instance.get_ValueAsString("Name");
|
||||
fSavedName.appendItem(queries);
|
||||
}
|
||||
|
||||
fSavedName.setValue("");
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.setStyle("position: absolute; width: 100%; height: 100%");
|
||||
Borderlayout layout = new Borderlayout();
|
||||
layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;");
|
||||
messageDiv = new Div();
|
||||
messageDiv.appendChild(getMessage());
|
||||
messageDiv.setStyle(MESSAGE_DIV_STYLE);
|
||||
messageDiv.setId("message");
|
||||
|
||||
north = new North();
|
||||
north.appendChild(messageDiv);
|
||||
layout.appendChild(north);
|
||||
north.setAutoscroll(true);
|
||||
north.setStyle("border: none;");
|
||||
|
||||
center = new Center();
|
||||
layout.appendChild(center);
|
||||
center.appendChild(getCenterPanel());
|
||||
getCenterPanel().setHflex("1");
|
||||
getCenterPanel().setVflex("1");
|
||||
center.setAutoscroll(true);
|
||||
center.setStyle("border: none");
|
||||
|
||||
Rows rows = southRowPanel.newRows();
|
||||
rows.getParent().getId();
|
||||
Row row1 = rows.newRow();
|
||||
Row row = rows.newRow();
|
||||
|
||||
Hbox hBox = new Hbox();
|
||||
Hbox hBox1 = new Hbox();
|
||||
|
||||
lSaved = new Label(Msg.getMsg(Env.getCtx(), "SavedParameter"));
|
||||
hBox1.appendChild(lSaved);
|
||||
fSavedName.addEventListener(Events.ON_CHANGE, this);
|
||||
hBox.appendChild(fSavedName);
|
||||
|
||||
bSave.setEnabled(false);
|
||||
bSave.addActionListener(this);
|
||||
hBox.appendChild(bSave);
|
||||
|
||||
bDelete.setEnabled(false);
|
||||
bDelete.addActionListener(this);
|
||||
hBox.appendChild(bDelete);
|
||||
|
||||
hBox.setStyle("margin-right:30px;");
|
||||
hBox1.setStyle("margin-right:30px;");
|
||||
row1.appendChild(hBox1);
|
||||
row.appendChild(hBox);
|
||||
|
||||
// Print format on report para
|
||||
MProcess pr = new MProcess(m_ctx, m_AD_Process_ID, null);
|
||||
if (pr.isReport() && pr.getJasperReport() == null)
|
||||
{
|
||||
listPrintFormat();
|
||||
|
||||
hBox = new Hbox();
|
||||
hBox1 = new Hbox();
|
||||
hBox1.appendChild(lPrintFormat);
|
||||
hBox.appendChild(fPrintFormat.getComponent());
|
||||
row1.appendChild(hBox1);
|
||||
row.appendChild(hBox);
|
||||
|
||||
hBox = new Hbox();
|
||||
hBox1 = new Hbox();
|
||||
hBox1.appendChild(lreportType);
|
||||
hBox.appendChild(freportType);
|
||||
row1.appendChild(hBox1);
|
||||
row.appendChild(hBox);
|
||||
|
||||
hBox = new Hbox();
|
||||
hBox1 = new Hbox();
|
||||
hBox1.appendChild(lIsSummary);
|
||||
hBox.appendChild(chbIsSummary);
|
||||
row1.appendChild(hBox1);
|
||||
row.appendChild(hBox);
|
||||
}
|
||||
|
||||
if(!showLastRun)
|
||||
{
|
||||
hBox.setVisible(false);
|
||||
hBox1.setVisible(false);
|
||||
}
|
||||
|
||||
Panel confParaPanel =new Panel();
|
||||
confParaPanel.setStyle("float:right");
|
||||
// Invert - Unify OK/Cancel IDEMPIERE-77
|
||||
bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK, true, true);
|
||||
bOK.setId("Ok");
|
||||
bOK.setWidth("50%");
|
||||
bOK.addEventListener(Events.ON_CLICK, this);
|
||||
confParaPanel.appendChild(bOK);
|
||||
|
||||
bCancel = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL, true, true);
|
||||
bCancel.setId("Cancel");
|
||||
bCancel.setWidth("50%");
|
||||
bCancel.addEventListener(Events.ON_CLICK, this);
|
||||
confParaPanel.appendChild(bCancel);
|
||||
row.appendChild(confParaPanel);
|
||||
|
||||
South south = new South();
|
||||
south.setSclass("dialog-footer");
|
||||
layout.appendChild(south);
|
||||
south.appendChild(southRowPanel);
|
||||
this.appendChild(layout);
|
||||
}
|
||||
|
||||
private Button bCancel = null;
|
||||
|
||||
//saved parameters
|
||||
private Combobox fSavedName=new Combobox();
|
||||
private Button bSave=ButtonFactory.createNamedButton("Save");
|
||||
private Button bDelete=ButtonFactory.createNamedButton("Delete");
|
||||
private List<MPInstance> savedParams;
|
||||
private Label lSaved;
|
||||
|
||||
private Properties m_ctx;
|
||||
private int m_AD_Process_ID;
|
||||
|
||||
// Print Format and View Report
|
||||
private WTableDirEditor fPrintFormat = null;
|
||||
private Listbox freportType = new Listbox();
|
||||
private Label lPrintFormat = new Label(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID"));
|
||||
private Label lreportType = new Label(Msg.translate(Env.getCtx(), "view.report"));
|
||||
private Label lIsSummary = new Label(Msg.translate(Env.getCtx(), "Summary"));
|
||||
private Checkbox chbIsSummary = new Checkbox();
|
||||
|
||||
/**
|
||||
* Set Visible
|
||||
* (set focus to OK if visible)
|
||||
|
@ -395,112 +151,19 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
public void onEvent(Event event) {
|
||||
Component component = event.getTarget();
|
||||
|
||||
String saveName = null;
|
||||
boolean lastRun = false;
|
||||
if (fSavedName.getRawText() != null) {
|
||||
saveName = fSavedName.getRawText();
|
||||
lastRun = ("** " + Msg.getMsg(Env.getCtx(), "LastRun") + " **")
|
||||
.equals(saveName);
|
||||
}
|
||||
if(component instanceof A && event.getName().equals((Events.ON_CLICK))){
|
||||
doOnClick((A)component);
|
||||
} else if (component instanceof Button) {
|
||||
Button element = (Button)component;
|
||||
if ("Ok".equalsIgnoreCase(element.getId())) {
|
||||
if(freportType.getSelectedItem() != null) {
|
||||
getProcessInfo().setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
}
|
||||
if(fPrintFormat != null && fPrintFormat.getValue() != null) {
|
||||
MPrintFormat format = new MPrintFormat(m_ctx, (Integer) fPrintFormat.getValue(), null);
|
||||
if (format != null) {
|
||||
getProcessInfo().setSerializableObject(format);
|
||||
}
|
||||
}
|
||||
} else if (bOK.equals(component)) {
|
||||
super.onEvent(event);
|
||||
|
||||
getProcessInfo().setIsSummary(chbIsSummary.isChecked());
|
||||
|
||||
if (isParameterPage)
|
||||
startProcess();
|
||||
else
|
||||
restart();
|
||||
} else if ("Cancel".equalsIgnoreCase(element.getId())) {
|
||||
cancelProcess();
|
||||
|
||||
} else if (event.getTarget().equals(bSave) && fSavedName != null
|
||||
&& !lastRun) {
|
||||
|
||||
// Update existing
|
||||
if (fSavedName.getSelectedIndex() > -1 && savedParams != null) {
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(saveName)) {
|
||||
getProcessInfo().setAD_PInstance_ID(savedParams.get(i)
|
||||
.getAD_PInstance_ID());
|
||||
for (MPInstancePara para : savedParams.get(i)
|
||||
.getParameters()) {
|
||||
para.deleteEx(true);
|
||||
}
|
||||
getParameterPanel().saveParameters();
|
||||
savedParams.get(i).setAD_PrintFormat_ID((Integer)fPrintFormat.getValue());
|
||||
savedParams.get(i).setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
savedParams.get(i).setIsSummary(chbIsSummary.isSelected());
|
||||
savedParams.get(i).saveEx();
|
||||
}
|
||||
}
|
||||
}
|
||||
// create new
|
||||
else {
|
||||
MPInstance instance = null;
|
||||
try {
|
||||
instance = new MPInstance(Env.getCtx(),
|
||||
getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID());
|
||||
instance.setName(saveName);
|
||||
instance.setAD_PrintFormat_ID((Integer) fPrintFormat.getValue());
|
||||
instance.setReportType(freportType.getSelectedItem().getValue().toString());
|
||||
instance.setIsSummary(chbIsSummary.isSelected());
|
||||
instance.saveEx();
|
||||
getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID());
|
||||
// Get Parameters
|
||||
if (getParameterPanel() != null) {
|
||||
if (!getParameterPanel().saveParameters()) {
|
||||
throw new AdempiereSystemError(Msg.getMsg(
|
||||
Env.getCtx(), "SaveParameterError"));
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
|
||||
}
|
||||
}
|
||||
querySaved();
|
||||
fSavedName.setSelectedItem(getComboItem(saveName));
|
||||
}
|
||||
|
||||
else if (event.getTarget().equals(bDelete) && fSavedName != null
|
||||
&& !lastRun) {
|
||||
Object o = fSavedName.getSelectedItem();
|
||||
if (savedParams != null && o != null) {
|
||||
String selected = fSavedName.getSelectedItem().getLabel();
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(selected)) {
|
||||
savedParams.get(i).deleteEx(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
querySaved();
|
||||
}
|
||||
if (isParameterPage)
|
||||
startProcess();
|
||||
else
|
||||
restart();
|
||||
}else if (bCancel.equals(component)){
|
||||
cancelProcess();
|
||||
} else if (event.getName().equals(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT)) {
|
||||
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Process, getAD_Process_ID());
|
||||
} else if (event.getTarget().equals(fSavedName)) {
|
||||
if (savedParams != null && saveName != null) {
|
||||
for (int i = 0; i < savedParams.size(); i++) {
|
||||
if (savedParams.get(i).getName().equals(saveName)) {
|
||||
loadSavedParams(savedParams.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean enabled = !Util.isEmpty(saveName);
|
||||
bSave.setEnabled(enabled && !lastRun);
|
||||
bDelete.setEnabled(enabled && fSavedName.getSelectedIndex() > -1
|
||||
&& !lastRun);
|
||||
} else if (event.getName().equals(ON_INITIAL_FOCUS_EVENT)) {
|
||||
if (!isUILocked())
|
||||
{
|
||||
|
@ -514,41 +177,6 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
}
|
||||
}
|
||||
|
||||
public Comboitem getComboItem( String value) {
|
||||
Comboitem item = null;
|
||||
for (int i = 0; i < fSavedName.getItems().size(); i++) {
|
||||
if (fSavedName.getItems().get(i) != null) {
|
||||
item = (Comboitem)fSavedName.getItems().get(i);
|
||||
if (value.equals(item.getLabel().toString())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private void setReportTypeAndPrintFormat(MPInstance instance)
|
||||
{
|
||||
if (fPrintFormat != null && instance != null) {
|
||||
fPrintFormat.setValue((Integer) instance.getAD_PrintFormat_ID());
|
||||
}
|
||||
|
||||
if (freportType != null && instance != null) {
|
||||
if (instance.getReportType() == null)
|
||||
freportType.setValue("HTML");
|
||||
else
|
||||
freportType.setValue(instance.getReportType());
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
chbIsSummary.setSelected(instance.getIsSummary());
|
||||
}
|
||||
|
||||
private void loadSavedParams(MPInstance instance) {
|
||||
getParameterPanel().loadParameters(instance);
|
||||
setReportTypeAndPrintFormat(instance);
|
||||
}
|
||||
|
||||
private void doOnClick(A btn) {
|
||||
int Record_ID = 0;
|
||||
int AD_Table_ID =0;
|
||||
|
@ -623,18 +251,16 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
|
||||
bOK.setLabel(Msg.getMsg(Env.getCtx(), "Parameter"));
|
||||
bOK.setImage(ThemeManager.getThemeResource("images/Reset16.png"));
|
||||
|
||||
bCancel.setLabel(Msg.getMsg(Env.getCtx(), "Close"));
|
||||
bCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
|
||||
isParameterPage = false;
|
||||
|
||||
m_ids = pi.getIDs();
|
||||
|
||||
//move message div to center to give more space to display potentially very long log info
|
||||
getCenterPanel().detach();
|
||||
messageDiv.detach();
|
||||
messageDiv.setStyle("");
|
||||
north.setVisible(false);
|
||||
center.appendChild(messageDiv);
|
||||
messageDiv.setVflex("1");
|
||||
messageDiv.setHflex("1");
|
||||
topParameterLayout.detach();
|
||||
//TODO:hieplq show result
|
||||
invalidate();
|
||||
|
||||
Clients.response(new AuEcho(this, "onAfterProcess", null));
|
||||
|
@ -713,22 +339,17 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene
|
|||
tr.appendChild(td);
|
||||
}
|
||||
}
|
||||
messageDiv.appendChild(logMessageTable);
|
||||
//messageDiv.appendChild(logMessageTable);
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
setMessageText(new StringBuffer(getInitialMessage()));
|
||||
getMessage().setContent(getInitialMessage());
|
||||
|
||||
north.setVisible(true);
|
||||
messageDiv.detach();
|
||||
if(logMessageTable!=null){
|
||||
messageDiv.removeChild(logMessageTable);
|
||||
//messageDiv.removeChild(logMessageTable);
|
||||
}
|
||||
messageDiv.setStyle(MESSAGE_DIV_STYLE);
|
||||
north.appendChild(messageDiv);
|
||||
|
||||
center.appendChild(getCenterPanel());
|
||||
//messageDiv.setStyle(MESSAGE_DIV_STYLE);
|
||||
|
||||
isParameterPage = true;
|
||||
|
||||
|
|
|
@ -20,10 +20,8 @@ import java.util.logging.Level;
|
|||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.factory.ButtonFactory;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -31,11 +29,6 @@ import org.compiere.util.Env;
|
|||
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.Div;
|
||||
import org.zkoss.zul.Hlayout;
|
||||
import org.zkoss.zul.Layout;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -89,8 +82,9 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
|
|||
log.info("Process=" + pi.getAD_Process_ID());
|
||||
try
|
||||
{
|
||||
initComponents();
|
||||
init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, "100%", autoStart, true);
|
||||
init(Env.getCtx(), WindowNo, pi.getAD_Process_ID(), pi, autoStart, true);
|
||||
mainParameterLayout.setStyle("max-height:" + (SessionManager.getAppDesktop().getClientInfo().desktopHeight - 150) + "px");
|
||||
this.setSclass("popup-dialog");
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
@ -135,50 +129,6 @@ public class ProcessModalDialog extends AbstractProcessDialog implements EventLi
|
|||
this(WindowNo, AD_Process_ID, tableId, recordId, autoStart);
|
||||
} // ProcessDialog
|
||||
|
||||
private void initComponents() {
|
||||
this.setBorder("normal");
|
||||
Layout dialogBody = new Vlayout();
|
||||
dialogBody.setHflex("1");
|
||||
dialogBody.setStyle(dialogBody.getStyle() + ";max-height:" + (SessionManager.getAppDesktop().getClientInfo().desktopHeight - 100) + "px");
|
||||
|
||||
|
||||
Vlayout dialogContent = new Vlayout();
|
||||
dialogContent.setHflex("1");
|
||||
dialogContent.setVflex("1");
|
||||
dialogContent.setSclass("dialog-content");
|
||||
dialogContent.setStyle("overflow-y: auto;");
|
||||
dialogBody.appendChild(dialogContent);
|
||||
// description
|
||||
Div div = new Div();
|
||||
div.setId("message");
|
||||
div.appendChild(getMessage());
|
||||
div.setStyle("max-height: 150pt; overflow: auto;");
|
||||
dialogContent.appendChild(div);
|
||||
|
||||
dialogContent.appendChild(getCenterPanel());
|
||||
// button panel
|
||||
Layout hbox = new Hlayout();
|
||||
hbox.setStyle("bottom:0;text-align:right");
|
||||
dialogBody.appendChild(hbox);
|
||||
hbox.setWidth("100%");
|
||||
hbox.setSclass("dialog-footer");
|
||||
|
||||
Button btn = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
|
||||
btn.setId("Ok");
|
||||
btn.addEventListener(Events.ON_CLICK, this);
|
||||
hbox.appendChild(btn);
|
||||
|
||||
btn = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL);
|
||||
btn.setId("Cancel");
|
||||
btn.addEventListener(Events.ON_CLICK, this);
|
||||
hbox.appendChild(btn);
|
||||
dialogBody.appendChild(hbox);
|
||||
this.appendChild(dialogBody);
|
||||
|
||||
this.setSclass("popup-dialog");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Visible
|
||||
* (set focus to OK if visible)
|
||||
|
|
|
@ -79,8 +79,6 @@ public class ProcessParameterPanel extends Panel implements
|
|||
*/
|
||||
private static final long serialVersionUID = -5730428618898681676L;
|
||||
|
||||
private String width;
|
||||
|
||||
/**
|
||||
* Dynamic generated Parameter panel.
|
||||
*
|
||||
|
@ -90,23 +88,10 @@ public class ProcessParameterPanel extends Panel implements
|
|||
* process info
|
||||
*/
|
||||
public ProcessParameterPanel(int WindowNo, ProcessInfo pi) {
|
||||
this(WindowNo, pi, "100%");
|
||||
} // ProcessParameterPanel
|
||||
|
||||
/**
|
||||
* Dynamic generated Parameter panel.
|
||||
*
|
||||
* @param WindowNo
|
||||
* window
|
||||
* @param pi
|
||||
* process info
|
||||
*/
|
||||
public ProcessParameterPanel(int WindowNo, ProcessInfo pi, String width) {
|
||||
//
|
||||
m_WindowNo = WindowNo;
|
||||
m_processInfo = pi;
|
||||
m_AD_Window_ID = AEnv.getADWindowID (WindowNo);
|
||||
this.width = width;
|
||||
this.m_InfoWindowID = pi.getAD_InfoWindow_ID();
|
||||
//
|
||||
initComponent();
|
||||
|
@ -115,7 +100,6 @@ public class ProcessParameterPanel extends Panel implements
|
|||
|
||||
private void initComponent() {
|
||||
centerPanel = GridFactory.newGridLayout();
|
||||
centerPanel.setInnerWidth(width);
|
||||
this.appendChild(centerPanel);
|
||||
|
||||
// setup columns
|
||||
|
|
|
@ -96,7 +96,7 @@ public class WProcessCtl extends AbstractProcessCtl {
|
|||
ProcessModalDialog para = new ProcessModalDialog(listener, WindowNo, pi, false);
|
||||
if (para.isValid())
|
||||
{
|
||||
para.setWidth("500px");
|
||||
//para.setWidth("500px");
|
||||
para.setVisible(true);
|
||||
para.setPosition("center");
|
||||
para.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||
|
|
|
@ -428,7 +428,7 @@ public class WPaySelect extends PaySelect
|
|||
AD_Proces_ID, X_C_PaySelection.Table_ID, m_ps.getC_PaySelection_ID(), false);
|
||||
if (dialog.isValid()) {
|
||||
try {
|
||||
dialog.setWidth("500px");
|
||||
//dialog.setWidth("500px");
|
||||
dialog.setVisible(true);
|
||||
dialog.setPage(form.getPage());
|
||||
dialog.doHighlighted();
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/* .z-window.z-window-noborder.z-window-noheader.z-window-embedded
|
||||
.z-window.z-window-noborder.z-window-noheader.z-window-embedded .z-window-content
|
||||
twwo css make height of window always 100% its parent,
|
||||
it fix some issue relate resize, but can make side effect
|
||||
when detect side effect, fix to only apply for parameter window*/
|
||||
.z-window.z-window-noborder.z-window-noheader.z-window-embedded,
|
||||
.z-window.z-window-noborder.z-window-noheader.z-window-embedded .z-window-content,
|
||||
.main-parameter-layout{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main-parameter-layout,
|
||||
.top-parameter-layout,
|
||||
.bottom-parameter-layout,
|
||||
.message-parameter-layout,
|
||||
.input-paramenter-layout,
|
||||
.option-paramenter-layout,
|
||||
.report-option-container,
|
||||
.bottom-container{
|
||||
width: 100%;
|
||||
}
|
||||
.top-parameter-layout{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.bottom-parameter-layout{
|
||||
|
||||
}
|
||||
|
||||
.message-paramenter{
|
||||
max-height: 150pt;
|
||||
overflow: hidden;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.option-input-parameter{
|
||||
|
||||
}
|
||||
|
||||
.bottom-container{
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.button-container{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.save-parameter-container{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.popup-dialog.z-window.z-window-overlapped.z-window-shadow,
|
||||
.popup-dialog.z-window.z-window-noborder.z-window-highlighted.z-window-shadow{
|
||||
width:600px;
|
||||
}
|
||||
|
||||
.input-paramenter-layout{
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.popup-dialog .input-paramenter-layout{
|
||||
width: 90%;
|
||||
}
|
|
@ -81,3 +81,5 @@ table.z-vbox > tbody > tr > td > table {
|
|||
<c:include page="fragment/help-window.css.dsp" />
|
||||
|
||||
<c:include page="fragment/borderlayout.css.dsp" />
|
||||
|
||||
<c:include page="fragment/parameter-process.css.dsp" />
|
||||
|
|
Loading…
Reference in New Issue