From 0d05606682f81f274bc92b2803944d6fe89197b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Tak=C3=A1cs?= <93127072+PeterTakacs300@users.noreply.github.com> Date: Tue, 9 Aug 2022 09:08:17 +0200 Subject: [PATCH] IDEMPIERE-5362 - Attribute Dialog UX improvments 2022 aug (#1418) * IDEMPIERE-5362 - Attribute Dialog should use scroll when many attributes * IDEMPIERE-5362 - adding max height to dialog --- .../webui/window/WPAttributeDialog.java | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java index 8aec45d377..75e4c0d61a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeDialog.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.logging.Level; +import org.adempiere.webui.ClientInfo; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.Button; @@ -79,9 +80,11 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Borderlayout; +import org.zkoss.zul.Cell; import org.zkoss.zul.Center; import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menupopup; +import org.zkoss.zul.North; import org.zkoss.zul.South; import org.zkoss.zul.Space; @@ -122,6 +125,7 @@ public class WPAttributeDialog extends Window implements EventListener this.setBorder("normal"); this.setShadow(true); this.setSizable(true); + this.setMaximizable(true); if (log.isLoggable(Level.CONFIG)) log.config("M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID + ", M_Product_ID=" + M_Product_ID @@ -202,6 +206,8 @@ public class WPAttributeDialog extends Window implements EventListener private Borderlayout mainLayout = new Borderlayout(); private Panel centerPanel = new Panel(); private Grid centerLayout = new Grid(); + private Panel northPanel = new Panel(); + private Grid northLayout = new Grid(); private ConfirmPanel confirmPanel = new ConfirmPanel (true); private String m_columnName = null; @@ -215,6 +221,17 @@ public class WPAttributeDialog extends Window implements EventListener mainLayout.setParent(this); ZKUpdateUtil.setHflex(mainLayout, "1"); ZKUpdateUtil.setVflex(mainLayout, "min"); + if (ClientInfo.maxHeight(600)) + mainLayout.setStyle("max-height: 100%;"); + else + mainLayout.setStyle("max-height: 600px;"); + + North north = new North(); + north.setSclass("dialog-content"); + north.setParent(mainLayout); + ZKUpdateUtil.setVflex(northPanel, "min"); + ZKUpdateUtil.setHflex(northPanel, "min"); + north.appendChild(northPanel); Center center = new Center(); center.setSclass("dialog-content"); @@ -222,6 +239,7 @@ public class WPAttributeDialog extends Window implements EventListener ZKUpdateUtil.setVflex(centerPanel, "min"); ZKUpdateUtil.setHflex(centerPanel, "min"); center.appendChild(centerPanel); + center.setAutoscroll(true); South south = new South(); south.setSclass("dialog-footer"); @@ -230,6 +248,8 @@ public class WPAttributeDialog extends Window implements EventListener centerPanel.appendChild(centerLayout); centerLayout.setOddRowSclass("even"); + northPanel.appendChild(northLayout); + northLayout.setOddRowSclass("even"); // confirmPanel.addActionListener(Events.ON_CLICK, this); addEventListener(Events.ON_CANCEL, e -> onCancel()); @@ -252,6 +272,9 @@ public class WPAttributeDialog extends Window implements EventListener column.setParent(columns); ZKUpdateUtil.setWidth(column, "70%"); + Rows northRows = new Rows(); + northRows.setParent(northLayout); + Rows rows = new Rows(); rows.setParent(centerLayout); @@ -298,10 +321,13 @@ public class WPAttributeDialog extends Window implements EventListener if (m_productWindow) { Row row = new Row(); - row.setParent(rows); + row.setParent(northRows); + Cell cell = new Cell(); + cell.setWidth("29%"); cbNewEdit.setLabel(Msg.getMsg(Env.getCtx(), "EditRecord")); cbNewEdit.addEventListener(Events.ON_CHECK, this); - row.appendChild(cbNewEdit); + cell.appendChild(cbNewEdit); + row.appendChild(cell); String sql = "SELECT M_AttributeSetInstance_ID, Description" + " FROM M_AttributeSetInstance" @@ -321,7 +347,7 @@ public class WPAttributeDialog extends Window implements EventListener ZKUpdateUtil.setHflex(existingCombo, "1"); row = new Row(); - row.setParent(rows); + row.setParent(northRows); LayoutUtils.addSclass("txt-btn", bNewRecord); bNewRecord.addActionListener(this); row.appendChild(bNewRecord); @@ -362,7 +388,7 @@ public class WPAttributeDialog extends Window implements EventListener bSelect.addEventListener(Events.ON_CLICK, this); row.appendChild(bSelect); ZKUpdateUtil.setHflex(bSelect, "1"); - rows.appendChild(row); + northRows.appendChild(row); // All Attributes MAttribute[] attributes = as.getMAttributes (true); @@ -378,7 +404,7 @@ public class WPAttributeDialog extends Window implements EventListener row.setParent(rows); m_row++; Label label = new Label (Msg.translate(Env.getCtx(), "Lot")); - row.appendChild(label); + row.appendChild(label.rightAlign()); row.appendChild(fieldLotString); ZKUpdateUtil.setHflex(fieldLotString, "1"); fieldLotString.setText (m_masi.getLot()); @@ -399,7 +425,7 @@ public class WPAttributeDialog extends Window implements EventListener row = new Row(); row.setParent(rows); m_row++; - row.appendChild(label); + row.appendChild(label.rightAlign()); row.appendChild(fieldLot); ZKUpdateUtil.setHflex(fieldLot, "1"); if (m_masi.getM_Lot_ID() != 0) @@ -450,7 +476,7 @@ public class WPAttributeDialog extends Window implements EventListener row.setParent(rows); m_row++; Label label = new Label (Msg.translate(Env.getCtx(), "SerNo")); - row.appendChild(label); + row.appendChild(label.rightAlign()); row.appendChild(fieldSerNo); ZKUpdateUtil.setHflex(fieldSerNo, "1"); fieldSerNo.setText(m_masi.getSerNo()); @@ -482,7 +508,7 @@ public class WPAttributeDialog extends Window implements EventListener fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate(true)); else fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate()); - row.appendChild(label); + row.appendChild(label.rightAlign()); row.appendChild(fieldGuaranteeDate); } // GuaranteeDate @@ -517,7 +543,7 @@ public class WPAttributeDialog extends Window implements EventListener fieldDescription.setReadonly(true); Row row = new Row(); row.setParent(rows); - row.appendChild(label); + row.appendChild(label.rightAlign()); row.appendChild(fieldDescription); ZKUpdateUtil.setHflex(fieldDescription, "1");