Re: D2W and non-relational insertion lists.

2011-02-16 Thread Joe Little
I won't be setting a relationship to that Person type, but want to
fill in the values. I can't assume these will be set on creation
either, just if the properties are null (whether on creation of entity
or later when editing). My thinking is the modern approach is some
sort of ajax live search on the text field, where the search is made
against self.company.affiliates.fullName, but also where any of
company, affiliates, etc is potentially null at this point of the
search.

My mind can grok how to setup something like this in the standard WO
component model, but all I have to work with are derived pages from
rules, and thus not sure how either the non-search approach I
originally laid out (trivial) or this ajax approach is doable in the
D2W world.


On Tue, Feb 15, 2011 at 11:50 PM, Mark Wardle m...@wardle.org wrote:
 Hi Joe.

 I may have interpreted this incorrectly but I'll try some suggestions.

 I don't think your issue is a D2W problem per se.

 I would consider this a modelling one - if a membership is linked to a
 user but you want some details copied in to the membership on
 creation, then can't you do that as part of the setUser() setter in
 your membership with a check not to overwrite if there's already  a
 value for that (those) properties.

 Mark

 --
 Dr. Mark Wardle
 Specialist registrar, Neurology
 (Sent from my mobile)


 On 16 Feb 2011, at 05:49, Joe Little jmlit...@gmail.com wrote:

 Ok, I'll try to give a more specific example.

 I have a Membership entity with such properties as beginDate, endDate,
 company (relationship) and primaryContactName and primaryContactEmail.
 The end users want to select these last two values from a pull down
 list of known company.Affiliates, where Affiliates are people with
 name, email, etc.

 However, affliates move around so they want to store those values
 relative to one this membership whenever its created, so five years
 from now, those values stick. A slightly better example is Projects
 who have among other thing a String property of VisitingScholar or
 Fellow, which is just the name of an Affiliate again. In the same way,
 they want this name to stick with project even if that Affiliate
 changes companies or disappears altogether. I've done this before, but
 have no clue of how to do this with D2W. I want one to be able to set
 the value when say primaryContactName == null via a pull down of
 current company.Affiliates if company itself is != null, and then
 later, allow for just standard text field manipulation.


 On Tue, Feb 15, 2011 at 9:17 PM, David Holt programming...@me.com wrote:
 I'd love to help but this makes no sense to me at all.

 Can you be more specific? What are your entities?


 On 2011-02-15, at 8:49 PM, Joe Little jmlit...@gmail.com wrote:

 I want the certain fields (String) to take the values from a pull down
 from another Entity, inserting Entity.name or Entity.type for the
 string on selection. I don't want a relation since the choices are to
 be archival and not reflect what Entity.type is presently, but what it
 was at time of creation/edit. I was wondering how this is normally
 done with D2W rules. Also, I was hoping to do this on initial setting
 of the property only, but allow free-form editing when not null. I'm
 presuming pull downs like this are par for the coarse, but haven't
 found ready examples to point me to the right d2w keys.
 ___
 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/mark%40wardle.org

 This email sent to m...@wardle.org

 ___
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 and non-relational insertion lists.

2011-02-16 Thread David LeBer
You have a bit of a workflow going on in that requirement.

- If property is null, provide selectable list of string values obtained from 
an arbitrary entity.
- If property is not null allow its string value to be edited free from.

In addition you will need to handle:

- Do you need to be able to supply a qualifier to restrict the list of values
- Do you need the ability to clear the selected value, and pick a new one from 
the list

As such, I don't believe there is a pre-baked D2W component that will do 
exactly what you want.

So you are probably gonna have to create a custom one, the simplest route is 
documented in step 7 here:

http://wiki.objectstyle.org/confluence/display/WO/D2W+Rules+Reference+-+Cookbook+-+FAQ

Alternately, you could subclass ERDCustomComponent.
 
On 2011-02-16, at 1:00 PM, Joe Little wrote:

 I won't be setting a relationship to that Person type, but want to
 fill in the values. I can't assume these will be set on creation
 either, just if the properties are null (whether on creation of entity
 or later when editing). My thinking is the modern approach is some
 sort of ajax live search on the text field, where the search is made
 against self.company.affiliates.fullName, but also where any of
 company, affiliates, etc is potentially null at this point of the
 search.
 
 My mind can grok how to setup something like this in the standard WO
 component model, but all I have to work with are derived pages from
 rules, and thus not sure how either the non-search approach I
 originally laid out (trivial) or this ajax approach is doable in the
 D2W world.
 
 
 On Tue, Feb 15, 2011 at 11:50 PM, Mark Wardle m...@wardle.org wrote:
 Hi Joe.
 
 I may have interpreted this incorrectly but I'll try some suggestions.
 
 I don't think your issue is a D2W problem per se.
 
 I would consider this a modelling one - if a membership is linked to a
 user but you want some details copied in to the membership on
 creation, then can't you do that as part of the setUser() setter in
 your membership with a check not to overwrite if there's already  a
 value for that (those) properties.
 
 Mark
 
 --
 Dr. Mark Wardle
 Specialist registrar, Neurology
 (Sent from my mobile)
 
 
 On 16 Feb 2011, at 05:49, Joe Little jmlit...@gmail.com wrote:
 
 Ok, I'll try to give a more specific example.
 
 I have a Membership entity with such properties as beginDate, endDate,
 company (relationship) and primaryContactName and primaryContactEmail.
 The end users want to select these last two values from a pull down
 list of known company.Affiliates, where Affiliates are people with
 name, email, etc.
 
 However, affliates move around so they want to store those values
 relative to one this membership whenever its created, so five years
 from now, those values stick. A slightly better example is Projects
 who have among other thing a String property of VisitingScholar or
 Fellow, which is just the name of an Affiliate again. In the same way,
 they want this name to stick with project even if that Affiliate
 changes companies or disappears altogether. I've done this before, but
 have no clue of how to do this with D2W. I want one to be able to set
 the value when say primaryContactName == null via a pull down of
 current company.Affiliates if company itself is != null, and then
 later, allow for just standard text field manipulation.
 
 
 On Tue, Feb 15, 2011 at 9:17 PM, David Holt programming...@me.com wrote:
 I'd love to help but this makes no sense to me at all.
 
 Can you be more specific? What are your entities?
 
 
 On 2011-02-15, at 8:49 PM, Joe Little jmlit...@gmail.com wrote:
 
 I want the certain fields (String) to take the values from a pull down
 from another Entity, inserting Entity.name or Entity.type for the
 string on selection. I don't want a relation since the choices are to
 be archival and not reflect what Entity.type is presently, but what it
 was at time of creation/edit. I was wondering how this is normally
 done with D2W rules. Also, I was hoping to do this on initial setting
 of the property only, but allow free-form editing when not null. I'm
 presuming pull downs like this are par for the coarse, but haven't
 found ready examples to point me to the right d2w keys.
 ___
 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/mark%40wardle.org
 
 This email sent to m...@wardle.org
 
 ___
 Do not post 

Re: D2W and non-relational insertion lists.

2011-02-16 Thread David Holt
Hi Joe,Ignoring the workflow issues:On the edit page you could use something like:ERDEditStringWithChoicesI modifiedERDEditStringWithChoicesso that you can use a key path as well as a dictionary or array in the rules (not thoroughly tested). You may want to cloneERDEditStringWithChoicesand customize it instead:Object choices = valueForBinding("possibleChoices");  if(choices != null) {NSMutableArray keyChoices = new NSMutableArray();// choices will be a string if you have specified a keyPath in the rulesif(choices instanceof String) { String possibleChoices=(String)d2wContext().valueForKey("possibleChoices"); if( possibleChoices!=null  possibleChoices.length()0 )// get the value for the keyPath  choices = (NSDictionary)valueForKeyPath(possibleChoices);}// This results in choices being a NSDictionary grabbed from the keyPath provided.// Now you can use it as if it came from the rules:if(choices instanceof NSArray) {  for(Enumeration e = ((NSArray)choices).objectEnumerator(); e.hasMoreElements(); ) {NSDictionary dict = (NSDictionary)e.nextElement();String key = (String)dict.allKeys().lastObject();String value = (String)dict.objectForKey(key);keyChoices.addObject(new ERXKeyValuePair(key, ERXLocalizer.currentLocalizer().localizedStringForKeyWithDefault(value)));  }} else if(choices instanceof NSDictionary) {  NSArray keys = ((NSDictionary)choices).allKeys();  keys = ERXArrayUtilities.sortedArraySortedWithKey(keys, "toString");  for(Enumeration e = keys.objectEnumerator(); e.hasMoreElements(); ) {String key = (String)e.nextElement();String value = (String)((NSDictionary)choices).objectForKey(key);keyChoices.addObject(new ERXKeyValuePair(key, ERXLocalizer.currentLocalizer().localizedStringForKeyWithDefault(value)));  }}   _availableElements = keyChoices;  }Specifying the key path should give you the flexibility to programatically create a dictionary of values you need for your popup fromcurrent company.AffiliatesAgain a simple example of a method I put in my session to illustrate: public NSDictionary writtenLanguagePreference() {   NSMutableDictionary writtenLanguagePreference = new NSMutableDictionary();writtenLanguagePreference.setObjectForKey("English", "English");writtenLanguagePreference.setObjectForKey("Spanish","Spanish"); return (NSDictionary)writtenLanguagePreference;  }And the associated rules:110 : (pageConfiguration = 'ZZZ' and propertyKey = 'language') = componentName = "ERDEditStringWithChoices" [com.webobjects.directtoweb.Assignment]110 : (pageConfiguration = 'ZZZ' and propertyKey = 'language') = possibleChoices = "session.writtenLanguagePreference" [com.webobjects.directtoweb.Assignment]Results in this UI:And a string stored in the database:HTH,DavidOn 2011-02-15, at 11:50 PM, Mark Wardle wrote:Hi Joe.I may have interpreted this incorrectly but I'll try some suggestions.I don't think your issue is a D2W problem per se.I would consider this a modelling one - if a membership is linked to auser but you want some details copied in to the membership oncreation, then can't you do that as part of the setUser() setter inyour membership with a check not to overwrite if there's already avalue for that (those) properties.Mark-- Dr. Mark WardleSpecialist registrar, Neurology(Sent from my mobile)On 16 Feb 2011, at 05:49, Joe Little jmlit...@gmail.com wrote:Ok, I'll try to give a more specific example.I have a Membership entity with such properties as beginDate, endDate,company (relationship) and primaryContactName and primaryContactEmail.The end users want to select these last two values from a pull downlist of known company.Affiliates, where Affiliates are people withname, email, etc.However, affliates move around so they want to store those valuesrelative to one this membership whenever its created, so five yearsfrom now, those values stick. A slightly better example is Projectswho have among other thing a String property of VisitingScholar orFellow, which is just the name of an Affiliate again. In the same way,they want this name to stick with project even if that Affiliatechanges companies or disappears altogether. I've done this before, buthave no clue of how to do this with D2W. I want one to be able to setthe value when say primaryContactName == null via a pull down ofcurrent company.Affiliates if company itself is != null, and thenlater, allow for just standard text field manipulation.On Tue, Feb 15, 2011 at 9:17 PM, David Holt programming...@me.com wrote:I'd love to help but this makes no sense to me at all.Can you be more specific? What are your entities?On 2011-02-15, at 8:49 PM, Joe Little jmlit...@gmail.com wrote:I want the certain fields (String) to take the values from a pull downfrom another Entity, inserting Entity.name or Entity.type for thestring on 

D2W and non-relational insertion lists.

2011-02-15 Thread Joe Little
I want the certain fields (String) to take the values from a pull down
from another Entity, inserting Entity.name or Entity.type for the
string on selection. I don't want a relation since the choices are to
be archival and not reflect what Entity.type is presently, but what it
was at time of creation/edit. I was wondering how this is normally
done with D2W rules. Also, I was hoping to do this on initial setting
of the property only, but allow free-form editing when not null. I'm
presuming pull downs like this are par for the coarse, but haven't
found ready examples to point me to the right d2w keys.
 ___
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 and non-relational insertion lists.

2011-02-15 Thread Joe Little
Ok, I'll try to give a more specific example.

I have a Membership entity with such properties as beginDate, endDate,
company (relationship) and primaryContactName and primaryContactEmail.
The end users want to select these last two values from a pull down
list of known company.Affiliates, where Affiliates are people with
name, email, etc.

However, affliates move around so they want to store those values
relative to one this membership whenever its created, so five years
from now, those values stick. A slightly better example is Projects
who have among other thing a String property of VisitingScholar or
Fellow, which is just the name of an Affiliate again. In the same way,
they want this name to stick with project even if that Affiliate
changes companies or disappears altogether. I've done this before, but
have no clue of how to do this with D2W. I want one to be able to set
the value when say primaryContactName == null via a pull down of
current company.Affiliates if company itself is != null, and then
later, allow for just standard text field manipulation.


On Tue, Feb 15, 2011 at 9:17 PM, David Holt programming...@me.com wrote:
 I'd love to help but this makes no sense to me at all.

 Can you be more specific? What are your entities?


 On 2011-02-15, at 8:49 PM, Joe Little jmlit...@gmail.com wrote:

 I want the certain fields (String) to take the values from a pull down
 from another Entity, inserting Entity.name or Entity.type for the
 string on selection. I don't want a relation since the choices are to
 be archival and not reflect what Entity.type is presently, but what it
 was at time of creation/edit. I was wondering how this is normally
 done with D2W rules. Also, I was hoping to do this on initial setting
 of the property only, but allow free-form editing when not null. I'm
 presuming pull downs like this are par for the coarse, but haven't
 found ready examples to point me to the right d2w keys.
 ___
 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 and non-relational insertion lists.

2011-02-15 Thread Mark Wardle
Hi Joe.

I may have interpreted this incorrectly but I'll try some suggestions.

I don't think your issue is a D2W problem per se.

I would consider this a modelling one - if a membership is linked to a
user but you want some details copied in to the membership on
creation, then can't you do that as part of the setUser() setter in
your membership with a check not to overwrite if there's already  a
value for that (those) properties.

Mark

-- 
Dr. Mark Wardle
Specialist registrar, Neurology
(Sent from my mobile)


On 16 Feb 2011, at 05:49, Joe Little jmlit...@gmail.com wrote:

 Ok, I'll try to give a more specific example.

 I have a Membership entity with such properties as beginDate, endDate,
 company (relationship) and primaryContactName and primaryContactEmail.
 The end users want to select these last two values from a pull down
 list of known company.Affiliates, where Affiliates are people with
 name, email, etc.

 However, affliates move around so they want to store those values
 relative to one this membership whenever its created, so five years
 from now, those values stick. A slightly better example is Projects
 who have among other thing a String property of VisitingScholar or
 Fellow, which is just the name of an Affiliate again. In the same way,
 they want this name to stick with project even if that Affiliate
 changes companies or disappears altogether. I've done this before, but
 have no clue of how to do this with D2W. I want one to be able to set
 the value when say primaryContactName == null via a pull down of
 current company.Affiliates if company itself is != null, and then
 later, allow for just standard text field manipulation.


 On Tue, Feb 15, 2011 at 9:17 PM, David Holt programming...@me.com wrote:
 I'd love to help but this makes no sense to me at all.

 Can you be more specific? What are your entities?


 On 2011-02-15, at 8:49 PM, Joe Little jmlit...@gmail.com wrote:

 I want the certain fields (String) to take the values from a pull down
 from another Entity, inserting Entity.name or Entity.type for the
 string on selection. I don't want a relation since the choices are to
 be archival and not reflect what Entity.type is presently, but what it
 was at time of creation/edit. I was wondering how this is normally
 done with D2W rules. Also, I was hoping to do this on initial setting
 of the property only, but allow free-form editing when not null. I'm
 presuming pull downs like this are par for the coarse, but haven't
 found ready examples to point me to the right d2w keys.
 ___
 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/mark%40wardle.org

 This email sent to m...@wardle.org
 ___
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