need to replace markup css classes dynamically

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

need to replace markup css classes dynamically

rajeev_yadav
Hi,

I have a wicket panel. I want to replace the class variables of markup dynamically based on certain conditions. Below is the markup snippet:

<wicket:panel>
<div class="${noticesStyle}" wicket:id="noticescontainer">
       

Notices

        <div class="${noticesStyle}">
                <p>[message]</p>
                <p class="jump"><wicket:message key="my.documents.link.label"/></p>
        </div>
</div>
</wicket:panel>


=======

In this markup I need to replace ${noticesStyle} variable through java class based on certain condition when this panel loads.

In this markup,
noicesContainer is a webcontainer
message is a label.

Can you please help me how this can be achieved in wicket 1.4.
kbs
Reply | Threaded
Open this post in threaded view
|

Re: need to replace markup css classes dynamically

kbs
Hello,

Use panel.add(new SimpleAttributeModifer("class", "classname");

Refer:

https://cwiki.apache.org/WICKET/how-to-modify-an-attribute-on-a-html-tag.html
 
Kulbhushan Sharma
http://sharmakulbhushan.blogspot.com



From: rajeev_yadav [via Apache Wicket] <[hidden email]>
To: kbs <[hidden email]>
Sent: Wed, 2 February, 2011 11:08:14 AM
Subject: need to replace markup css classes dynamically

Hi,

I have a wicket panel. I want to replace the class variables of markup dynamically based on certain conditions. Below is the markup snippet:

<wicket:panel>
<div class="${noticesStyle}" wicket:id="noticescontainer">
        <h3 class="${noticesStyle}">Notices</h3>
        <div class="${noticesStyle}">
                <p>[message]</p>
                <p class="jump"><wicket:message key="my.documents.link.label"/></p>
        </div>
</div>
</wicket:panel>


=======

In this markup I need to replace ${noticesStyle} variable through java class based on certain condition when this panel loads.

In this markup,
noicesContainer is a webcontainer
message is a label.

Can you please help me how this can be achieved in wicket 1.4.


If you reply to this email, your message will be added to the discussion below:
http://apache-wicket.1842946.n4.nabble.com/need-to-replace-markup-css-classes-dynamically-tp3253435p3253435.html
To start a new topic under Apache Wicket, email [hidden email]
To unsubscribe from Apache Wicket, click here.

Reply | Threaded
Open this post in threaded view
|

Re: need to replace markup css classes dynamically

rajeev_yadav
Finally I could achieve this. There are two ways that can be used:

1. override getvariation method and create  markups with panel_varationnames. Each html will have required css

2. Using texttemplate.