Re: inmethod-grid refresh issue

2013-03-04 Thread saty
Thanks Marc, This is indeed the issue, i am going to make it light weight for
now and provide an alternate mechanism to launch the other features that are
stuffed in here at present.

Thank for helping me out.







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656957.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
I bet we are getting to the source of the problem.

Non light-weight columns like yours, create the components just once when
the grid is first rendered. So the model instances you pass when you create
the Component will remain the same even if you update the grid.

I believe non-lightweight columns where designed as a means to create
editable rows and shouldn't be used otherwise.

I don't think you really need to use a component for what you are trying to
accomplish.
Maybe you should override "public IRenderable newCell(IModel
rowModel)" instead and write whatever markup you need directly to the
response.

Hope it helps
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 7:13 PM, saty  wrote:

> Actually i have overridden
> public Component newCell(WebMarkupContainer parent, String componentId,
> IModel rowModel)
> {
> ...
> }
>
> to use a separate panel for cell content, due to other functions, will not
> make any difference?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656952.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: inmethod-grid refresh issue

2013-03-04 Thread saty
Actually i have overridden 
public Component newCell(WebMarkupContainer parent, String componentId,
IModel rowModel) 
{
...
}

to use a separate panel for cell content, due to other functions, will not
make any difference?

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656952.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
You should start debugging your project instead of using "print" to see
what is really happening (call stack, variable values...).

PropertyColumn always calls the get method of your model object:

@Override
public IRenderable newCell(IModel rowModel)
{
return new IRenderable()
{
public void render(IModel rowModel, Response response)
{
CharSequence value = getValue(rowModel);
if (value != null)
{
response.write(value);
}
}
};
}

private CharSequence getValue(IModel rowModel)
{
I rowObject = getModelObject(rowModel);
P property = null;
if (rowObject != null)
{
try
{
property = getProperty(rowObject, getPropertyExpression());
}
catch (NullPointerException e)
{

}
}
CharSequence string = convertToString(property);
if (isEscapeMarkup() && string != null)
{
string = Strings.escapeMarkup(string.toString());
}
return string;
}





On Mon, Mar 4, 2013 at 6:11 PM, saty  wrote:

> Also i put a print on every getter but it only prints on first call on a
> set
> of rows, if you filter among those rows its never get called, i suspect the
> grid has rows cached and its assuming nothing changed so using those rows
> again as a subset of previously created rows.
>
> Thanks
>
>
>
>
>
>


Re: inmethod-grid refresh issue

2013-03-04 Thread saty
Also i put a print on every getter but it only prints on first call on a set
of rows, if you filter among those rows its never get called, i suspect the
grid has rows cached and its assuming nothing changed so using those rows
again as a subset of previously created rows.

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656950.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: inmethod-grid refresh issue

2013-03-04 Thread saty
yes i am using property columns in grid to map columns to properties of
model.

Data Source is a very simple implementation just filter model objects in a
cache into a list of filtered model objects.

Context is user and also his filter settings.

If a user can not see value from source x so his calculated value would be
total value minus what he can not see, there are several other parameter to
this context but this is what it is for all parameters. Also if he has
filtered the view on XYZ, the calculated value will exclude everything that
comes from XYZ (including rows).

Its like total sales coming from multiple accounts but user may be seeing
only one or few accounts (not all) so sales should show what is the sale
from those selected accounts (in view).

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656949.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
In your IDataSource code, you left out the implementation "public
IModel model(MyModel object);", I'm quite suspicious that your
models are the source of the problem.
I'm assuming that you are using PropertyColumns in your grid, with these
columns, your getter method should be getting called every time.
You also say "...that may return different value if the context changes..."
what does "context" stand for?
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 5:39 PM, saty  wrote:

> Its a regular java bean with properties and setter and getter methods.
> Grid uses the expression to map a column to a particular property on row
> model (MyModel).
>
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656945.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: inmethod-grid refresh issue

2013-03-04 Thread saty
Just managed to get a workaround to fix the problem.
I have to add a dummy property to the model object and calculate that
property within my data source and than use that property to map to the
calculated column.
However since i can not change the state of original shared model object, so
i have to clone it first (for every user, not a good idea ) and it
introduces whole set of new problems.

Does that ring a bell, how the problem can be solver without all this?

When the model expose a getCalculatedValue method, why would not the grid
call that method to render the row every time on a column that is mapped to
an expression 'calculatedValue' ?

Thanks




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656947.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: inmethod-grid refresh issue

2013-03-04 Thread saty
Its a regular java bean with properties and setter and getter methods.
Grid uses the expression to map a column to a particular property on row
model (MyModel).

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656945.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
What's the code for MyModel?
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 5:14 PM, saty  wrote:

> public class DataSource implements IDataSource {
> private Filter myModelFilterChain;
> public DataSource(FilterChain myModelFilterChain)
> {
> this.myModelFilterChain= myModelFilterChain;
>
> }
>
> @Override
> public void detach() {//.
>
> }
>
> @Override
> public void query(com.inmethod.grid.IDataSource.IQuery query,
>
> com.inmethod.grid.IDataSource.IQueryResult result) {
>
>  //all rows are already cached..use myModelFilterChain
> above to filter
> List MyModels...
> result.setTotalCount(MyModels.size());
> int from = MyModels.size() > query.getFrom() ?
> query.getFrom() :
> MyModels.size();
> int to = MyModels.size() > from + query.getCount() ? from +
> query.getCount() : MyModels.size();
> List resultList = MyModels.subList((int)from,
> (int)to);
> result.setItems(resultList.iterator());
> stopWatch.stop();
> }
>
> }
>
>
> copied relevant potion above, i can see query method is called every time,
> no issues there.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656942.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: inmethod-grid refresh issue

2013-03-04 Thread saty
public class DataSource implements IDataSource {
private Filter myModelFilterChain; 
public DataSource(FilterChain myModelFilterChain) 
{
this.myModelFilterChain= myModelFilterChain;

}

@Override
public void detach() {//.

}

@Override
public void query(com.inmethod.grid.IDataSource.IQuery query,
com.inmethod.grid.IDataSource.IQueryResult 
result) {

 //all rows are already cached..use myModelFilterChain above to 
filter  
List MyModels...
result.setTotalCount(MyModels.size());
int from = MyModels.size() > query.getFrom() ? query.getFrom() :
MyModels.size();
int to = MyModels.size() > from + query.getCount() ? from +
query.getCount() : MyModels.size(); 
List resultList = MyModels.subList((int)from, 
(int)to);
result.setItems(resultList.iterator()); 
stopWatch.stop();   
}   

}


copied relevant potion above, i can see query method is called every time,
no issues there.

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656942.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
The problem must be in your row models.
What does your IDataSource implementation look like?
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 4:55 PM, saty  wrote:

> grid.markAllItemsDirty();
> grid.update();
> This does not help, for some reason grid is smart not to regenerate a row
> for a model it already did.
> I can see my getXXX method is called by grid only first time and than its
> never get called again so the column shows what was calculated for the
> first
> call.
>
> To be more specific, if the grid shows 20 rows and than i filter to show 10
> out of those 20 rows, it does not call the getXXX methods on my model
> object.
>
> However If i change filter setting so it has to now show 30 rows (20
> previous and say 10 other rows) , it does call the getXXX methods again.
>
> Not really sure what controls this behaviors and how to override it.
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656940.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: inmethod-grid refresh issue

2013-03-04 Thread saty
grid.markAllItemsDirty();
grid.update();
This does not help, for some reason grid is smart not to regenerate a row
for a model it already did. 
I can see my getXXX method is called by grid only first time and than its
never get called again so the column shows what was calculated for the first
call.

To be more specific, if the grid shows 20 rows and than i filter to show 10
out of those 20 rows, it does not call the getXXX methods on my model
object.

However If i change filter setting so it has to now show 30 rows (20
previous and say 10 other rows) , it does call the getXXX methods again.

Not really sure what controls this behaviors and how to override it.
Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656940.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
Ok, I see.
Either way if it is a DataGrid, calling markAllItemsDirty() and update()
from your ajax request should do the job.
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 4:35 PM, saty  wrote:

> Thanks Marc, i will take a look at these methods if they can help, however
> my
> equals method can not help here as i said previously some columns are
> derived in the sense they dont return an attribute of the object but a
> value
> which is derived from the context (and object state) in which the method is
> called.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656938.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: inmethod-grid refresh issue

2013-03-04 Thread saty
Thanks Marc, i will take a look at these methods if they can help, however my
equals method can not help here as i said previously some columns are
derived in the sense they dont return an attribute of the object but a value
which is derived from the context (and object state) in which the method is
called.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656938.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: inmethod-grid refresh issue

2013-03-04 Thread Marc Nuri San Félix
Hello Saty

You should check methods "markItemDirty(IModel model)",
"markAllItemsDirty()" and "update()". This are the methods you are supposed
to be calling when refreshing the grid's content.

You should also make sure that the equals() method of your model objects
return false when both objects aren't equal...

Cheers
--
Marc Nuri
www.marcnuri.com


On Mon, Mar 4, 2013 at 4:20 PM, saty  wrote:

> Any thoughts on this please?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656936.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: inmethod-grid refresh issue

2013-03-04 Thread saty
Any thoughts on this please?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910p4656936.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



inmethod-grid refresh issue

2013-03-01 Thread saty
I have this strange case where when i do ajax target.add(grid), it does call
my grid datasource to request the rows that the grid need to populate but
when it finds that rows to be displayed are same what grid already has it
does not recreate the grid (i can say that as i notice my get methods on
model are not called).

My guess is when it need to display same rows (model) it will not run
through the list of model objects again that it need to show, however in my
case there are few derived columns (hence corresponding get methods) that
may return different value if the context changes (controlled by several
filters on grid).

How can i force the grid to run through the model list every time to refresh
the grid, regardless?

Not sure if above explains the problem clearly, please do let me know if
more details are required.

Thanks





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/inmethod-grid-refresh-issue-tp4656910.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