IDEMPIERE-369 Master Detail layout improvements. Minor adjustment to the redraw of detailpane.
This commit is contained in:
parent
b0c509fa06
commit
960a984e5d
|
@ -12,8 +12,13 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui;
|
package org.adempiere.webui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
|
import org.zkoss.zk.au.out.AuOuter;
|
||||||
import org.zkoss.zk.au.out.AuScript;
|
import org.zkoss.zk.au.out.AuScript;
|
||||||
|
import org.zkoss.zk.ui.AbstractComponent;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.HtmlBasedComponent;
|
import org.zkoss.zk.ui.HtmlBasedComponent;
|
||||||
import org.zkoss.zk.ui.util.Clients;
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
@ -124,4 +129,14 @@ public final class LayoutUtils {
|
||||||
window.doOverlapped();
|
window.doOverlapped();
|
||||||
Clients.response("_openPopupWindow_", new AuScript(window, script.toString()));
|
Clients.response("_openPopupWindow_", new AuScript(window, script.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void redraw(AbstractComponent component) {
|
||||||
|
StringWriter writer = new StringWriter(1024);
|
||||||
|
try {
|
||||||
|
component.redraw(writer);
|
||||||
|
Clients.response(new AuOuter(component, writer.toString()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,7 +571,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
private void initFirstTabpanel() {
|
private void initFirstTabpanel() {
|
||||||
adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
|
adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
|
||||||
adTabbox.getSelectedTabpanel().activate(true);
|
adTabbox.getSelectedTabpanel().activate(true);
|
||||||
Events.echoEvent(new Event("onPostInit", adTabbox.getComponent()));
|
|
||||||
|
if (adTabbox.getSelectedTabpanel().isGridView()) {
|
||||||
|
Events.postEvent(new Event(CompositeADTabbox.ON_POST_INIT_EVENT, adTabbox.getComponent()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.adempiere.util.Callback;
|
import org.adempiere.util.Callback;
|
||||||
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.component.ADTabListModel;
|
import org.adempiere.webui.component.ADTabListModel;
|
||||||
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
|
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
|
@ -54,6 +55,8 @@ import org.zkoss.zul.Vlayout;
|
||||||
*/
|
*/
|
||||||
public class CompositeADTabbox extends AbstractADTabbox
|
public class CompositeADTabbox extends AbstractADTabbox
|
||||||
{
|
{
|
||||||
|
public static final String ON_POST_INIT_EVENT = "onPostInit";
|
||||||
|
|
||||||
public static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged";
|
public static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged";
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
|
@ -133,6 +136,18 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
detailPane.addEventListener(DetailPane.ON_POST_SELECT_TAB_EVENT, new EventListener<Event>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
if ((!ADTabpanel.isUseSplitViewForForm() && !headerTab.isGridView())
|
||||||
|
|| (detailPane.getSelectedADTabpanel() instanceof ADSortTab)) {
|
||||||
|
LayoutUtils.redraw(detailPane);
|
||||||
|
Clients.scrollIntoView(detailPane.getSelectedADTabpanel());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onEditDetail(int row) {
|
protected void onEditDetail(int row) {
|
||||||
|
@ -188,10 +203,10 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
layout.addEventListener("onPostInit", new EventListener<Event>() {
|
layout.addEventListener(ON_POST_INIT_EVENT, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
layout.invalidate();
|
LayoutUtils.redraw(layout);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -547,8 +562,8 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
detailTab.activate(true);
|
detailTab.activate(true);
|
||||||
detailTab.setDetailPaneMode(true, isUseVflexForDetailPane());
|
detailTab.setDetailPaneMode(true, isUseVflexForDetailPane());
|
||||||
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
|
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
|
||||||
if (!ADTabpanel.isUseSplitViewForForm()) {
|
if (!ADTabpanel.isUseSplitViewForForm() && !headerTab.isGridView()) {
|
||||||
layout.invalidate();
|
Events.echoEvent(new Event(DetailPane.ON_REDRAW_EVENT, detailPane));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,13 +662,9 @@ public class CompositeADTabbox extends AbstractADTabbox
|
||||||
tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane());
|
tabPanel.setDetailPaneMode(true, isUseVflexForDetailPane());
|
||||||
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
|
detailPane.setVflex(Boolean.toString(isUseVflexForDetailPane()));
|
||||||
if (tabPanel instanceof ADSortTab) {
|
if (tabPanel instanceof ADSortTab) {
|
||||||
detailPane.invalidate();
|
|
||||||
detailPane.updateToolbar(false, true);
|
detailPane.updateToolbar(false, true);
|
||||||
} else {
|
} else {
|
||||||
tabPanel.dynamicDisplay(0);
|
tabPanel.dynamicDisplay(0);
|
||||||
if (!ADTabpanel.isUseSplitViewForForm() && !headerTab.isGridView()) {
|
|
||||||
detailPane.invalidate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,10 @@ import org.zkoss.zul.Toolbar;
|
||||||
*/
|
*/
|
||||||
public class DetailPane extends Panel implements EventListener<Event> {
|
public class DetailPane extends Panel implements EventListener<Event> {
|
||||||
|
|
||||||
|
public static final String ON_POST_SELECT_TAB_EVENT = "onPostSelectTab";
|
||||||
|
|
||||||
|
public static final String ON_REDRAW_EVENT = "onRedraw";
|
||||||
|
|
||||||
private static final String STATUS_TEXT_ATTRIBUTE = "status.text";
|
private static final String STATUS_TEXT_ATTRIBUTE = "status.text";
|
||||||
|
|
||||||
private static final String STATUS_ERROR_ATTRIBUTE = "status.error";
|
private static final String STATUS_ERROR_ATTRIBUTE = "status.error";
|
||||||
|
@ -91,9 +95,7 @@ public class DetailPane extends Panel implements EventListener<Event> {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
fireActivateDetailEvent();
|
fireActivateDetailEvent();
|
||||||
if (!ADTabpanel.isUseSplitViewForForm()) {
|
Events.postEvent(new Event(ON_POST_SELECT_TAB_EVENT, DetailPane.this));
|
||||||
Clients.scrollIntoView(getSelectedADTabpanel());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tabbox.setSclass("adwindow-detailpane-tabbox");
|
tabbox.setSclass("adwindow-detailpane-tabbox");
|
||||||
|
@ -107,6 +109,8 @@ public class DetailPane extends Panel implements EventListener<Event> {
|
||||||
if (!ADTabpanel.isUseSplitViewForForm()) {
|
if (!ADTabpanel.isUseSplitViewForForm()) {
|
||||||
LayoutUtils.addSclass("adwindow-detailpane-xsplit", this);
|
LayoutUtils.addSclass("adwindow-detailpane-xsplit", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addEventListener(ON_REDRAW_EVENT, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectedIndex() {
|
public int getSelectedIndex() {
|
||||||
|
@ -391,6 +395,8 @@ public class DetailPane extends Panel implements EventListener<Event> {
|
||||||
showPopup(error, messageContainer);
|
showPopup(error, messageContainer);
|
||||||
} else if (event.getName().equals(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT)) {
|
} else if (event.getName().equals(ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT)) {
|
||||||
updateProcessToolbar();
|
updateProcessToolbar();
|
||||||
|
} else if (event.getName().equals(ON_REDRAW_EVENT)) {
|
||||||
|
LayoutUtils.redraw(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue