diff --git a/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java b/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java index 18251591d4..0327477f1a 100644 --- a/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java +++ b/org.adempiere.base/src/org/compiere/model/DataStatusEvent.java @@ -20,6 +20,8 @@ import java.io.Serializable; import java.sql.Timestamp; import java.util.EventObject; +import org.idempiere.fa.util.Util; + /** * Data Status Event *

@@ -337,4 +339,17 @@ public final class DataStatusEvent extends EventObject implements Serializable return m_confirmed; } // isConfirmed + public boolean isEqual(DataStatusEvent e) { + if (e == null) return false; + + return e.m_changed == m_changed && + e.m_inserting == m_inserting && + e.m_isError == m_isError && + e.m_isWarning == m_isWarning && + Util.equals(e.m_AD_Message, m_AD_Message) && + e.m_changedColumn == m_changedColumn && + Util.equals(e.m_columnName, m_columnName) && + e.m_currentRow == m_currentRow; + } + } // DataStatusEvent diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 3e83e0232e..87f45a2fc0 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -2227,7 +2227,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable * @param e event */ public void dataStatusChanged (DataStatusEvent e) - { + { if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo + " - " + e.toString()); int oldCurrentRow = e.getCurrentRow(); m_DataStatusEvent = e; // save it @@ -2238,6 +2238,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable // set current row m_DataStatusEvent = e; // setCurrentRow clear it, need to save again m_DataStatusEvent.setCurrentRow(m_currentRow); + // Same row - update value if (oldCurrentRow == m_currentRow) { @@ -2248,8 +2249,25 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable field.setValue(value, m_mTable.isInserting()); } } - else // Redistribute Info with current row info - fireDataStatusChanged(m_DataStatusEvent); + else + { + // Redistribute Info with current row info + // Avoid firing of duplicate event + boolean fire = true; + if (m_lastDataStatusEvent != null) + { + if (System.currentTimeMillis() - m_lastDataStatusEventTime < 200) + { + if (m_lastDataStatusEvent.isEqual(m_DataStatusEvent)) + { + fire = false; + } + } + } + + if (fire) + fireDataStatusChanged(m_DataStatusEvent); + } //reset m_lastDataStatusEventTime = System.currentTimeMillis(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java index be306888f9..b81cdbfc93 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Messagebox.java @@ -28,6 +28,7 @@ import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Util; import org.zkoss.zhtml.Text; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -244,7 +245,20 @@ public class Messagebox extends Window implements EventListener this.setSizable(true); this.setVisible(true); - this.setId("MessageBox_"+AdempiereIdGenerator.escapeId(title)); + String id = "MessageBox_"+AdempiereIdGenerator.escapeId(title); + //make sure id is unique + Page page = AEnv.getDesktop().getFirstPage(); + Component fellow = page.getFellowIfAny(id); + if (fellow != null) { + int count = 0; + String newId = null; + while (fellow != null) { + newId = id + "_" + ++count; + fellow = page.getFellowIfAny(newId); + } + id = newId; + } + this.setId(id); AEnv.showCenterScreen(this); return returnValue; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java index f9da63ba1c..19a2a6b905 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/GridTabDataBinder.java @@ -195,9 +195,9 @@ public class GridTabDataBinder implements ValueChangeListener { for (int i = 0; i < values.length; i++) { - if (!gridTab.dataNew(true)) + if (!gridTab.dataNew(false)) { - throw new IllegalStateException("Could not clone tab"); + throw new IllegalStateException("Could not create new row"); } gridTab.setValue(columnName, values[i]); @@ -209,10 +209,9 @@ public class GridTabDataBinder implements ValueChangeListener { if (!gridTab.dataSave(false)) { - throw new IllegalStateException("Could not update tab"); - } - - gridTab.setCurrentRow(oldRow); + throw new IllegalStateException("Could not update row"); + } } + gridTab.setCurrentRow(oldRow); } -} +} \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java index cadf38fcd9..4de586ef09 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FDialog.java @@ -62,7 +62,7 @@ public class FDialog if (message != null && message.length() > 0) { - out.append("\n").append(message); + out.append("
").append(message); } return out;