RE: problem with selectedObject of EOFormController in Java Client
RE: problem with selectedObject of EOFormController in Java Client
- Subject: RE: problem with selectedObject of EOFormController in Java Client
- From: <email@hidden>
- Date: Thu, 2 Sep 2004 10:26:06 +0200
- Thread-topic: problem with selectedObject of EOFormController in Java Client
Jaime,
In the constructor it is definetly too early to get hold of the selected object.
You might get it when the display group is set on the controller.
However, as the application reacts to user interaction the selected object might change. To keep the full flexibility of the Java client application you should add an observer to the display group:
/** Overridden here to register a delayed observer watching the main display group.
*
* @see com.webobjects.eoapplication.EOEntityController#startListeningToDisplayGroup()
*/
protected void startListeningToDisplayGroup()
{
if (_displayGroupObserver == null)
{
EOObserverCenter.addObserver(_displayGroupObserver = new Observer(), displayGroup());
}
super.startListeningToDisplayGroup();
}
/** Overridden here to unregister our delayed observer on the main display group.
*
* @see com.webobjects.eoapplication.EOEntityController#stopListeningToDisplayGroup()
*/
protected void stopListeningToDisplayGroup()
{
if (_displayGroupObserver != null)
{
EOObserverCenter.removeObserver(_displayGroupObserver, displayGroup());
EODelayedObserverQueue.defaultObserverQueue().dequeueObserver(_displayGroupObserver);
_displayGroupObserver = null;
}
super.stopListeningToDisplayGroup();
}
// Inner classes
/** Observer for the main display group.
*
*/
protected class Observer extends EODelayedObserver
{
/* Delayed notification
*
* @see com.webobjects.eocontrol.EODelayedObserver#subjectChanged()
*/
public void subjectChanged()
{
LignesController.this.mainDisplayGoupChanged();
}
}
BTW, controllers do have methods along the lines of 'awake': controllerDidLoadArchive(), connectionWasEstablished()
Pierre
-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Jaime Magiera
Sent: Thursday, September 02, 2004 8:20 AM
To: email@hidden
Subject: problem with selectedObject of EOFormController in Java Client
I can get the selectedObject() of an EOFormController after the
interface has been drawn and the values are displayed. However, this
returns null:
public JCMediaProjectFormWindowController(EOXMLUnarchiver unarchiver) {
super(unarchiver);
aProject = selectedObject();
}
How do I get the selectedObject() before everything gets drawn/loaded?
I'd need to use it in code beforehand. (I noticed the client side
doesn't have awake() or anything similar).
Jaime
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.