Re: DataTable generics vs. IColumn generics

2015-03-10 Thread Sven Meier

Hi,

At the current implementation they need to do
cols.add(new LocationColumLocation(...));
instead of just
cols.add(new LocationColum(...));

I think you mean LocationColumnPerson.

nice feature of PropertyColums: Not to have a too strength coupling of 
what the column displays in the cell and what the data table shows.


As I see it, columns decide what to display (e.g. a person's location) 
and the component provided in #popuplateItem() decides how to display 
this information.
Let us know when you figured out how to improve separation of these 
concerns.


Have fun
Sven



Am 09.03.2015 um 10:29 schrieb Patrick Davids:

Hi Sven,
I did already implement it this way... and its working.

But my team members asked (more the client developers point of view), 
why the column-class itself is not a generic of Location, like this.


public class LocationColumn extends PropertyColumnLocation {
...
}

At the current implementation they need to do
cols.add(new LocationColumLocation(...));
instead of just
cols.add(new LocationColum(...));

Thats why I forwarded the question here, because I studied a bit the 
Column-Hierarchie code and also wondered about this strength coupling 
between T of ICellPopulator and T of rowModel and T of DataTable.



I suppose my team members see the PropertyColumn more like the usage 
of a PropertModel.
The generic of a PropertyModel is the type, which is returned by the 
expression.
The generic of a PropertyColumn is the DataTables generic / rowModel 
generic, not what its expression retrieves/returns/displays.


I think thats it...

As more as I think about this issue, maybe this could be a nice 
feature of PropertyColums.
Not to have a too strength coupling of what the column displays in the 
cell and what the data table shows.


kind regards
Patrick

Am 05.03.2015 um 18:43 schrieb Sven Meier:

Hi Patrick,

you can let your column implementation be generic:

  public class LocationColumnT extends PropertyColumnT {

  public LocationColumn(String expressionToLocation){
  super(Model.of(Location), expressionToLocation);
  }

  @Override
  public void populateItem(ItemICellPopulatorT cellItem,
String componentId, IModelT rowModel) {
  cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
  }
  }

What do you need more?

Regards
Sven


Am 05.03.2015 um 15:34 schrieb Patrick Davids:

Hi Sven,
thanx for feedback.

Ok, how to implement the LocationColumn more reusable?
I dont want to be bound to a Datatable of Persons.

I'd like to have a Column which works with a Locations, independently
from which model-object the expression fetches the Location.

Is there any way to do that?

best regards
Patrick

Am 05.03.2015 um 15:19 schrieb Sven Meier:

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the
type of the row models.

A column is responsible to provide a cell component for a row: For
DataTable only the input (e.g. Person) is interesting, the output
(Location) doesn't matter.

Your LocationColumn should extend PropertyColumnPerson:

 public class LocationColumn extends PropertyColumnPerson{

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorPerson 
cellItem,

String componentId, IModelPerson rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of
ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand
correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new
ListDataProviderPerson(), 50);


public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem,
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();
}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could 

Re: DataTable generics vs. IColumn generics

2015-03-09 Thread Patrick Davids

Hi Sven,
I did already implement it this way... and its working.

But my team members asked (more the client developers point of view), 
why the column-class itself is not a generic of Location, like this.


public class LocationColumn extends PropertyColumnLocation {
...
}

At the current implementation they need to do
cols.add(new LocationColumLocation(...));
instead of just
cols.add(new LocationColum(...));

Thats why I forwarded the question here, because I studied a bit the 
Column-Hierarchie code and also wondered about this strength coupling 
between T of ICellPopulator and T of rowModel and T of DataTable.



I suppose my team members see the PropertyColumn more like the usage of 
a PropertModel.
The generic of a PropertyModel is the type, which is returned by the 
expression.
The generic of a PropertyColumn is the DataTables generic / rowModel 
generic, not what its expression retrieves/returns/displays.


I think thats it...

As more as I think about this issue, maybe this could be a nice feature 
of PropertyColums.
Not to have a too strength coupling of what the column displays in the 
cell and what the data table shows.


kind regards
Patrick

Am 05.03.2015 um 18:43 schrieb Sven Meier:

Hi Patrick,

you can let your column implementation be generic:

  public class LocationColumnT extends PropertyColumnT {

  public LocationColumn(String expressionToLocation){
  super(Model.of(Location), expressionToLocation);
  }

  @Override
  public void populateItem(ItemICellPopulatorT cellItem,
String componentId, IModelT rowModel) {
  cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
  }
  }

What do you need more?

Regards
Sven


Am 05.03.2015 um 15:34 schrieb Patrick Davids:

Hi Sven,
thanx for feedback.

Ok, how to implement the LocationColumn more reusable?
I dont want to be bound to a Datatable of Persons.

I'd like to have a Column which works with a Locations, independently
from which model-object the expression fetches the Location.

Is there any way to do that?

best regards
Patrick

Am 05.03.2015 um 15:19 schrieb Sven Meier:

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the
type of the row models.

A column is responsible to provide a cell component for a row: For
DataTable only the input (e.g. Person) is interesting, the output
(Location) doesn't matter.

Your LocationColumn should extend PropertyColumnPerson:

 public class LocationColumn extends PropertyColumnPerson{

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorPerson cellItem,
String componentId, IModelPerson rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of
ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand
correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new
ListDataProviderPerson(), 50);


public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem,
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();
}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns
to allow special renderings of table-cells.

But how can I achieve this, if also ICellPopulator is bound to T of
the rowModel?

kind regards
Patrick

-
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: DataTable generics vs. IColumn generics

2015-03-05 Thread Sven Meier

Hi Patrick,

you can let your column implementation be generic:

 public class LocationColumnT extends PropertyColumnT {

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorT cellItem,
String componentId, IModelT rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

What do you need more?

Regards
Sven


Am 05.03.2015 um 15:34 schrieb Patrick Davids:

Hi Sven,
thanx for feedback.

Ok, how to implement the LocationColumn more reusable?
I dont want to be bound to a Datatable of Persons.

I'd like to have a Column which works with a Locations, independently 
from which model-object the expression fetches the Location.


Is there any way to do that?

best regards
Patrick

Am 05.03.2015 um 15:19 schrieb Sven Meier:

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the
type of the row models.

A column is responsible to provide a cell component for a row: For
DataTable only the input (e.g. Person) is interesting, the output
(Location) doesn't matter.

Your LocationColumn should extend PropertyColumnPerson:

 public class LocationColumn extends PropertyColumnPerson{

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorPerson cellItem,
String componentId, IModelPerson rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of
ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand
correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new
ListDataProviderPerson(), 50);


public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem,
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();
}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns
to allow special renderings of table-cells.

But how can I achieve this, if also ICellPopulator is bound to T of
the rowModel?

kind regards
Patrick

-
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






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



Re: DataTable generics vs. IColumn generics

2015-03-05 Thread Sven Meier

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the 
type of the row models.


A column is responsible to provide a cell component for a row: For 
DataTable only the input (e.g. Person) is interesting, the output 
(Location) doesn't matter.


Your LocationColumn should extend PropertyColumnPerson:

public class LocationColumn extends PropertyColumnPerson{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

@Override
public void populateItem(ItemICellPopulatorPerson cellItem, 
String componentId, IModelPerson rowModel) {
cellItem.add(new Label(componentId, new 
LocationFormatModel((IModelLocation)createDataModel(rowModel), 
Model.of(Session.get().getLocale();

}
}

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of 
ICellPopulator?


As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand 
correct), its the type of object shown by the cell itself.


But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new 
ListDataProviderPerson(), 50);



public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem, 
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new 
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();

}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns 
to allow special renderings of table-cells.


But how can I achieve this, if also ICellPopulator is bound to T of 
the rowModel?


kind regards
Patrick

-
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: DataTable generics vs. IColumn generics

2015-03-05 Thread Patrick Davids

Hi Sven,
thanx for feedback.

Ok, how to implement the LocationColumn more reusable?
I dont want to be bound to a Datatable of Persons.

I'd like to have a Column which works with a Locations, independently 
from which model-object the expression fetches the Location.


Is there any way to do that?

best regards
Patrick

Am 05.03.2015 um 15:19 schrieb Sven Meier:

Hi,

generic T is identical for the DataTable, and it's IColumns: it's the
type of the row models.

A column is responsible to provide a cell component for a row: For
DataTable only the input (e.g. Person) is interesting, the output
(Location) doesn't matter.

Your LocationColumn should extend PropertyColumnPerson:

 public class LocationColumn extends PropertyColumnPerson{

 public LocationColumn(String expressionToLocation){
 super(Model.of(Location), expressionToLocation);
 }

 @Override
 public void populateItem(ItemICellPopulatorPerson cellItem,
String componentId, IModelPerson rowModel) {
 cellItem.add(new Label(componentId, new
LocationFormatModel((IModelLocation)createDataModel(rowModel),
Model.of(Session.get().getLocale();
 }
 }

Have fun
Sven

Am 05.03.2015 um 12:26 schrieb Patrick Davids:

Hi all,
whats the meaning of generic T on DataTables vs T of IColumn and T of
ICellPopulator?

As I understand its the type of object shown by the table rows.

Reading the javadoc of AbstractColumn it says T (if I understand
correct), its the type of object shown by the cell itself.

But DataTable and its internal list of columns are bound together.
T of both must be the same...

I tried to implement something like this, and here I get problems.


ListIColumnPerson, Void cols = new ArrayList();
cols.add(new PropertyColumnPerson, Void(Model.of(Name), name));
(compiler error)
cols.add(new LocationColumn(location));
(compiler error)

new DataTablePerson, Void(id, cols, new
ListDataProviderPerson(), 50);


public class LocationColumn extends PropertyColumnLocation{

public LocationColumn(String expressionToLocation){
super(Model.of(Location), expressionToLocation);
}

  @Override
public void populateItem(ItemICellPopulatorLocation cellItem,
String componentId, IModelLocation rowModel) {
cellItem.add(new Label(componentId, new
LocationFormatModel(rowModel, Model.of(Session.get().getLocale();
}
}

Also the Generic of ICellPopulator is bound to T of column.

I always thought it could be possible to implement sub-class columns
to allow special renderings of table-cells.

But how can I achieve this, if also ICellPopulator is bound to T of
the rowModel?

kind regards
Patrick

-
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



--
Mit freundlichen Grüßen,

Patrick Davids

nuboLOGIC GmbH  Co. KG
Südportal 1 • 22848 Norderstedt

Tel.: +49 40 228539 732
Email: patrick.dav...@nubologic.com

http://www.nubologic.com

Handelsregister: HRA6819 Pi  | Amtsgericht Pinneberg

Geschäftsführung der Verwaltungsgesellschaft
Christian Capelle

HRB10145Pi | Amtsgericht Pinneberg

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