IDEMPIERE-5664 - Report Renderer can Overwrite any Current Tab (#1777)
* IDEMPIERE-5664 - Report Renderer can Overwrite any Current Tab * IDEMPIERE-5664 - fix issue on close - do not render the report if the tab is not found (e.g. closed already) * IDEMPIERE-5664 - pr1777 patch
This commit is contained in:
parent
a811b62b56
commit
fdf2f0299c
|
@ -274,12 +274,21 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
||||||
String title = window.getTitle();
|
String title = window.getTitle();
|
||||||
window.setTitle(null);
|
window.setTitle(null);
|
||||||
preOpenNewTab();
|
preOpenNewTab();
|
||||||
if (Window.INSERT_NEXT.equals(window.getAttribute(Window.INSERT_POSITION_KEY)))
|
if (Window.INSERT_NEXT.equals(window.getAttribute(Window.INSERT_POSITION_KEY))) {
|
||||||
windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, title, true, true, null);
|
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 if(Window.REPLACE.equals(window.getAttribute(Window.INSERT_POSITION_KEY))) {
|
||||||
else
|
Tab refTab = windowContainer.getSelectedTab();
|
||||||
|
Object windowNoAttribute = window.getAttribute(WindowContainer.REPLACE_WINDOW_NO);
|
||||||
|
if (windowNoAttribute != null && windowNoAttribute instanceof Integer) {
|
||||||
|
int windowNo = (Integer)windowNoAttribute;
|
||||||
|
refTab = windowContainer.getTab(windowNo);
|
||||||
|
}
|
||||||
|
windowContainer.replace(refTab, window, title);
|
||||||
|
}
|
||||||
|
else {
|
||||||
windowContainer.addWindow(tabPanel, title, true, null);
|
windowContainer.addWindow(tabPanel, title, true, null);
|
||||||
|
}
|
||||||
if (window instanceof IHelpContext)
|
if (window instanceof IHelpContext)
|
||||||
Events.sendEvent(new Event(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, window));
|
Events.sendEvent(new Event(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, window));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
|
||||||
public static final String DEFER_SET_SELECTED_TAB = "deferSetSelectedTab";
|
public static final String DEFER_SET_SELECTED_TAB = "deferSetSelectedTab";
|
||||||
|
|
||||||
private static final int DEFAULT_MAX_TITLE_LENGTH = 30;
|
private static final int DEFAULT_MAX_TITLE_LENGTH = 30;
|
||||||
|
|
||||||
|
public static final String REPLACE_WINDOW_NO = "replaceWindowNo";
|
||||||
|
|
||||||
private Tabbox tabbox;
|
private Tabbox tabbox;
|
||||||
private ToolBar toolbar;
|
private ToolBar toolbar;
|
||||||
|
@ -584,7 +586,7 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
|
||||||
* @param windowNo
|
* @param windowNo
|
||||||
* @return org.zkoss.zul.Tab
|
* @return org.zkoss.zul.Tab
|
||||||
*/
|
*/
|
||||||
private org.zkoss.zul.Tab getTab(int windowNo) {
|
public org.zkoss.zul.Tab getTab(int windowNo) {
|
||||||
org.zkoss.zul.Tabpanels panels = tabbox.getTabpanels();
|
org.zkoss.zul.Tabpanels panels = tabbox.getTabpanels();
|
||||||
List<?> childrens = panels.getChildren();
|
List<?> childrens = panels.getChildren();
|
||||||
for (Object child : childrens)
|
for (Object child : childrens)
|
||||||
|
@ -647,7 +649,7 @@ public class WindowContainer extends AbstractUIPart implements EventListener<Eve
|
||||||
* @param title
|
* @param title
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Tab replace(Tab refTab, Window comp, String title) {
|
public org.zkoss.zul.Tab replace(org.zkoss.zul.Tab refTab, Window comp, String title) {
|
||||||
|
|
||||||
if (refTab == null)
|
if (refTab == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2033,7 +2033,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
|
||||||
ZKUpdateUtil.setHeight(findWindow, "100%");
|
ZKUpdateUtil.setHeight(findWindow, "100%");
|
||||||
else
|
else
|
||||||
ZKUpdateUtil.setHeight(findWindow, "60%");
|
ZKUpdateUtil.setHeight(findWindow, "60%");
|
||||||
findWindow.setSizable(false);
|
findWindow.setSizable(false);
|
||||||
findWindow.setContentStyle("background-color: #fff; width: 99%; margin: auto;");
|
findWindow.setContentStyle("background-color: #fff; width: 99%; margin: auto;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,15 @@ public class ZkReportViewerProvider implements ReportViewerProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void openReportViewWindow (ReportEngine report) {
|
protected void openReportViewWindow (ReportEngine report) {
|
||||||
Window viewer = new ZkReportViewer(report, report.getName());
|
ZkReportViewer viewer = new ZkReportViewer(report, report.getName());
|
||||||
|
|
||||||
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
if(report.isReplaceTabContent())
|
if(report.isReplaceTabContent()) {
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.REPLACE);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.REPLACE);
|
||||||
|
viewer.setAttribute(WindowContainer.REPLACE_WINDOW_NO, report.getWindowNo());
|
||||||
viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE);
|
}
|
||||||
SessionManager.getAppDesktop().showWindow(viewer);
|
viewer.setAttribute(WindowContainer.DEFER_SET_SELECTED_TAB, Boolean.TRUE);
|
||||||
|
SessionManager.getAppDesktop().showWindow(viewer);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue