Re: Models and panel updates

2010-07-15 Thread Sven Meier

Hi,

>I think you mean that I need to use the PanelDetails class as a model, 
and create all the properties in it.


it's not necessary to copy all properties to the panel. A 
CompoundPropertyModel doesn't care where it gets its properties from. As 
I have written, the following should work:


setDefaultModel(new CompoundPropertyModel(product));

The example just shows that AjaxEditableLabels work fine with 
CompoundPropertyModels.


Regards
Sven


On 07/16/2010 04:42 AM, Mansour Al Akeel wrote:

Sven, thank you.
I had a look at the Ajax example. I think you mean that I need to use
the PanelDetails class as a model, and create all the properties in
it. This is very verbose as the Product class contains many fields
that I need to edit, and adding getters/setters to the PanelDetails
class will make it big, and the code is repeated.
Based on the example, my class should be:


public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;
private Product product;

public ProductDetails(String id, Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
this.product = product;
setDefaultModel(new 
CompoundPropertyModel(this));
}

public void setCodProduct(String codProduct) {
this.product.setCodProduct(codProduct);
}
public String getCodProduct() {
return this.product.getCodProduct();
}
}

This brings up a question, what is the best way to wrap domain objects
in a Model for easy CRUD and with a minimum amount of coding, and
reusing the component (ie, without having to recreate the object) ?


On Thu, Jul 15, 2010 at 10:12 PM, Sven Meier  wrote:
   

Hi,

please see EditableLabelPage.java in wicket-examples for AjaxEditableLabels
working with a CompoundPropertyModel.

 

Why would the reference be outdated, since ProperyModel is considered
dynamic module ?
   

PropertyModel is dynamic in the property it provides, but it is hard-wired
on the object you give to its constructor.

Hope this helps

Sven


On 07/15/2010 08:36 PM, Mansour Al Akeel wrote:
 

Sven,
thank you, but it worked when using this ?

add(new Label("codProduct"));

Is there an easy way to update the default model And the
AjaxEditableLabel in the similar fasion?  Nice to have an example.
Why would the reference be outdated, since ProperyModel is considered
dynamic module ?

Thank you.

On Thu, Jul 15, 2010 at 8:35 PM, Sven Meierwrote:

   

Hi,

it's the "outdated reference" problem (as often when something goes wrong
with models):

  new PropertyModel(getDefaultModel(), "codProduct"))

Note that you're putting the current default model into another model.
Later on you change the default model:

  setDefaultModel(new CompoundPropertyModel(product))

How should your PropertyModel be aware of this change?

BTW Martijn's statement is incorrect:

 

If you look at the source code for AjaxEditableLabel you could've seen
that it is not suited for CompoundPropertyModel usage.

   

AjaxEditableLabel is very well capable of working with
CompoundPropertyModels, see AjaxEditableLabel#getParentModel().

Regards

Sven


On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:

 

Hello Martrin, and Ernesto,
it's still not working. I have this ProductPanel to be updated and
(possibly edited). It shows the product info when an item is clicked.
Here's the code for the Product Panel:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new
PropertyModel(getDefaultModel(), "codProduct")));

add(new Label("tpVat"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product 
");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new
CompoundPropertyModel(product));
}
}

And here's the code for the i

Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread Igor Vaynberg
yes, i think the debug window shows it unescaped.

-igor

On Thu, Jul 15, 2010 at 8:47 PM, DmitryM  wrote:
>
> Okay, I will double check that (since it's still in the XML response coming
> back to the page)
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290924.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
>
>

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



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Okay, I will double check that (since it's still in the XML response coming
back to the page)
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290924.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: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread Igor Vaynberg
it is expected in order to escape any possible CDATA]]> closing tags,
this is escaped back into ] by javascript on the client side.

-igor

On Thu, Jul 15, 2010 at 9:07 AM, DmitryM  wrote:
>
> Hello, guys
>
> I've noticed one thing recently (could not find anything related in the
> forum).
> My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
> the Ajax response.
>
> Currently I see that all arrays' closing brackets ']' are turned into ']^'
> which technically breaks my JSON (and even simple javascript) being
> returned.
>
> Is it a bug or an expected behavior and I can do something about it?
>
> Because when Ajax response is being evaluated javascript gets parsing error
> and I'm not sure I have any control over it.
>
> Thanks,
> Dmitry
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.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
>
>

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



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread John Armstrong
Are you sure its not actually ^M which is a windows CR/LF linefeed?

This may be causing the parser to choke if its passing them through as literals.

Long shot, sorry :)
J

On Thu, Jul 15, 2010 at 9:07 AM, DmitryM  wrote:
>
> Hello, guys
>
> I've noticed one thing recently (could not find anything related in the
> forum).
> My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
> the Ajax response.
>
> Currently I see that all arrays' closing brackets ']' are turned into ']^'
> which technically breaks my JSON (and even simple javascript) being
> returned.
>
> Is it a bug or an expected behavior and I can do something about it?
>
> Because when Ajax response is being evaluated javascript gets parsing error
> and I'm not sure I have any control over it.
>
> Thanks,
> Dmitry
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.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
>
>

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



Re: Models and panel updates

2010-07-15 Thread Mansour Al Akeel
Sven, thank you.
I had a look at the Ajax example. I think you mean that I need to use
the PanelDetails class as a model, and create all the properties in
it. This is very verbose as the Product class contains many fields
that I need to edit, and adding getters/setters to the PanelDetails
class will make it big, and the code is repeated.
Based on the example, my class should be:


public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;
private Product product;

public ProductDetails(String id, Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
this.product = product;
setDefaultModel(new 
CompoundPropertyModel(this));
}

public void setCodProduct(String codProduct) {
this.product.setCodProduct(codProduct);
}
public String getCodProduct() {
return this.product.getCodProduct();
}
}

This brings up a question, what is the best way to wrap domain objects
in a Model for easy CRUD and with a minimum amount of coding, and
reusing the component (ie, without having to recreate the object) ?


On Thu, Jul 15, 2010 at 10:12 PM, Sven Meier  wrote:
> Hi,
>
> please see EditableLabelPage.java in wicket-examples for AjaxEditableLabels
> working with a CompoundPropertyModel.
>
>> Why would the reference be outdated, since ProperyModel is considered
>> dynamic module ?
>
> PropertyModel is dynamic in the property it provides, but it is hard-wired
> on the object you give to its constructor.
>
> Hope this helps
>
> Sven
>
>
> On 07/15/2010 08:36 PM, Mansour Al Akeel wrote:
>>
>> Sven,
>> thank you, but it worked when using this ?
>>
>> add(new Label("codProduct"));
>>
>> Is there an easy way to update the default model And the
>> AjaxEditableLabel in the similar fasion?  Nice to have an example.
>> Why would the reference be outdated, since ProperyModel is considered
>> dynamic module ?
>>
>> Thank you.
>>
>> On Thu, Jul 15, 2010 at 8:35 PM, Sven Meier  wrote:
>>
>>>
>>> Hi,
>>>
>>> it's the "outdated reference" problem (as often when something goes wrong
>>> with models):
>>>
>>>  new PropertyModel(getDefaultModel(), "codProduct"))
>>>
>>> Note that you're putting the current default model into another model.
>>> Later on you change the default model:
>>>
>>>  setDefaultModel(new CompoundPropertyModel(product))
>>>
>>> How should your PropertyModel be aware of this change?
>>>
>>> BTW Martijn's statement is incorrect:
>>>

 If you look at the source code for AjaxEditableLabel you could've seen
 that it is not suited for CompoundPropertyModel usage.

>>>
>>> AjaxEditableLabel is very well capable of working with
>>> CompoundPropertyModels, see AjaxEditableLabel#getParentModel().
>>>
>>> Regards
>>>
>>> Sven
>>>
>>>
>>> On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:
>>>

 Hello Martrin, and Ernesto,
 it's still not working. I have this ProductPanel to be updated and
 (possibly edited). It shows the product info when an item is clicked.
 Here's the code for the Product Panel:

 public class ProductDetails extends Panel {

       �...@ejb
        private ProductServicesLocal productServices;

        public ProductDetails(String id, final Product product) {
                super(id);
                setOutputMarkupId(true);
                this.setCurrentProduct(product);
                add(new Label("id"));

                add(new AjaxEditableLabel("codProduct",
                                new
 PropertyModel(getDefaultModel(), "codProduct")));

                add(new Label("tpVat"));

                add(new AjaxLink("save") {
                       �...@override
                        public void onClick(AjaxRequestTarget target) {
                                System.out.println("saving product 
 ");
                        }
                });
        }

        public void setCurrentProduct(Product product) {
                setDefaultModel(new
 CompoundPropertyModel(product));
        }
 }

 And here's the code for the item to update the panel:


                                AjaxLink    link = new
 AjaxLink("link") {
                                        {
                                                add(n

Re: Adding vertical scrollbar to the listview

2010-07-15 Thread Jeremy Thomerson
That's a css question.  http://www.google.com/search?q=css+overflow

On Thu, Jul 15, 2010 at 6:19 PM, jammyjohn  wrote:

>
> Hi,
>
> I have a list view that displays 5 blank rows. When I click the "add blank
> row" button, it adds 5 more rows to the existing 5 blank rows. Likewise, my
> listview may grow.
>
> Is there a possibility to add a scrollbar to my listview.
>
> Appreciate your help in this regard.
>
> Thanks
> J
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Adding-vertical-scrollbar-to-the-listview-tp2290796p2290796.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
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com


Adding vertical scrollbar to the listview

2010-07-15 Thread jammyjohn

Hi, 

I have a list view that displays 5 blank rows. When I click the "add blank
row" button, it adds 5 more rows to the existing 5 blank rows. Likewise, my
listview may grow.

Is there a possibility to add a scrollbar to my listview.

Appreciate your help in this regard.

Thanks
J
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Adding-vertical-scrollbar-to-the-listview-tp2290796p2290796.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: Preventing double-click of AjaxButtons in ModalWindow

2010-07-15 Thread Alex Grant
That's perfect, thank you for the help.

Alex

-Original Message-
From: Pedro Santos [mailto:pedros...@gmail.com] 
Sent: Friday, 16 July 2010 12:07 a.m.
To: users@wicket.apache.org
Subject: Re: Preventing double-click of AjaxButtons in ModalWindow

You can use an IAjaxCallDecorator to disable buttons and re-enable them with 
the ajax request completes

On Wed, Jul 14, 2010 at 7:53 PM, Alex Grant wrote:

> I have ModalWindows whose content contains OK AjaxButtons, which, 
> assuming validation passes, will do some processing and then close the 
> ModalWindow.
>
> If a user enters valid data and then double-clicks the OK button they 
> will get an Exception like this one, because Wicket has already 
> processed the closing of the ModalWindow in the first click and the 
> button is therefore no longer on the screen for the second click.
>
> org.apache.wicket.WicketRuntimeException: Submit Button 
> tabbedPanel:panel:form:view:productsForm:manageProductsPanel:addProduc
> tPanel:content:editForm:ok
> (path=wizard:tabbedPanel:tabForm:tabbedPanel:panel:form:view:productsF
> orm:manageProductsPanel:addProductPanel:content:editForm:ok)
> is not visible
> at org.apache.wicket.markup.html.form.Form$2.component(Form.java:620)
>
> Is there some way to prevent this? If the buttons could be disabled in 
> javascript and re-enabled with the ajax request completes, or even if 
> this particular error could be suppressed and ignored if I knew that 
> the submitting button was in a closed ModalWindow.
>
> Alex
>



--
Pedro Henrique Oliveira dos Santos

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



Re: Models and panel updates

2010-07-15 Thread Sven Meier

Hi,

please see EditableLabelPage.java in wicket-examples for AjaxEditableLabels 
working with a CompoundPropertyModel.


Why would the reference be outdated, since ProperyModel is considered dynamic 
module ?


PropertyModel is dynamic in the property it provides, but it is hard-wired on 
the object you give to its constructor.

Hope this helps

Sven


On 07/15/2010 08:36 PM, Mansour Al Akeel wrote:

Sven,
thank you, but it worked when using this ?

add(new Label("codProduct"));

Is there an easy way to update the default model And the
AjaxEditableLabel in the similar fasion?  Nice to have an example.
Why would the reference be outdated, since ProperyModel is considered
dynamic module ?

Thank you.

On Thu, Jul 15, 2010 at 8:35 PM, Sven Meier  wrote:
   

Hi,

it's the "outdated reference" problem (as often when something goes wrong
with models):

  new PropertyModel(getDefaultModel(), "codProduct"))

Note that you're putting the current default model into another model.
Later on you change the default model:

  setDefaultModel(new CompoundPropertyModel(product))

How should your PropertyModel be aware of this change?

BTW Martijn's statement is incorrect:
 

If you look at the source code for AjaxEditableLabel you could've seen
that it is not suited for CompoundPropertyModel usage.
   

AjaxEditableLabel is very well capable of working with
CompoundPropertyModels, see AjaxEditableLabel#getParentModel().

Regards

Sven


On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:
 

Hello Martrin, and Ernesto,
it's still not working. I have this ProductPanel to be updated and
(possibly edited). It shows the product info when an item is clicked.
Here's the code for the Product Panel:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new
PropertyModel(getDefaultModel(), "codProduct")));

add(new Label("tpVat"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new
CompoundPropertyModel(product));
}
}

And here's the code for the item to update the panel:


AjaxLinklink = new
AjaxLink("link") {
{
add(new Label("id", new
PropertyModel(model,
"id")));
}
@Override
public void
onClick(AjaxRequestTarget target) {
Product product =
item.getModelObject();

  productDetails.setCurrentProduct(product);

  target.addComponent(productDetails);

  System.out.println(product.getId());
}
};
item.add(link);


The problem with this code, is the Editable Label doesn't update with
the rest of the labels. I mean if I click on an item, it shows me the
results for the corresponding product in the Labels, but not in the
AjaxEditableLabel.



On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
wrote:

   

you need to add the updated panel into target:

target.addComponent(panelToBeUpdated);



2010/7/15 Mansour Al Akeel:

 

I just tried it. It doesn't update the panel. Here's the full code:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new
PropertyModel((Product)getDefaultModelObject(), "codProduct")));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product 
");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new
CompoundPropertyModel(product));
}
}

-
T

Re: Models and panel updates

2010-07-15 Thread Mansour Al Akeel
Sven,
thank you, but it worked when using this ?

add(new Label("codProduct"));

Is there an easy way to update the default model And the
AjaxEditableLabel in the similar fasion?  Nice to have an example.
Why would the reference be outdated, since ProperyModel is considered
dynamic module ?

Thank you.

On Thu, Jul 15, 2010 at 8:35 PM, Sven Meier  wrote:
> Hi,
>
> it's the "outdated reference" problem (as often when something goes wrong
> with models):
>
>  new PropertyModel(getDefaultModel(), "codProduct"))
>
> Note that you're putting the current default model into another model.
> Later on you change the default model:
>
>  setDefaultModel(new CompoundPropertyModel(product))
>
> How should your PropertyModel be aware of this change?
>
> BTW Martijn's statement is incorrect:
>>If you look at the source code for AjaxEditableLabel you could've seen
>>that it is not suited for CompoundPropertyModel usage.
>
> AjaxEditableLabel is very well capable of working with
> CompoundPropertyModels, see AjaxEditableLabel#getParentModel().
>
> Regards
>
> Sven
>
>
> On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:
>>
>> Hello Martrin, and Ernesto,
>> it's still not working. I have this ProductPanel to be updated and
>> (possibly edited). It shows the product info when an item is clicked.
>> Here's the code for the Product Panel:
>>
>> public class ProductDetails extends Panel {
>>
>>       �...@ejb
>>        private ProductServicesLocal productServices;
>>
>>        public ProductDetails(String id, final Product product) {
>>                super(id);
>>                setOutputMarkupId(true);
>>                this.setCurrentProduct(product);
>>                add(new Label("id"));
>>
>>                add(new AjaxEditableLabel("codProduct",
>>                                new
>> PropertyModel(getDefaultModel(), "codProduct")));
>>
>>                add(new Label("tpVat"));
>>
>>                add(new AjaxLink("save") {
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                System.out.println("saving product  ");
>>                        }
>>                });
>>        }
>>
>>        public void setCurrentProduct(Product product) {
>>                setDefaultModel(new
>> CompoundPropertyModel(product));
>>        }
>> }
>>
>> And here's the code for the item to update the panel:
>>
>>
>>                                AjaxLink  link = new
>> AjaxLink("link") {
>>                                        {
>>                                                add(new Label("id", new
>> PropertyModel(model,
>>                                                                "id")));
>>                                        }
>>                                       �...@override
>>                                        public void
>> onClick(AjaxRequestTarget target) {
>>                                                Product product =
>> item.getModelObject();
>>
>>  productDetails.setCurrentProduct(product);
>>
>>  target.addComponent(productDetails);
>>
>>  System.out.println(product.getId());
>>                                        }
>>                                };
>>                                item.add(link);
>>
>>
>> The problem with this code, is the Editable Label doesn't update with
>> the rest of the labels. I mean if I click on an item, it shows me the
>> results for the corresponding product in the Labels, but not in the
>> AjaxEditableLabel.
>>
>>
>>
>> On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
>>   wrote:
>>
>>>
>>> you need to add the updated panel into target:
>>>
>>> target.addComponent(panelToBeUpdated);
>>>
>>>
>>>
>>> 2010/7/15 Mansour Al Akeel:
>>>

 I just tried it. It doesn't update the panel. Here's the full code:

 public class ProductDetails extends Panel {

       �...@ejb
        private ProductServicesLocal productServices;

        public ProductDetails(String id, final Product product) {
                super(id);
                setOutputMarkupId(true);
                this.setCurrentProduct(product);
                add(new Label("id"));

                add(new AjaxEditableLabel("codProduct",
                                new
 PropertyModel((Product)getDefaultModelObject(), "codProduct")));

                add(new AjaxLink("save") {
                       �...@override
                        public void onClick(AjaxRequestTarget target) {
                                System.out.println("saving product 
 ");
                        }
                });
        }

        public void setCurrentProduct(Product product) {
                setDefaultModel(new
 CompoundPropertyModel(product));
        }
 }

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.

Re: Models and panel updates

2010-07-15 Thread Sven Meier

Hi,

it's the "outdated reference" problem (as often when something goes 
wrong with models):


  new PropertyModel(getDefaultModel(), "codProduct"))

Note that you're putting the current default model into another model.
Later on you change the default model:

  setDefaultModel(new CompoundPropertyModel(product))

How should your PropertyModel be aware of this change?

BTW Martijn's statement is incorrect:
>If you look at the source code for AjaxEditableLabel you could've seen
>that it is not suited for CompoundPropertyModel usage.

AjaxEditableLabel is very well capable of working with 
CompoundPropertyModels, see AjaxEditableLabel#getParentModel().


Regards

Sven


On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:

Hello Martrin, and Ernesto,
it's still not working. I have this ProductPanel to be updated and
(possibly edited). It shows the product info when an item is clicked.
Here's the code for the Product Panel:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new PropertyModel(getDefaultModel(), 
"codProduct")));

add(new Label("tpVat"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new CompoundPropertyModel(product));
}
}

And here's the code for the item to update the panel:


AjaxLink  link = new 
AjaxLink("link") {
{
add(new Label("id", new 
PropertyModel(model,
"id")));
}
@Override
public void onClick(AjaxRequestTarget 
target) {
Product product = 
item.getModelObject();

productDetails.setCurrentProduct(product);

target.addComponent(productDetails);

System.out.println(product.getId());
}
};
item.add(link);


The problem with this code, is the Editable Label doesn't update with
the rest of the labels. I mean if I click on an item, it shows me the
results for the corresponding product in the Labels, but not in the
AjaxEditableLabel.



On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
  wrote:
   

you need to add the updated panel into target:

target.addComponent(panelToBeUpdated);



2010/7/15 Mansour Al Akeel:
 

I just tried it. It doesn't update the panel. Here's the full code:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new 
PropertyModel((Product)getDefaultModelObject(), "codProduct")));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new CompoundPropertyModel(product));
}
}

-
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

   



-
To unsubscribe, e-mail: users-unsubscr...@wicket.

Re: Loading static javascript

2010-07-15 Thread Martin Makundi
Then you might want to use a resourcestream ?

Something like:

IResourceStream resourceStream = new AttachmentResourceStream(
new ByteArrayInputStream(item.getModelObject().getFile()));
getRequestCycle().setRequestTarget(
new ResourceStreamRequestTarget(resourceStream) {
  @Override
  public String getFileName() {
return item.getModelObject().getName();
  }
});

  static class AttachmentResourceStream extends AbstractResourceStream {
private InputStream attachment;

/**
 * @param attachment
 */
AttachmentResourceStream(InputStream attachment) {
  this.attachment = attachment;
}

/**
 * @see org.apache.wicket.util.resource.IResourceStream#close()
 */
@Override
public void close() throws IOException {
  attachment.close();
}

/**
 * @see org.apache.wicket.util.resource.IResourceStream#getInputStream()
 */
@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
  return attachment;
}
  }


**
Martin

2010/7/15 Jarosz Yohan :
> Perhaps I have badly explained something.
> my javascript files are not located in my webapps directory, but on the 
> filesystem
> On Jul 15, 2010, at 6:31 PM, Jarosz Yohan wrote:
>
> In fact, this is not working too.
> I think it because wicket couldn't find my javascript file.
> when I give url (this file can be accessed via url also) it's working, but 
> not with a filesystem path
> and I really need not to pass by filesytem...
>
> On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:
>
> This is easier:
>
>  response.renderJavascriptReference("/js/jquery.js");
>
>
> **
> Martin
>
> 2010/7/15 Jarosz Yohan mailto:yohan.jar...@epfl.ch>>:
> Hello,
>
> I'm trying to load statatic js files. I 'm using in the init of the 
> application
>
> getResourceSettings().addResourceFolder("/somePath/");
> resourceSettings.setResourceStreamLocator(new RessourceLocator());
>
> with
> public class RessourceLocator extends ResourceStreamLocator{
> public RessourceLocator() {}
> public IResourceStream locate(final Class clazz, final String path) {
>      IResourceStream located = super.locate(clazz, trimFolders(path));
>      if (located != null) {return located;}
>      return super.locate(clazz, path);
> }
>  private String trimFolders(String path) {
>      return path.substring(path.lastIndexOf("/") + 1);}
> }
>
> and in my Page I have
> add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
> and of course myFile.js located under /somePath"
>
> what am I missing?
>
> Yohan
>
>
>
> -
> To unsubscribe, e-mail: 
> users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: 
> users-h...@wicket.apache.org
>
>
> Jarosz Yohan
> Bioinformatics & Biostatistics Core Facility
> EPFL School of Life Sciences
>
>  EPFL SV PTECH PTBB
>  AAB 0 23
>  Station 15
>  1015 Lausanne
>  Switzerland
>
> phone: [+41 21 69] 31439
> email:   yohan.jar...@epfl.ch
>
>
>
>
> Jarosz Yohan
> Bioinformatics & Biostatistics Core Facility
> EPFL School of Life Sciences
>
>   EPFL SV PTECH PTBB
>   AAB 0 23
>   Station 15
>   1015 Lausanne
>   Switzerland
>
> phone: [+41 21 69] 31439
> email:   yohan.jar...@epfl.ch
>
>
>
>

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



Re: Loading static javascript

2010-07-15 Thread Jarosz Yohan
Perhaps I have badly explained something.
my javascript files are not located in my webapps directory, but on the 
filesystem
On Jul 15, 2010, at 6:31 PM, Jarosz Yohan wrote:

In fact, this is not working too.
I think it because wicket couldn't find my javascript file.
when I give url (this file can be accessed via url also) it's working, but not 
with a filesystem path
and I really need not to pass by filesytem...

On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:

This is easier:

  response.renderJavascriptReference("/js/jquery.js");


**
Martin

2010/7/15 Jarosz Yohan mailto:yohan.jar...@epfl.ch>>:
Hello,

I'm trying to load statatic js files. I 'm using in the init of the application

getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());

with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class clazz, final String path) {
  IResourceStream located = super.locate(clazz, trimFolders(path));
  if (located != null) {return located;}
  return super.locate(clazz, path);
}
  private String trimFolders(String path) {
  return path.substring(path.lastIndexOf("/") + 1);}
}

and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"

what am I missing?

Yohan



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


Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences

  EPFL SV PTECH PTBB
  AAB 0 23
  Station 15
  1015 Lausanne
  Switzerland

phone: [+41 21 69] 31439
email:   yohan.jar...@epfl.ch




Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences

   EPFL SV PTECH PTBB
   AAB 0 23
   Station 15
   1015 Lausanne
   Switzerland

phone: [+41 21 69] 31439
email:   yohan.jar...@epfl.ch





Re: Loading static javascript

2010-07-15 Thread Jarosz Yohan
In fact, this is not working too.
I think it because wicket couldn't find my javascript file.
when I give url (this file can be accessed via url also) it's working, but not 
with a filesystem path
and I really need not to pass by filesytem...

On Jul 15, 2010, at 6:06 PM, Martin Makundi wrote:

This is easier:

   response.renderJavascriptReference("/js/jquery.js");


**
Martin

2010/7/15 Jarosz Yohan mailto:yohan.jar...@epfl.ch>>:
Hello,

I'm trying to load statatic js files. I 'm using in the init of the application

getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());

with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class clazz, final String path) {
   IResourceStream located = super.locate(clazz, trimFolders(path));
   if (located != null) {return located;}
   return super.locate(clazz, path);
}
   private String trimFolders(String path) {
   return path.substring(path.lastIndexOf("/") + 1);}
}

and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"

what am I missing?

Yohan



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


Jarosz Yohan
Bioinformatics & Biostatistics Core Facility
EPFL School of Life Sciences

   EPFL SV PTECH PTBB
   AAB 0 23
   Station 15
   1015 Lausanne
   Switzerland

phone: [+41 21 69] 31439
email:   yohan.jar...@epfl.ch





Re: IPropertyReflectionAwareModel

2010-07-15 Thread Igor Vaynberg
no reason that i can see, file a jira. cant be fixed in 1.4 though.

-igor

2010/7/15 Uwe Schäfer :
> hi
>
> is there a particular reason, why IPropertyReflectionAwareModel does not
> extend IModel?
>
> it looks like an extension of IModel and i need exactly this: an IModel
> that implements IPropertyReflectionAwareModel: might be PropertyModel, might
> be something homebrewn
>
> currently i have to do something like
>
> foo(IModel myModel){
>  if (!(myModel instanceof IPropertyReflectionAwareModel))
>  yellAtProgrammer();
>  ...
> }
>
> cu uwe
>
>
> -
> 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



AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Hello, guys

I've noticed one thing recently (could not find anything related in the
forum).
My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
the Ajax response.

Currently I see that all arrays' closing brackets ']' are turned into ']^'
which technically breaks my JSON (and even simple javascript) being
returned.

Is it a bug or an expected behavior and I can do something about it?

Because when Ajax response is being evaluated javascript gets parsing error
and I'm not sure I have any control over it.

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.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: Loading static javascript

2010-07-15 Thread Martin Makundi
This is easier:

response.renderJavascriptReference("/js/jquery.js");


**
Martin

2010/7/15 Jarosz Yohan :
> Hello,
>
> I'm trying to load statatic js files. I 'm using in the init of the 
> application
>
> getResourceSettings().addResourceFolder("/somePath/");
> resourceSettings.setResourceStreamLocator(new RessourceLocator());
>
> with
> public class RessourceLocator extends ResourceStreamLocator{
> public RessourceLocator() {}
> public IResourceStream locate(final Class clazz, final String path) {
>        IResourceStream located = super.locate(clazz, trimFolders(path));
>        if (located != null) {return located;}
>        return super.locate(clazz, path);
> }
>    private String trimFolders(String path) {
>        return path.substring(path.lastIndexOf("/") + 1);}
> }
>
> and in my Page I have
> add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
> and of course myFile.js located under /somePath"
>
> what am I missing?
>
> Yohan
>
>

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



Loading static javascript

2010-07-15 Thread Jarosz Yohan
Hello,

I'm trying to load statatic js files. I 'm using in the init of the application

getResourceSettings().addResourceFolder("/somePath/");
resourceSettings.setResourceStreamLocator(new RessourceLocator());

with
public class RessourceLocator extends ResourceStreamLocator{
public RessourceLocator() {}
public IResourceStream locate(final Class clazz, final String path) {
IResourceStream located = super.locate(clazz, trimFolders(path));
if (located != null) {return located;}
return super.locate(clazz, path);
}
private String trimFolders(String path) {
return path.substring(path.lastIndexOf("/") + 1);}
}

and in my Page I have
add(JavascriptPackageResource.getHeaderContribution("/myFile.js"));
and of course myFile.js located under /somePath"

what am I missing?

Yohan



Re: wicket in a mobile application.

2010-07-15 Thread Martin Funk
2010/7/15 amit1400158 

>
> Is it favourable to develop android application in wicket or to use android
> sdk or any other framework??
>
as with so many other questions: it depends and there is no easy answer to
that.
There probably already have been written ephic papers on that subject.

Short answer that would come to my mind is. If you choose to develop a
webapplication using a servlet based framework like wiket you pbrobably
don't have to go far out our way.

On the other hand if you develop a andrdoid native app, it is possible to
come up with a user interface that gives a much better experiance to the
user. But still a server for the information you want to handle on the
device needs to be developed.

Either way, go ahead and have fun,

mf


> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/wicket-in-a-mobile-application-tp2287273p2289914.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>


Re: Models and panel updates

2010-07-15 Thread Mansour Al Akeel
Hello Martrin, and Ernesto,
it's still not working. I have this ProductPanel to be updated and
(possibly edited). It shows the product info when an item is clicked.
Here's the code for the Product Panel:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new PropertyModel(getDefaultModel(), 
"codProduct")));

add(new Label("tpVat"));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new CompoundPropertyModel(product));
}
}

And here's the code for the item to update the panel:


AjaxLink link = new 
AjaxLink("link") {
{
add(new Label("id", new 
PropertyModel(model,
"id")));
}
@Override
public void onClick(AjaxRequestTarget 
target) {
Product product = 
item.getModelObject();

productDetails.setCurrentProduct(product);

target.addComponent(productDetails);

System.out.println(product.getId());
}
};
item.add(link);


The problem with this code, is the Editable Label doesn't update with
the rest of the labels. I mean if I click on an item, it shows me the
results for the corresponding product in the Labels, but not in the
AjaxEditableLabel.



On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
 wrote:
> you need to add the updated panel into target:
>
> target.addComponent(panelToBeUpdated);
>
>
>
> 2010/7/15 Mansour Al Akeel :
>> I just tried it. It doesn't update the panel. Here's the full code:
>>
>> public class ProductDetails extends Panel {
>>
>>       �...@ejb
>>        private ProductServicesLocal productServices;
>>
>>        public ProductDetails(String id, final Product product) {
>>                super(id);
>>                setOutputMarkupId(true);
>>                this.setCurrentProduct(product);
>>                add(new Label("id"));
>>
>>                add(new AjaxEditableLabel("codProduct",
>>                                new 
>> PropertyModel((Product)getDefaultModelObject(), "codProduct")));
>>
>>                add(new AjaxLink("save") {
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                System.out.println("saving product  ");
>>                        }
>>                });
>>        }
>>
>>        public void setCurrentProduct(Product product) {
>>                setDefaultModel(new CompoundPropertyModel(product));
>>        }
>> }
>>
>> -
>> 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



How to prevent rendering of unauthorized components?

2010-07-15 Thread Martin Makundi
Hi!

I would like to avoid this error, to prevent the render alltogether.
How can I do that?

2010-07-15 17:15:52,117 75919560 [24056...@qtp-13963314-568] ERROR
RequestCycle  - Component [Page class =
com.mycompany.application.view.application.MainPage, id = 0, version =
3, ajax = 1] does not permit action RENDER
org.apache.wicket.authorization.UnauthorizedActionException: Component
[Page class = com.mycompany.application.view.application.MainPage, id
= 0, version = 3, ajax = 1] does not permit action RENDER
   at org.apache.wicket.Page.renderPage(Page.java:876)
   at 
org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:63)
   at 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
   at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1258)
   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)


**
Martin

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



IPropertyReflectionAwareModel

2010-07-15 Thread Uwe Schäfer

hi

is there a particular reason, why IPropertyReflectionAwareModel does not 
extend IModel?


it looks like an extension of IModel and i need exactly this: an 
IModel that implements IPropertyReflectionAwareModel: might be 
PropertyModel, might be something homebrewn


currently i have to do something like

foo(IModel myModel){
 if (!(myModel instanceof IPropertyReflectionAwareModel))
  yellAtProgrammer();
 ...
}

cu uwe


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



Re: wicket in a mobile application.

2010-07-15 Thread Jeremy Thomerson
On Thu, Jul 15, 2010 at 4:58 AM, amit1400158  wrote:

>
> Is it favourable to develop android application in wicket or to use android
> sdk or any other framework??
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/wicket-in-a-mobile-application-tp2287273p2289914.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>


You can't develop an Android application in Wicket.  You can develop a web
application that targets mobile phones, including Android.  Or, you can
develop an Android application with their JDK (or natively).  But a Wicket
app is a web app first.

-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Models and panel updates

2010-07-15 Thread Martin Makundi
you need to add the updated panel into target:

target.addComponent(panelToBeUpdated);



2010/7/15 Mansour Al Akeel :
> I just tried it. It doesn't update the panel. Here's the full code:
>
> public class ProductDetails extends Panel {
>
>       �...@ejb
>        private ProductServicesLocal productServices;
>
>        public ProductDetails(String id, final Product product) {
>                super(id);
>                setOutputMarkupId(true);
>                this.setCurrentProduct(product);
>                add(new Label("id"));
>
>                add(new AjaxEditableLabel("codProduct",
>                                new 
> PropertyModel((Product)getDefaultModelObject(), "codProduct")));
>
>                add(new AjaxLink("save") {
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                System.out.println("saving product  ");
>                        }
>                });
>        }
>
>        public void setCurrentProduct(Product product) {
>                setDefaultModel(new CompoundPropertyModel(product));
>        }
> }
>
> -
> 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: Models and panel updates

2010-07-15 Thread Ernesto Reinaldo Barreiro
Do you mean update the whole panel when you edit the "codProduct"?

Ernesto

On Thu, Jul 15, 2010 at 2:41 PM, Mansour Al Akeel
 wrote:
> I just tried it. It doesn't update the panel. Here's the full code:
>
> public class ProductDetails extends Panel {
>
>       �...@ejb
>        private ProductServicesLocal productServices;
>
>        public ProductDetails(String id, final Product product) {
>                super(id);
>                setOutputMarkupId(true);
>                this.setCurrentProduct(product);
>                add(new Label("id"));
>
>                add(new AjaxEditableLabel("codProduct",
>                                new 
> PropertyModel((Product)getDefaultModelObject(), "codProduct")));
>
>                add(new AjaxLink("save") {
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                System.out.println("saving product  ");
>                        }
>                });
>        }
>
>        public void setCurrentProduct(Product product) {
>                setDefaultModel(new CompoundPropertyModel(product));
>        }
> }
>
> -
> 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: Models and panel updates

2010-07-15 Thread Mansour Al Akeel
I just tried it. It doesn't update the panel. Here's the full code:

public class ProductDetails extends Panel {

@EJB
private ProductServicesLocal productServices;

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));

add(new AjaxEditableLabel("codProduct",
new 
PropertyModel((Product)getDefaultModelObject(), "codProduct")));

add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}

public void setCurrentProduct(Product product) {
setDefaultModel(new CompoundPropertyModel(product));
}
}

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



Re: Models and panel updates

2010-07-15 Thread Martijn Dashorst
If you look at the source code for AjaxEditableLabel you could've seen
that it is not suited for CompoundPropertyModel usage. Because the
editor requires two components: a label and an input box, which are
both created with "label" ,resp. "editor" component identifiers, which
both bind to the default model (in your case: none), they will use
their component id's to look up their model bindings. This is easily
solvable by providing an explicit propertymodel to the AEL.

The following should work:

add(new AEL("codProduct", new PropertyModel(getDefaultModel(),
"codProduct")));

Martijn

On Thu, Jul 15, 2010 at 2:25 PM, Mansour Al Akeel
 wrote:
> so what should I use in this case?
> can you give me an example, to update the panel and have ajax fields ?
>
>
> On Thu, Jul 15, 2010 at 3:17 PM, Martin Makundi
>  wrote:
>> Hi!
>>
>> I would dis-advice you using compoundpropertymodel. Dropping it will
>> make everything more explicit and clear all your problems. Using
>> compoundpropertymodel you will get all kinds of surprises.. sometimes,
>> and spend lot of extra time resolving.
>>
>> **
>> Martin
>>
>> 2010/7/15 Mansour Al Akeel :
>>> Hello all, I have been trying to resolve this issue. I have a panel
>>> that shows a product info.
>>>
>>> public class ProductDetails extends Panel {
>>>
>>>        public ProductDetails(String id, final Product product) {
>>>                super(id);
>>>                setOutputMarkupId(true);
>>>                this.setCurrentProduct(product);
>>>                add(new Label("id"));
>>>                add(new Label("codProduct"));
>>>                add(new AjaxLink("save") {
>>>                       �...@override
>>>                        public void onClick(AjaxRequestTarget target) {
>>>                                System.out.println("saving product  ");
>>>                        }
>>>                });
>>>        }
>>>        public void setCurrentProduct(Product product) {
>>>                setDefaultModel(new CompoundPropertyModel(product));
>>>        }
>>> }
>>>
>>>
>>> when ever I click a link to update the product panel using ajax link,
>>> I get the correct info displayed. However, I need to be able to edit
>>> the labels in the panel. So I used :
>>>
>>> add(new AjaxEditableLabel("codProduct"));
>>>
>>> I get this:
>>>
>>> WicketMessage: No get method defined for class: class
>>> rentals.entities.Product expression: label
>>>
>>> In a previous thread, I was advised to use CompoundPropertyModel, and
>>> I think it's easier, but why I am getting this ?
>>>
>>> -
>>> 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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.8

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



Re: Models and panel updates

2010-07-15 Thread Ernesto Reinaldo Barreiro
can you try

add(new AjaxEditableLabel("codProduct", new
PropertyModel(product, "codProduct"));

Ernesto


On Thu, Jul 15, 2010 at 2:08 PM, Mansour Al Akeel
 wrote:
> Hello all, I have been trying to resolve this issue. I have a panel
> that shows a product info.
>
> public class ProductDetails extends Panel {
>
>        public ProductDetails(String id, final Product product) {
>                super(id);
>                setOutputMarkupId(true);
>                this.setCurrentProduct(product);
>                add(new Label("id"));
>                add(new Label("codProduct"));
>                add(new AjaxLink("save") {
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                System.out.println("saving product  ");
>                        }
>                });
>        }
>        public void setCurrentProduct(Product product) {
>                setDefaultModel(new CompoundPropertyModel(product));
>        }
> }
>
>
> when ever I click a link to update the product panel using ajax link,
> I get the correct info displayed. However, I need to be able to edit
> the labels in the panel. So I used :
>
> add(new AjaxEditableLabel("codProduct"));
>
> I get this:
>
> WicketMessage: No get method defined for class: class
> rentals.entities.Product expression: label
>
> In a previous thread, I was advised to use CompoundPropertyModel, and
> I think it's easier, but why I am getting this ?
>
> -
> 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: Models and panel updates

2010-07-15 Thread Mansour Al Akeel
so what should I use in this case?
can you give me an example, to update the panel and have ajax fields ?


On Thu, Jul 15, 2010 at 3:17 PM, Martin Makundi
 wrote:
> Hi!
>
> I would dis-advice you using compoundpropertymodel. Dropping it will
> make everything more explicit and clear all your problems. Using
> compoundpropertymodel you will get all kinds of surprises.. sometimes,
> and spend lot of extra time resolving.
>
> **
> Martin
>
> 2010/7/15 Mansour Al Akeel :
>> Hello all, I have been trying to resolve this issue. I have a panel
>> that shows a product info.
>>
>> public class ProductDetails extends Panel {
>>
>>        public ProductDetails(String id, final Product product) {
>>                super(id);
>>                setOutputMarkupId(true);
>>                this.setCurrentProduct(product);
>>                add(new Label("id"));
>>                add(new Label("codProduct"));
>>                add(new AjaxLink("save") {
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                System.out.println("saving product  ");
>>                        }
>>                });
>>        }
>>        public void setCurrentProduct(Product product) {
>>                setDefaultModel(new CompoundPropertyModel(product));
>>        }
>> }
>>
>>
>> when ever I click a link to update the product panel using ajax link,
>> I get the correct info displayed. However, I need to be able to edit
>> the labels in the panel. So I used :
>>
>> add(new AjaxEditableLabel("codProduct"));
>>
>> I get this:
>>
>> WicketMessage: No get method defined for class: class
>> rentals.entities.Product expression: label
>>
>> In a previous thread, I was advised to use CompoundPropertyModel, and
>> I think it's easier, but why I am getting this ?
>>
>> -
>> 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: Models and panel updates

2010-07-15 Thread Martin Makundi
Hi!

I would dis-advice you using compoundpropertymodel. Dropping it will
make everything more explicit and clear all your problems. Using
compoundpropertymodel you will get all kinds of surprises.. sometimes,
and spend lot of extra time resolving.

**
Martin

2010/7/15 Mansour Al Akeel :
> Hello all, I have been trying to resolve this issue. I have a panel
> that shows a product info.
>
> public class ProductDetails extends Panel {
>
>        public ProductDetails(String id, final Product product) {
>                super(id);
>                setOutputMarkupId(true);
>                this.setCurrentProduct(product);
>                add(new Label("id"));
>                add(new Label("codProduct"));
>                add(new AjaxLink("save") {
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                System.out.println("saving product  ");
>                        }
>                });
>        }
>        public void setCurrentProduct(Product product) {
>                setDefaultModel(new CompoundPropertyModel(product));
>        }
> }
>
>
> when ever I click a link to update the product panel using ajax link,
> I get the correct info displayed. However, I need to be able to edit
> the labels in the panel. So I used :
>
> add(new AjaxEditableLabel("codProduct"));
>
> I get this:
>
> WicketMessage: No get method defined for class: class
> rentals.entities.Product expression: label
>
> In a previous thread, I was advised to use CompoundPropertyModel, and
> I think it's easier, but why I am getting this ?
>
> -
> 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



Models and panel updates

2010-07-15 Thread Mansour Al Akeel
Hello all, I have been trying to resolve this issue. I have a panel
that shows a product info.

public class ProductDetails extends Panel {

public ProductDetails(String id, final Product product) {
super(id);
setOutputMarkupId(true);
this.setCurrentProduct(product);
add(new Label("id"));
add(new Label("codProduct"));
add(new AjaxLink("save") {
@Override
public void onClick(AjaxRequestTarget target) {
System.out.println("saving product  ");
}
});
}
public void setCurrentProduct(Product product) {
setDefaultModel(new CompoundPropertyModel(product));
}
}


when ever I click a link to update the product panel using ajax link,
I get the correct info displayed. However, I need to be able to edit
the labels in the panel. So I used :

add(new AjaxEditableLabel("codProduct"));

I get this:

WicketMessage: No get method defined for class: class
rentals.entities.Product expression: label

In a previous thread, I was advised to use CompoundPropertyModel, and
I think it's easier, but why I am getting this ?

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



Re: Preventing double-click of AjaxButtons in ModalWindow

2010-07-15 Thread Pedro Santos
You can use an IAjaxCallDecorator to disable buttons and re-enable them with
the ajax request completes

On Wed, Jul 14, 2010 at 7:53 PM, Alex Grant wrote:

> I have ModalWindows whose content contains OK AjaxButtons, which, assuming
> validation passes, will do some processing and then close the ModalWindow.
>
> If a user enters valid data and then double-clicks the OK button they will
> get an Exception like this one, because Wicket has already processed the
> closing of the ModalWindow in the first click and the button is therefore no
> longer on the screen for the second click.
>
> org.apache.wicket.WicketRuntimeException: Submit Button
> tabbedPanel:panel:form:view:productsForm:manageProductsPanel:addProductPanel:content:editForm:ok
> (path=wizard:tabbedPanel:tabForm:tabbedPanel:panel:form:view:productsForm:manageProductsPanel:addProductPanel:content:editForm:ok)
> is not visible
> at org.apache.wicket.markup.html.form.Form$2.component(Form.java:620)
>
> Is there some way to prevent this? If the buttons could be disabled in
> javascript and re-enabled with the ajax request completes, or even if this
> particular error could be suppressed and ignored if I knew that the
> submitting button was in a closed ModalWindow.
>
> Alex
>



-- 
Pedro Henrique Oliveira dos Santos


Re: localizing resources

2010-07-15 Thread Paul Szulc
ok, thx!

On Thu, Jul 15, 2010 at 12:23 PM, Martin Grigorov wrote:

> name it logo_en.png, logo_es.png, ...
> then just set the Session locale after login:
>
> if (loginOk) {
>  session.setLocale(user.getLocale())
> ...
> }
>
> see also Session#setStyle().
>
> On Thu, 2010-07-15 at 11:58 +0200, Paul Szulc wrote:
> > Can we localize resources in Wicket? I mean imagine I have
> multiple-language
> > application and this application has a logo image. I have pl_logo.ong
> > en_logo.png es_logo.png and so on. And now I want to define my image in
> > markup once and in controller one, and let wicket to decided which
> resource
> > (which logo) is to be shown (depending on users language). Does wicket
> > already has this sort of functionality or do I have to implement it
> myself?
> >
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Best regards,
Paul Szulc

http://paulszulc.wordpress.com


Re: localizing resources

2010-07-15 Thread Martin Grigorov
name it logo_en.png, logo_es.png, ...
then just set the Session locale after login:

if (loginOk) {
 session.setLocale(user.getLocale())
...
}

see also Session#setStyle().

On Thu, 2010-07-15 at 11:58 +0200, Paul Szulc wrote:
> Can we localize resources in Wicket? I mean imagine I have multiple-language
> application and this application has a logo image. I have pl_logo.ong
> en_logo.png es_logo.png and so on. And now I want to define my image in
> markup once and in controller one, and let wicket to decided which resource
> (which logo) is to be shown (depending on users language). Does wicket
> already has this sort of functionality or do I have to implement it myself?
> 



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



Re: using comet to find all clients using a page

2010-07-15 Thread fachhoch

wicket cometd is it  asychronous  or synchronus ?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/using-comet-to-find-all-clients-using-a-page-tp2283204p2289929.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



localizing resources

2010-07-15 Thread Paul Szulc
Can we localize resources in Wicket? I mean imagine I have multiple-language
application and this application has a logo image. I have pl_logo.ong
en_logo.png es_logo.png and so on. And now I want to define my image in
markup once and in controller one, and let wicket to decided which resource
(which logo) is to be shown (depending on users language). Does wicket
already has this sort of functionality or do I have to implement it myself?

-- 
Best regards,
Paul Szulc

http://paulszulc.wordpress.com


Re: wicket in a mobile application.

2010-07-15 Thread amit1400158

Is it favourable to develop android application in wicket or to use android
sdk or any other framework??
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-in-a-mobile-application-tp2287273p2289914.html
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Wicket's Form Model (using hibernate entity or value objects) Design

2010-07-15 Thread vov

see org.apache.wicket.model.LoadableDetachableModel
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.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: Changing CSS classes

2010-07-15 Thread Ernesto Reinaldo Barreiro
Josh,

If you use default FeedbackPanel that's already done for you, as
following method shows...

protected String getCSSClass(final FeedbackMessage message)
{
return "feedbackPanel" + message.getLevelAsString();
}

So, all you have to do is add CSS  for  'li.feedbackPanelERROR',
'li.feedbackPanelERRORDEBUG'... and so on... If you need other CSS
classes for specific panel then you could override that method.

Regards,

Ernesto

On Thu, Jul 15, 2010 at 10:29 AM, Josh Kamau  wrote:
> Hi guys;
>
> I would like to change the CSS style of my feedback component depending on
> whether its error or info.
>
> How do do that? How do i modify the css class or id attribute of a
> component.
>
> Regards.
>
> Josh.
>

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



Re: Wicket's Form Model (using hibernate entity or value objects) Design

2010-07-15 Thread Nivedan Nadaraj
Hi All
I use Wicket with Hibernate. I have used the hibernate entity as a Form's
Model.Now however I noticed that I need to also add/update an LDAP
instance's entries.This means as part of my submit
Ineed to wicket to capture the non-entity properties also.

1. I either have to use a Value Object as a Form's model and then map it to
the entity that needs to be perisisted.
2. Map the VO values into LDAP.

This means i would have additional Mappers/Assemblers adding in more code to
be maintained and adds duplicate objects of the model itself.

Is there any other pattern someone has used in such a scenario?

I know this problem has a mix of Wicket and Hibernate but its just a design
issue.Any pointers?

Thanks for the time
Cheers
Nive


tomcat 7.0.0 getRelativePathPrefixToContextRoot

2010-07-15 Thread Ludger Kluitmann
Hi,

with running a wicket application under tomcat 7 I found a strange
difference to tomcat 6. getRelativePathPrefixToContextRoot in tomcat 6
is empty. In tomcat 7 getRelativePathPrefixToContextRoot delivers ../

I'm not sure if it is a wicket or a tomcat problem, but nevertheless I
get wrong path settings for some style sheets, javascript and images.

ludger

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



Changing CSS classes

2010-07-15 Thread Josh Kamau
Hi guys;

I would like to change the CSS style of my feedback component depending on
whether its error or info.

How do do that? How do i modify the css class or id attribute of a
component.

Regards.

Josh.


Re: Logging

2010-07-15 Thread Martin Makundi
That's a whole another story ... ;)

**
Martin

2010/7/15 Josh Kamau :
> Thanks Martin. I wanted to make sure am doing the right thing..
>
> Regards.
> On Thu, Jul 15, 2010 at 10:59 AM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
>>        private static final Logger log =
>> LoggerFactory.getLogger(WebPage.class);
>>
>>
>> 2010/7/15 Josh Kamau :
>> > Hi guys;
>> >
>> > I know wicket comes with pre configured logging . How do i get hold of
>> the
>> > Logger object so that i can log messages in my pages and panels?
>> >
>> > regards.
>> >
>> > Josh.
>> >
>>
>> -
>> 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: Logging

2010-07-15 Thread Josh Kamau
Thanks Martin. I wanted to make sure am doing the right thing..

Regards.
On Thu, Jul 15, 2010 at 10:59 AM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

>private static final Logger log =
> LoggerFactory.getLogger(WebPage.class);
>
>
> 2010/7/15 Josh Kamau :
> > Hi guys;
> >
> > I know wicket comes with pre configured logging . How do i get hold of
> the
> > Logger object so that i can log messages in my pages and panels?
> >
> > regards.
> >
> > Josh.
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Output just text, no component

2010-07-15 Thread Ted Vinke

 Darn, that's it! Thanks a lot!

Regards, Ted

Op 14-7-2010 16:04, James Carman schreef:

You can use a org.apache.wicket.util.template.JavaScriptTemplate.

On Wed, Jul 14, 2010 at 9:51 AM, Ted Vinke  wrote:

  Hi everybody!

I'm trying to accomplish something new with Wicket: output just some text,
instead of a component. I simply can't figure out how to dynamically render
from my backing Java class $XAML_FILENAME below (which is the suggested
snippet to embed JW Player).





*var* cnt = document.getElementById("mediaspace");

*var* src = '$XAML_FILENAME';

*var* cfg = {

file:'video.wmv',

height:'240',

width:'440'

};

*var* ply = *new* jeroenwijering.Player(cnt,src,cfg);




I've tried to put a SPAN where the $XAML_FILENAME is and add a Label with
setRenderBodyOnly(*true*) but that's for obvious reasons invalid HTML :)

Any hints are greatly appreciated!

Kind regards, Ted


-
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: Initiating File Download through Ajax is not working

2010-07-15 Thread MattyDE

Hey Svaen, thanks a lot. 

This works smoothly ;)

download = new AjaxDownloadBehavoir()
{
@Override
protected IResourceStream getResourceStream()
{   
return new FileResourceStream(getXMLFile());
}

@Override
protected String getFileName() {
return getXMLFile().getAbsoluteFile().getName();
}
};
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Initiating-File-Download-through-Ajax-is-not-working-tp2289784p2289809.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: Initiating File Download through Ajax is not working

2010-07-15 Thread Sven Meier

Hi,

IIRC you have to override AJAXDownload#getFileName(), this should 
trigger a download dialog in the browser.


Regards

Sven

On 07/15/2010 09:46 AM, MattyDE wrote:

Hi Folks,

i need to write an Web-XML-Filler. So i have to generate a XML-File
on-the-fly and after that i want to stream the generated File to the
browser.

Iam using this Example :
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
... and it works half with the behavoir.

 download = new AjaxDownloadBehavoir()
{
@Override
protected IResourceStream getResourceStream()
{   
return new FileResourceStream(getXMLFile());
}
};
add(download);

After initiating the File is not streamed to the browser, no, its shown in
the browser as a text-page.

btw: Iam Using an AjaxButton (with a form) not an AjaxLink... does this
matter?

Any hints?

Thanks in Advance!
   



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



Re: TextFilteredPropertyColumn feature?

2010-07-15 Thread Ivan Dudko
thank you!

error is really here.

2010/7/15 vov :
>
> I thing that you can have a problem with your FilterCriterionInterface:
> public String getComparedValue()
>        {
>          return filter.get("Name").toString();
>        }
> ...it can throw NullPointerExcaption if you did not input name filter
>
> Try to debug your dao.getResultSetFullSize(fltr)
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/TextFilteredPropertyColumn-feature-tp2289687p2289781.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
>
>

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



Re: Logging

2010-07-15 Thread Martin Makundi
private static final Logger log = 
LoggerFactory.getLogger(WebPage.class);


2010/7/15 Josh Kamau :
> Hi guys;
>
> I know wicket comes with pre configured logging . How do i get hold of the
> Logger object so that i can log messages in my pages and panels?
>
> regards.
>
> Josh.
>

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



Logging

2010-07-15 Thread Josh Kamau
Hi guys;

I know wicket comes with pre configured logging . How do i get hold of the
Logger object so that i can log messages in my pages and panels?

regards.

Josh.


Initiating File Download through Ajax is not working

2010-07-15 Thread MattyDE

Hi Folks,

i need to write an Web-XML-Filler. So i have to generate a XML-File
on-the-fly and after that i want to stream the generated File to the
browser.

Iam using this Example :
https://cwiki.apache.org/confluence/display/WICKET/AJAX+update+and+file+download+in+one+blow
 
... and it works half with the behavoir.

download = new AjaxDownloadBehavoir()
{
@Override
protected IResourceStream getResourceStream()
{   
return new FileResourceStream(getXMLFile());
}
};
add(download);

After initiating the File is not streamed to the browser, no, its shown in
the browser as a text-page.

btw: Iam Using an AjaxButton (with a form) not an AjaxLink... does this
matter?

Any hints?

Thanks in Advance!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Initiating-File-Download-through-Ajax-is-not-working-tp2289784p2289784.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: TextFilteredPropertyColumn feature?

2010-07-15 Thread vov

I thing that you can have a problem with your FilterCriterionInterface:
public String getComparedValue()
{
  return filter.get("Name").toString();
}
...it can throw NullPointerExcaption if you did not input name filter

Try to debug your dao.getResultSetFullSize(fltr)
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/TextFilteredPropertyColumn-feature-tp2289687p2289781.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: TextFilteredPropertyColumn feature?

2010-07-15 Thread Ivan Dudko
I know, it works..
But only if i fill two inputs it starts filtering.
If i miss one field - nothing heppens.

public class MyDataProvider extends SortableDataProvider
implements IFilterStateLocator{

private static final long serialVersionUID = 4127276061657391787L;

DataSource dataSource = QueryFactory.getDataSource();
private final MyDAOImpl dao = new MyDAOImpl(dataSource);
private Map filter = new HashMap();


final FilterInterface fltr = new FilterInterface() {

private static final long serialVersionUID = 2875452317013449087L;

public boolean isNative() {
return true;
}

public int getNativeFilterMode() {
return 0;
}

public int getFilterCriterionsCount() {
return 2;
}

public FilterCriterionInterface getFilterCriterion(int id) {
ArrayList fcs = new
ArrayList();
FilterCriterionInterface fc = new FilterCriterionInterface() {

public boolean isEnabled() {
return true;
}

public String getTargetField() {
return "Name";
}

public int getFiltermode() {
return 0;
}

public int getCriterionType() {
return 
FilterCriterionInterface.STRING_FILTER_CRITERION;
}

public ArrayList getComparedValues() {
return null;
}

public String getComparedValue2() {
return null;
}

public String getComparedValue() {
return filter.get("Name").toString();
}

public String getCompareType() {
return FilterCriterionInterface.ENTRY_IN_WORD;
}
};

FilterCriterionInterface fc2 = new FilterCriterionInterface() {

public boolean isEnabled() {
return true;
}

public String getTargetField() {
return "Path";
}

public int getFiltermode() {
return 0;
}

public int getCriterionType() {
return 
FilterCriterionInterface.STRING_FILTER_CRITERION;
}

public ArrayList getComparedValues() {
return null;
}

public String getComparedValue2() {
return null;
}

public String getComparedValue() {
return filter.get("Path").toString();
}

public String getCompareType() {
return 
FilterCriterionInterface.ENTRY_IN_WORD;
}
};  
fcs.add(fc2);
fcs.add(fc);
return fcs.get(id);
}
};



public MyDataProvider() throws QueryException {
setSort("id", true);
filter = new HashMap();
}


public Iterator iterator(int first, int count) {
SortParam sp = getSort();
return dao.getData(first, count, sp.getProperty(),
sp.isAscending(), fltr).iterator();
}

@SuppressWarnings({ "unchecked", "rawtypes" })
public IModel model(Object object) {
return new Model((Serializable)object);
}

public int size() {
return dao.getResu

Re: TextFilteredPropertyColumn feature?

2010-07-15 Thread vov

Your page look fine, but you do not attach code for 'MyDataProvider'
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/TextFilteredPropertyColumn-feature-tp2289687p2289754.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