You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mansour Al Akeel <ma...@gmail.com> on 2011/03/28 01:37:04 UTC

Highlight current/clicked AjaxLink

Hello all,
I have created a dynamic menu using AjaxLink. Clicking a link results in
dispalying the correcponding class on the screen. It's common, to
display the clicked link in a different color/background ... etc.

But I wasn't able to find a way to achieve this. 
Any advice tutorial, article ?

I am using 1.5-rc2





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


Re: Highlight current/clicked AjaxLink

Posted by Mansour Al Akeel <ma...@gmail.com>.
No answer yet. 

Any thing not clear ?

On Sun Mar 27,2011 07:37 pm, Mansour Al Akeel wrote:
> Hello all,
> I have created a dynamic menu using AjaxLink. Clicking a link results in
> dispalying the correcponding class on the screen. It's common, to
> display the clicked link in a different color/background ... etc.
> 
> But I wasn't able to find a way to achieve this. 
> Any advice tutorial, article ?
> 
> I am using 1.5-rc2
> 
> 
> 
> 

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


Re: Highlight current/clicked AjaxLink

Posted by Mansour Al Akeel <ma...@gmail.com>.
Josh, I tried to run the app, but I couldn't resolve an issue with
maven. May be you have seen something similar before. I had deleted the corresponding wicket/1.4.12 direcotry 
from maven repo to forse it to re download, but no luck. I am using maven 3. Do I need to install all these required projects manaully ?


Apache Maven 3.0.1 (r1038046; 2010-11-23 05:58:32-0500)
Java version: 1.6.0_24
Java home: /opt/sun-jdk-1.6.0.24/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux" version: "2.6.36-gentoo-r5" arch: "amd64" Family: "unix"


[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.josh:demoapp:war:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.mortbay.jetty:maven-jetty-plugin is missing. @ line 174, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 163, column 12
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-eclipse-plugin is missing. @ line 178, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demoapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-jetty-plugin:6.1.22:run (default-cli) @ demoapp >>>
[WARNING] The POM for org.apache.wicket:wicket:jar:1.4.12 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.wicket:wicket-extensions:jar:1.4.12 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.wicket:wicket-guice:jar:1.4.12 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.google.inject:guice-servlet:jar:2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.wideplay.warp:warp-persist:jar:2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-entitymanager:jar:3.5.1-Final is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.hibernate:hibernate-validator:jar:4.0.2.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ demoapp ---
[WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ demoapp ---
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[INFO] Compiling 25 source files to /home/mansour/downloads/demoapp/demoapp/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket/1.4.12/wicket-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket-extensions/1.4.12/wicket-extensions-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket-guice/1.4.12/wicket-guice-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/com/google/inject/guice-servlet/2.0/guice-servlet-2.0.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/com/wideplay/warp/warp-persist/2.0/warp-persist-2.0.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.1-Final/hibernate-entitymanager-3.5.1-Final.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/hibernate/hibernate-validator/4.0.2.GA/hibernate-validator-4.0.2.GA.jar; error in opening zip file
[INFO] 7 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.509s
[INFO] Finished at: Mon Mar 28 12:09:37 EDT 2011
[INFO] Final Memory: 4M/113M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project demoapp: Compilation failure: Compilation failure:
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket/1.4.12/wicket-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket-extensions/1.4.12/wicket-extensions-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/apache/wicket/wicket-guice/1.4.12/wicket-guice-1.4.12.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/com/google/inject/guice-servlet/2.0/guice-servlet-2.0.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/com/wideplay/warp/warp-persist/2.0/warp-persist-2.0.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.1-Final/hibernate-entitymanager-3.5.1-Final.jar; error in opening zip file
[ERROR] error: error reading /home/mansour/.m2/repository/org/hibernate/hibernate-validator/4.0.2.GA/hibernate-validator-4.0.2.GA.jar; error in opening zip file
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException



On Mon Mar 28,2011 11:00 am, Josh Kamau wrote:
> I have attached a simple application to show you how to highlight the
> selected link. I hope it helps. Check the sources and the css.
> 
> Regards.



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


Re: Highlight current/clicked AjaxLink

Posted by Josh Kamau <jo...@gmail.com>.
I have attached a simple application to show you how to highlight the
selected link. I hope it helps. Check the sources and the css.

Regards.

Re: Highlight current/clicked AjaxLink

Posted by Mansour Al Akeel <ma...@gmail.com>.
Marco, thank you.
I have implemented already the pages as a panel to be replaced, and this
was a requirement to do it with ajax. So I can not follow this route at
this point. But what you have here is the exact functionality I am
after. It will be nice if I can disable the current link, but I need to
at least show it's current in the style.


On Mon Mar 28,2011 08:46 am, Marco Springer wrote:
> Hi Mansour
> 
> For reloading different pages I'm using BookmarkablePageLink
> (non-ajax), that have the option for "setAutoEnable(true)'.
> When this option is set for each BookmarkablePageLink and one
> BookmarkablePageLink is clicked on the website, the generated HTML for
> that link is changed.
> For example:
> My current page is Home and the other available page link is the Gallery.
> 
> <span><em>Home</em></span>
> <a href="gallery">Gallery</a>
> 
> After clicking on the Gallery button:
> <a href="home">Home</a>
> <span><em>Gallery</em></span>
> 
> I think this does the job perfectly, in my case... Perhaps you can
> apply it for your case as well.
> 
> For a more detailed description:
> http://wicketstuff.org/wicket14/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.BookmarkablePageLinkPage
> 
> G'luck
> 
> Marco.
> 
> On 28 March 2011 07:48, Mansour Al Akeel <ma...@gmail.com> wrote:
> > Josh,
> > Yes each link is reloading a different page, and the list of the links
> > is not rebuilt. Only the contents part of the page.
> > What would your css alternative solution be ? How can I get the clicked
> > link disabled and assing it a class, excluding the rest of the links,
> > without breaking the ajax functionality for the AjaxLink ?
> >
> > On Mon Mar 28,2011 07:51 am, Josh Kamau wrote:
> >> hi.
> >>
> >> Have you tried something like
> >>
> >> ?myLink.add(new AttributeAppender(...));
> >>
> >> or
> >>
> >> myLink.add(new AttributeModifier(...))
> >>
> >> this methods can add/modify a css class in a markup element.
> >>
> >> Please check the javadocs for method details if this is what you want.
> >>
> >> However, if i were in your situation, i would use css only to archieve this
> >> , that is , if each link reloads a different page.
> >>
> >>
> >> Josh.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

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


Re: Highlight current/clicked AjaxLink

Posted by Marco Springer <ma...@gmail.com>.
Hi Mansour

For reloading different pages I'm using BookmarkablePageLink
(non-ajax), that have the option for "setAutoEnable(true)'.
When this option is set for each BookmarkablePageLink and one
BookmarkablePageLink is clicked on the website, the generated HTML for
that link is changed.
For example:
My current page is Home and the other available page link is the Gallery.

<span><em>Home</em></span>
<a href="gallery">Gallery</a>

After clicking on the Gallery button:
<a href="home">Home</a>
<span><em>Gallery</em></span>

I think this does the job perfectly, in my case... Perhaps you can
apply it for your case as well.

For a more detailed description:
http://wicketstuff.org/wicket14/compref/?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.BookmarkablePageLinkPage

G'luck

Marco.

On 28 March 2011 07:48, Mansour Al Akeel <ma...@gmail.com> wrote:
> Josh,
> Yes each link is reloading a different page, and the list of the links
> is not rebuilt. Only the contents part of the page.
> What would your css alternative solution be ? How can I get the clicked
> link disabled and assing it a class, excluding the rest of the links,
> without breaking the ajax functionality for the AjaxLink ?
>
> On Mon Mar 28,2011 07:51 am, Josh Kamau wrote:
>> hi.
>>
>> Have you tried something like
>>
>>  myLink.add(new AttributeAppender(...));
>>
>> or
>>
>> myLink.add(new AttributeModifier(...))
>>
>> this methods can add/modify a css class in a markup element.
>>
>> Please check the javadocs for method details if this is what you want.
>>
>> However, if i were in your situation, i would use css only to archieve this
>> , that is , if each link reloads a different page.
>>
>>
>> Josh.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Highlight current/clicked AjaxLink

Posted by Mansour Al Akeel <ma...@gmail.com>.
Josh,
Yes each link is reloading a different page, and the list of the links
is not rebuilt. Only the contents part of the page. 
What would your css alternative solution be ? How can I get the clicked
link disabled and assing it a class, excluding the rest of the links,
without breaking the ajax functionality for the AjaxLink ?

On Mon Mar 28,2011 07:51 am, Josh Kamau wrote:
> hi.
> 
> Have you tried something like
> 
>  myLink.add(new AttributeAppender(...));
> 
> or
> 
> myLink.add(new AttributeModifier(...))
> 
> this methods can add/modify a css class in a markup element.
> 
> Please check the javadocs for method details if this is what you want.
> 
> However, if i were in your situation, i would use css only to archieve this
> , that is , if each link reloads a different page.
> 
> 
> Josh.

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


Re: Highlight current/clicked AjaxLink

Posted by Josh Kamau <jo...@gmail.com>.
hi.

Have you tried something like

 myLink.add(new AttributeAppender(...));

or

myLink.add(new AttributeModifier(...))

this methods can add/modify a css class in a markup element.

Please check the javadocs for method details if this is what you want.

However, if i were in your situation, i would use css only to archieve this
, that is , if each link reloads a different page.


Josh.

Re: Highlight current/clicked AjaxLink

Posted by Mansour Al Akeel <ma...@gmail.com>.
Bruno,
There' no bug here. It's just something I need to do, and unable to find
a way to do it with wicket. All I need to do is to highlight the clicked
ajaxLink in a list. I am not sure how to add a css class to this link
only, knowing that there is other links in this list.

I just didn't get any response, so I thought something not clear.


On Mon Mar 28,2011 01:13 am, Bruno Borges wrote:
> Please provide a quickstart with the use case, so we can reproduce the bug.
> 
> 
> Bruno Borges
> www.brunoborges.com.br
> +55 21 76727099
> 
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
>  - Francois de La Rochefoucauld
> 
> 
> 
> On Sun, Mar 27, 2011 at 8:37 PM, Mansour Al Akeel <mansour.alakeel@gmail.com
> > wrote:
> 
> > Hello all,
> > I have created a dynamic menu using AjaxLink. Clicking a link results in
> > dispalying the correcponding class on the screen. It's common, to
> > display the clicked link in a different color/background ... etc.
> >
> > But I wasn't able to find a way to achieve this.
> > Any advice tutorial, article ?
> >
> > I am using 1.5-rc2
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >

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


Re: Highlight current/clicked AjaxLink

Posted by Bruno Borges <br...@gmail.com>.
Please provide a quickstart with the use case, so we can reproduce the bug.


Bruno Borges
www.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
 - Francois de La Rochefoucauld



On Sun, Mar 27, 2011 at 8:37 PM, Mansour Al Akeel <mansour.alakeel@gmail.com
> wrote:

> Hello all,
> I have created a dynamic menu using AjaxLink. Clicking a link results in
> dispalying the correcponding class on the screen. It's common, to
> display the clicked link in a different color/background ... etc.
>
> But I wasn't able to find a way to achieve this.
> Any advice tutorial, article ?
>
> I am using 1.5-rc2
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>