Re: AW: inserting urls in script variables

2009-06-12 Thread Bas Vroling
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl 


wrote:


If I set setRenderBodyOnly(true) it doesn't work either, and  
then it
shouldn't complain anymore. (wicket is the one complaining,  
not the

applet
btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is a  
value

and
it
needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template  
code.

The
template part looks like this:

wicket:panel
   span wicket:id=familyName/span
   applet code=jalview.bin.JalviewLite width=100%  
height=750

archive=jalviewApplet.jar
   param name=file value={{URL HERE}}
   param name=embedded value=true/
   param name=showFullId value=false/
   /applet
/wicket:panel

The applet show a multiple sequence alignment that I would  
like to

be
retrieved from wicket.
In my java code I have created a link that downloads the  
file. This

works fine if I show the link on a page and click on it:

   DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
   @Override
   public void onClick() {
   String alignment = (String)
currentJalviewAlignment.getObject();
   byte[] bytes = alignment.getBytes();
   getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
   }
   };

When I try to do the obvious, replace the {{URL_HERE}} part  
with

span
wicket:id=downloadMsf/span  it complains about non- 
valid XML

and
such.

Any ideas?


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best:
http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: inserting urls in script variables

2009-06-12 Thread Wilhelmsen Tor Iver
   param name=file value={{URL HERE}}

Put some wicket:id on that, then add a WebComponent for it that you add
an AttributeModifier to, which sets the value attribute.

 When I try to do the obvious, replace the {{URL_HERE}} part 
 with span wicket:id=downloadMsf/span  it complains 
 about non-valid XML and such.

There are basically two groups of web frameworks: 

The strict group parses the HTML in the templates and (if they use
their own tags) requires the templates to conform to XHTML syntax. Tags
and attributes specific to the framework form parts of proper XML
namespaces. Wicket, Facelets and Tapestry belong to this group as far as
I know. These are the more powerfuil since they can manipulate the DOM
at render time while maintaining a designer-friendly template without
too much mess. 

The lenient group only bothers with its own tags/commands etc. and
treats the rest of the template as just text that should be outputted to
the stream without a question about structure. JSP, Velocity, Webmacro
and many others belong to this group, which is large because it is far
easier to write parsers for this approach, for some definitions of
easier :). This is the reason you can do e.g. a href=%= url % in
JSP because JSP turns that into outputting of the string a href=\,
the value of url, then the string \. It never sees the a element.
However, since it deals with JSP and JSTL tags in the same step, you
cannot do e.g. c:if test=%= somevariable % but need to use EL
instead. 

(Did I mention that JSP is a horrid mess and EL is just mascara on a
pig? Well, consider it mentioned. :) )

- Tor Iver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: inserting urls in script variables

2009-06-12 Thread Jeremy Thomerson
(
                             value,
 urlFor(dlink.getRequestCycle().getRequestTarget();

 but that gives me the url of the page, not the downloadlink.

 On 10 Jun, at 11:46, Martijn Dashorst wrote:

 urlFor(dlink)?

 Martijn

 On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl
 wrote:

 Ok, that is starting to work, thanks! Now I only need to get the url
 in
 the
 simpleAttributeModifier. This doesn't accept models but needs a
 CharSequence, which does seem logical but how do I get the actual
 URL
 of
 the
 dlink model in there?

 On 10 Jun, at 10:48, Martijn Dashorst wrote:

 param wicket:id=filename /

 add(new WebMarkupContainer(filename).add(new
 SimpleAttributeModifier(value, ...)));

 On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl
 wrote:

 If I set setRenderBodyOnly(true) it doesn't work either, and then
 it
 shouldn't complain anymore. (wicket is the one complaining, not
 the
 applet
 btw)



 On 10 Jun, at 09:53, Dorothée Giernoth wrote:

 b/c you can't put a tag into a tag ... as it says: it is a value
 and
 it
 needs a value, not a tag ... xml doesn't work that way


 -Ursprüngliche Nachricht-
 Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
 Gesendet: Mittwoch, 10. Juni 2009 09:41
 An: users@wicket.apache.org
 Betreff: inserting urls in script variables

 Hi guys,

 I'm trying to insert a download url in a piece of template code.
 The
 template part looks like this:

 wicket:panel
   span wicket:id=familyName/span
   applet code=jalview.bin.JalviewLite width=100%
 height=750
 archive=jalviewApplet.jar
           param name=file value={{URL HERE}}
           param name=embedded value=true/
           param name=showFullId value=false/
   /applet
 /wicket:panel

 The applet show a multiple sequence alignment that I would like
 to
 be
 retrieved from wicket.
 In my java code I have created a link that downloads the file.
 This
 works fine if I show the link on a page and click on it:

   DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
           @Override
           public void onClick() {
                   String alignment = (String)
 currentJalviewAlignment.getObject();
                   byte[] bytes = alignment.getBytes();
                   getRequestCycle().setRequestTarget(new
 AlignmentRequestTarget(bytes, alignment + .fasta));
           }
   };

 When I try to do the obvious, replace the {{URL_HERE}} part with
 span
 wicket:id=downloadMsf/span  it complains about non-valid XML
 and
 such.

 Any ideas?



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 --
 Become a Wicket expert, learn from the best:
 http://wicketinaction.com
 Apache Wicket 1.3.5 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 --
 Become a Wicket expert, learn from the best:
 http://wicketinaction.com
 Apache Wicket 1.3.5 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.5 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h

Re: AW: inserting urls in script variables

2009-06-12 Thread Bas Vroling
(
value,
urlFor(dlink.getRequestCycle().getRequestTarget();

but that gives me the url of the page, not the downloadlink.

On 10 Jun, at 11:46, Martijn Dashorst wrote:


urlFor(dlink)?

Martijn

On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl 


wrote:


Ok, that is starting to work, thanks! Now I only need to get  
the url

in
the
simpleAttributeModifier. This doesn't accept models but  
needs a
CharSequence, which does seem logical but how do I get the  
actual

URL
of
the
dlink model in there?

On 10 Jun, at 10:48, Martijn Dashorst wrote:


param wicket:id=filename /

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl 


wrote:


If I set setRenderBodyOnly(true) it doesn't work either,  
and then

it
shouldn't complain anymore. (wicket is the one  
complaining, not

the
applet
btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is  
a value

and
it
needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of  
template code.

The
template part looks like this:

wicket:panel
  span wicket:id=familyName/span
  applet code=jalview.bin.JalviewLite width=100%
height=750
archive=jalviewApplet.jar
  param name=file value={{URL HERE}}
  param name=embedded value=true/
  param name=showFullId value=false/
  /applet
/wicket:panel

The applet show a multiple sequence alignment that I  
would like

to
be
retrieved from wicket.
In my java code I have created a link that downloads the  
file.

This
works fine if I show the link on a page and click on it:

  DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
  @Override
  public void onClick() {
  String alignment = (String)
currentJalviewAlignment.getObject();
  byte[] bytes = alignment.getBytes();
  getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
  }
  };

When I try to do the obvious, replace the {{URL_HERE}}  
part with

span
wicket:id=downloadMsf/span  it complains about non- 
valid XML

and
such.

Any ideas?



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users- 
h...@wicket.apache.org







--
Become a Wicket expert, learn from the best:
http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best:
http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Re: AW: inserting urls in script variables

2009-06-11 Thread Bas Vroling

So does anyone have an idea how to fix this?


On 10 Jun, at 12:42, Bas Vroling wrote:

Thanks for the extensive feedback, but urlFor() does not accept that  
as input...
I tried being smart and did this (please correct me if this is  
nonsense):


add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

value, 
dlink.urlFor(ILinkListener.INTERFACE;

when I access the pages it gives the following error:

java.lang.IllegalStateException: No Page found for component  
[MarkupContainer [Component id = downloadMsf]]

at org.apache.wicket.Component.getPage(Component.java:1755)

although the component is added to the panel. Here's the complete  
code:


public JalViewPanel(String id, DefaultMutableTreeNode treeNode) {
super(id);
activeNode = treeNode;

		DownloadLink dlink = new DownloadLink(downloadMsf,  
currentJalviewAlignment) {

@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new  
AlignmentRequestTarget(bytes, alignment.fasta));

}
};

add(dlink);
		add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

value, 
dlink.urlFor(ILinkListener.INTERFACE;
}

On 10 Jun, at 12:10, Martijn Dashorst wrote:

You could always look at the source for how Link does it: getURL()  
calls:


/**
 * Gets the url to use for this link.
 *
 * @return The URL that this link links to
 */
protected CharSequence getURL()
{
return urlFor(ILinkListener.INTERFACE);
}

which calls:

Component#urlFor(this, ILinkListener.INTERFACE)

so you should call:

urlFor(dlink, ILinkListener.INTERFACE)

Martijn

On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
wrote:
I'm feeling not really smart here, but that doesn't work. urlFor  
needs

something like a irequesttarget. I tried something like this:

add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

  value,
urlFor(dlink.getRequestCycle().getRequestTarget();

but that gives me the url of the page, not the downloadlink.

On 10 Jun, at 11:46, Martijn Dashorst wrote:


urlFor(dlink)?

Martijn

On Wed, Jun 10, 2009 at 11:27 AM, Bas  
Vrolingbvrol...@cmbi.ru.nl wrote:


Ok, that is starting to work, thanks! Now I only need to get the  
url in

the
simpleAttributeModifier. This doesn't accept models but needs a
CharSequence, which does seem logical but how do I get the  
actual URL of

the
dlink model in there?

On 10 Jun, at 10:48, Martijn Dashorst wrote:


param wicket:id=filename /

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas  
Vrolingbvrol...@cmbi.ru.nl wrote:


If I set setRenderBodyOnly(true) it doesn't work either, and  
then it
shouldn't complain anymore. (wicket is the one complaining,  
not the

applet
btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is a  
value and

it
needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template  
code. The

template part looks like this:

wicket:panel
span wicket:id=familyName/span
applet code=jalview.bin.JalviewLite width=100%  
height=750

archive=jalviewApplet.jar
param name=file value={{URL HERE}}
param name=embedded value=true/
param name=showFullId value=false/
/applet
/wicket:panel

The applet show a multiple sequence alignment that I would  
like to be

retrieved from wicket.
In my java code I have created a link that downloads the  
file. This

works fine if I show the link on a page and click on it:

DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
@Override
public void onClick() {
String alignment = (String)
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
}
};

When I try to do the obvious, replace the {{URL_HERE}} part  
with span
wicket:id=downloadMsf/span  it complains about non-valid  
XML and

such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail

Re: AW: inserting urls in script variables

2009-06-11 Thread Jeremy Thomerson
Look at the source - it has getURL which is a protected method.  If
you really can't figure out how to use urlFor(...) from the source -
then override getURL as such:

public CharSequence getURL() {
return super.getURL();
}

Make it public and use it to get the URL.  You can ascertain all of
this from the source.


--
Jeremy Thomerson
http://www.wickettraining.com




On Thu, Jun 11, 2009 at 4:18 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:
 So does anyone have an idea how to fix this?


 On 10 Jun, at 12:42, Bas Vroling wrote:

 Thanks for the extensive feedback, but urlFor() does not accept that as
 input...
 I tried being smart and did this (please correct me if this is nonsense):

 add(new WebMarkupContainer(filename).add(new SimpleAttributeModifier(
                                value,
 dlink.urlFor(ILinkListener.INTERFACE;

 when I access the pages it gives the following error:

 java.lang.IllegalStateException: No Page found for component
 [MarkupContainer [Component id = downloadMsf]]
    at org.apache.wicket.Component.getPage(Component.java:1755)

 although the component is added to the panel. Here's the complete code:

 public JalViewPanel(String id, DefaultMutableTreeNode treeNode) {
                super(id);
                activeNode = treeNode;

                DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
                       �...@override
                        public void onClick() {
                                String alignment = (String)
 currentJalviewAlignment.getObject();
                                byte[] bytes = alignment.getBytes();
                                getRequestCycle().setRequestTarget(new
 AlignmentRequestTarget(bytes, alignment.fasta));
                        }
                };

                add(dlink);
                add(new WebMarkupContainer(filename).add(new
 SimpleAttributeModifier(
                                value,
 dlink.urlFor(ILinkListener.INTERFACE;
        }

 On 10 Jun, at 12:10, Martijn Dashorst wrote:

 You could always look at the source for how Link does it: getURL() calls:

        /**
         * Gets the url to use for this link.
         *
         * @return The URL that this link links to
         */
        protected CharSequence getURL()
        {
                return urlFor(ILinkListener.INTERFACE);
        }

 which calls:

 Component#urlFor(this, ILinkListener.INTERFACE)

 so you should call:

 urlFor(dlink, ILinkListener.INTERFACE)

 Martijn

 On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:

 I'm feeling not really smart here, but that doesn't work. urlFor needs
 something like a irequesttarget. I tried something like this:

 add(new WebMarkupContainer(filename).add(new SimpleAttributeModifier(
                              value,
 urlFor(dlink.getRequestCycle().getRequestTarget();

 but that gives me the url of the page, not the downloadlink.

 On 10 Jun, at 11:46, Martijn Dashorst wrote:

 urlFor(dlink)?

 Martijn

 On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl
 wrote:

 Ok, that is starting to work, thanks! Now I only need to get the url
 in
 the
 simpleAttributeModifier. This doesn't accept models but needs a
 CharSequence, which does seem logical but how do I get the actual URL
 of
 the
 dlink model in there?

 On 10 Jun, at 10:48, Martijn Dashorst wrote:

 param wicket:id=filename /

 add(new WebMarkupContainer(filename).add(new
 SimpleAttributeModifier(value, ...)));

 On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl
 wrote:

 If I set setRenderBodyOnly(true) it doesn't work either, and then it
 shouldn't complain anymore. (wicket is the one complaining, not the
 applet
 btw)



 On 10 Jun, at 09:53, Dorothée Giernoth wrote:

 b/c you can't put a tag into a tag ... as it says: it is a value
 and
 it
 needs a value, not a tag ... xml doesn't work that way


 -Ursprüngliche Nachricht-
 Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
 Gesendet: Mittwoch, 10. Juni 2009 09:41
 An: users@wicket.apache.org
 Betreff: inserting urls in script variables

 Hi guys,

 I'm trying to insert a download url in a piece of template code.
 The
 template part looks like this:

 wicket:panel
    span wicket:id=familyName/span
    applet code=jalview.bin.JalviewLite width=100% height=750
 archive=jalviewApplet.jar
            param name=file value={{URL HERE}}
            param name=embedded value=true/
            param name=showFullId value=false/
    /applet
 /wicket:panel

 The applet show a multiple sequence alignment that I would like to
 be
 retrieved from wicket.
 In my java code I have created a link that downloads the file. This
 works fine if I show the link on a page and click on it:

    DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
           �...@override
            public void onClick() {
                    String alignment = (String)
 currentJalviewAlignment.getObject

inserting urls in script variables

2009-06-10 Thread Bas Vroling

Hi guys,

I'm trying to insert a download url in a piece of template code. The  
template part looks like this:


wicket:panel
span wicket:id=familyName/span
	applet code=jalview.bin.JalviewLite width=100% height=750  
archive=jalviewApplet.jar

param name=file value={{URL HERE}}
param name=embedded value=true/
param name=showFullId value=false/
/applet
/wicket:panel

The applet show a multiple sequence alignment that I would like to be  
retrieved from wicket.
In my java code I have created a link that downloads the file. This  
works fine if I show the link on a page and click on it:


	DownloadLink dlink = new DownloadLink(downloadMsf,  
currentJalviewAlignment) {

@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
			getRequestCycle().setRequestTarget(new  
AlignmentRequestTarget(bytes, alignment + .fasta));

}
};

When I try to do the obvious, replace the {{URL_HERE}} part with span  
wicket:id=downloadMsf/span  it complains about non-valid XML and  
such.


Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AW: inserting urls in script variables

2009-06-10 Thread Dorothée Giernoth
b/c you can't put a tag into a tag ... as it says: it is a value and it needs a 
value, not a tag ... xml doesn't work that way 

 
-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl] 
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template code. The  
template part looks like this:

wicket:panel
span wicket:id=familyName/span
applet code=jalview.bin.JalviewLite width=100% height=750  
archive=jalviewApplet.jar
param name=file value={{URL HERE}}
param name=embedded value=true/
param name=showFullId value=false/
/applet
/wicket:panel

The applet show a multiple sequence alignment that I would like to be  
retrieved from wicket.
In my java code I have created a link that downloads the file. This  
works fine if I show the link on a page and click on it:

DownloadLink dlink = new DownloadLink(downloadMsf,  
currentJalviewAlignment) {
@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new  
AlignmentRequestTarget(bytes, alignment + .fasta));
}
};

When I try to do the obvious, replace the {{URL_HERE}} part with span  
wicket:id=downloadMsf/span  it complains about non-valid XML and  
such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: inserting urls in script variables

2009-06-10 Thread Bas Vroling
If I set setRenderBodyOnly(true) it doesn't work either, and then it  
shouldn't complain anymore. (wicket is the one complaining, not the  
applet btw)




On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is a value and  
it needs a value, not a tag ... xml doesn't work that way



-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template code. The
template part looks like this:

wicket:panel
span wicket:id=familyName/span
applet code=jalview.bin.JalviewLite width=100% height=750
archive=jalviewApplet.jar
param name=file value={{URL HERE}}
param name=embedded value=true/
param name=showFullId value=false/
/applet
/wicket:panel

The applet show a multiple sequence alignment that I would like to be
retrieved from wicket.
In my java code I have created a link that downloads the file. This
works fine if I show the link on a page and click on it:

DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
}
};

When I try to do the obvious, replace the {{URL_HERE}} part with span
wicket:id=downloadMsf/span  it complains about non-valid XML and
such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: inserting urls in script variables

2009-06-10 Thread Martijn Dashorst
param wicket:id=filename /

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:
 If I set setRenderBodyOnly(true) it doesn't work either, and then it
 shouldn't complain anymore. (wicket is the one complaining, not the applet
 btw)



 On 10 Jun, at 09:53, Dorothée Giernoth wrote:

 b/c you can't put a tag into a tag ... as it says: it is a value and it
 needs a value, not a tag ... xml doesn't work that way


 -Ursprüngliche Nachricht-
 Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
 Gesendet: Mittwoch, 10. Juni 2009 09:41
 An: users@wicket.apache.org
 Betreff: inserting urls in script variables

 Hi guys,

 I'm trying to insert a download url in a piece of template code. The
 template part looks like this:

 wicket:panel
        span wicket:id=familyName/span
        applet code=jalview.bin.JalviewLite width=100% height=750
 archive=jalviewApplet.jar
                param name=file value={{URL HERE}}
                param name=embedded value=true/
                param name=showFullId value=false/
        /applet
 /wicket:panel

 The applet show a multiple sequence alignment that I would like to be
 retrieved from wicket.
 In my java code I have created a link that downloads the file. This
 works fine if I show the link on a page and click on it:

        DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
               �...@override
                public void onClick() {
                        String alignment = (String)
 currentJalviewAlignment.getObject();
                        byte[] bytes = alignment.getBytes();
                        getRequestCycle().setRequestTarget(new
 AlignmentRequestTarget(bytes, alignment + .fasta));
                }
        };

 When I try to do the obvious, replace the {{URL_HERE}} part with span
 wicket:id=downloadMsf/span  it complains about non-valid XML and
 such.

 Any ideas?

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: inserting urls in script variables

2009-06-10 Thread Bas Vroling
Ok, that is starting to work, thanks! Now I only need to get the url  
in the simpleAttributeModifier. This doesn't accept models but needs a  
CharSequence, which does seem logical but how do I get the actual URL  
of the dlink model in there?


On 10 Jun, at 10:48, Martijn Dashorst wrote:


param wicket:id=filename /

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
wrote:

If I set setRenderBodyOnly(true) it doesn't work either, and then it
shouldn't complain anymore. (wicket is the one complaining, not the  
applet

btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is a value  
and it

needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template code. The
template part looks like this:

wicket:panel
   span wicket:id=familyName/span
   applet code=jalview.bin.JalviewLite width=100%  
height=750

archive=jalviewApplet.jar
   param name=file value={{URL HERE}}
   param name=embedded value=true/
   param name=showFullId value=false/
   /applet
/wicket:panel

The applet show a multiple sequence alignment that I would like to  
be

retrieved from wicket.
In my java code I have created a link that downloads the file. This
works fine if I show the link on a page and click on it:

   DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
   @Override
   public void onClick() {
   String alignment = (String)
currentJalviewAlignment.getObject();
   byte[] bytes = alignment.getBytes();
   getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
   }
   };

When I try to do the obvious, replace the {{URL_HERE}} part with  
span
wicket:id=downloadMsf/span  it complains about non-valid XML  
and

such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: inserting urls in script variables

2009-06-10 Thread Martijn Dashorst
You could always look at the source for how Link does it: getURL() calls:

/**
 * Gets the url to use for this link.
 *
 * @return The URL that this link links to
 */
protected CharSequence getURL()
{
return urlFor(ILinkListener.INTERFACE);
}

which calls:

Component#urlFor(this, ILinkListener.INTERFACE)

so you should call:

urlFor(dlink, ILinkListener.INTERFACE)

Martijn

On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:
 I'm feeling not really smart here, but that doesn't work. urlFor needs
 something like a irequesttarget. I tried something like this:

 add(new WebMarkupContainer(filename).add(new SimpleAttributeModifier(
                                value,
 urlFor(dlink.getRequestCycle().getRequestTarget();

 but that gives me the url of the page, not the downloadlink.

 On 10 Jun, at 11:46, Martijn Dashorst wrote:

 urlFor(dlink)?

 Martijn

 On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:

 Ok, that is starting to work, thanks! Now I only need to get the url in
 the
 simpleAttributeModifier. This doesn't accept models but needs a
 CharSequence, which does seem logical but how do I get the actual URL of
 the
 dlink model in there?

 On 10 Jun, at 10:48, Martijn Dashorst wrote:

 param wicket:id=filename /

 add(new WebMarkupContainer(filename).add(new
 SimpleAttributeModifier(value, ...)));

 On Wed, Jun 10, 2009 at 9:57 AM, Bas Vrolingbvrol...@cmbi.ru.nl wrote:

 If I set setRenderBodyOnly(true) it doesn't work either, and then it
 shouldn't complain anymore. (wicket is the one complaining, not the
 applet
 btw)



 On 10 Jun, at 09:53, Dorothée Giernoth wrote:

 b/c you can't put a tag into a tag ... as it says: it is a value and
 it
 needs a value, not a tag ... xml doesn't work that way


 -Ursprüngliche Nachricht-
 Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
 Gesendet: Mittwoch, 10. Juni 2009 09:41
 An: users@wicket.apache.org
 Betreff: inserting urls in script variables

 Hi guys,

 I'm trying to insert a download url in a piece of template code. The
 template part looks like this:

 wicket:panel
      span wicket:id=familyName/span
      applet code=jalview.bin.JalviewLite width=100% height=750
 archive=jalviewApplet.jar
              param name=file value={{URL HERE}}
              param name=embedded value=true/
              param name=showFullId value=false/
      /applet
 /wicket:panel

 The applet show a multiple sequence alignment that I would like to be
 retrieved from wicket.
 In my java code I have created a link that downloads the file. This
 works fine if I show the link on a page and click on it:

      DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
             �...@override
              public void onClick() {
                      String alignment = (String)
 currentJalviewAlignment.getObject();
                      byte[] bytes = alignment.getBytes();
                      getRequestCycle().setRequestTarget(new
 AlignmentRequestTarget(bytes, alignment + .fasta));
              }
      };

 When I try to do the obvious, replace the {{URL_HERE}} part with span
 wicket:id=downloadMsf/span  it complains about non-valid XML and
 such.

 Any ideas?

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.5 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.5 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands

Re: AW: inserting urls in script variables

2009-06-10 Thread Bas Vroling
Thanks for the extensive feedback, but urlFor() does not accept that  
as input...
I tried being smart and did this (please correct me if this is  
nonsense):


add(new WebMarkupContainer(filename).add(new SimpleAttributeModifier(
value, 
dlink.urlFor(ILinkListener.INTERFACE;

when I access the pages it gives the following error:

java.lang.IllegalStateException: No Page found for component  
[MarkupContainer [Component id = downloadMsf]]

 at org.apache.wicket.Component.getPage(Component.java:1755)

although the component is added to the panel. Here's the complete code:

public JalViewPanel(String id, DefaultMutableTreeNode treeNode) {
super(id);
activeNode = treeNode;

		DownloadLink dlink = new DownloadLink(downloadMsf,  
currentJalviewAlignment) {

@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new  
AlignmentRequestTarget(bytes, alignment.fasta));

}
};

add(dlink);
		add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

value, 
dlink.urlFor(ILinkListener.INTERFACE;
}

On 10 Jun, at 12:10, Martijn Dashorst wrote:

You could always look at the source for how Link does it: getURL()  
calls:


/**
 * Gets the url to use for this link.
 *
 * @return The URL that this link links to
 */
protected CharSequence getURL()
{
return urlFor(ILinkListener.INTERFACE);
}

which calls:

Component#urlFor(this, ILinkListener.INTERFACE)

so you should call:

urlFor(dlink, ILinkListener.INTERFACE)

Martijn

On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
wrote:
I'm feeling not really smart here, but that doesn't work. urlFor  
needs

something like a irequesttarget. I tried something like this:

add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

   value,
urlFor(dlink.getRequestCycle().getRequestTarget();

but that gives me the url of the page, not the downloadlink.

On 10 Jun, at 11:46, Martijn Dashorst wrote:


urlFor(dlink)?

Martijn

On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
wrote:


Ok, that is starting to work, thanks! Now I only need to get the  
url in

the
simpleAttributeModifier. This doesn't accept models but needs a
CharSequence, which does seem logical but how do I get the actual  
URL of

the
dlink model in there?

On 10 Jun, at 10:48, Martijn Dashorst wrote:


param wicket:id=filename /

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas  
Vrolingbvrol...@cmbi.ru.nl wrote:


If I set setRenderBodyOnly(true) it doesn't work either, and  
then it
shouldn't complain anymore. (wicket is the one complaining, not  
the

applet
btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:

b/c you can't put a tag into a tag ... as it says: it is a  
value and

it
needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template  
code. The

template part looks like this:

wicket:panel
 span wicket:id=familyName/span
 applet code=jalview.bin.JalviewLite width=100%  
height=750

archive=jalviewApplet.jar
 param name=file value={{URL HERE}}
 param name=embedded value=true/
 param name=showFullId value=false/
 /applet
/wicket:panel

The applet show a multiple sequence alignment that I would  
like to be

retrieved from wicket.
In my java code I have created a link that downloads the file.  
This

works fine if I show the link on a page and click on it:

 DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
 @Override
 public void onClick() {
 String alignment = (String)
currentJalviewAlignment.getObject();
 byte[] bytes = alignment.getBytes();
 getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
 }
 };

When I try to do the obvious, replace the {{URL_HERE}} part  
with span
wicket:id=downloadMsf/span  it complains about non-valid  
XML and

such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Re: AW: inserting urls in script variables

2009-06-10 Thread freak182

Martjin already say that:


so you should call:

urlFor(dlink, ILinkListener.INTERFACE) 

not dlink.urlFor.


Bas Vroling wrote:
 
 Thanks for the extensive feedback, but urlFor() does not accept that  
 as input...
 I tried being smart and did this (please correct me if this is  
 nonsense):
 
 add(new WebMarkupContainer(filename).add(new SimpleAttributeModifier(
   value, 
 dlink.urlFor(ILinkListener.INTERFACE;
 
 when I access the pages it gives the following error:
 
 java.lang.IllegalStateException: No Page found for component  
 [MarkupContainer [Component id = downloadMsf]]
   at org.apache.wicket.Component.getPage(Component.java:1755)
 
 although the component is added to the panel. Here's the complete code:
 
 public JalViewPanel(String id, DefaultMutableTreeNode treeNode) {
   super(id);
   activeNode = treeNode;
 
   DownloadLink dlink = new DownloadLink(downloadMsf,  
 currentJalviewAlignment) {
   @Override
   public void onClick() {
   String alignment = (String) 
 currentJalviewAlignment.getObject();
   byte[] bytes = alignment.getBytes();
   getRequestCycle().setRequestTarget(new  
 AlignmentRequestTarget(bytes, alignment.fasta));
   }
   };
 
   add(dlink);
   add(new WebMarkupContainer(filename).add(new  
 SimpleAttributeModifier(
   value, 
 dlink.urlFor(ILinkListener.INTERFACE;
   }
 
 On 10 Jun, at 12:10, Martijn Dashorst wrote:
 
 You could always look at the source for how Link does it: getURL()  
 calls:

  /**
   * Gets the url to use for this link.
   *
   * @return The URL that this link links to
   */
  protected CharSequence getURL()
  {
  return urlFor(ILinkListener.INTERFACE);
  }

 which calls:

 Component#urlFor(this, ILinkListener.INTERFACE)

 so you should call:

 urlFor(dlink, ILinkListener.INTERFACE)

 Martijn

 On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
 wrote:
 I'm feeling not really smart here, but that doesn't work. urlFor  
 needs
 something like a irequesttarget. I tried something like this:

 add(new WebMarkupContainer(filename).add(new  
 SimpleAttributeModifier(
value,
 urlFor(dlink.getRequestCycle().getRequestTarget();

 but that gives me the url of the page, not the downloadlink.

 On 10 Jun, at 11:46, Martijn Dashorst wrote:

 urlFor(dlink)?

 Martijn

 On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl  
 wrote:

 Ok, that is starting to work, thanks! Now I only need to get the  
 url in
 the
 simpleAttributeModifier. This doesn't accept models but needs a
 CharSequence, which does seem logical but how do I get the actual  
 URL of
 the
 dlink model in there?

 On 10 Jun, at 10:48, Martijn Dashorst wrote:

 

 add(new WebMarkupContainer(filename).add(new
 SimpleAttributeModifier(value, ...)));

 On Wed, Jun 10, 2009 at 9:57 AM, Bas  
 Vrolingbvrol...@cmbi.ru.nl wrote:

 If I set setRenderBodyOnly(true) it doesn't work either, and  
 then it
 shouldn't complain anymore. (wicket is the one complaining, not  
 the
 applet
 btw)



 On 10 Jun, at 09:53, Dorothée Giernoth wrote:

 b/c you can't put a tag into a tag ... as it says: it is a  
 value and
 it
 needs a value, not a tag ... xml doesn't work that way


 -Ursprüngliche Nachricht-
 Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
 Gesendet: Mittwoch, 10. Juni 2009 09:41
 An: users@wicket.apache.org
 Betreff: inserting urls in script variables

 Hi guys,

 I'm trying to insert a download url in a piece of template  
 code. The
 template part looks like this:

 wicket:panel
  
  applet code=jalview.bin.JalviewLite width=100%  
 height=750
 archive=jalviewApplet.jar
  
  
  
  /applet
 /wicket:panel

 The applet show a multiple sequence alignment that I would  
 like to be
 retrieved from wicket.
 In my java code I have created a link that downloads the file.  
 This
 works fine if I show the link on a page and click on it:

  DownloadLink dlink = new DownloadLink(downloadMsf,
 currentJalviewAlignment) {
  @Override
  public void onClick() {
  String alignment = (String)
 currentJalviewAlignment.getObject();
  byte[] bytes = alignment.getBytes();
  getRequestCycle().setRequestTarget(new
 AlignmentRequestTarget(bytes, alignment + .fasta));
  }
  };

 When I try to do the obvious, replace the {{URL_HERE}} part  
 with  wicket:id=downloadMsf  it complains about non-valid  
 XML and
 such.

 Any ideas?

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands

Re: AW: inserting urls in script variables

2009-06-10 Thread Bas Vroling
Of course I tried Martijn's suggestion, but the urlFor() function does  
not accept both the dlink  ILinkListener.INTERFACE arguments.


On 10 Jun, at 16:19, freak182 wrote:



Martjin already say that:


so you should call:

urlFor(dlink, ILinkListener.INTERFACE)

not dlink.urlFor.


Bas Vroling wrote:


Thanks for the extensive feedback, but urlFor() does not accept that
as input...
I tried being smart and did this (please correct me if this is
nonsense):

add(new WebMarkupContainer(filename).add(new  
SimpleAttributeModifier(

value, 
dlink.urlFor(ILinkListener.INTERFACE;

when I access the pages it gives the following error:

java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = downloadMsf]]
 at org.apache.wicket.Component.getPage(Component.java:1755)

although the component is added to the panel. Here's the complete  
code:


public JalViewPanel(String id, DefaultMutableTreeNode treeNode) {
super(id);
activeNode = treeNode;

DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
@Override
public void onClick() {
String alignment = (String) 
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment.fasta));
}
};

add(dlink);
add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(
value, 
dlink.urlFor(ILinkListener.INTERFACE;
}

On 10 Jun, at 12:10, Martijn Dashorst wrote:


You could always look at the source for how Link does it: getURL()
calls:

/**
 * Gets the url to use for this link.
 *
 * @return The URL that this link links to
 */
protected CharSequence getURL()
{
return urlFor(ILinkListener.INTERFACE);
}

which calls:

Component#urlFor(this, ILinkListener.INTERFACE)

so you should call:

urlFor(dlink, ILinkListener.INTERFACE)

Martijn

On Wed, Jun 10, 2009 at 11:59 AM, Bas Vrolingbvrol...@cmbi.ru.nl
wrote:

I'm feeling not really smart here, but that doesn't work. urlFor
needs
something like a irequesttarget. I tried something like this:

add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(
  value,
urlFor(dlink.getRequestCycle().getRequestTarget();

but that gives me the url of the page, not the downloadlink.

On 10 Jun, at 11:46, Martijn Dashorst wrote:


urlFor(dlink)?

Martijn

On Wed, Jun 10, 2009 at 11:27 AM, Bas Vrolingbvrol...@cmbi.ru.nl
wrote:


Ok, that is starting to work, thanks! Now I only need to get the
url in
the
simpleAttributeModifier. This doesn't accept models but needs a
CharSequence, which does seem logical but how do I get the actual
URL of
the
dlink model in there?

On 10 Jun, at 10:48, Martijn Dashorst wrote:




add(new WebMarkupContainer(filename).add(new
SimpleAttributeModifier(value, ...)));

On Wed, Jun 10, 2009 at 9:57 AM, Bas
Vrolingbvrol...@cmbi.ru.nl wrote:


If I set setRenderBodyOnly(true) it doesn't work either, and
then it
shouldn't complain anymore. (wicket is the one complaining, not
the
applet
btw)



On 10 Jun, at 09:53, Dorothée Giernoth wrote:


b/c you can't put a tag into a tag ... as it says: it is a
value and
it
needs a value, not a tag ... xml doesn't work that way


-Ursprüngliche Nachricht-
Von: Bas Vroling [mailto:bvrol...@cmbi.ru.nl]
Gesendet: Mittwoch, 10. Juni 2009 09:41
An: users@wicket.apache.org
Betreff: inserting urls in script variables

Hi guys,

I'm trying to insert a download url in a piece of template
code. The
template part looks like this:

wicket:panel

applet code=jalview.bin.JalviewLite width=100%
height=750
archive=jalviewApplet.jar



/applet
/wicket:panel

The applet show a multiple sequence alignment that I would
like to be
retrieved from wicket.
In my java code I have created a link that downloads the file.
This
works fine if I show the link on a page and click on it:

DownloadLink dlink = new DownloadLink(downloadMsf,
currentJalviewAlignment) {
@Override
public void onClick() {
String alignment = (String)
currentJalviewAlignment.getObject();
byte[] bytes = alignment.getBytes();
getRequestCycle().setRequestTarget(new
AlignmentRequestTarget(bytes, alignment + .fasta));
}
};

When I try to do the obvious, replace the {{URL_HERE}} part
with  wicket:id=downloadMsf  it complains about non- 
valid

XML and
such.

Any ideas?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional