On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik <solomax...@gmail.com> wrote:
> Hello Martin, > > Thanks for the quick response! > > On Thu, Oct 13, 2016 at 11:39 PM, Martin Grigorov <mgrigo...@apache.org> > wrote: > > > Hi Maxim, > > > > On Thu, Oct 13, 2016 at 6:10 PM, Maxim Solodovnik <solomax...@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 >