Re: [D2W] Using a custom component inside ermodernlook

Jesse Tayler <[email protected]> Wed, 25 Sep 2013 11:43:57 -0400
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
you prolly want something more like

    <wo:ERXStyleSheet framework = "ERModernDefaultSkin" filename = "datepicker.css" />



On Sep 25, 2013, at 11:39 AM, Giancarlo Dessena <[email protected]> wrote:

> Wow it worked.
> One last thing though. I have copied the stylesheets into the header like this.
> 
> <script src="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/Ajax.framework/WebServerResources/prototype.js"></script>
> <script src="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/Ajax.framework/WebServerResources/effects.js"></script>
> <script src="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/Ajax.framework/WebServerResources/wonder.js"></script>
> <script src="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/ERCoolComponents.framework/WebServerResources/ercoolcomponents.js"></script>
> <script src="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/WOLips.framework/WebServerResources/wolips.js"></script>
> <link rel="stylesheet" type="text/css" media="screen" href="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/ERModernDefaultSkin.framework/WebServerResources/default_screen_stylesheet.css">
> <link rel="stylesheet" type="text/css" media="print" href="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/ERModernDefaultSkin.framework/WebServerResources/default_print_stylesheet.css">
> <link rel="stylesheet" type="text/css" media="screen" href="/cgi-bin/WebObjects/SNSAdminToolD2W.woa/_wr_/wodata=/Developer/WebObjects/Versions/WebObjects543/Library/Frameworks/ERModernDefaultSkin.framework/WebServerResources/datepicker.css">
> 
> As you can imagine this is not ideal as the links are static. Is there a way to let the paths be generated generically?
> 
> 
> Am 25.09.2013 um 17:05 schrieb David LeBer <[email protected]>:
> 
>> On 2013-09-25, at 10:28 AM, Giancarlo Dessena <[email protected]> wrote:
>> 
>>> Hey David :)
>>> 
>>> thank you for your input.
>>> Unfortunately I haven't understand your tips (probably due to a lack of D2W knowledge and some difficulties as a non native speaker :P).
>>> Anyway could you clarify what do you mean with these lines?
>>>> It should take a binding for the pageConfig name (and any other bits it may be pulling from the d2wc) and fall back to looking for a d2wContext if it doesn't get them.
>> 
>> Basically you need to modify the page wrapper's bodyClass() method so it's no longer dependent on a d2wContext. Something like:
>> 
>> 	public String bodyClass() {
>> 		String result = null;
>> 		String pageConfig = stringValueForBinding("pageConfiguration", "VanillaPage");
>> 		if (d2wContext() != null && pageConfig.equals("VanillaPage") ) {
>> 			pageConfig = (String)d2wContext().valueForKey("pageConfiguration");
>> 		}
>> 		if (pageConfig != null && pageConfig.length() > 0) {
>> 			result = pageConfig + "Body";
>> 		}
>> 		return result;
>> 	}
>> 
>> Note: typed into email, not tested
>> 
>> In looking at the PageWrapper component I see there are two stylesheet components that have dependencies on d2wContext as well, I suppose you could wrap those in conditionals and add the necessary stylesheets manually if the d2wContext is missing, or just do without the flexibility of being able to specify stylesheets in the rules all together. 
>> 
>> 
>>>> 
>>>> You'll also have to set the navigation state (it's an array), see ERXNavigationComponent for details.
>> 
>> Make your page inherit from ERXNavigationComponent (or copy the appropriate bits from it) and then return the state in your page:
>> 
>> 	@Override
>> 	public NSArray navigationState() { return new NSArray("Foo", "Bin", "Bar"); }
>> 
>> Foo, the current tab, a child of Bin, a child of Bar.
>> 
>> D
>> 
>>> Maybe a small sample would help
>>> 
>>> Greetings Carlo
>>> 
>>> PS Sorry about the double mail. did not realize i just answered u and not the wonder mailing list
>>> 
>>> Anfang der weitergeleiteten Nachricht:
>>> 
>>>> Von: David LeBer <[email protected]>
>>>> Betreff: Aw: [Wonder-disc] [D2W] Using a custom component inside ermodernlook
>>>> Datum: 25. September 2013 15:13:04 MESZ
>>>> An: Giancarlo Dessena <[email protected]>
>>>> Kopie: wonder Project <[email protected]>
>>>> 
>>>> Who was the idiot who wrote that modern crap... Oh, wait. :p
>>>> 
>>>> Really, the pagewrapper should be modified to eliminate the dependency for having it's own d2wContext.
>>>> 
>>>> It should take a binding for the pageConfig name (and any other bits it may be pulling from the d2wc) and fall back to looking for a d2wContext if it doesn't get them.
>>>> 
>>>> You'll also have to set the navigation state (it's an array), see ERXNavigationComponent for details.
>>>> 
>>>> Shouldn't be too hard to implement that.
>>>> 
>>>> Pull requests welcome.
>>>> 
>>>> --
>>>> David LeBer
>>>> Codeferous Software
>>>> 
>>>> On 2013-09-25, at 8:25 AM, Giancarlo Dessena <[email protected]> wrote:
>>>> 
>>>>> That is correct, but If i want to use the pageWrapper component a D2WContext is needed to display the menu:
>>>>> HelloWorld.html
>>>>> <PastedGraphic-10.png>
>>>>> PageWrapper
>>>>> <PastedGraphic-9.png>
>>>>> 
>>>>> If I just use a regular component I get a NullPointerException because of the missing D2WContext.
>>>>> 
>>>>> <PastedGraphic-7.png>
>>>>> 
>>>>> <PastedGraphic-8.png>
>>>>> 
>>>>> Am 25.09.2013 um 13:05 schrieb Fabian Peters <[email protected]>:
>>>>> 
>>>>>> Hi Carlo,
>>>>>> 
>>>>>> Am 25.09.2013 um 10:46 schrieb Giancarlo Dessena:
>>>>>> 
>>>>>>> Maybe I should point out that ERModernLook isn't simply a look for D2W. It also changes the way the D2W menu is created.
>>>>>>> In ERModernLook the menu is created using an external plist in which you have to add the menu titles and the actions they are using.
>>>>>>> The action should return a D2W Component and this is the reason why I have to use a ERD2WPage.
>>>>>> 
>>>>>> You can return pretty much anything you like. From the documentation on ERXNavigationMenu <https://github.com/wocommunity/wonder/blob/master/Frameworks/Core/ERExtensions/Documentation/Navigation.html>:
>>>>>> 
>>>>>> 	The action here does not have to be a component action.
>>>>>> 		In order of precedence, it can be:
>>>>>> 		
>>>>>> 		href
>>>>>> 		action
>>>>>> 		pageName
>>>>>> 		directActionName
>>>>>> 	
>>>>>> Fabian
>>>>>> 
>>>>>>> According to the wonder Wiki this is only possible by using components that extend ERD2WPage and that implies that the HelloWorld component has a correctly initialized D2W Context.
>>>>>>> 
>>>>>>> So for the component to work I need 4 things set in the rules file:
>>>>>>> 1. Set an Entity (does not need to be used inside the component)
>>>>>>> 	- pageConfiguration = 'Payment' => entity = "ActivePayment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>> 2. Set a Task
>>>>>>> 	- pageConfiguration = 'Payment' => task = "inspect" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>> 3. Set a template (here I name the component I want to be displayed when i click on the Tab)
>>>>>>> 	- pageConfiguration = 'Payment' => templateNameForInspectPage = "Payment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>> 4. Set the navigation state of the Menu
>>>>>>> 	- pageConfiguration = 'Payment' => navigationState = "Payment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>> 
>>>>>>> Here is the wiki page where I have the information from:
>>>>>>> - http://wiki.wocommunity.org/display/documentation/Adding+a+Normal+WOComponent+Page+to+an+ERModernLook+based+application
>>>>>>> 
>>>>>>> Also if you are new to the ERModernLook and interested here the introduction screencast:
>>>>>>> - http://www.wocommunity.org/podcasts/ERModernDirectToWebIntro.mov
>>>>>>> 
>>>>>>> 
>>>>>>> Am 24.09.2013 um 18:31 schrieb Ramsey Gurley <[email protected]>:
>>>>>>> 
>>>>>>>> Why does your Payment page extend ERD2WPage? D2W pages are designed to handle generic EOs. If you're making a page for a specific entity, you're doing it wrong :)  Maybe you want to use embedded D2W here to make something like a payment dashboard instead?  
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Sep 24, 2013, at 3:23 AM, Giancarlo Dessena wrote:
>>>>>>>> 
>>>>>>>>> Hi Ramsey,
>>>>>>>>> 
>>>>>>>>> I have tried your suggestions and it did not workout.
>>>>>>>>> Also I think it's not addressing my actuall Problem.
>>>>>>>>> As I said I'm trying to make a custom component reachable through the ERModernLook.
>>>>>>>>> To do so I have added these entries to the NavigationMenu.plist
>>>>>>>>> 
>>>>>>>>> 	{
>>>>>>>>> 		name = Root;
>>>>>>>>> 		children = ("Home","Avatars", "Payment","SystemMessages");
>>>>>>>>> 	},
>>>>>>>>> 	{
>>>>>>>>> 		name = "Payment";
>>>>>>>>> 		action = "session.navController.showPayment";
>>>>>>>>> 	},
>>>>>>>>> 
>>>>>>>>> and Added the showPayment method to the MainNavigationController
>>>>>>>>> 	public WOComponent showPayment(){
>>>>>>>>> 		return D2W.factory().pageForConfigurationNamed(Payment.class.getName(),session());
>>>>>>>>> 	}
>>>>>>>>> 
>>>>>>>>> Here my Payment component:
>>>>>>>>> 	public class Payment extends ERD2WPage {
>>>>>>>>> 		public Payment(WOContext context) {
>>>>>>>>> 			super(context);
>>>>>>>>> 		}
>>>>>>>>> 	}
>>>>>>>>> 
>>>>>>>>> According to the wo wiki i just have to add the following rules to make the component reachable:
>>>>>>>>> pageConfiguration = 'Payment' => entity = "ActivePayment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>>>> pageConfiguration = 'Payment' => task = "QueryAll" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>> pageConfiguration = 'Payment' => templateNameForInspectPage = "Payment" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>> pageConfiguration = 'Payment' => navigationState = "Payment" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>> 
>>>>>>>>> I am confused. why Do I have to use  ListActivePayment in my pageconfigutation name?
>>>>>>>>> 
>>>>>>>>> further explanations would be very helpful :)
>>>>>>>>> 
>>>>>>>>> Greetings Carlo
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Am 23.09.2013 um 18:24 schrieb Ramsey Gurley <[email protected]>:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Sep 23, 2013, at 7:20 AM, Giancarlo Dessena wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hello everybody,
>>>>>>>>>>> 
>>>>>>>>>>> I'm yet again stuck with a D2W/ERModernLook Issue. 
>>>>>>>>>>> I am trying to add a normal component to my D2W project by following this little how to:
>>>>>>>>>>> http://wiki.wocommunity.org/display/documentation/Adding+a+Normal+WOComponent+Page+to+an+ERModernLook+based+application
>>>>>>>>>>> 
>>>>>>>>>>> I have managed to create and edit everything according to the tutorial, but unfortunately I still get this error:
>>>>>>>>>>> 
>>>>>>>>>>> java.lang.IllegalStateException: 
>>>>>>>>>>> Couldn't find the dynamic page named com.mycompany.adminD2W.ui.components.payment.Payment in your DirectToWeb model.task and entity is null, it seems that one model, maybe ERDirectToWeb d2w.d2wmodel is not loaded!
>>>>>>>>>>> 
>>>>>>>>>>> I think it has to do with the extra rules that had to be adder to make it work:
>>>>>>>>>>> pageConfiguration = 'Payment' => entity = "ActivePayment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>>>>>> pageConfiguration = 'Payment' => task = "QueryAll" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>>>> pageConfiguration = 'Payment' => templateNameForInspectPage = "Payment" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>>>> pageConfiguration = 'Payment' => navigationState = "Payment" [WO:com.webobjects.directtoweb.Assignment]
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Correction, ListActivePayment, etc. Get rid of these rules. You're breaking things :)
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Especially this one looks fishy:
>>>>>>>>>>> pageConfiguration = 'Payment' => entity = "ActivePayment" [WO:com.webobjects.directtoweb.EntityAssignment]
>>>>>>>>>>> 
>>>>>>>>>>> When I open the rule editor is shown as a com.webobjects.directtoweb.Assignment:
>>>>>>>>>>> <PastedGraphic-3.png>
>>>>>>>>>>> If I open it with a text editor instead I can clearly see the EntityAssignment class in the rule:
>>>>>>>>>>> <PastedGraphic-4.png>
>>>>>>>>>>> 
>>>>>>>>>>> What could I possibly be doing wrong here? Is this even the right way to add a non D2W Component to the ERModernLook?
>>>>>>>>>>> 
>>>>>>>>>>> Any Help is appreciated :)
>>>>>>>>>>> 
>>>>>>>>>>> Greetings Carlo
>>>>>>>>>>> 
>>>>>>>>>>> PS Fabian if you are reading this thank you for your input. I still have to go through your replies as I'am currently stuck with this issue here ;)
>>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>>> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
>>>>>>>>>>> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
>>>>>>>>>>> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
>>>>>>>>>>> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
>>>>>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk_______________________________________________
>>>>>>>>>>> Wonder-disc mailing list
>>>>>>>>>>> [email protected]
>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> October Webinars: Code for Performance
>>>>>>>>> Free Intel webinars can help you accelerate application performance.
>>>>>>>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
>>>>>>>>> the latest Intel processors and coprocessors. See abstracts and register >
>>>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>>>>>>>>> _______________________________________________
>>>>>>>>> Wonder-disc mailing list
>>>>>>>>> [email protected]
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> October Webinars: Code for Performance
>>>>>>> Free Intel webinars can help you accelerate application performance.
>>>>>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
>>>>>>> the latest Intel processors and coprocessors. See abstracts and register >
>>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>>>>>>> _______________________________________________
>>>>>>> Wonder-disc mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>>>>> 
>>>>> 
>>>>> ------------------------------------------------------------------------------
>>>>> October Webinars: Code for Performance
>>>>> Free Intel webinars can help you accelerate application performance.
>>>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
>>>>> the latest Intel processors and coprocessors. See abstracts and register >
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk_______________________________________________
>>>>> Wonder-disc mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>>>> 
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> October Webinars: Code for Performance
>>> Free Intel webinars can help you accelerate application performance.
>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
>>> the latest Intel processors and coprocessors. See abstracts and register >
>>> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Wonder-disc mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/wonder-disc
>> 
> 
> 
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
> _______________________________________________
> Wonder-disc mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wonder-disc


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk