On 2011-11-28, at 10:30 AM, Markus Ruggiero wrote:

> 
> On 28.11.2011, at 18:05, David Holt wrote:
> 
>> You should be able to put it in your session (ERXThreadStorage for example) 
>> and access it from there:
>> 
>> pageConfiguration='EditMyEntity' and session.selectedEntity.kind = 'blah' => 
>> displayPropertyKeys = ....
> 
> Great - and then the  silly question: How do I put it there? Please some hand 
> holding :-(


These are methods I use in my Session class:


    protected Project _selectedProject;

    public Project selectedProject() {
        return _selectedProject;
    }

    public void setSelectedProject(Project selectedProject) {
        _selectedProject = selectedProject;
        ERXThreadStorage.takeValueForKey(selectedProject(), "selectedProject");
    }

    public void awake() {
        super.awake();
        // if we have a selected project, keep track of it
        if (selectedProject() != null) {
                ERXThreadStorage.takeValueForKey(selectedProject(), 
"selectedProject");
        }
    }

    public void sleep() {
        ERXThreadStorage.takeValueForKey(null, "selectedProject");    
        super.sleep();
    }

Then when you want to select the Entity you would do something like this (here 
I have a custom select component in a ListProject configuration) and I return a 
page with the list of activities that are associated with the selected project. 
You'll have to figure out where it makes sense for your entity to be selected 
in your app.

        public WOComponent view() {
                Project selectedProject = (Project) object(); 
                ((Session)session()).setSelectedProject(selectedProject);
                return (WOComponent) 
((Session)session()).navController().listActivities();
        }

You will find additional examples in BugTracker and SimpleBlog. 

d

> 
> ---markus---
> 
>> 
>> On 2011-11-28, at 8:24 AM, Markus Ruggiero wrote:
>> 
>>> I need a rule like the following (pseudo code):
>>> 
>>> pageConfiguration='EditMyEntity' and {the MyEntityObject has a value of 
>>> 'SOMETHING' in its KIND-attribute} => displayPropertyKeys = ....
>>> 
>>> Background:
>>> 
>>> I have dozens of ElectronicDocuments. Each has a to-one reference to a 
>>> DocumentType (there are many many such types). All documents behave the 
>>> same, and the user is free to change the document type. However for one 
>>> type of document I need to have different displayPropertyKeys.
>>> 
>>> Thanks a lot
>>> ---markus--- _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>> 
>>> This email sent to programming...@mac.com
>> 
>> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to