Re: [D2W] Using a custom component inside ermodernlook

Mark Wardle <[email protected]> Sat, 5 Oct 2013 22:37:51 +0100
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
Hi. I used ERModernLook for the first time a month or so ago and encountered exactly the same problem. I preferred a PageWrapper that was not dependent on D2W so switched it to an application specific one that did not require D2W.

The navigation menus can link to anything - direct actions for example. I tend to favour using direct actions and then, if I want a D2W page, create the page and return it in that direct action. Then, all my navigation controller logic is in one place, grouped by system. It also allows more sophisticated logic, so for example, you might want to display a list with different qualifiers depending on the navigation button pressed. 

Your original code needs to be a basic WOComponent, probably stateful and synchronising. Create a direct action, reference your component using pageWithName() and return it, possibly configured in the direct action depending on session or other context information

Best wishes,

Mark

On 25 Sep 2013, at 13:25, 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

-- 
Dr. Mark Wardle
Consultant Neurologist, University Hospital Wales, Cardiff, UK
Email: [email protected] or [email protected]  Twitter: @mwardle
Telephone: 02920745274 (secretary) or facsimile: 02920744166

------------------------------------------------------------------------------
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=60134791&iu=/4140/ostg.clktrk

_______________________________________________
Wonder-disc mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wonder-disc