[ 1869609 ] Tabs within Collapsed Grid disabled
This commit is contained in:
parent
a841e16ad0
commit
909e6f215f
|
@ -789,6 +789,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
}
|
||||
}
|
||||
setCurrentRow(m_currentRow, true);
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_REFRESH_ALL));
|
||||
} // dataRefreshAll
|
||||
|
||||
/**
|
||||
|
@ -808,6 +809,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
log.fine("#" + m_vo.TabNo + " - row=" + row);
|
||||
m_mTable.dataRefresh(row);
|
||||
setCurrentRow(row, true);
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_REFRESH));
|
||||
} // dataRefresh
|
||||
|
||||
|
||||
|
@ -824,6 +826,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
boolean retValue = (m_mTable.dataSave(manualCmd) == GridTable.SAVE_OK);
|
||||
if (manualCmd)
|
||||
setCurrentRow(m_currentRow, false);
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_SAVE));
|
||||
return retValue;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -864,6 +867,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
log.fine("#" + m_vo.TabNo);
|
||||
m_mTable.dataIgnore();
|
||||
setCurrentRow(m_currentRow, false); // re-load data
|
||||
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_IGNORE));
|
||||
log.fine("#" + m_vo.TabNo + "- fini");
|
||||
} // dataIgnore
|
||||
|
||||
|
@ -922,6 +927,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
getField(i).validateValue();
|
||||
}
|
||||
m_mTable.setChanged(false);
|
||||
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_NEW));
|
||||
return retValue;
|
||||
} // dataNew
|
||||
|
||||
|
@ -934,6 +941,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
log.fine("#" + m_vo.TabNo + " - row=" + m_currentRow);
|
||||
boolean retValue = m_mTable.dataDelete(m_currentRow);
|
||||
setCurrentRow(m_currentRow, true);
|
||||
fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_DELETE));
|
||||
return retValue;
|
||||
} // dataDelete
|
||||
|
||||
|
@ -2591,6 +2599,22 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
m_listenerList.add(DataStatusListener.class, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param l
|
||||
*/
|
||||
public synchronized void addStateChangeListener(StateChangeListener l)
|
||||
{
|
||||
m_listenerList.add(StateChangeListener.class, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param l
|
||||
*/
|
||||
public synchronized void removeStateChangeListener(StateChangeListener l)
|
||||
{
|
||||
m_listenerList.remove(StateChangeListener.class, l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Feature Request [1707462]
|
||||
* Enable runtime change of VFormat
|
||||
|
@ -2678,4 +2702,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
navigate(to);
|
||||
}
|
||||
|
||||
private void fireStateChangeEvent(StateChangeEvent e)
|
||||
{
|
||||
StateChangeListener[] listeners = m_listenerList.getListeners(StateChangeListener.class);
|
||||
if (listeners.length == 0)
|
||||
return;
|
||||
for(int i = 0; i < listeners.length; i++) {
|
||||
listeners[i].stateChange(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // MTab
|
||||
|
|
|
@ -502,6 +502,7 @@ public class GridTable extends AbstractTableModel
|
|||
//
|
||||
m_changed = false;
|
||||
m_rowChanged = -1;
|
||||
m_inserting = false;
|
||||
return true;
|
||||
} // open
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class StateChangeEvent extends EventObject {
|
||||
|
||||
private int eventType;
|
||||
|
||||
public StateChangeEvent(Object source, int eventType) {
|
||||
super(source);
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public final static int DATA_REFRESH_ALL = 0;
|
||||
public final static int DATA_REFRESH = 1;
|
||||
public final static int DATA_NEW = 2;
|
||||
public final static int DATA_DELETE = 3;
|
||||
public final static int DATA_SAVE = 4;
|
||||
public final static int DATA_IGNORE = 5;
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public interface StateChangeListener extends EventListener {
|
||||
|
||||
public void stateChange(StateChangeEvent event);
|
||||
|
||||
}
|
Loading…
Reference in New Issue