Re: Trying to create a dynamic url with the components action?
Re: Trying to create a dynamic url with the components action?
- Subject: Re: Trying to create a dynamic url with the components action?
- From: James Cicenia <email@hidden>
- Date: Sun, 6 May 2007 09:49:14 -0500
I best explain this better...
I have someone else's component. So what I have to do is create my
complete
url in java code. Normally I use something like componentActionURL().
However
this component has only:
public WOComponent actionDownloadThisFile()
{
returnDownloadInsteadOfComponent = true;
WOComponent componentToReturn = componentValueForBinding
("action", context().page());
return componentToReturn;
}
There is no component in the html. Just one generic component that
needs to render a url.
So I did this in my java code:
NXFileDownload fd = new NXFileDownload(context());
fd.setValueForBinding( item.title(),"filenameForClient");
fd.setValueForBinding(new Boolean
(false),"useDisplayOnlyIfDataExists");
fd.setValueForBinding(new Boolean(true),"useShowLengthOfDownload");
fd.setValueForBinding(new Boolean
(false),"useShouldDisplayInBrowser");
fd.setValueForBinding( item.projectDocumentObject().documentObject
(),"data");
So now what do I do to render its url?
I was hoping for something like fd.componentActionURL() .. BUT it
doesn't have one?!
Any hints?
James Cicenia
On May 6, 2007, at 12:12 AM, Lachlan Deck wrote:
Hi James,
On 06/05/2007, at 8:30 AM, James Cicenia wrote:
I am needing to create my own URLs dynamically that call a
components method.
How do I do this?
I assume you've a reusable component you're wanting to drop on a page?
Say I have a component that renders the url that is for the delete
method in that component?
perhaps something like this is what you're after.
-- html --
<webobject name="CanDelete"><webobject name="DeleteAction">...</
webobject></webobject>
-- wod --
CanDelete: WOConditional {
condition = hasDeleteableParent;
}
DeleteAction: WOHyperlink {
action = deleteAction;
}
-- java --
public WOActionResults deleteAction() {
return deleteableParent().deleteRecord();
// or
return performParentAction( "relevantKey" );
}
public YourInterface deleteableParent() {
return parent() instanceof YourInterface ? ( YourInterface )parent
() : null;
}
public boolean hasDeleteableParent() {
return deleteableParent() != null;
}
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40jimijon.com
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