• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Obtaining the elementID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining the elementID


  • Subject: Re: Obtaining the elementID
  • From: King Chung Huang <email@hidden>
  • Date: Thu, 27 Oct 2005 20:17:08 -0600

There is a undocumented method called _subcomponentForElementWithID (String id) in WOComponent that will return a subcomponent of the current component with the given context id. But, as Chuck said, this is not reliable if there are state changes that affect how the page gets generated (ie: the context ids would change). It'd be better to just assign your own identifiers that are independent of page generation to the elements you want to be able to target and create a lookup table (eg: a dictionary) that you can call to resolve element references.

King Chung Huang
Learning Commons
University of Calgary

On Oct 26, 2005, at 12:59 PM, Chuck Hill wrote:

Some more thoughts on why this is the way it is and why there is no componentForElementID(String id) method on WOComponent:

You could hack something out by doing this:


public WOActionResults invokeAction( WOContext aContext, WORequest aRequest ) {

if ( aContext.senderID().equals( aContext.elementID() ) ) {
aContext().page().registerComponentForElementID(this, aContext.elementID());
}
return super.invokeAction(aContext, aRequest);
}



But you would run into problems with stateless components and dynamic elements as their state depends on the exact state of the tree traversal when they are accessed. And the element you are trying to access may have been hidden during another phase leading to inconsistencies down the line and the introduction of security breaches.


Chuck


On Oct 26, 2005, at 11:49 AM, Stephane Guyot wrote:


Miguel,

Have a look on the examples : /Developer/Examples/JavaWebObjects/ Frameworks/WOComponentElements
In WXActionURL.java you have exactly what you a looking for :



/**
* Override of invokeAction method - this method is used to perform the action
* from the bindings. This method matches the sender ID with the element ID
* (to ensure this is the instance we want) and then returns the action from
* the bindings.
*/


public WOActionResults invokeAction( WOContext aContext, WORequest aRequest ) {

        if ( aContext.senderID().equals( aContext.elementID() ) ) {
            return (WOActionResults)valueForBinding( "action" );
        }
        return null;
    }

}

HTH,
Stephane

Le 25 oct. 05, à 00:33, Miguel Arroz a écrit :



Hi!

I'm trying some AJAX stuff, and I need to work with the element IDs of the objects. While building the page, i just ask the context what is the current elementID(). But how do I do the reverse operation? How can I ask the context what is the object associated with some ID?

  Yours

Miguel Arroz

"The world lies in the hands of evil
 And we pray it would last" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--
Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40shaw.ca


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Obtaining the elementID (From: Miguel Arroz <email@hidden>)
 >Re: Obtaining the elementID (From: Stephane Guyot <email@hidden>)
 >Re: Obtaining the elementID (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Problem trying to get a WO Java CLient app to run
  • Next by Date: Re: Problem trying to get a WO Java CLient app to run
  • Previous by thread: Re: Obtaining the elementID
  • Next by thread: where to download ERChangeNotificationJMS
  • Index(es):
    • Date
    • Thread