Re: D2W Can I access Object property values from the rule system?

2011-12-01 Thread Markus Ruggiero
Ramsey hits again!

Thanks  a lot. The most obvious is it. Whenever I teach programming (and WO) I 
tell my students when it starts to get complicated it most probably is wrong. 
Sometimes I do not follow my own advice. 

Thanks again
---markus---

On 28.11.2011, at 18:27, Ramsey Gurley wrote:

 
 On Nov 28, 2011, at 9: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--- 
 
 You should be able to do something like 
 
 object.documentType.typeString == 'SOMETHING'
 
 Just make sure to terminate your object and session keypaths on an attribute 
 and not an eo.  I'm not aware of any special caching done for EOs in the rule 
 system, so that would likely result in a big pile of wasted memory.
 
 Ramsey
 
 

 ___
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


D2W Can I access Object property values from the rule system?

2011-11-28 Thread Markus Ruggiero
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/archive%40mail-archive.com

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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread David Holt
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 = 

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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread Ramsey Gurley

On Nov 28, 2011, at 9: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--- 

You should be able to do something like 

object.documentType.typeString == 'SOMETHING'

Just make sure to terminate your object and session keypaths on an attribute 
and not an eo.  I'm not aware of any special caching done for EOs in the rule 
system, so that would likely result in a big pile of wasted memory.

Ramsey

 ___
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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread Markus Ruggiero

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 :-(

---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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread David Holt

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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread Markus Ruggiero

On 28.11.2011, at 19:52, David Holt wrote:

 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();
   }
 

David,

Thanks a lot for your input. However my problem lies exactly here (your  view() 
action). I have  a plain auto generated ListPage and the user clicks on the 
edit-icon on one of the rows. Would I need a custom property level component 
for the edit icon so that I could put some code like yours into or is there an 
other (plain D2W) way to accomplish this? How do I intercept the action before 
the EditPage is created but after the user has clicked the selected row? 
Probably not seeing the forest for the trees anymore. When I am tired I tend to 
confuse simple things.

---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/archive%40mail-archive.com

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


Re: D2W Can I access Object property values from the rule system?

2011-11-28 Thread David Holt

On 2011-11-28, at 1:39 PM, Markus Ruggiero wrote:

 
 On 28.11.2011, at 19:52, David Holt wrote:
 
 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();
  }
 
 
 David,
 
 Thanks a lot for your input. However my problem lies exactly here (your  
 view() action). I have  a plain auto generated ListPage and the user clicks 
 on the edit-icon on one of the rows. Would I need a custom property level 
 component for the edit icon so that I could put some code like yours into

you could do this. The view() method above comes from a custom hyperlink in the 
list page.

 or is there an other (plain D2W)

You're not using Wonder??

 way to accomplish this? How do I intercept the action before the EditPage is 
 created

NextPageDelegate allows you to do some customization before returning the 
NextPage. Your list page calls this when your Edit button is pressed. I would 
do it here if you don't want a custom button.

 but after the user has clicked the selected row? Probably not seeing the 
 forest for the trees anymore. When I am tired I tend to confuse simple things.

In that case you may want to try Ramsey's suggestion before going any further 
with mine :-)

d

 
 ---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/archive%40mail-archive.com

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