abstract class MyLabel extends Panel {
MyLabel(String id, IModel model) {
Link link=new Link("link") { onclick() { MyLabel.this.onclick(); }}
link.add(new SimpleAttributeModifier("ondblclick", "this.onclick();");
link.setPopupSettings(PageMap.forName("my-label-pagemap").....);
link.add(new Label("label", model));
}
<wicket:panel><a wicket:id="link" href="" wicket:id="label">[[label]]</span></a></wicket:panel>
-Igor
On 10/17/06, Karl M. Davis <[EMAIL PROTECTED]> wrote:
Igor,I'm trying to have a Label (not a link) that opens a popup when double-clicked.-- Karl
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Igor Vaynberg
Sent: Tuesday, October 17, 2006 4:53 PM
To: [email protected]
Subject: Re: [Wicket-user] Open Popup via Ajaxerm, the problem is the url - if the page is not bookmarkable you cannot create a url to it without having a page instance. that would be bad cause you would be precreating the page instance so you have its url available in the page that calls it.
what is the usecase? does the link do something different if it is single clicked?
-Igor
On 10/17/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:if its not bookmarkable then you can just put that code into attribute modifier and attach it to the link. js poupup settings generates should work fine there.
-Igor
On 10/17/06, Karl M. Davis <[EMAIL PROTECTED]> wrote:Wow, that was idiotic of me. I somehow got it stuck in my head that the page I was linking to was bookmarkable-- it's not.Is there a way to have _javascript_ open a popup to a page that is not bookmarkable? Looking through the Wicket source I don't see anything quite as simple as urlFor(...) that takes a reference to a Page.-- Karl
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Igor Vaynberg
Sent: Tuesday, October 17, 2006 7:23 AM
To: [email protected]
Subject: Re: [Wicket-user] Open Popup via Ajaxthis has nothing to do with popup settings. if you have a bookmarkable page - which looks like you do because you are using that urlfor variant you must provide either the default constructonr () or since you are using parameters a (PageParemeters params) constructor.
-igpr
On 10/17/06, Karl M. Davis <[EMAIL PROTECTED]> wrote:Igor,Thanks for the reply and the suggestion to just extend AbstractBehavior. That definitely does work better.Now, however, it looks like the URL I'm generating (using Component.urlFor(Class, PageParameters)) isn't working out quite right. The generated ondblclick attribute is:<<'contentEditorPageMap', 'scrollbars=no,location=no,menuBar=no,resizable=no,status=no,toolbar=no,width=750,height=550'); return false;">>And I get a <<java.lang.NoSuchMethodException: simplepersistence.feature.dynamicPages.SnippetEditorPopupPage.<init>()>> exception when opening the popup. Is there a better way that I should be trying to do all of this? Something a little less hacky than abusing PopupSettings like this, perhaps?-- Karl
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Igor Vaynberg
Sent: Monday, October 16, 2006 9:16 PM
To: [email protected]
Subject: Re: [Wicket-user] Open Popup via Ajaxyou are kinda abusing popup settings class, its not meant to generate _javascript_ for that usecase. the problem is that "return false;" in the js it generates which is mean to abort he current click event.
you def dont need ajax to do this, try whats below
private static class DoubleClickEditorBehavior extends AbstractBehavior {
void onComponentTag(ComponentTag tag) {
PopupSettings popupSettings = new PopupSettings(PageMap
.forName("contentEditorPageMap")).setHeight(
SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(
SnippetEditorPopupPage.WINDOW_WIDTH);
popupSettings.setTarget ("'" + url + "'");
if(target != null)
tag.put("ondblclick", target.appendJavascript(popupSettings.getPopupJavaScript());
}
}
-igor
On 10/16/06, Karl M. Davis <[EMAIL PROTECTED]> wrote:Hello all,What I'm trying to do is have a Label that I can double click to open a popup window. I don't really care if it's Ajax or static _javascript_, I just need it to work. However, Ajax seemed easiest so I've added the following Ajax behavior to a Label:<<private static class DoubleClickEditorAjaxBehavior extends AjaxEventBehavior
{
// Constants
private static final long serialVersionUID = 460292942456978352L;
// Member Variables
private String url;/**
* Constructor.
*/
public DoubleClickEditorAjaxBehavior(String url)
{
super("onDblClick");
this.url = ""> }/**
* Opens the [EMAIL PROTECTED] SnippetEditorPopupPage}.
*
* @see wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget)
*/
@Override
protected void onEvent(AjaxRequestTarget target)
{
PopupSettings popupSettings = new PopupSettings(PageMap
.forName("contentEditorPageMap")).setHeight(
SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(
SnippetEditorPopupPage.WINDOW_WIDTH);
popupSettings.setTarget ("'" + url + "'");
if(target != null)
target.appendJavascript(popupSettings.getPopupJavaScript());
}
}
>>It doesn't seem to do anything, though the Ajax debug window shows the following every time I double click:<<
INFO:
INFO: Initiating Ajax GET request on /doh?wicket:interface=:0:dynamicPageContent::IBehaviorListener&wicket:behaviorId=3&random=0.5027223472182086
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (354 characters)
INFO:
<?xml version="1.0" encoding="UTF-8"?><ajax-response><evaluate><![CDATA[window.open('/doh?wicket:bookmarkablePage=:simplepersistence.feature.dynamicPages.SnippetEditorPopupPage&0=karl&1=1', 'contentEditorPageMap', 'scrollbars=no,location=no,menuBar=no,resizable=no,status=no,toolbar=no,width=750,height=550'); return false;]]></evaluate></ajax-response>
INFO: Response parsed. Now invoking steps...
ERROR: Exception evaluating _javascript_: SyntaxError: invalid return
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...>>Can anyone point out what I might be doing wrong or a better way to go about this?Thanks,Karl
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
