Re: Wicket vs JS frameworks.

2016-10-14 Thread fzb
Thanks Martin for the reply.  Understood the points conveyed. 


Martin Grigorov-4 wrote
> It scales with the knowledge of the engineers.
> It is not just Wicket when you need big scale application.
> It goes from the OS configuration, to the selection of the databases, the
> web server config and good application code.

Is there any place or topic, where we consolidate all best practices &
learnings ?  


Martin Grigorov-4 wrote
> I personally try to use only technologies that *I* like, not because the
> marketing team of some company said that their product is the best.

Yes, agreed. But not just marketing team of that company, the industry trend
is more towards those JS frameworks like Angular, React etc.. So wanted to
know where do Wicket stand against those..  We wil be in a better position
to answer questions down the line.. As an Architect when you make decisions,
you need to stand by those and prove it..  This topic was intended to
clarify & get more insights to be able to make decision.

- fzb








--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771p4675798.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket vs JS frameworks.

2016-10-14 Thread Martin Grigorov
On Oct 15, 2016 3:05 AM, "fzb"  wrote:
>
> From the posts so far this is what i understand..
>
> 1. JS based apps are best suited for high scale applications.. It is worth
> the effort you take to build and maintain such apps..

One of my former client runs the biggest mail provider in Europe.
There the application was serving 200 000 users at normal load and 500 000
at peak times.
It is not like Facebook but also it is not the average web application.

>
> 2. Wicket can scale only to certain extent based on the server capacity ?
If
> so how to quantify ?
> (What about load balancing ? What about stateless pages ? Why it does not
> scale ?)

See above.
It scales with the knowledge of the engineers.
It is not just Wicket when you need big scale application.
It goes from the OS configuration, to the selection of the databases, the
web server config and good application code.

>
> 3. JS based apps resource availability is plenty.. So for new projects
> better to go with these ?
>  - What if the maintaining these apps becomes tedious due the cons of
these
> JS discussed earlier.
>
> May be some more insights will help us all understand, how to choose what
> depending on the scenarios in hand.

First you need to answer yourself what kind of application you need. What
is its target audience. What developers you have. Wicket is just a tool in
the box.
If you want to be developer above the average then experiment with new
technologies. Only this way you will have an opinion. I can tell you
anything good or bad about any technology  (they all have their
shortcomings) but this should not be a reason to use it or drop it from the
options.
I personally try to use only technologies that *I* like, not because the
marketing team of some company said that their product is the best.

Good luck!

>
> - fzb
>
>
>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771p4675796.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: Wicket vs JS frameworks.

2016-10-14 Thread fzb
>From the posts so far this is what i understand..  

1. JS based apps are best suited for high scale applications.. It is worth
the effort you take to build and maintain such apps.. 

2. Wicket can scale only to certain extent based on the server capacity ? If
so how to quantify ?
(What about load balancing ? What about stateless pages ? Why it does not
scale ?)  

3. JS based apps resource availability is plenty.. So for new projects
better to go with these ? 
 - What if the maintaining these apps becomes tedious due the cons of these
JS discussed earlier.

May be some more insights will help us all understand, how to choose what
depending on the scenarios in hand.

- fzb



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771p4675796.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: DropDownChoice with ChoiceRenderer

2016-10-14 Thread ganea iulia
:) yes, that was it:
@Override
public String getObject(String paramString, IModel> paramIModel) {
return paramString;
}

solved it:)

On Fri, Oct 14, 2016 at 4:03 PM, Per Newgro  wrote:

> Hello ganea,
>
> can you please investigate the method below?
>
> Hope that helps
> Per
>
> Am 14.10.2016 um 14:52 schrieb ganea iulia:
>
>> @Override
>> public String getObject(String paramString, IModel> extends
>> String>> paramIModel) {
>> // TODO Auto-generated method stub
>> return null;
>> }
>>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: DropDownChoice with ChoiceRenderer

2016-10-14 Thread Per Newgro

Hello ganea,

can you please investigate the method below?

Hope that helps
Per

Am 14.10.2016 um 14:52 schrieb ganea iulia:

@Override
public String getObject(String paramString, IModel> paramIModel) {
// TODO Auto-generated method stub
return null;
}




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



DropDownChoice with ChoiceRenderer

2016-10-14 Thread ganea iulia
Hello,
I'm using Wicket 7.
I have this simple use case where I need to have a dropdownchoice, where to
display some values, but the model should retain other values.
I have done the following, however, the model always retains null.

So my dropdownchoice should display Code1 and Code2 but save in the model
the values C1 or C2. Instead it always saves null.


==HTML==



Name:





Code:


[Code]


   


 




  




==JAVA==
public TestPage(IModel model) {
super(model);

TestForm tst = new TestForm("testForm", model);
tst.setOutputMarkupId(true);
add(tst);

}

class TestForm extends Form {
/**
*
*/
private static final long serialVersionUID = 1L;

public TestForm(String id, IModel model) {
super(id, model);

TextField txtName = new TextField("txtName", new
PropertyModel(getModelObject(), "name"));
add(txtName);
txtName.setOutputMarkupId(true);
//choice
List lst = new ArrayList();
lst.add("C1");
lst.add("C2");


ChoiceRenderer renderer = new ChoiceRenderer("code") {

private static final long serialVersionUID = 8875819661197521211L;

@Override
public Object getDisplayValue(String arg0) {
return (arg0.equals("C1") ? "Code1" : "Code2");
}

@Override
public String getIdValue(String arg0, int arg1) {
return arg0;
}

@Override
public String getObject(String paramString, IModel> paramIModel) {
// TODO Auto-generated method stub
return null;
}

};
DropDownChoice code = new DropDownChoice("code", lst,
renderer);
code.setOutputMarkupId(true);
code.setModel(new PropertyModel(getModelObject(), "code"));
add(code);
}

@Override
protected void onSubmit() {

logger.info("OnSubmit");
System.out.println("Code=" + getModelObject().getCode());

}
}

==Bean for the MODEL==
public class TestBean implements Serializable{

/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
private String code;
private Integer id;
public TestBean(String name, String code, Integer id) {
this.name = name;
this.code = code;
this.id = id;
}
public TestBean()
{
this.name = "";
this.code = "";
this.id =  null;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}

}


Bookmarkable link doesn't become a https link

2016-10-14 Thread Lars Törner
Hi,

we had a problem where a bookmarkable link didn't become a https link.

I found this:
https://cwiki.apache.org/confluence/display/WICKET/How+to+switch+to+SSL+mode

Which, with a warning,  states:

 "It is extemtely important that when setting the rootRequestMapper it is
done AFTER you have added any bookmarkable links otherwise they will not be
switched over to Secure mode."

I found that we in our Application.init() did the opposite, i.e. set the
rootRequestMapper before the page mounting. Problem solved, I thought.

Instead the problem was that the page wasn't mounted at all, and the only
thing that worked was to mount the page and keep the order we had, which,
according to the link and the warning above is bound to fail.

Please, can anyone tell me what I'm missing here?

Wicket version: 6.22.

Cheers
Lars


Re: Wicket vs JS frameworks.

2016-10-14 Thread Andrea Del Bene
The "new" JS Frameworks in combination with JSON have made quite cheap 
building CRUD web app. But there are a number of factors that I 
personally don't like at all with this type of solutions:


- they only work with single-page applications. period. SPA is not a 
silver-bullet, it's not the best solution for everything.
- the same can be stated for JSON. I might need to use another data 
format and maybe I might prefer a relational db instead of Mongo...
- hard to test your app in isolation. With wicket you can test your 
generated HTML without even using a server.
- standard "bending": you have to use something that is not pure HTML 
(custom tags, JSX, ...) and then COMPILE it to something standard (most 
of the time JS) :-(

- ...

My 3 cents.

On 14/10/2016 06:33, fzb wrote:

Hi,

I am a fan of Wicket & had been working on for last 6 to 7 yrs using the
same. Recently had evaluated few frameworks Angular, ReactJS etc in view of
developing new applications, I did not feel them appealing may be due to my
very bad java script knowledge.. if at all i learn and start working on it,
I felt I am not going to be productive on it. Currently I feel Wicket due to
its Component based is very much productive and helps to give the
consistency across application in terms of look n feel etc.

Just thought of hearing comments from others as well ..  Are those using
Wicket, using other frameworks as well.  Are there any combinations which
works well with Wicket or otherwise.

- fzb

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Thank you, works great.

On Fri, Oct 14, 2016 at 12:06 PM, Peter Henderson <
peter.hender...@starjar.com> wrote:

> Hi
>
> Change your markup to
>
> ...
> 
> ..
> 
> 
>
>
> 
> 
>
> 
> 
>
>
>
>
>
>
>
>
> On 14 October 2016 at 09:44, ganea iulia  wrote:
>
> > Hello Per, thank you for the links.
> >
> > I have following html code:
> >
> > 
> >   
> >  > width="100%">
> > 
> > 
> > Name
> > Code
> > 
> > 
> > Id
> > 
> > 
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  
> >
> > The Java code looks like this:
> >
> > public TestPage(IModel model) {
> > super(model);
> >
> > TestForm tst = new TestForm("testForm", model);
> > tst.setOutputMarkupId(true);
> > add(tst);
> >
> > }
> >
> > class TestForm extends Form {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> > public TestForm(String id, IModel model) {
> > super(id, model);
> >
> > List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
> > new TestBean("Name2", "Code2", 2));
> > add(new ListView("forEachItem", beans) {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > protected void populateItem(ListItem item) {
> >   item.add(new Label("itemName", new PropertyModel(item.getModel(),
> > "name")));
> >   item.add(new Label("itemCode", new PropertyModel(item.getModel(),
> > "code")));
> >   item.add(new Label("itemId", new PropertyModel(item.getModel(),
> "id")));
> > }
> >   });
> > }
> >
> > @Override
> > protected void onSubmit() {
> >
> > logger.info("OnSubmit");
> >
> > }
> > }
> >
> > The code crashes here because itemId belongs to another row.
> > Could you please advise?
> >
> > Thank you
> >
> >
> >
> > On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:
> >
> > > Hello ganea,
> > >
> > > you can find many information about your problem at
> > > http://examples7x.wicket.apache.org/index.html
> > > espacially
> > > http://examples7x.wicket.apache.org/repeater
> > >
> > > The user guide can you find here
> > > https://ci.apache.org/projects/wicket/guide/7.x/
> > > Repeaters are explained here
> > > https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
> > >
> > > You can add a markup container to a list view item and add the required
> > > row components to it.
> > >
> > > Hope that helps
> > > Per
> > >
> > >
> > > Am 14.10.2016 um 09:16 schrieb ganea iulia:
> > >
> > >> Hello,
> > >>
> > >> I have in the html file, a table where I need to repeat every two
> rows.
> > >> So, my table is backed by a bean, where the bean values fill 2 rows of
> > the
> > >> table.
> > >> When new bean instance is created, I need to add new 2 rows to the
> > table.
> > >>
> > >> Thank you
> > >>
> > >>
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Peter Henderson
>
> Director
> Starjar Ltd.
> www.starjar.com
> 0330 088 1662
>


Re: Repeat every 2 rows in a table

2016-10-14 Thread Peter Henderson
Hi

Change your markup to

...

..


   
   


   










On 14 October 2016 at 09:44, ganea iulia  wrote:

> Hello Per, thank you for the links.
>
> I have following html code:
>
> 
>   
>  width="100%">
> 
> 
> Name
> Code
> 
> 
> Id
> 
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
>
> The Java code looks like this:
>
> public TestPage(IModel model) {
> super(model);
>
> TestForm tst = new TestForm("testForm", model);
> tst.setOutputMarkupId(true);
> add(tst);
>
> }
>
> class TestForm extends Form {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> public TestForm(String id, IModel model) {
> super(id, model);
>
> List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
> new TestBean("Name2", "Code2", 2));
> add(new ListView("forEachItem", beans) {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> @Override
> protected void populateItem(ListItem item) {
>   item.add(new Label("itemName", new PropertyModel(item.getModel(),
> "name")));
>   item.add(new Label("itemCode", new PropertyModel(item.getModel(),
> "code")));
>   item.add(new Label("itemId", new PropertyModel(item.getModel(), "id")));
> }
>   });
> }
>
> @Override
> protected void onSubmit() {
>
> logger.info("OnSubmit");
>
> }
> }
>
> The code crashes here because itemId belongs to another row.
> Could you please advise?
>
> Thank you
>
>
>
> On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:
>
> > Hello ganea,
> >
> > you can find many information about your problem at
> > http://examples7x.wicket.apache.org/index.html
> > espacially
> > http://examples7x.wicket.apache.org/repeater
> >
> > The user guide can you find here
> > https://ci.apache.org/projects/wicket/guide/7.x/
> > Repeaters are explained here
> > https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
> >
> > You can add a markup container to a list view item and add the required
> > row components to it.
> >
> > Hope that helps
> > Per
> >
> >
> > Am 14.10.2016 um 09:16 schrieb ganea iulia:
> >
> >> Hello,
> >>
> >> I have in the html file, a table where I need to repeat every two rows.
> >> So, my table is backed by a bean, where the bean values fill 2 rows of
> the
> >> table.
> >> When new bean instance is created, I need to add new 2 rows to the
> table.
> >>
> >> Thank you
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>



-- 
Peter Henderson

Director
Starjar Ltd.
www.starjar.com
0330 088 1662


Re: Wicket vs JS frameworks.

2016-10-14 Thread fzb
Tobias Soloschenko wrote
> I think because Wicket uses HTML5 and Java you can combine JS Frameworks
> with many of the features of Wicket. Example: Because you have a java
> backend you can build a rest API with wicket-rest-annotations and
> configure your Angular JS to work with it - if you have a page change you
> could use Wicket components and even the pages could be served with Wicket
> containing the Angular content.

Yes, we can embed some components from React or Angular if this works. But
again maintaining compatibility over release cycles is an issue..  If there
was some built in mechanism in wicket, it would be ideal. 


Is any one attending this conf ? ApacheCon Europe 2016
https://apacheconeu2016.sched.org/event/8UL4?iframe=no

May be he might touch up on these topics ? If any one attend, please post .. 





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771p4675785.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Hello Per, thank you for the links.

I have following html code:


  



Name
Code


Id



   









 

The Java code looks like this:

public TestPage(IModel model) {
super(model);

TestForm tst = new TestForm("testForm", model);
tst.setOutputMarkupId(true);
add(tst);

}

class TestForm extends Form {
/**
*
*/
private static final long serialVersionUID = 1L;

public TestForm(String id, IModel model) {
super(id, model);

List beans = Arrays.asList(new TestBean("Name1", "Code1", 1),
new TestBean("Name2", "Code2", 2));
add(new ListView("forEachItem", beans) {
/**
*
*/
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItem item) {
  item.add(new Label("itemName", new PropertyModel(item.getModel(),
"name")));
  item.add(new Label("itemCode", new PropertyModel(item.getModel(),
"code")));
  item.add(new Label("itemId", new PropertyModel(item.getModel(), "id")));
}
  });
}

@Override
protected void onSubmit() {

logger.info("OnSubmit");

}
}

The code crashes here because itemId belongs to another row.
Could you please advise?

Thank you



On Fri, Oct 14, 2016 at 10:29 AM, Per Newgro  wrote:

> Hello ganea,
>
> you can find many information about your problem at
> http://examples7x.wicket.apache.org/index.html
> espacially
> http://examples7x.wicket.apache.org/repeater
>
> The user guide can you find here
> https://ci.apache.org/projects/wicket/guide/7.x/
> Repeaters are explained here
> https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html
>
> You can add a markup container to a list view item and add the required
> row components to it.
>
> Hope that helps
> Per
>
>
> Am 14.10.2016 um 09:16 schrieb ganea iulia:
>
>> Hello,
>>
>> I have in the html file, a table where I need to repeat every two rows.
>> So, my table is backed by a bean, where the bean values fill 2 rows of the
>> table.
>> When new bean instance is created, I need to add new 2 rows to the table.
>>
>> Thank you
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket vs JS frameworks.

2016-10-14 Thread fzb
Ernesto Reinaldo Barreiro-4 wrote
> 2- In some places, companies I have worked for as consultant, I have seen
> projects that they considered complex because the JS paraphernalia. They
> were be just trivial using Wicket. The sad thing is they did not have any
> need to scale. So, something like wicket was more than a perfect fit. 

Very much true. I am working on a system, where it is a mid or small (100 to
250 users) scaling requirement... I felt wicket is more than sufficient for
this. But I do have some issues, i will post a separate topic on the issues
to get clarified. This is more general topic.


Ernesto Reinaldo Barreiro-4 wrote
> They all used REST and some JS machinery (they also did not plan for
> mobile so
> REST was not needed). Some of these applications were not very DRY... and
> REST layer was kind of a mess where you never knew for sure what was
> actually used and not.

REST should not be a criteria for going with JS based systems.  We do have
mobile apps, we expose REST services using Spring. We dont need the same
data in web & mobile most of the time. For mobile it is very much limited.
So having a separate REST layer works well.

Lets wait n hear from some more experts on this topic. People who had done
lot of apps on JS side & Wicket side will be a good candidate, not being
Biased :) 











--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-vs-JS-frameworks-tp4675771p4675783.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Clear input form values

2016-10-14 Thread ganea iulia
Hello,
But that was it.
The code contained both the
txtName.setOutputMarkupId(true) and the
txtName.add(new AjaxFormComponentUpdatingBehavior("change") { ...


I will paste all the code again (I have now only added the
txtLink.setOutputMarkupId(true) and the TestForm.setOutputMarkupId(true); )
Thank you

==HTML code==



Name:












==JAVA CODE==

public class TestPage extends WebPage {

private static final long serialVersionUID = 311508940740808005L;
private static final Logger logger = LogManager.getLogger(TestPage.class);

public TestPage(IModel model) {
super(model);

TestForm tst = new TestForm("testForm", model);
tst.setOutputMarkupId(true);
add(tst);

}

class TestForm extends Form {
/**
*
*/
private static final long serialVersionUID = 1L;

public TestForm(String id, IModel model) {
super(id, model);

TextField txtName = new TextField("txtName", new
PropertyModel(getModelObject(), "name"));
add(txtName);
txtName.setOutputMarkupId(true);
txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1654345477970524731L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(txtName);
}

});

AjaxLink clearLink = new AjaxLink("clearLink", model)
{
/**
*
*/
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
model.setObject(new TestBean());
TestForm.this.clearInput();
target.add(TestForm.this);

}

};
clearLink.setOutputMarkupId(true);
add(clearLink);
}

@Override
protected void onSubmit() {

logger.info("OnSubmit");

}
}


}


==THE BEAN==

import java.io.Serializable;

public class TestBean implements Serializable{

/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
private String code;
private Integer id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}

}



On Fri, Oct 14, 2016 at 10:43 AM, Martin Grigorov 
wrote:

> We can only advise on the code that you give us.
> Your real code may not work for many other reasons but since you give us
> some incomplete copies of it we have no idea what is wrong.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 14, 2016 at 9:33 AM, ganea iulia 
> wrote:
>
> > Hello,
> >
> > The txtName field has the .setOutputMarkupId(true).
> > I have also added it to the form.
> > But it doesn't work howevere.
> > I have event tested adding it to the txtLink, but still no change.
> >
> > However, the issue appears to come from the
> > txtName.add(new AjaxFormComponentUpdatingBehavior("change") {...}
> >
> > If I comment out this part, the clear is done.
> > But I need to have this behaviour kept.
> >
> > Could you please advise?
> > Thank you
> >
> >
> > On Fri, Oct 14, 2016 at 10:10 AM, Martin Grigorov 
> > wrote:
> >
> > > On Fri, Oct 14, 2016 at 9:01 AM, ganea iulia 
> > > wrote:
> > >
> > > > Hello,
> > > >
> > > > I'm using Wicket 7.
> > > >
> > > > Please help me with the following.
> > > >
> > > > I have a test form, with only one input text field on it.
> > > > When pressing on a link, I need to have the values in the form
> cleared
> > > out.
> > > >
> > > > This is the html and java code, but I could not make it work, the
> input
> > > > field just won't clear.
> > > >
> > > > 
> > > >  > > > width="100%">
> > > > 
> > > > Name:
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  > > > name="btnClear" />
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > >
> > > >
> > > > public TestPage(IModel model, final ReturnObjectPage
> > > returnPage)
> > > > {
> > > > super(model);
> > > > this.returnPage = returnPage;
> > > >
> > >
> > > Don't keep references to other pages.
> > > Use PageReference instead.
> > >
> > >
> > > >
> > > > add(new TestForm("testForm", model));
> > > >
> > > > }
> > > >
> > > > class TestForm extends Form {
> > > > /**
> > > > *
> > > > */
> > > > private static final long serialVersionUID = 1L;
> > > >
> > > >
> > > > public TestForm(String id, IModel model) {
> > > > super(id, model);
> > > > TextField txtName = new TextField("txtName", new
> > > > PropertyModel(getModelObject(), "name"));
> > > > add(txtName);
> > > > txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
> > > > private static final long serialVersionUID = 1654345477970524731L;
> > > >
> > > > @Override
> > > > protected void onUpdate(AjaxRequestTarget target) {
> > > > target.add(txtName);
> > > > }
> > > >
> > > > });
> > > > txtName.setOutputMarkupId(true);
> > > > AjaxLink clearLink = new AjaxLink("clearLink",
> > > model)
> > > > {
> > > > /**
> > > > *
> > > > */
> > > > private static final long serialVersionUID = 1L;
> > > >
> > > > @Override
> > > > public void onClick(AjaxRequestTarget target) {
> > > > model.setObject(

Re: Clear input form values

2016-10-14 Thread Martin Grigorov
We can only advise on the code that you give us.
Your real code may not work for many other reasons but since you give us
some incomplete copies of it we have no idea what is wrong.

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

On Fri, Oct 14, 2016 at 9:33 AM, ganea iulia  wrote:

> Hello,
>
> The txtName field has the .setOutputMarkupId(true).
> I have also added it to the form.
> But it doesn't work howevere.
> I have event tested adding it to the txtLink, but still no change.
>
> However, the issue appears to come from the
> txtName.add(new AjaxFormComponentUpdatingBehavior("change") {...}
>
> If I comment out this part, the clear is done.
> But I need to have this behaviour kept.
>
> Could you please advise?
> Thank you
>
>
> On Fri, Oct 14, 2016 at 10:10 AM, Martin Grigorov 
> wrote:
>
> > On Fri, Oct 14, 2016 at 9:01 AM, ganea iulia 
> > wrote:
> >
> > > Hello,
> > >
> > > I'm using Wicket 7.
> > >
> > > Please help me with the following.
> > >
> > > I have a test form, with only one input text field on it.
> > > When pressing on a link, I need to have the values in the form cleared
> > out.
> > >
> > > This is the html and java code, but I could not make it work, the input
> > > field just won't clear.
> > >
> > > 
> > >  > > width="100%">
> > > 
> > > Name:
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > >  > > name="btnClear" />
> > > 
> > > 
> > > 
> > > 
> > >
> > >
> > >
> > > public TestPage(IModel model, final ReturnObjectPage
> > returnPage)
> > > {
> > > super(model);
> > > this.returnPage = returnPage;
> > >
> >
> > Don't keep references to other pages.
> > Use PageReference instead.
> >
> >
> > >
> > > add(new TestForm("testForm", model));
> > >
> > > }
> > >
> > > class TestForm extends Form {
> > > /**
> > > *
> > > */
> > > private static final long serialVersionUID = 1L;
> > >
> > >
> > > public TestForm(String id, IModel model) {
> > > super(id, model);
> > > TextField txtName = new TextField("txtName", new
> > > PropertyModel(getModelObject(), "name"));
> > > add(txtName);
> > > txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
> > > private static final long serialVersionUID = 1654345477970524731L;
> > >
> > > @Override
> > > protected void onUpdate(AjaxRequestTarget target) {
> > > target.add(txtName);
> > > }
> > >
> > > });
> > > txtName.setOutputMarkupId(true);
> > > AjaxLink clearLink = new AjaxLink("clearLink",
> > model)
> > > {
> > > /**
> > > *
> > > */
> > > private static final long serialVersionUID = 1L;
> > >
> > > @Override
> > > public void onClick(AjaxRequestTarget target) {
> > > model.setObject(new TestBean());
> > > TestForm.this.clearInput();
> > > target.add(TestForm.this);
> > > target.add(txtName);
> > >
> >
> > 1. There is no need to add 'txtName' to the target because its parent
> > (TestForm) is added
> > 2. Neither of them have .setOutputMarkupId(true), so Wicket won't be able
> > to update them in the DOM. It should even complain about this.
> >
> >
> > > }
> > >
> > > };
> > > add(clearLink);
> > > }
> > > @Override
> > > protected void onSubmit() {
> > >
> > > logger.info("OnSubmit");
> > >
> > > }
> > > }
> > >
> >
>


Re: Clear input form values

2016-10-14 Thread ganea iulia
Hello,

The txtName field has the .setOutputMarkupId(true).
I have also added it to the form.
But it doesn't work howevere.
I have event tested adding it to the txtLink, but still no change.

However, the issue appears to come from the
txtName.add(new AjaxFormComponentUpdatingBehavior("change") {...}

If I comment out this part, the clear is done.
But I need to have this behaviour kept.

Could you please advise?
Thank you


On Fri, Oct 14, 2016 at 10:10 AM, Martin Grigorov 
wrote:

> On Fri, Oct 14, 2016 at 9:01 AM, ganea iulia 
> wrote:
>
> > Hello,
> >
> > I'm using Wicket 7.
> >
> > Please help me with the following.
> >
> > I have a test form, with only one input text field on it.
> > When pressing on a link, I need to have the values in the form cleared
> out.
> >
> > This is the html and java code, but I could not make it work, the input
> > field just won't clear.
> >
> > 
> >  > width="100%">
> > 
> > Name:
> > 
> > 
> > 
> > 
> > 
> > 
> >  > name="btnClear" />
> > 
> > 
> > 
> > 
> >
> >
> >
> > public TestPage(IModel model, final ReturnObjectPage
> returnPage)
> > {
> > super(model);
> > this.returnPage = returnPage;
> >
>
> Don't keep references to other pages.
> Use PageReference instead.
>
>
> >
> > add(new TestForm("testForm", model));
> >
> > }
> >
> > class TestForm extends Form {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> >
> > public TestForm(String id, IModel model) {
> > super(id, model);
> > TextField txtName = new TextField("txtName", new
> > PropertyModel(getModelObject(), "name"));
> > add(txtName);
> > txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
> > private static final long serialVersionUID = 1654345477970524731L;
> >
> > @Override
> > protected void onUpdate(AjaxRequestTarget target) {
> > target.add(txtName);
> > }
> >
> > });
> > txtName.setOutputMarkupId(true);
> > AjaxLink clearLink = new AjaxLink("clearLink",
> model)
> > {
> > /**
> > *
> > */
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > public void onClick(AjaxRequestTarget target) {
> > model.setObject(new TestBean());
> > TestForm.this.clearInput();
> > target.add(TestForm.this);
> > target.add(txtName);
> >
>
> 1. There is no need to add 'txtName' to the target because its parent
> (TestForm) is added
> 2. Neither of them have .setOutputMarkupId(true), so Wicket won't be able
> to update them in the DOM. It should even complain about this.
>
>
> > }
> >
> > };
> > add(clearLink);
> > }
> > @Override
> > protected void onSubmit() {
> >
> > logger.info("OnSubmit");
> >
> > }
> > }
> >
>


Re: Repeat every 2 rows in a table

2016-10-14 Thread Per Newgro

Hello ganea,

you can find many information about your problem at
http://examples7x.wicket.apache.org/index.html
espacially
http://examples7x.wicket.apache.org/repeater

The user guide can you find here
https://ci.apache.org/projects/wicket/guide/7.x/
Repeaters are explained here
https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html

You can add a markup container to a list view item and add the required 
row components to it.


Hope that helps
Per

Am 14.10.2016 um 09:16 schrieb ganea iulia:

Hello,

I have in the html file, a table where I need to repeat every two rows.
So, my table is backed by a bean, where the bean values fill 2 rows of the
table.
When new bean instance is created, I need to add new 2 rows to the table.

Thank you




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



Repeat every 2 rows in a table

2016-10-14 Thread ganea iulia
Hello,

I have in the html file, a table where I need to repeat every two rows.
So, my table is backed by a bean, where the bean values fill 2 rows of the
table.
When new bean instance is created, I need to add new 2 rows to the table.

Thank you


Re: (Customizable) Fragment as String

2016-10-14 Thread Maxim Solodovnik
Many thanks :)

On Fri, Oct 14, 2016 at 2:12 PM, Martin Grigorov 
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 
> 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 
> > wrote:
> >
> > > 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:id="title">  > > > wicket:id="start"> -  > > > 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
> > > > > >  - 
>  > > > > > wicket:id="aa3">
> > > > > >
> > > > > > to be able to remove some blocks without breaking the rendering
> > > > > >
> > > > > > so I can modify the markup something like this
> > > > > >  -  > > > > > wicket:id="aa2">  > > 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.  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
> > > > > > AA1
> > > > > > 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

Re: (Customizable) Fragment as String

2016-10-14 Thread Martin Grigorov
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 
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 
> wrote:
>
> > On Thu, Oct 13, 2016 at 6:49 PM, Maxim Solodovnik 
> > 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:id="title">  > > wicket:id="start"> -  > > 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
> > > > >  -   > > > > wicket:id="aa3">
> > > > >
> > > > > to be able to remove some blocks without breaking the rendering
> > > > >
> > > > > so I can modify the markup something like this
> > > > >  -  > > > > wicket:id="aa2">  > 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.  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
> > > > > AA1
> > > > > 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: Clear input form values

2016-10-14 Thread Martin Grigorov
On Fri, Oct 14, 2016 at 9:01 AM, ganea iulia  wrote:

> Hello,
>
> I'm using Wicket 7.
>
> Please help me with the following.
>
> I have a test form, with only one input text field on it.
> When pressing on a link, I need to have the values in the form cleared out.
>
> This is the html and java code, but I could not make it work, the input
> field just won't clear.
>
> 
>  width="100%">
> 
> Name:
> 
> 
> 
> 
> 
> 
>  name="btnClear" />
> 
> 
> 
> 
>
>
>
> public TestPage(IModel model, final ReturnObjectPage returnPage)
> {
> super(model);
> this.returnPage = returnPage;
>

Don't keep references to other pages.
Use PageReference instead.


>
> add(new TestForm("testForm", model));
>
> }
>
> class TestForm extends Form {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
>
> public TestForm(String id, IModel model) {
> super(id, model);
> TextField txtName = new TextField("txtName", new
> PropertyModel(getModelObject(), "name"));
> add(txtName);
> txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
> private static final long serialVersionUID = 1654345477970524731L;
>
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> target.add(txtName);
> }
>
> });
> txtName.setOutputMarkupId(true);
> AjaxLink clearLink = new AjaxLink("clearLink", model)
> {
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> model.setObject(new TestBean());
> TestForm.this.clearInput();
> target.add(TestForm.this);
> target.add(txtName);
>

1. There is no need to add 'txtName' to the target because its parent
(TestForm) is added
2. Neither of them have .setOutputMarkupId(true), so Wicket won't be able
to update them in the DOM. It should even complain about this.


> }
>
> };
> add(clearLink);
> }
> @Override
> protected void onSubmit() {
>
> logger.info("OnSubmit");
>
> }
> }
>


Clear input form values

2016-10-14 Thread ganea iulia
Hello,

I'm using Wicket 7.

Please help me with the following.

I have a test form, with only one input text field on it.
When pressing on a link, I need to have the values in the form cleared out.

This is the html and java code, but I could not make it work, the input
field just won't clear.




Name:














public TestPage(IModel model, final ReturnObjectPage returnPage) {
super(model);
this.returnPage = returnPage;

add(new TestForm("testForm", model));

}

class TestForm extends Form {
/**
*
*/
private static final long serialVersionUID = 1L;


public TestForm(String id, IModel model) {
super(id, model);
TextField txtName = new TextField("txtName", new
PropertyModel(getModelObject(), "name"));
add(txtName);
txtName.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1654345477970524731L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
target.add(txtName);
}

});
txtName.setOutputMarkupId(true);
AjaxLink clearLink = new AjaxLink("clearLink", model)
{
/**
*
*/
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
model.setObject(new TestBean());
TestForm.this.clearInput();
target.add(TestForm.this);
target.add(txtName);
}

};
add(clearLink);
}
@Override
protected void onSubmit() {

logger.info("OnSubmit");

}
}