You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2016/10/13 16:10:17 UTC

(Customizable) Fragment as String

Hello All,

I'm successfully using following code [1] to get Panel as String
Unfortunately It is not possible to get Fragment as String this way :(

The goal I'm trying to achieve is: store email subject as wicket:fragment

Another question is: is it possible to edit markup like this
<span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
wicket:id="aa3"></span>

to be able to remove some blocks without breaking the rendering

so I can modify the markup something like this
<span wicket:id="aa1"></span><wicket:remove> - <span
wicket:id="aa2"></span> <span wicket:id="aa3"></span></wicket:remove>

The java code will remain the same:
comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new Label("aa3",
"AA3"))

And I'll get
<span>AA1</span>
as a result without any errors/warnings

Thanks in advance!

[1]
https://github.com/apache/openmeetings/blob/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractTemplatePanel.java#L70

-- 
WBR
Maxim aka solomax

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
I was able to find workaround :)
In case of following modification:
https://github.com/solomax/fragment-as-string/commit/c6d5e8a692242fa2754a39b9cbe964d24c84a97e
Everything works as expected

The only issue is: fragment is wrapped with
DEFAULT_MARKUP: "<wicket:container wicket:id='%s'></wicket:container>"
Is there any option to remove it?


On Mon, Oct 17, 2016 at 1:57 PM, Martin Grigorov <mg...@apache.org>
wrote:

> - org.apache.wicket.markup.IMarkupResourceStreamProvider
> - Component#setMarkup()
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Oct 17, 2016 at 8:33 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Is there other option to have additional markup in the same file?
> >
> > WBR, Maxim
> > (from mobile, sorry for the typos)
> >
> > On Oct 17, 2016 12:44, "Maxim Solodovnik" <so...@gmail.com> wrote:
> >
> > That's a pitty :(
> > Thanks for your time
> > It would be nice to have this functionality available
> >
> > WBR, Maxim
> > (from mobile, sorry for the typos)
> >
> > On Oct 16, 2016 04:44, "Martin Grigorov" <mg...@apache.org> wrote:
> >
> > > Sorry, but I don't find a way to make it work.
> > > It will need more thinking and debugging and I have no that much time
> > right
> > > now.
> > > Just use Panel instead of Fragment.
> > > I'll add a comment to ComponentRenderer's javadoc that Fragments are
> not
> > > supported.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 14, 2016 at 9:14 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> > > wrote:
> > >
> > > > Many thanks :)
> > > >
> > > > On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > I'll take a look at the weekend.
> > > > >
> > > > > Martin Grigorov
> > > > > Wicket Training and Consulting
> > > > > https://twitter.com/mtgrigorov
> > > > >
> > > > > On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <
> > > solomax666@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Yes, the changes were local :(
> > > > > > Here is the quickstart: https://github.com/solomax/fra
> > > gment-as-string
> > > > > >
> > > > > > In case following line is uncommented
> > > > > > https://github.com/solomax/fragment-as-string/blob/
> > > > > > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > > > > > (next one should be commented)
> > > > > > Tests are fails with markup not found exception
> > > > > >
> > > > > > Is it possible to create something like "wicket:visible" (or
> > > > > "om:visible")
> > > > > > tag+attribute so it can act as I call setVisible in Java?
> > > > > >
> > > > > > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <
> > > mgrigorov@apache.org
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> > > > > solomax666@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hello Martin,
> > > > > > > >
> > > > > > > > Thanks for the quick response!
> > > > > > > >
> > > > > > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > > > > > mgrigorov@apache.org>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Maxim,
> > > > > > > > >
> > > > > > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > > > > > solomax666@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hello All,
> > > > > > > > > >
> > > > > > > > > > I'm successfully using following code [1] to get Panel as
> > > > String
> > > > > > > > > > Unfortunately It is not possible to get Fragment as
> String
> > > this
> > > > > way
> > > > > > > :(
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > You can replace your util with ComponentRenderer#
> > > > renderComponent()
> > > > > > > > > https://github.com/apache/wicket/blob/
> > > > > 70606d73e9165d37c1d8b7c7820279
> > > > > > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > > > > > core/util/string/
> > > > > > > > > ComponentRenderer.java#L86
> > > > > > > > > The problem here is that your helper page doesn't provide
> the
> > > > > > > Fragment's
> > > > > > > > > markup. Someone has to provide it.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > I have added following block to [2]
> > > > > > > >
> > > > > > >
> > > > > > > No, you have not!
> > > > > > > There is no 'fragment' in [2] and [3]
> > > > > > > Or you did it locally ? Better create a branch and point us to
> > it.
> > > > > > >
> > > > > > >
> > > > > > > > <wicket:fragment wicket:id="subject"><span
> > > > wicket:id="prefix"></span>
> > > > > > > <span
> > > > > > > > wicket:id="title"></span> <span
> > > > > > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > > > > > wicket:fragment>
> > > > > > > >
> > > > > > > > then I have added following code to [3]
> > > > > > > >
> > > > > > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject",
> > this);
> > > > > > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > > > > > , new OmTextLabel("title", a.getTitle())
> > > > > > > > , new OmTextLabel("start",
> > > > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > > > dTimeZone(a.getStart(),
> > > > > > > > tz))
> > > > > > > > , new OmTextLabel("end",
> > > > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > > dTimeZone(a.getEnd(),
> > > > > > > tz))
> > > > > > > > );
> > > > > > > >
> > > > > > > > so I I was hoping markup should be available .... but it's
> not
> > :(
> > > > > > > >
> > > > > > > > [3]
> > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > > service/mail/template/CreatedAppointmentTemplate.java
> > > > > > > >
> > > > > > > > [2]
> > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > The goal I'm trying to achieve is: store email subject as
> > > > > > > > wicket:fragment
> > > > > > > > > >
> > > > > > > > > > Another question is: is it possible to edit markup like
> > this
> > > > > > > > > > <span wicket:id="aa1"></span> - <span
> > wicket:id="aa2"></span>
> > > > > <span
> > > > > > > > > > wicket:id="aa3"></span>
> > > > > > > > > >
> > > > > > > > > > to be able to remove some blocks without breaking the
> > > rendering
> > > > > > > > > >
> > > > > > > > > > so I can modify the markup something like this
> > > > > > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > > > > > wicket:remove>
> > > > > > > > > >
> > > > > > > > > > The java code will remain the same:
> > > > > > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2",
> "AA2"),
> > > new
> > > > > > > > > Label("aa3",
> > > > > > > > > > "AA3"))
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > > > > > >
> > > > > > > > >
> > > > > > > > Actually we have markup files unpacked, so end users can add
> > some
> > > > > > > > modifications to it
> > > > > > > > So I need to let users to modify fragments without
> recompiling
> > or
> > > > > java
> > > > > > > > programming
> > > > > > > > re-arraging blocks is OK, but removing ....
> > > > > > > >
> > > > > > >
> > > > > > > I'm afraid you will need to use auto-components for such
> > > requirement.
> > > > > > > E.g. <om:label ...> in the markup and IComponentResolver in
> Java
> > > that
> > > > > > knows
> > > > > > > what to do with such elements in the markup. E.g. it will
> > > > instantiate a
> > > > > > > Label and set its model by reading some special attribute.
> > > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > >
> > > > > > > > > > And I'll get
> > > > > > > > > > <span>AA1</span>
> > > > > > > > > > as a result without any errors/warnings
> > > > > > > > > >
> > > > > > > > > > Thanks in advance!
> > > > > > > > > >
> > > > > > > > > > [1]
> > > > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > > > openmeetings-service/src/main/
> > java/org/apache/openmeetings/
> > > > > > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > WBR
> > > > > > > > > > Maxim aka solomax
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > WBR
> > > > > > > > Maxim aka solomax
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > WBR
> > > > > > Maxim aka solomax
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
>



-- 
WBR
Maxim aka solomax

Re: (Customizable) Fragment as String

Posted by Martin Grigorov <mg...@apache.org>.
- org.apache.wicket.markup.IMarkupResourceStreamProvider
- Component#setMarkup()

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 17, 2016 at 8:33 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Is there other option to have additional markup in the same file?
>
> WBR, Maxim
> (from mobile, sorry for the typos)
>
> On Oct 17, 2016 12:44, "Maxim Solodovnik" <so...@gmail.com> wrote:
>
> That's a pitty :(
> Thanks for your time
> It would be nice to have this functionality available
>
> WBR, Maxim
> (from mobile, sorry for the typos)
>
> On Oct 16, 2016 04:44, "Martin Grigorov" <mg...@apache.org> wrote:
>
> > Sorry, but I don't find a way to make it work.
> > It will need more thinking and debugging and I have no that much time
> right
> > now.
> > Just use Panel instead of Fragment.
> > I'll add a comment to ComponentRenderer's javadoc that Fragments are not
> > supported.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 14, 2016 at 9:14 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Many thanks :)
> > >
> > > On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > I'll take a look at the weekend.
> > > >
> > > > Martin Grigorov
> > > > Wicket Training and Consulting
> > > > https://twitter.com/mtgrigorov
> > > >
> > > > On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <
> > solomax666@gmail.com>
> > > > wrote:
> > > >
> > > > > Yes, the changes were local :(
> > > > > Here is the quickstart: https://github.com/solomax/fra
> > gment-as-string
> > > > >
> > > > > In case following line is uncommented
> > > > > https://github.com/solomax/fragment-as-string/blob/
> > > > > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > > > > (next one should be commented)
> > > > > Tests are fails with markup not found exception
> > > > >
> > > > > Is it possible to create something like "wicket:visible" (or
> > > > "om:visible")
> > > > > tag+attribute so it can act as I call setVisible in Java?
> > > > >
> > > > > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <
> > mgrigorov@apache.org
> > > >
> > > > > wrote:
> > > > >
> > > > > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> > > > solomax666@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hello Martin,
> > > > > > >
> > > > > > > Thanks for the quick response!
> > > > > > >
> > > > > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > > > > mgrigorov@apache.org>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Maxim,
> > > > > > > >
> > > > > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > > > > solomax666@gmail.com>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hello All,
> > > > > > > > >
> > > > > > > > > I'm successfully using following code [1] to get Panel as
> > > String
> > > > > > > > > Unfortunately It is not possible to get Fragment as String
> > this
> > > > way
> > > > > > :(
> > > > > > > > >
> > > > > > > >
> > > > > > > > You can replace your util with ComponentRenderer#
> > > renderComponent()
> > > > > > > > https://github.com/apache/wicket/blob/
> > > > 70606d73e9165d37c1d8b7c7820279
> > > > > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > > > > core/util/string/
> > > > > > > > ComponentRenderer.java#L86
> > > > > > > > The problem here is that your helper page doesn't provide the
> > > > > > Fragment's
> > > > > > > > markup. Someone has to provide it.
> > > > > > > >
> > > > > > > >
> > > > > > > I have added following block to [2]
> > > > > > >
> > > > > >
> > > > > > No, you have not!
> > > > > > There is no 'fragment' in [2] and [3]
> > > > > > Or you did it locally ? Better create a branch and point us to
> it.
> > > > > >
> > > > > >
> > > > > > > <wicket:fragment wicket:id="subject"><span
> > > wicket:id="prefix"></span>
> > > > > > <span
> > > > > > > wicket:id="title"></span> <span
> > > > > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > > > > wicket:fragment>
> > > > > > >
> > > > > > > then I have added following code to [3]
> > > > > > >
> > > > > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject",
> this);
> > > > > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > > > > , new OmTextLabel("title", a.getTitle())
> > > > > > > , new OmTextLabel("start",
> > > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > > dTimeZone(a.getStart(),
> > > > > > > tz))
> > > > > > > , new OmTextLabel("end",
> > > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > dTimeZone(a.getEnd(),
> > > > > > tz))
> > > > > > > );
> > > > > > >
> > > > > > > so I I was hoping markup should be available .... but it's not
> :(
> > > > > > >
> > > > > > > [3]
> > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > service/mail/template/CreatedAppointmentTemplate.java
> > > > > > >
> > > > > > > [2]
> > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > >
> > > > > > > > > The goal I'm trying to achieve is: store email subject as
> > > > > > > wicket:fragment
> > > > > > > > >
> > > > > > > > > Another question is: is it possible to edit markup like
> this
> > > > > > > > > <span wicket:id="aa1"></span> - <span
> wicket:id="aa2"></span>
> > > > <span
> > > > > > > > > wicket:id="aa3"></span>
> > > > > > > > >
> > > > > > > > > to be able to remove some blocks without breaking the
> > rendering
> > > > > > > > >
> > > > > > > > > so I can modify the markup something like this
> > > > > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > > > > wicket:remove>
> > > > > > > > >
> > > > > > > > > The java code will remain the same:
> > > > > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"),
> > new
> > > > > > > > Label("aa3",
> > > > > > > > > "AA3"))
> > > > > > > > >
> > > > > > > >
> > > > > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > > > > >
> > > > > > > >
> > > > > > > Actually we have markup files unpacked, so end users can add
> some
> > > > > > > modifications to it
> > > > > > > So I need to let users to modify fragments without recompiling
> or
> > > > java
> > > > > > > programming
> > > > > > > re-arraging blocks is OK, but removing ....
> > > > > > >
> > > > > >
> > > > > > I'm afraid you will need to use auto-components for such
> > requirement.
> > > > > > E.g. <om:label ...> in the markup and IComponentResolver in Java
> > that
> > > > > knows
> > > > > > what to do with such elements in the markup. E.g. it will
> > > instantiate a
> > > > > > Label and set its model by reading some special attribute.
> > > > > >
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > >
> > > > > > > > > And I'll get
> > > > > > > > > <span>AA1</span>
> > > > > > > > > as a result without any errors/warnings
> > > > > > > > >
> > > > > > > > > Thanks in advance!
> > > > > > > > >
> > > > > > > > > [1]
> > > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > > openmeetings-service/src/main/
> java/org/apache/openmeetings/
> > > > > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > WBR
> > > > > > > > > Maxim aka solomax
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > WBR
> > > > > > > Maxim aka solomax
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > WBR
> > > > > Maxim aka solomax
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
Is there other option to have additional markup in the same file?

WBR, Maxim
(from mobile, sorry for the typos)

On Oct 17, 2016 12:44, "Maxim Solodovnik" <so...@gmail.com> wrote:

That's a pitty :(
Thanks for your time
It would be nice to have this functionality available

WBR, Maxim
(from mobile, sorry for the typos)

On Oct 16, 2016 04:44, "Martin Grigorov" <mg...@apache.org> wrote:

> Sorry, but I don't find a way to make it work.
> It will need more thinking and debugging and I have no that much time right
> now.
> Just use Panel instead of Fragment.
> I'll add a comment to ComponentRenderer's javadoc that Fragments are not
> supported.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 14, 2016 at 9:14 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Many thanks :)
> >
> > On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > I'll take a look at the weekend.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> > > wrote:
> > >
> > > > Yes, the changes were local :(
> > > > Here is the quickstart: https://github.com/solomax/fra
> gment-as-string
> > > >
> > > > In case following line is uncommented
> > > > https://github.com/solomax/fragment-as-string/blob/
> > > > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > > > (next one should be commented)
> > > > Tests are fails with markup not found exception
> > > >
> > > > Is it possible to create something like "wicket:visible" (or
> > > "om:visible")
> > > > tag+attribute so it can act as I call setVisible in Java?
> > > >
> > > > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> > > solomax666@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hello Martin,
> > > > > >
> > > > > > Thanks for the quick response!
> > > > > >
> > > > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > > > mgrigorov@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Maxim,
> > > > > > >
> > > > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > > > solomax666@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hello All,
> > > > > > > >
> > > > > > > > I'm successfully using following code [1] to get Panel as
> > String
> > > > > > > > Unfortunately It is not possible to get Fragment as String
> this
> > > way
> > > > > :(
> > > > > > > >
> > > > > > >
> > > > > > > You can replace your util with ComponentRenderer#
> > renderComponent()
> > > > > > > https://github.com/apache/wicket/blob/
> > > 70606d73e9165d37c1d8b7c7820279
> > > > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > > > core/util/string/
> > > > > > > ComponentRenderer.java#L86
> > > > > > > The problem here is that your helper page doesn't provide the
> > > > > Fragment's
> > > > > > > markup. Someone has to provide it.
> > > > > > >
> > > > > > >
> > > > > > I have added following block to [2]
> > > > > >
> > > > >
> > > > > No, you have not!
> > > > > There is no 'fragment' in [2] and [3]
> > > > > Or you did it locally ? Better create a branch and point us to it.
> > > > >
> > > > >
> > > > > > <wicket:fragment wicket:id="subject"><span
> > wicket:id="prefix"></span>
> > > > > <span
> > > > > > wicket:id="title"></span> <span
> > > > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > > > wicket:fragment>
> > > > > >
> > > > > > then I have added following code to [3]
> > > > > >
> > > > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > > > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > > > , new OmTextLabel("title", a.getTitle())
> > > > > > , new OmTextLabel("start",
> > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > dTimeZone(a.getStart(),
> > > > > > tz))
> > > > > > , new OmTextLabel("end",
> > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > dTimeZone(a.getEnd(),
> > > > > tz))
> > > > > > );
> > > > > >
> > > > > > so I I was hoping markup should be available .... but it's not :(
> > > > > >
> > > > > > [3]
> > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > service/mail/template/CreatedAppointmentTemplate.java
> > > > > >
> > > > > > [2]
> > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > The goal I'm trying to achieve is: store email subject as
> > > > > > wicket:fragment
> > > > > > > >
> > > > > > > > Another question is: is it possible to edit markup like this
> > > > > > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span>
> > > <span
> > > > > > > > wicket:id="aa3"></span>
> > > > > > > >
> > > > > > > > to be able to remove some blocks without breaking the
> rendering
> > > > > > > >
> > > > > > > > so I can modify the markup something like this
> > > > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > > > wicket:remove>
> > > > > > > >
> > > > > > > > The java code will remain the same:
> > > > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"),
> new
> > > > > > > Label("aa3",
> > > > > > > > "AA3"))
> > > > > > > >
> > > > > > >
> > > > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > > > >
> > > > > > >
> > > > > > Actually we have markup files unpacked, so end users can add some
> > > > > > modifications to it
> > > > > > So I need to let users to modify fragments without recompiling or
> > > java
> > > > > > programming
> > > > > > re-arraging blocks is OK, but removing ....
> > > > > >
> > > > >
> > > > > I'm afraid you will need to use auto-components for such
> requirement.
> > > > > E.g. <om:label ...> in the markup and IComponentResolver in Java
> that
> > > > knows
> > > > > what to do with such elements in the markup. E.g. it will
> > instantiate a
> > > > > Label and set its model by reading some special attribute.
> > > > >
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > >
> > > > > > > > And I'll get
> > > > > > > > <span>AA1</span>
> > > > > > > > as a result without any errors/warnings
> > > > > > > >
> > > > > > > > Thanks in advance!
> > > > > > > >
> > > > > > > > [1]
> > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > > > >
> > > > > > > > --
> > > > > > > > WBR
> > > > > > > > Maxim aka solomax
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > WBR
> > > > > > Maxim aka solomax
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
That's a pitty :(
Thanks for your time
It would be nice to have this functionality available

WBR, Maxim
(from mobile, sorry for the typos)

On Oct 16, 2016 04:44, "Martin Grigorov" <mg...@apache.org> wrote:

> Sorry, but I don't find a way to make it work.
> It will need more thinking and debugging and I have no that much time right
> now.
> Just use Panel instead of Fragment.
> I'll add a comment to ComponentRenderer's javadoc that Fragments are not
> supported.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 14, 2016 at 9:14 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Many thanks :)
> >
> > On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > I'll take a look at the weekend.
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> > > wrote:
> > >
> > > > Yes, the changes were local :(
> > > > Here is the quickstart: https://github.com/solomax/
> fragment-as-string
> > > >
> > > > In case following line is uncommented
> > > > https://github.com/solomax/fragment-as-string/blob/
> > > > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > > > (next one should be commented)
> > > > Tests are fails with markup not found exception
> > > >
> > > > Is it possible to create something like "wicket:visible" (or
> > > "om:visible")
> > > > tag+attribute so it can act as I call setVisible in Java?
> > > >
> > > > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <
> mgrigorov@apache.org
> > >
> > > > wrote:
> > > >
> > > > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> > > solomax666@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hello Martin,
> > > > > >
> > > > > > Thanks for the quick response!
> > > > > >
> > > > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > > > mgrigorov@apache.org>
> > > > > > wrote:
> > > > > >
> > > > > > > Hi Maxim,
> > > > > > >
> > > > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > > > solomax666@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hello All,
> > > > > > > >
> > > > > > > > I'm successfully using following code [1] to get Panel as
> > String
> > > > > > > > Unfortunately It is not possible to get Fragment as String
> this
> > > way
> > > > > :(
> > > > > > > >
> > > > > > >
> > > > > > > You can replace your util with ComponentRenderer#
> > renderComponent()
> > > > > > > https://github.com/apache/wicket/blob/
> > > 70606d73e9165d37c1d8b7c7820279
> > > > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > > > core/util/string/
> > > > > > > ComponentRenderer.java#L86
> > > > > > > The problem here is that your helper page doesn't provide the
> > > > > Fragment's
> > > > > > > markup. Someone has to provide it.
> > > > > > >
> > > > > > >
> > > > > > I have added following block to [2]
> > > > > >
> > > > >
> > > > > No, you have not!
> > > > > There is no 'fragment' in [2] and [3]
> > > > > Or you did it locally ? Better create a branch and point us to it.
> > > > >
> > > > >
> > > > > > <wicket:fragment wicket:id="subject"><span
> > wicket:id="prefix"></span>
> > > > > <span
> > > > > > wicket:id="title"></span> <span
> > > > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > > > wicket:fragment>
> > > > > >
> > > > > > then I have added following code to [3]
> > > > > >
> > > > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > > > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > > > , new OmTextLabel("title", a.getTitle())
> > > > > > , new OmTextLabel("start",
> > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > > dTimeZone(a.getStart(),
> > > > > > tz))
> > > > > > , new OmTextLabel("end",
> > > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > dTimeZone(a.getEnd(),
> > > > > tz))
> > > > > > );
> > > > > >
> > > > > > so I I was hoping markup should be available .... but it's not :(
> > > > > >
> > > > > > [3]
> > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > service/mail/template/CreatedAppointmentTemplate.java
> > > > > >
> > > > > > [2]
> > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > >
> > > > > > > > The goal I'm trying to achieve is: store email subject as
> > > > > > wicket:fragment
> > > > > > > >
> > > > > > > > Another question is: is it possible to edit markup like this
> > > > > > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span>
> > > <span
> > > > > > > > wicket:id="aa3"></span>
> > > > > > > >
> > > > > > > > to be able to remove some blocks without breaking the
> rendering
> > > > > > > >
> > > > > > > > so I can modify the markup something like this
> > > > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > > > wicket:remove>
> > > > > > > >
> > > > > > > > The java code will remain the same:
> > > > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"),
> new
> > > > > > > Label("aa3",
> > > > > > > > "AA3"))
> > > > > > > >
> > > > > > >
> > > > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > > > >
> > > > > > >
> > > > > > Actually we have markup files unpacked, so end users can add some
> > > > > > modifications to it
> > > > > > So I need to let users to modify fragments without recompiling or
> > > java
> > > > > > programming
> > > > > > re-arraging blocks is OK, but removing ....
> > > > > >
> > > > >
> > > > > I'm afraid you will need to use auto-components for such
> requirement.
> > > > > E.g. <om:label ...> in the markup and IComponentResolver in Java
> that
> > > > knows
> > > > > what to do with such elements in the markup. E.g. it will
> > instantiate a
> > > > > Label and set its model by reading some special attribute.
> > > > >
> > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > > >
> > > > > > > > And I'll get
> > > > > > > > <span>AA1</span>
> > > > > > > > as a result without any errors/warnings
> > > > > > > >
> > > > > > > > Thanks in advance!
> > > > > > > >
> > > > > > > > [1]
> > > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > > > >
> > > > > > > > --
> > > > > > > > WBR
> > > > > > > > Maxim aka solomax
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > WBR
> > > > > > Maxim aka solomax
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>

Re: (Customizable) Fragment as String

Posted by Martin Grigorov <mg...@apache.org>.
Sorry, but I don't find a way to make it work.
It will need more thinking and debugging and I have no that much time right
now.
Just use Panel instead of Fragment.
I'll add a comment to ComponentRenderer's javadoc that Fragments are not
supported.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 14, 2016 at 9:14 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Many thanks :)
>
> On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > I'll take a look at the weekend.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Yes, the changes were local :(
> > > Here is the quickstart: https://github.com/solomax/fragment-as-string
> > >
> > > In case following line is uncommented
> > > https://github.com/solomax/fragment-as-string/blob/
> > > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > > (next one should be commented)
> > > Tests are fails with markup not found exception
> > >
> > > Is it possible to create something like "wicket:visible" (or
> > "om:visible")
> > > tag+attribute so it can act as I call setVisible in Java?
> > >
> > > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <mgrigorov@apache.org
> >
> > > wrote:
> > >
> > > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> > solomax666@gmail.com>
> > > > wrote:
> > > >
> > > > > Hello Martin,
> > > > >
> > > > > Thanks for the quick response!
> > > > >
> > > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > > mgrigorov@apache.org>
> > > > > wrote:
> > > > >
> > > > > > Hi Maxim,
> > > > > >
> > > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > > solomax666@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hello All,
> > > > > > >
> > > > > > > I'm successfully using following code [1] to get Panel as
> String
> > > > > > > Unfortunately It is not possible to get Fragment as String this
> > way
> > > > :(
> > > > > > >
> > > > > >
> > > > > > You can replace your util with ComponentRenderer#
> renderComponent()
> > > > > > https://github.com/apache/wicket/blob/
> > 70606d73e9165d37c1d8b7c7820279
> > > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > > core/util/string/
> > > > > > ComponentRenderer.java#L86
> > > > > > The problem here is that your helper page doesn't provide the
> > > > Fragment's
> > > > > > markup. Someone has to provide it.
> > > > > >
> > > > > >
> > > > > I have added following block to [2]
> > > > >
> > > >
> > > > No, you have not!
> > > > There is no 'fragment' in [2] and [3]
> > > > Or you did it locally ? Better create a branch and point us to it.
> > > >
> > > >
> > > > > <wicket:fragment wicket:id="subject"><span
> wicket:id="prefix"></span>
> > > > <span
> > > > > wicket:id="title"></span> <span
> > > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > > wicket:fragment>
> > > > >
> > > > > then I have added following code to [3]
> > > > >
> > > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > > , new OmTextLabel("title", a.getTitle())
> > > > > , new OmTextLabel("start",
> > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> > dTimeZone(a.getStart(),
> > > > > tz))
> > > > > , new OmTextLabel("end",
> > > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> dTimeZone(a.getEnd(),
> > > > tz))
> > > > > );
> > > > >
> > > > > so I I was hoping markup should be available .... but it's not :(
> > > > >
> > > > > [3]
> > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > service/mail/template/CreatedAppointmentTemplate.java
> > > > >
> > > > > [2]
> > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > > >
> > > > >
> > > > > >
> > > > > > >
> > > > > > > The goal I'm trying to achieve is: store email subject as
> > > > > wicket:fragment
> > > > > > >
> > > > > > > Another question is: is it possible to edit markup like this
> > > > > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span>
> > <span
> > > > > > > wicket:id="aa3"></span>
> > > > > > >
> > > > > > > to be able to remove some blocks without breaking the rendering
> > > > > > >
> > > > > > > so I can modify the markup something like this
> > > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > > wicket:remove>
> > > > > > >
> > > > > > > The java code will remain the same:
> > > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> > > > > > Label("aa3",
> > > > > > > "AA3"))
> > > > > > >
> > > > > >
> > > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > > >
> > > > > >
> > > > > Actually we have markup files unpacked, so end users can add some
> > > > > modifications to it
> > > > > So I need to let users to modify fragments without recompiling or
> > java
> > > > > programming
> > > > > re-arraging blocks is OK, but removing ....
> > > > >
> > > >
> > > > I'm afraid you will need to use auto-components for such requirement.
> > > > E.g. <om:label ...> in the markup and IComponentResolver in Java that
> > > knows
> > > > what to do with such elements in the markup. E.g. it will
> instantiate a
> > > > Label and set its model by reading some special attribute.
> > > >
> > > >
> > > > >
> > > > >
> > > > >
> > > > > > >
> > > > > > > And I'll get
> > > > > > > <span>AA1</span>
> > > > > > > as a result without any errors/warnings
> > > > > > >
> > > > > > > Thanks in advance!
> > > > > > >
> > > > > > > [1]
> > > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > > >
> > > > > > > --
> > > > > > > WBR
> > > > > > > Maxim aka solomax
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > WBR
> > > > > Maxim aka solomax
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
Many thanks :)

On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov <mg...@apache.org>
wrote:

> I'll take a look at the weekend.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Yes, the changes were local :(
> > Here is the quickstart: https://github.com/solomax/fragment-as-string
> >
> > In case following line is uncommented
> > https://github.com/solomax/fragment-as-string/blob/
> > master/src/main/java/org/apache/solomax/HomePage.java#L16
> > (next one should be commented)
> > Tests are fails with markup not found exception
> >
> > Is it possible to create something like "wicket:visible" (or
> "om:visible")
> > tag+attribute so it can act as I call setVisible in Java?
> >
> > On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <
> solomax666@gmail.com>
> > > wrote:
> > >
> > > > Hello Martin,
> > > >
> > > > Thanks for the quick response!
> > > >
> > > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> > mgrigorov@apache.org>
> > > > wrote:
> > > >
> > > > > Hi Maxim,
> > > > >
> > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > > solomax666@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hello All,
> > > > > >
> > > > > > I'm successfully using following code [1] to get Panel as String
> > > > > > Unfortunately It is not possible to get Fragment as String this
> way
> > > :(
> > > > > >
> > > > >
> > > > > You can replace your util with ComponentRenderer#renderComponent()
> > > > > https://github.com/apache/wicket/blob/
> 70606d73e9165d37c1d8b7c7820279
> > > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > > core/util/string/
> > > > > ComponentRenderer.java#L86
> > > > > The problem here is that your helper page doesn't provide the
> > > Fragment's
> > > > > markup. Someone has to provide it.
> > > > >
> > > > >
> > > > I have added following block to [2]
> > > >
> > >
> > > No, you have not!
> > > There is no 'fragment' in [2] and [3]
> > > Or you did it locally ? Better create a branch and point us to it.
> > >
> > >
> > > > <wicket:fragment wicket:id="subject"><span wicket:id="prefix"></span>
> > > <span
> > > > wicket:id="title"></span> <span
> > > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > > wicket:fragment>
> > > >
> > > > then I have added following code to [3]
> > > >
> > > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > > , new OmTextLabel("title", a.getTitle())
> > > > , new OmTextLabel("start",
> > > > CalendarPatterns.getDateWithTimeByMiliSecondsAn
> dTimeZone(a.getStart(),
> > > > tz))
> > > > , new OmTextLabel("end",
> > > > CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
> > > tz))
> > > > );
> > > >
> > > > so I I was hoping markup should be available .... but it's not :(
> > > >
> > > > [3]
> > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > service/mail/template/CreatedAppointmentTemplate.java
> > > >
> > > > [2]
> > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > > >
> > > >
> > > > >
> > > > > >
> > > > > > The goal I'm trying to achieve is: store email subject as
> > > > wicket:fragment
> > > > > >
> > > > > > Another question is: is it possible to edit markup like this
> > > > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span>
> <span
> > > > > > wicket:id="aa3"></span>
> > > > > >
> > > > > > to be able to remove some blocks without breaking the rendering
> > > > > >
> > > > > > so I can modify the markup something like this
> > > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > > wicket:remove>
> > > > > >
> > > > > > The java code will remain the same:
> > > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> > > > > Label("aa3",
> > > > > > "AA3"))
> > > > > >
> > > > >
> > > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > > >
> > > > >
> > > > Actually we have markup files unpacked, so end users can add some
> > > > modifications to it
> > > > So I need to let users to modify fragments without recompiling or
> java
> > > > programming
> > > > re-arraging blocks is OK, but removing ....
> > > >
> > >
> > > I'm afraid you will need to use auto-components for such requirement.
> > > E.g. <om:label ...> in the markup and IComponentResolver in Java that
> > knows
> > > what to do with such elements in the markup. E.g. it will instantiate a
> > > Label and set its model by reading some special attribute.
> > >
> > >
> > > >
> > > >
> > > >
> > > > > >
> > > > > > And I'll get
> > > > > > <span>AA1</span>
> > > > > > as a result without any errors/warnings
> > > > > >
> > > > > > Thanks in advance!
> > > > > >
> > > > > > [1]
> > > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > > >
> > > > > > --
> > > > > > WBR
> > > > > > Maxim aka solomax
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: (Customizable) Fragment as String

Posted by Martin Grigorov <mg...@apache.org>.
I'll take a look at the weekend.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 14, 2016 at 5:26 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Yes, the changes were local :(
> Here is the quickstart: https://github.com/solomax/fragment-as-string
>
> In case following line is uncommented
> https://github.com/solomax/fragment-as-string/blob/
> master/src/main/java/org/apache/solomax/HomePage.java#L16
> (next one should be commented)
> Tests are fails with markup not found exception
>
> Is it possible to create something like "wicket:visible" (or "om:visible")
> tag+attribute so it can act as I call setVisible in Java?
>
> On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Hello Martin,
> > >
> > > Thanks for the quick response!
> > >
> > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <
> mgrigorov@apache.org>
> > > wrote:
> > >
> > > > Hi Maxim,
> > > >
> > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> > solomax666@gmail.com>
> > > > wrote:
> > > >
> > > > > Hello All,
> > > > >
> > > > > I'm successfully using following code [1] to get Panel as String
> > > > > Unfortunately It is not possible to get Fragment as String this way
> > :(
> > > > >
> > > >
> > > > You can replace your util with ComponentRenderer#renderComponent()
> > > > https://github.com/apache/wicket/blob/70606d73e9165d37c1d8b7c7820279
> > > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> > core/util/string/
> > > > ComponentRenderer.java#L86
> > > > The problem here is that your helper page doesn't provide the
> > Fragment's
> > > > markup. Someone has to provide it.
> > > >
> > > >
> > > I have added following block to [2]
> > >
> >
> > No, you have not!
> > There is no 'fragment' in [2] and [3]
> > Or you did it locally ? Better create a branch and point us to it.
> >
> >
> > > <wicket:fragment wicket:id="subject"><span wicket:id="prefix"></span>
> > <span
> > > wicket:id="title"></span> <span
> > > wicket:id="start"></span> - <span wicket:id="end"></span></
> > > wicket:fragment>
> > >
> > > then I have added following code to [3]
> > >
> > > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > > f.add(new OmTextLabel("prefix", 1151L, langId)
> > > , new OmTextLabel("title", a.getTitle())
> > > , new OmTextLabel("start",
> > > CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
> > > tz))
> > > , new OmTextLabel("end",
> > > CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
> > tz))
> > > );
> > >
> > > so I I was hoping markup should be available .... but it's not :(
> > >
> > > [3]
> > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > service/mail/template/CreatedAppointmentTemplate.java
> > >
> > > [2]
> > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > service/mail/template/CreatedAppointmentTemplate.html#L33
> > >
> > >
> > > >
> > > > >
> > > > > The goal I'm trying to achieve is: store email subject as
> > > wicket:fragment
> > > > >
> > > > > Another question is: is it possible to edit markup like this
> > > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
> > > > > wicket:id="aa3"></span>
> > > > >
> > > > > to be able to remove some blocks without breaking the rendering
> > > > >
> > > > > so I can modify the markup something like this
> > > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> > wicket:remove>
> > > > >
> > > > > The java code will remain the same:
> > > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> > > > Label("aa3",
> > > > > "AA3"))
> > > > >
> > > >
> > > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > > >
> > > >
> > > Actually we have markup files unpacked, so end users can add some
> > > modifications to it
> > > So I need to let users to modify fragments without recompiling or java
> > > programming
> > > re-arraging blocks is OK, but removing ....
> > >
> >
> > I'm afraid you will need to use auto-components for such requirement.
> > E.g. <om:label ...> in the markup and IComponentResolver in Java that
> knows
> > what to do with such elements in the markup. E.g. it will instantiate a
> > Label and set its model by reading some special attribute.
> >
> >
> > >
> > >
> > >
> > > > >
> > > > > And I'll get
> > > > > <span>AA1</span>
> > > > > as a result without any errors/warnings
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > > > [1]
> > > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > > >
> > > > > --
> > > > > WBR
> > > > > Maxim aka solomax
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
Yes, the changes were local :(
Here is the quickstart: https://github.com/solomax/fragment-as-string

In case following line is uncommented
https://github.com/solomax/fragment-as-string/blob/master/src/main/java/org/apache/solomax/HomePage.java#L16
(next one should be commented)
Tests are fails with markup not found exception

Is it possible to create something like "wicket:visible" (or "om:visible")
tag+attribute so it can act as I call setVisible in Java?

On Fri, Oct 14, 2016 at 1:14 AM, Martin Grigorov <mg...@apache.org>
wrote:

> On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello Martin,
> >
> > Thanks for the quick response!
> >
> > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <mg...@apache.org>
> > wrote:
> >
> > > Hi Maxim,
> > >
> > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <
> solomax666@gmail.com>
> > > wrote:
> > >
> > > > Hello All,
> > > >
> > > > I'm successfully using following code [1] to get Panel as String
> > > > Unfortunately It is not possible to get Fragment as String this way
> :(
> > > >
> > >
> > > You can replace your util with ComponentRenderer#renderComponent()
> > > https://github.com/apache/wicket/blob/70606d73e9165d37c1d8b7c7820279
> > > fb4be18770/wicket-core/src/main/java/org/apache/wicket/
> core/util/string/
> > > ComponentRenderer.java#L86
> > > The problem here is that your helper page doesn't provide the
> Fragment's
> > > markup. Someone has to provide it.
> > >
> > >
> > I have added following block to [2]
> >
>
> No, you have not!
> There is no 'fragment' in [2] and [3]
> Or you did it locally ? Better create a branch and point us to it.
>
>
> > <wicket:fragment wicket:id="subject"><span wicket:id="prefix"></span>
> <span
> > wicket:id="title"></span> <span
> > wicket:id="start"></span> - <span wicket:id="end"></span></
> > wicket:fragment>
> >
> > then I have added following code to [3]
> >
> > Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> > f.add(new OmTextLabel("prefix", 1151L, langId)
> > , new OmTextLabel("title", a.getTitle())
> > , new OmTextLabel("start",
> > CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
> > tz))
> > , new OmTextLabel("end",
> > CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
> tz))
> > );
> >
> > so I I was hoping markup should be available .... but it's not :(
> >
> > [3]
> > https://github.com/apache/openmeetings/blob/3.1.x/
> > openmeetings-service/src/main/java/org/apache/openmeetings/
> > service/mail/template/CreatedAppointmentTemplate.java
> >
> > [2]
> > https://github.com/apache/openmeetings/blob/3.1.x/
> > openmeetings-service/src/main/java/org/apache/openmeetings/
> > service/mail/template/CreatedAppointmentTemplate.html#L33
> >
> >
> > >
> > > >
> > > > The goal I'm trying to achieve is: store email subject as
> > wicket:fragment
> > > >
> > > > Another question is: is it possible to edit markup like this
> > > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
> > > > wicket:id="aa3"></span>
> > > >
> > > > to be able to remove some blocks without breaking the rendering
> > > >
> > > > so I can modify the markup something like this
> > > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></
> wicket:remove>
> > > >
> > > > The java code will remain the same:
> > > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> > > Label("aa3",
> > > > "AA3"))
> > > >
> > >
> > > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> > >
> > >
> > Actually we have markup files unpacked, so end users can add some
> > modifications to it
> > So I need to let users to modify fragments without recompiling or java
> > programming
> > re-arraging blocks is OK, but removing ....
> >
>
> I'm afraid you will need to use auto-components for such requirement.
> E.g. <om:label ...> in the markup and IComponentResolver in Java that knows
> what to do with such elements in the markup. E.g. it will instantiate a
> Label and set its model by reading some special attribute.
>
>
> >
> >
> >
> > > >
> > > > And I'll get
> > > > <span>AA1</span>
> > > > as a result without any errors/warnings
> > > >
> > > > Thanks in advance!
> > > >
> > > > [1]
> > > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > > service/mail/template/AbstractTemplatePanel.java#L70
> > > >
> > > > --
> > > > WBR
> > > > Maxim aka solomax
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: (Customizable) Fragment as String

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello Martin,
>
> Thanks for the quick response!
>
> On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi Maxim,
> >
> > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> >
> > > Hello All,
> > >
> > > I'm successfully using following code [1] to get Panel as String
> > > Unfortunately It is not possible to get Fragment as String this way :(
> > >
> >
> > You can replace your util with ComponentRenderer#renderComponent()
> > https://github.com/apache/wicket/blob/70606d73e9165d37c1d8b7c7820279
> > fb4be18770/wicket-core/src/main/java/org/apache/wicket/core/util/string/
> > ComponentRenderer.java#L86
> > The problem here is that your helper page doesn't provide the Fragment's
> > markup. Someone has to provide it.
> >
> >
> I have added following block to [2]
>

No, you have not!
There is no 'fragment' in [2] and [3]
Or you did it locally ? Better create a branch and point us to it.


> <wicket:fragment wicket:id="subject"><span wicket:id="prefix"></span> <span
> wicket:id="title"></span> <span
> wicket:id="start"></span> - <span wicket:id="end"></span></
> wicket:fragment>
>
> then I have added following code to [3]
>
> Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
> f.add(new OmTextLabel("prefix", 1151L, langId)
> , new OmTextLabel("title", a.getTitle())
> , new OmTextLabel("start",
> CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
> tz))
> , new OmTextLabel("end",
> CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz))
> );
>
> so I I was hoping markup should be available .... but it's not :(
>
> [3]
> https://github.com/apache/openmeetings/blob/3.1.x/
> openmeetings-service/src/main/java/org/apache/openmeetings/
> service/mail/template/CreatedAppointmentTemplate.java
>
> [2]
> https://github.com/apache/openmeetings/blob/3.1.x/
> openmeetings-service/src/main/java/org/apache/openmeetings/
> service/mail/template/CreatedAppointmentTemplate.html#L33
>
>
> >
> > >
> > > The goal I'm trying to achieve is: store email subject as
> wicket:fragment
> > >
> > > Another question is: is it possible to edit markup like this
> > > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
> > > wicket:id="aa3"></span>
> > >
> > > to be able to remove some blocks without breaking the rendering
> > >
> > > so I can modify the markup something like this
> > > <span wicket:id="aa1"></span><wicket:remove> - <span
> > > wicket:id="aa2"></span> <span wicket:id="aa3"></span></wicket:remove>
> > >
> > > The java code will remain the same:
> > > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> > Label("aa3",
> > > "AA3"))
> > >
> >
> > Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
> >
> >
> Actually we have markup files unpacked, so end users can add some
> modifications to it
> So I need to let users to modify fragments without recompiling or java
> programming
> re-arraging blocks is OK, but removing ....
>

I'm afraid you will need to use auto-components for such requirement.
E.g. <om:label ...> in the markup and IComponentResolver in Java that knows
what to do with such elements in the markup. E.g. it will instantiate a
Label and set its model by reading some special attribute.


>
>
>
> > >
> > > And I'll get
> > > <span>AA1</span>
> > > as a result without any errors/warnings
> > >
> > > Thanks in advance!
> > >
> > > [1]
> > > https://github.com/apache/openmeetings/blob/3.1.x/
> > > openmeetings-service/src/main/java/org/apache/openmeetings/
> > > service/mail/template/AbstractTemplatePanel.java#L70
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: (Customizable) Fragment as String

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello Martin,

Thanks for the quick response!

On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi Maxim,
>
> On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello All,
> >
> > I'm successfully using following code [1] to get Panel as String
> > Unfortunately It is not possible to get Fragment as String this way :(
> >
>
> You can replace your util with ComponentRenderer#renderComponent()
> https://github.com/apache/wicket/blob/70606d73e9165d37c1d8b7c7820279
> fb4be18770/wicket-core/src/main/java/org/apache/wicket/core/util/string/
> ComponentRenderer.java#L86
> The problem here is that your helper page doesn't provide the Fragment's
> markup. Someone has to provide it.
>
>
I have added following block to [2]
<wicket:fragment wicket:id="subject"><span wicket:id="prefix"></span> <span
wicket:id="title"></span> <span
wicket:id="start"></span> - <span wicket:id="end"></span></wicket:fragment>

then I have added following code to [3]

Fragment f = new Fragment(TemplatePage.COMP_ID, "subject", this);
f.add(new OmTextLabel("prefix", 1151L, langId)
, new OmTextLabel("title", a.getTitle())
, new OmTextLabel("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz))
, new OmTextLabel("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz))
);

so I I was hoping markup should be available .... but it's not :(

[3]
https://github.com/apache/openmeetings/blob/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java

[2]
https://github.com/apache/openmeetings/blob/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html#L33


>
> >
> > The goal I'm trying to achieve is: store email subject as wicket:fragment
> >
> > Another question is: is it possible to edit markup like this
> > <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
> > wicket:id="aa3"></span>
> >
> > to be able to remove some blocks without breaking the rendering
> >
> > so I can modify the markup something like this
> > <span wicket:id="aa1"></span><wicket:remove> - <span
> > wicket:id="aa2"></span> <span wicket:id="aa3"></span></wicket:remove>
> >
> > The java code will remain the same:
> > comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new
> Label("aa3",
> > "AA3"))
> >
>
> Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))
>
>
Actually we have markup files unpacked, so end users can add some
modifications to it
So I need to let users to modify fragments without recompiling or java
programming
re-arraging blocks is OK, but removing ....



> >
> > And I'll get
> > <span>AA1</span>
> > as a result without any errors/warnings
> >
> > Thanks in advance!
> >
> > [1]
> > https://github.com/apache/openmeetings/blob/3.1.x/
> > openmeetings-service/src/main/java/org/apache/openmeetings/
> > service/mail/template/AbstractTemplatePanel.java#L70
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax

Re: (Customizable) Fragment as String

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

On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> I'm successfully using following code [1] to get Panel as String
> Unfortunately It is not possible to get Fragment as String this way :(
>

You can replace your util with ComponentRenderer#renderComponent()
https://github.com/apache/wicket/blob/70606d73e9165d37c1d8b7c7820279fb4be18770/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java#L86
The problem here is that your helper page doesn't provide the Fragment's
markup. Someone has to provide it.


>
> The goal I'm trying to achieve is: store email subject as wicket:fragment
>
> Another question is: is it possible to edit markup like this
> <span wicket:id="aa1"></span> - <span wicket:id="aa2"></span> <span
> wicket:id="aa3"></span>
>
> to be able to remove some blocks without breaking the rendering
>
> so I can modify the markup something like this
> <span wicket:id="aa1"></span><wicket:remove> - <span
> wicket:id="aa2"></span> <span wicket:id="aa3"></span></wicket:remove>
>
> The java code will remain the same:
> comp.add(new Label("aa1", "AA1"), new Label("aa2", "AA2"), new Label("aa3",
> "AA3"))
>

Just make aa2 and aa3 inviible (e.g. aa2.setVisible(false))


>
> And I'll get
> <span>AA1</span>
> as a result without any errors/warnings
>
> Thanks in advance!
>
> [1]
> https://github.com/apache/openmeetings/blob/3.1.x/
> openmeetings-service/src/main/java/org/apache/openmeetings/
> service/mail/template/AbstractTemplatePanel.java#L70
>
> --
> WBR
> Maxim aka solomax
>