Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread chimaira
Thanks  Igor, But , how can I assign the markup Id ? There is no constructor
with a super(id) method ! 

Thanks again

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4323167.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread Martin Grigorov
Hi,

On Tue, Jan 24, 2012 at 10:27 AM, chimaira death_style2...@hotmail.com wrote:
 Thanks  Igor, But , how can I assign the markup Id ? There is no constructor
 with a super(id) method !

Which markup id you need ?


@Override
   public CharSequence decorateScript(Component c, CharSequence script){
   return if (!confirm(' +
StringUtils.replace(confirmMessage, ',
\') + ')) return false;\n + script;

This is the code that generates the JavaScript. Here you receive the
component (c), so you can use c.getMarkupId(), if this is the markup
id you need.


 Thanks again

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4323167.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: wicket 1.5.3 RequestCycleListener redirection migration problem

2012-01-24 Thread Martin Grigorov
Hi,

See CryptoMapper and HttpsMapper classes and there usages in Wicket.
These are examples of root request mapper pattern in Wicket.
See https://cwiki.apache.org/confluence/display/WICKET/Request+mapping

So you can create your own AgreementRequestMapper and register it as
root mapper.
In #mapRequest(Url) impl you should check whether the current user has
agreed and return either new RenderPageRequestHandler(new
PageProvider(YourPage.class)) or delegate mapRequest() call to the
original root mapper

On Mon, Jan 23, 2012 at 7:10 PM, Schnick nick.fea...@gmail.com wrote:

 Martin Grigorov-4 wrote

 Hi,

 On Fri, Jan 20, 2012 at 6:15 PM, Schnick lt;nick.featch@gt; wrote:
 Hello all,

 I am trying to migrate to wicket 1.5.3 but am having problems. I would
 like
 to redirect users to a particular wicket page at any given time in their
 visit. I have overridden RequestCycleListener's onBeginRequest method so
 that it sets the request cycles response page like so
  cycle.setResponsePage(TermsAndConditionsInputPage.class);
 and
  scheduleRequestHandlerAfterCurrent(new RenderPageRequestHandler(new
 PageProvider(TermsAndConditionsInputPage.class))) ;

 but get the following error and the desired page to redirect to is not
 loaded.
  java.lang.IllegalStateException: Header was already written to response!

 The following code redirects to the page I want but also generates a
 warning
 ... java.lang.IllegalStateException: Committed

 WebResponse webResponse = (WebResponse]) cycle.getResponse();
 webResponse.sendRedirect(terms-and-conditions));

 I would appreciate any help and thoughts on how to solve this problem. I
 haven't found any posts of people redirecting from RequestCycleListener
 onBeginRequest method. Is their a better approach?

 P.S in wicket 1.4.19 the code to redirect was
 setRedirect(true);
 setResponsePage(TermsAndConditionsInputPage.class)

 In 1.5.x you need just the second line.

 Why do you want to do that in onBeginRequest() ? Do it where you did it in
 1.4.x







 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4313664.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com

 -
 To unsubscribe, e-mail: users-unsubscribe@.apache
 For additional commands, e-mail: users-help@.apache


 In 1.4.x I override WebRequestCycle and did the redirected in onBeginRequest
 method so for 1.5 overriding the AbstractRequestCycleListener's
 onBeginRequest seems like the best choice. I can't override the
 applicaiton's createRequestCycle method since it has been made final.

 Changing the web request cycle was done to ensure that the user could not
 perform any further actions till they agreed to the terms and conditions of
 the website. Is their a better way to Wicket way to do this? At this point
 all i can think of doing is adding redirects to each page.

 I've also tried overriding newWebRequest and newWebResponse but get the
 following exception when I query the web session from these methods.
  java.lang.IllegalArgumentException: Argument 'requestCycle' may not be
 null.


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-3-RequestCycleListener-redirection-migration-problem-tp4313664p4321330.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread chimaira
Hi martin, 
oops I thought the AjaxCallDecorator was a markup component,  sorry

So how can I implement it in my AjaxLink ? By simply adding it in my
constructor? 


Thanks again 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4323255.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: replace input type=button with tag a

2012-01-24 Thread cosmindumy
In wicket 1.4.18 there is no method setBody() in AbstractLink.
If there is no other possibility don't bother. I found a backup solution.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/replace-input-type-button-with-tag-a-tp4320997p4323257.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread Martin Grigorov
new AjaxLink() {

  protected IAjaxCallDecorator getAjaxCallDecorator() {return new
JSConfirmDecorator(); }
}

On Tue, Jan 24, 2012 at 11:04 AM, chimaira death_style2...@hotmail.com wrote:
 Hi martin,
 oops I thought the AjaxCallDecorator was a markup component,  sorry

 So how can I implement it in my AjaxLink ? By simply adding it in my
 constructor?


 Thanks again

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4323255.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



[1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in the 
available choices collection


logger.warn(
Detected inconsistency in choice component: {}/{}. 
Model returned object: {}, but this object is not available in the list 
of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that to work.

Is there another way of selecting the object?

Thanks
Per

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



Re: [1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Maybe a usecase helps :-)

I load my choices in a LDM. The selected choice is located in the domain 
model.

So the objects are equal by semantic but not by instance.

Dropdown choices are d, Germany; dk, Danmark hashcodes are 1 and 2
selected value is d, Germany hashcode is 3

Cheers
Per

Am 24.01.2012 10:42, schrieb Per Newgro:

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in the 
available choices collection


logger.warn(
Detected inconsistency in choice component: 
{}/{}. Model returned object: {}, but this object is not available in 
the list of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that to 
work.

Is there another way of selecting the object?

Thanks
Per

-
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: Problems with requests to MountPath and optional parameters

2012-01-24 Thread Martin Grigorov
Hi,

On Tue, Jan 24, 2012 at 9:37 AM, shayy sha...@gmail.com wrote:
 Hi,

 I'm trying to use @MountPath in conjunction with Wicket 1.5 but I'm
 encountering an issue.

 I've configured the following mount path on one of my page classes:
 @MountPath(/items/#{itemName}/#{itemNumber}/#{itemDate}/#{subItemName})

 Requesting the following URL results in a 404 when using Firefox or IE and
 is in constant loading mode when using Chrome:
 host/items/itemName/381/2011-12-22T21:08:32.960+0200/sub.item:221

I think the + sign causes this. Try without it.


 But requesting the same URL with a trailing / works.

 I am thinking it might be a problem with the special characters, as the
 request succeeds with no trailing / if I substitue all values to simple
 strings:
 host/items/itemName/381/itemDate/subitemName

 Am I misconfiguring the mount path in any way?
 Could it be that the special characters are the cause of this behavior?

 Thanks,
 Shay

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Problems-with-requests-to-MountPath-and-optional-parameters-tp4323095p4323095.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread chimaira

I got it,

Thanks for your help  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4323328.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: [1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Sven Meier

Hi,

Igor's commit statements says improved inconsistency handling in choice 
components.
This change prevents IChoiceRenderer#getIdValue() being called with -1 
as the index argument.


I assume you are using a custom IChoiceRenderer which doesn't use the 
index but a custom identifier?


Try overriding #getModelValue():

@Override
public String getModelValue()
{
final Foo object = getModelObject();
if (object != null)
{
return  + object.getBar();
}
else
{
return ;
}
}

And create a jira issue please. We might have to revert this change.

Sven

Am 24.01.2012 10:52, schrieb Per Newgro:

Maybe a usecase helps :-)

I load my choices in a LDM. The selected choice is located in the 
domain model.

So the objects are equal by semantic but not by instance.

Dropdown choices are d, Germany; dk, Danmark hashcodes are 1 and 2
selected value is d, Germany hashcode is 3

Cheers
Per

Am 24.01.2012 10:42, schrieb Per Newgro:

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in the 
available choices collection


logger.warn(
Detected inconsistency in choice component: 
{}/{}. Model returned object: {}, but this object is not available in 
the list of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that to 
work.

Is there another way of selecting the object?

Thanks
Per

-
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: [1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Thanks Sven,

https://issues.apache.org/jira/browse/WICKET-4353

Cheers
Per

Am 24.01.2012 11:31, schrieb Sven Meier:

Hi,

Igor's commit statements says improved inconsistency handling in 
choice components.
This change prevents IChoiceRenderer#getIdValue() being called with -1 
as the index argument.


I assume you are using a custom IChoiceRenderer which doesn't use the 
index but a custom identifier?


Try overriding #getModelValue():

@Override
public String getModelValue()
{
final Foo object = getModelObject();
if (object != null)
{
return  + object.getBar();
}
else
{
return ;
}
}

And create a jira issue please. We might have to revert this change.

Sven

Am 24.01.2012 10:52, schrieb Per Newgro:

Maybe a usecase helps :-)

I load my choices in a LDM. The selected choice is located in the 
domain model.

So the objects are equal by semantic but not by instance.

Dropdown choices are d, Germany; dk, Danmark hashcodes are 1 and 2
selected value is d, Germany hashcode is 3

Cheers
Per

Am 24.01.2012 10:42, schrieb Per Newgro:

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in 
the available choices collection


logger.warn(
Detected inconsistency in choice component: 
{}/{}. Model returned object: {}, but this object is not available 
in the list of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that 
to work.

Is there another way of selecting the object?

Thanks
Per

-
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.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How to retrieve form value within onSubmit

2012-01-24 Thread Kayode Odeyemi
Hi,

I will like to understand the dynamics behind retrieving form values when
they are submitted.

I have the following code:

Dashboard.html
---
body
span wicket:id='mainNavigation'/

 form wicket:id=searchForm
 label for=searchSearch:/label
 input wicket:id=searchtextfield type=text / br /
 input type=submit/
/form

/body

Dashboard.java
--
public class Dashboard extends BasePage {

private static final Logger log =
Logger.getLogger(Dashboard.class.getName());

public Dashboard() {
super ();
final SearchForm searchForm = new SearchForm(searchForm);
add(searchForm);
}

public Dashboard(IModel model) {
super(model);
}

private class SearchForm extends Form implements
IFormSubmittingComponent {
TextField searchtextfield;
Search search = new Search();

public SearchForm(String id) {
super(id);
add(searchtextfield = new TextField(searchtextfield, new
Model() {

@Override
public Serializable getObject() {
return search.getText();
}

@Override
public void setObject(Serializable object) {
search.setText((String) object);
}
}));
}

@Override
public boolean getDefaultFormProcessing() {
return false;
}

@Override
public Form? getForm() {
return this;
}

@Override
public String getInputName() {
return searchtextfield;
}

@Override
public void onSubmit() {

//String value = (String)searchtextfield.getModelObject();
String value = searchtextfield.getValue();
log.log(Level.INFO, Search value is: , value);

// Using SolrJ to make the request to Solr
String url = http://localhost:8983/solr/;;
try {
// Connect to Solr Server
SolrServer server = new CommonsHttpSolrServer(url);
//server.query(null, METHOD.GET);
SolrQuery solrQuery = new SolrQuery(value);
QueryResponse response = server.query(solrQuery);

// log the response
log.log(Level.INFO, Search result is: ,
response.toString());
System.out.println(System print. Response is:  +
response.toString());
} catch (MalformedURLException ex) {

 Logger.getLogger(Dashboard.class.getName()).log(Level.SEVERE, null, ex);
} catch(SolrServerException sse) {

}
}
}

}

Search.java
-
public class Search {

private String text;

public Search() {
}

public Search(String text) {
this.text = text;
}

public String getText() {
return text;
}

public void setText(String text) {
this.text = text;
}
}

I really don't know what I'm doing wrong as I can't seem to be able to
retrieve the value entered into the textfield.

Any help will be much appreciated.

Thanks

-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde


Re: Problems with requests to MountPath and optional parameters

2012-01-24 Thread shayy
Although I must use the + since it's in my code logic, I've tried it
without it and it still fails.

Any suggestions?

Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problems-with-requests-to-MountPath-and-optional-parameters-tp4323095p4323572.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to retrieve form value within onSubmit

2012-01-24 Thread Martin Grigorov
Hi,

See below.

On Tue, Jan 24, 2012 at 1:56 PM, Kayode Odeyemi drey...@gmail.com wrote:
 Hi,

 I will like to understand the dynamics behind retrieving form values when
 they are submitted.

 I have the following code:

 Dashboard.html
 ---
 body
        span wicket:id='mainNavigation'/

         form wicket:id=searchForm
             label for=searchSearch:/label
             input wicket:id=searchtextfield type=text / br /
             input type=submit/
        /form

    /body

 Dashboard.java
 --
 public class Dashboard extends BasePage {

    private static final Logger log =
 Logger.getLogger(Dashboard.class.getName());

    public Dashboard() {
        super ();
        final SearchForm searchForm = new SearchForm(searchForm);
        add(searchForm);
    }

    public Dashboard(IModel model) {
        super(model);
    }

    private class SearchForm extends Form implements
 IFormSubmittingComponent {
        TextField searchtextfield;
        Search search = new Search();

        public SearchForm(String id) {
            super(id);
            add(searchtextfield = new TextField(searchtextfield, new
 Model() {

replace with: new PropertyModel(search, text)


                @Override
                public Serializable getObject() {
                    return search.getText();
                }

                @Override
                public void setObject(Serializable object) {
                        search.setText((String) object);
                }
            }));
        }

        @Override
        public boolean getDefaultFormProcessing() {
            return false;
        }

remove this method


        @Override
        public Form? getForm() {
            return this;
        }

        @Override
        public String getInputName() {
            return searchtextfield;
        }

        @Override
        public void onSubmit() {

            //String value = (String)searchtextfield.getModelObject();
            String value = searchtextfield.getValue();
            log.log(Level.INFO, Search value is: , value);

            // Using SolrJ to make the request to Solr
            String url = http://localhost:8983/solr/;;
            try {
                // Connect to Solr Server
                SolrServer server = new CommonsHttpSolrServer(url);
                //server.query(null, METHOD.GET);
                SolrQuery solrQuery = new SolrQuery(value);
                QueryResponse response = server.query(solrQuery);

                // log the response
                log.log(Level.INFO, Search result is: ,
 response.toString());
                System.out.println(System print. Response is:  +
 response.toString());
            } catch (MalformedURLException ex) {

  Logger.getLogger(Dashboard.class.getName()).log(Level.SEVERE, null, ex);
            } catch(SolrServerException sse) {

            }
        }
    }

 }

 Search.java
 -
 public class Search {

make this Serializable


    private String text;

    public Search() {
    }

    public Search(String text) {
        this.text = text;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
 }

 I really don't know what I'm doing wrong as I can't seem to be able to
 retrieve the value entered into the textfield.

 Any help will be much appreciated.

 Thanks

 --
 Odeyemi 'Kayode O.
 http://www.sinati.com. t: @charyorde



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com


Re: AjaxSubmitLink : Simple attribute modifier (confirm javascript popup) never calld , form not submited

2012-01-24 Thread Richard W. Adams
If understand your problem correctly, the solution might be just to create 
it as an AjaxButton  override the onSubmit  onError methods. We do that 
in our app  works great.

RAM /abr./: Rarely Adequate Memory. 



From:   chimaira death_style2...@hotmail.com
To: users@wicket.apache.org
Date:   01/23/2012 05:53 PM
Subject:AjaxSubmitLink :   Simple attribute modifier (confirm 
javascript popup) never calld , form not submited



Hello , sorry for my english ! 


I m facing a probleme with AjaxSubmitLink on a form compoenent 

I want to add a simple attribute modifier with a on click and a confirm 
javascript popup, to get to user confirmation befor submiting.

That works fine with a simple wicket button , but I want to use
AjaxSubmitLink that way I can overrid the OnError methode and refresh my
form feedback, so I create I class AjaxConfirmButton extends 
AjaxSubmitLink.
and in the constructor I add the behaviour (add( new
SimpleAttributeModifier('onclick', return confirm(...)).

the probleme is the on click javascript is never calld and the form is 
never
submited.

is there a way to fix this issue? 
 hanks a lot 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4322492.html

Sent from the Users forum mailing list archive at Nabble.com.

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




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: How to retrieve form value within onSubmit

2012-01-24 Thread Kayode Odeyemi
On Tue, Jan 24, 2012 at 12:09 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 See below.

 On Tue, Jan 24, 2012 at 1:56 PM, Kayode Odeyemi drey...@gmail.com wrote:
  Hi,
 
  I will like to understand the dynamics behind retrieving form values when
  they are submitted.
 
  I have the following code:
 
  Dashboard.html
  ---
  body
 span wicket:id='mainNavigation'/
 
  form wicket:id=searchForm
  label for=searchSearch:/label
  input wicket:id=searchtextfield type=text / br /
  input type=submit/
 /form
 
 /body
 
  Dashboard.java
  --
  public class Dashboard extends BasePage {
 
 private static final Logger log =
  Logger.getLogger(Dashboard.class.getName());
 
 public Dashboard() {
 super ();
 final SearchForm searchForm = new SearchForm(searchForm);
 add(searchForm);
 }
 
 public Dashboard(IModel model) {
 super(model);
 }
 
 private class SearchForm extends Form implements
  IFormSubmittingComponent {
 TextField searchtextfield;
 Search search = new Search();
 
 public SearchForm(String id) {
 super(id);
 add(searchtextfield = new TextField(searchtextfield, new
  Model() {

 replace with: new PropertyModel(search, text)

 
 @Override
 public Serializable getObject() {
 return search.getText();
 }
 
 @Override
 public void setObject(Serializable object) {
 search.setText((String) object);
 }
 }));
 }
 
 @Override
 public boolean getDefaultFormProcessing() {
 return false;
 }

 remove this method

 
 @Override
 public Form? getForm() {
 return this;
 }
 
 @Override
 public String getInputName() {
 return searchtextfield;
 }
 
 @Override
 public void onSubmit() {
 
 //String value = (String)searchtextfield.getModelObject();
 String value = searchtextfield.getValue();
 log.log(Level.INFO, Search value is: , value);
 
 // Using SolrJ to make the request to Solr
 String url = http://localhost:8983/solr/;;
 try {
 // Connect to Solr Server
 SolrServer server = new CommonsHttpSolrServer(url);
 //server.query(null, METHOD.GET);
 SolrQuery solrQuery = new SolrQuery(value);
 QueryResponse response = server.query(solrQuery);
 
 // log the response
 log.log(Level.INFO, Search result is: ,
  response.toString());
 System.out.println(System print. Response is:  +
  response.toString());
 } catch (MalformedURLException ex) {
 
   Logger.getLogger(Dashboard.class.getName()).log(Level.SEVERE, null, ex);
 } catch(SolrServerException sse) {
 
 }
 }
 }
 
  }
 
  Search.java
  -
  public class Search {

 make this Serializable

 
 private String text;
 
 public Search() {
 }
 
 public Search(String text) {
 this.text = text;
 }
 
 public String getText() {
 return text;
 }
 
 public void setText(String text) {
 this.text = text;
 }
  }
 
  I really don't know what I'm doing wrong as I can't seem to be able to
  retrieve the value entered into the textfield.
 
  Any help will be much appreciated.
 
  Thanks
 


Thanks Martin. Worked as expected.

It looks like I will have lots of experimenting to do to understand wicket
model/components architecture. I've read lot's of docs, books and
references and I'm still surprised that I'm missing basic understanding of
how things work.

-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde


Re: Execute Javascript after components of a certain type render

2012-01-24 Thread Alec Swan
Your suggestions worked. Thank you both!

On Mon, Jan 23, 2012 at 1:50 PM, Alec Swan alecs...@gmail.com wrote:
 What about AbstractTransformerBehavior? Can I use it to execute Javascript?

 On Mon, Jan 23, 2012 at 12:08 PM, Igor Vaynberg igor.vaynb...@gmail.com 
 wrote:
 There is no baked behavior for this. Create your own and override
 renderhead method to output js. If this is a one time thing override
 istemporary method to return true.

 -igor

 -igor
 On Jan 23, 2012 10:26 AM, Alec Swan alecs...@gmail.com wrote:

 It looks like your code will add an IHeaderContributor to EVERY
 component once IComponentOnBeforeRenderListener finds an instance of
 IMyPanel component. Which is not what I need.

 I was hoping to do something like this:

 addPostComponentOnBeforeRenderListener(new
 IComponentOnBeforeRenderListener() {
            @Override
            public void onBeforeRender(Component component) {
                if (component instanceof MicroSitePanel) {
                    component.add(new XXXBehavior() {
                      // somehow fire Javascript when component
 renders, e.g. onComponentTag???
                    });
                }
            }
        });

 So, my question is what XXXBehavior should I use and how to fire
 Javascript when component renders?

 Thanks,

 Alec

 On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene adelb...@ciseonweb.it
 wrote:
  Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
  but I didn't understand exactly what you do with this kind of listener.
 
  Once you have checked if component implements IMyPanel, I would call
  Application.getHeaderContributorListenerCollection()  and I would add a
  header contributor which renders your JavaScript as I suggested in the
  previous mail.
  The code of you IComponentOnBeforeRenderListener should be something
 like:
 
   implements IComponentOnBeforeRenderListener{
 
     onBeforeRender(Component component) {
         if(component instanceof IMyPanel)
 
   Application.get().getHeaderContributorListenerCollection().add(new
  IHeaderContributor(){
                                 public void renderHead( IHeaderResponse
  response)
                                     {
 
   response.renderOnLoadJavaScript(...your JavaScript...);
                                     }
             });
 
     }
  }
 
  That's a a good idea but unfortunately my panels extend disjoint class
  hierarchies and I can only group them using interfaces.
 
  Any thoughts on how I can use Application listeners to accomplish this?
 
  Thanks,
 
  Alec
 
  On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Beneadelb...@ciseonweb.it
   wrote:
 
 
 
  -
  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: AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-24 Thread Alec Swan
Can anybody comment on this? Is this a bug?

Thanks,

Alec

On Sun, Jan 22, 2012 at 11:50 AM, Alec Swan alecs...@gmail.com wrote:
 The following workaround works but violates encapsulation. Why doesn't
 AjaxRequestTarget.AjaxHeaderResponse class escape special XML
 characters?

 public void renderHead(IHeaderResponse response) {
        String scriptToRender = scriptif (1 == 1  true)
 alert('Hello!')/script;
        if (scriptToRender != null) {
            if (AjaxRequestTarget.get() != null) {
                scriptToRender = scriptToRender.replace(, amp;);
 // todo: escape other XML special characters
            }
            response.renderString(scriptToRender);
        }
    }

 Thanks,

 Alec

 On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I am using Wicket 1.4.17 and have a panel which implements
 IHeaderContributor as follows:

 public void renderHead(IHeaderResponse response) {
  response.renderString(scriptif (1 == 1  true) 
 alert('Hello!')/script);
 }

 When the panel is updated as a part of AJAX request (by adding to ART)
 the following error is shown in Debugger:

 ERROR: Error in parsing: XML Parsing Error: not well-formed
 Location: http://localhost:8080/...
 Line Number 1, Column 67:head
 xmlns:wicket=http://wicket.apache.org;scriptif (1 == 1  true)
 alert('Hello!')/script/head

 Shouldn't ART's header contributor properly escape special XML
 characters such as ? How can I fix this?

 Thanks,

 Alec

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



Re: wicket appl architecture

2012-01-24 Thread Kayode Odeyemi
On Tue, Jan 24, 2012 at 2:05 AM, nazeem md.naz...@gmail.com wrote:

 This is an interesting article referring to the Linked In tech team
 experience and how they are addressing using client side template..


 http://blogs.developerforce.com/developer-relations/2011/12/thoughts-on-ui-architectures.html
 Thoughts on UI Architecture


 In the above article he refers to this

 https://engineering.linkedin.com/frontend/leaving-jsps-dust-moving-linkedin-dustjs-client-side-templates


 So, the concept of single json/rest api interface addressing to all type of
 client (full web based app, mobile version of html app, ios, android, etc).
 In this case how can I write wicket components to render from jsons ? i
 believe its not required since its more on the server side, direct pojos
 should be fine.

 But at the last he also mentions Server-side templating should continue to
 be the default choice for most web applications as it offers many benefits
 like performance, security etc..
 This seemed contradicting to the full details explained.

 Can any one clarify where does wicket fall in this structure and how we can
 leverage both (server side templating + client side templating for mobile
 apps)


+1

Very interesting read. Wicket could be very powerful if components have
client side templating built in.

-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde


Error while closing the modal window

2012-01-24 Thread sudeivas
I am getting the below exception when I try to close a modal window. Also I
am not seeing this error in development but I am seeing this in production
as we have some session management installed. 

Cannot find behavior with id: 0 on component: [SherlockModalWindow
[Component id = binListWindow]]. Perhaps the behavior did not properly
implement getStatelessHint() and returned 'true' to indicate that it is
stateless instead of returning 'false' to indicate that it is stateful.
org.apache.wicket.behavior.InvalidBehaviorIdException: Cannot find behavior
with id: 0 on component: [SherlockModalWindow [Component id =
binListWindow]]. Perhaps the behavior did not properly implement
getStatelessHint() and returned 'true' to indicate that it is stateless
instead of returning 'false' to indicate that it is stateful.
at org.apache.wicket.Behaviors.getBehaviorById(Behaviors.java:303)
at org.apache.wicket.Component.getBehaviorById(Component.java:4430)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:254)
at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:147)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at com.xxx.tomcat.valves.QueryLogValve.invoke(QueryLogValve.java:78)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)


I also saw a related item,

https://issues.apache.org/jira/browse/WICKET-4116

We are already in 1.5.3 and our session management is working fine. The same
session is being used from source page to the modal window. But when I try
to close the modal window, it goes to the error page. 

Please let me know if I am missing something. 

-Suresh

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Error-while-closing-the-modal-window-tp4325332p4325332.html
Sent from the Users forum mailing list archive at Nabble.com.

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



How to refresh frame2 with an Ajax submit button in frame1 for a page using frameset?

2012-01-24 Thread michen
Hi there,

I am building a Wicket application with a frame layout, where leftFrame
contains a form with an AjaxSubmit button displaying user search criteria,
and rightFrame shows the search result. How can I code my onSubmit call for
my AjaxSubmit button to refresh the rightFrame to show the content after
performing the search?

Your help is greatly appreciated.

Thanks
-min

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-refresh-frame2-with-an-Ajax-submit-button-in-frame1-for-a-page-using-frameset-tp4326014p4326014.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to refresh frame2 with an Ajax submit button in frame1 for a page using frameset?

2012-01-24 Thread michen
More specifically, I would like to refresh a grid table in my frame2 after
submit button in frame1 is clicked.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-refresh-frame2-with-an-Ajax-submit-button-in-frame1-for-a-page-using-frameset-tp4326014p4326091.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: wicket appl architecture

2012-01-24 Thread Martin Grigorov
Hi,

On Tue, Jan 24, 2012 at 9:15 PM, Kayode Odeyemi drey...@gmail.com wrote:
 On Tue, Jan 24, 2012 at 2:05 AM, nazeem md.naz...@gmail.com wrote:

 This is an interesting article referring to the Linked In tech team
 experience and how they are addressing using client side template..


 http://blogs.developerforce.com/developer-relations/2011/12/thoughts-on-ui-architectures.html
 Thoughts on UI Architecture


 In the above article he refers to this

 https://engineering.linkedin.com/frontend/leaving-jsps-dust-moving-linkedin-dustjs-client-side-templates


 So, the concept of single json/rest api interface addressing to all type of
 client (full web based app, mobile version of html app, ios, android, etc).
 In this case how can I write wicket components to render from jsons ? i
 believe its not required since its more on the server side, direct pojos
 should be fine.

 But at the last he also mentions Server-side templating should continue to
 be the default choice for most web applications as it offers many benefits
 like performance, security etc..
 This seemed contradicting to the full details explained.

 Can any one clarify where does wicket fall in this structure and how we can
 leverage both (server side templating + client side templating for mobile
 apps)


 +1

 Very interesting read. Wicket could be very powerful if components have
 client side templating built in.

Currently Wicket supports generating XML-like responses in non-Ajax requests.
You can do client side templating based on XML - for example .xslt templates.
You can extend Mustache, Dust, Underscore, ... to read the data from
XML instead of JSON and let them do the rest for you.

In Ajax request you can return XML or JSON or any other format data
and render it at the client side with your favorite JS templating
library.


 --
 Odeyemi 'Kayode O.
 http://www.sinati.com. t: @charyorde



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-24 Thread Martin Grigorov
Hi,

Yes, looks like a bug.
Please create a ticket + a quickstart.

On Tue, Jan 24, 2012 at 8:56 PM, Alec Swan alecs...@gmail.com wrote:
 Can anybody comment on this? Is this a bug?

 Thanks,

 Alec

 On Sun, Jan 22, 2012 at 11:50 AM, Alec Swan alecs...@gmail.com wrote:
 The following workaround works but violates encapsulation. Why doesn't
 AjaxRequestTarget.AjaxHeaderResponse class escape special XML
 characters?

 public void renderHead(IHeaderResponse response) {
        String scriptToRender = scriptif (1 == 1  true)
 alert('Hello!')/script;
        if (scriptToRender != null) {
            if (AjaxRequestTarget.get() != null) {
                scriptToRender = scriptToRender.replace(, amp;);
 // todo: escape other XML special characters
            }
            response.renderString(scriptToRender);
        }
    }

 Thanks,

 Alec

 On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan alecs...@gmail.com wrote:
 Hello,

 I am using Wicket 1.4.17 and have a panel which implements
 IHeaderContributor as follows:

 public void renderHead(IHeaderResponse response) {
  response.renderString(scriptif (1 == 1  true) 
 alert('Hello!')/script);
 }

 When the panel is updated as a part of AJAX request (by adding to ART)
 the following error is shown in Debugger:

 ERROR: Error in parsing: XML Parsing Error: not well-formed
 Location: http://localhost:8080/...
 Line Number 1, Column 67:head
 xmlns:wicket=http://wicket.apache.org;scriptif (1 == 1  true)
 alert('Hello!')/script/head

 Shouldn't ART's header contributor properly escape special XML
 characters such as ? How can I fix this?

 Thanks,

 Alec

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: How to refresh frame2 with an Ajax submit button in frame1 for a page using frameset?

2012-01-24 Thread Martin Grigorov
Hi,

Why did you choose iframes ?
Using plain div backed by Wicket's Panel will make it much easier to manage.

The problem is that when the Ajax response is sent to the browser
Wicket uses Wicket.$(oldComponentId) (which delegates to
document.getElementByid(oldComponentId)) to find the component to
replace.
In your case you need something like:
document.getElementById('rightFrameId').contentWindow.document.getElementById(oldComponentId).

You can try to make it work by monkey-patching Wicket.$() on the fly.
With target.prependJavaScript execute some JS code that backs up the
old impl of Wicket.$ and replaces it with the one that works with
iframes.
With appendJavaScript revert that temporary change.

Good luck!

On Wed, Jan 25, 2012 at 3:38 AM, michen mic...@zynga.com wrote:
 More specifically, I would like to refresh a grid table in my frame2 after
 submit button in frame1 is clicked.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-refresh-frame2-with-an-Ajax-submit-button-in-frame1-for-a-page-using-frameset-tp4326014p4326091.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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