Adempiere Java Swing user interface, there's a bug when user edit a field and moves to another tab without leaving editor control.
The editor control doesn't fire the lost focus event, this cause that the toolbar enables the buttons Undo and Save, as if a change is made by the user, but Save and Undo does't work as the system is in a bad state.
I solved the bug by execute the lostfocus before the statechange event (statechange is fired when the user change the tab)
Here the piece of code that I added to APanel.Java source method stateChange to solve the problem:
/**************************************************************************
* Change Listener - (tab change) <->
* @param e event
*/
public void stateChanged (ChangeEvent e)
{
//......MAT0::Begin
//Run LostFocus Event when change tab
if (m_curWinTab != null)
{
Component cp = m_window.getFocusOwner();
if (cp != null){
m_window.dispatchEvent(new FocusEvent(cp, FocusEvent.FOCUS_LOST));
}
}
//......MAT10::End
To simulate the error execute the follow steps:
1) Open a window e.g.: Table & Column
2) Select a record and open the Tab Colum
3) Select a Column ad write something into the field description
4) without leave the field 'Description' select another tab
You notice that in the toolbar the Undo button and the Save Button are activated, but if you click them nothing appens