IDEMPIERE-2007 Detail Pane: Reduce vertical space use by paging control.
This commit is contained in:
parent
c6e660ca50
commit
ec78079e40
|
@ -1395,6 +1395,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
if (listPanel.isVisible()) {
|
||||
listPanel.refresh(gridTab);
|
||||
listPanel.scrollToCurrentRow();
|
||||
Clients.resize(listPanel);
|
||||
} else {
|
||||
listPanel.deactivate();
|
||||
}
|
||||
|
@ -1649,5 +1650,13 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
|||
Clients.response(new AuScript(script.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(Component parent) {
|
||||
super.setParent(parent);
|
||||
if (parent != null) {
|
||||
listPanel.onADTabPanelParentChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1373,7 +1373,14 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
String origmsg = null;
|
||||
if (msg != null && msg.length() > 0)
|
||||
{
|
||||
origmsg = Msg.getMsg(Env.getCtx(), e.getAD_Message());
|
||||
if (detailTab && GridTable.DATA_REFRESH_MESSAGE.equals(e.getAD_Message()))
|
||||
{
|
||||
origmsg = e.getTotalRows() + " " + Msg.getMsg(Env.getCtx(), "Records");
|
||||
}
|
||||
else
|
||||
{
|
||||
origmsg = Msg.getMsg(Env.getCtx(), e.getAD_Message());
|
||||
}
|
||||
adMessage.append(origmsg);
|
||||
}
|
||||
String info = e.getInfo();
|
||||
|
|
|
@ -58,6 +58,7 @@ import org.zkoss.zul.Div;
|
|||
import org.zkoss.zul.Frozen;
|
||||
import org.zkoss.zul.Paging;
|
||||
import org.zkoss.zul.Row;
|
||||
import org.zkoss.zul.Tabpanel;
|
||||
import org.zkoss.zul.Vbox;
|
||||
import org.zkoss.zul.event.ZulEvents;
|
||||
|
||||
|
@ -143,7 +144,6 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
this.setHflex("1");
|
||||
|
||||
gridFooter = new Div();
|
||||
gridFooter.setHflex("1");
|
||||
gridFooter.setVflex("0");
|
||||
|
||||
//default paging size
|
||||
|
@ -195,6 +195,11 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
if (paging != null && paging.getPageSize() != pageSize) {
|
||||
paging.setPageSize(pageSize);
|
||||
updateModel();
|
||||
if (paging.getPageSize() > 1) {
|
||||
showPagingControl();
|
||||
} else {
|
||||
hidePagingControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,6 +222,21 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
updateListIndex();
|
||||
|
||||
this.init = true;
|
||||
|
||||
showRecordsCount();
|
||||
}
|
||||
|
||||
private void showRecordsCount() {
|
||||
Component parent = this.getParent();
|
||||
while (parent != null) {
|
||||
if (parent instanceof DetailPane) {
|
||||
DetailPane p = (DetailPane) parent;
|
||||
if (p.getSelectedADTabpanel() != null && p.getSelectedADTabpanel().getGridTab() == this.gridTab)
|
||||
p.setStatusMessage(tableModel.getRowCount() + " " + Msg.getMsg(Env.getCtx(), "Records"), false);
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupFields(GridTab gridTab) {
|
||||
|
@ -290,6 +310,8 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
public void activate(GridTab gridTab) {
|
||||
if (!isInit()) {
|
||||
init(gridTab);
|
||||
} else {
|
||||
showRecordsCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +351,7 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
if (paging.getTotalSize() != gridTab.getRowCount())
|
||||
paging.setTotalSize(gridTab.getRowCount());
|
||||
if (paging.getPageCount() > 1 && !gridFooter.isVisible()) {
|
||||
gridFooter.setVisible(true);
|
||||
showPagingControl();
|
||||
}
|
||||
int pgIndex = rowIndex >= 0 ? rowIndex % pageSize : 0;
|
||||
int pgNo = rowIndex >= 0 ? (rowIndex - pgIndex) / pageSize : 0;
|
||||
|
@ -359,9 +381,9 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
paging.setActivePage(pgNo);
|
||||
}
|
||||
if (paging.getPageCount() == 1) {
|
||||
gridFooter.setVisible(false);
|
||||
hidePagingControl();
|
||||
} else {
|
||||
gridFooter.setVisible(true);
|
||||
showPagingControl();
|
||||
}
|
||||
if (rowIndex >= 0 && pgIndex >= 0) {
|
||||
echoOnPostSelectedRowChanged();
|
||||
|
@ -370,7 +392,17 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
if (rowIndex >= 0) {
|
||||
echoOnPostSelectedRowChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hidePagingControl() {
|
||||
if (gridFooter.isVisible())
|
||||
gridFooter.setVisible(false);
|
||||
}
|
||||
|
||||
private void showPagingControl() {
|
||||
if (!gridFooter.isVisible())
|
||||
gridFooter.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -530,20 +562,20 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
paging.setPageSize(pageSize);
|
||||
paging.setTotalSize(tableModel.getRowCount());
|
||||
paging.setDetailed(true);
|
||||
gridFooter.appendChild(paging);
|
||||
gridFooter.setSclass("adtab-grid-south");
|
||||
paging.setId("paging");
|
||||
gridFooter.appendChild(paging);
|
||||
paging.addEventListener(ZulEvents.ON_PAGING, this);
|
||||
renderer.setPaging(paging);
|
||||
if (paging.getPageCount() == 1) {
|
||||
gridFooter.setVisible(false);
|
||||
hidePagingControl();
|
||||
} else {
|
||||
gridFooter.setVisible(true);
|
||||
}
|
||||
paging.setId("paging");
|
||||
showPagingControl();
|
||||
}
|
||||
positionPagingControl();
|
||||
}
|
||||
else
|
||||
{
|
||||
gridFooter.setVisible(false);
|
||||
hidePagingControl();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1055,4 +1087,38 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onADTabPanelParentChanged() {
|
||||
positionPagingControl();
|
||||
}
|
||||
|
||||
private void positionPagingControl() {
|
||||
if (isDetailPane()) {
|
||||
Component parent = this.getParent();
|
||||
while (parent != null) {
|
||||
if (parent instanceof Tabpanel) {
|
||||
Component firstChild = parent.getFirstChild();
|
||||
if ( gridFooter.getParent() != firstChild ) {
|
||||
firstChild.appendChild(gridFooter);
|
||||
gridFooter.setHflex("0");
|
||||
gridFooter.setSclass("adwindow-detailpane-adtab-grid-south");
|
||||
}
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
if (paging != null)
|
||||
paging.setDetailed(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gridFooter.getParent() != this) {
|
||||
gridFooter.setHflex("1");
|
||||
gridFooter.setSclass("adtab-grid-south");
|
||||
appendChild(gridFooter);
|
||||
}
|
||||
if (paging != null)
|
||||
paging.setDetailed(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -856,6 +856,23 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
|||
background-color: #D3D3D3;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-adtab-grid-south {
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-adtab-grid-south .z-paging {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.adwindow-detailpane-adtab-grid-south .z-paging .z-paging-inp {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.adwindow-gridview-detail {
|
||||
height: 200px;
|
||||
}
|
||||
|
@ -956,6 +973,10 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
|||
background-image: none !important;
|
||||
}
|
||||
|
||||
div.z-column-cnt, div.z-grid-header div.z-auxheader-cnt {
|
||||
padding: 4px 2px 3px;
|
||||
}
|
||||
|
||||
.form-label
|
||||
{
|
||||
text-align: right;
|
||||
|
|
Loading…
Reference in New Issue