I have a Java-Client application that has several panels in a single window in a master-detail interface. In order to speed the opening of a window, I have a mechanism whereby only display groups shown on a panel are fetched. When the user clicks a tab, the display groups on the newly displayed panel are fetched.
The way I do this is to have a display group delegate for each panel, which delegates for the display groups on that panel with the following scheme:
public class Panel_delegate {
public Panel_delegate (NSArray /*[EODisplayGroup]*/ dgs) { super (); display_groups = dgs;
if (display_groups != null) { java.util.Enumeration e = display_groups.objectEnumerator ();
while (e.hasMoreElements ()) { EODisplayGroup d = (EODisplayGroup)e.nextElement (); // ((EODisplayGroup)e.nextElement ()).setDelegate (this); d.setDelegate (this); d.setFetchesOnLoad (false); Service.log(this, " optimistic "+d.usesOptimisticRefresh()); Service.log(this, " validates "+d.validatesChangesImmediately()); d.setUsesOptimisticRefresh (false); } } }
protected boolean load_data = false; protected NSArray /*[EODisplayGroup]*/ display_groups;
public boolean displayGroupShouldFetch (EODisplayGroup group) { Service.log (this, " should fetch "+load_data+group.fetchesOnLoad ()+display_groups); return load_data; }
public boolean displayGroupShouldRedisplay (EODisplayGroup group, NSNotification notification) { Service.log (this, " should redisplay "+load_data+group.fetchesOnLoad ()+display_groups); return load_data; }
public boolean displayGroupShouldRefetch (EODisplayGroup group, NSNotification notification) { Service.log (this, " should refetch "+load_data+group.fetchesOnLoad ()+display_groups); return load_data; }
public void fetch () { Service.log (this, " fetch "+display_groups); load_data = true;
if (display_groups != null) { java.util.Enumeration e = display_groups.objectEnumerator ();
while (e.hasMoreElements ()) { fetch_display_group ((EODisplayGroup)e.nextElement ()); } } }
set up by the call
contacts_delegate = new Panel_delegate (new NSArray (new Object [] {telephones_display_group, addresses_display_group, email_display_group}));
There is also the master display group (displayGroup ()), and my problem is that when a change is made to a field in that group (the user types and then tabs or clicks in another field), the above mechanism is circumvented and fetches are done on all the other display groups, which results in a noticeable pause before the user can proceed.
I have tried various combinations of passing true and false to setUsesOptimisticRefresh and setValidatesChangesImmediately:
displayGroup ().setUsesOptimisticRefresh (false); displayGroup ().setValidatesChangesImmediately (true);
and set the check boxes for these in Interface Builder, but no luck. Can anyone tell me a way of really suppressing fetches on EODisplayGroups?
Thanks Ian Joyner Sportstec |