Hi David,

I got a little closer...

It dawned on me that ERDAttributeRepetition is not a stateless component.  So 
in the component I just created an object called selectedObject and a component 
action that sets selectedObject to the item in the repetition.

So now I have it that if selectedObject is null display the list of objects 
otherwise display a ERXD2WInspect and pass in the selectedObject.  Then in my 
rule system for that entity I have the templateNameForInspectPage resolve to a 
subclass of ERD2WCompactInspectPageTemplate.  And I wrap the compact inspect 
page template in a form and handle the save.

But...

Now I'm stuck on how to reset the selected object variable.  If I do it in the 
sleep phase the form will not work because the selected object is no longer 
around.  If I do not reset the variable once I set it in the component it is 
stuck with it.

So what I ended up doing is putting the selected object variable in the top 
level component that embeds the d2w inspect, list and query components.  And 
then I just pass it up and down.  Which is kind of messy because the 
intermediate inspect page has a couple of getter setter methods that just 
passes the object up and down.

Does anybody know of a smarter way to handle this kind of situation?

Aloha,
Mr. Johnny Miller
Web Development Manager
Kahalawai Media Company
Lahaina, HI 96761
tel: (808) 661-7962 | mobile: (808) 283-0791
website | e-mail        

On May 2, 2013, at 4:10 PM, Johnny Miller <[email protected]> wrote:

> I have the power to confuse anyone when it comes to this WO/D2W!
> 
> OK.  I created a screenshot with comments and I've posted it here: 
> http://www.kahalawai.com/ToManyLink.jpg
> 
> So yes... I'm using embedded d2w components.  Each of the thumbnails is a 
> link.  When the user clicks on the thumbnail it should keep the first two 
> columns the same and in the third column keep the action bar but replace the 
> list of thumbs with a form to edit the thumbnail (or create a new one).
> 
> The model is:
> 
> Product ->> Product Images -> ERAttachment
> 
> The selected object in the display group is a "Product" the list of the 
> thumbs are Product Image eos.
> 
> I'm just trying to figure out how to put that component action in there... so 
> I keep the current selected object but I have a secondary selected object 
> somehow.
> 
> Does that help?  Or make any sense?  
> 
> Thanks,
> 
> Johnny
> 
> 
> On May 2, 2013, at 3:39 PM, David Holt <[email protected]> wrote:
> 
>> Hi Johnny,
>> 
>> Ok, I admit to now being confused.
>> 
>> Your master list is D2W? Or is it just loading embedded D2W components below 
>> it?
>> 
>> When you said "new page" I interpreted that as "new window". Not sure what 
>> this looks like. Screen shots would help.
>> 
>> Is the link in question from a to-many relationship on your inspect page? Or 
>> is it from the original list? I was assuming that you would be able to get 
>> the object in the list, then pass that in your link to your new page. What 
>> object is it that you don't want to lose reference to?
>> 
>> In case it helps, here is how I usually create a  simple link for a 
>> situation like yours. It could be in any page, really, but I usually put 
>> such a thing in a list page:
>> 
>> .wo
>> 
>> <wo:link action = "$view"><wo:str value = "$displayValue"/></wo:link>
>> 
>> .java
>> 
>> public class SelectDocumentForView extends ERXStatelessComponent {
>>      public SelectDocumentForView(WOContext context) {
>>              super(context);
>>      }
>> 
>>      public EOEnterpriseObject object() {
>>              return (EOEnterpriseObject) valueForBinding("object");
>>      }
>> 
>>      public String key() {
>>              return (String) valueForBinding("key");
>>      }
>> 
>>      public String displayValue() {
>>              return (String) object().valueForKey(key());
>>      }
>>      
>>      public WOComponent view() {
>>              Document selectedDocument = (Document) object();
>>              return (WOComponent) 
>> ((Session)session()).navController().inspectDocument(selectedDocument);
>>      }
>>      
>> }
>> 
>> rules:
>> 
>> 100 : (pageConfiguration = 'ListMyWGDocuments' and propertyKey = 'title') => 
>> componentName = "D2WCustomComponent" [com.webobjects.directtoweb.Assignment]
>> 100 : (pageConfiguration = 'ListMyWGDocuments' and propertyKey = 'title') => 
>> customComponentName = "SelectDocumentForView" 
>> [com.webobjects.directtoweb.Assignment]
>> 
>> 
>> To set up a dummy propertyKey you just declare it in your 
>> displayPropertyKeys for that pageConfiguration. So if 'title' wasn't 
>> actually a property, it would still show up because I've declared a 
>> component for it. You'd change the html above to display a static string 
>> instead of the value of the propertyKey.
>> 
>> Hope that helps,
>> David
>> 
>> 
>> 
>> On 2013-05-02, at 6:17 PM, Johnny Miller <[email protected]> wrote:
>> 
>>> Thanks David,
>>> 
>>> I'll take you up on that :)
>>> 
>>> So maybe what I'm doing is the wrong approach but this is my method:
>>> 
>>> The ERDActionBar's delegate assigns a pageConfiguration.
>>> 
>>> In my rules I say for that page configuration use an inspect page template 
>>> that subclasses ERD2WInspectPage.  On that template it has some 
>>> presentation code and a component that subclasses ERDInspectPageRepetition. 
>>>  I'm using the subclass of ERDInspectPageRepetition to fetch the eos and 
>>> print them to the screen.  So...
>>> 
>>> Is there an example of a custom link component in Wonder?  Can I just 
>>> create a componentAction that sets the propertyKey to the dummy key? 
>>> 
>>> I don't understand why I would use target = "_blank"?  I don't want to 
>>> change the browser window?  Or is that a special D2W thing?
>>> 
>>> Thanks a lot!
>>> 
>>> Johnny
>>> 
>>> On May 2, 2013, at 2:22 PM, David Holt <[email protected]> wrote:
>>> 
>>>> Hi Johnny,
>>>> 
>>>> You can make a custom link component with target = "_blank" for the 
>>>> embedded list. You need to declare a dummy property key for that entity, 
>>>> and call your customComponent for that property key. If you need a hand 
>>>> with the actual component, let me know.
>>>> 
>>>> David
>>>> 
>>>> 
>>>> 
>>>> On 2013-05-02, at 5:13 PM, Johnny Miller <[email protected]> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> I'm trying to figure out something and I'm lost again.  And I figure 
>>>>> there is an easy answer so here goes:
>>>>> 
>>>>> I'm using embedded components and I have a "master list" style page.  On 
>>>>> my inspect component I have an ERDActionBar that lets the user go between 
>>>>> different screens such as inspect page, an edit page and different pages 
>>>>> for special attribute handling and relationships.
>>>>> 
>>>>> So here is my question: if I'm showing a list of objects from a to many 
>>>>> relationship - how do I open a new page to edit one of the objects in the 
>>>>> relationship without changing what the current object is and without 
>>>>> using a modal window?
>>>>> 
>>>>> Thanks in advance,
>>>>> 
>>>>> Aloha,
>>>>> Mr. Johnny Miller
>>>>> Web Development Manager
>>>>> Kahalawai Media Company
>>>>> Lahaina, HI 96761
>>>>> tel: (808) 661-7962 | mobile: (808) 283-0791
>>>>> website | e-mail  
>>>>> 
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list      ([email protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>>>> 
>>>>> This email sent to [email protected]
>>>> 
>>> 
>> 
> 

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

This email sent to [email protected]

Reply via email to