You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Konstantin Sharenkov <Ko...@enterra-inc.com> on 2003/10/08 11:49:57 UTC
Technique to use tapestry windows as popup and technique to call listener form other page
Keywords: popup link action DirectLink ActionLink PageLink
(
To tapestry developers:
The followed techniques is need on because I don't find how to realize
this behavior by standard tapestry techniques.
)
Situation:
I have a page with list of items [list.html].
When item clicked I want to open popup tapestry window for editing
[item.html].
Problem 1. I can't call tapestry window as popup.
Problem 2. If I call window as popup I want to set current item for the
page. I can do it only in event listener. But PageLink is not produce
event.
(
To Tapestry developers:
I think it is good idea implement popup properties for XXXXLink
components family
like <a href="#" jwcid="@PageLink" page="Help" popup="true"
popupName="helpWindow"> help </a>
or create new component PopupPageLink
)
Solution.
1.
Create component on item page and make it invisible.
<span jwcid="selectItem@DirectLink" listener="select"
parameters="ognl:0" style="display:none;"/>
2. Use following class
public class TapestryHelper
{
public static String getDirectLinkRef( IRequestCycle cycle, String
page_name, String link_name, Object params )
{
IPage page = cycle.getPage( page_name );
DirectLink component = (DirectLink) page.getComponent( link_name
);
component.setProperty( "parameters", params );
ILink link = component.getLink( cycle );
return link.getURL( null, true );
}
}
3. Create getter for list.html
public String getPopupUrl()
{
return TapestryHelper.getDirectLinkRef( getRequestCycle(),
"item", "select", new Integer( getCurrentItem().getId() ));
}
4. In list.html use following construction
<span jwcid="@Foreach" source="list" value="currentItem">
<a jwcid="@contrib:PopupLink" herf="ognl:popupUrl" ><span
jwcid="@Insert" value="ognl:currentItem.name"/> </a>
<span>
5. implements select() listener for item.html
public void selectSurvey( IRequestCycle cycle )
{
Object[] params = cycle.getServiceParameters();
int itemId = ((Integer) params[0]).intValue();
setItemId( itemId );
cycle.activate( this );
}
End.
Anybody know hot to implement it more correctly.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Technique to use tapestry windows as popup and technique to call
listener form other page (POSSIBLE SOLUTION)
Posted by "F. Da Costa" <da...@xs4all.nl>.
F. Da Costa wrote:
> Hi,
>
> Browsing throught he list I saw this posting.
> As i am experiencing *exactly* the same same problem as you described I
> thought would would ask whether you got the issue resolved *and* if you
> did , whether you would mind sharing your solution?
>
> I *have* to do this so I figured I might as well ask.
>
> TIA,
> Fermin DCG
>
> Konstantin Sharenkov wrote:
>
>> Keywords: popup link action DirectLink ActionLink PageLink
>>
>> (
>> To tapestry developers:
>> The followed techniques is need on because I don't find how to realize
>> this behavior by standard tapestry techniques.
>> )
>>
>> Situation:
>> I have a page with list of items [list.html].
>> When item clicked I want to open popup tapestry window for editing
>> [item.html].
I just solved this with the help of Howard using the IExternalPage
The Item.page would extend the Basepage and implement the IExternalInterface.
Below a couple of snips that I use to get the job done:
.page
<static-binding name="onClick">popupDetails(this.href); return
false;</static-binding>
This way I make sure the page pops in another window and NOT the current one!
.js:
/**
* This function does the actual popup
*/
function popupDetails(pop2URL) {
if (pop2URL) {
aWindow = window.open(pop2URL, _detailWindowID, _popWindowProperties);
aWindow.focus();
}
}
Output .html:
...
<a href="/app?service=external/AveragePriceComposition&sp=SobjectID"
onClick="top.frmScripts.popupDetails(this.href); return false;">XXX</a>
...
Just thought I would share the resolution of my own efforts with the list.
>>
>> Problem 1. I can't call tapestry window as popup. Problem 2. If I
>> call window as popup I want to set current item for the
>> page. I can do it only in event listener. But PageLink is not produce
>> event.
>>
>> ( To Tapestry developers: I think it is good idea implement popup
>> properties for XXXXLink
>> components family
>> like <a href="#" jwcid="@PageLink" page="Help" popup="true"
>> popupName="helpWindow"> help </a>
>> or create new component PopupPageLink
>> )
>>
>>
>> Solution.
>> 1.
>> Create component on item page and make it invisible.
>> <span jwcid="selectItem@DirectLink" listener="select"
>> parameters="ognl:0" style="display:none;"/>
>>
>> 2. Use following class
>> public class TapestryHelper
>> {
>> public static String getDirectLinkRef( IRequestCycle cycle, String
>> page_name, String link_name, Object params )
>> {
>> IPage page = cycle.getPage( page_name );
>> DirectLink component = (DirectLink) page.getComponent( link_name
>> );
>> component.setProperty( "parameters", params );
>> ILink link = component.getLink( cycle );
>> return link.getURL( null, true );
>> }
>> }
>>
>> 3. Create getter for list.html
>> public String getPopupUrl()
>> {
>> return TapestryHelper.getDirectLinkRef( getRequestCycle(),
>> "item", "select", new Integer( getCurrentItem().getId() ));
>> }
>>
>> 4. In list.html use following construction
>> <span jwcid="@Foreach" source="list" value="currentItem">
>> <a jwcid="@contrib:PopupLink" herf="ognl:popupUrl" ><span
>> jwcid="@Insert" value="ognl:currentItem.name"/> </a>
>> <span>
>>
>> 5. implements select() listener for item.html
>> public void selectSurvey( IRequestCycle cycle )
>> {
>> Object[] params = cycle.getServiceParameters();
>> int itemId = ((Integer) params[0]).intValue();
>>
>> setItemId( itemId );
>>
>> cycle.activate( this );
>> }
>>
>> End.
>>
>> Anybody know hot to implement it more correctly.
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Technique to use tapestry windows as popup and technique to call
listener form other page
Posted by "F. Da Costa" <da...@xs4all.nl>.
Hi,
Browsing throught he list I saw this posting.
As i am experiencing *exactly* the same same problem as you described I
thought would would ask whether you got the issue resolved *and* if you did
, whether you would mind sharing your solution?
I *have* to do this so I figured I might as well ask.
TIA,
Fermin DCG
Konstantin Sharenkov wrote:
> Keywords: popup link action DirectLink ActionLink PageLink
>
> (
> To tapestry developers:
> The followed techniques is need on because I don't find how to realize
> this behavior by standard tapestry techniques.
> )
>
> Situation:
> I have a page with list of items [list.html].
> When item clicked I want to open popup tapestry window for editing
> [item.html].
>
> Problem 1. I can't call tapestry window as popup.
> Problem 2. If I call window as popup I want to set current item for the
> page. I can do it only in event listener. But PageLink is not produce
> event.
>
> (
> To Tapestry developers:
> I think it is good idea implement popup properties for XXXXLink
> components family
> like <a href="#" jwcid="@PageLink" page="Help" popup="true"
> popupName="helpWindow"> help </a>
> or create new component PopupPageLink
> )
>
>
> Solution.
> 1.
> Create component on item page and make it invisible.
> <span jwcid="selectItem@DirectLink" listener="select"
> parameters="ognl:0" style="display:none;"/>
>
> 2. Use following class
> public class TapestryHelper
> {
> public static String getDirectLinkRef( IRequestCycle cycle, String
> page_name, String link_name, Object params )
> {
> IPage page = cycle.getPage( page_name );
> DirectLink component = (DirectLink) page.getComponent( link_name
> );
> component.setProperty( "parameters", params );
> ILink link = component.getLink( cycle );
> return link.getURL( null, true );
> }
> }
>
> 3. Create getter for list.html
>
> public String getPopupUrl()
> {
> return TapestryHelper.getDirectLinkRef( getRequestCycle(),
> "item", "select", new Integer( getCurrentItem().getId() ));
> }
>
> 4. In list.html use following construction
> <span jwcid="@Foreach" source="list" value="currentItem">
> <a jwcid="@contrib:PopupLink" herf="ognl:popupUrl" ><span
> jwcid="@Insert" value="ognl:currentItem.name"/> </a>
> <span>
>
> 5. implements select() listener for item.html
>
> public void selectSurvey( IRequestCycle cycle )
> {
> Object[] params = cycle.getServiceParameters();
> int itemId = ((Integer) params[0]).intValue();
>
> setItemId( itemId );
>
> cycle.activate( this );
> }
>
> End.
>
> Anybody know hot to implement it more correctly.
>
> ---------------------------------------------------------------------
> 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: Technique to use tapestry windows as popup and technique to call listener form other page
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Rendering of links is the domain of
http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/link/ILinkRenderer.html.
The framework itself has a single implementation:
http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/link/DefaultLinkRenderer.html
An improved implementation could definately emit JavaScript to create a popup window.
All the link components (PageLink, DirectLink, etc.) include a renderer parameter for this purpose.
Apparently, I never got around to creating a PopupLinkRenderer implementation.
Your listener method would look something like:
public void editThingy(IRequestCycle cycle)
{
EditThingyPage page = (EditThingyPage)cycle.getPage("EditThingy");
Integer thingyId = (Integer)cycle.getServiceParameters()[0];
page.setThingyId(thingyId);
cycle.activate(page);
}
That's an important aspect of Tapestry; you don't violate encapsulation by having page A invoke a
listener method ono page B. Instead, the listener method is on page A and the connection to page B
occurs in Java code.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com
> -----Original Message-----
> From: Konstantin Sharenkov
> [mailto:Konstantin.Sharenkov@enterra-inc.com]
> Sent: Wednesday, October 08, 2003 5:50 AM
> To: Tapestry users
> Subject: Technique to use tapestry windows as popup and
> technique to call listener form other page
>
>
> Keywords: popup link action DirectLink ActionLink PageLink
>
> (
> To tapestry developers:
> The followed techniques is need on because I don't find how
> to realize this behavior by standard tapestry techniques.
> )
>
> Situation:
> I have a page with list of items [list.html].
> When item clicked I want to open popup tapestry window for
> editing [item.html].
>
> Problem 1. I can't call tapestry window as popup.
> Problem 2. If I call window as popup I want to set current
> item for the page. I can do it only in event listener. But
> PageLink is not produce event.
>
> (
> To Tapestry developers:
> I think it is good idea implement popup properties for
> XXXXLink components family
> like <a href="#" jwcid="@PageLink" page="Help" popup="true"
> popupName="helpWindow"> help </a>
> or create new component PopupPageLink
> )
>
>
> Solution.
> 1.
> Create component on item page and make it invisible.
> <span jwcid="selectItem@DirectLink" listener="select"
> parameters="ognl:0" style="display:none;"/>
>
> 2. Use following class
> public class TapestryHelper
> {
> public static String getDirectLinkRef( IRequestCycle
> cycle, String page_name, String link_name, Object params )
> {
> IPage page = cycle.getPage( page_name );
> DirectLink component = (DirectLink)
> page.getComponent( link_name );
> component.setProperty( "parameters", params );
> ILink link = component.getLink( cycle );
> return link.getURL( null, true );
> }
> }
>
> 3. Create getter for list.html
>
> public String getPopupUrl()
> {
> return TapestryHelper.getDirectLinkRef( getRequestCycle(),
> "item", "select", new Integer(
> getCurrentItem().getId() ));
> }
>
> 4. In list.html use following construction
> <span jwcid="@Foreach" source="list" value="currentItem">
> <a jwcid="@contrib:PopupLink" herf="ognl:popupUrl" ><span
> jwcid="@Insert" value="ognl:currentItem.name"/> </a> <span>
>
> 5. implements select() listener for item.html
>
> public void selectSurvey( IRequestCycle cycle )
> {
> Object[] params = cycle.getServiceParameters();
> int itemId = ((Integer) params[0]).intValue();
>
> setItemId( itemId );
>
> cycle.activate( this );
> }
>
> End.
>
> Anybody know hot to implement it more correctly.
>
> ---------------------------------------------------------------------
> 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