Re: Freemarker+ExtJS vs Wicket questions

2011-12-04 Thread Martin Grigorov
Hi,

I don't want to convince you anyhow. Just responding to your
questions/observations.

On Sun, Dec 4, 2011 at 6:30 AM, Andrei Voden are...@gmail.com wrote:
 Hi. I have been developing for a while using Freemarker + some JS
 frameworks (like ExtJS, Dojo and JQuery) and Java as Model building on
 back-end. Now I hear lots of talks about Wicket so Im trying to understand
 pros and cons. After reading intro in Wicket I have mixed feelings. Below
 are my conclusions. I know Im biased but dont take it as offense. Instead
 rather as my misunderstanding since Im really trying to see if Wicket
 is thing to switch to.

 Pros:

 -Seems like this is good for companies where you have Java programmers that
 you can now utilize for building Front-end.

True, only if you are a pure consumer of component libraries.
Once you start writing your own components you'll need knowledge in JS/CSS.


 - Clean HTML code and all logic handled by Java.

This is a real pros, imo.


 - Quick to start building simple apps that fall into the box of the
 framework.

 - No JScript or HTML/CSS knowledge needed. Can separate easier Frot-end and
 Back-end developers -- easier to hire.

Partially true.
I think both developers should know something about the technology of
the other. Not details, but something. Otherwise they cannot meet in
the middle.


 Cons:

 - On other hand, as Front-end developer this looks weird to me since I feel
 like I don't have full control of JScript code.

 1) Since Wicket uses Java for generating HTML/CSS/JScript UI controls for
 me meaning if I need to tweak those controls outside of their box it maybe
 problematic. In my experience any framework good until you start doing
 something different from what it was intended and then you can spend more
 time trying to do simple out of box thing then using native JScript. Is
 there JScript sources for Wicket controls?

Well written component should provide means to be extended and
customized. Most of the components should not generate JS and/or CSS.
The resources should be delivered with the components (see
ResourceReference) and the Java part of the component should just call
JS functions.
E.g.: AjaxRequestTarget.appendJavaScript(myJsLib.doSomething())
and this call should be made so it is easy for the consumer of the
component to replace it with something else.


 2) Prototyping: using Freemarker I can do changes and simply refresh page.
 In case of Wicket I need to recompile.

For prototyping this is OK but in long term the static types and the
unit tests are more valuable ;-)
But for prototyping (small app) you can use embedded Jetty (see
Start.java in Wicket's quickstart app) and this is quite fast.



 3) Logic blocks: Looks like Wicket allows injection of values into HTML
 tags with wicket: attribute but how do you handle block logic like
 IF(condition) then {use HTML block1} else { use another HTML block}?

This is done at the server side:
if (condition) {
  add(panelA)
} else {
  add(panelB)
}

If the block is something really reusable then you should use Panel,
otherwise you can use Fragment instead.


 4) Non html data templating: often during page generation I compose some
 AJAX data from FreeMarker inside tag. How do I do similar things from
 Wicket?

It is still possible. Wicket's Ajax behaviors can give you callback
url to the component at the server side. So you can ask the component
to do something and with AjaxRequestTarget.appendJavaScript() you can
return any string response (like JSON, XML, ...) and handle this
response with any JS templating system.
See the behavior used for
https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/autocomplete-tagit-parent/autocomplete-tagit
. It returns JSON which is consumed by JQuery UI autocompleter.


 5) Is it harder/simpler to create custom UI controls in Wicket vs using say
 Dojo, ExtJS or JQuery?

The best is to integrate them. See 4) above for integration of Wicket
with JQuery UI component.
Once integrated you can give this component to a Java developer who
don't know JS at all and she can use it in her app.


 Andrei



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

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



Re: Freemarker+ExtJS vs Wicket questions

2011-12-04 Thread Andrei Voden
Thank you for your input. Really helping me to grasp it.
Question on #4 in Cons: what I ment is to generate templated content
outside of the tags. Like for example I have:
script
.templated code.
/script
Is that doable? Sorry if that sounds newbeesh.

Andrei


Re: Freemarker+ExtJS vs Wicket questions

2011-12-04 Thread Martin Grigorov
o.a.w.Component and Behavior classes have method #renderHead(IHeaderResponse)

with IHeaderResponse#renderXyz methods you can contribute JS, CSS and
plain text to the page. It is up to you how you'll generate the
constribution.
In TagIt component I used TextTemplate to prepare the template and
populate it but you can use anything, even FreeMarker to do that. in
wicket-velocity module we do the same with Velocity.

Additionally when you use Wicket Ajax functionality you can use
AjaxRequestTarget.(pre|ap)pendJavaScript() methods to contribute JS
respectively before and after the replacement of the components'
markup.

On Sun, Dec 4, 2011 at 11:04 AM, Andrei Voden are...@gmail.com wrote:
 Thank you for your input. Really helping me to grasp it.
 Question on #4 in Cons: what I ment is to generate templated content
 outside of the tags. Like for example I have:
 script
 .templated code.
 /script
 Is that doable? Sorry if that sounds newbeesh.

 Andrei



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

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



Event or Notice when a ListView's Model changes

2011-12-04 Thread hfriederichs
Hello,

I have a Wicket ListView, who's Model is based on a select on a
process-database. Users can initiate a (deploy-)process, and when the
process is finished, a row is added in the database, and so also in the
ListView's Model's backing List. When this happens, I want to rerender
another part of the same Panel. That other part has it's own Form. So I need
an event when a row is added. The Wicket Events to send after that I can
figure out for myself, my concern is about reacting to the database inserts.
I tried various methods, onChange and the like, on various components, but
to no avail. 

Please help, I'm using Wicket 1.5.3

Regards,

Hans

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157030.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread Andrea Del Bene

Hi,

have you tried overriding onModelChanged()? You can fire event in this 
method.

Hello,

I have a Wicket ListView, who's Model is based on a select on a
process-database. Users can initiate a (deploy-)process, and when the
process is finished, a row is added in the database, and so also in the
ListView's Model's backing List. When this happens, I want to rerender
another part of the same Panel. That other part has it's own Form. So I need
an event when a row is added. The Wicket Events to send after that I can
figure out for myself, my concern is about reacting to the database inserts.
I tried various methods, onChange and the like, on various components, but
to no avail.

Please help, I'm using Wicket 1.5.3

Regards,

Hans

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157030.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread hfriederichs
Yes, I'm sorry, I wrote /I tried various methods, onChange and the like/ by
which I meant onModelChanged(). But onModelChanged() isn't called when a row
is added. I think that makes sense, because the backing List on itself
hasn't changed.
Furthermore, I experimented by replacing the ListView by a DataView, but no
calling of onModelChanged() there either.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157831.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: Internationalization on panels

2011-12-04 Thread cosmindumy
Hi again, 
I have the same problems with table header columns internationalization. 
This is what I use:

-columns.add(new PropertyColumnUser(new ModelString(new
ResourceModel(name.name, Default).getObject()), age, age));
-columns.add(new PropertyColumnUser(new
ModelString(getString(name.name)), name, name));

It seems it doesn't find the property name.name with ResourceModel and it
displays Default. This property exists. as for the second columns it
displays. Do you have any idea? Is there other solution to pass the property
to the PropertyColumn?
Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4157832.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread Martin Grigorov
call manually listview.modelChanged() after the update of its List
this will call onModelChanged

On Sun, Dec 4, 2011 at 8:37 PM, hfriederichs h.friederi...@ohra.nl wrote:
 Yes, I'm sorry, I wrote /I tried various methods, onChange and the like/ by
 which I meant onModelChanged(). But onModelChanged() isn't called when a row
 is added. I think that makes sense, because the backing List on itself
 hasn't changed.
 Furthermore, I experimented by replacing the ListView by a DataView, but no
 calling of onModelChanged() there either.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157831.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




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

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



Re: Internationalization on panels

2011-12-04 Thread cosmindumy
It works with 
columns.add(new PropertyColumnUser(new ResourceModel(name.name,
Default), age, age));

but I don't understand why it didn't find property with the first variant.
 columns.add(new PropertyColumnUser(new ModelString(new
ResourceModel(name.name, Default).getObject()), age, age));

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4157887.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread hfriederichs
But the List isn't updated by a user's action. There's a decoupling here: the
user's action inserts a row that has a 'state-column' that's initialized
with, let's call it 'unfinished'. The processes are executed asynchronously
by another thread, that, after some minutes, updates the state-column to
'finished'.
My ListView represents a list of finished processes, so you can never know
when the selection on the database changes. So how do I know when an update
has taken place? I need a sort of listener there.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158107.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread Igor Vaynberg
the label that outputs the status can keep its last status, and in
onbeforerender can check if the new status coming from the model is
different then the old. if it is, it can fire the event.

-igor

On Sun, Dec 4, 2011 at 12:59 PM, hfriederichs h.friederi...@ohra.nl wrote:
 But the List isn't updated by a user's action. There's a decoupling here: the
 user's action inserts a row that has a 'state-column' that's initialized
 with, let's call it 'unfinished'. The processes are executed asynchronously
 by another thread, that, after some minutes, updates the state-column to
 'finished'.
 My ListView represents a list of finished processes, so you can never know
 when the selection on the database changes. So how do I know when an update
 has taken place? I need a sort of listener there.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158107.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread hfriederichs
I'm sorry if my writing is confusing. But there isn't a label that outputs
the state, because the list shows /only/ finished processes. 
Maybe the following flow explains what happens:
- A user chooses an application he wants to deploy to a certain stage, let's
say production
- When he has chosen, a label shows the current version of the application
in production
- The user clicks the 'deploybutton', as a result of which a row is inserted
with state 'unfinished'
- Another thread picks up the process and executes a script that deploys the
application
- At the end of this, that other thread updates the state-field to
'finished'
- At the bottom of the panel my listview with finished processes is updated,
and the user will notice that because I added a
AjaxSelfUpdatingTimerBehavior.
- But when the list is refreshed I want the version label that I mentioned
in the beginning to be refreshed also, because there's a new current version

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158203.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: Internationalization on panels

2011-12-04 Thread Martin Grigorov
Read https://cwiki.apache.org/WICKET/working-with-wicket-models.html

Be careful on the static vs. dynamic part ;-)

On Sun, Dec 4, 2011 at 8:54 PM, cosmindumy cosmind...@yahoo.com wrote:
 It works with
 columns.add(new PropertyColumnUser(new ResourceModel(name.name,
 Default), age, age));

 but I don't understand why it didn't find property with the first variant.
  columns.add(new PropertyColumnUser(new ModelString(new
 ResourceModel(name.name, Default).getObject()), age, age));

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4157887.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




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

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



Re: Internationalization on panels

2011-12-04 Thread cosmindumy
Thanks. I red the tutorial and now is more clear. 
Now I am looking for a solution to change the ResourceModel of a Lable. 
For instance I want  the key to be changed between show.components and
when the component is displayed the property to be hide.componets.
Therefore I need a way to set my label resource model.
If you know a solution please tell me.
Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4158350.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: Event or Notice when a ListView's Model changes

2011-12-04 Thread Andrea Del Bene
If you override listview's onBeforeRender you could check if finished 
processes' list contains version displayed by label and if so, you could 
update it.

I'm sorry if my writing is confusing. But there isn't a label that outputs
the state, because the list shows /only/ finished processes.
Maybe the following flow explains what happens:
- A user chooses an application he wants to deploy to a certain stage, let's
say production
- When he has chosen, a label shows the current version of the application
in production
- The user clicks the 'deploybutton', as a result of which a row is inserted
with state 'unfinished'
- Another thread picks up the process and executes a script that deploys the
application
- At the end of this, that other thread updates the state-field to
'finished'
- At the bottom of the panel my listview with finished processes is updated,
and the user will notice that because I added a
AjaxSelfUpdatingTimerBehavior.
- But when the list is refreshed I want the version label that I mentioned
in the beginning to be refreshed also, because there's a new current version

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158203.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: Internationalization on panels

2011-12-04 Thread Igor Vaynberg
class mymodel extends abstractreadonlymodelstring {
  string getobject() {
 if (show) return getstring(show.components) else return
getstring(hide.components);}}

-igor

On Sun, Dec 4, 2011 at 2:09 PM, cosmindumy cosmind...@yahoo.com wrote:
 Thanks. I red the tutorial and now is more clear.
 Now I am looking for a solution to change the ResourceModel of a Lable.
 For instance I want  the key to be changed between show.components and
 when the component is displayed the property to be hide.componets.
 Therefore I need a way to set my label resource model.
 If you know a solution please tell me.
 Thanks.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-on-panels-tp2299768p4158350.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