[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Problems with FIXGRIDList and automatically detect changes mechanism  XML
Forum Index -> Development
Author Message
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

Hello,

we use the mechanism to automatically detect value changes. If changes were detected a YESNOPopup is shown.

If the user clicks yes the changes are saved and the same item is displayed. If the user clicks cancel then nothing should happen. But that nothing should happen works not properly.

We use a FIXGRIDList. The user clicks on another row. The popup is shown and then the user clicks on cancel.

public class DelayedSelectionFIXGRIDListBinding<T extends AbstractDelayedSelectionFIXGRIDItem> extends FIXGRIDListBinding<T> {
  @Override
  public void selectItem(final IFIXGRIDItem item) {
    YESNOPopup popup = YESNOPopup.createInstance(
      new IYesNoCancelListener() {
        public void reactOnCancel() {
            ...
        }
  ...
}

What to do in the reactOnCancel() Method? At the moment we use m_lastSelected.setSelected(true);

The problem is that the last action is the mouseclick from the user on a row. If I switch to another window e.g. Firefox and then I switch back this mouslick is executed.

Any ideas?


Thanks,
Ralph
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

Hi,

I understand most of it, but maybe not "everything":

The user clicks on a grid item that e.g. selects something different. A popup comes up and asks if to save changes of the currenlty processed items.

The user presses "cancel" which means, he/she wants to stay with the current item.

Consequently you need to re-select in the grid the item that is currently visible. Re-selection should be made in the following way:

Code:
    gridList.deselectCurrentSelection();
    gridList.selectItem(previousItem);
 


It must NOT be done in the way:
Code:
    previousItem.setSelected(true);
 


Background: the gridList internally keeps a Set of selected items which needs to be synched with the selcted-booleans within the items. THis is only done when using the gridList.selectItem() method (which interally calls item.setSelected(true)).

After re-selecting the preivuos item everything should be fine.


...maybe the hint with doing the selection properly is already the solution for your problem???

Björn

Björn Müller, CaptainCasa GmbH
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

Hello,

your proposal was our first solution but then we reload our detail pane.

e.g. the user changes a name in the detail pane. Then the user clicks another row in the FIXGRIDList, then we call
gridList.selectItem(previousItem);

Now the old item is called but the actual changes are lost.
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

...yes, the selectItem(..) does the same as the normal click of the user (and now I understood, what you are talking about).

We could provide a second "selectItem(true/false)" method in which you specify if you want to process the normal click processing or not.

As altenative you can of course define a flag within your coding like this:

Code:
     boolean m_keepQuiet = false;
 
     ...
     public void onRowSelect()
     {
         if (m_keepQuiet == true) return;
     }
 
     ...
     m_keepQuiet = true;
     gridList.selectItem(previousItem);
     m_keepQuiet = false;
 


I think to provide this extended select method (with boolean) is of general interest, so we will add it short term. OK?

Björn

Björn Müller, CaptainCasa GmbH
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5516
Offline

...this is the method from next update on. Available on request of course:

Code:
     /**
      * Selectes an item.
      * 
      * @param withSelectionProcessingInApplication
      * If set to true then the normal selection processing is executed - just as
      * if the item was selected by the user within the user interface client.
      * If set to false then the normal selection processing is not executed - the
      * method "onRowSelect" on item level will not be called consequently.
      */
     public void selectItem(IFIXGRIDItem item, boolean withSelectionProcessingInApplication)
     {
         CLog.L.log(CLog.LL_INF,"Select item: " + m_objectBinding);
         item.setSelected(true);
         m_selectedItems.add((itemClass)item);
         if (withSelectionProcessingInApplication == true)
             item.onRowSelect();
     }
 


Björn

Björn Müller, CaptainCasa GmbH
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

Hello Björn,

thanks a lot for your help. This method should solve our problem.


Ralph
[WWW]
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

Hello Björn,

I used this method but there is still a problem.

The user clicks on a grid item that e.g. selects something different. A popup comes up and asks if to save changes of the currenlty processed items.

The user presses "cancel" which means, he/she wants to stay with the current item.

The onCancel() Method call
gridList.deselectCurrentSelection();
gridList.selectItem(previousItem, false);

Now the user switches to another window, e.g. Firefox and switches back. Then the popup comes up again and asks if to save changes. This happens also in other cases, e.g. if I delete this item. But this happens not if I click first in e.g. a textfield.


Any ideas?
[WWW]
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team