You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Richard Watson <ri...@gmail.com> on 2005/01/30 16:03:10 UTC
Putting library components into a "global" namespace?
Hi all,
Is there any way to force components and pages in a library into a
global (or application) namespace?
Cheers,
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Putting library components into a "global" namespace?
Posted by Richard Watson <ri...@gmail.com>.
Yup, same use-case! I have a solution that renders fine but I had
issues with the rewind cycle - Tapestry reported that it could not
find a nested component in the library and I didn't know enough about
identifying components to work it out. (So I have two nested library
components inside the application "Border" in a library page -
namespace issues got pretty fun!) I've gone with a workaround for the
meantime but I will clean it up when the pressure drops. I'll
checkout Nanda's solution as well and see how similar they are.
Thanks!
Richard
On Sun, 30 Jan 2005 10:45:09 -0500, Howard Lewis Ship <hl...@gmail.com> wrote:
> Drew Davidson was looking for this as well; I also advised that it
> could be done using a specification resolver delegate, not sure what
> he did.
>
> His use case was that he wanted to provide pages in a library, but
> wanted the application to provide a Border component to apply look and
> feel. I think that's a reasonable use case.
>
> Perhaps we should add an "application:" namespace perfix to supplement
> "framework:" for this purpose?
>
> On Sun, 30 Jan 2005 10:36:58 -0500, Erik Hatcher
> <er...@ehatchersolutions.com> wrote:
> >
> > On Jan 30, 2005, at 10:03 AM, Richard Watson wrote:
> > > Is there any way to force components and pages in a library into a
> > > global (or application) namespace?
> >
> > Such questions should be accompanied by a use-case as well. Why would
> > you want such a feature?
> >
> > I suspect that this could be done with some specification resolver
> > trickery.
> >
> > Erik
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
>
> Professional Tapestry training, mentoring, support
> and project work. http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Putting library components into a "global" namespace?
Posted by Nanda Firdausi <en...@gmx.net>.
I'm also already looking for solution like this :P I think it is ridiculous,
while component can be recursively arranged, why we can't recursively 'see'
component and/or page in library? To make it private? Hmmmm... Maybe it's
time to think smething about component and page visibility. :)
Well, my solution(with Tapestry 3.0.1 is hack PageSpecificationResolver, and
change render() menthod into something like this:
public void resolve(IRequestCycle cycle, String prefixedName)
{
reset();
INamespace namespace = getNamespace(prefixedName,
getSpecificationSource().getApplicationNamespace());
setNamespace(namespace);
if (namespace.containsPage(_simpleName))
{
setSpecification(namespace.getPageSpecification(_simpleName));
return;
}
// Not defined in the specification, so it's time to hunt it down.
searchForPage(cycle);
if (getSpecification() == null)
throw new ApplicationRuntimeException(
Tapestry.format(
"Namespace.no-such-page",
_simpleName,
namespace.getNamespaceId()));
}
And add this method:
public INamespace getNamespace(String prefixedName,
INamespace parentNamespace) {
INamespace namespace = null;
int colonx = prefixedName.indexOf(':');
if (colonx > 0) {
String name = prefixedName.substring(colonx + 1);
String namespaceId = prefixedName.substring(0, colonx);
if (namespaceId.equals(INamespace.FRAMEWORK_NAMESPACE))
namespace =
getSpecificationSource().getFrameworkNamespace();
else
namespace = getNamespace(name, parentNamespace
.getChildNamespace(namespaceId));
} else {
_simpleName = prefixedName;
namespace = parentNamespace;
}
return namespace;
}
Now, I can refer nested component with, such as
library1:library2Inlibrary1:componentInLibrary2.
Maybe it will work in 3.1 as well (I haven't try this), just change the
method at PageSpecificationResolverImpl.
Hope this is useful...
Cheers,
Nanda Firdausi
> -----Original Message-----
> From: Howard Lewis Ship [mailto:hlship@gmail.com]
> Sent: 30 Januari 2005 16:45
> To: Tapestry users
> Subject: Re: Putting library components into a "global" namespace?
>
> Drew Davidson was looking for this as well; I also advised
> that it could be done using a specification resolver
> delegate, not sure what he did.
>
> His use case was that he wanted to provide pages in a
> library, but wanted the application to provide a Border
> component to apply look and feel. I think that's a
> reasonable use case.
>
> Perhaps we should add an "application:" namespace perfix to
> supplement "framework:" for this purpose?
>
>
> On Sun, 30 Jan 2005 10:36:58 -0500, Erik Hatcher
> <er...@ehatchersolutions.com> wrote:
> >
> > On Jan 30, 2005, at 10:03 AM, Richard Watson wrote:
> > > Is there any way to force components and pages in a
> library into a
> > > global (or application) namespace?
> >
> > Such questions should be accompanied by a use-case as well.
> Why would
> > you want such a feature?
> >
> > I suspect that this could be done with some specification resolver
> > trickery.
> >
> > Erik
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant Creator,
> Jakarta Tapestry Creator, Jakarta HiveMind
>
> Professional Tapestry training, mentoring, support and
> project work. http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Putting library components into a "global" namespace?
Posted by Howard Lewis Ship <hl...@gmail.com>.
Drew Davidson was looking for this as well; I also advised that it
could be done using a specification resolver delegate, not sure what
he did.
His use case was that he wanted to provide pages in a library, but
wanted the application to provide a Border component to apply look and
feel. I think that's a reasonable use case.
Perhaps we should add an "application:" namespace perfix to supplement
"framework:" for this purpose?
On Sun, 30 Jan 2005 10:36:58 -0500, Erik Hatcher
<er...@ehatchersolutions.com> wrote:
>
> On Jan 30, 2005, at 10:03 AM, Richard Watson wrote:
> > Is there any way to force components and pages in a library into a
> > global (or application) namespace?
>
> Such questions should be accompanied by a use-case as well. Why would
> you want such a feature?
>
> I suspect that this could be done with some specification resolver
> trickery.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Putting library components into a "global" namespace?
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 30, 2005, at 10:03 AM, Richard Watson wrote:
> Is there any way to force components and pages in a library into a
> global (or application) namespace?
Such questions should be accompanied by a use-case as well. Why would
you want such a feature?
I suspect that this could be done with some specification resolver
trickery.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org