Re: type safe field references

2010-04-28 Thread Leo . Erlandsson
Hi,

Perhaps this is what you're looking for?
http://code.google.com/p/bindgen-wicket/

add(new Label(state, new PropertyModel(person, address.state.code)));
becomes
add(new Label(state, new PropertyModel(person, new 
PersonBinding().address().state().code().getPath(;

Type safe and refactor safe.

// Leo


Hi all

I am new to Wicket and investigating if usable for our project or not. I
have a minor question related to type safety and the creation of models. 
It
seems to me, that existing bean models are used by referencing the bean
fields using Strings, e.g.

public PojoStockQuotePage()
{
StockQuote quote = new StockQuote(IBM);
add(new Label(stockIBM, new PropertyModel(quote, quote));
}

I seem to remember, that I've seen an example of a Wicket extension, 
which
allows me to write type safe field references. Does any one have a clue,
which extension I stumbled into or how to perform type safe references?




Re: DatePicker and visibility of the parent component

2010-03-26 Thread Leo . Erlandsson
We had the same problem. It probably can be solved in a better way (but 
that would require a RFE and changes to Wicket), but we used a quick and 
easy solution (tm).

Instead of actually setting isVisible() on the Date Picker, we just hide 
it using CSS. I don't know if this is applicable in your use case with 
wicket:enclosure.


@Override
public void onRendered(Component component) {
if (!isReadOnly()) {
super.onRendered(component);
} else {
Response response = component.getResponse();
response.write(\ndiv style=\display:none;\);
super.onRendered(component);
response.write(\n/div);
}

}
});

We're using isReadOnly() (non-standard Wicket method) to determine if 
DatePicker should be visible or not. You probably could be using 
setVisible() isVisible() using overrides and some tweaks.

Hi,

I have date picker added to a date field.

DateTextField field = new DateTextField(field, -MM-dd);

field1.add(new DatePicker());

If the section the date picker is in is visible there is no problem. If 
the
section is not visible using wicket:enclosure, I get an error:

http://localhost:8080/resources/org.apache.wicket.extensions.yui.YuiLib/calendar/calendar.jsUncaught

TypeError: Cannot read property 'id' of null


Re: Re: RE: RE: RE: Regarding TreeTable Horizontal Scrollbar

2010-03-26 Thread Leo . Erlandsson
Take a look at

http://www.wicketframework.org/wicket-extensions/apidocs/wicket/extensions/markup/html/tree/table/ColumnLocation.html

Specifying fixed size column should be no harder than adding them as LEFT 
or RIGHT columns instead of MIDDLE Column. MIDDLE column cannot have a 
fixed width.

You should, however, be aware of a JavaScript i TreeTable that does 
resizing, see method init() in TreeTable:

// Attach the javascript that resizes the header according to the body
// This is necessary to support fixed position header. The header does
// not
// scroll together with body. The body contains vertical scrollbar. The
// header width must be same as body content width, so that the columns
// are properly aligned.

Maybe you need to remove this, or at least modify the behavior...

Or, you could always do as I did in my example - specify the width of the 
treetable greater than the size of the enclosing div (see earlier 
examples).



Hi,

I am new to the Wicket and am trying out the TreeTable example. I am 
facing
a more fundmental issue. I am unable to give a fixed width to the middle
columns. I can only specify the Unit as Proportional which is dividing 
the
columns proportionally within the available space. Because of this I 
don't
even see where horizontal scrollbar can be used with the table. The total
width of the table seems to remain same no matter how many coloumns I 
add.
Is there a way to change this behaviour so that I can specify fixed 
widths
to all the columns?

regards,
Kamesh


Re: RE: RE: RE: Regarding TreeTable Horizontal Scrollbar

2010-03-25 Thread Leo . Erlandsson
Hi,

Still a CSS issue, not a Wicket one ;)

I used Google to search for css table locked column scroll

First result was a good StackOverflow-question:
http://stackoverflow.com/questions/296020/how-can-i-lock-the-first-row-and-first-column-of-a-table-when-scrolling-possibly

Try the Horizontal Scrollbar in the example mentioned in the Accepted 
StackOverflow answer:
http://www.cubido.at/Portals/7/docs/Blog/Karin/HTML%20and%20Javascript/ResizeColumns/Table.htm

Source here: 
http://www.cubido.at/Portals/7/docs/Blog/Karin/HTML%20and%20Javascript/ResizeColumns.zip


Seems to be what you're looking for. 



Thanks to have your valuable reply  effort you made to answer my query. 
But let me to explain you again my problem statement because this solution 
won't help me to fix the issue I have. I need a CSS style at TreeTable 
markup level so that the Horizontal Scrollbar would be a part of TreeTable 
component. Here is my problem statement:

In my application, there are two scenarios: 

1) I need an entire table to be scrollable horizontally 
2) Horizontal scrolling on entire table except the tree node column.

Now I tried with changing both TreeTable markup  CSS attribute but 
couldn't get success. I am using wicket 1.4.5 version.

Actually the problem statement is, in my application, I need a TreeTable 
where first column should contain the data in a tree structure  rest 
others column will be the simple one. So, I used TreeTable 
wicket-extension component to get the requirement fulfill but the problem 
arises when table has many number of columns then the table should be 
horizontally scrollable. And as per my analysis, this existing treetable 
component doesn't provide this feature.

Could you please let me know that whether it's possible to customize 
component for above mentioned requirement? And if yes, then guide me to do 
this otherwise please let me know what would be the other approach.



Re: RE: RE: Regarding TreeTable Horizontal Scrollbar

2010-03-18 Thread Leo . Erlandsson
 Anyone knows how to get the TreeTable Horizontal Scrollbar? If possible 
share the code snippet.
 Regards
 Vikash


Didn't you find any CSS Examples using Google?

This really is not a Wicket question, but a CSS question. However, I did a 
CSS Example for you.
Is this what you're looking for (click URL to see image)?

http://img514.imageshack.us/img514/1294/wicketscrollingtreetabl.jpg

It's all CSS. I took the Wicket TreeTable Example and added the following 
CSS (quick and dirty, there are more ways).
The magic is the CSS overflow-x: scroll;

wicket:head
style

div.my-tree  {
height: 20em;
width:1500px;
}

div.c {
width:1250px;
overflow-x: scroll;
}
/style
/wicket:head

wicket:extend
div class=c
div wicket:id=treeTable class=my-tree
/div
/div
/wicket:extend




Re: Regarding TreeTable Horizontal Scrollbar

2010-03-15 Thread Leo . Erlandsson
You can solve this by using CSS.

E.g.

table
trtd
div style=width:100%;overflow:auto;white-space:nowrap
[content]
/div
/td/tr 
/table

The trick is overflow:auto that will add scrollbars when needed.

overflow-y: scroll;  will give you an always visible scrollbar for the 
y-axis.


Hi,

I am using TreeTable Wicket-1.4.5 component in my application. In my 
application, TreeTable may have one to many column based on some 
selection/event. I want Horizontal scrollbar for TreeTable component to 
see the entire columns when it has many numbers.
If it needs customization then please let me know how it can be achieved.



Re: RE: Regarding TreeTable Horizontal Scrollbar

2010-03-15 Thread Leo . Erlandsson
If you want the entire table to be scrollable horizontally you should 
probably place the CSS attributes on the top CSS class 
(wicket-tree-table).

Search the net for CSS horizontal scoll. There should be loads of 
examples on how to do this using CSS.

http://lmgtfy.com/?q=css horizontal scoll overflow


 Where should I place the contents you have sent me as I tried it at 
TreeTable html  couldn't get the needed output? Please see the below code 
and  let me know where I can modify...

Tried for both TreeTable component html  web page html.

wicket:panel



div class=wicket-tree-table

Re: Re: FormTester and Select component?

2010-03-02 Thread Leo . Erlandsson
You could easily extend WicketTester and FormTester to support selecting 
in org.apache.wicket.extensions.markup.html.form.select.Select.

Take a look at the

public void select(String formComponentId, int index)

method in FormTester and

public FormTester newFormTester(String path, boolean fillBlankString)

in BaseWicketTester on how to do it.


Thank you for the reply. Unfortunately this is not easier for me since
we already have this function implemented using the Select component.
If there is no way of getting FormTester to work with that component
i'll have a look at your code - i really want to have this test
automated without having to use a heavier test framework.



Re: [OT] Apache con 2010 europe, when?

2010-02-25 Thread Leo . Erlandsson
SDC2010 - Scandinavian Developer Conference in Gothenburg, Sweden.

There is even a lecture on Wicket! :)

http://www.scandevconf.se/2010/conference/speakers/andrew-lombardi/?backlnk=dptgday=togglewrap1






nino martinez wael nino.martinez.w...@gmail.com 
2010-02-25 14:45
Sänd svar till
users@wicket.apache.org


Till
users@wicket.apache.org
Kopia

Ärende
[OT] Apache con 2010 europe, when?






Hi Guys

Im trying todo a conference lineup so we at our company can decide which
conference to go to. But can't find the date for Apache con europe 2010, I
thought it were somewhere in march.

If interested these are in my lineup so far:

Apache Con
Devoxx
Øredev

Are there some conference I forgot? The conference should be about java 
and
development in general, preferably like Øredev (with tracks like Test,
Agile, Architecture, User Experience etc), so we can see what happens in 
the
development world. And somewhere in the europe region... I haven't got
budget for a us trip. Otherwise It would only be me going :)

Ohh and forgive my intrusion :)

Regards Nino



Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
now problem is not accessing object fields..

problem is transform resultset to these objects..

You could just work with Maps in Wicket instead of Domain Objects. The 
transformation from ResultSet to a Map containing the Column name as Key 
and the data as Value should be trivial (if not; reply and I'll provide 
sample code) using MetaData (this is how we do it in our JSP pages today).

Or you could write / find a software that does the mapping from JDBC 
ResultSet to Domain Objects... But why not use an ORM such as Hibernate / 
Cayenne / iBatis then.. ?





Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
If you want to use a Map and display it in a Datatable there's no 
difference from using an Object in Wicket. 

You access the key/values using PropertyColumn as usual (i.e. you don't 
really need to make any changes to your code). For Objects you use e. g. 
name for the getName() method. When using Maps name will return the 
value corresponding to the key name.




 Can you give me an example, how i can use ResultSet transformed into
 Map with for example datatable component?
 I think i can write method transforming ResultSet to a Map.
 
 I do not want to use any ORM, because web tier for my app is just
 control panel and main features implemented in the backend.

 You want to swim without getting wet. Fine :)

 public class MyMilkFactory {
public ListMilk provideHoneyObjects() {
// iterate over sql statement/REsultSet
   Milk milk = createMilk(rs);
   Honey honey provideHoney(rs.getInteger(honeyid));
 
}

public Milk createMilk(ResultSet rs) { // do not use an 
OR/mapper here 
 but do the dirty work on your own}

public Honey provideHoney(int id) {//read from database, 
again do the 
 dirty work on your own }
}


Re: Re: Re: jdbc

2010-02-15 Thread Leo . Erlandsson
Should be no different when using JDBC than using it when using Domain 
Objects.

Check out Wicket Phonebook Example that uses FilterToolbar:
http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-phonebook

Source Code Example:
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/phonebook/src/main/java/wicket/contrib/phonebook/web/page/ListContactsPage.java


 Thank you!
 I just discovered this sample:
 http://www.brettdutton.com/blog/?p=4

 What i can do.. if i want to use FilterToolbar with DataTable?


Re: How to add Images in wicket Navigator instead of ?

2010-02-15 Thread Leo . Erlandsson
 How to add Images in wicket Navigator instead of?

One way, I'm sure there are others:

Write your own MyPagingNavigator that extends PagingNavigator or 
AjaxPagingNavigator. Provide your own markup.
Override  protected PagingNavigator newPagingNavigator(String navigatorId, 
final DataTable? table); in NavigationToolbar / AjaxNavigationToolbar 
and provide your own MyPagingNavigator there.



Med vänlig hälsning / Sincerely yours
Leo Erlandsson

Tyringekonsult AB

Phone: +46-(0)451- 594 54
Email: leo.erlands...@tyringe.com
Website: www.tyringe.com





saravana kumar shav...@gmail.com 
2010-02-15 13:34
Sänd svar till
users@wicket.apache.org


Till
users@wicket.apache.org
Kopia

Ärende
How to add Images in wicket Navigator instead of?







-- 
Thanks  Regards,
SaravanaKumar G.



Re: Re: How to add Images in wicket Navigator instead of ?

2010-02-15 Thread Leo . Erlandsson
 thank u for your reply.I didn't understand. please send code or link.

Unfortunately I can't include code from our project. However, if you 
search this mailing list you'll find several examples and other solutions 
to your problem:

http://old.nabble.com/PagingNavigator-with-custom-images-ts13422772.html#a13422772
http://old.nabble.com/Help%3A-Graphic-link-in-PagingNavigator-ts21453859.html#a21453994
http://old.nabble.com/How-to-change-the-style-of-navigator-in-PageableViewList-ts14978321.html#a1501
 
  --- Including code






Re: Regarding editable datagrid

2010-02-03 Thread Leo . Erlandsson
I am kasi. I am developing POC (Proof of concept) on editable datagrid 
using apache wicket framework to implement in one of the project.
I am using 'Apache Wicket 1.4.5 Release'. I have a question that whether 
editable datagrid features are available in the 'Apache Wicket 1.4.5' 
version or not?
If they are available, which classes support the editable datagrid 
features?

Check out InMethod Grid. Click rows to edit.

http://wicketstuff.org/grid-examples/data-grid/editable

Of course you can also easily make an editable grid yourself using Wicket 
and Wicket Extensions standard classes.

Best regards,
Leo



Re: Help with Wicket Adoption Numbers

2010-01-11 Thread Leo . Erlandsson
As my English is not my mother's tongue, even though I do speak it pretty
good, what is the meaning of pointy haired bosses?
I think I can understand it, but hey, I want to know if these are the 
kinds
of bosses I encountered too often..

It's from the Dilbert Comic Strip :)

Wikipedia:
http://en.wikipedia.org/wiki/Pointy-Haired_Boss

The Pointy-Haired Boss (often abbreviated to just PHB) is Dilbert's boss 
in the Dilbert comic strip. He is notable for his micromanagement, gross 
incompetence and unawareness of his surroundings, yet somehow retains 
power in the workplace.



Re: Several entities and DataTable

2010-01-10 Thread Leo Erlandsson

I would use an SQL Join in the iterator(int first, int count) method to get
data from the associated table and return the data in the returned Domain
Objects.

You could also do an SQL Query for each result in your iterator() method,
but that would give you 1+n SQL Queries instead of just 1.

Also, note that your code has several Security Vulnerabilities as it is
susceptible to SQL Injection Attacks (!) if you let the user specify the
Filter String:

String tmp = filter.getName();
sql = where name like '% + tmp + %'; 





-
---
Leo Erlandsson, M. Sc.
-- 
View this message in context: 
http://old.nabble.com/Several-entities-and-DataTable-tp27075166p27097481.html
Sent from the Wicket - User 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: Help with Wicket Adoption Numbers

2010-01-08 Thread Leo . Erlandsson
Hi,

We also had the same consideration when we chose Wicket. But why choose an 
inferior technology just because of it's Adoption Numbers? Also, Wicket is 
becoming more and more popular as people see the light :)

Check out Jobs Trends (Relative Growth) here (JSF vs Struts vs Wicket):
http://www.indeed.com/jobtrends?q=Struts%2C+JSF%2C+Wicketl=relative=1

We have a couple of hundred customers and so far the feedback is great 
both from our Developers and our Software Architects. Customers like that 
the GUIs are faster due to the simplicity of Ajax Adoption in Wicket.

I also know that several large privately held companies in Sweden are 
using Wicket, as well as large Government Agencies (e.g. the Swedish 
Immigration Office).


Sincerely yours
Leo Erlandsson






Lester Chua cicowic...@gmail.com 
2010-01-08 01:43
Sänd svar till
users@wicket.apache.org


Till
users@wicket.apache.org
Kopia

Ärende
Help with Wicket Adoption Numbers






Hi,

I am facing a hurdle that need crossing in my final attempt to push 
Wicket for use in an organization.
I have:

1) Prototyped a small size module
2) Did 2-3 presentations on the key features and advantages of wicket

No one is disputing my claims about productivity and good OO code that 
was the result.

BUT, the technology evaluation committee is NOT recommending Wicket 
because of. of all things.
- Wicket's Low Adoption Rate
Can I find any numbers to blow this away?

My alternative is to accept the finding and work with Struts 2. Which 
will mean the stack will need to expand to DWR
 (for security). I REALLY don't want to go there, and am even 
considering not taking part in this project due to the high risk 
involved, only 9 months to introduce huge changes to a system that has 
lots of legacy problems (took about 3 years to build). I think a lot of 
those years were spent wrestling with the monster that is EJB 1.1. The 
only way I thought the project can even be on time is to scrap the 
entire presentation layer (aka Struts) and redo it in Wicket with 1 
dedicated developer while the rest of the team work on killing the beast 
that is EJB 1.1 by refactoring the biz code.

Sigh, my choices are stark. It's either to keep the job and plough ahead 
and probably fail spectacularly 9 months later or go hungry and explain 
to my wife why we need to spend less on the kid..

It's easy to blame the tech committee but they did help me find wicket 
by rejecting my initial proposal to build the new system on a 
(JQuery+JSON+REST) framework, which can be very productive as well, if 
not as clean as Wicket.

Sorry for rambling so much. Is there any way I can demolish the silly 
low adoption rate argument (omg I still don't believe it can be so lame)?

Lester



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





Re: Wicket datepicker disable weekdays

2009-11-20 Thread Leo Erlandsson

This is certainly possible.

You need to use YUI Calendar Renderers. They are documented in the YUI Cal2
API Doc. You can find an example of what you are trying to achieve here
(thanks Google):

http://www.stephaniebender.de/extras/yui/examples/calendar/render/1.html

Basically, you'll want to do this for all disallowed weekdays:

var myCustomRenderer = function(workingDate, cell) { 
cell.innerHTML = X; 
YAHOO.util.Dom.addClass(cell, disallowed); 
return YAHOO.widget.Calendar.STOP_RENDER; 
} 
YAHOO.example.calendar.cal1.addWeekdayRenderer(1, myCustomRenderer);

This will put an X on all Sundays, making them disabled. Also, it will add a
CSS class ('disallowed') that can be customized if you want to change the
appearance of disabled cells.


-- 
View this message in context: 
http://old.nabble.com/Wicket-datepicker-disable-weekdays-tp26444084p26447477.html
Sent from the Wicket - User 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



Reading localization properties from Subclass .properties file

2009-11-06 Thread Leo . Erlandsson
Hi,

We are in the process of moving our applications from JSP to Wicket.
Right now we're writing a framework with BasePages and base components to 
build on and are
learning Wicket on the fly.

The BasePage contains a HeaderPanel which renders the Headline of the 
page:

!-- BasePage.java --
   public BasePage() {

super();
.
.
header = new HeaderPanel(header, getHeaderImagePath());
add(header);

}


We then subclass BasePage and implement getHeaderImagePath() which is 
abstract.
HeaderPanel reads the header from a .properties file and uses a different 
resourceKey
depending on what mode the page is in. E.g. if the page is in edit 
mode, the HeaderPanel
tries to read editHeadline, and if the page is in view mode the 
HeaderPanel tries to read
viewHeadline:

!-- Extract from HeaderPanel.java constructor --
add(new Label(viewHeadline,
new StringResourceModel(viewHeadline,
this, model)) {

@Override
public boolean isVisible() {
return getMode() == Mode.VIEW;
}
}.setRenderBodyOnly(true));


!-- SubclassPage.java --
public class SubclassPage extends BasePage
public  SubclassPage() {
 
super();

}
}


Now for the problem:

We would like to be able to read the localization properties from the Page 
_Subclass_ .properties file.
This apparently won't work because the HeaderPanel is added in BasePage, 
and uses
that as parent component to HeaderPanel in the StringResourceModel.

Of course we can create methods like getViewHeadline() and force the Page 
subclass to
implement/override them, but is there a better way? 

Is it possible to get the values from the Page Subclass .properties file?

Thanks!

Regards,
Leo


Ang. Reading localization properties from Subclass .properties file

2009-11-06 Thread Leo . Erlandsson
Sorry for the inconvenience, Wicket is handling this beautifully and loads 
the correct resourceKey value from the Page subclass .properties file. I 
don't dare admit what the problem was

Thanks for a great framework!



Reading localization properties from Page Subclass .properties file

2009-11-05 Thread Leo . Erlandsson
Hi,

We are in the process of moving our applications from JSP to Wicket.
Right now we're writing a framework with BasePages and base components to 
build on and are
learning Wicket on the fly.

The BasePage contains a HeaderPanel which renders the Headline of the 
page:

!-- BasePage.java --
   public BasePage() {

super();
.
.
header = new HeaderPanel(header, getHeaderImagePath());
add(header);

}


We then subclass BasePage and implement getHeaderImagePath() which is 
abstract.
HeaderPanel reads the header from a .properties file and uses a different 
resourceKey
depending on what mode the page is in. E.g. if the page is in edit 
mode, the HeaderPanel
tries to read editHeadline, and if the page is in view mode the 
HeaderPanel tries to read
viewHeadline:

!-- Extract from HeaderPanel.java constructor --
add(new Label(viewHeadline,
new StringResourceModel(viewHeadline,
this, model)) {

@Override
public boolean isVisible() {
return getMode() == Mode.VIEW;
}
}.setRenderBodyOnly(true));


!-- SubclassPage.java --
public class SubclassPage extends BasePage
public  SubclassPage() {
 
super();

}
}


Now for the problem:

We would like to be able to read the localization properties from the Page 
_Subclass_ .properties file.
This apparently won't work because the HeaderPanel is added in BasePage 
constructor, and uses
that as parent component to HeaderPanel in the StringResourceModel.

Of course we can create methods like getViewHeadline() and force the Page 
subclass to
implement/override them, but is there a better way? 

Is it possible to get the values from the Page Subclass .properties file?

Thanks!

Regards,
Leo


Re: WhiteSpaces in PasswordTextField

2009-10-25 Thread Leo Erlandsson

protected boolean shouldTrimInput()

Determines whether or not this component should trim its input prior to
processing it. The default value is true  

Returns: True if the input should be trimmed.

seems like a good candidate.
-- 
View this message in context: 
http://www.nabble.com/WhiteSpaces-in-PasswordTextField-tp26047182p26047468.html
Sent from the Wicket - User 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: SV: ajax - navigate to new location

2009-09-04 Thread Leo . Erlandsson
This seems to work fine:

new AjaxLink(ajaxlink) {

public void onClick(AjaxRequestTarget target) {
getRequestCycle().setRequestTarget(new 
RedirectRequestTarget(http://www.google.com;));
}
});






Wilhelmsen Tor Iver toriv...@arrive.no 
2009-09-04 15:47
Sänd svar till
users@wicket.apache.org


Till
users@wicket.apache.org users@wicket.apache.org
Kopia

Ärende
SV: ajax - navigate to new location






 target.prependJavascript(window.location.href=google.com);
 
 Is there a better way of doing this?

Doubtful; Ajax is primarily concerned with NOT replacing the whole page. 
If you always replace the page use a normal link instead which lets you 
set a RedirectRequestTarget for instance.

- Tor Iver

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