diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index 5f511d4319..843123af3b 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -424,12 +424,13 @@ public class GridController extends CPanel // VEditor => this - New Editor value to be updated here (MTable) vEditor.addVetoableChangeListener(this); // Add to VPanel - vPanel.addField(vEditor, mField); + vPanel.addFieldBuffered(vEditor, mField); // APanel Listen to buttons if (mField.getDisplayType() == DisplayType.Button && m_aPanel != null) ((JButton)vEditor).addActionListener (m_aPanel); } } // for all fields + vPanel.addFieldBuffered(null, null); // flush the last one through // No Included Grid Controller /* diff --git a/client/src/org/compiere/grid/VPanel.java b/client/src/org/compiere/grid/VPanel.java index a26bdd93ad..6b174c8c94 100644 --- a/client/src/org/compiere/grid/VPanel.java +++ b/client/src/org/compiere/grid/VPanel.java @@ -173,6 +173,10 @@ public final class VPanel extends CTabbedPane } }; + private VEditor prevEditor = null; + private GridField prevField = null; + private boolean wrap = false; + /** Logger */ private static CLogger log = CLogger.getCLogger (VPanel.class); @@ -203,12 +207,27 @@ public final class VPanel extends CTabbedPane } } } // setMnemonic - + /** - * Add Field and Label to Panel + * Add Field and Label to buffer and push buffered field to Panel * @param editor editor * @param mField field model */ + public void addFieldBuffered (VEditor editor, GridField mField) + { + wrap = mField != null ? !mField.isSameLine() : false; + + if ( prevEditor != null && prevField != null) + addField(prevEditor, prevField); + prevEditor = editor; + prevField = mField; + } + /** + * Add the previous Field and Label to Panel + * @param editor editor + * @param mField field model + * @param wrap move to next line after this field + */ public void addField (VEditor editor, GridField mField) { //[ 1757088 ] @@ -266,7 +285,10 @@ public final class VPanel extends CTabbedPane // *** The Label *** if ( label == null) + { label = new CLabel(""); + label.setName(mField.getColumnName()); + } // if (mField.isCreateMnemonic()) setMnemonic(label, mField.getMnemonic()); @@ -300,6 +322,10 @@ public final class VPanel extends CTabbedPane { constraints += mField.isLongField() ? ",spanx" : ""; } + if ( wrap ) + { + constraints += ", wrap"; + } // Add Field //[ 1757088 ]