You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Singer <wi...@regnis.de> on 2008/10/15 15:56:39 UTC

Highlight some words in the markup content

We are using Wicket as base for our website (www.syntevo.com). We have a 
simple search feature on the website, but want to extend it like it is known 
to work in forums: the searched words should be highlighted.

Does someone already has implemented such a feature to surround plain words 
in the markup by a special tag?

--
Cheers,
Tom

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


Re: Highlight some words in the markup content

Posted by Jeremy Thomerson <je...@wickettraining.com>.
If you are displaying search results dynamically, and it's not part of your
static markup, you can also do something like this:

        class HighlightingModel extends LoadableDetachableModel<String> {

            private transient IModel<String> text;
            private transient IModel<String> searchWord;

            HighlightingModel(IModel<String> text, IModel<String>
searchWord) {
                this.text = text;
                this.searchWord = searchWord;
            }

            @Override
            protected String load() {
                return text.getObject().replaceAll(searchWord.getObject(),
"<span class=\"search\">" + searchWord.getObject() + "</span>");
            }

            @Override
            protected void onDetach() {
                super.onDetach();
                text = null;
                searchWord = null;
            }

        }

        IModel<String> resultDescription = new HighlightingModel(new
PropertyModel(someObject, "someProperty"), new PropertyModel(searchQuery,
"searchTerm"));

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



On Wed, Oct 15, 2008 at 12:07 PM, Thomas Singer <wi...@regnis.de> wrote:

> Thanks. But how the filter should know about the request which contains the
> information about what to highlight?
>
> --
> Cheers,
> Tom
>
>
>
> Igor Vaynberg wrote:
>
>> iresponsefilter
>>
>> -igor
>>
>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de> wrote:
>>
>>  OK, this looks trivial, but were should I place this code to replace all
>>> content, no matter whether it comes from a page template, border or
>>> fragment?
>>>
>>> --
>>> Cheers,
>>> Tom
>>>
>>>
>>>
>>> Martijn Dashorst wrote:
>>>
>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>>> "</span>");
>>>>
>>>> label.setEscapeModelStrings(false);
>>>>
>>>> Martijn
>>>>
>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
>>>> wrote:
>>>>
>>>>  We are using Wicket as base for our website (www.syntevo.com). We have
>>>>> a
>>>>> simple search feature on the website, but want to extend it like it is
>>>>> known
>>>>> to work in forums: the searched words should be highlighted.
>>>>>
>>>>> Does someone already has implemented such a feature to surround plain
>>>>> words
>>>>> in the markup by a special tag?
>>>>>
>>>>> --
>>>>> Cheers,
>>>>> Tom
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>  ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Highlight some words in the markup content

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Perhaps you could use a jQuery plugin to do this?  Something like [1] -
although this is just the first Google result that came up for me.  I have
not tested this.

[1] -
http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html

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



On Mon, Oct 19, 2009 at 3:12 PM, Jim Pinkham <pi...@gmail.com> wrote:

> I'd be interested to know if anyone else is using this technique for search
> highlighting with a DataTable.
>
> http://pastebin.com/m5446797d
>
> The data in my grid may contain HTML, so that makes it considerably more
> complicated (my first attempt didn't address this problem).  I'd love to
> know if someone else has a better/simpler way, although this does appear to
> work fine, it took a day to come up with.
>
> In general, I kind of like the idea of separating this concern from the
> model, whose purpose is just to get the data, and think of this search
> highlighting as more of a decorator that applies to the entire grid rather
> than any particular column, since I've got several PropertyColumn
> subclasses
> (LinkPropertyColumn, ImagePropertyColumn, NonEscapedHTMLPropertyColumn,
> ...etc).
>
> Hope this helps someone else.
>
> Thanks,
> -- Jim.
>
> On Fri, Oct 24, 2008 at 1:06 PM, Jim Pinkham <pi...@gmail.com> wrote:
>
> > I've got a few embellishments to that idea that others might enjoy.
>  These
> > include the ability to use on non-string properties, and caching the last
> > compiled pattern (maybe uses a bit less CPU than replaceAll each time).
> >
> >     protected static class HighlightingModel extends
> > LoadableDetachableModel {
> >         private static final long serialVersionUID = 1L;
> >
> >         private transient IModel text;
> >         private transient IModel searchWord;
> >         private transient Pattern lastp;
> >         private transient String lastSearch;
> >
> >         HighlightingModel(IModel text, IModel searchWord) {
> >             this.text = text;
> >             this.searchWord = searchWord;
> >         }
> >
> >         @Override
> >         protected String load() {
> >             String srch = (String)searchWord.getObject();
> >             Object object = text.getObject();
> >             String txt = "";
> >             if (object != null) {
> >                 IConverter converter =
> > Application.get().getConverterLocator().getConverter(object.getClass());
> >                 txt = converter.convertToString(object,
> > Session.get().getLocale());
> >             }
> >             if (srch != null) {
> >                 Pattern p = null;
> >                 if (lastp != null && srch.equals(lastSearch) )
> >                     p = lastp;
> >                 else {
> >                     try {
> >                         p = Pattern.compile(srch,
> > Pattern.CASE_INSENSITIVE);
> >                     } catch (PatternSyntaxException e) {
> >                         if (e.getIndex()>-1) {
> >                             srch = srch.substring(0, e.getIndex());
> >                             try {
> >                                 p = Pattern.compile(srch,
> > Pattern.CASE_INSENSITIVE);
> >                             } catch (Exception e2) {
> >                                 srch = null;
> >                             }
> >                         } else
> >                             srch = null;
> >                     }
> >                 }
> >                 if (p != null) {
> >                     Matcher m = p.matcher(txt);
> >                     return m.replaceFirst("<span
> > class=\"search\">$0</span>");
> >                 }
> >             }
> >             return txt;
> >         }
> >
> >         @Override
> >         protected void onDetach() {
> >             super.onDetach();
> >             text = null;
> >             searchWord = null;
> >         }
> >     }
> >
> > -- Jim Pinkham
> >
> >
> > On Thu, Oct 16, 2008 at 3:24 PM, Thomas Singer <wi...@regnis.de> wrote:
> >
> >> Thanks all. The first tests work fine now, still need to handle the
> >> ignore-case searching...
> >>
> >> Is there anybody else interested in this feature? Then I will try to
> >> prepare the IResponseFilter implementation for public
> viewing/integration in
> >> Wicket.
> >>
> >>  as far as i know the response filter runs within the request cycle and
> >>> request cycle has metadata facility, so....
> >>>
> >>
> >> We already make use of RequestCycle.get(), but if you don't work on
> Wicket
> >> the full day like you, then one forgets such secrets.
> >>
> >>
> >> --
> >> Cheers,
> >> Tom
> >>
> >>
> >> Igor Vaynberg wrote:
> >>
> >>> as far as i know the response filter runs within the request cycle and
> >>> request cycle has metadata facility, so....
> >>>
> >>> -igor
> >>>
> >>> On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer <wi...@regnis.de>
> >>> wrote:
> >>>
> >>>  Thanks. But how the filter should know about the request which
> contains
> >>>> the
> >>>> information about what to highlight?
> >>>>
> >>>> --
> >>>> Cheers,
> >>>> Tom
> >>>>
> >>>>
> >>>>
> >>>> Igor Vaynberg wrote:
> >>>>
> >>>>  iresponsefilter
> >>>>>
> >>>>> -igor
> >>>>>
> >>>>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de>
> >>>>> wrote:
> >>>>>
> >>>>>  OK, this looks trivial, but were should I place this code to replace
> >>>>> all
> >>>>>
> >>>>>> content, no matter whether it comes from a page template, border or
> >>>>>> fragment?
> >>>>>>
> >>>>>> --
> >>>>>> Cheers,
> >>>>>> Tom
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> Martijn Dashorst wrote:
> >>>>>>
> >>>>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
> >>>>>>
> >>>>>>> "</span>");
> >>>>>>>
> >>>>>>> label.setEscapeModelStrings(false);
> >>>>>>>
> >>>>>>> Martijn
> >>>>>>>
> >>>>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>  We are using Wicket as base for our website (www.syntevo.com). We
> >>>>>>> have
> >>>>>>>
> >>>>>>>> a
> >>>>>>>> simple search feature on the website, but want to extend it like
> it
> >>>>>>>> is
> >>>>>>>> known
> >>>>>>>> to work in forums: the searched words should be highlighted.
> >>>>>>>>
> >>>>>>>> Does someone already has implemented such a feature to surround
> >>>>>>>> plain
> >>>>>>>> words
> >>>>>>>> in the markup by a special tag?
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Cheers,
> >>>>>>>> Tom
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>> 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: Highlight some words in the markup content

Posted by Jim Pinkham <pi...@gmail.com>.
I'd be interested to know if anyone else is using this technique for search
highlighting with a DataTable.

http://pastebin.com/m5446797d

The data in my grid may contain HTML, so that makes it considerably more
complicated (my first attempt didn't address this problem).  I'd love to
know if someone else has a better/simpler way, although this does appear to
work fine, it took a day to come up with.

In general, I kind of like the idea of separating this concern from the
model, whose purpose is just to get the data, and think of this search
highlighting as more of a decorator that applies to the entire grid rather
than any particular column, since I've got several PropertyColumn subclasses
(LinkPropertyColumn, ImagePropertyColumn, NonEscapedHTMLPropertyColumn,
...etc).

Hope this helps someone else.

Thanks,
-- Jim.

On Fri, Oct 24, 2008 at 1:06 PM, Jim Pinkham <pi...@gmail.com> wrote:

> I've got a few embellishments to that idea that others might enjoy.  These
> include the ability to use on non-string properties, and caching the last
> compiled pattern (maybe uses a bit less CPU than replaceAll each time).
>
>     protected static class HighlightingModel extends
> LoadableDetachableModel {
>         private static final long serialVersionUID = 1L;
>
>         private transient IModel text;
>         private transient IModel searchWord;
>         private transient Pattern lastp;
>         private transient String lastSearch;
>
>         HighlightingModel(IModel text, IModel searchWord) {
>             this.text = text;
>             this.searchWord = searchWord;
>         }
>
>         @Override
>         protected String load() {
>             String srch = (String)searchWord.getObject();
>             Object object = text.getObject();
>             String txt = "";
>             if (object != null) {
>                 IConverter converter =
> Application.get().getConverterLocator().getConverter(object.getClass());
>                 txt = converter.convertToString(object,
> Session.get().getLocale());
>             }
>             if (srch != null) {
>                 Pattern p = null;
>                 if (lastp != null && srch.equals(lastSearch) )
>                     p = lastp;
>                 else {
>                     try {
>                         p = Pattern.compile(srch,
> Pattern.CASE_INSENSITIVE);
>                     } catch (PatternSyntaxException e) {
>                         if (e.getIndex()>-1) {
>                             srch = srch.substring(0, e.getIndex());
>                             try {
>                                 p = Pattern.compile(srch,
> Pattern.CASE_INSENSITIVE);
>                             } catch (Exception e2) {
>                                 srch = null;
>                             }
>                         } else
>                             srch = null;
>                     }
>                 }
>                 if (p != null) {
>                     Matcher m = p.matcher(txt);
>                     return m.replaceFirst("<span
> class=\"search\">$0</span>");
>                 }
>             }
>             return txt;
>         }
>
>         @Override
>         protected void onDetach() {
>             super.onDetach();
>             text = null;
>             searchWord = null;
>         }
>     }
>
> -- Jim Pinkham
>
>
> On Thu, Oct 16, 2008 at 3:24 PM, Thomas Singer <wi...@regnis.de> wrote:
>
>> Thanks all. The first tests work fine now, still need to handle the
>> ignore-case searching...
>>
>> Is there anybody else interested in this feature? Then I will try to
>> prepare the IResponseFilter implementation for public viewing/integration in
>> Wicket.
>>
>>  as far as i know the response filter runs within the request cycle and
>>> request cycle has metadata facility, so....
>>>
>>
>> We already make use of RequestCycle.get(), but if you don't work on Wicket
>> the full day like you, then one forgets such secrets.
>>
>>
>> --
>> Cheers,
>> Tom
>>
>>
>> Igor Vaynberg wrote:
>>
>>> as far as i know the response filter runs within the request cycle and
>>> request cycle has metadata facility, so....
>>>
>>> -igor
>>>
>>> On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer <wi...@regnis.de>
>>> wrote:
>>>
>>>  Thanks. But how the filter should know about the request which contains
>>>> the
>>>> information about what to highlight?
>>>>
>>>> --
>>>> Cheers,
>>>> Tom
>>>>
>>>>
>>>>
>>>> Igor Vaynberg wrote:
>>>>
>>>>  iresponsefilter
>>>>>
>>>>> -igor
>>>>>
>>>>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de>
>>>>> wrote:
>>>>>
>>>>>  OK, this looks trivial, but were should I place this code to replace
>>>>> all
>>>>>
>>>>>> content, no matter whether it comes from a page template, border or
>>>>>> fragment?
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> Tom
>>>>>>
>>>>>>
>>>>>>
>>>>>> Martijn Dashorst wrote:
>>>>>>
>>>>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>>>>>
>>>>>>> "</span>");
>>>>>>>
>>>>>>> label.setEscapeModelStrings(false);
>>>>>>>
>>>>>>> Martijn
>>>>>>>
>>>>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
>>>>>>> wrote:
>>>>>>>
>>>>>>>  We are using Wicket as base for our website (www.syntevo.com). We
>>>>>>> have
>>>>>>>
>>>>>>>> a
>>>>>>>> simple search feature on the website, but want to extend it like it
>>>>>>>> is
>>>>>>>> known
>>>>>>>> to work in forums: the searched words should be highlighted.
>>>>>>>>
>>>>>>>> Does someone already has implemented such a feature to surround
>>>>>>>> plain
>>>>>>>> words
>>>>>>>> in the markup by a special tag?
>>>>>>>>
>>>>>>>> --
>>>>>>>> Cheers,
>>>>>>>> Tom
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> 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: Highlight some words in the markup content

Posted by Jim Pinkham <pi...@gmail.com>.
I've got a few embellishments to that idea that others might enjoy.  These
include the ability to use on non-string properties, and caching the last
compiled pattern (maybe uses a bit less CPU than replaceAll each time).

    protected static class HighlightingModel extends LoadableDetachableModel
{
        private static final long serialVersionUID = 1L;

        private transient IModel text;
        private transient IModel searchWord;
        private transient Pattern lastp;
        private transient String lastSearch;

        HighlightingModel(IModel text, IModel searchWord) {
            this.text = text;
            this.searchWord = searchWord;
        }

        @Override
        protected String load() {
            String srch = (String)searchWord.getObject();
            Object object = text.getObject();
            String txt = "";
            if (object != null) {
                IConverter converter =
Application.get().getConverterLocator().getConverter(object.getClass());
                txt = converter.convertToString(object,
Session.get().getLocale());
            }
            if (srch != null) {
                Pattern p = null;
                if (lastp != null && srch.equals(lastSearch) )
                    p = lastp;
                else {
                    try {
                        p = Pattern.compile(srch, Pattern.CASE_INSENSITIVE);
                    } catch (PatternSyntaxException e) {
                        if (e.getIndex()>-1) {
                            srch = srch.substring(0, e.getIndex());
                            try {
                                p = Pattern.compile(srch,
Pattern.CASE_INSENSITIVE);
                            } catch (Exception e2) {
                                srch = null;
                            }
                        } else
                            srch = null;
                    }
                }
                if (p != null) {
                    Matcher m = p.matcher(txt);
                    return m.replaceFirst("<span
class=\"search\">$0</span>");
                }
            }
            return txt;
        }

        @Override
        protected void onDetach() {
            super.onDetach();
            text = null;
            searchWord = null;
        }
    }

-- Jim Pinkham

On Thu, Oct 16, 2008 at 3:24 PM, Thomas Singer <wi...@regnis.de> wrote:

> Thanks all. The first tests work fine now, still need to handle the
> ignore-case searching...
>
> Is there anybody else interested in this feature? Then I will try to
> prepare the IResponseFilter implementation for public viewing/integration in
> Wicket.
>
>  as far as i know the response filter runs within the request cycle and
>> request cycle has metadata facility, so....
>>
>
> We already make use of RequestCycle.get(), but if you don't work on Wicket
> the full day like you, then one forgets such secrets.
>
>
> --
> Cheers,
> Tom
>
>
> Igor Vaynberg wrote:
>
>> as far as i know the response filter runs within the request cycle and
>> request cycle has metadata facility, so....
>>
>> -igor
>>
>> On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer <wi...@regnis.de> wrote:
>>
>>  Thanks. But how the filter should know about the request which contains
>>> the
>>> information about what to highlight?
>>>
>>> --
>>> Cheers,
>>> Tom
>>>
>>>
>>>
>>> Igor Vaynberg wrote:
>>>
>>>  iresponsefilter
>>>>
>>>> -igor
>>>>
>>>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de>
>>>> wrote:
>>>>
>>>>  OK, this looks trivial, but were should I place this code to replace
>>>> all
>>>>
>>>>> content, no matter whether it comes from a page template, border or
>>>>> fragment?
>>>>>
>>>>> --
>>>>> Cheers,
>>>>> Tom
>>>>>
>>>>>
>>>>>
>>>>> Martijn Dashorst wrote:
>>>>>
>>>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>>>>
>>>>>> "</span>");
>>>>>>
>>>>>> label.setEscapeModelStrings(false);
>>>>>>
>>>>>> Martijn
>>>>>>
>>>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
>>>>>> wrote:
>>>>>>
>>>>>>  We are using Wicket as base for our website (www.syntevo.com). We
>>>>>> have
>>>>>>
>>>>>>> a
>>>>>>> simple search feature on the website, but want to extend it like it
>>>>>>> is
>>>>>>> known
>>>>>>> to work in forums: the searched words should be highlighted.
>>>>>>>
>>>>>>> Does someone already has implemented such a feature to surround plain
>>>>>>> words
>>>>>>> in the markup by a special tag?
>>>>>>>
>>>>>>> --
>>>>>>> Cheers,
>>>>>>> Tom
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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: Highlight some words in the markup content

Posted by Thomas Singer <wi...@regnis.de>.
Thanks all. The first tests work fine now, still need to handle the 
ignore-case searching...

Is there anybody else interested in this feature? Then I will try to prepare 
the IResponseFilter implementation for public viewing/integration in Wicket.

> as far as i know the response filter runs within the request cycle and
> request cycle has metadata facility, so....

We already make use of RequestCycle.get(), but if you don't work on Wicket 
the full day like you, then one forgets such secrets.

--
Cheers,
Tom


Igor Vaynberg wrote:
> as far as i know the response filter runs within the request cycle and
> request cycle has metadata facility, so....
> 
> -igor
> 
> On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer <wi...@regnis.de> wrote:
> 
>> Thanks. But how the filter should know about the request which contains the
>> information about what to highlight?
>>
>> --
>> Cheers,
>> Tom
>>
>>
>>
>> Igor Vaynberg wrote:
>>
>>> iresponsefilter
>>>
>>> -igor
>>>
>>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de> wrote:
>>>
>>>  OK, this looks trivial, but were should I place this code to replace all
>>>> content, no matter whether it comes from a page template, border or
>>>> fragment?
>>>>
>>>> --
>>>> Cheers,
>>>> Tom
>>>>
>>>>
>>>>
>>>> Martijn Dashorst wrote:
>>>>
>>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>>>> "</span>");
>>>>>
>>>>> label.setEscapeModelStrings(false);
>>>>>
>>>>> Martijn
>>>>>
>>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
>>>>> wrote:
>>>>>
>>>>>  We are using Wicket as base for our website (www.syntevo.com). We have
>>>>>> a
>>>>>> simple search feature on the website, but want to extend it like it is
>>>>>> known
>>>>>> to work in forums: the searched words should be highlighted.
>>>>>>
>>>>>> Does someone already has implemented such a feature to surround plain
>>>>>> words
>>>>>> in the markup by a special tag?
>>>>>>
>>>>>> --
>>>>>> Cheers,
>>>>>> Tom
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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: Highlight some words in the markup content

Posted by Igor Vaynberg <ig...@gmail.com>.
as far as i know the response filter runs within the request cycle and
request cycle has metadata facility, so....

-igor

On Wed, Oct 15, 2008 at 10:07 AM, Thomas Singer <wi...@regnis.de> wrote:

> Thanks. But how the filter should know about the request which contains the
> information about what to highlight?
>
> --
> Cheers,
> Tom
>
>
>
> Igor Vaynberg wrote:
>
>> iresponsefilter
>>
>> -igor
>>
>> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de> wrote:
>>
>>  OK, this looks trivial, but were should I place this code to replace all
>>> content, no matter whether it comes from a page template, border or
>>> fragment?
>>>
>>> --
>>> Cheers,
>>> Tom
>>>
>>>
>>>
>>> Martijn Dashorst wrote:
>>>
>>>  tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>>> "</span>");
>>>>
>>>> label.setEscapeModelStrings(false);
>>>>
>>>> Martijn
>>>>
>>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de>
>>>> wrote:
>>>>
>>>>  We are using Wicket as base for our website (www.syntevo.com). We have
>>>>> a
>>>>> simple search feature on the website, but want to extend it like it is
>>>>> known
>>>>> to work in forums: the searched words should be highlighted.
>>>>>
>>>>> Does someone already has implemented such a feature to surround plain
>>>>> words
>>>>> in the markup by a special tag?
>>>>>
>>>>> --
>>>>> Cheers,
>>>>> Tom
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>  ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Highlight some words in the markup content

Posted by Thomas Singer <wi...@regnis.de>.
Thanks. But how the filter should know about the request which contains the 
information about what to highlight?

--
Cheers,
Tom


Igor Vaynberg wrote:
> iresponsefilter
> 
> -igor
> 
> On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de> wrote:
> 
>> OK, this looks trivial, but were should I place this code to replace all
>> content, no matter whether it comes from a page template, border or
>> fragment?
>>
>> --
>> Cheers,
>> Tom
>>
>>
>>
>> Martijn Dashorst wrote:
>>
>>> tekst.replaceAll(searchword, "<span class="search">" + searchword +
>>> "</span>");
>>>
>>> label.setEscapeModelStrings(false);
>>>
>>> Martijn
>>>
>>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de> wrote:
>>>
>>>> We are using Wicket as base for our website (www.syntevo.com). We have a
>>>> simple search feature on the website, but want to extend it like it is
>>>> known
>>>> to work in forums: the searched words should be highlighted.
>>>>
>>>> Does someone already has implemented such a feature to surround plain
>>>> words
>>>> in the markup by a special tag?
>>>>
>>>> --
>>>> Cheers,
>>>> Tom
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 

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


Re: Highlight some words in the markup content

Posted by Igor Vaynberg <ig...@gmail.com>.
iresponsefilter

-igor

On Wed, Oct 15, 2008 at 8:22 AM, Thomas Singer <wi...@regnis.de> wrote:

> OK, this looks trivial, but were should I place this code to replace all
> content, no matter whether it comes from a page template, border or
> fragment?
>
> --
> Cheers,
> Tom
>
>
>
> Martijn Dashorst wrote:
>
>> tekst.replaceAll(searchword, "<span class="search">" + searchword +
>> "</span>");
>>
>> label.setEscapeModelStrings(false);
>>
>> Martijn
>>
>> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de> wrote:
>>
>>> We are using Wicket as base for our website (www.syntevo.com). We have a
>>> simple search feature on the website, but want to extend it like it is
>>> known
>>> to work in forums: the searched words should be highlighted.
>>>
>>> Does someone already has implemented such a feature to surround plain
>>> words
>>> in the markup by a special tag?
>>>
>>> --
>>> Cheers,
>>> Tom
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Highlight some words in the markup content

Posted by Thomas Singer <wi...@regnis.de>.
OK, this looks trivial, but were should I place this code to replace all 
content, no matter whether it comes from a page template, border or fragment?

--
Cheers,
Tom


Martijn Dashorst wrote:
> tekst.replaceAll(searchword, "<span class="search">" + searchword + "</span>");
> 
> label.setEscapeModelStrings(false);
> 
> Martijn
> 
> On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de> wrote:
>> We are using Wicket as base for our website (www.syntevo.com). We have a
>> simple search feature on the website, but want to extend it like it is known
>> to work in forums: the searched words should be highlighted.
>>
>> Does someone already has implemented such a feature to surround plain words
>> in the markup by a special tag?
>>
>> --
>> Cheers,
>> Tom
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 

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


Re: Highlight some words in the markup content

Posted by Martijn Dashorst <ma...@gmail.com>.
tekst.replaceAll(searchword, "<span class="search">" + searchword + "</span>");

label.setEscapeModelStrings(false);

Martijn

On Wed, Oct 15, 2008 at 3:56 PM, Thomas Singer <wi...@regnis.de> wrote:
> We are using Wicket as base for our website (www.syntevo.com). We have a
> simple search feature on the website, but want to extend it like it is known
> to work in forums: the searched words should be highlighted.
>
> Does someone already has implemented such a feature to surround plain words
> in the markup by a special tag?
>
> --
> Cheers,
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



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

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