Re: D2W/ERModernLook in non D2W app
Re: D2W/ERModernLook in non D2W app
- Subject: Re: D2W/ERModernLook in non D2W app
- From: Ramsey Gurley <email@hidden>
- Date: Wed, 9 Jun 2010 16:12:25 -0400
On Jun 9, 2010, at 3:49 PM, Andrew R. Kinnie wrote:
Sorry, didn't reply all with my last reply.
Begin forwarded message:
Thanks David and Ramsey. I seem to be having issues, unfortunately.
To clarify, originally, I was planning to have the admin component
be a subcomponent within the normal wrapper (by "normal I mean pre-
d2w -- not "non"-d2w as I previously suggested. I meant the site
works without d2w, I just thought adding the admin as d2w would be
a good way to learn d2w). Anyway, I attempted to accomplish this
by making my Admin component essentially a copy of the PageWrapper
from ERModernMoviesDemo . . . but got confused by the head and body
stuff. Now I see that was likely the source of many of my issues.
So now I am trying to do exactly what you suggest and open a new
window with a page level admin component via D2W. (restoring the
html, head and body tags). Now, however, when ERD2WHead asks for
this:
D2WContext context = (D2WContext)
context().page().valueForKey("d2wContext");
I am getting null. I have the d2wContext method inside my Admin
component (copied from the modern movies demo), and also have the
body class method.
public D2WContext d2wContext() {
if (context().page() instanceof D2WPage) {
D2WPage d2wPage = (D2WPage) context().page();
return d2wPage.d2wContext();
}
return null;
}
If you need a context, you can return new D2WContext(session()) here
instead of null for the stylesheet stuff. I don't think they rely on
anything like task or entity, but I could be wrong.
public String bodyClass() {
String result = null;
String pageConfig =
(String)d2wContext().valueForKey("pageConfiguration");
if (pageConfig != null && pageConfig.length() > 0) {
result = pageConfig + "Body";
}
return result;
}
This one _may_ flip its wig with that d2wContext. Not totally sure
(^_^) If it does, you can simply assign the body class something
different in the absence of a D2WPage parent. Your page wrapper is
just an ordinary component after all.
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd
">
<html>
<webobject name = "HeadTag">
<webobject name = "StyleSheets" />
</webobject>
<webobject name = "BodyTag">
<webobject name = "IsDebug">
<div id="ERD2WDebugFlags"><webobject name =
"ERD2WDebugFlags" /></div>
</webobject>
<div id = "ContentWrapper">
<div id = "MenuHeader">
<webobject name = "ERXNavigationMenu"/>
</div>
<div id = "MainContent">
<webobject name = "MainContent" />
</div>
</div>
<webobject name = "WOLToolBar"/>
<webobject name = "ERMD2WStyleSheetInjector"/>
</webobject>
</html>
wod:
ERXNavigationMenu : ERXNavigationMenu {
navigationContext = navigationContext;
}
MainContent : WOComponentContent {
_unroll = YES;
}
BodyTag : WOBody {
class = bodyClass;
}
HeadTag : ERD2WHead {
}
EntitiesMenu : MenuHeader {
}
ERD2WDebugFlags : ERD2WDebugFlags {
context = d2wContext;
}
IsDebug : WOConditional {
condition = application.isDevelopmentMode;
}
StyleSheets : ERMD2WCSSReference {
localContext = d2wContext;
}
WOLToolBar : WOLToolBar {
expanded = true;
}
ERMD2WStyleSheetInjector : ERMD2WStyleSheetInjector {
localContext = d2wContext;
}
I still have the rule in my rule file telling the pageWrapperName
to be "Admin"
Still isn't loading. I assume there is something else I am
missing. (Note I am for now, abandoning doing the subcomponent
method.)
Add these to your properties file. They may shed some light on that
subject.
log4j.category.er.directtoweb.rules.ERD2WTraceRuleFiringEnabled=DEBUG
log4j.category.er.directtoweb.rules.pageWrapperName.cache=DEBUG
log4j.category.er.directtoweb.rules.pageWrapperName.candidates=DEBUG
log4j.category.er.directtoweb.rules.pageWrapperName.fire=DEBUG
On Jun 9, 2010, at 3:32 PM, David Holt wrote:
Hi Andrew,
In order to minimize the work that you need to do, I would
consider rethinking your approach to the admin side. Instead of it
opening inside your AUC, why don't you have the admin link open up
a nice full page completely outside your current pagewrapper with
the unchanged ERModernLook all ready to go?
Your admin link will call something like
session.navController.adminAction() (see the ModernMoviesDemo for
examples), and you will include the PageWrapper and MenuHeader
from the example in your application. Then the D2W rule system
will find the pagewrapper, menuheader and skin framework required
to make the complete page. Part of your navigation strategy on the
Admin/D2W side will need to include a link back to reload the
"normal" page wrapper.
Once you figure out how D2W ties all this together, it will be
easier to figure out how to frame it within your original strategy.
If you want to go ahead with your current strategy see further
notes below...
Also see David LeBer's responses in the thread from a few weeks
ago which will give you some idea of the complexity involved in
the opposite problem: "embedding standard components into
ERModernDirectToWeb"
On 9-Jun-10, at 11:10 AM, Andrew R. Kinnie wrote:
Thanks. I added a rule in the d2wmodel file for
pageWrapperName. However, I managed to discover several other
problems.
The pagewrapper will need to include a call to the D2W context.
Every ERModernLook page needs access to this.
My page wrapper was for a non-d2w page and site,
<aside>This is a common misconception. There's really no such
thing as a non-D2W site. You can use as much or as little D2W as
you wish. Your pages are either created by the D2W factory or
they're not. Your web application either includes the D2W
frameworks or it doesn't. Those are the distinctions, rather than
"D2W App" or "non-D2W app".</aside>
and I want the d2w stuff to be a subcomponent of this. It is
very simple, I have a header, sidebar navigation, and an
AjaxUpdateContainer which changes based on what link the user
clicks on the navigation sidebar. One of these links is the
Admin link, which will (I hope) cause the D2W stuff to be loaded
into the AjaxUpdateContainer, without disturbing anything else.
Your PageWrapper component will need to provide the D2WContext. If
you plan to go with ERModernLook you're going to have to look
carefully at the CSS. I am pretty sure that it also depends on the
body class being in your PageWrapper.
I therefore made my Admin component into the "pageWrapperName"
for the purposes of the D2W rule, and created it based on the
pageWrapper from ERModernMoviesDemo.
Not sure what you mean here. Is the Admin component included
inside the AUC or is it going to be a page level component?
1. I changed it to remove the header because this is a
subcomponent. However, this removed the stylesheets tag. I also
eliminated the bodyTag webobject, again, as this is a
subcomponent. Neither of these seem to affect this problem though.
I think that D2W expects whatever component you use for the
PageWrapper to contain the page level HTML. All the D2W page level
components would depend on that. Otherwise what you might be
looking for are the embeddable components (remember that there was
a palette of these things in WOBuilder?).
This works, sort of, but the WOLToolbar appears as a ul above the
ul of the entities. (I had an error here until I added the
WOLips framework and password) I assume this is related to the
navigation panel not being styled properly.
Yeah you're messing with the assumptions that were made in
creating the CSS for ModernLook, I expect. The WOLToolbar is
styled to be at the bottom of the page.
The real problem is that when I click an entity, now I get an NPE
error:
ERMD2WStyleSheetInjector.java 39 resourceFrameworkName
er.modern.directtoweb.components
Which apparently means it's not getting the skin framework (and
also isn't supplying the default of "app") I added the property
to the skin framework's properties file (then added it to the
app's properties too to see if that changed anything. It
didn't. I assume this is related to the missing stylesheets from
the head.
This is established by the rules. You've messed with the
framework's assumptions for the styling.
2. I then added the head and body back (along with the bodyClass
method lifted from the ERModernMoviesDemo's pageWrapper). I
changed it from an Ajax link to a regular WOHyperlink and set
target = "new" but now I get an NPE like this (before I get to
the uls from the WOLToolbar or the entitities) :
ERD2WHead.java 32 displayNameForPageConfiguration
er.directtoweb.components
(Note this also happens inside the AjaxUpdateContainer if I keep
it as an AjaxUpdateLink with the appropriate containerid)
You can't use the head and body tag nested inside a component that
contains head and body tags (which I am assuming your Main
component does).
So, while I am doing better than I was, I guess I am just
fundamentally missing what I am supposed to be doing in relation
to dropping an ERModernLook component with navigation into an
AjaxUpdateContainer of an existing site.
I am pretty sure that the assumptions for ModernLook is that it is
providing the full pages. I don't think nesting is going to work
for you unless you look at how the styling is affected by being
nested like this.
Is there some configuration I am supposed to be doing to set the
resources other than in the properties file of the look framework
(and adding that framework to the app)?
Just setting the property worked for me. Try your admin pages as
full ModernLook pages by dropping in PageWrapper and MenuHeader
and see if it picking up all the elements from the ModernD2W/Look/
Skin frameworks.
Thanks. This technology looks very cool, and I would like to
think it's fairly easy to do this, rather than re-creating
entirely new D2W projects, even for a D2W novice.
It is very cool, and you WILL be able to include D2W pages in your
existing application. You just have to keep in mind that the look
frameworks are not trivial to create or change in my experience. I
would hate to guess how long David LeBer spent creating this look.
In my opinion you're going to have a much easier time of it if you
just use the look as intended. Then, once you are familiar with
how it works, you can start to see where customizations are
possible.
HTH,
David
Andrew
On Jun 9, 2010, at 9:36 AM, Ramsey Gurley wrote:
On Jun 9, 2010, at 9:22 AM, Andrew R. Kinnie wrote:
I am again attempting to use D2W for the admin portion of an
existing app.
Basically, I have an existing site, and wanted to add an admin
link to the home page navigation bar, based on whether the user
has logged in and has admin privileges. When the user clicks
on the link, I want to load a D2W generated admin component
into the AjaxUpdate area for the content. Seems all fairly
simple and straight forward.
I created a new framework, copied the ERModernSkin WSR into its
WSR, added er.modern.look.skinframework =
MySitesERModernSkinFramework to its (i.e. the skin framework's)
properties then added the framework to my app. I also added
ERD2W's framework, etc. to the app.
I also created a NavigationMenu.plist, based on the one in
ERModernMoviesDemo, and modified it to present my entities,
modified the session to present my navController and created
actions appropriate to it within it.
Now however, first, none of the ERModernLook css is loading,
but I figure I can fix that later. The big problem is I can
click the link and get a ul of the entities, but when I click
an entity link, I get this error:
com
.webobjects
.appserver._private.WODynamicElementCreationException: : cannot
find component or dynamic element named PageWrapper
I don't have a component named PageWrapper (ERModernMoviesDemo
does), I perform that function in my "Main" component. I
searched the ERModernMoviesDemo and found no references to
PageWrapper in it, other than in the class itself.
Is there someplace I can globally change a setting to point to
my Main component? Is this going to work like this at all?
The ERModernMoviesDemo is obviously a self-contained app, and
not a subcomponent within another app that has its own custom
html and css.
Any assistance would be appreciated.
Andrew
The page wrapper is typically part of the app rather than the
framework, so if you don't have one, you'll need to designate
one. I believe the D2W key you need is pageWrapperName and you
can set it in the rule with a single assignment. If your Main
component is a wrapper, then it should be simple. You might
want to download the modern look template to have a look at the
PageWrapper component in there, as loading the CSS was a bit
more involved.
http://avendasora.svn.beanstalkapp.com/repository/
Ramsey
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden