IDEMPIERE-379 Reporting wizard for end users

This commit is contained in:
Juan David Arboleda 2012-11-28 01:14:41 -05:00
parent 04e7d33c47
commit be0e5134f8
2 changed files with 46 additions and 49 deletions

View File

@ -93,8 +93,6 @@ public class WReportCustomization implements IFormController,EventListener<Even
private Label pipeSeparator; private Label pipeSeparator;
private ToolBarButton bExport = new ToolBarButton(); private ToolBarButton bExport = new ToolBarButton();
private Button bnext ; private Button bnext ;
private Button bcancel;
private Button bRun;
private ToolBarButton btnSave; private ToolBarButton btnSave;
private Tabbox tabbox = new Tabbox(); private Tabbox tabbox = new Tabbox();
private Tabs tabs = new Tabs(); private Tabs tabs = new Tabs();
@ -102,6 +100,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
private Window winExportFile = null; private Window winExportFile = null;
private Listbox cboType = new Listbox(); private Listbox cboType = new Listbox();
private ConfirmPanel confirmPanel = new ConfirmPanel(true); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private ConfirmPanel confirmPanelMain = new ConfirmPanel(true);
public boolean isChange=false; public boolean isChange=false;
public ZkReportViewer viewer; public ZkReportViewer viewer;
MPrintFormat fm; MPrintFormat fm;
@ -179,7 +178,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
headerPanel.appendChild(newPrintFormat); headerPanel.appendChild(newPrintFormat);
Separator tor =new Separator("vertical"); Separator tor =new Separator("vertical");
tor.setSpacing("500px"); tor.setSpacing("23%");
headerPanel.appendChild(tor); headerPanel.appendChild(tor);
selectAll = new Label(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "SelectAll"))); selectAll = new Label(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "SelectAll")));
@ -195,7 +194,6 @@ public class WReportCustomization implements IFormController,EventListener<Even
headerPanel.appendChild(pipeSeparator); headerPanel.appendChild(pipeSeparator);
headerPanel.appendChild(new Separator("vertical")); headerPanel.appendChild(new Separator("vertical"));
headerPanel.appendChild(deselectAll); headerPanel.appendChild(deselectAll);
headerPanel.appendChild(new Separator("vertical")); headerPanel.appendChild(new Separator("vertical"));
Auxhead head=new Auxhead(); Auxhead head=new Auxhead();
@ -205,7 +203,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
headerPanel.appendChild(new Separator("horizontal")); headerPanel.appendChild(new Separator("horizontal"));
tabbox.setWidth("100%"); tabbox.setWidth("100%");
tabbox.setHeight("80%"); tabbox.setHeight("87%");
tabfo2.addEventListener(Events.ON_CLICK, this); tabfo2.addEventListener(Events.ON_CLICK, this);
tabsc3.addEventListener(Events.ON_CLICK, this); tabsc3.addEventListener(Events.ON_CLICK, this);
tabgc4.addEventListener(Events.ON_CLICK, this); tabgc4.addEventListener(Events.ON_CLICK, this);
@ -285,27 +283,17 @@ public class WReportCustomization implements IFormController,EventListener<Even
foot.appendChild(new Separator("vertical")); foot.appendChild(new Separator("vertical"));
} }
bRun=new Button();
bRun.setLabel(Msg.getMsg(Env.getCtx(), "Run"));
bRun.setName("bRun");
bRun.addEventListener(Events.ON_CLICK, this);
foot.appendChild(bRun);
Separator se =new Separator("vertical");
se.setSpacing("500px");
foot.appendChild(se);
bnext=new Button(); bnext=new Button();
bnext.setLabel(Msg.getMsg(Env.getCtx(), "NextPage")); bnext.setLabel(Msg.getMsg(Env.getCtx(), "NextPage"));
bnext.setName("Next"); bnext.setName("Next");
bnext.addEventListener(Events.ON_CLICK, this); bnext.addEventListener(Events.ON_CLICK, this);
foot.appendChild(bnext); foot.appendChild(bnext);
foot.appendChild(new Separator("vertical")); Vbox vb = new Vbox();
vb.setWidth("50%");
bcancel=new Button(); foot.appendChild(vb);
bcancel.setName("Cancel"); vb.appendChild(confirmPanelMain);
bcancel.addEventListener(Events.ON_CLICK, this); confirmPanelMain.addActionListener(this);
bcancel.setLabel("Cancel"); confirmPanelMain.setVflex("0");
foot.appendChild(bcancel);
f.appendChild(foot); f.appendChild(foot);
grid.appendChild(f); grid.appendChild(f);
@ -345,15 +333,9 @@ public class WReportCustomization implements IFormController,EventListener<Even
tabbox.setSelectedIndex(oldtabidx); tabbox.setSelectedIndex(oldtabidx);
} }
else{ else{
if("Cancel".equals(bt.getName())){
close();
}
if("NewPrintFormat".equals(bt.getName())){ if("NewPrintFormat".equals(bt.getName())){
copyFormat(); copyFormat();
} }
if("bRun".equals(bt.getName())){
runReport();
}
} }
} }
} else { } else {
@ -365,12 +347,13 @@ public class WReportCustomization implements IFormController,EventListener<Even
oldtabidx = tabidx; oldtabidx = tabidx;
} }
} }
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)){
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) close();
winExportFile.onClose(); }else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)){
else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) ((WRCTabPanel) tabbox.getSelectedTabpanel()).updatePFI();
exportFile(); onSave();
close();
}
selectAll.setVisible(oldtabidx == 0); selectAll.setVisible(oldtabidx == 0);
deselectAll.setVisible(oldtabidx == 0); deselectAll.setVisible(oldtabidx == 0);
pipeSeparator.setVisible(oldtabidx == 0); pipeSeparator.setVisible(oldtabidx == 0);
@ -439,10 +422,18 @@ public class WReportCustomization implements IFormController,EventListener<Even
winExportFile.appendChild(vb); winExportFile.appendChild(vb);
vb.appendChild(hb); vb.appendChild(hb);
vb.appendChild(confirmPanel); vb.appendChild(confirmPanel);
confirmPanel.addActionListener(this); EventListener exportListener= new EventListener()
{
public void onEvent(Event event) throws Exception {
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
winExportFile.onClose();
else if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
exportFile();
}
};
confirmPanel.addActionListener(exportListener);
confirmPanel.setVflex("0"); confirmPanel.setVflex("0");
} }
winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); winExportFile.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
AEnv.showWindow(winExportFile); AEnv.showWindow(winExportFile);
} // cmd_export } // cmd_export
@ -524,7 +515,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
public void close() public void close()
{ {
SessionManager.getAppDesktop().closeActiveWindow(); form.detach();
} }
public void copyFormat(){ public void copyFormat(){
@ -550,7 +541,7 @@ public class WReportCustomization implements IFormController,EventListener<Even
tpsf5.setMPrintFormat(newpf); tpsf5.setMPrintFormat(newpf);
tpsf5.setPrintFormatItems(pfi); tpsf5.setPrintFormatItems(pfi);
tpsf5.refresh(); tpsf5.refresh();
setIsChanged(true); setIsChanged(false);
comboReport.removeAllItems(); comboReport.removeAllItems();
comboReport.appendItem(newpf.getName(), newpf.get_ID()); comboReport.appendItem(newpf.getName(), newpf.get_ID());
@ -562,12 +553,6 @@ public class WReportCustomization implements IFormController,EventListener<Even
btnSave.setDisabled(!isChange); btnSave.setDisabled(!isChange);
bExport.setDisabled(isChange); bExport.setDisabled(isChange);
bRun.setDisabled(isChange);
newPrintFormat.setDisabled(isChange); newPrintFormat.setDisabled(isChange);
} }
public void runReport(){
m_reportEngine.setPrintFormat(m_reportEngine.getPrintFormat()); // reload
new ZkReportViewerProvider().openViewer(m_reportEngine);
}
} }

View File

@ -1106,12 +1106,24 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID(); int AD_PrintFormat_ID = m_reportEngine.getPrintFormat().get_ID();
Env.setContext(m_ctx, "AD_PrintFormat_ID", AD_PrintFormat_ID); Env.setContext(m_ctx, "AD_PrintFormat_ID", AD_PrintFormat_ID);
ADForm form = ADForm.openForm(SystemIDs.FORM_REPORT_WIZARD);
ADForm form = ADForm.openForm(SystemIDs.FORM_REPORT_WIZARD);
WReportCustomization av = (WReportCustomization) form.getICustomForm(); WReportCustomization av = (WReportCustomization) form.getICustomForm();
av.setReportEngine(m_reportEngine); av.setReportEngine(m_reportEngine);
form.setClosable(true);
form.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); form.setWidth("70%");
form.setHeight("85%");
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
if (DialogEvents.ON_WINDOW_CLOSE.equals(event.getName())) {
if(m_reportEngine.getPrintFormat().get_ID()!=Env.getContextAsInt(m_ctx, "AD_PrintFormat_ID")){
fillComboReport (m_reportEngine.getPrintFormat().get_ID());
}
cmd_report();
}
}
});
form.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
SessionManager.getAppDesktop().showWindow(form); SessionManager.getAppDesktop().showWindow(form);
} // cmd_Wizard } // cmd_Wizard