IDEMPIERE-291 Zk Report Viewer: Drill across dropdown should be visible only for html output, label and tooltip shouldn't have the & character.

This commit is contained in:
Heng Sin Low 2012-06-06 22:52:35 +08:00
parent 20c846a64c
commit b94843f98e
1 changed files with 23 additions and 9 deletions

View File

@ -64,6 +64,7 @@ import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util;
import org.zkoss.util.media.AMedia; import org.zkoss.util.media.AMedia;
import org.zkoss.util.media.Media; import org.zkoss.util.media.Media;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
@ -247,31 +248,31 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
toolBar.appendChild(summary); toolBar.appendChild(summary);
bCustomize.setImage("/images/Preference24.png"); bCustomize.setImage("/images/Preference24.png");
bCustomize.setTooltiptext(Msg.getMsg(Env.getCtx(), "PrintCustomize")); bCustomize.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "PrintCustomize")));
toolBar.appendChild(bCustomize); toolBar.appendChild(bCustomize);
bCustomize.addEventListener(Events.ON_CLICK, this); bCustomize.addEventListener(Events.ON_CLICK, this);
bFind.setImage("/images/Find24.png"); bFind.setImage("/images/Find24.png");
bFind.setTooltiptext(Msg.getMsg(Env.getCtx(), "Find")); bFind.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Find")));
toolBar.appendChild(bFind); toolBar.appendChild(bFind);
bFind.addEventListener(Events.ON_CLICK, this); bFind.addEventListener(Events.ON_CLICK, this);
toolBar.appendChild(new Separator("vertical")); toolBar.appendChild(new Separator("vertical"));
bSendMail.setImage("/images/SendMail24.png"); bSendMail.setImage("/images/SendMail24.png");
bSendMail.setTooltiptext(Msg.getMsg(Env.getCtx(), "SendMail")); bSendMail.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "SendMail")));
toolBar.appendChild(bSendMail); toolBar.appendChild(bSendMail);
bSendMail.addEventListener(Events.ON_CLICK, this); bSendMail.addEventListener(Events.ON_CLICK, this);
bArchive.setImage("/images/Archive24.png"); bArchive.setImage("/images/Archive24.png");
bArchive.setTooltiptext(Msg.getMsg(Env.getCtx(), "Archive")); bArchive.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Archive")));
toolBar.appendChild(bArchive); toolBar.appendChild(bArchive);
bArchive.addEventListener(Events.ON_CLICK, this); bArchive.addEventListener(Events.ON_CLICK, this);
if (m_isCanExport) if (m_isCanExport)
{ {
bExport.setImage("/images/ExportX24.png"); bExport.setImage("/images/ExportX24.png");
bExport.setTooltiptext(Msg.getMsg(Env.getCtx(), "Export")); bExport.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Export")));
toolBar.appendChild(bExport); toolBar.appendChild(bExport);
bExport.addEventListener(Events.ON_CLICK, this); bExport.addEventListener(Events.ON_CLICK, this);
} }
@ -279,7 +280,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
toolBar.appendChild(new Separator("vertical")); toolBar.appendChild(new Separator("vertical"));
bRefresh.setImage("/images/Refresh24.png"); bRefresh.setImage("/images/Refresh24.png");
bRefresh.setTooltiptext(Msg.getMsg(Env.getCtx(), "Refresh")); bRefresh.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Refresh")));
toolBar.appendChild(bRefresh); toolBar.appendChild(bRefresh);
bRefresh.addEventListener(Events.ON_CLICK, this); bRefresh.addEventListener(Events.ON_CLICK, this);
@ -374,6 +375,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
File file = File.createTempFile(prefix, ".pdf", new File(path)); File file = File.createTempFile(prefix, ".pdf", new File(path));
m_reportEngine.createPDF(file); m_reportEngine.createPDF(file);
media = new AMedia(file.getName(), "pdf", "application/pdf", file, true); media = new AMedia(file.getName(), "pdf", "application/pdf", file, true);
labelDrill.setVisible(false);
comboDrill.setVisible(false);
} else if ("HTML".equals(previewType.getSelectedItem().getValue())) { } else if ("HTML".equals(previewType.getSelectedItem().getValue())) {
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
String prefix = makePrefix(m_reportEngine.getName()); String prefix = makePrefix(m_reportEngine.getName());
@ -384,6 +388,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
File file = File.createTempFile(prefix, ".html", new File(path)); File file = File.createTempFile(prefix, ".html", new File(path));
m_reportEngine.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp", this.getUuid())); m_reportEngine.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(Executions.getCurrent().getContextPath(), "rp", this.getUuid()));
media = new AMedia(file.getName(), "html", "text/html", file, false); media = new AMedia(file.getName(), "html", "text/html", file, false);
labelDrill.setVisible(true);
comboDrill.setVisible(true);
} else if ("XLS".equals(previewType.getSelectedItem().getValue())) { } else if ("XLS".equals(previewType.getSelectedItem().getValue())) {
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
String prefix = makePrefix(m_reportEngine.getName()); String prefix = makePrefix(m_reportEngine.getName());
@ -394,6 +401,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
File file = File.createTempFile(prefix, ".xls", new File(path)); File file = File.createTempFile(prefix, ".xls", new File(path));
m_reportEngine.createXLS(file, AEnv.getLanguage(Env.getCtx())); m_reportEngine.createXLS(file, AEnv.getLanguage(Env.getCtx()));
media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true); media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true);
labelDrill.setVisible(false);
comboDrill.setVisible(false);
} }
Events.echoEvent("onPreviewReport", this, null); Events.echoEvent("onPreviewReport", this, null);
@ -543,7 +553,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
private void revalidate() private void revalidate()
{ {
// Report Info // Report Info
setTitle(Msg.getMsg(Env.getCtx(), "Report") + ": " + m_reportEngine.getName() + " " + Env.getHeader(Env.getCtx(), 0)); setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Report") + ": " + m_reportEngine.getName() + " " + Env.getHeader(Env.getCtx(), 0)));
StringBuffer sb = new StringBuffer (); StringBuffer sb = new StringBuffer ();
sb.append(Msg.getMsg(Env.getCtx(), "DataCols")).append("=") sb.append(Msg.getMsg(Env.getCtx(), "DataCols")).append("=")
.append(m_reportEngine.getColumnCount()) .append(m_reportEngine.getColumnCount())
@ -655,7 +665,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
renderReport(); renderReport();
} catch (Exception e) { } catch (Exception e) {
throw new AdempiereException("Failed to render report", e); throw new AdempiereException("Failed to render report", e);
} }
} }
/** /**
@ -750,6 +760,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
winExportFile = new Window(); winExportFile = new Window();
winExportFile.setTitle(Msg.getMsg(Env.getCtx(), "Export") + ": " + getTitle()); winExportFile.setTitle(Msg.getMsg(Env.getCtx(), "Export") + ": " + getTitle());
winExportFile.setWidth("450px"); winExportFile.setWidth("450px");
winExportFile.setHeight("300px");
winExportFile.setClosable(true); winExportFile.setClosable(true);
winExportFile.setBorder("normal"); winExportFile.setBorder("normal");
winExportFile.setStyle("position:absolute"); winExportFile.setStyle("position:absolute");
@ -774,13 +785,16 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
hb.appendChild(div); hb.appendChild(div);
hb.appendChild(cboType); hb.appendChild(cboType);
cboType.setWidth("100%"); cboType.setWidth("100%");
hb.setVflex("1");
Vbox vb = new Vbox(); Vbox vb = new Vbox();
vb.setWidth("390px"); vb.setVflex("1");
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");
} }
AEnv.showCenterScreen(winExportFile); AEnv.showCenterScreen(winExportFile);