Adempiere Apanel bug

07/15/2014 My solution is now part of the Adempiere official source code:

[ADEMPIERE-140] APanel statechange bug - ADempiere Issue Tracker - Google Chrome_055
[ADEMPIERE-140] APanel statechange bug - ADempiere Issue Tracker - Google Chrome_054

My customer showed me a bug of the Adempiere Java GUI.

To replicate the bug in Adempiere version 3.6 and 3.7 please follow those steps:

1 – login and open a window, e.g ‘Table and Colum’
2 – select a record and open the tab ‘Column’
3 – select a Column ad write something into the field ‘Description’
4 – without leave the field ‘Description’ select another tab (e.g. tab ‘Table’)

After that you could notice that both Save and Undo button are actives, as if there are some changes to save, but if you click on them nothing happens

Table and Column  Asset  SuperUser (System Administrator) @ System.* [127.0.0.1{localhost-texoradp-adempiere}]_156

That becouse there is an error in the Apanel class.

After some hours spent into debugging I have find this simple solution:
raise the FOCUS_LOST event at the beginning of the state changed event (the ‘state changed’ event is fired when the user moves from one tab to another one).
By that the result is that before moving to the new selected tab Adempiere asks to save changes or undo.

Here the source code of the patch:

	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 download the patch: http://sourceforge.net/tracker/?func=detail&aid=3598464&group_id=176962&atid=879334

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s