Re: RE: back link

2010-08-08 Thread Leszek Gawron
Well ... first off the code was written out the top of my head and as it is
totally trivial there should be no problem there is a typo somewhere.

Answering your second concern: no it shouldn't be built-in in:
- it breaks pages' statelessness
- the web navigation is hardly ever linear so you always need to tweak it
for your needs.
- when you put ajax info the picture you need to come up with another
approach.

Cheers

W dniu 2010-08-09 02:33 użytkownik "Alex Rass"  napisał:

Well, first off, there's a bug:


> setResponsePage( new TargetPage( new SomeModel(),
> Originatin...
Needs to be part of constructor call:


> setResponsePage( new TargetPage( new SomeModel(),
>   OriginatingPage.this )  );

Second of all: this seems so "dirty".
Doing this means that for something THIS simple and common, you need to go
and change ALL your page's constructors?

Yes, I can go through the types of Pages and inherit them all once and add
all features I need into them, but it also seems like it's something that
should be inherent/built in, no?

- Alex


>-Original Message-
>From: Leszek Gawron [mailto:lgaw...@gmail.com] On Behalf Of Leszek
Gaw...


autocomplete works in development but It doesn't in production

2010-08-08 Thread Fernando Wermus
Hi all,
 Any advice or clue about how to solve this issue?

thanks in advance

-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus


Re: DataView/LoadableDetachableModel/onClick

2010-08-08 Thread Igor Vaynberg
 final Customer customer = item.getModelObject();
...   Link link = new Link("link") {
   public void onClick()   {
   setResponsePage(new CustomerPage(customer));

the line above holds on to the customer object, so the Link subclass
has a reference to customer. instead
...   Link link = new Link("link", item.getmodel()) {
   public void onClick()   {

   setResponsePage(new
CustomerPage((Customer)getmodelobject()));

-igor

On Sun, Aug 8, 2010 at 8:16 PM, Chris Merrill  wrote:
> I have a DataView on a page to list items returned by a DB query (using JPA). 
>  My database object
> (Customer) has LoadableDetachableModel class (called DetachableCustomerModel) 
> that the provider
> returns via the model() method.  When populating the table, I want a link to 
> a page for the details
> of that object. The following code actually works, but throws a 
> WicketNotSerializableException
> on my Customer class when the page is rendered:
>
>
>        final DataView table_viewer = new 
> DataView("customer_list", provider)
>            {
>           �...@override
>            protected void populateItem(final Item item)
>                {
>                final Customer customer = item.getModelObject();
>                item.add(new Label("id", String.valueOf(customer.getId(;
>                Link link = new Link("link")
>                    {
>                   �...@override
>                    public void onClick()
>                        {
>                        Debug.log.out("CustomerListPage.onClick() - customer: 
> " + customer.getName());
>                        setResponsePage(new CustomerPage(customer));
>                        }
>                    };
>                item.add(link);
>                link.add(new Label("name", customer.getName()));
>                String date_string = "";
>                Date date = customer.getLastActivity();
>                if (date != null)                         // TODO should this 
> really ever be null?
>                    date_string = DateUtil.toSimpleDateString(date);
>                item.add(new Label("date", date_string));
>                }
>            };
>
> From what I understand, it SHOULD throw that exception, since the Customer 
> came from JPA and
> shouldn't be serialized. That is, I think, why the LoadableDetachableModel 
> exists.  So, thinking
> that I should be using the model instead, I tried this variation, but was 
> surprised to find
> the same result.
>
>        final DataView table_viewer = new 
> DataView("customer_list", provider)
>            {
>           �...@override
>            protected void populateItem(final Item item)
>                {
>                final IModel customer_model = item.getModel();
>                Customer customer = customer_model.getObject();
>                item.add(new Label("id", String.valueOf(customer.getId(;
>                Link link = new Link("link")
>                    {
>                   �...@override
>                    public void onClick()
>                        {
>                        Debug.log.out("CustomerListPage.onClick() - customer: 
> " +
> customer_model.getObject().getName());
>                        setResponsePage(new 
> CustomerPage(customer_model.getObject()));
>                        }
>                    };
>                item.add(link);
>                link.add(new Label("name", customer.getName()));
>                String date_string = "";
>                Date date = customer.getLastActivity();
>                if (date != null)                         // TODO should this 
> really ever be null?
>                    date_string = DateUtil.toSimpleDateString(date);
>                item.add(new Label("date", date_string));
>                }
>            };
>
> So I'm obviously missing something important about the right way to do this.
>
> Can someone point me in the right direction?
>
> TIA!
> Chris
>
>
>
> --
>  -
> Chris Merrill                           |  Web Performance, Inc.
> ch...@webperformance.com                |  http://webperformance.com
> 919-433-1762                            |  919-845-7601
>
> Web Performance: Website Load Testing Software & Services
>  -
>
> -
> 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: Ajax-Panel Toggling Visibility

2010-08-08 Thread Nivedan Nadaraj
Hi
Thanks for the pointers.

I have tried doing the following and yet to see the expected result (i.e
re-render the list view with the new items)

1 .Using an entirely new Model instance, and seting it using setModel
2. When the Listview is created I have said setReuseItems(true)
3. When the model has changed I execute the listview.removeAll() (prior to
updating the model)// as per documentation  removeAll is to be called if
model changed
4. Since we say setModel() wouldn't that call modelChanged()? Anyways I have
expliclty invoked modelChanged

Bascially, I have got the ListView inside a panel.The panel is wrapped
inside the WebmarkupContainer.

thanks again
Niv


On Fri, Aug 6, 2010 at 6:57 PM, Wilhelmsen Tor Iver wrote:

> > this.setModelObject(updatedModelInstance);
>
> Are you sure you do not mean setModel() instead of setModelObject() here?
>
> Also, look into whether you use setReuseItems(true) on the listview, then
> you probably want modelChanged() somewhere too.
>
> - Tor Iver
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


DataView/LoadableDetachableModel/onClick

2010-08-08 Thread Chris Merrill
I have a DataView on a page to list items returned by a DB query (using JPA).  
My database object
(Customer) has LoadableDetachableModel class (called DetachableCustomerModel) 
that the provider
returns via the model() method.  When populating the table, I want a link to a 
page for the details
of that object. The following code actually works, but throws a 
WicketNotSerializableException
on my Customer class when the page is rendered:


final DataView table_viewer = new 
DataView("customer_list", provider)
{
@Override
protected void populateItem(final Item item)
{
final Customer customer = item.getModelObject();
item.add(new Label("id", String.valueOf(customer.getId(;
Link link = new Link("link")
{
@Override
public void onClick()
{
Debug.log.out("CustomerListPage.onClick() - customer: " 
+ customer.getName());
setResponsePage(new CustomerPage(customer));
}
};
item.add(link);
link.add(new Label("name", customer.getName()));
String date_string = "";
Date date = customer.getLastActivity();
if (date != null) // TODO should this 
really ever be null?
date_string = DateUtil.toSimpleDateString(date);
item.add(new Label("date", date_string));
}
};

>From what I understand, it SHOULD throw that exception, since the Customer 
>came from JPA and
shouldn't be serialized. That is, I think, why the LoadableDetachableModel 
exists.  So, thinking
that I should be using the model instead, I tried this variation, but was 
surprised to find
the same result.

final DataView table_viewer = new 
DataView("customer_list", provider)
{
@Override
protected void populateItem(final Item item)
{
final IModel customer_model = item.getModel();
Customer customer = customer_model.getObject();
item.add(new Label("id", String.valueOf(customer.getId(;
Link link = new Link("link")
{
@Override
public void onClick()
{
Debug.log.out("CustomerListPage.onClick() - customer: " 
+
customer_model.getObject().getName());
setResponsePage(new 
CustomerPage(customer_model.getObject()));
}
};
item.add(link);
link.add(new Label("name", customer.getName()));
String date_string = "";
Date date = customer.getLastActivity();
if (date != null) // TODO should this 
really ever be null?
date_string = DateUtil.toSimpleDateString(date);
item.add(new Label("date", date_string));
}
};

So I'm obviously missing something important about the right way to do this.

Can someone point me in the right direction?

TIA!
Chris



-- 
 -
Chris Merrill   |  Web Performance, Inc.
ch...@webperformance.com|  http://webperformance.com
919-433-1762|  919-845-7601

Web Performance: Website Load Testing Software & Services
 -

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



RE: back link

2010-08-08 Thread Alex Rass
Well, first off, there's a bug:

>  setResponsePage( new TargetPage( new SomeModel(),
>   OriginatingPage.this );

Needs to be part of constructor call:

>  setResponsePage( new TargetPage( new SomeModel(),
>   OriginatingPage.this )  );

Second of all: this seems so "dirty".
Doing this means that for something THIS simple and common, you need to go
and change ALL your page's constructors?

Yes, I can go through the types of Pages and inherit them all once and add
all features I need into them, but it also seems like it's something that
should be inherent/built in, no?

- Alex

>-Original Message-
>From: Leszek Gawron [mailto:lgaw...@gmail.com] On Behalf Of Leszek
Gawron
>Sent: Friday, 6 August 2010 10:22 PM
>To: users@wicket.apache.org
>Subject: Re: back link
>
>You are better of with something like this :
>
>public class OriginatingPage extends WebPage {
>   public OriginatingPage() {
>  add( new Link( "targetPage" ) {
>public void onClick() {
>  setResponsePage( new TargetPage( new SomeModel(),
>   OriginatingPage.this );
>}
>  }
>   }
>}
>
>
>public class TargetPage extends WebPage {
>   public TargetPage( IModel model, final Page returnPage ) {
> super( model );
> add( new Link( "back" ) {
>   public void onClick() {
> setResponsePage( returnPage );
>   }
> }
>   }
>}
>
>
>You can use analogous technique for panel replacement.
>
>this way it always 100% predictable (and BTW works when javascript is
>not available: javascript turned off, dummy browsers on mobile
devices).
>
>--
>Leszek Gawron http://www.mobilebox.pl/krs.html
>CTO at MobileBox Ltd.
>
>-
>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: how to dinamically add a wicket property to the key in the properties file

2010-08-08 Thread zoran

Sorry,

I don't know why it didn't work before, but it works now.

Thanks.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-dinamically-add-a-wicket-property-to-the-key-in-the-properties-file-tp2317893p2317938.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: how to dinamically add a wicket property to the key in the properties file

2010-08-08 Thread Martin Makundi
Please use debugger and find out why it does not work. Should work.

**
Martin

2010/8/8 zoran :
>
> Martin,
>
> I've tried this, but it doesn't work.
>
> Any other idea?
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-dinamically-add-a-wicket-property-to-the-key-in-the-properties-file-tp2317893p2317912.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: how to dinamically add a wicket property to the key in the properties file

2010-08-08 Thread zoran

Martin,

I've tried this, but it doesn't work.

Any other idea?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-dinamically-add-a-wicket-property-to-the-key-in-the-properties-file-tp2317893p2317912.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: how to dinamically add a wicket property to the key in the properties file

2010-08-08 Thread Martin Makundi
Try getString("alertmessage",
Model.ofMap(Collections.singletonMap("pagetitle", "My page title")));


**
Martin

2010/8/8 zoran :
>
> Hi,
>
> I want to use key from properties file with wicket page property added in
> this
> value. I tried this way, but it doesn't work.
>
> String js="alert('"+getString("alertmessage")+"');";
>                                        target.appendJavascript(js);
>
> alertmessage=Learning goal ${pagetitle} updated  successfully.
>
> As result I got an alert with message:
>
> Learning goal ${pagetitle} updated  successfully.
>
> What is wrong with this code?
>
> Zoran
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-dinamically-add-a-wicket-property-to-the-key-in-the-properties-file-tp2317893p2317893.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



how to dinamically add a wicket property to the key in the properties file

2010-08-08 Thread zoran

Hi,

I want to use key from properties file with wicket page property added in
this
value. I tried this way, but it doesn't work. 

String js="alert('"+getString("alertmessage")+"');";
target.appendJavascript(js);

alertmessage=Learning goal ${pagetitle} updated  successfully.

As result I got an alert with message:

Learning goal ${pagetitle} updated  successfully.

What is wrong with this code?

Zoran
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-dinamically-add-a-wicket-property-to-the-key-in-the-properties-file-tp2317893p2317893.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: robots.txt

2010-08-08 Thread Nikita Tovstoles
my bad - let me clarify:

if robots.txt is being stored in appserver's webapp directory, then yes,
that'll work regardless app's context path. If it's being packaged with the
webapp - and is part of, say, a mvn project, it can be stored in
{project}/src/main/webapp. However, the webapp should then be deployed @
root context.

-nikita

On Sun, Aug 8, 2010 at 11:28 AM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Not really...
>
> 2010/8/8 Nikita Tovstoles :
> > ..that assumes that the app's context path is "/".
> >
> > On Sun, Aug 8, 2010 at 3:03 AM, Martin Makundi <
> > martin.maku...@koodaripalvelut.com> wrote:
> >
> >> Hi!
> >>
> >> You can insert static stuff in webapp/. directory.
> >>
> >> **
> >> Martin
> >>
> >> 2010/8/8 Sefa Irken :
> >> > This is a ridicilous question, I am pretty new to web and servlet
> world
> >> > (coming from  desktop java). I couldn't figure out, how to serve my
> >> > robots.txt under www.site.com/robots.txt. How can I do that in Wicket
> ?
> >> >
> >>
> >> -
> >> 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: robots.txt

2010-08-08 Thread Martin Makundi
Not really...

2010/8/8 Nikita Tovstoles :
> ..that assumes that the app's context path is "/".
>
> On Sun, Aug 8, 2010 at 3:03 AM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
>> Hi!
>>
>> You can insert static stuff in webapp/. directory.
>>
>> **
>> Martin
>>
>> 2010/8/8 Sefa Irken :
>> > This is a ridicilous question, I am pretty new to web and servlet world
>> > (coming from  desktop java). I couldn't figure out, how to serve my
>> > robots.txt under www.site.com/robots.txt. How can I do that in Wicket ?
>> >
>>
>> -
>> 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: robots.txt

2010-08-08 Thread Nikita Tovstoles
..that assumes that the app's context path is "/".

On Sun, Aug 8, 2010 at 3:03 AM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Hi!
>
> You can insert static stuff in webapp/. directory.
>
> **
> Martin
>
> 2010/8/8 Sefa Irken :
> > This is a ridicilous question, I am pretty new to web and servlet world
> > (coming from  desktop java). I couldn't figure out, how to serve my
> > robots.txt under www.site.com/robots.txt. How can I do that in Wicket ?
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: robots.txt

2010-08-08 Thread Martin Makundi
Hi!

You can insert static stuff in webapp/. directory.

**
Martin

2010/8/8 Sefa Irken :
> This is a ridicilous question, I am pretty new to web and servlet world
> (coming from  desktop java). I couldn't figure out, how to serve my
> robots.txt under www.site.com/robots.txt. How can I do that in Wicket ?
>

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



robots.txt

2010-08-08 Thread Sefa Irken
This is a ridicilous question, I am pretty new to web and servlet world
(coming from  desktop java). I couldn't figure out, how to serve my
robots.txt under www.site.com/robots.txt. How can I do that in Wicket ?