• 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: Dynamic Direct Actions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic Direct Actions


  • Subject: Re: Dynamic Direct Actions
  • From: "Daniele Corti" <email@hidden>
  • Date: Fri, 4 May 2007 12:42:34 +0200

thank you Kieran, That's exactly what I need!

2007/5/4, Kieran Kelleher <email@hidden>:
Each direction action is called by the performActionNamed method that takes a String argument, so you can have dynamic whatever you want. Your dynamic actions are just Strings and you can store them in the db along with other metadata and write your own custom logic to do whatever you want wit those Srting "actions".

For example, here is a simple  subclass of WODirectAction that interprets the "action name" as a page name, creates the page and pushes query dictionaries into those pages if they implement a specific interface. Note there is only one method taking a String param and because I never call super, WO never creates a method name for the String to invoke a method using reflection:

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WODirectAction;
import com.webobjects.appserver.WORequest ;

/**
* @author kieran
*
*/
public class Show extends WODirectAction {
private static final org.apache.log4j.Logger log = org.apache.log4j.Logger
.getLogger(Show.class);
/**
* @param aRequest
*/
public Show(WORequest aRequest) {
super(aRequest);
}
/**
* @see com.webobjects.appserver.WODirectAction#performActionNamed(java.lang.String)
* @override we override this to actually return pages named 'name' instead of the usual
* behavior of this method which is to determine a action method name by adding 'Action'
* and invoking through reflection
* Now we can have URLs like
* /wa/Show/MyPage?oid=2345
 * Inspired by a Pierce Wetter tip.
* We also pull all the form values and stuff them into the target component
* if it implements the RailsBehaviour interface
*/
public WOActionResults performActionNamed(String name){
// Create the page
WOComponent  page = pageWithName(name);
if (page instanceof RailsBehaviour && request().formValues() != null && request().formValues().count() > 0){
((RailsBehaviour)page).takeValuesFromDictionary(request().formValues());
}
return page;
}

}






On May 4, 2007, at 5:56 AM, Daniele Corti wrote:

Hi list,
    A simple question: is there a way to generate Dynamic Direct Actions?

   I mean, I'm thinking about an application really simple: menu with links, generated by a worepetition, but I wish to use only directActions (for indexing, don't make me begin...), so I thought, there's a way to dynamically add a Direct Action to an app, this is usefull, if i'll add a backend for adding new links!

ah, of course direct action simply call


public WoActionResult   homePageAction(){
return pageWithName("HomePage");
}

not strange things ;-)


thank you for any help,

--
Daniele Corti
AIM: S0CR4TE5
Messenger: 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




--
Daniele Corti
AIM: S0CR4TE5
Messenger: 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: 
 >Dynamic Direct Actions (From: "Daniele Corti" <email@hidden>)
 >Re: Dynamic Direct Actions (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Dynamic Direct Actions
  • Next by Date: Developer Needed
  • Previous by thread: Re: Dynamic Direct Actions
  • Next by thread: Developer Needed
  • Index(es):
    • Date
    • Thread