You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Jaruska <mi...@gmail.com> on 2013/02/10 22:23:20 UTC

Re: find html tag

again with my question: is it possible to get markup in onRender() of the component?
have found this article:
https://cwiki.apache.org/WICKET/component-rendering.html
but in onRender() section is just code snippet I'm not understand. is there more
detailed example how to get markup of the component in onRender()?

thanks, michael



On 23.1.2013 22:47, Martin Grigorov wrote:
> You can use IMarkupFilter to manipulate the raw markup before being loaded
> and used by the components.
> See the implementations in Wicket to see what can be done with such filter.
>
>
> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <michael.jaruska@gmail.com
>> wrote:
>
>> Look at my original post. User clicks on <a href="./mypage.html?cid=menu/*
>> *submenu/subsubmenu2">**subsubmenu2</a>, then
>> I have in String "category" (java code) value "menu/submenu/subsubmenu2".
>> I need just to make 2 more steps:
>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>> 2. find <li> tag which is parent of the anchor from point 1;
>>
>> When I have point 2 done, then I know how to put somethink into <li> tag...
>>
>>
>>
>>
>> On 23.1.2013 21:21, Bas Gooren wrote:
>>
>>> Ok, so you are indeed looking for a way to change a html attribute ;-)
>>>
>>> Since you wrote (in your folluw-up e-mail) that you cannot generate the
>>> html, there are some ways, but they mostly work outside of the normal
>>> wicket way.
>>>
>>> 1) In the component which actually renders your static html override
>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>> replaceComponentTagBody)
>>>
>>> 2) store the static html somewhere by itself, and create a custom model.
>>> The model can then load the html and perform string replacement.
>>> You can then add a label component which uses the model and has
>>> setEscapeModelStrings(false) set.
>>>
>>> Met vriendelijke groet,
>>> Kind regards,
>>>
>>> Bas Gooren
>>>
>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>
>>>> I need to find the parent <li> tag of the anchor user clicks - I now
>>>> from PageParameters which anchor
>>>> has been clicked. Then I will put into this parent <li> specific
>>>> atribute (id="something"). This attribute
>>>> will be then processed by JavaScript on the page.
>>>>
>>>>
>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>
>>>>> Sorry, I read too quickly.
>>>>>
>>>>> What are you trying to accomplish? Let's say you are able to find the
>>>>> appropriate html tag, what do you want to do with it?
>>>>>
>>>>> Met vriendelijke groet,
>>>>> Kind regards,
>>>>>
>>>>> Bas Gooren
>>>>>
>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>
>>>>>> And question is not "how can I change html attribute" but "how can I
>>>>>> go through html structure" and
>>>>>> find html tag with specific attribute :-)
>>>>>>
>>>>>>
>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>
>>>>>>> Hi!
>>>>>>>
>>>>>>> What you want to accomplish (e.g. changing some html attributes) can
>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>
>>>>>>> In pseudocode:
>>>>>>>
>>>>>>> RepeatingView uls = ...
>>>>>>> for_every_li:
>>>>>>> WebMarkupContainer li = ...
>>>>>>> uls.add(li);
>>>>>>>
>>>>>>> now, you can do something like this:
>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>       isEnabled() {
>>>>>>>           return true if you want to append a html attribute;
>>>>>>>       }
>>>>>>> });
>>>>>>>
>>>>>>> Or alternatively:
>>>>>>>
>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>           super(tag);
>>>>>>>
>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>       }
>>>>>>> }
>>>>>>>
>>>>>>> Met vriendelijke groet,
>>>>>>> Kind regards,
>>>>>>>
>>>>>>> Bas Gooren
>>>>>>>
>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>
>>>>>>>> I have this html structure:
>>>>>>>> <ul class="mymenu">
>>>>>>>>    <li>
>>>>>>>>      <a href="./mypage.html?cid=menu">**menu</a>
>>>>>>>>    <ul>
>>>>>>>>      <li>
>>>>>>>>        <a href="./mypage.html?cid=menu/**submenu">submenu</a>
>>>>>>>>      <ul>
>>>>>>>>        <li>
>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu1">**
>>>>>>>> subsubmenu1</a>
>>>>>>>>        </li>
>>>>>>>>        <li>
>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu2">**
>>>>>>>> subsubmenu2</a>
>>>>>>>>        </li>
>>>>>>>>        <li>
>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu3">**
>>>>>>>> subsubmenu3</a>
>>>>>>>>        </li>
>>>>>>>>      </ul>
>>>>>>>>    </ul>
>>>>>>>> </ul>
>>>>>>>>
>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>    //cid = category id
>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>    ...
>>>>>>>> }
>>>>>>>>
>>>>>>>> Now I need some way I can add atribute into parent <li> tag of <a>
>>>>>>>> tag on which I do click.
>>>>>>>> Somethink like (pseudocode):
>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>    //cid = category id
>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>    //find corresponding <a> tag
>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>> tag_by_category(category)
>>>>>>>>    //have corresponding anchor tag, get parrent tag of the anchor tag
>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>> }
>>>>>>>>
>>>>>>>> But I don't know where to start my search and I totaly don't know
>>>>>>>> whot to look for in docu.
>>>>>>>>
>>>>>>>> Please, help :-)
>>>>>>>>
>>>>>>>> ------------------------------**------------------------------**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------**------------------------------**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
Paul, thanks. Looks like I'm just two steps from final. My current code in MyPanel (stupid,
at the moment just for test):
@Override
public void onRender()
{
     MarkupStream markupStream = this.getAssociatedMarkupStream(false);
     while(markupStream.hasMore())
     {
         String myString = markupStream.next().toString(); //after last html element I get null
                                                           //pointer exception but markupStream.hasMore()
                                                           //indicate that there is more elements
         myString = myString.replaceAll("menuso", "someelse");
         System.out.println(myString);
     }
}

two more questions:
1. markupStream.hasMore() is going over MyPanel markup, when go over all markup
    it's going beyond border and after last html tag I get null pointer exception
    on markupStream.next()
2. how to write modified markup back to markupStream? Have found this:
    Response response = this.getResponse(); //in MyPanel - MyPanel is Component (extends Panel)
    response.write(CharSequence); //is this right way to write modified stream back to response?

will test same with onComponentTag(ComponentTag component), based on this:
http://stackoverflow.com/questions/4609871/wicket-getting-body-of-markup-element
now know hot to get markupStream (2 days ago my big problem).

sorry for my stupid questions, i'm still n00b ...



On 12.2.2013 18:07, Paul Bors wrote:
> You can also do it inside the onComponentTag() or onComponentTagBody():
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/Component.html#onComponentTag(org.apache.wicket.markup.ComponentTag
> )
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/Component.html#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
> org.apache.wicket.markup.ComponentTag)
>
> This is how I switched from a <DIV> to a <SPAN> when nesting forms since
> Wicket uses <DIV> that sometimes breaks my CSS inheritance:
>
> /**
>   * Wicket by default will substitute inner nested forms with DIV elements,
> we want SPAN
>   * elements to preserve the page layout.
>   *
>   * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
>   */
> @Override
> protected void onComponentTag(final ComponentTag tag) {
>    super.onComponentTag(tag);
>    if(!isRootForm()) {
>      tag.setName("span");
>    }
> }
>
> ~ Thank you,
>     Paul Bors
> On Tue, Feb 12, 2013 at 7:55 AM, Michael Jaruska
> <mi...@gmail.com>wrote:
>
>> do you mean in beforeRender(final Component component)?
>>
>>
>>
>>
>> On 12.2.2013 9:11, Martin Grigorov wrote:
>>
>>> Hi,
>>>
>>> As Sven suggested - BorderBehavior does exactly this.
>>>
>>>
>>> On Tue, Feb 12, 2013 at 9:08 AM, Michael Jaruska
>>> <mi...@gmail.com>**wrote:
>>>
>>>   no way how to modify raw html stream in actual rendering?
>>>>
>>>>
>>>>
>>>> On 11.2.2013 11:50, Michael Jaruska wrote:
>>>>
>>>>   based on this article:
>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>>in
>>>>> section onRender()
>>>>> it should be possible to modify markup which is going from wicket (e.g.
>>>>> from .html file)
>>>>> and modyfied it send to client.
>>>>>
>>>>>
>>>>> On 11.2.2013 11:34, Michael Jaruska wrote:
>>>>>
>>>>>   yes, i need that raw html that comes from markup (my .html file which
>>>>>> is
>>>>>> my panel),
>>>>>> in java code i will modify it (one step for put new class) and send it
>>>>>> to client :-)
>>>>>> as i thnik now i dont need to delete previous step because this
>>>>>> modifying isn't in
>>>>>> markup. so i just need to modify markup in actual render - modify
>>>>>> markup
>>>>>> stream.
>>>>>>
>>>>>>
>>>>>> On 11.2.2013 11:26, Martin Grigorov wrote:
>>>>>>
>>>>>>   MarkupStream gives you the raw html that comes from the .html file,
>>>>>>> i.e.
>>>>>>> from the template file.
>>>>>>> It doesn't give you the html from the previous page render.
>>>>>>>
>>>>>>> You need to send Ajax requests to update the server side state to be
>>>>>>> in
>>>>>>> sync with the client side state (modified by your JS).
>>>>>>>
>>>>>>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <
>>>>>>> michael.jaruska@gmail.com
>>>>>>>
>>>>>>>   wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>    in fact, my panel is menu which is modified by javascript.
>>>>>>>
>>>>>>>> i need to keep track of the previous selected entry (to get know
>>>>>>>> javascript to disable element) and actual element to modify
>>>>>>>> (add class) for javascript.
>>>>>>>>
>>>>>>>> javascript need to now at a moment "page rendered" where is
>>>>>>>> class which it is looking for.
>>>>>>>>
>>>>>>>> so i need to modify html markup, modify it on client side by
>>>>>>>> javascript is not possible.
>>>>>>>>
>>>>>>>> based on this article:
>>>>>>>> https://cwiki.apache.org/******WICKET/component-rendering.******html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>>> <https://cwiki.apache.**org/**WICKET/component-**rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>
>>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>   it should be possible modify markup generated by component (my
>>>>>>>> panel).
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>>    Hi,
>>>>>>>>
>>>>>>>>>
>>>>>>>>> What do you want to do with the markup ?
>>>>>>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>>>>>>> something that may be solved much easier.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>
>>>>>>>>>    wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>      thanks, studied. but in my case not working. i don't know why,
>>>>>>>>> where is
>>>>>>>>>
>>>>>>>>>   my
>>>>>>>>>> mistake. try this code:
>>>>>>>>>>
>>>>>>>>>> markup - base page:
>>>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>>>> <html xmlns:wicket>
>>>>>>>>>>         <head>
>>>>>>>>>>             <title>my test page</title>
>>>>>>>>>>             <meta http-equiv="Content-Type" content="text/html;
>>>>>>>>>> charset=utf-8"
>>>>>>>>>> />
>>>>>>>>>>         </head>
>>>>>>>>>>         <body>
>>>>>>>>>>             <p>my test page</p>
>>>>>>>>>>             <span wicket:id="myPanel">[my test panel]</span>
>>>>>>>>>>         </body>
>>>>>>>>>> </html>
>>>>>>>>>>
>>>>>>>>>> markup - my test panel:
>>>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>>>> <html xmlns:wicket>
>>>>>>>>>> <wicket:panel>
>>>>>>>>>>        <ul>
>>>>>>>>>>           <li>
>>>>>>>>>>             <a href="./mypage.html?cid=menu">********my item</a>
>>>>>>>>>>
>>>>>>>>>>           </li>
>>>>>>>>>>        </ul>
>>>>>>>>>> </wicket:panel>
>>>>>>>>>>
>>>>>>>>>> java - base page:
>>>>>>>>>> public class PageBase extends WebPage{
>>>>>>>>>>             public PageBase()
>>>>>>>>>>             {
>>>>>>>>>>                     //my panel
>>>>>>>>>>                     this.add(new MyMenu("myPanel").****
>>>>>>>>>> setRenderBodyOnly(true));
>>>>>>>>>>
>>>>>>>>>>             }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> java - panel:
>>>>>>>>>> ublic class MyMenu extends Panel{
>>>>>>>>>>             public PanelMenu(String id)
>>>>>>>>>>             {
>>>>>>>>>>                     super(id);
>>>>>>>>>>             }
>>>>>>>>>>
>>>>>>>>>>             protected void onRender(MarkupStream markupStream){
>>>>>>>>>>                     while(markupStream.hasMore())
>>>>>>>>>>                     {
>>>>>>>>>>                             System.out.println(******
>>>>>>>>>> markupStream.next());
>>>>>>>>>>
>>>>>>>>>>                     }
>>>>>>>>>>             }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> i expect on console printed whole html markup for panel, but
>>>>>>>>>> nothing
>>>>>>>>>> is
>>>>>>>>>> displayed.
>>>>>>>>>>
>>>>>>>>>> any ideas please?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>>>>>>
>>>>>>>>>>     See BorderBehavior#beforeRender(********Component) on how to
>>>>>>>>>> iterate over
>>>>>>>>>>
>>>>>>>>>>   the
>>>>>>>>>>>
>>>>>>>>>>> markup.
>>>>>>>>>>>
>>>>>>>>>>> Sven
>>>>>>>>>>>
>>>>>>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>>>>>>
>>>>>>>>>>>     my quick test:
>>>>>>>>>>>
>>>>>>>>>>>   @Override
>>>>>>>>>>>> protected void onRender()
>>>>>>>>>>>> {
>>>>>>>>>>>>         super.onRender();
>>>>>>>>>>>>         System.out.println(this.********getMarkup().toString());
>>>>>>>>>>>>
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how
>>>>>>>>>>>> to
>>>>>>>>>>>> get
>>>>>>>>>>>> whole
>>>>>>>>>>>> markup for my panel?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>     Sure, with #getMarkup() you can get hold of the component's
>>>>>>>>>>>> markup.
>>>>>>>>>>>>
>>>>>>>>>>>>   With a MarkupStream you can iterate over it.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>     again with my question: is it possible to get markup in
>>>>>>>>>>>>> onRender() of
>>>>>>>>>>>>>
>>>>>>>>>>>>>   the component?
>>>>>>>>>>>>>> have found this article:
>>>>>>>>>>>>>> https://cwiki.apache.org/********WICKET/component-rendering.**
>>>>>>>>>>>>>> *****<https://cwiki.apache.org/******WICKET/component-rendering.*****>
>>>>>>>>>>>>>> *html<https://cwiki.apache.**org/****WICKET/component-**
>>>>>>>>>>>>>> rendering.****html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <https://cwiki.apache.**org/****WICKET/component-**
>>>>>>>>>>>>>> rendering.**html<https://**cwiki.apache.org/**WICKET/**
>>>>>>>>>>>>>> component-rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   <https://cwiki.apache.org/******
>>>>>>>>>>>>>> WICKET/component-rendering.******<https://cwiki.apache.org/****WICKET/component-rendering.****>
>>>>>>>>>>>>>> html<https://cwiki.apache.org/****WICKET/component-rendering.*
>>>>>>>>>>>>>> ***html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****
>>>>>>>>>>>>>> html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   but in onRender() section is just code snippet I'm not
>>>>>>>>>>>>>> understand. is
>>>>>>>>>>>>>> there more
>>>>>>>>>>>>>> detailed example how to get markup of the component in
>>>>>>>>>>>>>> onRender()?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> thanks, michael
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>     You can use IMarkupFilter to manipulate the raw markup
>>>>>>>>>>>>>> before
>>>>>>>>>>>>>> being
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   loaded
>>>>>>>>>>>>>>> and used by the components.
>>>>>>>>>>>>>>> See the implementations in Wicket to see what can be done with
>>>>>>>>>>>>>>> such
>>>>>>>>>>>>>>> filter.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       Look at my original post. User clicks on <a
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    href="./mypage.html?cid=menu/*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**********subsubmenu2</a>, then
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> When I have point 2 done, then I know how to put somethink
>>>>>>>>>>>>>>>> into
>>>>>>>>>>>>>>>> <li>
>>>>>>>>>>>>>>>> tag...
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>>>>>>> attribute
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    ;-)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>>>>>>> generate
>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> html, there are some ways, but they mostly work outside of
>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> normal
>>>>>>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>>>>>>> override
>>>>>>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g.
>>>>>>>>>>>>>>>>> look at
>>>>>>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a
>>>>>>>>>>>>>>>>> custom
>>>>>>>>>>>>>>>>> model.
>>>>>>>>>>>>>>>>> The model can then load the html and perform string
>>>>>>>>>>>>>>>>> replacement.
>>>>>>>>>>>>>>>>> You can then add a label component which uses the model and
>>>>>>>>>>>>>>>>> has
>>>>>>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>      I need to find the parent <li> tag of the anchor user
>>>>>>>>>>>>>>>>> clicks - I
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    now
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li>
>>>>>>>>>>>>>>>>>> specific
>>>>>>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>      Sorry, I read too quickly.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>   What are you trying to accomplish? Let's say you are able
>>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>>> find
>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      And question is not "how can I change html attribute"
>>>>>>>>>>>>>>>>>>> but "how
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>    can I
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      Hi!
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>   What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li>
>>>>>>>>>>>>>>>>>>>>> component.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>>>>>>           isEnabled() {
>>>>>>>>>>>>>>>>>>>>>               return true if you want to append a html
>>>>>>>>>>>>>>>>>>>>> attribute;
>>>>>>>>>>>>>>>>>>>>>           }
>>>>>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>>>>>>           onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>>>>>>               super(tag);
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>               tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>>>>>>           }
>>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      Hi,
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>   is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu">**
>>>>>>>>>>>>>>>>>>>>>> ********menu</a>
>>>>>>>>>>>>>>>>>>>>>>        <ul>
>>>>>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>>>>>>          <ul>
>>>>>>>>>>>>>>>>>>>>>>            <li>
>>>>>>>>>>>>>>>>>>>>>>              <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>>>>>>            </li>
>>>>>>>>>>>>>>>>>>>>>>            <li>
>>>>>>>>>>>>>>>>>>>>>>              <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>>>>>>            </li>
>>>>>>>>>>>>>>>>>>>>>>            <li>
>>>>>>>>>>>>>>>>>>>>>>              <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>>>>>>            </li>
>>>>>>>>>>>>>>>>>>>>>>          </ul>
>>>>>>>>>>>>>>>>>>>>>>        </ul>
>>>>>>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>>>        //cid = category id
>>>>>>>>>>>>>>>>>>>>>>        String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>        ...
>>>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li>
>>>>>>>>>>>>>>>>>>>>>> tag
>>>>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>>>        //cid = category id
>>>>>>>>>>>>>>>>>>>>>>        String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>>>        //find corresponding <a> tag
>>>>>>>>>>>>>>>>>>>>>>        Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>>>>>>>>>>>>> **
>>>>>>>>>>>>>>>>>>>>>> ******
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>>>>>>        //have corresponding anchor tag, get parrent tag
>>>>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>>>>>>        Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>>>>>>        //and now I can do my mysterious things with
>>>>>>>>>>>>>>>>>>>>>> menu...
>>>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly
>>>>>>>>>>>>>>>>>>>>>> don't
>>>>>>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> ------------------------------******
>>>>>>>>>>>>>>>>>>>>>> ****--------------------------******--
>>>>>>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*****
>>>>>>>>>>>>>>>>>>>>>> ***
>>>>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-******unsubscribe@**
>>>>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.****ap**
>>>>>>>>>>>>>>>>>>>>>> ache.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.**
>>>>>>>>>>>>>>>>>>>>>> apache.org <us...@wicket.apache.org>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       ------------------------------******
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> ****--------------------------******--
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>    **--**
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org<
>>>>>>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>   users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       ------------------------------******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ****--------------------------******--**
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>    --**
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>>>>> *apa**
>>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org<
>>>>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>      For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>       ------------------------------****
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ******------------------------****--*
>>>>>>>>>>>>>>>>> *--**
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    --**---------
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>>> *apa**
>>>>>>>>>>>>>>>> che.org<
>>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org <
>>>>>>>>>>>>>>>> http://apache.org>
>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      For additional commands, e-mail:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      ------------------------------****
>>>>>>>>>>>>>>> ****--------------------------****--**
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   --**
>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org>
>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    For additional commands, e-mail:
>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>>>>
>>>>>>>>>>>>> *--**--**
>>>>>>>>>>>>> ---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>> che.org
>>>>>>>>>>>>> <http://apache.org**>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org><
>>>>>>>>>>>>> http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>    For additional commands, e-mail:
>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>     ------------------------------**
>>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>>> *--**--**
>>>>>>>>>>>>>
>>>>>>>>>>>>>   ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>> che.org<
>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org><
>>>>>>>>>>>> http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>    For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>    ------------------------------********------------------------
>>>>>>>>>>>> **--**
>>>>>>>>>>>>
>>>>>>>>>>> --**
>>>>>>>>>>> --**---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>> che.org<
>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org> <
>>>>>>>>>>> http://wicket.apache.org>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>    For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>     ------------------------------********------------------------
>>>>>>>>>>> **--**
>>>>>>>>>>> --**
>>>>>>>>>>>
>>>>>>>>>>>   --**---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>> che.org<
>>>>>>>>>> http://apache.org**>
>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org> <
>>>>>>>>>> http://wicket.apache.org><
>>>>>>>>>> users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>    For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>    ------------------------------******--------------------------**
>>>>>>>>> --**
>>>>>>>>>
>>>>>>>> --**---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>> http://apache.org**>
>>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org><
>>>>>>>> users-unsubscribe@**wicket.apache.org<us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>   ------------------------------****----------------------------**
>>>> --**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>> <us...@wicket.apache.org>
>>>>>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Paul Bors <pa...@bors.ws>.
You can also do it inside the onComponentTag() or onComponentTagBody():

http://wicket.apache.org/apidocs/1.5/org/apache/wicket/Component.html#onComponentTag(org.apache.wicket.markup.ComponentTag
)
http://wicket.apache.org/apidocs/1.5/org/apache/wicket/Component.html#onComponentTagBody(org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)

This is how I switched from a <DIV> to a <SPAN> when nesting forms since
Wicket uses <DIV> that sometimes breaks my CSS inheritance:

/**
 * Wicket by default will substitute inner nested forms with DIV elements,
we want SPAN
 * elements to preserve the page layout.
 *
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected void onComponentTag(final ComponentTag tag) {
  super.onComponentTag(tag);
  if(!isRootForm()) {
    tag.setName("span");
  }
}

~ Thank you,
   Paul Bors
On Tue, Feb 12, 2013 at 7:55 AM, Michael Jaruska
<mi...@gmail.com>wrote:

> do you mean in beforeRender(final Component component)?
>
>
>
>
> On 12.2.2013 9:11, Martin Grigorov wrote:
>
>> Hi,
>>
>> As Sven suggested - BorderBehavior does exactly this.
>>
>>
>> On Tue, Feb 12, 2013 at 9:08 AM, Michael Jaruska
>> <mi...@gmail.com>**wrote:
>>
>>  no way how to modify raw html stream in actual rendering?
>>>
>>>
>>>
>>> On 11.2.2013 11:50, Michael Jaruska wrote:
>>>
>>>  based on this article:
>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>>in
>>>> section onRender()
>>>> it should be possible to modify markup which is going from wicket (e.g.
>>>> from .html file)
>>>> and modyfied it send to client.
>>>>
>>>>
>>>> On 11.2.2013 11:34, Michael Jaruska wrote:
>>>>
>>>>  yes, i need that raw html that comes from markup (my .html file which
>>>>> is
>>>>> my panel),
>>>>> in java code i will modify it (one step for put new class) and send it
>>>>> to client :-)
>>>>> as i thnik now i dont need to delete previous step because this
>>>>> modifying isn't in
>>>>> markup. so i just need to modify markup in actual render - modify
>>>>> markup
>>>>> stream.
>>>>>
>>>>>
>>>>> On 11.2.2013 11:26, Martin Grigorov wrote:
>>>>>
>>>>>  MarkupStream gives you the raw html that comes from the .html file,
>>>>>> i.e.
>>>>>> from the template file.
>>>>>> It doesn't give you the html from the previous page render.
>>>>>>
>>>>>> You need to send Ajax requests to update the server side state to be
>>>>>> in
>>>>>> sync with the client side state (modified by your JS).
>>>>>>
>>>>>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <
>>>>>> michael.jaruska@gmail.com
>>>>>>
>>>>>>  wrote:
>>>>>>>
>>>>>>>
>>>>>>   in fact, my panel is menu which is modified by javascript.
>>>>>>
>>>>>>> i need to keep track of the previous selected entry (to get know
>>>>>>> javascript to disable element) and actual element to modify
>>>>>>> (add class) for javascript.
>>>>>>>
>>>>>>> javascript need to now at a moment "page rendered" where is
>>>>>>> class which it is looking for.
>>>>>>>
>>>>>>> so i need to modify html markup, modify it on client side by
>>>>>>> javascript is not possible.
>>>>>>>
>>>>>>> based on this article:
>>>>>>> https://cwiki.apache.org/******WICKET/component-rendering.******html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>> <https://cwiki.apache.**org/**WICKET/component-**rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>> >
>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>> >
>>>>>>>
>>>>>>>>
>>>>>>>>  it should be possible modify markup generated by component (my
>>>>>>> panel).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>>>>>
>>>>>>>   Hi,
>>>>>>>
>>>>>>>>
>>>>>>>> What do you want to do with the markup ?
>>>>>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>>>>>> something that may be solved much easier.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>
>>>>>>>>   wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>     thanks, studied. but in my case not working. i don't know why,
>>>>>>>> where is
>>>>>>>>
>>>>>>>>  my
>>>>>>>>> mistake. try this code:
>>>>>>>>>
>>>>>>>>> markup - base page:
>>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>>> <html xmlns:wicket>
>>>>>>>>>        <head>
>>>>>>>>>            <title>my test page</title>
>>>>>>>>>            <meta http-equiv="Content-Type" content="text/html;
>>>>>>>>> charset=utf-8"
>>>>>>>>> />
>>>>>>>>>        </head>
>>>>>>>>>        <body>
>>>>>>>>>            <p>my test page</p>
>>>>>>>>>            <span wicket:id="myPanel">[my test panel]</span>
>>>>>>>>>        </body>
>>>>>>>>> </html>
>>>>>>>>>
>>>>>>>>> markup - my test panel:
>>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>>> <html xmlns:wicket>
>>>>>>>>> <wicket:panel>
>>>>>>>>>       <ul>
>>>>>>>>>          <li>
>>>>>>>>>            <a href="./mypage.html?cid=menu">********my item</a>
>>>>>>>>>
>>>>>>>>>          </li>
>>>>>>>>>       </ul>
>>>>>>>>> </wicket:panel>
>>>>>>>>>
>>>>>>>>> java - base page:
>>>>>>>>> public class PageBase extends WebPage{
>>>>>>>>>            public PageBase()
>>>>>>>>>            {
>>>>>>>>>                    //my panel
>>>>>>>>>                    this.add(new MyMenu("myPanel").****
>>>>>>>>> setRenderBodyOnly(true));
>>>>>>>>>
>>>>>>>>>            }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> java - panel:
>>>>>>>>> ublic class MyMenu extends Panel{
>>>>>>>>>            public PanelMenu(String id)
>>>>>>>>>            {
>>>>>>>>>                    super(id);
>>>>>>>>>            }
>>>>>>>>>
>>>>>>>>>            protected void onRender(MarkupStream markupStream){
>>>>>>>>>                    while(markupStream.hasMore())
>>>>>>>>>                    {
>>>>>>>>>                            System.out.println(******
>>>>>>>>> markupStream.next());
>>>>>>>>>
>>>>>>>>>                    }
>>>>>>>>>            }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> i expect on console printed whole html markup for panel, but
>>>>>>>>> nothing
>>>>>>>>> is
>>>>>>>>> displayed.
>>>>>>>>>
>>>>>>>>> any ideas please?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>>>>>
>>>>>>>>>    See BorderBehavior#beforeRender(********Component) on how to
>>>>>>>>> iterate over
>>>>>>>>>
>>>>>>>>>  the
>>>>>>>>>>
>>>>>>>>>> markup.
>>>>>>>>>>
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>>>>>
>>>>>>>>>>    my quick test:
>>>>>>>>>>
>>>>>>>>>>  @Override
>>>>>>>>>>> protected void onRender()
>>>>>>>>>>> {
>>>>>>>>>>>        super.onRender();
>>>>>>>>>>>        System.out.println(this.********getMarkup().toString());
>>>>>>>>>>>
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how
>>>>>>>>>>> to
>>>>>>>>>>> get
>>>>>>>>>>> whole
>>>>>>>>>>> markup for my panel?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>>>>>
>>>>>>>>>>>    Sure, with #getMarkup() you can get hold of the component's
>>>>>>>>>>> markup.
>>>>>>>>>>>
>>>>>>>>>>>  With a MarkupStream you can iterate over it.
>>>>>>>>>>>>
>>>>>>>>>>>> Sven
>>>>>>>>>>>>
>>>>>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>    again with my question: is it possible to get markup in
>>>>>>>>>>>> onRender() of
>>>>>>>>>>>>
>>>>>>>>>>>>  the component?
>>>>>>>>>>>>> have found this article:
>>>>>>>>>>>>> https://cwiki.apache.org/********WICKET/component-rendering.**
>>>>>>>>>>>>> *****<https://cwiki.apache.org/******WICKET/component-rendering.*****>
>>>>>>>>>>>>> *html<https://cwiki.apache.**org/****WICKET/component-**
>>>>>>>>>>>>> rendering.****html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>>>>>>>> >
>>>>>>>>>>>>> <https://cwiki.apache.**org/****WICKET/component-**
>>>>>>>>>>>>> rendering.**html<https://**cwiki.apache.org/**WICKET/**
>>>>>>>>>>>>> component-rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  <https://cwiki.apache.org/******
>>>>>>>>>>>>> WICKET/component-rendering.******<https://cwiki.apache.org/****WICKET/component-rendering.****>
>>>>>>>>>>>>> html<https://cwiki.apache.org/****WICKET/component-rendering.*
>>>>>>>>>>>>> ***html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>> >
>>>>>>>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****
>>>>>>>>>>>>> html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  but in onRender() section is just code snippet I'm not
>>>>>>>>>>>>> understand. is
>>>>>>>>>>>>> there more
>>>>>>>>>>>>> detailed example how to get markup of the component in
>>>>>>>>>>>>> onRender()?
>>>>>>>>>>>>>
>>>>>>>>>>>>> thanks, michael
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    You can use IMarkupFilter to manipulate the raw markup
>>>>>>>>>>>>> before
>>>>>>>>>>>>> being
>>>>>>>>>>>>>
>>>>>>>>>>>>>  loaded
>>>>>>>>>>>>>> and used by the components.
>>>>>>>>>>>>>> See the implementations in Wicket to see what can be done with
>>>>>>>>>>>>>> such
>>>>>>>>>>>>>> filter.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      Look at my original post. User clicks on <a
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   href="./mypage.html?cid=menu/*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *submenu/subsubmenu2">**********subsubmenu2</a>, then
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> When I have point 2 done, then I know how to put somethink
>>>>>>>>>>>>>>> into
>>>>>>>>>>>>>>> <li>
>>>>>>>>>>>>>>> tag...
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>>>>>> attribute
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   ;-)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>>>>>> generate
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> html, there are some ways, but they mostly work outside of
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> normal
>>>>>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>>>>>> override
>>>>>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g.
>>>>>>>>>>>>>>>> look at
>>>>>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a
>>>>>>>>>>>>>>>> custom
>>>>>>>>>>>>>>>> model.
>>>>>>>>>>>>>>>> The model can then load the html and perform string
>>>>>>>>>>>>>>>> replacement.
>>>>>>>>>>>>>>>> You can then add a label component which uses the model and
>>>>>>>>>>>>>>>> has
>>>>>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>     I need to find the parent <li> tag of the anchor user
>>>>>>>>>>>>>>>> clicks - I
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>   now
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li>
>>>>>>>>>>>>>>>>> specific
>>>>>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>     Sorry, I read too quickly.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>  What are you trying to accomplish? Let's say you are able
>>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>>> find
>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     And question is not "how can I change html attribute"
>>>>>>>>>>>>>>>>>> but "how
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>   can I
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     Hi!
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>  What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li>
>>>>>>>>>>>>>>>>>>>> component.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>>>>>          isEnabled() {
>>>>>>>>>>>>>>>>>>>>              return true if you want to append a html
>>>>>>>>>>>>>>>>>>>> attribute;
>>>>>>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>>>>>          onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>>>>>              super(tag);
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>              tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>     Hi,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>  is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>>>>>       <li>
>>>>>>>>>>>>>>>>>>>>>         <a href="./mypage.html?cid=menu">**
>>>>>>>>>>>>>>>>>>>>> ********menu</a>
>>>>>>>>>>>>>>>>>>>>>       <ul>
>>>>>>>>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>>>>>         <ul>
>>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*********
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>>         </ul>
>>>>>>>>>>>>>>>>>>>>>       </ul>
>>>>>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>>       //cid = category id
>>>>>>>>>>>>>>>>>>>>>       String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>       ...
>>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li>
>>>>>>>>>>>>>>>>>>>>> tag
>>>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>>       //cid = category id
>>>>>>>>>>>>>>>>>>>>>       String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>>       //find corresponding <a> tag
>>>>>>>>>>>>>>>>>>>>>       Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>>>>>>>>>>>> **
>>>>>>>>>>>>>>>>>>>>> ******
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>>>>>       //have corresponding anchor tag, get parrent tag
>>>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>>>>>       Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>>>>>       //and now I can do my mysterious things with
>>>>>>>>>>>>>>>>>>>>> menu...
>>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly
>>>>>>>>>>>>>>>>>>>>> don't
>>>>>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> ------------------------------******
>>>>>>>>>>>>>>>>>>>>> ****--------------------------******--
>>>>>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*****
>>>>>>>>>>>>>>>>>>>>> ***
>>>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-******unsubscribe@**
>>>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.****ap**
>>>>>>>>>>>>>>>>>>>>> ache.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.**
>>>>>>>>>>>>>>>>>>>>> apache.org <us...@wicket.apache.org>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>  For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      ------------------------------******
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> ****--------------------------******--
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>   **--**
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org<
>>>>>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>> >
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>  users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      ------------------------------******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ****--------------------------******--**
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>   --**
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>>>> *apa**
>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org<
>>>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>> >
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>      ------------------------------****
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ******------------------------****--*
>>>>>>>>>>>>>>>> *--**
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>   --**---------
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.*******
>>>>>>>>>>>>>>> *apa**
>>>>>>>>>>>>>>> che.org<
>>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.******apache.org <
>>>>>>>>>>>>>>> http://apache.org>
>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>> >
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     ------------------------------****
>>>>>>>>>>>>>> ****--------------------------****--**
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  --**
>>>>>>>>>>>>> ---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org>
>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>   ------------------------------**
>>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>>>
>>>>>>>>>>>> *--**--**
>>>>>>>>>>>> ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>> che.org
>>>>>>>>>>>> <http://apache.org**>
>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org><
>>>>>>>>>>>> http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>> >
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>> *--**--**
>>>>>>>>>>>>
>>>>>>>>>>>>  ---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>> che.org<
>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org><
>>>>>>>>>>> http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>> >
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   ------------------------------********------------------------
>>>>>>>>>>> **--**
>>>>>>>>>>>
>>>>>>>>>> --**
>>>>>>>>>> --**---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>> che.org<
>>>>>>>>>> http://apache.org**>
>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org> <
>>>>>>>>>> http://wicket.apache.org>
>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    ------------------------------********------------------------
>>>>>>>>>> **--**
>>>>>>>>>> --**
>>>>>>>>>>
>>>>>>>>>>  --**---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>> che.org<
>>>>>>>>> http://apache.org**>
>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org> <
>>>>>>>>> http://wicket.apache.org><
>>>>>>>>> users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>   ------------------------------******--------------------------**
>>>>>>>> --**
>>>>>>>>
>>>>>>> --**---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>> http://apache.org**>
>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org><
>>>>>>> users-unsubscribe@**wicket.apache.org<us...@wicket.apache.org>
>>>>>>> >
>>>>>>>
>>>>>>>>
>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>  ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> <us...@wicket.apache.org>
>>> >
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
do you mean in beforeRender(final Component component)?



On 12.2.2013 9:11, Martin Grigorov wrote:
> Hi,
>
> As Sven suggested - BorderBehavior does exactly this.
>
>
> On Tue, Feb 12, 2013 at 9:08 AM, Michael Jaruska
> <mi...@gmail.com>wrote:
>
>> no way how to modify raw html stream in actual rendering?
>>
>>
>>
>> On 11.2.2013 11:50, Michael Jaruska wrote:
>>
>>> based on this article:
>>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>in section onRender()
>>> it should be possible to modify markup which is going from wicket (e.g.
>>> from .html file)
>>> and modyfied it send to client.
>>>
>>>
>>> On 11.2.2013 11:34, Michael Jaruska wrote:
>>>
>>>> yes, i need that raw html that comes from markup (my .html file which is
>>>> my panel),
>>>> in java code i will modify it (one step for put new class) and send it
>>>> to client :-)
>>>> as i thnik now i dont need to delete previous step because this
>>>> modifying isn't in
>>>> markup. so i just need to modify markup in actual render - modify markup
>>>> stream.
>>>>
>>>>
>>>> On 11.2.2013 11:26, Martin Grigorov wrote:
>>>>
>>>>> MarkupStream gives you the raw html that comes from the .html file, i.e.
>>>>> from the template file.
>>>>> It doesn't give you the html from the previous page render.
>>>>>
>>>>> You need to send Ajax requests to update the server side state to be in
>>>>> sync with the client side state (modified by your JS).
>>>>>
>>>>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <
>>>>> michael.jaruska@gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>>   in fact, my panel is menu which is modified by javascript.
>>>>>> i need to keep track of the previous selected entry (to get know
>>>>>> javascript to disable element) and actual element to modify
>>>>>> (add class) for javascript.
>>>>>>
>>>>>> javascript need to now at a moment "page rendered" where is
>>>>>> class which it is looking for.
>>>>>>
>>>>>> so i need to modify html markup, modify it on client side by
>>>>>> javascript is not possible.
>>>>>>
>>>>>> based on this article:
>>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>
>>>>>> it should be possible modify markup generated by component (my
>>>>>> panel).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>>>>
>>>>>>   Hi,
>>>>>>>
>>>>>>> What do you want to do with the markup ?
>>>>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>>>>> something that may be solved much easier.
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>>>>> michael.jaruska@gmail.com
>>>>>>>
>>>>>>>   wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>    thanks, studied. but in my case not working. i don't know why,
>>>>>>> where is
>>>>>>>
>>>>>>>> my
>>>>>>>> mistake. try this code:
>>>>>>>>
>>>>>>>> markup - base page:
>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>> <html xmlns:wicket>
>>>>>>>>        <head>
>>>>>>>>            <title>my test page</title>
>>>>>>>>            <meta http-equiv="Content-Type" content="text/html;
>>>>>>>> charset=utf-8"
>>>>>>>> />
>>>>>>>>        </head>
>>>>>>>>        <body>
>>>>>>>>            <p>my test page</p>
>>>>>>>>            <span wicket:id="myPanel">[my test panel]</span>
>>>>>>>>        </body>
>>>>>>>> </html>
>>>>>>>>
>>>>>>>> markup - my test panel:
>>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>>> <html xmlns:wicket>
>>>>>>>> <wicket:panel>
>>>>>>>>       <ul>
>>>>>>>>          <li>
>>>>>>>>            <a href="./mypage.html?cid=menu">******my item</a>
>>>>>>>>
>>>>>>>>          </li>
>>>>>>>>       </ul>
>>>>>>>> </wicket:panel>
>>>>>>>>
>>>>>>>> java - base page:
>>>>>>>> public class PageBase extends WebPage{
>>>>>>>>            public PageBase()
>>>>>>>>            {
>>>>>>>>                    //my panel
>>>>>>>>                    this.add(new MyMenu("myPanel").****
>>>>>>>> setRenderBodyOnly(true));
>>>>>>>>
>>>>>>>>            }
>>>>>>>> }
>>>>>>>>
>>>>>>>> java - panel:
>>>>>>>> ublic class MyMenu extends Panel{
>>>>>>>>            public PanelMenu(String id)
>>>>>>>>            {
>>>>>>>>                    super(id);
>>>>>>>>            }
>>>>>>>>
>>>>>>>>            protected void onRender(MarkupStream markupStream){
>>>>>>>>                    while(markupStream.hasMore())
>>>>>>>>                    {
>>>>>>>>                            System.out.println(******
>>>>>>>> markupStream.next());
>>>>>>>>
>>>>>>>>                    }
>>>>>>>>            }
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> i expect on console printed whole html markup for panel, but nothing
>>>>>>>> is
>>>>>>>> displayed.
>>>>>>>>
>>>>>>>> any ideas please?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>>>>
>>>>>>>>    See BorderBehavior#beforeRender(******Component) on how to
>>>>>>>> iterate over
>>>>>>>>
>>>>>>>>> the
>>>>>>>>>
>>>>>>>>> markup.
>>>>>>>>>
>>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>>>>
>>>>>>>>>    my quick test:
>>>>>>>>>
>>>>>>>>>> @Override
>>>>>>>>>> protected void onRender()
>>>>>>>>>> {
>>>>>>>>>>        super.onRender();
>>>>>>>>>>        System.out.println(this.******getMarkup().toString());
>>>>>>>>>>
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how to
>>>>>>>>>> get
>>>>>>>>>> whole
>>>>>>>>>> markup for my panel?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>>>>
>>>>>>>>>>    Sure, with #getMarkup() you can get hold of the component's
>>>>>>>>>> markup.
>>>>>>>>>>
>>>>>>>>>>> With a MarkupStream you can iterate over it.
>>>>>>>>>>>
>>>>>>>>>>> Sven
>>>>>>>>>>>
>>>>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>>>>
>>>>>>>>>>>    again with my question: is it possible to get markup in
>>>>>>>>>>> onRender() of
>>>>>>>>>>>
>>>>>>>>>>>> the component?
>>>>>>>>>>>> have found this article:
>>>>>>>>>>>> https://cwiki.apache.org/******WICKET/component-rendering.*****
>>>>>>>>>>>> *html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>>>>>>> <https://cwiki.apache.**org/**WICKET/component-**
>>>>>>>>>>>> rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>>>
>>>>>>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****
>>>>>>>>>>>> html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> but in onRender() section is just code snippet I'm not
>>>>>>>>>>>> understand. is
>>>>>>>>>>>> there more
>>>>>>>>>>>> detailed example how to get markup of the component in
>>>>>>>>>>>> onRender()?
>>>>>>>>>>>>
>>>>>>>>>>>> thanks, michael
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>    You can use IMarkupFilter to manipulate the raw markup before
>>>>>>>>>>>> being
>>>>>>>>>>>>
>>>>>>>>>>>>> loaded
>>>>>>>>>>>>> and used by the components.
>>>>>>>>>>>>> See the implementations in Wicket to see what can be done with
>>>>>>>>>>>>> such
>>>>>>>>>>>>> filter.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>>>>
>>>>>>>>>>>>>    wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      Look at my original post. User clicks on <a
>>>>>>>>>>>>>
>>>>>>>>>>>>>   href="./mypage.html?cid=menu/*
>>>>>>>>>>>>>> *submenu/subsubmenu2">********subsubmenu2</a>, then
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>>>>>>> <li>
>>>>>>>>>>>>>> tag...
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>     Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>>>>> attribute
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   ;-)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>>>>> generate
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>>>>>>> normal
>>>>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>>>>> override
>>>>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g.
>>>>>>>>>>>>>>> look at
>>>>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a
>>>>>>>>>>>>>>> custom
>>>>>>>>>>>>>>> model.
>>>>>>>>>>>>>>> The model can then load the html and perform string
>>>>>>>>>>>>>>> replacement.
>>>>>>>>>>>>>>> You can then add a label component which uses the model and
>>>>>>>>>>>>>>> has
>>>>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     I need to find the parent <li> tag of the anchor user
>>>>>>>>>>>>>>> clicks - I
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   now
>>>>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li>
>>>>>>>>>>>>>>>> specific
>>>>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>     Sorry, I read too quickly.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>>>>>>> find
>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>     And question is not "how can I change html attribute"
>>>>>>>>>>>>>>>>> but "how
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>   can I
>>>>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     Hi!
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li>
>>>>>>>>>>>>>>>>>>> component.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>>>>          isEnabled() {
>>>>>>>>>>>>>>>>>>>              return true if you want to append a html
>>>>>>>>>>>>>>>>>>> attribute;
>>>>>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>>>>          onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>>>>              super(tag);
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>              tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     Hi,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>>>>       <li>
>>>>>>>>>>>>>>>>>>>>         <a href="./mypage.html?cid=menu">********menu</a>
>>>>>>>>>>>>>>>>>>>>       <ul>
>>>>>>>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>>>>         <ul>
>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>           <li>
>>>>>>>>>>>>>>>>>>>>             <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>>>>           </li>
>>>>>>>>>>>>>>>>>>>>         </ul>
>>>>>>>>>>>>>>>>>>>>       </ul>
>>>>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>       //cid = category id
>>>>>>>>>>>>>>>>>>>>       String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       ...
>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li>
>>>>>>>>>>>>>>>>>>>> tag
>>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>>       //cid = category id
>>>>>>>>>>>>>>>>>>>>       String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>>       //find corresponding <a> tag
>>>>>>>>>>>>>>>>>>>>       Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>>>>>>>>>>> ******
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>>>>       //have corresponding anchor tag, get parrent tag of
>>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>>>>       Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>>>>       //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly
>>>>>>>>>>>>>>>>>>>> don't
>>>>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> ------------------------------****
>>>>>>>>>>>>>>>>>>>> ****--------------------------****--
>>>>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******
>>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-****unsubscribe@**
>>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.**ap**
>>>>>>>>>>>>>>>>>>>> ache.org <http://apache.org><users-unsubscribe@**
>>>>>>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      ------------------------------****
>>>>>>>>>>>>>>>>>>> ****--------------------------****--
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>   **--**
>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******
>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>      ------------------------------****
>>>>>>>>>>>>>>>>> ****--------------------------****--**
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>   --**
>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      ------------------------------**
>>>>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>>>>> *--**
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   --**---------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>>> che.org<
>>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org>
>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>     For additional commands, e-mail:
>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>>
>>>>>>>>>>>> --**
>>>>>>>>>>>> ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   ------------------------------******--------------------------*
>>>>>>>>>>> *--**--**
>>>>>>>>>>> ---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org
>>>>>>>>>>> <http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>    ------------------------------******--------------------------*
>>>>>>>>>>> *--**--**
>>>>>>>>>>>
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>>> http://apache.org**>
>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>   ------------------------------******--------------------------**
>>>>>>>>> --**
>>>>>>>>> --**---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>> http://apache.org**>
>>>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    ------------------------------******--------------------------**
>>>>>>>>> --**
>>>>>>>>>
>>>>>>>> --**---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>> http://apache.org**>
>>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org><
>>>>>>>> users-unsubscribe@**wicket.apache.org<us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>   ------------------------------****----------------------------**
>>>>>> --**---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>> <us...@wicket.apache.org>
>>>>>>>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

As Sven suggested - BorderBehavior does exactly this.


On Tue, Feb 12, 2013 at 9:08 AM, Michael Jaruska
<mi...@gmail.com>wrote:

> no way how to modify raw html stream in actual rendering?
>
>
>
> On 11.2.2013 11:50, Michael Jaruska wrote:
>
>> based on this article:
>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>in section onRender()
>> it should be possible to modify markup which is going from wicket (e.g.
>> from .html file)
>> and modyfied it send to client.
>>
>>
>> On 11.2.2013 11:34, Michael Jaruska wrote:
>>
>>> yes, i need that raw html that comes from markup (my .html file which is
>>> my panel),
>>> in java code i will modify it (one step for put new class) and send it
>>> to client :-)
>>> as i thnik now i dont need to delete previous step because this
>>> modifying isn't in
>>> markup. so i just need to modify markup in actual render - modify markup
>>> stream.
>>>
>>>
>>> On 11.2.2013 11:26, Martin Grigorov wrote:
>>>
>>>> MarkupStream gives you the raw html that comes from the .html file, i.e.
>>>> from the template file.
>>>> It doesn't give you the html from the previous page render.
>>>>
>>>> You need to send Ajax requests to update the server side state to be in
>>>> sync with the client side state (modified by your JS).
>>>>
>>>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <
>>>> michael.jaruska@gmail.com
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>>  in fact, my panel is menu which is modified by javascript.
>>>>> i need to keep track of the previous selected entry (to get know
>>>>> javascript to disable element) and actual element to modify
>>>>> (add class) for javascript.
>>>>>
>>>>> javascript need to now at a moment "page rendered" where is
>>>>> class which it is looking for.
>>>>>
>>>>> so i need to modify html markup, modify it on client side by
>>>>> javascript is not possible.
>>>>>
>>>>> based on this article:
>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>> >
>>>>> it should be possible modify markup generated by component (my
>>>>> panel).
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>>>
>>>>>  Hi,
>>>>>>
>>>>>> What do you want to do with the markup ?
>>>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>>>> something that may be solved much easier.
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>>>> michael.jaruska@gmail.com
>>>>>>
>>>>>>  wrote:
>>>>>>>
>>>>>>>
>>>>>>   thanks, studied. but in my case not working. i don't know why,
>>>>>> where is
>>>>>>
>>>>>>> my
>>>>>>> mistake. try this code:
>>>>>>>
>>>>>>> markup - base page:
>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>> <html xmlns:wicket>
>>>>>>>       <head>
>>>>>>>           <title>my test page</title>
>>>>>>>           <meta http-equiv="Content-Type" content="text/html;
>>>>>>> charset=utf-8"
>>>>>>> />
>>>>>>>       </head>
>>>>>>>       <body>
>>>>>>>           <p>my test page</p>
>>>>>>>           <span wicket:id="myPanel">[my test panel]</span>
>>>>>>>       </body>
>>>>>>> </html>
>>>>>>>
>>>>>>> markup - my test panel:
>>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>>> <html xmlns:wicket>
>>>>>>> <wicket:panel>
>>>>>>>      <ul>
>>>>>>>         <li>
>>>>>>>           <a href="./mypage.html?cid=menu">******my item</a>
>>>>>>>
>>>>>>>         </li>
>>>>>>>      </ul>
>>>>>>> </wicket:panel>
>>>>>>>
>>>>>>> java - base page:
>>>>>>> public class PageBase extends WebPage{
>>>>>>>           public PageBase()
>>>>>>>           {
>>>>>>>                   //my panel
>>>>>>>                   this.add(new MyMenu("myPanel").****
>>>>>>> setRenderBodyOnly(true));
>>>>>>>
>>>>>>>           }
>>>>>>> }
>>>>>>>
>>>>>>> java - panel:
>>>>>>> ublic class MyMenu extends Panel{
>>>>>>>           public PanelMenu(String id)
>>>>>>>           {
>>>>>>>                   super(id);
>>>>>>>           }
>>>>>>>
>>>>>>>           protected void onRender(MarkupStream markupStream){
>>>>>>>                   while(markupStream.hasMore())
>>>>>>>                   {
>>>>>>>                           System.out.println(******
>>>>>>> markupStream.next());
>>>>>>>
>>>>>>>                   }
>>>>>>>           }
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> i expect on console printed whole html markup for panel, but nothing
>>>>>>> is
>>>>>>> displayed.
>>>>>>>
>>>>>>> any ideas please?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>>>
>>>>>>>   See BorderBehavior#beforeRender(******Component) on how to
>>>>>>> iterate over
>>>>>>>
>>>>>>>> the
>>>>>>>>
>>>>>>>> markup.
>>>>>>>>
>>>>>>>> Sven
>>>>>>>>
>>>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>>>
>>>>>>>>   my quick test:
>>>>>>>>
>>>>>>>>> @Override
>>>>>>>>> protected void onRender()
>>>>>>>>> {
>>>>>>>>>       super.onRender();
>>>>>>>>>       System.out.println(this.******getMarkup().toString());
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how to
>>>>>>>>> get
>>>>>>>>> whole
>>>>>>>>> markup for my panel?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>>>
>>>>>>>>>   Sure, with #getMarkup() you can get hold of the component's
>>>>>>>>> markup.
>>>>>>>>>
>>>>>>>>>> With a MarkupStream you can iterate over it.
>>>>>>>>>>
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>>>
>>>>>>>>>>   again with my question: is it possible to get markup in
>>>>>>>>>> onRender() of
>>>>>>>>>>
>>>>>>>>>>> the component?
>>>>>>>>>>> have found this article:
>>>>>>>>>>> https://cwiki.apache.org/******WICKET/component-rendering.*****
>>>>>>>>>>> *html<https://cwiki.apache.org/****WICKET/component-rendering.****html>
>>>>>>>>>>> <https://cwiki.apache.**org/**WICKET/component-**
>>>>>>>>>>> rendering.**html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>> >
>>>>>>>>>>> <https://cwiki.apache.org/****WICKET/component-rendering.****
>>>>>>>>>>> html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>> >
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> but in onRender() section is just code snippet I'm not
>>>>>>>>>>> understand. is
>>>>>>>>>>> there more
>>>>>>>>>>> detailed example how to get markup of the component in
>>>>>>>>>>> onRender()?
>>>>>>>>>>>
>>>>>>>>>>> thanks, michael
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>>>
>>>>>>>>>>>   You can use IMarkupFilter to manipulate the raw markup before
>>>>>>>>>>> being
>>>>>>>>>>>
>>>>>>>>>>>> loaded
>>>>>>>>>>>> and used by the components.
>>>>>>>>>>>> See the implementations in Wicket to see what can be done with
>>>>>>>>>>>> such
>>>>>>>>>>>> filter.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>>>
>>>>>>>>>>>>   wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>     Look at my original post. User clicks on <a
>>>>>>>>>>>>
>>>>>>>>>>>>  href="./mypage.html?cid=menu/*
>>>>>>>>>>>>> *submenu/subsubmenu2">********subsubmenu2</a>, then
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>>>
>>>>>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>>>>>> <li>
>>>>>>>>>>>>> tag...
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>>>> attribute
>>>>>>>>>>>>>
>>>>>>>>>>>>>  ;-)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>>>> generate
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>>>>>> normal
>>>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>>>> override
>>>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g.
>>>>>>>>>>>>>> look at
>>>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a
>>>>>>>>>>>>>> custom
>>>>>>>>>>>>>> model.
>>>>>>>>>>>>>> The model can then load the html and perform string
>>>>>>>>>>>>>> replacement.
>>>>>>>>>>>>>> You can then add a label component which uses the model and
>>>>>>>>>>>>>> has
>>>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    I need to find the parent <li> tag of the anchor user
>>>>>>>>>>>>>> clicks - I
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  now
>>>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li>
>>>>>>>>>>>>>>> specific
>>>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    Sorry, I read too quickly.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>>>>>> find
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    And question is not "how can I change html attribute"
>>>>>>>>>>>>>>>> but "how
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  can I
>>>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    Hi!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li>
>>>>>>>>>>>>>>>>>> component.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>>>         isEnabled() {
>>>>>>>>>>>>>>>>>>             return true if you want to append a html
>>>>>>>>>>>>>>>>>> attribute;
>>>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>>>         onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>>>             super(tag);
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>             tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>    Hi,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>>>      <li>
>>>>>>>>>>>>>>>>>>>        <a href="./mypage.html?cid=menu">********menu</a>
>>>>>>>>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>>>        <ul>
>>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>>        </ul>
>>>>>>>>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      ...
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li>
>>>>>>>>>>>>>>>>>>> tag
>>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>>      //find corresponding <a> tag
>>>>>>>>>>>>>>>>>>>      Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>>>>>>>>>> ******
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>>>      //have corresponding anchor tag, get parrent tag of
>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>>>      Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>>>      //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly
>>>>>>>>>>>>>>>>>>> don't
>>>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ------------------------------****
>>>>>>>>>>>>>>>>>>> ****--------------------------****--
>>>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******
>>>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-****unsubscribe@**
>>>>>>>>>>>>>>>>>>> wicket.apache.org <users-unsubscribe@wicket.**ap**
>>>>>>>>>>>>>>>>>>> ache.org <http://apache.org><users-unsubscribe@**
>>>>>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     ------------------------------****
>>>>>>>>>>>>>>>>>> ****--------------------------****--
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>  **--**
>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******
>>>>>>>>>>>>>>>>> apa**
>>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>> >
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    For additional commands, e-mail:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>     ------------------------------****
>>>>>>>>>>>>>>>> ****--------------------------****--**
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>  --**
>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org<http://apache.org>
>>>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>> >
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    For additional commands, e-mail:
>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     ------------------------------**
>>>>>>>>>>>>>> ******------------------------**--*
>>>>>>>>>>>>>> *--**
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  --**---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.******apa**
>>>>>>>>>>>>> che.org<
>>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.****apache.org <http://apache.org>
>>>>>>>>>>>>> <http://wicket.**apache.org <http://wicket.apache.org>>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>    For additional commands, e-mail:
>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>   ------------------------------**
>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>
>>>>>>>>>>> --**
>>>>>>>>>>> ---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>> >
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  ------------------------------******--------------------------*
>>>>>>>>>> *--**--**
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org
>>>>>>>>>> <http://apache.org**>
>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>   ------------------------------******--------------------------*
>>>>>>>>>> *--**--**
>>>>>>>>>>
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>> http://apache.org**>
>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  ------------------------------******--------------------------**
>>>>>>>> --**
>>>>>>>> --**---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>> http://apache.org**>
>>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org>
>>>>>>>> <us...@wicket.apache.org>
>>>>>>>> >
>>>>>>>>
>>>>>>>>>
>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>   ------------------------------******--------------------------**
>>>>>>>> --**
>>>>>>>>
>>>>>>> --**---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>> http://apache.org**>
>>>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org><
>>>>>>> users-unsubscribe@**wicket.apache.org<us...@wicket.apache.org>
>>>>>>> >
>>>>>>>
>>>>>>>>
>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>  ------------------------------****----------------------------**
>>>>> --**---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>> <us...@wicket.apache.org>
>>>>> >
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
no way how to modify raw html stream in actual rendering?


On 11.2.2013 11:50, Michael Jaruska wrote:
> based on this article:
> https://cwiki.apache.org/WICKET/component-rendering.html in section onRender()
> it should be possible to modify markup which is going from wicket (e.g. from .html file)
> and modyfied it send to client.
>
>
> On 11.2.2013 11:34, Michael Jaruska wrote:
>> yes, i need that raw html that comes from markup (my .html file which is my panel),
>> in java code i will modify it (one step for put new class) and send it to client :-)
>> as i thnik now i dont need to delete previous step because this modifying isn't in
>> markup. so i just need to modify markup in actual render - modify markup stream.
>>
>>
>> On 11.2.2013 11:26, Martin Grigorov wrote:
>>> MarkupStream gives you the raw html that comes from the .html file, i.e.
>>> from the template file.
>>> It doesn't give you the html from the previous page render.
>>>
>>> You need to send Ajax requests to update the server side state to be in
>>> sync with the client side state (modified by your JS).
>>>
>>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <michael.jaruska@gmail.com
>>>> wrote:
>>>
>>>> in fact, my panel is menu which is modified by javascript.
>>>> i need to keep track of the previous selected entry (to get know
>>>> javascript to disable element) and actual element to modify
>>>> (add class) for javascript.
>>>>
>>>> javascript need to now at a moment "page rendered" where is
>>>> class which it is looking for.
>>>>
>>>> so i need to modify html markup, modify it on client side by
>>>> javascript is not possible.
>>>>
>>>> based on this article:
>>>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>> it should be possible modify markup generated by component (my
>>>> panel).
>>>>
>>>>
>>>>
>>>>
>>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> What do you want to do with the markup ?
>>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>>> something that may be solved much easier.
>>>>>
>>>>>
>>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>>> michael.jaruska@gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>>   thanks, studied. but in my case not working. i don't know why, where is
>>>>>> my
>>>>>> mistake. try this code:
>>>>>>
>>>>>> markup - base page:
>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>> <html xmlns:wicket>
>>>>>>       <head>
>>>>>>           <title>my test page</title>
>>>>>>           <meta http-equiv="Content-Type" content="text/html;
>>>>>> charset=utf-8"
>>>>>> />
>>>>>>       </head>
>>>>>>       <body>
>>>>>>           <p>my test page</p>
>>>>>>           <span wicket:id="myPanel">[my test panel]</span>
>>>>>>       </body>
>>>>>> </html>
>>>>>>
>>>>>> markup - my test panel:
>>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>>> <html xmlns:wicket>
>>>>>> <wicket:panel>
>>>>>>      <ul>
>>>>>>         <li>
>>>>>>           <a href="./mypage.html?cid=menu">****my item</a>
>>>>>>
>>>>>>         </li>
>>>>>>      </ul>
>>>>>> </wicket:panel>
>>>>>>
>>>>>> java - base page:
>>>>>> public class PageBase extends WebPage{
>>>>>>           public PageBase()
>>>>>>           {
>>>>>>                   //my panel
>>>>>>                   this.add(new MyMenu("myPanel").****
>>>>>> setRenderBodyOnly(true));
>>>>>>
>>>>>>           }
>>>>>> }
>>>>>>
>>>>>> java - panel:
>>>>>> ublic class MyMenu extends Panel{
>>>>>>           public PanelMenu(String id)
>>>>>>           {
>>>>>>                   super(id);
>>>>>>           }
>>>>>>
>>>>>>           protected void onRender(MarkupStream markupStream){
>>>>>>                   while(markupStream.hasMore())
>>>>>>                   {
>>>>>>                           System.out.println(****markupStream.next());
>>>>>>
>>>>>>                   }
>>>>>>           }
>>>>>> }
>>>>>>
>>>>>>
>>>>>> i expect on console printed whole html markup for panel, but nothing is
>>>>>> displayed.
>>>>>>
>>>>>> any ideas please?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>>
>>>>>>   See BorderBehavior#beforeRender(****Component) on how to iterate over
>>>>>>> the
>>>>>>>
>>>>>>> markup.
>>>>>>>
>>>>>>> Sven
>>>>>>>
>>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>>
>>>>>>>   my quick test:
>>>>>>>> @Override
>>>>>>>> protected void onRender()
>>>>>>>> {
>>>>>>>>       super.onRender();
>>>>>>>>       System.out.println(this.****getMarkup().toString());
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>>>>>>> whole
>>>>>>>> markup for my panel?
>>>>>>>>
>>>>>>>>
>>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>>
>>>>>>>>   Sure, with #getMarkup() you can get hold of the component's markup.
>>>>>>>>> With a MarkupStream you can iterate over it.
>>>>>>>>>
>>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>>
>>>>>>>>>   again with my question: is it possible to get markup in onRender() of
>>>>>>>>>> the component?
>>>>>>>>>> have found this article:
>>>>>>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>>>>>>> there more
>>>>>>>>>> detailed example how to get markup of the component in onRender()?
>>>>>>>>>>
>>>>>>>>>> thanks, michael
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>>
>>>>>>>>>>   You can use IMarkupFilter to manipulate the raw markup before being
>>>>>>>>>>> loaded
>>>>>>>>>>> and used by the components.
>>>>>>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>>>>>>> filter.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>>
>>>>>>>>>>>   wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>    Look at my original post. User clicks on <a
>>>>>>>>>>>
>>>>>>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>>>>>>> *submenu/subsubmenu2">******subsubmenu2</a>, then
>>>>>>>>>>>>
>>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>>
>>>>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>>>>> <li>
>>>>>>>>>>>> tag...
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>    Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>>> attribute
>>>>>>>>>>>>
>>>>>>>>>>>>> ;-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>>> generate
>>>>>>>>>>>>> the
>>>>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>>>>> normal
>>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>>> override
>>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>>>>>>> model.
>>>>>>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>
>>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>>>>>>
>>>>>>>>>>>>>> now
>>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    Sorry, I read too quickly.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>>>>> find
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    And question is not "how can I change html attribute" but "how
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> can I
>>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    Hi!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>>         isEnabled() {
>>>>>>>>>>>>>>>>>             return true if you want to append a html attribute;
>>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>>         onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>>             super(tag);
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>             tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    Hi,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>>      <li>
>>>>>>>>>>>>>>>>>>        <a href="./mypage.html?cid=menu">******menu</a>
>>>>>>>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>>        <ul>
>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>>        </ul>
>>>>>>>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>      ...
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag
>>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>>      //find corresponding <a> tag
>>>>>>>>>>>>>>>>>>      Tag anchorTag = go_from_top_ul_tag_and_find_a_******
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>>      //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>>      Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>>      //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> ------------------------------**
>>>>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --**
>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>    ------------------------------******--------------------------*
>>>>>>>>>>>>> *--**
>>>>>>>>>>>>>
>>>>>>>>>>>> --**---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   ------------------------------****----------------------------**
>>>>>>>>>> --**
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> ------------------------------****----------------------------**--**
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   ------------------------------****----------------------------**--**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> ------------------------------****----------------------------**
>>>>>>> --**---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>> <us...@wicket.apache.org>
>>>>>>>>
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>   ------------------------------****----------------------------**
>>>>>> --**---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>> <us...@wicket.apache.org>
>>>>>>>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
based on this article:
https://cwiki.apache.org/WICKET/component-rendering.html in section onRender()
it should be possible to modify markup which is going from wicket (e.g. from .html file)
and modyfied it send to client.


On 11.2.2013 11:34, Michael Jaruska wrote:
> yes, i need that raw html that comes from markup (my .html file which is my panel),
> in java code i will modify it (one step for put new class) and send it to client :-)
> as i thnik now i dont need to delete previous step because this modifying isn't in
> markup. so i just need to modify markup in actual render - modify markup stream.
>
>
> On 11.2.2013 11:26, Martin Grigorov wrote:
>> MarkupStream gives you the raw html that comes from the .html file, i.e.
>> from the template file.
>> It doesn't give you the html from the previous page render.
>>
>> You need to send Ajax requests to update the server side state to be in
>> sync with the client side state (modified by your JS).
>>
>> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <michael.jaruska@gmail.com
>>> wrote:
>>
>>> in fact, my panel is menu which is modified by javascript.
>>> i need to keep track of the previous selected entry (to get know
>>> javascript to disable element) and actual element to modify
>>> (add class) for javascript.
>>>
>>> javascript need to now at a moment "page rendered" where is
>>> class which it is looking for.
>>>
>>> so i need to modify html markup, modify it on client side by
>>> javascript is not possible.
>>>
>>> based on this article:
>>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>> it should be possible modify markup generated by component (my
>>> panel).
>>>
>>>
>>>
>>>
>>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>>
>>>> Hi,
>>>>
>>>> What do you want to do with the markup ?
>>>> Maybe you don't need to bother with internals like MarkupStream for
>>>> something that may be solved much easier.
>>>>
>>>>
>>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>>> michael.jaruska@gmail.com
>>>>
>>>>> wrote:
>>>>>
>>>>
>>>>   thanks, studied. but in my case not working. i don't know why, where is
>>>>> my
>>>>> mistake. try this code:
>>>>>
>>>>> markup - base page:
>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>> <html xmlns:wicket>
>>>>>       <head>
>>>>>           <title>my test page</title>
>>>>>           <meta http-equiv="Content-Type" content="text/html;
>>>>> charset=utf-8"
>>>>> />
>>>>>       </head>
>>>>>       <body>
>>>>>           <p>my test page</p>
>>>>>           <span wicket:id="myPanel">[my test panel]</span>
>>>>>       </body>
>>>>> </html>
>>>>>
>>>>> markup - my test panel:
>>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>>> <html xmlns:wicket>
>>>>> <wicket:panel>
>>>>>      <ul>
>>>>>         <li>
>>>>>           <a href="./mypage.html?cid=menu">****my item</a>
>>>>>
>>>>>         </li>
>>>>>      </ul>
>>>>> </wicket:panel>
>>>>>
>>>>> java - base page:
>>>>> public class PageBase extends WebPage{
>>>>>           public PageBase()
>>>>>           {
>>>>>                   //my panel
>>>>>                   this.add(new MyMenu("myPanel").****
>>>>> setRenderBodyOnly(true));
>>>>>
>>>>>           }
>>>>> }
>>>>>
>>>>> java - panel:
>>>>> ublic class MyMenu extends Panel{
>>>>>           public PanelMenu(String id)
>>>>>           {
>>>>>                   super(id);
>>>>>           }
>>>>>
>>>>>           protected void onRender(MarkupStream markupStream){
>>>>>                   while(markupStream.hasMore())
>>>>>                   {
>>>>>                           System.out.println(****markupStream.next());
>>>>>
>>>>>                   }
>>>>>           }
>>>>> }
>>>>>
>>>>>
>>>>> i expect on console printed whole html markup for panel, but nothing is
>>>>> displayed.
>>>>>
>>>>> any ideas please?
>>>>>
>>>>>
>>>>>
>>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>>
>>>>>   See BorderBehavior#beforeRender(****Component) on how to iterate over
>>>>>> the
>>>>>>
>>>>>> markup.
>>>>>>
>>>>>> Sven
>>>>>>
>>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>>
>>>>>>   my quick test:
>>>>>>> @Override
>>>>>>> protected void onRender()
>>>>>>> {
>>>>>>>       super.onRender();
>>>>>>>       System.out.println(this.****getMarkup().toString());
>>>>>>>
>>>>>>> }
>>>>>>>
>>>>>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>>>>>> whole
>>>>>>> markup for my panel?
>>>>>>>
>>>>>>>
>>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>>
>>>>>>>   Sure, with #getMarkup() you can get hold of the component's markup.
>>>>>>>> With a MarkupStream you can iterate over it.
>>>>>>>>
>>>>>>>> Sven
>>>>>>>>
>>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>>
>>>>>>>>   again with my question: is it possible to get markup in onRender() of
>>>>>>>>> the component?
>>>>>>>>> have found this article:
>>>>>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>>>>>> there more
>>>>>>>>> detailed example how to get markup of the component in onRender()?
>>>>>>>>>
>>>>>>>>> thanks, michael
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>>
>>>>>>>>>   You can use IMarkupFilter to manipulate the raw markup before being
>>>>>>>>>> loaded
>>>>>>>>>> and used by the components.
>>>>>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>>>>>> filter.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>>
>>>>>>>>>>   wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>    Look at my original post. User clicks on <a
>>>>>>>>>>
>>>>>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>>>>>> *submenu/subsubmenu2">******subsubmenu2</a>, then
>>>>>>>>>>>
>>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>>
>>>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>>>> <li>
>>>>>>>>>>> tag...
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>>
>>>>>>>>>>>    Ok, so you are indeed looking for a way to change a html
>>>>>>>>>>> attribute
>>>>>>>>>>>
>>>>>>>>>>>> ;-)
>>>>>>>>>>>>
>>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>>> generate
>>>>>>>>>>>> the
>>>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>>>> normal
>>>>>>>>>>>> wicket way.
>>>>>>>>>>>>
>>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>>> override
>>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>>
>>>>>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>>>>>> model.
>>>>>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>>
>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>
>>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>>
>>>>>>>>>>>>    I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>>>>>
>>>>>>>>>>>>> now
>>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    Sorry, I read too quickly.
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>>>> find
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    And question is not "how can I change html attribute" but "how
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> can I
>>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    Hi!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>>         isEnabled() {
>>>>>>>>>>>>>>>>             return true if you want to append a html attribute;
>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>>         onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>>             super(tag);
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>             tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>>      <li>
>>>>>>>>>>>>>>>>>        <a href="./mypage.html?cid=menu">******menu</a>
>>>>>>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>>        <ul>
>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>>        </ul>
>>>>>>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>      ...
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag
>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>>      //find corresponding <a> tag
>>>>>>>>>>>>>>>>>      Tag anchorTag = go_from_top_ul_tag_and_find_a_******
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>>      //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>>      Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>>      //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ------------------------------**
>>>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>>>> che.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>>>
>>>>>>>>>>>>> --**
>>>>>>>>>>>>> ---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>    ------------------------------******--------------------------*
>>>>>>>>>>>> *--**
>>>>>>>>>>>>
>>>>>>>>>>> --**---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>>>> http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>   ------------------------------****----------------------------**
>>>>>>>>> --**
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ------------------------------****----------------------------**--**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>   ------------------------------****----------------------------**--**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>> <us...@wicket.apache.org>
>>>>>>>>
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------****----------------------------**
>>>>>> --**---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>> <us...@wicket.apache.org>
>>>>>>>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>   ------------------------------****----------------------------**
>>>>> --**---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>> <us...@wicket.apache.org>
>>>>>>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
yes, i need that raw html that comes from markup (my .html file which is my panel),
in java code i will modify it (one step for put new class) and send it to client :-)
as i thnik now i dont need to delete previous step because this modifying isn't in
markup. so i just need to modify markup in actual render - modify markup stream.


On 11.2.2013 11:26, Martin Grigorov wrote:
> MarkupStream gives you the raw html that comes from the .html file, i.e.
> from the template file.
> It doesn't give you the html from the previous page render.
>
> You need to send Ajax requests to update the server side state to be in
> sync with the client side state (modified by your JS).
>
> On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <michael.jaruska@gmail.com
>> wrote:
>
>> in fact, my panel is menu which is modified by javascript.
>> i need to keep track of the previous selected entry (to get know
>> javascript to disable element) and actual element to modify
>> (add class) for javascript.
>>
>> javascript need to now at a moment "page rendered" where is
>> class which it is looking for.
>>
>> so i need to modify html markup, modify it on client side by
>> javascript is not possible.
>>
>> based on this article:
>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>> it should be possible modify markup generated by component (my
>> panel).
>>
>>
>>
>>
>> On 11.2.2013 10:03, Martin Grigorov wrote:
>>
>>> Hi,
>>>
>>> What do you want to do with the markup ?
>>> Maybe you don't need to bother with internals like MarkupStream for
>>> something that may be solved much easier.
>>>
>>>
>>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>>> michael.jaruska@gmail.com
>>>
>>>> wrote:
>>>>
>>>
>>>   thanks, studied. but in my case not working. i don't know why, where is
>>>> my
>>>> mistake. try this code:
>>>>
>>>> markup - base page:
>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>> <html xmlns:wicket>
>>>>       <head>
>>>>           <title>my test page</title>
>>>>           <meta http-equiv="Content-Type" content="text/html;
>>>> charset=utf-8"
>>>> />
>>>>       </head>
>>>>       <body>
>>>>           <p>my test page</p>
>>>>           <span wicket:id="myPanel">[my test panel]</span>
>>>>       </body>
>>>> </html>
>>>>
>>>> markup - my test panel:
>>>> <?xml version="1.0" encoding="UTF-8" ?>
>>>> <html xmlns:wicket>
>>>> <wicket:panel>
>>>>      <ul>
>>>>         <li>
>>>>           <a href="./mypage.html?cid=menu">****my item</a>
>>>>
>>>>         </li>
>>>>      </ul>
>>>> </wicket:panel>
>>>>
>>>> java - base page:
>>>> public class PageBase extends WebPage{
>>>>           public PageBase()
>>>>           {
>>>>                   //my panel
>>>>                   this.add(new MyMenu("myPanel").****
>>>> setRenderBodyOnly(true));
>>>>
>>>>           }
>>>> }
>>>>
>>>> java - panel:
>>>> ublic class MyMenu extends Panel{
>>>>           public PanelMenu(String id)
>>>>           {
>>>>                   super(id);
>>>>           }
>>>>
>>>>           protected void onRender(MarkupStream markupStream){
>>>>                   while(markupStream.hasMore())
>>>>                   {
>>>>                           System.out.println(****markupStream.next());
>>>>
>>>>                   }
>>>>           }
>>>> }
>>>>
>>>>
>>>> i expect on console printed whole html markup for panel, but nothing is
>>>> displayed.
>>>>
>>>> any ideas please?
>>>>
>>>>
>>>>
>>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>>
>>>>   See BorderBehavior#beforeRender(****Component) on how to iterate over
>>>>> the
>>>>>
>>>>> markup.
>>>>>
>>>>> Sven
>>>>>
>>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>>
>>>>>   my quick test:
>>>>>> @Override
>>>>>> protected void onRender()
>>>>>> {
>>>>>>       super.onRender();
>>>>>>       System.out.println(this.****getMarkup().toString());
>>>>>>
>>>>>> }
>>>>>>
>>>>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>>>>> whole
>>>>>> markup for my panel?
>>>>>>
>>>>>>
>>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>>
>>>>>>   Sure, with #getMarkup() you can get hold of the component's markup.
>>>>>>> With a MarkupStream you can iterate over it.
>>>>>>>
>>>>>>> Sven
>>>>>>>
>>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>>
>>>>>>>   again with my question: is it possible to get markup in onRender() of
>>>>>>>> the component?
>>>>>>>> have found this article:
>>>>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>>>>
>>>>>>>>
>>>>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>>>>> there more
>>>>>>>> detailed example how to get markup of the component in onRender()?
>>>>>>>>
>>>>>>>> thanks, michael
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>>   You can use IMarkupFilter to manipulate the raw markup before being
>>>>>>>>> loaded
>>>>>>>>> and used by the components.
>>>>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>>>>> filter.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>>
>>>>>>>>>   wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>    Look at my original post. User clicks on <a
>>>>>>>>>
>>>>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>>>>> *submenu/subsubmenu2">******subsubmenu2</a>, then
>>>>>>>>>>
>>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>>
>>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>>> <li>
>>>>>>>>>> tag...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>>
>>>>>>>>>>    Ok, so you are indeed looking for a way to change a html
>>>>>>>>>> attribute
>>>>>>>>>>
>>>>>>>>>>> ;-)
>>>>>>>>>>>
>>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>>> generate
>>>>>>>>>>> the
>>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>>> normal
>>>>>>>>>>> wicket way.
>>>>>>>>>>>
>>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>>> override
>>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>>
>>>>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>>>>> model.
>>>>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>>
>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>> Kind regards,
>>>>>>>>>>>
>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>
>>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>>
>>>>>>>>>>>    I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>>>>
>>>>>>>>>>>> now
>>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>    Sorry, I read too quickly.
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>>> find
>>>>>>>>>>>>> the
>>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>
>>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    And question is not "how can I change html attribute" but "how
>>>>>>>>>>>>>
>>>>>>>>>>>>>> can I
>>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    Hi!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>>         isEnabled() {
>>>>>>>>>>>>>>>             return true if you want to append a html attribute;
>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>>         onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>>             super(tag);
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>             tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>>      <li>
>>>>>>>>>>>>>>>>        <a href="./mypage.html?cid=menu">******menu</a>
>>>>>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>>        <ul>
>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>          <li>
>>>>>>>>>>>>>>>>            <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>>          </li>
>>>>>>>>>>>>>>>>        </ul>
>>>>>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>      ...
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag
>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>>      //cid = category id
>>>>>>>>>>>>>>>>      String category = parameters.get("cid").******
>>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>>      //find corresponding <a> tag
>>>>>>>>>>>>>>>>      Tag anchorTag = go_from_top_ul_tag_and_find_a_******
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>>      //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>>      Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>>      //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ------------------------------**
>>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>>> che.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   For additional commands, e-mail:
>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>    ------------------------------**
>>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>>
>>>>>>>>>>>> --**
>>>>>>>>>>>> ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>    ------------------------------******--------------------------*
>>>>>>>>>>> *--**
>>>>>>>>>>>
>>>>>>>>>> --**---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>>> http://apache.org**>
>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>   For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   ------------------------------****----------------------------**
>>>>>>>> --**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> ------------------------------****----------------------------**--**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>> <us...@wicket.apache.org>
>>>>>>>>
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>   ------------------------------****----------------------------**--**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>> <us...@wicket.apache.org>
>>>>>>>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>> ------------------------------****----------------------------**
>>>>> --**---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>> <us...@wicket.apache.org>
>>>>>>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>   ------------------------------****----------------------------**
>>>> --**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>> <us...@wicket.apache.org>
>>>>>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Martin Grigorov <mg...@apache.org>.
MarkupStream gives you the raw html that comes from the .html file, i.e.
from the template file.
It doesn't give you the html from the previous page render.

You need to send Ajax requests to update the server side state to be in
sync with the client side state (modified by your JS).

On Mon, Feb 11, 2013 at 11:22 AM, Michael Jaruska <michael.jaruska@gmail.com
> wrote:

> in fact, my panel is menu which is modified by javascript.
> i need to keep track of the previous selected entry (to get know
> javascript to disable element) and actual element to modify
> (add class) for javascript.
>
> javascript need to now at a moment "page rendered" where is
> class which it is looking for.
>
> so i need to modify html markup, modify it on client side by
> javascript is not possible.
>
> based on this article:
> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
> it should be possible modify markup generated by component (my
> panel).
>
>
>
>
> On 11.2.2013 10:03, Martin Grigorov wrote:
>
>> Hi,
>>
>> What do you want to do with the markup ?
>> Maybe you don't need to bother with internals like MarkupStream for
>> something that may be solved much easier.
>>
>>
>> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <
>> michael.jaruska@gmail.com
>>
>>> wrote:
>>>
>>
>>  thanks, studied. but in my case not working. i don't know why, where is
>>> my
>>> mistake. try this code:
>>>
>>> markup - base page:
>>> <?xml version="1.0" encoding="UTF-8" ?>
>>> <html xmlns:wicket>
>>>      <head>
>>>          <title>my test page</title>
>>>          <meta http-equiv="Content-Type" content="text/html;
>>> charset=utf-8"
>>> />
>>>      </head>
>>>      <body>
>>>          <p>my test page</p>
>>>          <span wicket:id="myPanel">[my test panel]</span>
>>>      </body>
>>> </html>
>>>
>>> markup - my test panel:
>>> <?xml version="1.0" encoding="UTF-8" ?>
>>> <html xmlns:wicket>
>>> <wicket:panel>
>>>     <ul>
>>>        <li>
>>>          <a href="./mypage.html?cid=menu">****my item</a>
>>>
>>>        </li>
>>>     </ul>
>>> </wicket:panel>
>>>
>>> java - base page:
>>> public class PageBase extends WebPage{
>>>          public PageBase()
>>>          {
>>>                  //my panel
>>>                  this.add(new MyMenu("myPanel").****
>>> setRenderBodyOnly(true));
>>>
>>>          }
>>> }
>>>
>>> java - panel:
>>> ublic class MyMenu extends Panel{
>>>          public PanelMenu(String id)
>>>          {
>>>                  super(id);
>>>          }
>>>
>>>          protected void onRender(MarkupStream markupStream){
>>>                  while(markupStream.hasMore())
>>>                  {
>>>                          System.out.println(****markupStream.next());
>>>
>>>                  }
>>>          }
>>> }
>>>
>>>
>>> i expect on console printed whole html markup for panel, but nothing is
>>> displayed.
>>>
>>> any ideas please?
>>>
>>>
>>>
>>> On 10.2.2013 23:21, Sven Meier wrote:
>>>
>>>  See BorderBehavior#beforeRender(****Component) on how to iterate over
>>>> the
>>>>
>>>> markup.
>>>>
>>>> Sven
>>>>
>>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>>
>>>>  my quick test:
>>>>> @Override
>>>>> protected void onRender()
>>>>> {
>>>>>      super.onRender();
>>>>>      System.out.println(this.****getMarkup().toString());
>>>>>
>>>>> }
>>>>>
>>>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>>>> whole
>>>>> markup for my panel?
>>>>>
>>>>>
>>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>>
>>>>>  Sure, with #getMarkup() you can get hold of the component's markup.
>>>>>> With a MarkupStream you can iterate over it.
>>>>>>
>>>>>> Sven
>>>>>>
>>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>>
>>>>>>  again with my question: is it possible to get markup in onRender() of
>>>>>>> the component?
>>>>>>> have found this article:
>>>>>>> https://cwiki.apache.org/****WICKET/component-rendering.****html<https://cwiki.apache.org/**WICKET/component-rendering.**html>
>>>>>>> <https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>>> >
>>>>>>>
>>>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>>>> there more
>>>>>>> detailed example how to get markup of the component in onRender()?
>>>>>>>
>>>>>>> thanks, michael
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>>
>>>>>>>  You can use IMarkupFilter to manipulate the raw markup before being
>>>>>>>> loaded
>>>>>>>> and used by the components.
>>>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>>>> filter.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>>> michael.jaruska@gmail.com
>>>>>>>>
>>>>>>>>  wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>   Look at my original post. User clicks on <a
>>>>>>>>
>>>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>>>> *submenu/subsubmenu2">******subsubmenu2</a>, then
>>>>>>>>>
>>>>>>>>> I have in String "category" (java code) value
>>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>>> I need just to make 2 more steps:
>>>>>>>>> 1. in html code find anchor tag with href
>>>>>>>>> "menu/submenu/subsubmenu2";
>>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>>
>>>>>>>>> When I have point 2 done, then I know how to put somethink into
>>>>>>>>> <li>
>>>>>>>>> tag...
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>>
>>>>>>>>>   Ok, so you are indeed looking for a way to change a html
>>>>>>>>> attribute
>>>>>>>>>
>>>>>>>>>> ;-)
>>>>>>>>>>
>>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot
>>>>>>>>>> generate
>>>>>>>>>> the
>>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>>> normal
>>>>>>>>>> wicket way.
>>>>>>>>>>
>>>>>>>>>> 1) In the component which actually renders your static html
>>>>>>>>>> override
>>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>>
>>>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>>>> model.
>>>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>>
>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>> Kind regards,
>>>>>>>>>>
>>>>>>>>>> Bas Gooren
>>>>>>>>>>
>>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>>
>>>>>>>>>>   I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>>>
>>>>>>>>>>> now
>>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>>
>>>>>>>>>>>   Sorry, I read too quickly.
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to
>>>>>>>>>>>> find
>>>>>>>>>>>> the
>>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>>
>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>
>>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>>
>>>>>>>>>>>>   And question is not "how can I change html attribute" but "how
>>>>>>>>>>>>
>>>>>>>>>>>>> can I
>>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>   Hi!
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>>        isEnabled() {
>>>>>>>>>>>>>>            return true if you want to append a html attribute;
>>>>>>>>>>>>>>        }
>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>>        onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>>            super(tag);
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>            tag.put("my-html-attribute", value);
>>>>>>>>>>>>>>        }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>>     <li>
>>>>>>>>>>>>>>>       <a href="./mypage.html?cid=menu">******menu</a>
>>>>>>>>>>>>>>>     <ul>
>>>>>>>>>>>>>>>       <li>
>>>>>>>>>>>>>>>         <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>>       <ul>
>>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/*****
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>>       </ul>
>>>>>>>>>>>>>>>     </ul>
>>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>     //cid = category id
>>>>>>>>>>>>>>>     String category = parameters.get("cid").******
>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>     ...
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag
>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>>     //cid = category id
>>>>>>>>>>>>>>>     String category = parameters.get("cid").******
>>>>>>>>>>>>>>> toString();
>>>>>>>>>>>>>>>     //find corresponding <a> tag
>>>>>>>>>>>>>>>     Tag anchorTag = go_from_top_ul_tag_and_find_a_******
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>>     //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>>     Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>>     //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>>>> know
>>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ------------------------------**
>>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>>>> che.org <http://apache.org><users-**unsubscribe@**
>>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>
>>>>>>>>>>>>>>> >>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   ------------------------------**
>>>>>>>>>>>>>> ****--------------------------**--
>>>>>>>>>>>>>>
>>>>>>>>>>>>> **--**
>>>>>>>>>>>>> ---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>> >
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>  For additional commands, e-mail:
>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>   ------------------------------**
>>>>>>>>>>>> ****--------------------------**--**
>>>>>>>>>>>>
>>>>>>>>>>> --**
>>>>>>>>>>> ---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**
>>>>>>>>>>> che.org<http://apache.org**>
>>>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>> >
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>   ------------------------------******--------------------------*
>>>>>>>>>> *--**
>>>>>>>>>>
>>>>>>>>> --**---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.****apa**che.org<
>>>>>>>>> http://apache.org**>
>>>>>>>>> <users-unsubscribe@**wicket.**apache.org<http://wicket.apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>> >
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>  For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>  ------------------------------****----------------------------**
>>>>>>> --**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>> <us...@wicket.apache.org>
>>>>>>> >
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------****----------------------------**--**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>> <us...@wicket.apache.org>
>>>>>> >
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>  ------------------------------****----------------------------**--**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>> <us...@wicket.apache.org>
>>>>> >
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>> ------------------------------****----------------------------**
>>>> --**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>> <us...@wicket.apache.org>
>>>> >
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>  ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> <us...@wicket.apache.org>
>>> >
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
in fact, my panel is menu which is modified by javascript.
i need to keep track of the previous selected entry (to get know
javascript to disable element) and actual element to modify
(add class) for javascript.

javascript need to now at a moment "page rendered" where is
class which it is looking for.

so i need to modify html markup, modify it on client side by
javascript is not possible.

based on this article:
https://cwiki.apache.org/WICKET/component-rendering.html
it should be possible modify markup generated by component (my
panel).



On 11.2.2013 10:03, Martin Grigorov wrote:
> Hi,
>
> What do you want to do with the markup ?
> Maybe you don't need to bother with internals like MarkupStream for
> something that may be solved much easier.
>
>
> On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <michael.jaruska@gmail.com
>> wrote:
>
>> thanks, studied. but in my case not working. i don't know why, where is my
>> mistake. try this code:
>>
>> markup - base page:
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <html xmlns:wicket>
>>      <head>
>>          <title>my test page</title>
>>          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
>> />
>>      </head>
>>      <body>
>>          <p>my test page</p>
>>          <span wicket:id="myPanel">[my test panel]</span>
>>      </body>
>> </html>
>>
>> markup - my test panel:
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <html xmlns:wicket>
>> <wicket:panel>
>>     <ul>
>>        <li>
>>          <a href="./mypage.html?cid=menu">**my item</a>
>>        </li>
>>     </ul>
>> </wicket:panel>
>>
>> java - base page:
>> public class PageBase extends WebPage{
>>          public PageBase()
>>          {
>>                  //my panel
>>                  this.add(new MyMenu("myPanel").**setRenderBodyOnly(true));
>>          }
>> }
>>
>> java - panel:
>> ublic class MyMenu extends Panel{
>>          public PanelMenu(String id)
>>          {
>>                  super(id);
>>          }
>>
>>          protected void onRender(MarkupStream markupStream){
>>                  while(markupStream.hasMore())
>>                  {
>>                          System.out.println(**markupStream.next());
>>                  }
>>          }
>> }
>>
>>
>> i expect on console printed whole html markup for panel, but nothing is
>> displayed.
>>
>> any ideas please?
>>
>>
>>
>> On 10.2.2013 23:21, Sven Meier wrote:
>>
>>> See BorderBehavior#beforeRender(**Component) on how to iterate over the
>>> markup.
>>>
>>> Sven
>>>
>>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>>
>>>> my quick test:
>>>> @Override
>>>> protected void onRender()
>>>> {
>>>>      super.onRender();
>>>>      System.out.println(this.**getMarkup().toString());
>>>> }
>>>>
>>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>>> whole
>>>> markup for my panel?
>>>>
>>>>
>>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>>
>>>>> Sure, with #getMarkup() you can get hold of the component's markup.
>>>>> With a MarkupStream you can iterate over it.
>>>>>
>>>>> Sven
>>>>>
>>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>>
>>>>>> again with my question: is it possible to get markup in onRender() of
>>>>>> the component?
>>>>>> have found this article:
>>>>>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>>> there more
>>>>>> detailed example how to get markup of the component in onRender()?
>>>>>>
>>>>>> thanks, michael
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>>
>>>>>>> You can use IMarkupFilter to manipulate the raw markup before being
>>>>>>> loaded
>>>>>>> and used by the components.
>>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>>> filter.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>>> michael.jaruska@gmail.com
>>>>>>>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>
>>>>>>>   Look at my original post. User clicks on <a
>>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>>> *submenu/subsubmenu2">****subsubmenu2</a>, then
>>>>>>>> I have in String "category" (java code) value
>>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>>> I need just to make 2 more steps:
>>>>>>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>>
>>>>>>>> When I have point 2 done, then I know how to put somethink into <li>
>>>>>>>> tag...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>>
>>>>>>>>   Ok, so you are indeed looking for a way to change a html attribute
>>>>>>>>> ;-)
>>>>>>>>>
>>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot generate
>>>>>>>>> the
>>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>>> normal
>>>>>>>>> wicket way.
>>>>>>>>>
>>>>>>>>> 1) In the component which actually renders your static html override
>>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>>> replaceComponentTagBody)
>>>>>>>>>
>>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>>> model.
>>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>>
>>>>>>>>> Met vriendelijke groet,
>>>>>>>>> Kind regards,
>>>>>>>>>
>>>>>>>>> Bas Gooren
>>>>>>>>>
>>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>>
>>>>>>>>>   I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>>> now
>>>>>>>>>> from PageParameters which anchor
>>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>>
>>>>>>>>>>   Sorry, I read too quickly.
>>>>>>>>>>>
>>>>>>>>>>> What are you trying to accomplish? Let's say you are able to find
>>>>>>>>>>> the
>>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>>
>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>> Kind regards,
>>>>>>>>>>>
>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>
>>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>>
>>>>>>>>>>>   And question is not "how can I change html attribute" but "how
>>>>>>>>>>>> can I
>>>>>>>>>>>> go through html structure" and
>>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>   Hi!
>>>>>>>>>>>>>
>>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>>> attributes) can
>>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>>
>>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>>
>>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>>
>>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>>        isEnabled() {
>>>>>>>>>>>>>            return true if you want to append a html attribute;
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> });
>>>>>>>>>>>>>
>>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>>
>>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>>        onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>>            super(tag);
>>>>>>>>>>>>>
>>>>>>>>>>>>>            tag.put("my-html-attribute", value);
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>>
>>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>>
>>>>>>>>>>>>>   Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>>     <li>
>>>>>>>>>>>>>>       <a href="./mypage.html?cid=menu">****menu</a>
>>>>>>>>>>>>>>     <ul>
>>>>>>>>>>>>>>       <li>
>>>>>>>>>>>>>>         <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>>       <ul>
>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>         <li>
>>>>>>>>>>>>>>           <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>>         </li>
>>>>>>>>>>>>>>       </ul>
>>>>>>>>>>>>>>     </ul>
>>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>     //cid = category id
>>>>>>>>>>>>>>     String category = parameters.get("cid").****toString();
>>>>>>>>>>>>>>     ...
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag of
>>>>>>>>>>>>>> <a>
>>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>>     //cid = category id
>>>>>>>>>>>>>>     String category = parameters.get("cid").****toString();
>>>>>>>>>>>>>>     //find corresponding <a> tag
>>>>>>>>>>>>>>     Tag anchorTag = go_from_top_ul_tag_and_find_a_****
>>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>>     //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>>     Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>>     //and now I can do my mysterious things with menu...
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>>> know
>>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ------------------------------****----------------------------
>>>>>>>>>>>>>> **--**
>>>>>>>>>>>>>> ---------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**
>>>>>>>>>>>>>> che.org <http://apache.org><users-unsubscribe@**
>>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>>
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>   ------------------------------****----------------------------
>>>>>>>>>>>> **--**
>>>>>>>>>>>> ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   ------------------------------****----------------------------**
>>>>>>>>>> --**
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>>
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   ------------------------------****----------------------------**
>>>>>>>> --**---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------**------------------------------**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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: find html tag

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

What do you want to do with the markup ?
Maybe you don't need to bother with internals like MarkupStream for
something that may be solved much easier.


On Mon, Feb 11, 2013 at 10:01 AM, Michael Jaruska <michael.jaruska@gmail.com
> wrote:

> thanks, studied. but in my case not working. i don't know why, where is my
> mistake. try this code:
>
> markup - base page:
> <?xml version="1.0" encoding="UTF-8" ?>
> <html xmlns:wicket>
>     <head>
>         <title>my test page</title>
>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
> />
>     </head>
>     <body>
>         <p>my test page</p>
>         <span wicket:id="myPanel">[my test panel]</span>
>     </body>
> </html>
>
> markup - my test panel:
> <?xml version="1.0" encoding="UTF-8" ?>
> <html xmlns:wicket>
> <wicket:panel>
>    <ul>
>       <li>
>         <a href="./mypage.html?cid=menu">**my item</a>
>       </li>
>    </ul>
> </wicket:panel>
>
> java - base page:
> public class PageBase extends WebPage{
>         public PageBase()
>         {
>                 //my panel
>                 this.add(new MyMenu("myPanel").**setRenderBodyOnly(true));
>         }
> }
>
> java - panel:
> ublic class MyMenu extends Panel{
>         public PanelMenu(String id)
>         {
>                 super(id);
>         }
>
>         protected void onRender(MarkupStream markupStream){
>                 while(markupStream.hasMore())
>                 {
>                         System.out.println(**markupStream.next());
>                 }
>         }
> }
>
>
> i expect on console printed whole html markup for panel, but nothing is
> displayed.
>
> any ideas please?
>
>
>
> On 10.2.2013 23:21, Sven Meier wrote:
>
>> See BorderBehavior#beforeRender(**Component) on how to iterate over the
>> markup.
>>
>> Sven
>>
>> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>>
>>> my quick test:
>>> @Override
>>> protected void onRender()
>>> {
>>>     super.onRender();
>>>     System.out.println(this.**getMarkup().toString());
>>> }
>>>
>>> get me just top-level tag in my panel, subtags isn't shown. how to get
>>> whole
>>> markup for my panel?
>>>
>>>
>>> On 10.2.2013 22:38, Sven Meier wrote:
>>>
>>>> Sure, with #getMarkup() you can get hold of the component's markup.
>>>> With a MarkupStream you can iterate over it.
>>>>
>>>> Sven
>>>>
>>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>>
>>>>> again with my question: is it possible to get markup in onRender() of
>>>>> the component?
>>>>> have found this article:
>>>>> https://cwiki.apache.org/**WICKET/component-rendering.**html<https://cwiki.apache.org/WICKET/component-rendering.html>
>>>>> but in onRender() section is just code snippet I'm not understand. is
>>>>> there more
>>>>> detailed example how to get markup of the component in onRender()?
>>>>>
>>>>> thanks, michael
>>>>>
>>>>>
>>>>>
>>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>>
>>>>>> You can use IMarkupFilter to manipulate the raw markup before being
>>>>>> loaded
>>>>>> and used by the components.
>>>>>> See the implementations in Wicket to see what can be done with such
>>>>>> filter.
>>>>>>
>>>>>>
>>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <
>>>>>> michael.jaruska@gmail.com
>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>
>>>>>>  Look at my original post. User clicks on <a
>>>>>>> href="./mypage.html?cid=menu/*
>>>>>>> *submenu/subsubmenu2">****subsubmenu2</a>, then
>>>>>>> I have in String "category" (java code) value
>>>>>>> "menu/submenu/subsubmenu2".
>>>>>>> I need just to make 2 more steps:
>>>>>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>>
>>>>>>> When I have point 2 done, then I know how to put somethink into <li>
>>>>>>> tag...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>>
>>>>>>>  Ok, so you are indeed looking for a way to change a html attribute
>>>>>>>> ;-)
>>>>>>>>
>>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot generate
>>>>>>>> the
>>>>>>>> html, there are some ways, but they mostly work outside of the
>>>>>>>> normal
>>>>>>>> wicket way.
>>>>>>>>
>>>>>>>> 1) In the component which actually renders your static html override
>>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>>> replaceComponentTagBody)
>>>>>>>>
>>>>>>>> 2) store the static html somewhere by itself, and create a custom
>>>>>>>> model.
>>>>>>>> The model can then load the html and perform string replacement.
>>>>>>>> You can then add a label component which uses the model and has
>>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>>
>>>>>>>> Met vriendelijke groet,
>>>>>>>> Kind regards,
>>>>>>>>
>>>>>>>> Bas Gooren
>>>>>>>>
>>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>>
>>>>>>>>  I need to find the parent <li> tag of the anchor user clicks - I
>>>>>>>>> now
>>>>>>>>> from PageParameters which anchor
>>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>>> atribute (id="something"). This attribute
>>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>>
>>>>>>>>>  Sorry, I read too quickly.
>>>>>>>>>>
>>>>>>>>>> What are you trying to accomplish? Let's say you are able to find
>>>>>>>>>> the
>>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>>
>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>> Kind regards,
>>>>>>>>>>
>>>>>>>>>> Bas Gooren
>>>>>>>>>>
>>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>>
>>>>>>>>>>  And question is not "how can I change html attribute" but "how
>>>>>>>>>>> can I
>>>>>>>>>>> go through html structure" and
>>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>>
>>>>>>>>>>>  Hi!
>>>>>>>>>>>>
>>>>>>>>>>>> What you want to accomplish (e.g. changing some html
>>>>>>>>>>>> attributes) can
>>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>>
>>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>>
>>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>>> for_every_li:
>>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>>
>>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>>       isEnabled() {
>>>>>>>>>>>>           return true if you want to append a html attribute;
>>>>>>>>>>>>       }
>>>>>>>>>>>> });
>>>>>>>>>>>>
>>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>>
>>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>>>>>>           super(tag);
>>>>>>>>>>>>
>>>>>>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>>>>>>       }
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>>> Kind regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>>
>>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>>
>>>>>>>>>>>>  Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>>    <li>
>>>>>>>>>>>>>      <a href="./mypage.html?cid=menu">****menu</a>
>>>>>>>>>>>>>    <ul>
>>>>>>>>>>>>>      <li>
>>>>>>>>>>>>>        <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>> *submenu">submenu</a>
>>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>> *submenu/subsubmenu1">**
>>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>>        </li>
>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>> *submenu/subsubmenu2">**
>>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>>        </li>
>>>>>>>>>>>>>        <li>
>>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/***
>>>>>>>>>>>>> *submenu/subsubmenu3">**
>>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>>        </li>
>>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>>    </ul>
>>>>>>>>>>>>> </ul>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>>>    String category = parameters.get("cid").****toString();
>>>>>>>>>>>>>    ...
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag of
>>>>>>>>>>>>> <a>
>>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>>>    String category = parameters.get("cid").****toString();
>>>>>>>>>>>>>    //find corresponding <a> tag
>>>>>>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_****
>>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>>    //have corresponding anchor tag, get parrent tag of the
>>>>>>>>>>>>> anchor tag
>>>>>>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>>>>>>> }
>>>>>>>>>>>>>
>>>>>>>>>>>>> But I don't know where to start my search and I totaly don't
>>>>>>>>>>>>> know
>>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------****----------------------------
>>>>>>>>>>>>> **--**
>>>>>>>>>>>>> ---------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**
>>>>>>>>>>>>> che.org <http://apache.org><users-unsubscribe@**
>>>>>>>>>>>>> wicket.apache.org <us...@wicket.apache.org>>
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>  ------------------------------****----------------------------
>>>>>>>>>>> **--**
>>>>>>>>>>> ---------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>>>> >
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  ------------------------------****----------------------------**
>>>>>>>>> --**
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>>>> <us...@wicket.apache.org>
>>>>>>>>> >
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>  ------------------------------****----------------------------**
>>>>>>> --**---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>>>>> <us...@wicket.apache.org>
>>>>>>> >
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
thanks, studied. but in my case not working. i don't know why, where is my mistake. try this code:

markup - base page:
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket>
     <head>
         <title>my test page</title>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     </head>
     <body>
         <p>my test page</p>
         <span wicket:id="myPanel">[my test panel]</span>
     </body>
</html>

markup - my test panel:
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket>
<wicket:panel>
    <ul>
       <li>
         <a href="./mypage.html?cid=menu">my item</a>
       </li>
    </ul>
</wicket:panel>

java - base page:
public class PageBase extends WebPage{
	public PageBase()
	{
		//my panel
		this.add(new MyMenu("myPanel").setRenderBodyOnly(true));
	}
}

java - panel:
ublic class MyMenu extends Panel{
	public PanelMenu(String id)
	{
		super(id);
	}

	protected void onRender(MarkupStream markupStream){
		while(markupStream.hasMore())
		{
			System.out.println(markupStream.next());
		}
	}
}


i expect on console printed whole html markup for panel, but nothing is displayed.

any ideas please?


On 10.2.2013 23:21, Sven Meier wrote:
> See BorderBehavior#beforeRender(Component) on how to iterate over the markup.
>
> Sven
>
> On 02/10/2013 11:09 PM, Michael Jaruska wrote:
>> my quick test:
>> @Override
>> protected void onRender()
>> {
>>     super.onRender();
>>     System.out.println(this.getMarkup().toString());
>> }
>>
>> get me just top-level tag in my panel, subtags isn't shown. how to get whole
>> markup for my panel?
>>
>>
>> On 10.2.2013 22:38, Sven Meier wrote:
>>> Sure, with #getMarkup() you can get hold of the component's markup. With a MarkupStream you can iterate over it.
>>>
>>> Sven
>>>
>>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>>> again with my question: is it possible to get markup in onRender() of the component?
>>>> have found this article:
>>>> https://cwiki.apache.org/WICKET/component-rendering.html
>>>> but in onRender() section is just code snippet I'm not understand. is there more
>>>> detailed example how to get markup of the component in onRender()?
>>>>
>>>> thanks, michael
>>>>
>>>>
>>>>
>>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>>> You can use IMarkupFilter to manipulate the raw markup before being loaded
>>>>> and used by the components.
>>>>> See the implementations in Wicket to see what can be done with such filter.
>>>>>
>>>>>
>>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <michael.jaruska@gmail.com
>>>>>> wrote:
>>>>>
>>>>>> Look at my original post. User clicks on <a href="./mypage.html?cid=menu/*
>>>>>> *submenu/subsubmenu2">**subsubmenu2</a>, then
>>>>>> I have in String "category" (java code) value "menu/submenu/subsubmenu2".
>>>>>> I need just to make 2 more steps:
>>>>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>>
>>>>>> When I have point 2 done, then I know how to put somethink into <li> tag...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>>
>>>>>>> Ok, so you are indeed looking for a way to change a html attribute ;-)
>>>>>>>
>>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot generate the
>>>>>>> html, there are some ways, but they mostly work outside of the normal
>>>>>>> wicket way.
>>>>>>>
>>>>>>> 1) In the component which actually renders your static html override
>>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>>> replaceComponentTagBody)
>>>>>>>
>>>>>>> 2) store the static html somewhere by itself, and create a custom model.
>>>>>>> The model can then load the html and perform string replacement.
>>>>>>> You can then add a label component which uses the model and has
>>>>>>> setEscapeModelStrings(false) set.
>>>>>>>
>>>>>>> Met vriendelijke groet,
>>>>>>> Kind regards,
>>>>>>>
>>>>>>> Bas Gooren
>>>>>>>
>>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>>
>>>>>>>> I need to find the parent <li> tag of the anchor user clicks - I now
>>>>>>>> from PageParameters which anchor
>>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>>> atribute (id="something"). This attribute
>>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>>
>>>>>>>>
>>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>>
>>>>>>>>> Sorry, I read too quickly.
>>>>>>>>>
>>>>>>>>> What are you trying to accomplish? Let's say you are able to find the
>>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>>
>>>>>>>>> Met vriendelijke groet,
>>>>>>>>> Kind regards,
>>>>>>>>>
>>>>>>>>> Bas Gooren
>>>>>>>>>
>>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>>
>>>>>>>>>> And question is not "how can I change html attribute" but "how can I
>>>>>>>>>> go through html structure" and
>>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi!
>>>>>>>>>>>
>>>>>>>>>>> What you want to accomplish (e.g. changing some html attributes) can
>>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>>
>>>>>>>>>>> In pseudocode:
>>>>>>>>>>>
>>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>>> for_every_li:
>>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>>> uls.add(li);
>>>>>>>>>>>
>>>>>>>>>>> now, you can do something like this:
>>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>>       isEnabled() {
>>>>>>>>>>>           return true if you want to append a html attribute;
>>>>>>>>>>>       }
>>>>>>>>>>> });
>>>>>>>>>>>
>>>>>>>>>>> Or alternatively:
>>>>>>>>>>>
>>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>>>>>           super(tag);
>>>>>>>>>>>
>>>>>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>>>>>       }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>>> Kind regards,
>>>>>>>>>>>
>>>>>>>>>>> Bas Gooren
>>>>>>>>>>>
>>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>>
>>>>>>>>>>>> I have this html structure:
>>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>>    <li>
>>>>>>>>>>>>      <a href="./mypage.html?cid=menu">**menu</a>
>>>>>>>>>>>>    <ul>
>>>>>>>>>>>>      <li>
>>>>>>>>>>>>        <a href="./mypage.html?cid=menu/**submenu">submenu</a>
>>>>>>>>>>>>      <ul>
>>>>>>>>>>>>        <li>
>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu1">**
>>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>>        </li>
>>>>>>>>>>>>        <li>
>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu2">**
>>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>>        </li>
>>>>>>>>>>>>        <li>
>>>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu3">**
>>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>>        </li>
>>>>>>>>>>>>      </ul>
>>>>>>>>>>>>    </ul>
>>>>>>>>>>>> </ul>
>>>>>>>>>>>>
>>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>>>    ...
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag of <a>
>>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>>>    //find corresponding <a> tag
>>>>>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>>    //have corresponding anchor tag, get parrent tag of the anchor tag
>>>>>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>>>>>> }
>>>>>>>>>>>>
>>>>>>>>>>>> But I don't know where to start my search and I totaly don't know
>>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>>
>>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>>
>>>>>>>>>>>> ------------------------------**------------------------------**
>>>>>>>>>>>> ---------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> ------------------------------**------------------------------**
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ------------------------------**------------------------------**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------**------------------------------**---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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
>>>
>>
>> ---------------------------------------------------------------------
>> 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: find html tag

Posted by Sven Meier <sv...@meiers.net>.
See BorderBehavior#beforeRender(Component) on how to iterate over the 
markup.

Sven

On 02/10/2013 11:09 PM, Michael Jaruska wrote:
> my quick test:
> @Override
> protected void onRender()
> {
>     super.onRender();
>     System.out.println(this.getMarkup().toString());
> }
>
> get me just top-level tag in my panel, subtags isn't shown. how to get 
> whole
> markup for my panel?
>
>
> On 10.2.2013 22:38, Sven Meier wrote:
>> Sure, with #getMarkup() you can get hold of the component's markup. 
>> With a MarkupStream you can iterate over it.
>>
>> Sven
>>
>> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>>> again with my question: is it possible to get markup in onRender() 
>>> of the component?
>>> have found this article:
>>> https://cwiki.apache.org/WICKET/component-rendering.html
>>> but in onRender() section is just code snippet I'm not understand. 
>>> is there more
>>> detailed example how to get markup of the component in onRender()?
>>>
>>> thanks, michael
>>>
>>>
>>>
>>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>>> You can use IMarkupFilter to manipulate the raw markup before being 
>>>> loaded
>>>> and used by the components.
>>>> See the implementations in Wicket to see what can be done with such 
>>>> filter.
>>>>
>>>>
>>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska 
>>>> <michael.jaruska@gmail.com
>>>>> wrote:
>>>>
>>>>> Look at my original post. User clicks on <a 
>>>>> href="./mypage.html?cid=menu/*
>>>>> *submenu/subsubmenu2">**subsubmenu2</a>, then
>>>>> I have in String "category" (java code) value 
>>>>> "menu/submenu/subsubmenu2".
>>>>> I need just to make 2 more steps:
>>>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>>
>>>>> When I have point 2 done, then I know how to put somethink into 
>>>>> <li> tag...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>>
>>>>>> Ok, so you are indeed looking for a way to change a html 
>>>>>> attribute ;-)
>>>>>>
>>>>>> Since you wrote (in your folluw-up e-mail) that you cannot 
>>>>>> generate the
>>>>>> html, there are some ways, but they mostly work outside of the 
>>>>>> normal
>>>>>> wicket way.
>>>>>>
>>>>>> 1) In the component which actually renders your static html override
>>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>>> replaceComponentTagBody)
>>>>>>
>>>>>> 2) store the static html somewhere by itself, and create a custom 
>>>>>> model.
>>>>>> The model can then load the html and perform string replacement.
>>>>>> You can then add a label component which uses the model and has
>>>>>> setEscapeModelStrings(false) set.
>>>>>>
>>>>>> Met vriendelijke groet,
>>>>>> Kind regards,
>>>>>>
>>>>>> Bas Gooren
>>>>>>
>>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>>
>>>>>>> I need to find the parent <li> tag of the anchor user clicks - I 
>>>>>>> now
>>>>>>> from PageParameters which anchor
>>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>>> atribute (id="something"). This attribute
>>>>>>> will be then processed by JavaScript on the page.
>>>>>>>
>>>>>>>
>>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>>
>>>>>>>> Sorry, I read too quickly.
>>>>>>>>
>>>>>>>> What are you trying to accomplish? Let's say you are able to 
>>>>>>>> find the
>>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>>
>>>>>>>> Met vriendelijke groet,
>>>>>>>> Kind regards,
>>>>>>>>
>>>>>>>> Bas Gooren
>>>>>>>>
>>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>>
>>>>>>>>> And question is not "how can I change html attribute" but "how 
>>>>>>>>> can I
>>>>>>>>> go through html structure" and
>>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>>
>>>>>>>>>> Hi!
>>>>>>>>>>
>>>>>>>>>> What you want to accomplish (e.g. changing some html 
>>>>>>>>>> attributes) can
>>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>>
>>>>>>>>>> In pseudocode:
>>>>>>>>>>
>>>>>>>>>> RepeatingView uls = ...
>>>>>>>>>> for_every_li:
>>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>>> uls.add(li);
>>>>>>>>>>
>>>>>>>>>> now, you can do something like this:
>>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>>       isEnabled() {
>>>>>>>>>>           return true if you want to append a html attribute;
>>>>>>>>>>       }
>>>>>>>>>> });
>>>>>>>>>>
>>>>>>>>>> Or alternatively:
>>>>>>>>>>
>>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>>>>           super(tag);
>>>>>>>>>>
>>>>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>>>>       }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> Met vriendelijke groet,
>>>>>>>>>> Kind regards,
>>>>>>>>>>
>>>>>>>>>> Bas Gooren
>>>>>>>>>>
>>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>>
>>>>>>>>>>> I have this html structure:
>>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>>    <li>
>>>>>>>>>>>      <a href="./mypage.html?cid=menu">**menu</a>
>>>>>>>>>>>    <ul>
>>>>>>>>>>>      <li>
>>>>>>>>>>>        <a href="./mypage.html?cid=menu/**submenu">submenu</a>
>>>>>>>>>>>      <ul>
>>>>>>>>>>>        <li>
>>>>>>>>>>>          <a 
>>>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu1">**
>>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>>        </li>
>>>>>>>>>>>        <li>
>>>>>>>>>>>          <a 
>>>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu2">**
>>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>>        </li>
>>>>>>>>>>>        <li>
>>>>>>>>>>>          <a 
>>>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu3">**
>>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>>        </li>
>>>>>>>>>>>      </ul>
>>>>>>>>>>>    </ul>
>>>>>>>>>>> </ul>
>>>>>>>>>>>
>>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>>    ...
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag 
>>>>>>>>>>> of <a>
>>>>>>>>>>> tag on which I do click.
>>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>>    //cid = category id
>>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>>    //find corresponding <a> tag
>>>>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>>    //have corresponding anchor tag, get parrent tag of the 
>>>>>>>>>>> anchor tag
>>>>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> But I don't know where to start my search and I totaly don't 
>>>>>>>>>>> know
>>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>>
>>>>>>>>>>> Please, help :-)
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------**------------------------------** 
>>>>>>>>>>>
>>>>>>>>>>> ---------
>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> ------------------------------**------------------------------**
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> ------------------------------**------------------------------**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: 
>>>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>> ------------------------------**------------------------------**--------- 
>>>>>
>>>>> To unsubscribe, e-mail: 
>>>>> users-unsubscribe@wicket.**apache.org<us...@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
>>
>
> ---------------------------------------------------------------------
> 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: find html tag

Posted by Michael Jaruska <mi...@gmail.com>.
my quick test:
@Override
protected void onRender()
{
     super.onRender();
     System.out.println(this.getMarkup().toString());
}

get me just top-level tag in my panel, subtags isn't shown. how to get whole
markup for my panel?


On 10.2.2013 22:38, Sven Meier wrote:
> Sure, with #getMarkup() you can get hold of the component's markup. With a MarkupStream you can iterate over it.
>
> Sven
>
> On 02/10/2013 10:23 PM, Michael Jaruska wrote:
>> again with my question: is it possible to get markup in onRender() of the component?
>> have found this article:
>> https://cwiki.apache.org/WICKET/component-rendering.html
>> but in onRender() section is just code snippet I'm not understand. is there more
>> detailed example how to get markup of the component in onRender()?
>>
>> thanks, michael
>>
>>
>>
>> On 23.1.2013 22:47, Martin Grigorov wrote:
>>> You can use IMarkupFilter to manipulate the raw markup before being loaded
>>> and used by the components.
>>> See the implementations in Wicket to see what can be done with such filter.
>>>
>>>
>>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska <michael.jaruska@gmail.com
>>>> wrote:
>>>
>>>> Look at my original post. User clicks on <a href="./mypage.html?cid=menu/*
>>>> *submenu/subsubmenu2">**subsubmenu2</a>, then
>>>> I have in String "category" (java code) value "menu/submenu/subsubmenu2".
>>>> I need just to make 2 more steps:
>>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>>
>>>> When I have point 2 done, then I know how to put somethink into <li> tag...
>>>>
>>>>
>>>>
>>>>
>>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>>
>>>>> Ok, so you are indeed looking for a way to change a html attribute ;-)
>>>>>
>>>>> Since you wrote (in your folluw-up e-mail) that you cannot generate the
>>>>> html, there are some ways, but they mostly work outside of the normal
>>>>> wicket way.
>>>>>
>>>>> 1) In the component which actually renders your static html override
>>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>>> replaceComponentTagBody)
>>>>>
>>>>> 2) store the static html somewhere by itself, and create a custom model.
>>>>> The model can then load the html and perform string replacement.
>>>>> You can then add a label component which uses the model and has
>>>>> setEscapeModelStrings(false) set.
>>>>>
>>>>> Met vriendelijke groet,
>>>>> Kind regards,
>>>>>
>>>>> Bas Gooren
>>>>>
>>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>>
>>>>>> I need to find the parent <li> tag of the anchor user clicks - I now
>>>>>> from PageParameters which anchor
>>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>>> atribute (id="something"). This attribute
>>>>>> will be then processed by JavaScript on the page.
>>>>>>
>>>>>>
>>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>>
>>>>>>> Sorry, I read too quickly.
>>>>>>>
>>>>>>> What are you trying to accomplish? Let's say you are able to find the
>>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>>
>>>>>>> Met vriendelijke groet,
>>>>>>> Kind regards,
>>>>>>>
>>>>>>> Bas Gooren
>>>>>>>
>>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>>
>>>>>>>> And question is not "how can I change html attribute" but "how can I
>>>>>>>> go through html structure" and
>>>>>>>> find html tag with specific attribute :-)
>>>>>>>>
>>>>>>>>
>>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>>
>>>>>>>>> Hi!
>>>>>>>>>
>>>>>>>>> What you want to accomplish (e.g. changing some html attributes) can
>>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>>
>>>>>>>>> In pseudocode:
>>>>>>>>>
>>>>>>>>> RepeatingView uls = ...
>>>>>>>>> for_every_li:
>>>>>>>>> WebMarkupContainer li = ...
>>>>>>>>> uls.add(li);
>>>>>>>>>
>>>>>>>>> now, you can do something like this:
>>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>>       isEnabled() {
>>>>>>>>>           return true if you want to append a html attribute;
>>>>>>>>>       }
>>>>>>>>> });
>>>>>>>>>
>>>>>>>>> Or alternatively:
>>>>>>>>>
>>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>>>           super(tag);
>>>>>>>>>
>>>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>>>       }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> Met vriendelijke groet,
>>>>>>>>> Kind regards,
>>>>>>>>>
>>>>>>>>> Bas Gooren
>>>>>>>>>
>>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>>
>>>>>>>>>> I have this html structure:
>>>>>>>>>> <ul class="mymenu">
>>>>>>>>>>    <li>
>>>>>>>>>>      <a href="./mypage.html?cid=menu">**menu</a>
>>>>>>>>>>    <ul>
>>>>>>>>>>      <li>
>>>>>>>>>>        <a href="./mypage.html?cid=menu/**submenu">submenu</a>
>>>>>>>>>>      <ul>
>>>>>>>>>>        <li>
>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu1">**
>>>>>>>>>> subsubmenu1</a>
>>>>>>>>>>        </li>
>>>>>>>>>>        <li>
>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu2">**
>>>>>>>>>> subsubmenu2</a>
>>>>>>>>>>        </li>
>>>>>>>>>>        <li>
>>>>>>>>>>          <a href="./mypage.html?cid=menu/**submenu/subsubmenu3">**
>>>>>>>>>> subsubmenu3</a>
>>>>>>>>>>        </li>
>>>>>>>>>>      </ul>
>>>>>>>>>>    </ul>
>>>>>>>>>> </ul>
>>>>>>>>>>
>>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>    //cid = category id
>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>    ...
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> Now I need some way I can add atribute into parent <li> tag of <a>
>>>>>>>>>> tag on which I do click.
>>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>>    //cid = category id
>>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>>    //find corresponding <a> tag
>>>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>>> tag_by_category(category)
>>>>>>>>>>    //have corresponding anchor tag, get parrent tag of the anchor tag
>>>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> But I don't know where to start my search and I totaly don't know
>>>>>>>>>> whot to look for in docu.
>>>>>>>>>>
>>>>>>>>>> Please, help :-)
>>>>>>>>>>
>>>>>>>>>> ------------------------------**------------------------------**
>>>>>>>>>> ---------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ------------------------------**------------------------------**
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ------------------------------**------------------------------**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>> ------------------------------**------------------------------**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@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
>

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


Re: find html tag

Posted by Sven Meier <sv...@meiers.net>.
Sure, with #getMarkup() you can get hold of the component's markup. With 
a MarkupStream you can iterate over it.

Sven

On 02/10/2013 10:23 PM, Michael Jaruska wrote:
> again with my question: is it possible to get markup in onRender() of 
> the component?
> have found this article:
> https://cwiki.apache.org/WICKET/component-rendering.html
> but in onRender() section is just code snippet I'm not understand. is 
> there more
> detailed example how to get markup of the component in onRender()?
>
> thanks, michael
>
>
>
> On 23.1.2013 22:47, Martin Grigorov wrote:
>> You can use IMarkupFilter to manipulate the raw markup before being 
>> loaded
>> and used by the components.
>> See the implementations in Wicket to see what can be done with such 
>> filter.
>>
>>
>> On Wed, Jan 23, 2013 at 11:11 PM, Michael Jaruska 
>> <michael.jaruska@gmail.com
>>> wrote:
>>
>>> Look at my original post. User clicks on <a 
>>> href="./mypage.html?cid=menu/*
>>> *submenu/subsubmenu2">**subsubmenu2</a>, then
>>> I have in String "category" (java code) value 
>>> "menu/submenu/subsubmenu2".
>>> I need just to make 2 more steps:
>>> 1. in html code find anchor tag with href "menu/submenu/subsubmenu2";
>>> 2. find <li> tag which is parent of the anchor from point 1;
>>>
>>> When I have point 2 done, then I know how to put somethink into <li> 
>>> tag...
>>>
>>>
>>>
>>>
>>> On 23.1.2013 21:21, Bas Gooren wrote:
>>>
>>>> Ok, so you are indeed looking for a way to change a html attribute ;-)
>>>>
>>>> Since you wrote (in your folluw-up e-mail) that you cannot generate 
>>>> the
>>>> html, there are some ways, but they mostly work outside of the normal
>>>> wicket way.
>>>>
>>>> 1) In the component which actually renders your static html override
>>>> onComponentTagBody and fiddle with the markup stream (e.g. look at
>>>> replaceComponentTagBody)
>>>>
>>>> 2) store the static html somewhere by itself, and create a custom 
>>>> model.
>>>> The model can then load the html and perform string replacement.
>>>> You can then add a label component which uses the model and has
>>>> setEscapeModelStrings(false) set.
>>>>
>>>> Met vriendelijke groet,
>>>> Kind regards,
>>>>
>>>> Bas Gooren
>>>>
>>>> Op 23-1-2013 21:11, schreef Michael Jaruska:
>>>>
>>>>> I need to find the parent <li> tag of the anchor user clicks - I now
>>>>> from PageParameters which anchor
>>>>> has been clicked. Then I will put into this parent <li> specific
>>>>> atribute (id="something"). This attribute
>>>>> will be then processed by JavaScript on the page.
>>>>>
>>>>>
>>>>> On 23.1.2013 21:04, Bas Gooren wrote:
>>>>>
>>>>>> Sorry, I read too quickly.
>>>>>>
>>>>>> What are you trying to accomplish? Let's say you are able to find 
>>>>>> the
>>>>>> appropriate html tag, what do you want to do with it?
>>>>>>
>>>>>> Met vriendelijke groet,
>>>>>> Kind regards,
>>>>>>
>>>>>> Bas Gooren
>>>>>>
>>>>>> Op 23-1-2013 21:01, schreef Michael Jaruska:
>>>>>>
>>>>>>> And question is not "how can I change html attribute" but "how 
>>>>>>> can I
>>>>>>> go through html structure" and
>>>>>>> find html tag with specific attribute :-)
>>>>>>>
>>>>>>>
>>>>>>> On 23.1.2013 20:50, Bas Gooren wrote:
>>>>>>>
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> What you want to accomplish (e.g. changing some html 
>>>>>>>> attributes) can
>>>>>>>> be done by adding an attributemodifier to each <li> component.
>>>>>>>>
>>>>>>>> In pseudocode:
>>>>>>>>
>>>>>>>> RepeatingView uls = ...
>>>>>>>> for_every_li:
>>>>>>>> WebMarkupContainer li = ...
>>>>>>>> uls.add(li);
>>>>>>>>
>>>>>>>> now, you can do something like this:
>>>>>>>> li.add(new AttributeAppender(...) {
>>>>>>>>       isEnabled() {
>>>>>>>>           return true if you want to append a html attribute;
>>>>>>>>       }
>>>>>>>> });
>>>>>>>>
>>>>>>>> Or alternatively:
>>>>>>>>
>>>>>>>> WebMarkupContainer li = new WMC() {
>>>>>>>>       onComponentTag(ComponentTag tag) {
>>>>>>>>           super(tag);
>>>>>>>>
>>>>>>>>           tag.put("my-html-attribute", value);
>>>>>>>>       }
>>>>>>>> }
>>>>>>>>
>>>>>>>> Met vriendelijke groet,
>>>>>>>> Kind regards,
>>>>>>>>
>>>>>>>> Bas Gooren
>>>>>>>>
>>>>>>>> Op 23-1-2013 20:45, schreef Michael Jaruska:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> is there a way I can find specific html tag in markup?
>>>>>>>>>
>>>>>>>>> I have this html structure:
>>>>>>>>> <ul class="mymenu">
>>>>>>>>>    <li>
>>>>>>>>>      <a href="./mypage.html?cid=menu">**menu</a>
>>>>>>>>>    <ul>
>>>>>>>>>      <li>
>>>>>>>>>        <a href="./mypage.html?cid=menu/**submenu">submenu</a>
>>>>>>>>>      <ul>
>>>>>>>>>        <li>
>>>>>>>>>          <a 
>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu1">**
>>>>>>>>> subsubmenu1</a>
>>>>>>>>>        </li>
>>>>>>>>>        <li>
>>>>>>>>>          <a 
>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu2">**
>>>>>>>>> subsubmenu2</a>
>>>>>>>>>        </li>
>>>>>>>>>        <li>
>>>>>>>>>          <a 
>>>>>>>>> href="./mypage.html?cid=menu/**submenu/subsubmenu3">**
>>>>>>>>> subsubmenu3</a>
>>>>>>>>>        </li>
>>>>>>>>>      </ul>
>>>>>>>>>    </ul>
>>>>>>>>> </ul>
>>>>>>>>>
>>>>>>>>> I'm processing clicks on anchors with my page:
>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>    //cid = category id
>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>    ...
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> Now I need some way I can add atribute into parent <li> tag of 
>>>>>>>>> <a>
>>>>>>>>> tag on which I do click.
>>>>>>>>> Somethink like (pseudocode):
>>>>>>>>> public PageTest(PageParameters parameters){
>>>>>>>>>    //cid = category id
>>>>>>>>>    String category = parameters.get("cid").**toString();
>>>>>>>>>    //find corresponding <a> tag
>>>>>>>>>    Tag anchorTag = go_from_top_ul_tag_and_find_a_**
>>>>>>>>> tag_by_category(category)
>>>>>>>>>    //have corresponding anchor tag, get parrent tag of the 
>>>>>>>>> anchor tag
>>>>>>>>>    Tag anchorParentTag = anchorTag.getParent();
>>>>>>>>>    //and now I can do my mysterious things with menu...
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> But I don't know where to start my search and I totaly don't know
>>>>>>>>> whot to look for in docu.
>>>>>>>>>
>>>>>>>>> Please, help :-)
>>>>>>>>>
>>>>>>>>> ------------------------------**------------------------------**
>>>>>>>>> ---------
>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> ------------------------------**------------------------------**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: 
>>>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: 
>>>>> users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>> ------------------------------**------------------------------**--------- 
>>>
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apache.org<us...@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