IDEMPIERE-369 Master Detail layout improvements. Fixed click on row indicator not working in header grid view. Single click instead of double click to maximize selected detail tab. Not to auto switch to form view for the detail record icon and the click to maximize selected tab action.
This commit is contained in:
parent
147b55cd26
commit
d112a9c316
|
@ -248,6 +248,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
|
||||
//detach root component from old page
|
||||
Page page = appDesktop.getComponent().getPage();
|
||||
if (page.getDesktop() != null) {
|
||||
Collection<?> collection = page.getRoots();
|
||||
Object[] objects = new Object[0];
|
||||
objects = collection.toArray(objects);
|
||||
|
@ -258,13 +259,17 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
|||
rootComponents.add((Component) obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
appDesktop.getComponent().detach();
|
||||
|
||||
DesktopCache desktopCache = ((SessionCtrl)currSess).getDesktopCache();
|
||||
if (desktopCache != null)
|
||||
desktopCache.removeDesktop(Executions.getCurrent().getDesktop());
|
||||
} else {
|
||||
appDesktop = null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
appDesktop = null;
|
||||
|
|
|
@ -69,6 +69,7 @@ import org.compiere.util.Msg;
|
|||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.au.out.AuFocus;
|
||||
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.IdSpace;
|
||||
|
@ -106,6 +107,8 @@ import org.zkoss.zul.impl.XulElement;
|
|||
public class ADTabpanel extends Div implements Evaluatee, EventListener<Event>,
|
||||
DataStatusListener, IADTabpanel, IdSpace
|
||||
{
|
||||
public static final String ON_POST_INIT_EVENT = "onPostInit";
|
||||
|
||||
public static final String ON_SWITCH_VIEW_EVENT = "onSwitchView";
|
||||
|
||||
public static final String ON_DYNAMIC_DISPLAY_EVENT = "onDynamicDisplay";
|
||||
|
@ -190,7 +193,7 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
removeAttribute(ATTR_ON_ACTIVATE_POSTED);
|
||||
}
|
||||
});
|
||||
addEventListener("onPostInit", this);
|
||||
addEventListener(ON_POST_INIT_EVENT, this);
|
||||
}
|
||||
|
||||
private void initComponents()
|
||||
|
@ -498,7 +501,10 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
//stretch component to fill grid cell
|
||||
editor.fillHorizontal();
|
||||
|
||||
Component fellow = editor.getComponent().getFellowIfAny(field.getColumnName());
|
||||
if (fellow == null) {
|
||||
editor.getComponent().setId(field.getColumnName());
|
||||
}
|
||||
|
||||
//setup editor context menu
|
||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||
|
@ -932,12 +938,17 @@ DataStatusListener, IADTabpanel, IdSpace
|
|||
else if (WPaymentEditor.ON_SAVE_PAYMENT.equals(event.getName())) {
|
||||
windowPanel.onSavePayment();
|
||||
}
|
||||
else if ("onPostInit".equals(event.getName())) {
|
||||
else if (ON_POST_INIT_EVENT.equals(event.getName())) {
|
||||
if (detailPane != null) {
|
||||
Desktop desktop = Executions.getCurrent().getDesktop();
|
||||
//for unknown reason, this is needed once per desktop to fixed the layout of the detailpane.
|
||||
if (desktop.getAttribute("adtabpanel.detailpane.postinit.redraw") == null) {
|
||||
desktop.setAttribute("adtabpanel.detailpane.postinit.redraw", Boolean.TRUE);
|
||||
Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, detailPane));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void navigateTo(DefaultTreeNode<MTreeNode> value) {
|
||||
MTreeNode treeNode = value.getData();
|
||||
|
|
|
@ -586,7 +586,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
private void initFirstTabpanel() {
|
||||
adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
|
||||
adTabbox.getSelectedTabpanel().activate(true);
|
||||
Events.echoEvent(new Event("onPostInit", adTabbox.getSelectedTabpanel()));
|
||||
Events.echoEvent(new Event(ADTabpanel.ON_POST_INIT_EVENT, adTabbox.getSelectedTabpanel()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,11 +87,12 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
final int row = detailPane.getSelectedADTabpanel() != null
|
||||
? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow()
|
||||
: 0;
|
||||
final boolean formView = event.getData() != null ? (Boolean)event.getData() : true;
|
||||
adWindowPanel.saveAndNavigate(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
if (result)
|
||||
onEditDetail(row);
|
||||
onEditDetail(row, formView);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -105,7 +106,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
if (result) {
|
||||
onEditDetail(row);
|
||||
onEditDetail(row, true);
|
||||
if (!adWindowPanel.getActiveGridTab().isNew())
|
||||
adWindowPanel.onNew();
|
||||
}
|
||||
|
@ -136,7 +137,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
});
|
||||
}
|
||||
|
||||
protected void onEditDetail(int row) {
|
||||
protected void onEditDetail(int row, boolean formView) {
|
||||
int oldIndex = selectedIndex;
|
||||
IADTabpanel selectedPanel = detailPane.getSelectedADTabpanel();
|
||||
if (selectedPanel == null) return;
|
||||
|
@ -150,7 +151,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
}
|
||||
|
||||
headerTab.setDetailPaneMode(false);
|
||||
if (headerTab.isGridView()) {
|
||||
if (formView && headerTab.isGridView()) {
|
||||
headerTab.switchRowPresentation();
|
||||
}
|
||||
headerTab.getGridTab().setCurrentRow(row, true);
|
||||
|
@ -213,9 +214,6 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
if (b != null && b.booleanValue()) {
|
||||
activateDetailADTabpanel();
|
||||
}
|
||||
if (selectedIndex > 0 && tabPanel.isGridView()) {
|
||||
tabPanel.switchRowPresentation();
|
||||
}
|
||||
} else {
|
||||
onActivateDetail(tabPanel);
|
||||
}
|
||||
|
@ -274,7 +272,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
if (tabPanel == headerTab) {
|
||||
adWindowPanel.onToggle();
|
||||
} else {
|
||||
detailPane.onEdit();
|
||||
detailPane.onEdit(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -285,7 +283,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
GridView gridView = (GridView) event.getTarget();
|
||||
if (gridView.getParent() == headerTab) {
|
||||
if (!gridView.isDetailPaneMode()) {
|
||||
adWindowPanel.onToggle();
|
||||
}
|
||||
}
|
||||
|
@ -549,7 +547,7 @@ public class CompositeADTabbox extends AbstractADTabbox
|
|||
public void onDetailRecord() {
|
||||
if (detailPane != null && detailPane.getSelectedADTabpanel() != null) {
|
||||
try {
|
||||
detailPane.onEdit();
|
||||
detailPane.onEdit(false);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ import org.zkoss.zul.Toolbar;
|
|||
*/
|
||||
public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
||||
|
||||
private static final String TABBOX_ONSELECT_ATTRIBUTE = "detailpane.tabbox.onselect";
|
||||
|
||||
public static final String ON_POST_SELECT_TAB_EVENT = "onPostSelectTab";
|
||||
|
||||
private static final String STATUS_TEXT_ATTRIBUTE = "status.text";
|
||||
|
@ -96,6 +98,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
public void onEvent(Event event) throws Exception {
|
||||
fireActivateDetailEvent();
|
||||
Events.postEvent(new Event(ON_POST_SELECT_TAB_EVENT, DetailPane.this));
|
||||
Executions.getCurrent().setAttribute(TABBOX_ONSELECT_ATTRIBUTE, Boolean.TRUE);
|
||||
}
|
||||
});
|
||||
tabbox.setSclass("adwindow-detailpane-tabbox");
|
||||
|
@ -106,8 +109,6 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
|
||||
addEventListener(LayoutUtils.ON_REDRAW_EVENT, this);
|
||||
|
||||
addEventListener("onPostInit", this);
|
||||
|
||||
setId("detailPane");
|
||||
}
|
||||
|
||||
|
@ -154,12 +155,16 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
tab.setSclass("adwindow-detailpane-sub-tab");
|
||||
}
|
||||
|
||||
tab.addEventListener(Events.ON_DOUBLE_CLICK, new EventListener<Event>() {
|
||||
tab.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Tab tab = (Tab) event.getTarget();
|
||||
if (!tab.isSelected())
|
||||
return;
|
||||
|
||||
if (Executions.getCurrent().getAttribute(TABBOX_ONSELECT_ATTRIBUTE) != null)
|
||||
return;
|
||||
|
||||
org.zkoss.zul.Tabpanel zkTabpanel = tab.getLinkedPanel();
|
||||
IADTabpanel adtab = null;
|
||||
for(Component c : zkTabpanel.getChildren()) {
|
||||
|
@ -169,7 +174,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
}
|
||||
}
|
||||
if (adtab != null && adtab.isDetailPaneMode()) {
|
||||
onEdit();
|
||||
onEdit(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -207,7 +212,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
button.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
onEdit();
|
||||
onEdit(true);
|
||||
}
|
||||
});
|
||||
button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "EditRecord")));
|
||||
|
@ -259,7 +264,7 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
public void onEvent(Event event) throws Exception {
|
||||
GridView gridView = (GridView) event.getTarget();
|
||||
if (gridView.isDetailPaneMode())
|
||||
onEdit();
|
||||
onEdit(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -407,13 +412,6 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
return;
|
||||
}
|
||||
LayoutUtils.redraw(this);
|
||||
} else if (event.getName().equals("onPostInit")) {
|
||||
IADTabpanel adtabpanel = getSelectedADTabpanel();
|
||||
if (adtabpanel != null) {
|
||||
GridView gridView = adtabpanel.getGridView();
|
||||
if (gridView != null && gridView.getListbox() != null)
|
||||
Clients.resize(gridView.getListbox());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -518,8 +516,8 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
|
|||
}
|
||||
}
|
||||
|
||||
public void onEdit() throws Exception {
|
||||
Event openEvent = new Event(ON_EDIT_EVENT, DetailPane.this);
|
||||
public void onEdit(boolean formView) throws Exception {
|
||||
Event openEvent = new Event(ON_EDIT_EVENT, DetailPane.this, Boolean.valueOf(formView));
|
||||
eventListener.onEvent(openEvent);
|
||||
}
|
||||
|
||||
|
|
|
@ -522,6 +522,14 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
|||
overflow-y: visible;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-tabbox .z-tab-seld span.z-tab-text {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-tabbox .z-tab-seld span.z-tab-text:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-tabpanel {
|
||||
background-color: #fff
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue