From 83402399752977a3c17e206f9f98504d29efe7c4 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 11 Feb 2008 11:37:41 +0000 Subject: [PATCH] [ adempiere-Bugs-1891037 ] Tab: if initially grid mode, then no data is displayed --- client/src/org/compiere/grid/GridController.java | 6 +++--- client/src/org/compiere/grid/ed/VString.java | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index 008c20a2ff..5be99fe195 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -939,9 +939,9 @@ public class GridController extends CPanel */ if (comp instanceof VString){ VString vs = (VString)comp; - if ((vs.getVFormat() != null && mField.getVFormat() == null) - || (vs.getVFormat() == null && mField.getVFormat() != null) - || (vs.getVFormat() != null && !vs.getVFormat().equals(mField.getVFormat()))) { + if ((vs.getVFormat() != null && vs.getVFormat().length() > 0 && mField.getVFormat() == null) + || (vs.getVFormat() == null && mField.getVFormat() != null && mField.getVFormat().length() > 0) + || (vs.getVFormat() != null && mField.getVFormat() != null && !vs.getVFormat().equals(mField.getVFormat()))) { vs.setVFormat(mField.getVFormat()); } } diff --git a/client/src/org/compiere/grid/ed/VString.java b/client/src/org/compiere/grid/ed/VString.java index 5b104e00d1..84b93ba071 100644 --- a/client/src/org/compiere/grid/ed/VString.java +++ b/client/src/org/compiere/grid/ed/VString.java @@ -276,7 +276,11 @@ public final class VString extends CTextField } catch(ClassCastException ex ){ log.fine("VString.setVFormat - No caret Listeners"); } + + //hengsin: [ adempiere-Bugs-1891037 ], preserve current data before change of format + String s = getText(); setDocument(new MDocString(m_VFormat, m_fieldLength, this)); + setText(s); } // setVFormat /**