Re: AutoCompleteTextField issues

2013-05-14 Thread Sven Meier

Take a look at autocomplete's javadoc:

 * An {@link IAutoCompleteRenderer} is used for rendering of choices. 
To convert input back into a
 * non-String type you will have to provide a custom {@link 
IConverter}, either by overriding
 * {@link #getConverter(Class)} or by setting a suitable {@link 
IConverter} on the application's

 * {@link ConverterLocator}.

Sven

On 05/14/2013 11:26 PM, saty wrote:

I have used this before as a simple String model which works fine but with
other types i have some isues going on any help would be appreciated.

using:

final AutoCompleteTextField something = new
AutoCompleteTextField("code", xYZTypeModel, renderer)

the options are displayed correctly selects fine too but

XYZ.getObject() call throws exception:

java.lang.ClassCastException: java.lang.String cannot be cast to XYZ

not sure how it is able to Set String in a XYZ type.


I am using below renderer

IAutoCompleteRenderer renderer = new
AbstractAutoCompleteTextRenderer()
{
private static final long serialVersionUID = 1L;
@Override
protected String getTextValue(XYZ object)
{
return XYX.getDisplayText();
}

};

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteTextField-issues-tp4658798.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




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



Re: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread vineet semwal
On Tue, May 14, 2013 at 6:45 PM, vineet semwal wrote:

> Martin,
> thanks for the explanation,you are right ! ,i just tested that static
> block doesn't get executed .. but i could never reproduce  Andy's problem
> ..,
> i also checked and noticed that WicketTagIdentifier is registering the
> "panel" tagname  so i don't know what is registering it but it's getting
> registered ,i tried looking a bit at code but could not find it ..
>
> actually later yesterday i was able to reproduce the problem in a pure
quickstart ,earlier i was testing on some test project where i
test/experiment odd things,something there was registering the panel
tagname ,i also realized
that corresponding issue was created and fixed so all is well :-)


I"ll really apreciate the help to get the selected item of a DropDownChoice using Scala

2013-05-14 Thread Bruno Moura
Hi

For some weeks I'm trying to implement a simple combobox, DDC, and I'm
struggling with this. I asked  for some help several times but
unfortunately I didn't archive my goal because I'm failing sometimes to
understand  scala with wicket, I have a little background with them at the
moment.

Anyway,  my code is showed bellow:

*// ComboBox in a listView
item.add(new DropDownChoice("customerSelection", new
PropertyModel[Customer](customer, "name"), listCustomer, new
ChoiceRenderer[Customer]("name"))*


If I create a variable, for example,* val custName*,  to receive the name
of the selected customer which functions I need to implement on the
creation of DDC object and how can I retrieve this value for the variable?

Thanks very much for help me.


Re: Retrieve a value of textField and set the property of the Model

2013-05-14 Thread Bruno Moura
Hi Paul, thanks very much for your help!

I followed your suggestion but this peace of code doesn't compile
unfortunately:

IModel descriptionModel = new PropertyModel[Meeting](meeting,
"description"));

I have tried

val descriptionModel[IModel] = new PropertyModel[Meeting](meeting,
"description")); //wrong systax for scala

and

val descriptionModel = new IModel[Meeting](meeting, "description")); //
IModel can't be instanced

But I'm doing this thing wrong.

I made a great progress with my app but now I'm struggling with this issue
and I spent a lot
of time to archive this simple task. If I'm  doing this stuff with java my
life could
be much easier :-D.

I'll appreciate your hep again


Thanks very much




Bera


2013/5/10 Paul Bors 

> Why the Ajax round-trips for each "keyup" to extract the model's object?
> Have you tried to implement just the Save link/button and then look-up the
> model object from inside the onClick() method?
>
> In your case it would come from the PropertyModel you use already:
>
> TextField description = new TextField("description",new
> PropertyModel[Meeting](meeting, "description"))
>
> change to:
>
> IModel descriptionModel = new
> PropertyModel[Meeting](meeting, "description"));
> TextField descriptionTextField = new TextField("description",
> descriptionModel );
>
> and your link becomes:
>
> private class LinkSave(id: String, meeting: Meeting) extends
> AjaxLink[String](id) {
>
> @SpringBean
> var meetingMediator: TMeetingMediator = _
>   def onClick(target: AjaxRequestTarget) {
> meetingDAO.saveMeeting(descriptionModel.getObject())
>   }
> }
>
> Unless you want to also update some other element on the screen with each
> user key press I really don't think you need the "keyup" listener.
>
> ~ Thank you,
>Paul Bors
>
>
> On Thu, May 9, 2013 at 11:03 PM, Bruno Moura 
> wrote:
>
> > I'm trying to implement a ListView and in on column of it I added a
> > listView, for each line,
> > I want to save the data inserted on it and update the model:
> >
> > I'm implemented the code bellow:
> >
> > val description = new TextField("description",new
> > PropertyModel[Meeting](meeting, "description"))
> > description.add(new AjaxFormComponentUpdatingBehavior("keyup") {
> >   protected def onUpdate(target: AjaxRequestTarget) {
> > description.getDefaultModelObjectAsString
> >   }
> > })
> >
> > item.add(description)
> >
> > And I added a link for each line of my ListView for save the information
> in
> > database,
> > each line is a instance of a model meeting as is showed bellow:
> >
> > item.add(new LinkSave("save", meeting))
> >
> > private class LinkSave(id: String, meeting: Meeting) extends
> > AjaxLink[String](id) {
> >
> > @SpringBean
> > var meetingMediator: TMeetingMediator = _
> >
> > setVisible(clickavel.asInstanceOf[Boolean])
> > add(new Label("label", new Model[String]() {
> >   override def getObject: String = "Save"
> > }))
> >
> > def onClick(target: AjaxRequestTarget) {
> >   meetingDAO.saveMeeting(meeting)
> >
> > }
> >   }
> >
> >
> > But unfortunately the code above doesn't work. It's fail to retrieve the
> > value of the text
> > field and also to set the attribute description of the Object meeting
> with
> > the value of the text field, so in the database the column description is
> > never filled
> >
> > Someone know where I am doing wrong stuff?
> >
> > Thanks a lot!
> >
> >
> > Bera
> >
>


Re: Attaching Ajax Function to Java Method

2013-05-14 Thread William Speirs
@Bas Gooren that code you linked was very helpful. I have what I want
up and working, but it's using a bunch of ugly jQuery ajax callbacks
hacked into StringBuilders :-(

@Don Ferguson I don't *think* this is what I'm looking for as I have
thousands of options and I don't want them rendered at page load.
Instead I want to register a function that will call-back to my Java
code when someone start typing and allows me to search. However, I did
not run it, just looked at the code.

Here is what I have, again it's ugly. Does anyone know how I can
clean-up the jQuery.ajax stuff? I've gotta imagine there is a way to
do it in Wicket.

Thanks in advance...

Bill-

public class TypeaheadField extends TextField implements
IResourceListener {

private static final long serialVersionUID = 1L;

public TypeaheadField(final String id, final IModel model) {
super(id, model);

setOutputMarkupId(true);
add(new AttributeModifier("data-provide", "typeahead"));
}

@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);

StringBuilder sb = new StringBuilder();

sb.append("$('#");
sb.append(getMarkupId().replace(".", "."));
sb.append("').typeahead(");
sb.append(getConfig());
sb.append(");");

response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
}

private String getConfig() {
final StringBuilder ajaxCall = new StringBuilder();

ajaxCall.append("{ \"source\": ");

ajaxCall.append("function(query, process) { $.ajax({ url: \"");
ajaxCall.append(urlFor(IResourceListener.INTERFACE, null));
ajaxCall.append("\", data: { \"query\": query }, success:
function(data, status, jqXHR) { process(data); } }); }, ");

ajaxCall.append("items: 4 }");

return ajaxCall.toString();
}

@Override
public void onResourceRequested() {
final Request request = getRequestCycle().getRequest();
final IRequestParameters params = request.getRequestParameters();

final String query =
params.getParameterValue("query").toOptionalString();

WebResponse webResponse = (WebResponse) getRequestCycle().getResponse();
webResponse.setContentType("application/json");

OutputStreamWriter out = new
OutputStreamWriter(webResponse.getOutputStream(),
getRequest().getCharset());
JSONWriter json = new JSONWriter(out);

try {
json.array();

json.value("Connecticut");
json.value("California");
json.value("Colorado");

json.endArray();
} catch (JSONException e) {
throw new WicketRuntimeException("Could not write Json
response", e);
}

try {
out.flush();
} catch (IOException e) {
throw new WicketRuntimeException("Could not write Json to
servlet response", e);
}
}
}



On Tue, May 14, 2013 at 10:04 PM, Don Ferguson  wrote:
> The following seems to work (using wicket 6.7 with the experimental bootstrap 
> module).  Basically, this ajax behavior is called on page load.   At that 
> point, it writes out the javascript to initialize the object with typeahead 
> parameters.
>
> HTML:
>
>  data-items="4">
>
> JAVA:
>
> add(new TextField("typeahead").add(new TypeAhead()));
>
> TypeAhead Behavior:
>
> import org.apache.wicket.Component;
> import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
> import org.apache.wicket.ajax.AjaxRequestTarget;
> import org.apache.wicket.markup.head.IHeaderResponse;
> import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
>
> import java.util.Arrays;
> import java.util.List;
>
> public  class TypeAhead extends AbstractDefaultAjaxBehavior {
> @Override
> protected void onBind() {
> super.onBind();
> getComponent().setOutputMarkupId(true);
> }
>
> @Override
> protected void respond(AjaxRequestTarget target) {
> String sources = toJSONArray(getOptions());
> String script = String.format("$('#%s').typeahead( { source: %s } 
> );", getComponent().getMarkupId(), sources);
> target.appendJavaScript(script);
> }
>
> @Override
> public void renderHead(Component component, IHeaderResponse response) {
> super.renderHead(component, response);
> response.render(OnDomReadyHeaderItem.forScript( 
> this.getCallbackScript() ));
> }
>
>  // OVERRIDE THIS TO SUPPLY LIST OF OPTIONS
> public  List getOptions() {
> return Arrays.asList( new String[] {"Alabama", "Aftermath", 
> "Absinth"} );
> }
>
>  // There's probably a built-in method that does this…
>
> private String toJSONArray(List strings) {
> StringBuffer result = new StringBuffer("[");
> for (String string : strings) {
> result.append("'");
> result.append(string);
> result.append("',");
> }

Re: Attaching Ajax Function to Java Method

2013-05-14 Thread Don Ferguson
The following seems to work (using wicket 6.7 with the experimental bootstrap 
module).  Basically, this ajax behavior is called on page load.   At that 
point, it writes out the javascript to initialize the object with typeahead 
parameters.  

HTML:



JAVA:

add(new TextField("typeahead").add(new TypeAhead()));

TypeAhead Behavior:

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;

import java.util.Arrays;
import java.util.List;

public  class TypeAhead extends AbstractDefaultAjaxBehavior {
@Override
protected void onBind() {
super.onBind();
getComponent().setOutputMarkupId(true);
}

@Override
protected void respond(AjaxRequestTarget target) {
String sources = toJSONArray(getOptions());
String script = String.format("$('#%s').typeahead( { source: %s } );", 
getComponent().getMarkupId(), sources);
target.appendJavaScript(script);
}

@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(OnDomReadyHeaderItem.forScript( 
this.getCallbackScript() ));
}

 // OVERRIDE THIS TO SUPPLY LIST OF OPTIONS
public  List getOptions() {
return Arrays.asList( new String[] {"Alabama", "Aftermath", "Absinth"} 
);
}

 // There's probably a built-in method that does this…

private String toJSONArray(List strings) {
StringBuffer result = new StringBuffer("[");
for (String string : strings) {
result.append("'");
result.append(string);
result.append("',");
}
if (strings.size() > 0) {
result.deleteCharAt(result.lastIndexOf(","));
}
result.append("]");
return result.toString();
}

}


Hope this works for you.

-- Don Ferguson


On Tuesday, May 14, 2013 at 1:36 PM, William Speirs wrote:

> I'm trying to create a typeahead component for Wicket that uses Bootstrap's
> Typeahead:
>  
> To set this up though I need to provide the .typeahead method in JavaScript
> with a function that will return the results, given the query. What I'd
> like to do is attach that JavaScript function to a Java method much like
> what is done with an AjaxEventBehavior [2]. I cannot figure out how to go
> about setting all of this up... any ideas?
>  
> Thanks...
>  
> Bill-
>  
> [1] http://twitter.github.io/bootstrap/javascript.html#typeahead
> [2]
> http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html
>  
>  




Re: Attaching Ajax Function to Java Method

2013-05-14 Thread Bas Gooren

Select2's wicket integration should provide you with some pointers [1].

It basically points down to implementing a listener interface, and 
providing the url to it to your javascript code. You can then return 
your data when the listener interface's method is called.


[1]
https://github.com/ivaynberg/wicket-select2/blob/master/wicket-select2/src/main/java/com/vaynberg/wicket/select2/AbstractSelect2Choice.java 



Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14-5-2013 22:36, schreef William Speirs:

I'm trying to create a typeahead component for Wicket that uses Bootstrap's
Typeahead:

To set this up though I need to provide the .typeahead method in JavaScript
with a function that will return the results, given the query. What I'd
like to do is attach that JavaScript function to a Java method much like
what is done with an AjaxEventBehavior [2]. I cannot figure out how to go
about setting all of this up... any ideas?

Thanks...

Bill-

[1] http://twitter.github.io/bootstrap/javascript.html#typeahead
[2]
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html





AutoCompleteTextField issues

2013-05-14 Thread saty
I have used this before as a simple String model which works fine but with
other types i have some isues going on any help would be appreciated.

using:

final AutoCompleteTextField something = new
AutoCompleteTextField("code", xYZTypeModel, renderer)

the options are displayed correctly selects fine too but

XYZ.getObject() call throws exception:

java.lang.ClassCastException: java.lang.String cannot be cast to XYZ

not sure how it is able to Set String in a XYZ type.


I am using below renderer 

IAutoCompleteRenderer renderer = new
AbstractAutoCompleteTextRenderer() 
{
private static final long serialVersionUID = 1L;
@Override
protected String getTextValue(XYZ object) 
{
return XYX.getDisplayText();
}

};

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AutoCompleteTextField-issues-tp4658798.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: Feedback within Form Weird Issue

2013-05-14 Thread dhongyt
I solved the issue. I was invalidating my session before it could display.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Feedback-within-Form-Weird-Issue-tp4658757p4658797.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



Attaching Ajax Function to Java Method

2013-05-14 Thread William Speirs
I'm trying to create a typeahead component for Wicket that uses Bootstrap's
Typeahead:

To set this up though I need to provide the .typeahead method in JavaScript
with a function that will return the results, given the query. What I'd
like to do is attach that JavaScript function to a Java method much like
what is done with an AjaxEventBehavior [2]. I cannot figure out how to go
about setting all of this up... any ideas?

Thanks...

Bill-

[1] http://twitter.github.io/bootstrap/javascript.html#typeahead
[2]
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/AjaxEventBehavior.html


Re: Server and client side validation

2013-05-14 Thread Gabriel Landon
Martin,

Thank you it was even easier than I though.

/// starts parsley for this form (or the root form)
final Form form = (Form) component;
varResponse.render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').parsley();",
form.getRootForm()
.getMarkupId(;/

Regards,

Gabriel





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658795.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: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread vineet semwal
i have just created issue https://issues.apache.org/jira/browse/WICKET-5189
thank you !



On Tue, May 14, 2013 at 7:15 PM, Martin Grigorov wrote:

> On Tue, May 14, 2013 at 3:28 PM, vineet semwal  >wrote:
>
> > also why is well known tagnames getting registered and why are not they
> > just kept at start itself,they are just strings ,registering only makes
> > sense for the new tags in my opinion..
> >
> >
> Agreed.
> We can pre-register all known tags like: panel, border, head, container,
> etc.
> No need to do this lazily.
>
> org.apache.wicket.markup.parser.filter.WicketTagIdentifier#wellKnownTagNames
> is a static HashSet. It won't be too much memory consumption.
>
> Please file a ticket.
>
>
> >
> > On Tue, May 14, 2013 at 6:45 PM, vineet semwal  > >wrote:
> >
> > > Martin,
> > > thanks for the explanation,you are right ! ,i just tested that static
> > > block doesn't get executed .. but i could never reproduce  Andy's
> problem
> > > ..,
> > > i also checked and noticed that WicketTagIdentifier is registering the
> > > "panel" tagname  so i don't know what is registering it but it's
> getting
> > > registered ,i tried looking a bit at code but could not find it ..
> > >
> > >
> > > On Tue, May 14, 2013 at 5:18 PM, Martin Grigorov  > >wrote:
> > >
> > >> On Tue, May 14, 2013 at 9:51 AM, Martin Grigorov <
> mgrigo...@apache.org
> > >> >wrote:
> > >>
> > >> > Hi Vineet,
> > >> >
> > >> >
> > >> > On Mon, May 13, 2013 at 11:09 PM, vineet semwal <
> > >> vineetsemwa...@gmail.com>wrote:
> > >> >
> > >> >> hi martin,
> > >> >> that static block need not be copied to make it work,since it's a
> > >> static
> > >> >> block, it will get executed when the Panel class gets loaded,
> > >> >> the Panel class will get loaded by  PanelMarkupSourcingStrategy
> > itself
> > >> >>
> > >> >
> > >> > You are correct.
> > >> > I have no idea why it failed for Andy the first time.
> > >> >
> > >>
> > >> Now I realize what happens.
> > >> The usage of Panel.PANEL is inlined in PanelMarkupSourcingStrategy at
> > >> compile time, i.e. its String value is put in the place of the
> constant.
> > >> That's why it doesn't trigger the static initializer.
> > >>
> > >>
> > >> >
> > >> >
> > >> >> since it's referring a constant of panel . yes but i agree not a
> very
> > >> nice
> > >> >> code flow  so should be improved ,i always used to think they are
> > doing
> > >> >> this in a very weird way :-)
> > >> >>
> > >> >>
> > >> >> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov <
> > mgrigo...@apache.org
> > >> >> >wrote:
> > >> >>
> > >> >> > Hi,
> > >> >> >
> > >> >> >
> > >> >> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors 
> wrote:
> > >> >> >
> > >> >> > > Get rid of your newMarkupSourcingStrategy() override and place
> > the
> > >> >> HTML
> > >> >> > > right next to the Java source code and you'll be fine.
> > >> >> > >
> > >> >> >
> > >> >> > This will not work because usually Link component has no its own
> > >> markup
> > >> >> > file.
> > >> >> >
> > >> >> > See Panel.java. It has:
> > >> >> >
> > >> >> > static
> > >> >> > {
> > >> >> > // register "wicket:panel"
> > >> >> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
> > >> >> > }
> > >> >> >
> > >> >> > Just add this to your class and it should work.
> > >> >> >
> > >> >> > I think this is a bug in Wicket though - this piece of code
> should
> > be
> > >> >> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
> > >> >> >
> > >> >> > Feel free to file a bug report.
> > >> >> >
> > >> >> >
> > >> >> > >
> > >> >> > > If you do not like the default location of the HTML next to
> your
> > >> Java
> > >> >> > > classes, then read Chapter 4 of the Wicket user guide you can
> get
> > >> for
> > >> >> > free
> > >> >> > > from wicket's website at:
> > >> >> > > http://wicket.apache.org/learn/books/
> > >> >> > >
> > >> >> > > ~ Thank you,
> > >> >> > >   Paul Bors
> > >> >> > >
> > >> >> > > -Original Message-
> > >> >> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
> > >> >> > > Sent: Monday, May 13, 2013 2:04 PM
> > >> >> > > To: users@wicket.apache.org
> > >> >> > > Subject: Unknown tag name with Wicket namespace: 'panel'
> > >> >> > >
> > >> >> > > I get an exception and it's not very clear to me what I'm doing
> > >> wrong.
> > >> >> > >
> > >> >> > > This is the exception:
> > >> >> > > Last cause: Unknown tag name with Wicket namespace: 'panel'.
> > Might
> > >> be
> > >> >> you
> > >> >> > > haven't installed the appropriate resolver? ''
> > (line
> > >> 3,
> > >> >> > > column
> > >> >> > > 2)
> > >> >> > >
> > >> >> > > I'm trying to override the markupSourcingStrategy because i
> want
> > >> this
> > >> >> > class
> > >> >> > > to have it's own html file. Anybody an idea? I use wicket-core
> > >> 6.7.0.
> > >> >> > >
> > >> >> > >
> > >> >> > > This is my java file:
> > >> >> > > public class ExtBookMarkablePageLink extends
> > >> >> BookmarkablePageLink {
> > >> >> > >
> > >> >> > > private final Component label;

Possible bug with AjaxLazyLoadPanel

2013-05-14 Thread Raul
Hello, I'm trying to get a component to update with Ajax from a AjaxLink, but
always returns null, the access component is as follows.

Component  current = this.getPage().get("commentsPanel").get ("modalPanel");

Where "commentsPanel" is a "AjaxLazyLoadPanel" and "modalPanel" is of type
"Panel", If "commentsPanel" I put Panel type, the component finds correctly,



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Possible-bug-with-AjaxLazyLoadPanel-tp4658793.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: Call me page wicket from in page.jsp

2013-05-14 Thread Alis
Thank you!

 Now, my problem is that there are two sessions (one in wicket application
and another in jsp). How achievement maintain the values ​​existing in the
request from wicket to return to interact in the page jsp.

Example: 

page in wicket (Page.java) 

WebRequestCycle cycle = (WebRequestCycle) RequestCycle.get();
HttpServletRequest request =
cycle.getWebRequest().getHttpServletRequest();
HttpServletResponse response =
cycle.getWebResponse().getHttpServletResponse();
HttpSession session = request.getSession();


How return a page in jsp.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Call-me-page-wicket-from-iframe-in-page-jsp-tp4658716p4658792.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: Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Martin Grigorov
Hi,

We use
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617
because
it is faster than jQuery#replaceWith().
So yes, there is a small period when both the old and the new are in the
DOM.
As Sven asked - please create a quicktart and attach it to a ticket so we
can see whether we will find a solution or we will have to use the slower
way to replace.


On Tue, May 14, 2013 at 4:48 PM, Sven Meier  wrote:

> Create a quickstart and attach it to a Jira issue please.
>
> Sven
>
>
> On 05/14/2013 04:37 PM, Nico wrote:
>
>> Hi
>>
>> I migrated my application from Wicket 1.5.10 to 6.7
>>
>> During testing I recognized that during an ajax update (replacement) of a
>> component, the markup of the component is twice in the HTML markup (the
>> old
>> and the new markup). Thus the execution of javascript inside a component
>> may
>> fail due to the fact, that two components with the same id are present in
>> the HTML markup.
>>
>> EXAMPLE
>>
>>
>> *HTML:*
>> testlink
>> 
>>
*JAVA:* final WebMarkupContainer testbox = new WebMarkupContainer("testbox"); testbox.setOutputMarkupId(true); add(testbox); add(new AjaxLink("testlink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { target.add(testbox); } }); So while the ajax update is processed the 'testbox' DIV and its javascript are present twice (the old and new DIV). If the javascript is a little more complex and for example changes stuff inside the DIV, the javascript will change stuff in the old instead of the new DIV container. My javascript relies on the fact, that an id should always be present just once. Why is the old DIV not removed first, before the new DIV is appended? Can I change this behavior somehow? Thanks in advance Nico -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org

Component twice in markup while ajax refresh in Wicket 6.7 (migrated from 1.5.10)

2013-05-14 Thread Nico
Hi

I migrated my application from Wicket 1.5.10 to 6.7

During testing I recognized that during an ajax update (replacement) of a
component, the markup of the component is twice in the HTML markup (the old
and the new markup). Thus the execution of javascript inside a component may
fail due to the fact, that two components with the same id are present in
the HTML markup.

EXAMPLE


*HTML:*
testlink
*JAVA:* final WebMarkupContainer testbox = new WebMarkupContainer("testbox"); testbox.setOutputMarkupId(true); add(testbox); add(new AjaxLink("testlink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { target.add(testbox); } }); So while the ajax update is processed the 'testbox' DIV and its javascript are present twice (the old and new DIV). If the javascript is a little more complex and for example changes stuff inside the DIV, the javascript will change stuff in the old instead of the new DIV container. My javascript relies on the fact, that an id should always be present just once. Why is the old DIV not removed first, before the new DIV is appended? Can I change this behavior somehow? Thanks in advance Nico -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.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: Feedback within Form Weird Issue

2013-05-14 Thread dhongyt
Thanks I will try both things. I believe my pages are stateful.
Maybe its because I create an ErrorFeedback that extends the Feedback and
didn't override some classes needed.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Feedback-within-Form-Weird-Issue-tp4658757p4658788.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: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread Martin Grigorov
On Tue, May 14, 2013 at 3:28 PM, vineet semwal wrote:

> also why is well known tagnames getting registered and why are not they
> just kept at start itself,they are just strings ,registering only makes
> sense for the new tags in my opinion..
>
>
Agreed.
We can pre-register all known tags like: panel, border, head, container,
etc.
No need to do this lazily.
org.apache.wicket.markup.parser.filter.WicketTagIdentifier#wellKnownTagNames
is a static HashSet. It won't be too much memory consumption.

Please file a ticket.


>
> On Tue, May 14, 2013 at 6:45 PM, vineet semwal  >wrote:
>
> > Martin,
> > thanks for the explanation,you are right ! ,i just tested that static
> > block doesn't get executed .. but i could never reproduce  Andy's problem
> > ..,
> > i also checked and noticed that WicketTagIdentifier is registering the
> > "panel" tagname  so i don't know what is registering it but it's getting
> > registered ,i tried looking a bit at code but could not find it ..
> >
> >
> > On Tue, May 14, 2013 at 5:18 PM, Martin Grigorov  >wrote:
> >
> >> On Tue, May 14, 2013 at 9:51 AM, Martin Grigorov  >> >wrote:
> >>
> >> > Hi Vineet,
> >> >
> >> >
> >> > On Mon, May 13, 2013 at 11:09 PM, vineet semwal <
> >> vineetsemwa...@gmail.com>wrote:
> >> >
> >> >> hi martin,
> >> >> that static block need not be copied to make it work,since it's a
> >> static
> >> >> block, it will get executed when the Panel class gets loaded,
> >> >> the Panel class will get loaded by  PanelMarkupSourcingStrategy
> itself
> >> >>
> >> >
> >> > You are correct.
> >> > I have no idea why it failed for Andy the first time.
> >> >
> >>
> >> Now I realize what happens.
> >> The usage of Panel.PANEL is inlined in PanelMarkupSourcingStrategy at
> >> compile time, i.e. its String value is put in the place of the constant.
> >> That's why it doesn't trigger the static initializer.
> >>
> >>
> >> >
> >> >
> >> >> since it's referring a constant of panel . yes but i agree not a very
> >> nice
> >> >> code flow  so should be improved ,i always used to think they are
> doing
> >> >> this in a very weird way :-)
> >> >>
> >> >>
> >> >> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov <
> mgrigo...@apache.org
> >> >> >wrote:
> >> >>
> >> >> > Hi,
> >> >> >
> >> >> >
> >> >> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors  wrote:
> >> >> >
> >> >> > > Get rid of your newMarkupSourcingStrategy() override and place
> the
> >> >> HTML
> >> >> > > right next to the Java source code and you'll be fine.
> >> >> > >
> >> >> >
> >> >> > This will not work because usually Link component has no its own
> >> markup
> >> >> > file.
> >> >> >
> >> >> > See Panel.java. It has:
> >> >> >
> >> >> > static
> >> >> > {
> >> >> > // register "wicket:panel"
> >> >> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
> >> >> > }
> >> >> >
> >> >> > Just add this to your class and it should work.
> >> >> >
> >> >> > I think this is a bug in Wicket though - this piece of code should
> be
> >> >> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
> >> >> >
> >> >> > Feel free to file a bug report.
> >> >> >
> >> >> >
> >> >> > >
> >> >> > > If you do not like the default location of the HTML next to your
> >> Java
> >> >> > > classes, then read Chapter 4 of the Wicket user guide you can get
> >> for
> >> >> > free
> >> >> > > from wicket's website at:
> >> >> > > http://wicket.apache.org/learn/books/
> >> >> > >
> >> >> > > ~ Thank you,
> >> >> > >   Paul Bors
> >> >> > >
> >> >> > > -Original Message-
> >> >> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
> >> >> > > Sent: Monday, May 13, 2013 2:04 PM
> >> >> > > To: users@wicket.apache.org
> >> >> > > Subject: Unknown tag name with Wicket namespace: 'panel'
> >> >> > >
> >> >> > > I get an exception and it's not very clear to me what I'm doing
> >> wrong.
> >> >> > >
> >> >> > > This is the exception:
> >> >> > > Last cause: Unknown tag name with Wicket namespace: 'panel'.
> Might
> >> be
> >> >> you
> >> >> > > haven't installed the appropriate resolver? ''
> (line
> >> 3,
> >> >> > > column
> >> >> > > 2)
> >> >> > >
> >> >> > > I'm trying to override the markupSourcingStrategy because i want
> >> this
> >> >> > class
> >> >> > > to have it's own html file. Anybody an idea? I use wicket-core
> >> 6.7.0.
> >> >> > >
> >> >> > >
> >> >> > > This is my java file:
> >> >> > > public class ExtBookMarkablePageLink extends
> >> >> BookmarkablePageLink {
> >> >> > >
> >> >> > > private final Component label;
> >> >> > >  public  ExtBookMarkablePageLink(String id,
> >> Class
> >> >> > > pageClass) {
> >> >> > > this(id, pageClass, new PageParameters()); }  public  >> Page>
> >> >> > > ExtBookMarkablePageLink(String id, Class pageClass, final
> >> >> > PageParameters
> >> >> > > parameters) { super(id, pageClass, parameters); add(label =
> >> >> > > newLabel("label")); }
> >> >> > > protected Component newLabel(final String markupId) {
> >> >> > > return new Label(markupId, new

Re: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread vineet semwal
also why is well known tagnames getting registered and why are not they
just kept at start itself,they are just strings ,registering only makes
sense for the new tags in my opinion..


On Tue, May 14, 2013 at 6:45 PM, vineet semwal wrote:

> Martin,
> thanks for the explanation,you are right ! ,i just tested that static
> block doesn't get executed .. but i could never reproduce  Andy's problem
> ..,
> i also checked and noticed that WicketTagIdentifier is registering the
> "panel" tagname  so i don't know what is registering it but it's getting
> registered ,i tried looking a bit at code but could not find it ..
>
>
> On Tue, May 14, 2013 at 5:18 PM, Martin Grigorov wrote:
>
>> On Tue, May 14, 2013 at 9:51 AM, Martin Grigorov > >wrote:
>>
>> > Hi Vineet,
>> >
>> >
>> > On Mon, May 13, 2013 at 11:09 PM, vineet semwal <
>> vineetsemwa...@gmail.com>wrote:
>> >
>> >> hi martin,
>> >> that static block need not be copied to make it work,since it's a
>> static
>> >> block, it will get executed when the Panel class gets loaded,
>> >> the Panel class will get loaded by  PanelMarkupSourcingStrategy itself
>> >>
>> >
>> > You are correct.
>> > I have no idea why it failed for Andy the first time.
>> >
>>
>> Now I realize what happens.
>> The usage of Panel.PANEL is inlined in PanelMarkupSourcingStrategy at
>> compile time, i.e. its String value is put in the place of the constant.
>> That's why it doesn't trigger the static initializer.
>>
>>
>> >
>> >
>> >> since it's referring a constant of panel . yes but i agree not a very
>> nice
>> >> code flow  so should be improved ,i always used to think they are doing
>> >> this in a very weird way :-)
>> >>
>> >>
>> >> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov > >> >wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> >
>> >> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors  wrote:
>> >> >
>> >> > > Get rid of your newMarkupSourcingStrategy() override and place the
>> >> HTML
>> >> > > right next to the Java source code and you'll be fine.
>> >> > >
>> >> >
>> >> > This will not work because usually Link component has no its own
>> markup
>> >> > file.
>> >> >
>> >> > See Panel.java. It has:
>> >> >
>> >> > static
>> >> > {
>> >> > // register "wicket:panel"
>> >> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
>> >> > }
>> >> >
>> >> > Just add this to your class and it should work.
>> >> >
>> >> > I think this is a bug in Wicket though - this piece of code should be
>> >> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
>> >> >
>> >> > Feel free to file a bug report.
>> >> >
>> >> >
>> >> > >
>> >> > > If you do not like the default location of the HTML next to your
>> Java
>> >> > > classes, then read Chapter 4 of the Wicket user guide you can get
>> for
>> >> > free
>> >> > > from wicket's website at:
>> >> > > http://wicket.apache.org/learn/books/
>> >> > >
>> >> > > ~ Thank you,
>> >> > >   Paul Bors
>> >> > >
>> >> > > -Original Message-
>> >> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
>> >> > > Sent: Monday, May 13, 2013 2:04 PM
>> >> > > To: users@wicket.apache.org
>> >> > > Subject: Unknown tag name with Wicket namespace: 'panel'
>> >> > >
>> >> > > I get an exception and it's not very clear to me what I'm doing
>> wrong.
>> >> > >
>> >> > > This is the exception:
>> >> > > Last cause: Unknown tag name with Wicket namespace: 'panel'. Might
>> be
>> >> you
>> >> > > haven't installed the appropriate resolver? '' (line
>> 3,
>> >> > > column
>> >> > > 2)
>> >> > >
>> >> > > I'm trying to override the markupSourcingStrategy because i want
>> this
>> >> > class
>> >> > > to have it's own html file. Anybody an idea? I use wicket-core
>> 6.7.0.
>> >> > >
>> >> > >
>> >> > > This is my java file:
>> >> > > public class ExtBookMarkablePageLink extends
>> >> BookmarkablePageLink {
>> >> > >
>> >> > > private final Component label;
>> >> > >  public  ExtBookMarkablePageLink(String id,
>> Class
>> >> > > pageClass) {
>> >> > > this(id, pageClass, new PageParameters()); }  public > Page>
>> >> > > ExtBookMarkablePageLink(String id, Class pageClass, final
>> >> > PageParameters
>> >> > > parameters) { super(id, pageClass, parameters); add(label =
>> >> > > newLabel("label")); }
>> >> > > protected Component newLabel(final String markupId) {
>> >> > > return new Label(markupId, new
>> >> > > Model("")).setRenderBodyOnly(true);
>> >> > > }
>> >> > >
>> >> > > @Override
>> >> > > protected IMarkupSourcingStrategy newMarkupSourcingStrategy() {
>> return
>> >> > new
>> >> > > PanelMarkupSourcingStrategy(true);
>> >> > > }
>> >> > >
>> >> > > public ExtBookMarkablePageLink setLabel(IModel label) {
>> >> > > this.label.setDefaultModel(label);
>> >> > > return this;
>> >> > > }
>> >> > >
>> >> > > }
>> >> > >
>> >> > > and this my html file:
>> >> > > 
>> >> > > http://wicket.apache.org";>
>> >> > > 
>> >> > >   
>> >> > >   
>> >> > > 
>> >> > >
>> >> > >
>> >> > >
>> -

Re: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread vineet semwal
Martin,
thanks for the explanation,you are right ! ,i just tested that static block
doesn't get executed .. but i could never reproduce  Andy's problem ..,
i also checked and noticed that WicketTagIdentifier is registering the
"panel" tagname  so i don't know what is registering it but it's getting
registered ,i tried looking a bit at code but could not find it ..


On Tue, May 14, 2013 at 5:18 PM, Martin Grigorov wrote:

> On Tue, May 14, 2013 at 9:51 AM, Martin Grigorov  >wrote:
>
> > Hi Vineet,
> >
> >
> > On Mon, May 13, 2013 at 11:09 PM, vineet semwal <
> vineetsemwa...@gmail.com>wrote:
> >
> >> hi martin,
> >> that static block need not be copied to make it work,since it's a static
> >> block, it will get executed when the Panel class gets loaded,
> >> the Panel class will get loaded by  PanelMarkupSourcingStrategy itself
> >>
> >
> > You are correct.
> > I have no idea why it failed for Andy the first time.
> >
>
> Now I realize what happens.
> The usage of Panel.PANEL is inlined in PanelMarkupSourcingStrategy at
> compile time, i.e. its String value is put in the place of the constant.
> That's why it doesn't trigger the static initializer.
>
>
> >
> >
> >> since it's referring a constant of panel . yes but i agree not a very
> nice
> >> code flow  so should be improved ,i always used to think they are doing
> >> this in a very weird way :-)
> >>
> >>
> >> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov  >> >wrote:
> >>
> >> > Hi,
> >> >
> >> >
> >> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors  wrote:
> >> >
> >> > > Get rid of your newMarkupSourcingStrategy() override and place the
> >> HTML
> >> > > right next to the Java source code and you'll be fine.
> >> > >
> >> >
> >> > This will not work because usually Link component has no its own
> markup
> >> > file.
> >> >
> >> > See Panel.java. It has:
> >> >
> >> > static
> >> > {
> >> > // register "wicket:panel"
> >> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
> >> > }
> >> >
> >> > Just add this to your class and it should work.
> >> >
> >> > I think this is a bug in Wicket though - this piece of code should be
> >> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
> >> >
> >> > Feel free to file a bug report.
> >> >
> >> >
> >> > >
> >> > > If you do not like the default location of the HTML next to your
> Java
> >> > > classes, then read Chapter 4 of the Wicket user guide you can get
> for
> >> > free
> >> > > from wicket's website at:
> >> > > http://wicket.apache.org/learn/books/
> >> > >
> >> > > ~ Thank you,
> >> > >   Paul Bors
> >> > >
> >> > > -Original Message-
> >> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
> >> > > Sent: Monday, May 13, 2013 2:04 PM
> >> > > To: users@wicket.apache.org
> >> > > Subject: Unknown tag name with Wicket namespace: 'panel'
> >> > >
> >> > > I get an exception and it's not very clear to me what I'm doing
> wrong.
> >> > >
> >> > > This is the exception:
> >> > > Last cause: Unknown tag name with Wicket namespace: 'panel'. Might
> be
> >> you
> >> > > haven't installed the appropriate resolver? '' (line
> 3,
> >> > > column
> >> > > 2)
> >> > >
> >> > > I'm trying to override the markupSourcingStrategy because i want
> this
> >> > class
> >> > > to have it's own html file. Anybody an idea? I use wicket-core
> 6.7.0.
> >> > >
> >> > >
> >> > > This is my java file:
> >> > > public class ExtBookMarkablePageLink extends
> >> BookmarkablePageLink {
> >> > >
> >> > > private final Component label;
> >> > >  public  ExtBookMarkablePageLink(String id, Class
> >> > > pageClass) {
> >> > > this(id, pageClass, new PageParameters()); }  public  Page>
> >> > > ExtBookMarkablePageLink(String id, Class pageClass, final
> >> > PageParameters
> >> > > parameters) { super(id, pageClass, parameters); add(label =
> >> > > newLabel("label")); }
> >> > > protected Component newLabel(final String markupId) {
> >> > > return new Label(markupId, new
> >> > > Model("")).setRenderBodyOnly(true);
> >> > > }
> >> > >
> >> > > @Override
> >> > > protected IMarkupSourcingStrategy newMarkupSourcingStrategy() {
> return
> >> > new
> >> > > PanelMarkupSourcingStrategy(true);
> >> > > }
> >> > >
> >> > > public ExtBookMarkablePageLink setLabel(IModel label) {
> >> > > this.label.setDefaultModel(label);
> >> > > return this;
> >> > > }
> >> > >
> >> > > }
> >> > >
> >> > > and this my html file:
> >> > > 
> >> > > http://wicket.apache.org";>
> >> > > 
> >> > >   
> >> > >   
> >> > > 
> >> > >
> >> > >
> >> > >
> -
> >> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > > For additional commands, e-mail: users-h...@wicket.apache.org
> >> > >
> >> > >
> >> >
> >> >
> >> > --
> >> > Martin Grigorov
> >> > Wicket Training & Consulting
> >> > http://jWeekend.com 
> >> >
> >>
> >>
> >>
> >> --
> >> regards,
> >>
> >> Vineet Semwal
> >>
> >
> 

Re: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread Martin Grigorov
On Tue, May 14, 2013 at 9:51 AM, Martin Grigorov wrote:

> Hi Vineet,
>
>
> On Mon, May 13, 2013 at 11:09 PM, vineet semwal 
> wrote:
>
>> hi martin,
>> that static block need not be copied to make it work,since it's a static
>> block, it will get executed when the Panel class gets loaded,
>> the Panel class will get loaded by  PanelMarkupSourcingStrategy itself
>>
>
> You are correct.
> I have no idea why it failed for Andy the first time.
>

Now I realize what happens.
The usage of Panel.PANEL is inlined in PanelMarkupSourcingStrategy at
compile time, i.e. its String value is put in the place of the constant.
That's why it doesn't trigger the static initializer.


>
>
>> since it's referring a constant of panel . yes but i agree not a very nice
>> code flow  so should be improved ,i always used to think they are doing
>> this in a very weird way :-)
>>
>>
>> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov > >wrote:
>>
>> > Hi,
>> >
>> >
>> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors  wrote:
>> >
>> > > Get rid of your newMarkupSourcingStrategy() override and place the
>> HTML
>> > > right next to the Java source code and you'll be fine.
>> > >
>> >
>> > This will not work because usually Link component has no its own markup
>> > file.
>> >
>> > See Panel.java. It has:
>> >
>> > static
>> > {
>> > // register "wicket:panel"
>> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
>> > }
>> >
>> > Just add this to your class and it should work.
>> >
>> > I think this is a bug in Wicket though - this piece of code should be
>> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
>> >
>> > Feel free to file a bug report.
>> >
>> >
>> > >
>> > > If you do not like the default location of the HTML next to your Java
>> > > classes, then read Chapter 4 of the Wicket user guide you can get for
>> > free
>> > > from wicket's website at:
>> > > http://wicket.apache.org/learn/books/
>> > >
>> > > ~ Thank you,
>> > >   Paul Bors
>> > >
>> > > -Original Message-
>> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
>> > > Sent: Monday, May 13, 2013 2:04 PM
>> > > To: users@wicket.apache.org
>> > > Subject: Unknown tag name with Wicket namespace: 'panel'
>> > >
>> > > I get an exception and it's not very clear to me what I'm doing wrong.
>> > >
>> > > This is the exception:
>> > > Last cause: Unknown tag name with Wicket namespace: 'panel'. Might be
>> you
>> > > haven't installed the appropriate resolver? '' (line 3,
>> > > column
>> > > 2)
>> > >
>> > > I'm trying to override the markupSourcingStrategy because i want this
>> > class
>> > > to have it's own html file. Anybody an idea? I use wicket-core 6.7.0.
>> > >
>> > >
>> > > This is my java file:
>> > > public class ExtBookMarkablePageLink extends
>> BookmarkablePageLink {
>> > >
>> > > private final Component label;
>> > >  public  ExtBookMarkablePageLink(String id, Class
>> > > pageClass) {
>> > > this(id, pageClass, new PageParameters()); }  public 
>> > > ExtBookMarkablePageLink(String id, Class pageClass, final
>> > PageParameters
>> > > parameters) { super(id, pageClass, parameters); add(label =
>> > > newLabel("label")); }
>> > > protected Component newLabel(final String markupId) {
>> > > return new Label(markupId, new
>> > > Model("")).setRenderBodyOnly(true);
>> > > }
>> > >
>> > > @Override
>> > > protected IMarkupSourcingStrategy newMarkupSourcingStrategy() { return
>> > new
>> > > PanelMarkupSourcingStrategy(true);
>> > > }
>> > >
>> > > public ExtBookMarkablePageLink setLabel(IModel label) {
>> > > this.label.setDefaultModel(label);
>> > > return this;
>> > > }
>> > >
>> > > }
>> > >
>> > > and this my html file:
>> > > 
>> > > http://wicket.apache.org";>
>> > > 
>> > >   
>> > >   
>> > > 
>> > >
>> > >
>> > > -
>> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > > For additional commands, e-mail: users-h...@wicket.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > Martin Grigorov
>> > Wicket Training & Consulting
>> > http://jWeekend.com 
>> >
>>
>>
>>
>> --
>> regards,
>>
>> Vineet Semwal
>>
>
>
>
> --
> Martin Grigorov
> Wicket Training & Consulting
> http://jWeekend.com 
>



-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com 


Re: Deserialization InvalidClassException : no valid constructor

2013-05-14 Thread Jonas
This could only work if BufferedImage itself had a no-arg constructor.
It is it the first non-serializable class in the hierarchy that needs to
have it,
not the first serializable one, like in your example.
Besides, you would still lose all data stored in the BufferedImage's fields
(i.e.
the image stored in it).


On Mon, May 13, 2013 at 7:15 PM, smallufo  wrote:

> Today I encountered one famous deserialization problem :
> InvalidClassException : no valid constructor
>
> I googled and found some solution , but all are in-vain.
> The solution says the first non-serializable super class should define a
> no-arg constructor.
>
> But I try to define a no-arg constructor to EACH class of the HIERARCHY ,
> and EACH class implements Serializable... (which is not necessary , but I
> want to make it simple , to pinpoint the problem)
>
> My base class is an abstract class extends BufferedImage (java 2D)
> while BufferedImage is not Serializable
> So I make my abstract class implements Serializable and define a no-arg
> default constructor.
>
> The total hierarchy is :
> public abstract class AbstractChart extends BufferedImage implements
> Serializable {
>   public AbstractChart()  {// I try to remove this constructor ,
> but in vain
> super(0 , 0, TYPE_INT_ARGB);
>   }
> }
>
> and first child class :
>
> public class ChildChart extends AbstractChart implements Serializable {
>   public ChildChart() {
> super(); // or not calling super()
>   }
> }
>
> and the grandson class :
>
> public class GrandsonChart extends ChildChart implements Serializable {
>   public GrandsonChart() {
> super(); // or not calling super()
>   }
> }
>
> No matter I calls super() in ChildChart or GrandsonChart ,
>
> Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid
> constructor
>
> It happens when I click a button ,use ajax to paint this GrandsonChart ,
> and click another page , and use browser back .
> The browser will be redirected to /context/wicket/page?xxx (The error page)
> The screen shows :
> Could not deserialize object using:
> class
>
> org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream
>
> and in the console log , I can see this InvalidClassException is thrown.
>
> Any way to solve this problem ?
> (I've already added default no-arg constructor , and make each class
> implements Serializable , but still not working )
>
> environment :
> Wicket version : 6.7
> Resin 4.0.25
> Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc
> (It happens on Linux JDK too)
>


RE: form processing adding new inputs with an ajax onupdate

2013-05-14 Thread Simon B
Hi Paul, 

I was mistaken. I apologise.

Previously I hadn't completely removed the onConfigure method from the form
component  and simply called the setVisible in the onUpdate method of the
AjaxFormComponentUpdatingBehavior("onchange") / AFCUB("onchange").

So your suggestion worked! 

Thank you very much.

I would still really like to understand why the onConfigure way of setting
the visibility of the component didn't work, does anybody have any idea
about this?

Cheers

Simon



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-processing-adding-new-inputs-with-an-ajax-onupdate-tp4658758p4658779.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: form processing adding new inputs with an ajax onupdate

2013-05-14 Thread Simon B
Hi Paul, 

Thanks for your suggestion, hadn't tried that, but I have now and it doesn't
fix my problem.

I use the idiom


rather than simply calling 

Because: 
1. depending on the situation it can lead to many setVisible calls in
different parts of the page
2. it localises the visible setting to the component to which it applies
3. i don't need to pepper the code with lots of references to the component
whose visibility is to be set
4.
http://wicketinaction.com/2011/11/implement-wicket-component-visibility-changes-properly/

Thanks anyway for your suggestion, 

Cheers
Simon




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/form-processing-adding-new-inputs-with-an-ajax-onupdate-tp4658758p4658778.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: Unknown tag name with Wicket namespace: 'panel'

2013-05-14 Thread Martin Grigorov
Hi Vineet,


On Mon, May 13, 2013 at 11:09 PM, vineet semwal wrote:

> hi martin,
> that static block need not be copied to make it work,since it's a static
> block, it will get executed when the Panel class gets loaded,
> the Panel class will get loaded by  PanelMarkupSourcingStrategy itself
>

You are correct.
I have no idea why it failed for Andy the first time.


> since it's referring a constant of panel . yes but i agree not a very nice
> code flow  so should be improved ,i always used to think they are doing
> this in a very weird way :-)
>
>
> On Tue, May 14, 2013 at 1:48 AM, Martin Grigorov  >wrote:
>
> > Hi,
> >
> >
> > On Mon, May 13, 2013 at 10:02 PM, Paul Bors  wrote:
> >
> > > Get rid of your newMarkupSourcingStrategy() override and place the HTML
> > > right next to the Java source code and you'll be fine.
> > >
> >
> > This will not work because usually Link component has no its own markup
> > file.
> >
> > See Panel.java. It has:
> >
> > static
> > {
> > // register "wicket:panel"
> >  WicketTagIdentifier.registerWellKnownTagName(PANEL);
> > }
> >
> > Just add this to your class and it should work.
> >
> > I think this is a bug in Wicket though - this piece of code should be
> > executed by PanelMarkupSourcingStrategy, not by Panel itself.
> >
> > Feel free to file a bug report.
> >
> >
> > >
> > > If you do not like the default location of the HTML next to your Java
> > > classes, then read Chapter 4 of the Wicket user guide you can get for
> > free
> > > from wicket's website at:
> > > http://wicket.apache.org/learn/books/
> > >
> > > ~ Thank you,
> > >   Paul Bors
> > >
> > > -Original Message-
> > > From: Andy Van Den Heuvel [mailto:andy.vandenheu...@gmail.com]
> > > Sent: Monday, May 13, 2013 2:04 PM
> > > To: users@wicket.apache.org
> > > Subject: Unknown tag name with Wicket namespace: 'panel'
> > >
> > > I get an exception and it's not very clear to me what I'm doing wrong.
> > >
> > > This is the exception:
> > > Last cause: Unknown tag name with Wicket namespace: 'panel'. Might be
> you
> > > haven't installed the appropriate resolver? '' (line 3,
> > > column
> > > 2)
> > >
> > > I'm trying to override the markupSourcingStrategy because i want this
> > class
> > > to have it's own html file. Anybody an idea? I use wicket-core 6.7.0.
> > >
> > >
> > > This is my java file:
> > > public class ExtBookMarkablePageLink extends
> BookmarkablePageLink {
> > >
> > > private final Component label;
> > >  public  ExtBookMarkablePageLink(String id, Class
> > > pageClass) {
> > > this(id, pageClass, new PageParameters()); }  public 
> > > ExtBookMarkablePageLink(String id, Class pageClass, final
> > PageParameters
> > > parameters) { super(id, pageClass, parameters); add(label =
> > > newLabel("label")); }
> > > protected Component newLabel(final String markupId) {
> > > return new Label(markupId, new
> > > Model("")).setRenderBodyOnly(true);
> > > }
> > >
> > > @Override
> > > protected IMarkupSourcingStrategy newMarkupSourcingStrategy() { return
> > new
> > > PanelMarkupSourcingStrategy(true);
> > > }
> > >
> > > public ExtBookMarkablePageLink setLabel(IModel label) {
> > > this.label.setDefaultModel(label);
> > > return this;
> > > }
> > >
> > > }
> > >
> > > and this my html file:
> > > 
> > > http://wicket.apache.org";>
> > > 
> > >   
> > >   
> > > 
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martin Grigorov
> > Wicket Training & Consulting
> > http://jWeekend.com 
> >
>
>
>
> --
> regards,
>
> Vineet Semwal
>



-- 
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com 


Re: Server and client side validation

2013-05-14 Thread Martin Grigorov
Hi Gabriel,


On Tue, May 14, 2013 at 12:43 AM, Gabriel Landon  wrote:

> Hi Martin,
>
> It does work with the following code:
> /return $('#%s').closest('form').parsley( 'validate' );/
>
> Thank you very much.
>
> To find out whether the form is in a ModalWindow or not, I've used the
> following code:
> /@Override
> public void renderHead(final IHeaderResponse varResponse) {
> super.renderHead(varResponse);
> // starts parsley for this form
> if (this.findParent(ModalWindow.class) == null) {
>

I think you should look for the root form instead of a ModalWindow.
You can have nested forms in your app without ModalWindow around.
See org.apache.wicket.markup.html.form.Form#findForm
and org.apache.wicket.markup.html.form.Form#getRootForm


> varResponse
>
> .render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').parsley();",
> this.getMarkupId(;
> } else {
>
>
> varResponse.render(OnDomReadyHeaderItem.forScript(String.format("$('#%s').closest('form').parsley();",
> this.getMarkupId(;
> }
> }/
>
> Is there a better way to do that, or is it OK?
>
> Regards,
>
> Gabriel.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Server-and-client-side-validation-tp4658242p4658773.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
Wicket Training & Consulting
http://jWeekend.com 


Re: Feedback within Form Weird Issue

2013-05-14 Thread Martin Grigorov
Try with binding the session. Maybe you run in stateless mode.
Session session = getSession();
session.bind();
session.error(...);


On Mon, May 13, 2013 at 11:08 PM, dhongyt  wrote:

> Weird, it still does not show up.
> I do have a function that gets the session and register the error to it.
>
> Can the feedback be apart of the form? I have tried it outside the form
> with
> no luck either.
>
>
>
> I also changed my onSubmit to use session;
>
>
>
> It doesn't need to call the error function before the setResponsePage does
> it?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Feedback-within-Form-Weird-Issue-tp4658757p4658767.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
Wicket Training & Consulting
http://jWeekend.com