Re: Help with custom component that implements IOnChangeListener

2010-10-13 Thread Rut Bastoni
I've found the mistake: the TextField must override getStatelessHint() this 
way:


@Override
protected boolean getStatelessHint()
{
   return false;
}

now it works.
--
From: Rut Bastoni rut.bast...@poste.it
Sent: Thursday, October 07, 2010 4:08 PM
To: users@wicket.apache.org
Subject: Help with custom component that implements IOnChangeListener


Hi everyone,
i'm trying to implement a  custom TextField that fires onchange event
without using Ajax (it is a requirement of my project - i have good 
reasons

not to use Ajax).

Looking at the source files of DropDownChoice, CheckBox etc. (they all
implement the wantOnSelectionChangedNotifications() mechanism) i created 
a

class:

class OnChangeTextFieldT extends TextFieldT implements 
IOnChangeListener

{

   // . my stuff

   @Override
   public void onSelectionChanged()
   {
   updateModel();
   onSelectionChanged(getModelObject());
   }

   protected void onSelectionChanged(final Object newSelection)
{
   System.out.println(Event fired);
}

   /**
* Processes the component tag - This is like DropDownChoice and other
default FormComponents di
*/
   @Override
   protected void onComponentTag(final ComponentTag tag)
   {
   // url that points to this components IOnChangeListener method
   CharSequence url = urlFor(IOnChangeListener.INTERFACE);

   Form? form = findParent(Form.class);
   if (form != null)
   {
   tag.put(onchange, form.getJsForInterfaceUrl(url));
   }
   super.onComponentTag(tag);
   }

but that doesn't work. When i type into my textfield, i get an error page
saying:

WicketMessage: Attempt to access unknown request listener interface
IRedirectListener

Root cause:

org.apache.wicket.WicketRuntimeException: Attempt to access unknown 
request

listener interface IRedirectListener
at org.apache.wicket.markup.html.form.Form.dispatchEvent(Form.java:1320)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:870)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
at
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)

 etc. etc.

I looked into the sources, in particular Form.java, it seems like the url 
of

my listener (obtained by urlFor(IOnChangeListener.INTERFACE)) is wrong,
because this is the value that get stored in the hidden fild of the form,
and when the form dispatches events, it does not cause the correct
IListenerInterfaceRequestTarget be created.

I wonder, why does this mechanism work on DropDownChoice and others, and 
not

on my component?
Is this a bug? Or am I doing some mistake?

Thanks a Lot

Rut Bastoni


-
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: wicket 1.5, resource gives error in log?

2010-10-13 Thread Romeo Sheshi
hi
i have make a test and i have the error only when the src url is relative.

http://localhost:8080/test/wicket/bookmarkable/it.test.HomePage
if i have
 img src=/test/images/test.png/
i don't have the error i have the error if i put a relativ url
img src=test/images/test.png/
or
img src=images/test.png/
because wicket http://localhost:8080/test/wicket/bookmarkable/ + relative
url and don't find it
so you have the error
ERROR [org.apache.wicket.request.cycle.RequestCycle]  - Unable to execute
request. No suitable RequestHandler found.
URL=images/icons/arrow_down_end.png

Romeo Sheshi


2010/10/12 nino martinez wael nino.martinez.w...@gmail.com

 done -- https://issues.apache.org/jira/browse/WICKET-3103

 2010/10/12 Igor Vaynberg igor.vaynb...@gmail.com

  no, that shouldnt be there. file a bug please.
 
  -igor
 
  On Tue, Oct 12, 2010 at 3:49 AM, nino martinez wael
  nino.martinez.w...@gmail.com wrote:
   Hi
  
   I have something where I reference an image directly in html, wicket
 has
  no
   idea what it should do with it so it passes the request to the servlet
   container.. And it works as I wanted, but should it give an error
  message?
   Or am I doing something wrong?
  
   html:
img src=/images/icons/arrow_down_end.png/
  
   Log:
   ERROR [org.apache.wicket.request.cycle.RequestCycle]  - Unable to
 execute
   request. No suitable RequestHandler found.
   URL=images/icons/arrow_down_end.png
  
   regards Nino
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Feedback message does not show in new WebPage

2010-10-13 Thread Ian Marshall

Hello All,

I have a link, which when clicked causes a new web page to be shown.


HTML fragment
--
lt;a wicket:id=lnkPay href=#gt;Paylt;/agt;


Java fragment
-
LinkString lnkPay = new LinkString(lnkPay, new ModelString())
{
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
PageBuyOptions pgNext = new PageBuyOptions(...);
setResponsePage(pgNext);
}
};
lnkPay.setVisible(...);
liItem.add(lnkPay);


This new page has some validation code to ensure that the relevant status is
such that the page can offer the next step to the user. Should the status
have advanced (and so the link to get there is stale and should no longer
be visible, but it is visible since it was rendered to the user before the
status advanced) the new page (disables its OK button and) displays a
feedback message to the user.

HTML fragment
--
div wicket:id=fbpnlFeedbackPanel/


Java fragment
-
FeedbackPanel fbpnlFeedbackPanel = new FeedbackPanel(fbpnlFeedbackPanel);
add(fbpnlFeedbackPanel);

public PageBuyOptions(String sItemEncodedKey)
{
super();

if ([status has changed])
{
// MySession extends WebSession
MySession ssnSession = (MySession)getSession();

ssnSession.error([Link is stale]);
...
}

FormPageBuyOptionsData frmForm = new 
FormPageBuyOptionsData(frmForm)
{
...
}

...
}


This all works fine, and the feedback message shows as expected in the new
page. But there are two use cases when the new page is shown without the
expected feedback message: when the stale link is clicked using Open Link
in New Window or Open Link in New Tab.

Is this non-appearance of a feedback message in these two cases expected
Wicket behaviour? Am I missing something or doing something wrong? I would
appreciate any tips.

Ian Marshall
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Feedback-message-does-not-show-in-new-WebPage-tp2993413p2993413.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



condition in AbstractAjaxTimerBehavior

2010-10-13 Thread Maris Orbidans
Hi

I need to periodically update a page unless some condition is met.
I wrote javascript function canRefresh() and added like this:

add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
  @Override
  protected void onTimer(final AjaxRequestTarget target) {
updateSessionConfigPanel(target);
   }

   @Override
protected CharSequence getCallbackScript() {
  return if (!canRefresh()) {+ super.getCallbackScript()+};;
  }
 });

This is generated javascript.

script type=text/javascript !--/*--![CDATA[/*!--*/
Wicket.Event.add(window, load, function(event) { setTimeout(if
(!canRefresh()) {var
wcall=wicketAjaxGet('?wicket:interface=:0::IActivePageBehaviorListener:1
:wicket:ignoreIfNotActive=true',function() { }.bind(this),function() {
}.bind(this));};, 5000);;});
/*--]]*//script

The problem is that once canRefresh() returns false timer stops. Is it
possible to restart it?  Or a better way to implement conditional
update?


Maris

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



Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Carlson Weber
I searched all over the internet and it seems that no one uses this
method. The thing is that I am almost thinking that this is a bug,
because it's really not logic to me. What I am trying to do: I am
creating a panel that I will use in a lot of forms, and I want to
attach some javascript code to my onKeyDown HTML event of this
TextField, so my code looks like this:


container.getHeaderResponse().renderOnEventJavascript(document.getElementById('+txtCliente.getMarkupId()+'),
onKeyDown, if (window.event.altKey){if (window.event.keyCode ==
80){document.getElementById(' + link.getMarkupId() +
').onclick();}});

It's basically this: When user press Ctrl+P while TextField focused,
it will click on a link, that is another component of my panel. When
it renders the Javascript there's a problem: It render on the HEAD
section of HTML, referencing the TextField with a variable (with a
random name), but BEFORE the TextField was rendered on the HTML. The
result of this is that Firefox and Chrome gives an error , saying that
the component doesn't exist, and, in fact it doesn't, because the DOM
still didn't load! So, probably I am doing this wrong, does anyone can
help me with that? And what's the reason of this function
renderOnEventJavascript if it renders on the head? It will always give
an error message saying the component is null, am I right? I am using
the latest release of 1.4 series. Thank you very much guys!

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



Re: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Martin Grigorov
Hi,

Indeed it looks this method works only when the target element is already
available.
It is used by
org.apache.wicket.markup.html.internal.HeaderResponse.renderOnDomReadyJavascript(String)
and
org.apache.wicket.markup.html.internal.HeaderResponse.renderOnLoadJavascript(String)
but both of them use 'window' as target and it is always available.

To solve your problem you can use renderOnDomReadyJavascript(String) with
parameter: Wicket.Event.add(Wicket.$(+theId+, 'keydown', function(event)
{...}))

On Wed, Oct 13, 2010 at 3:13 PM, Carlson Weber cwe...@mastercim.com.brwrote:

 I searched all over the internet and it seems that no one uses this
 method. The thing is that I am almost thinking that this is a bug,
 because it's really not logic to me. What I am trying to do: I am
 creating a panel that I will use in a lot of forms, and I want to
 attach some javascript code to my onKeyDown HTML event of this
 TextField, so my code looks like this:



 container.getHeaderResponse().renderOnEventJavascript(document.getElementById('+txtCliente.getMarkupId()+'),
 onKeyDown, if (window.event.altKey){if (window.event.keyCode ==
 80){document.getElementById(' + link.getMarkupId() +
 ').onclick();}});

 It's basically this: When user press Ctrl+P while TextField focused,
 it will click on a link, that is another component of my panel. When
 it renders the Javascript there's a problem: It render on the HEAD
 section of HTML, referencing the TextField with a variable (with a
 random name), but BEFORE the TextField was rendered on the HTML. The
 result of this is that Firefox and Chrome gives an error , saying that
 the component doesn't exist, and, in fact it doesn't, because the DOM
 still didn't load! So, probably I am doing this wrong, does anyone can
 help me with that? And what's the reason of this function
 renderOnEventJavascript if it renders on the head? It will always give
 an error message saying the component is null, am I right? I am using
 the latest release of 1.4 series. Thank you very much guys!

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




Re: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Michael O'Cleirigh

 Hello,

You can use:

textfield.add (new AttributeModifier (onkeydown, true, if 
(window.event.altKey){if (window.event.keyCode ==

80){document.getElementById(' + link.getMarkupId() +
').onclick();}});

If you do this within the Component.onInitialize() you will have the 
true markupid of the link available.


If you wanted to get rid of the link altogether you could just attach an 
ajax event directly to the text field like:


textfield.add (new AjaxEventBehavior (onkeydown) {

@Override
protected void onEvent(final AjaxRequestTarget target) {
// do your serverside logic
}

@Override
   protected CharSequence getPreconditionScript() {
// if this evaluates to true in the browser then the event will 
be executed.

return return window.event.altKey  window.event.keyCode == 80;;
}

}):

This is untested but I think it should work,

Regards,

Mike


I searched all over the internet and it seems that no one uses this
method. The thing is that I am almost thinking that this is a bug,
because it's really not logic to me. What I am trying to do: I am
creating a panel that I will use in a lot of forms, and I want to
attach some javascript code to my onKeyDown HTML event of this
TextField, so my code looks like this:


container.getHeaderResponse().renderOnEventJavascript(document.getElementById('+txtCliente.getMarkupId()+'),
onKeyDown, if (window.event.altKey){if (window.event.keyCode ==
80){document.getElementById(' + link.getMarkupId() +
').onclick();}});

It's basically this: When user press Ctrl+P while TextField focused,
it will click on a link, that is another component of my panel. When
it renders the Javascript there's a problem: It render on the HEAD
section of HTML, referencing the TextField with a variable (with a
random name), but BEFORE the TextField was rendered on the HTML. The
result of this is that Firefox and Chrome gives an error , saying that
the component doesn't exist, and, in fact it doesn't, because the DOM
still didn't load! So, probably I am doing this wrong, does anyone can
help me with that? And what's the reason of this function
renderOnEventJavascript if it renders on the head? It will always give
an error message saying the component is null, am I right? I am using
the latest release of 1.4 series. Thank you very much guys!

-
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



WebPage: geting string

2010-10-13 Thread msantos

Hi there.

Is possible instanciate a WebPage component and the getting the string that
represents that webpage? My intention is to create a method that returns a
string representing a html page to use on a email.

Thanks a lot
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/WebPage-geting-string-tp2993717p2993717.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



DownloadLink with AjaxIndicator

2010-10-13 Thread Ann Baert
I would like to add an ajaxindicator on a DownloadLink.
How can I do this?

But because DownloadLink isn't ajax, I tried the following:

AjaxLink downloadLink = new AjaxLink(id) {

@Override
public void onClick(AjaxRequestTarget target) {
 
}
};
downloadLink.add(new AjaxEventBehavior(onclick) {
 
@Override
public void onEvent(final AjaxRequestTarget target) {
RequestCycle.get().setRequestTarget(new IRequestTarget() {

public void detach(RequestCycle requestCycle) {
}

public Object getLock(RequestCycle requestCycle) {
return null;
}

public void respond(RequestCycle requestCycle) {
WebResponse r = (WebResponse) requestCycle.getResponse();
r.setAttachmentHeader(header.ext);
r.setContentType(application/contentype);

...
Streams.copy(bais, r.getOutputStream());
 
target.appendJavascript(...);
}
});
 
}

@Override
protected CharSequence getEventHandler() {
AppendingStringBuffer handler = new AppendingStringBuffer();
handler.append(...);
handler.append(super.getEventHandler());
return handler;
}
});
add(downloadLink);



Thanks
Ann
 DISCLAIMER 

http://www.tvh.com/newen2/emaildisclaimer/default.html 

This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message.


Re: WebPage: geting string

2010-10-13 Thread Martin Makundi
Here:


/**
   * Renders given page
   * @param pageClass to render
   * @param pageParameters to render with
   * @param clean
   * @return String of HTML produced
   */
  public static String renderPageToString(
  final Class? extends Page pageClass,
  final PageParameters pageParameters, boolean clean) {
String webPageAsString;
{
  WebApplication webApplication = WebApplication.get();
  ServletContext servletContext = webApplication.getServletContext();
  MockHttpSession servletSession = new MockHttpSession(servletContext);
  servletSession.setTemporary(true);

  MockHttpServletRequest servletRequest = new MockHttpServletRequest(
  webApplication, servletSession, servletContext);
  MockHttpServletResponse servletResponse = new MockHttpServletResponse(
  servletRequest);
  servletRequest.initialize();
  servletResponse.initialize();

  WebRequest webRequest = new ServletWebRequest(servletRequest);

  BufferedWebResponse webResponse = new
BufferedWebResponse(servletResponse);
  webResponse.setAjax(true);

  WebRequestCycle htmlRequestCycle =
new WebRequestCycle(webApplication, webRequest, webResponse);

  BookmarkablePageRequestTarget htmlTarget =
new BookmarkablePageRequestTarget(pageClass, pageParameters);

  htmlRequestCycle.setRequestTarget(htmlTarget);

  try {
htmlRequestCycle.getProcessor().respond(htmlRequestCycle);

if (htmlRequestCycle.wasHandled() == false) {
  htmlRequestCycle.setRequestTarget(new WebErrorCodeResponseTarget(
  HttpServletResponse.SC_NOT_FOUND));
}
htmlRequestCycle.detach();
  } finally {
htmlRequestCycle.getResponse().close();
  }

  webPageAsString = webResponse.toString();
}

//try {
//  FileOutputStream fileOutputStream = new
FileOutputStream(c:/temp/test.html, false);
//  OutputStreamWriter o = new OutputStreamWriter(fileOutputStream, UTF8);
//  o.write(webResponse.toString());
//  o.flush();
//  o.close();
//} catch (Exception e) {
//  throw new IllegalStateException(Bug, e);
//}

webPageAsString = Utils.replaceAll(webPageAsString,
WebPageConstants.SRC_URL_PATTERN, src=\file:/// +
WebApplication.get().getServletContext().getRealPath(/) + /);

if (clean) {
  return escapeHighEnd(webPageAsString.replaceAll(wicket.*?, )
  .replaceAll(/wicket.*?, ).replaceAll(\\swicketpath=\.*?\,
  ));
}

return escapeHighEnd(webPageAsString);
  }


**
Martin

2010/10/13 msantos mpssan...@gmail.com:

 Hi there.

 Is possible instanciate a WebPage component and the getting the string that
 represents that webpage? My intention is to create a method that returns a
 string representing a html page to use on a email.

 Thanks a lot
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/WebPage-geting-string-tp2993717p2993717.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: AjaxRequestTarget not refreshing Component

2010-10-13 Thread Jeremy Thomerson
What does the Wicket AJAX debug window say in that response?

Jeremy Thomerson
http://wickettraining.com
-- sent from my smart phone, so please excuse spelling, formatting, or
compiler errors

On Oct 13, 2010 12:20 AM, LutherBaker lutherba...@gmail.com wrote:


I have created an outer list of areaGroups such that each group item
contains
a list of areas.

I am displaying a ModalWindow and editing an area. After changing the area's
name, I submit it via an AjaxSubmitButton which initially added the ListView
associated with a particular group. Obviously that failed (can't add a
repeater to an AjaxTargetRequest) at which point I added a
WebMarkupContainer to the markup.

   dl wicket:id=group.list class=groupList
dt[group name]/dt
wicket:container wicket:id=item.list.container
dd wicket:id=item.list
   Edit
[item name]
div class=summary wicket:id=item.summary[item summary]/div
/dd
/wicket:container
   /dl

I feed this inner ListView with a LodableDetachableModel where I
fetchAreasByAreaGroup:

   @Override
   protected ListArea load() {
   return dataService.fetchAreasByAreaGroup(areaGroup);
   }

I also created a WebMarkupContainer in code and set its outputMarkupId:

   final WebMarkupContainer itemListContainer = new
WebMarkupContainer(item.list.container);
   itemListContainer.setOutputMarkupId(true);

I store the markup container in a hashmap keyed by AreaGroup which allows me
to, from the ModalWindow, retrieve the markup container associated with the
edited area's AreaGroup. Which I then add to the AjaxRequestTarget in the
ModalWindow's form's AjaxButton.onSubmit handler:

   final WebMarkupContainer container =
areaPage.getWebMarkupContainer(area.getAreaGroup());
   target.addComponent(container);

So all is well. It all compiles and the page loads without error. So, again,
I pop the ModalWindow up, change the name and put a breakpoint in the code.
I can see the AjaxRequestTarget add the container. I can see that the
container is not null. I can see the dataService retrieve the new area. I
can see the code execute which populates the inner ListView I mentioned
earlier - with the updated area properties.

But, after the ModalWindow goes away, the underlying screen representation
doesn't change. The old name is still displayed.

Here is a snippet of the generated markup where you can see
item_list_container53 which identifies the wicket:container that I wish to
repaint.

   dl wicket:id=group.list class=groupList
dtWork/dt
wicket:container wicket:id=item.list.container
id=item_list_container53
dd wicket:id=item.list
   Edit
Hammerhead
div class=summary wicket:id=item.summaryDay job learning large
scale infrastructure skills/div
/dd
/wicket:container
   /dldl wicket:id=group.list class=groupList
dtBusiness Ventures/dt
wicket:container wicket:id=item.list.container
id=item_list_container55
dd wicket:id=item.list
   Edit
Fuzzy Bearings
div class=summary wicket:id=item.summarySoftware Development
Effort/div
/dd
/wicket:container
   /dl


Any thoughts on what I am missing?

Thanks in advance,
-Luther

PS: Please note that nabble will not accept posts with 'onclick' text in the
code snippet 'a' tags ... so I specifically edited onClick to simply be
click in the code snippets.
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-not-refreshing-Component-tp2993093p2993093.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


could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread fachhoch

could not serialize the pagejava.lang.OutOfMemoryError: PermGen space , 

I got this error, it happens once in a while , its hard to reproduce, 
please tell me   can wicket cause memory errors  for any reason ?
I am using 1.4.8 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2993745.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: DownloadLink with AjaxIndicator

2010-10-13 Thread MZemeck
AjaxIndicatorAppender?
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/extensions/ajax/markup/html/AjaxIndicatorAppender.html



From:   Ann Baert ann.ba...@tvh.be
To: users@wicket.apache.org
Date:   10/13/2010 10:09 AM
Subject:DownloadLink with AjaxIndicator



I would like to add an ajaxindicator on a DownloadLink.
How can I do this?

But because DownloadLink isn't ajax, I tried the following:

AjaxLink downloadLink = new AjaxLink(id) {

@Override
public void onClick(AjaxRequestTarget target) {
 
}
};
downloadLink.add(new AjaxEventBehavior(onclick) {
 
@Override
public void onEvent(final AjaxRequestTarget target) {
RequestCycle.get().setRequestTarget(new IRequestTarget() {

public void detach(RequestCycle requestCycle) {
}

public Object getLock(RequestCycle requestCycle) {
return null;
}

public void respond(RequestCycle requestCycle) {
WebResponse r = (WebResponse) requestCycle.getResponse();
r.setAttachmentHeader(header.ext);
r.setContentType(application/contentype);

...
Streams.copy(bais, r.getOutputStream());
 
target.appendJavascript(...);
}
});
 
}

@Override
protected CharSequence getEventHandler() {
AppendingStringBuffer handler = new AppendingStringBuffer();
handler.append(...);
handler.append(super.getEventHandler());
return handler;
}
});
add(downloadLink);



Thanks
Ann
 DISCLAIMER 

http://www.tvh.com/newen2/emaildisclaimer/default.html 

This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message.





Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

RE: could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread CREMONINI Daniele
It happens when the maximum amount of heap memory is reached.

The solution is to increase a dedicated virtual machine parameter to a higher 
value.
For example if you wish to increase to 256 megabytes use this:

-XX:MaxPermSize=256m

in your eclipse.ini file or in the right file of your application server.
If the problem should arise anyway you should consider to examine memory leaks 
in your application.

Let us know
Bye
Daniele Cremonini


-Original Message-
From: fachhoch [mailto:fachh...@gmail.com] 
Sent: 13 October 2010 16:25
To: users@wicket.apache.org
Subject: could not serialize the page java.lang.OutOfMemoryError: PermGen space


could not serialize the pagejava.lang.OutOfMemoryError: PermGen space , 

I got this error, it happens once in a while , its hard to reproduce, 
please tell me   can wicket cause memory errors  for any reason ?
I am using 1.4.8 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2993745.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 message has been scanned for viruses.

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



Re: DownloadLink with AjaxIndicator

2010-10-13 Thread Altuğ Bilgin Altıntaş
my below example codes works on http://jquery.malsup.com/block/

//**
public class BlockerBehaviour {


@SuppressWarnings(unused)
private String componentId;

public BlockerBehaviour(String componentId) {
   this.componentId = componentId;
}

public String getJSBlock() {
String JS =  $(document).ready(function() {\n +
  $.blockUI({ message: 'h1img
src=\images/ajax_indicator.gif\ / nbsp;+ new
ResourceModel(please.wait).getObject()+/h1' });\n +
}) ;;

return JS;
}

 public String getJSUnBlock() {
String JS =  $(document).ready(function() {\n +
  $.unblockUI();  +
}) ;;

return JS;
}

}


//***

public abstract class MyAjaxIndicatorButton extends AjaxButton {
private static final long serialVersionUID = 1L;


public MyAjaxIndicatorButton (String id) {
super(id);
}


@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() {
private static final long serialVersionUID = 1L;

@Override
public CharSequence decorateOnFailureScript(CharSequence script)
{
return script +   + new
BlockerBehaviour(getId()).getJSUnBlock();
}

@Override
public CharSequence decorateScript(CharSequence script) {

return script +   + new
BlockerBehaviour(getId()).getJSBlock();
}

@Override
public CharSequence decorateOnSuccessScript(CharSequence script)
{
return script +   + new
BlockerBehaviour(getId()).getJSUnBlock();
}
};
}  ;
}

2010/10/13 Ann Baert ann.ba...@tvh.be

 I would like to add an ajaxindicator on a DownloadLink.
 How can I do this?

 But because DownloadLink isn't ajax, I tried the following:

 AjaxLink downloadLink = new AjaxLink(id) {

@Override
public void onClick(AjaxRequestTarget target) {

}
 };
 downloadLink.add(new AjaxEventBehavior(onclick) {

@Override
public void onEvent(final AjaxRequestTarget target) {
RequestCycle.get().setRequestTarget(new IRequestTarget() {

public void detach(RequestCycle requestCycle) {
}

public Object getLock(RequestCycle requestCycle) {
return null;
}

public void respond(RequestCycle requestCycle) {
WebResponse r = (WebResponse) requestCycle.getResponse();
r.setAttachmentHeader(header.ext);
r.setContentType(application/contentype);

...
Streams.copy(bais, r.getOutputStream());

target.appendJavascript(...);
}
});

}

@Override
protected CharSequence getEventHandler() {
AppendingStringBuffer handler = new AppendingStringBuffer();
handler.append(...);
handler.append(super.getEventHandler());
return handler;
}
 });
 add(downloadLink);



 Thanks
 Ann
  DISCLAIMER 

 http://www.tvh.com/newen2/emaildisclaimer/default.html

 This message is delivered to all addressees subject to the conditions
 set forth in the attached disclaimer, which is an integral part of this
 message.



Re: Feedback message does not show in new WebPage

2010-10-13 Thread Jeremy Thomerson
On Wed, Oct 13, 2010 at 4:35 AM, Ian Marshall ianmarshall...@gmail.comwrote:


 Hello All,

 I have a link, which when clicked causes a new web page to be shown.


 HTML fragment
 --
 lt;a wicket:id=lnkPay href=#gt;Paylt;/agt;


 Java fragment
 -
 LinkString lnkPay = new LinkString(lnkPay, new ModelString())
 {
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
PageBuyOptions pgNext = new PageBuyOptions(...);
setResponsePage(pgNext);
}
 };
 lnkPay.setVisible(...);
 liItem.add(lnkPay);


 This new page has some validation code to ensure that the relevant status
 is
 such that the page can offer the next step to the user. Should the status
 have advanced (and so the link to get there is stale and should no longer
 be visible, but it is visible since it was rendered to the user before the
 status advanced) the new page (disables its OK button and) displays a
 feedback message to the user.

 HTML fragment
 --
 div wicket:id=fbpnlFeedbackPanel/


 Java fragment
 -
 FeedbackPanel fbpnlFeedbackPanel = new FeedbackPanel(fbpnlFeedbackPanel);
 add(fbpnlFeedbackPanel);

 public PageBuyOptions(String sItemEncodedKey)
 {
super();

if ([status has changed])
{
// MySession extends WebSession
MySession ssnSession = (MySession)getSession();

ssnSession.error([Link is stale]);
...
}

FormPageBuyOptionsData frmForm = new
 FormPageBuyOptionsData(frmForm)
{
...
}

...
 }


 This all works fine, and the feedback message shows as expected in the new
 page. But there are two use cases when the new page is shown without the
 expected feedback message: when the stale link is clicked using Open Link
 in New Window or Open Link in New Tab.

 Is this non-appearance of a feedback message in these two cases expected
 Wicket behaviour? Am I missing something or doing something wrong? I would
 appreciate any tips.

 Ian Marshall
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Feedback-message-does-not-show-in-new-WebPage-tp2993413p2993413.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


Can you try putting this in your Application#init and see if it
works: getPageSettings().setAutomaticMultiWindowSupport(false);

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


Re: could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread Altuğ Bilgin Altıntaş
What is your application server or container ?

Is it a heavy object page ?

Every application can get java.lang.OutOfMemoryError: PermGen space
potentially

First countermeasure you can take is to increase your container's memory.

Altuğ


2010/10/13 fachhoch fachh...@gmail.com


 could not serialize the pagejava.lang.OutOfMemoryError: PermGen space ,

 I got this error, it happens once in a while , its hard to reproduce,
 please tell me   can wicket cause memory errors  for any reason ?
 I am using 1.4.8
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2993745.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: could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread fachhoch

I got this error when running my app on   jetty and tomact  maven plugin.
and  I added 


-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m 

to JRE VM arguments in  Run configration   eclipse.

but I cannot start my Jetty  it complains

Error occurred during initialization of VM
Could not reserve enough space for object heap

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2993810.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: Problem with IHeaderResponse.renderOnEventJavascript

2010-10-13 Thread Carlson Weber
Ok guys, it worked , I used the AttributeModifier. The thing is, why
there's is that renderOnEventJavascript? This should be a method
attached maybe to the domready event... Do you think that is worth
submiting a patch? Or this is the correct behavior? (IMHO this isn't
all right). Anyway, problem solved, thank you all!

2010/10/13 Michael O'Cleirigh michael.ocleir...@rivulet.ca:
  Hello,

 You can use:

 textfield.add (new AttributeModifier (onkeydown, true, if
 (window.event.altKey){if (window.event.keyCode ==
 80){document.getElementById(' + link.getMarkupId() +
 ').onclick();}});

 If you do this within the Component.onInitialize() you will have the true
 markupid of the link available.

 If you wanted to get rid of the link altogether you could just attach an
 ajax event directly to the text field like:

 textfield.add (new AjaxEventBehavior (onkeydown) {

   �...@override
    protected void onEvent(final AjaxRequestTarget target) {
            // do your serverside logic
    }

   �...@override
   protected CharSequence getPreconditionScript() {
        // if this evaluates to true in the browser then the event will be
 executed.
        return return window.event.altKey  window.event.keyCode == 80;;
    }

 }):

 This is untested but I think it should work,

 Regards,

 Mike

 I searched all over the internet and it seems that no one uses this
 method. The thing is that I am almost thinking that this is a bug,
 because it's really not logic to me. What I am trying to do: I am
 creating a panel that I will use in a lot of forms, and I want to
 attach some javascript code to my onKeyDown HTML event of this
 TextField, so my code looks like this:



 container.getHeaderResponse().renderOnEventJavascript(document.getElementById('+txtCliente.getMarkupId()+'),
 onKeyDown, if (window.event.altKey){if (window.event.keyCode ==
 80){document.getElementById(' + link.getMarkupId() +
 ').onclick();}});

 It's basically this: When user press Ctrl+P while TextField focused,
 it will click on a link, that is another component of my panel. When
 it renders the Javascript there's a problem: It render on the HEAD
 section of HTML, referencing the TextField with a variable (with a
 random name), but BEFORE the TextField was rendered on the HTML. The
 result of this is that Firefox and Chrome gives an error , saying that
 the component doesn't exist, and, in fact it doesn't, because the DOM
 still didn't load! So, probably I am doing this wrong, does anyone can
 help me with that? And what's the reason of this function
 renderOnEventJavascript if it renders on the head? It will always give
 an error message saying the component is null, am I right? I am using
 the latest release of 1.4 series. Thank you very much guys!

 -
 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: AjaxPagingNavigator give out strange error

2010-10-13 Thread btbluesky

The problem is I was using Eclipse's maven plug (m2eclipse?!) to manage the
POM (I think it comes with WTP already). Its got the nice GUI, with the
checkbox options of include javadocs and include Sources. I didn't add
it manually in the POM.

Well, very good to know that it doesn't work properly. Maybe I should submit
something in Eclipse bugtrack.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxPagingNavigator-give-out-strange-error-tp2327360p2993927.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: condition in AbstractAjaxTimerBehavior

2010-10-13 Thread Igor Vaynberg
if (!canrefresh()) { settimeout( add original script )} else {
original script }


-igor

On Wed, Oct 13, 2010 at 4:37 AM, Maris Orbidans maris.orbid...@ingg.com wrote:
 Hi

 I need to periodically update a page unless some condition is met.
 I wrote javascript function canRefresh() and added like this:

 add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
 �...@override
  protected void onTimer(final AjaxRequestTarget target) {
    updateSessionConfigPanel(target);
   }

   @Override
    protected CharSequence getCallbackScript() {
      return if (!canRefresh()) {+ super.getCallbackScript()+};;
      }
  });

 This is generated javascript.

 script type=text/javascript !--/*--![CDATA[/*!--*/
 Wicket.Event.add(window, load, function(event) { setTimeout(if
 (!canRefresh()) {var
 wcall=wicketAjaxGet('?wicket:interface=:0::IActivePageBehaviorListener:1
 :wicket:ignoreIfNotActive=true',function() { }.bind(this),function() {
 }.bind(this));};, 5000);;});
 /*--]]*//script

 The problem is that once canRefresh() returns false timer stops. Is it
 possible to restart it?  Or a better way to implement conditional
 update?


 Maris

 -
 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: could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread fachhoch

I added   this to   eclipse -XX:PermSize=256m -XX:MaxPermSize=512m

but the problem is   I cannot start my jetty container I get this error  



Error occurred during initialization of VM
Could not reserve enough space for object heap

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2994036.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: Problem using wicket-extensions

2010-10-13 Thread Jeremy Thomerson
Without knowing what's on your classpath, it's impossible for us to help
you.  Either slf4j is not on the classpath (most likely), or there is some
other strange problem - duplicate jars, different classloaders, etc...

On Thu, Oct 7, 2010 at 12:48 AM, chitrabhanu.das
chitrabhanu@gmail.comwrote:


 Thanks for the repley. Yes I am using maven This is my pom.xml




 project xmlns=http://maven.apache.org/POM/4.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
 http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdnic.fts/groupId
artifactIdFTS2/artifactId
packagingwar/packaging
version1.0-SNAPSHOT/version
!-- TODO project name  --
namequickstart/name
description/description
!--
TODO organization namecompany name/name urlcompany
 url/url
/organization
--
licenses
license
nameThe Apache Software License, Version
 2.0/name
urlhttp://www.apache.org/licenses/LICENSE-2.0.txt
 /url
distributionrepo/distribution
/license
/licenses
dependencies
!--  WICKET DEPENDENCIES --
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring/artifactId
version2.5.6/version
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-spring/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-core/artifactId
version3.3.2.GA/version
/dependency
dependency
groupIdjavax.persistence/groupId
artifactIdpersistence-api/artifactId
version1.0/version
/dependency
dependency
groupIdorg.hibernate/groupId
artifactIdhibernate-annotations/artifactId
version3.4.0.GA/version
/dependency
dependency
groupIdcommons-dbcp/groupId
artifactIdcommons-dbcp/artifactId
version1.2.2/version
/dependency

dependency groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
/dependency


!-- LOGGING DEPENDENCIES - LOG4J --
dependency
groupIdorg.slf4j/groupId
artifactIdslf4j-log4j12/artifactId
version1.4.2/version
/dependency
dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version1.2.14/version
/dependency

!--  JUNIT DEPENDENCY FOR TESTING --
dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version3.8.2/version
scopetest/scope
/dependency

!--  JETTY DEPENDENCIES FOR TESTING  --
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-util/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
dependency
groupIdorg.mortbay.jetty/groupId
artifactIdjetty-management/artifactId
version${jetty.version}/version
scopeprovided/scope
/dependency
/dependencies
build
resources
resource
filteringfalse/filtering
directorysrc/main/resources/directory
/resource
resource
  

Re: Form model changes when onSubmit method is called for the first time.

2010-10-13 Thread Jeremy Thomerson
Show some code.

On Tue, Oct 5, 2010 at 9:27 AM, armandoxxx armando@dropchop.com wrote:


 Hey ppl

 Got a little problem with a form onSubmit().
 A form (for translations, IModelTranslation ) has a DropDownChoice (to
 select a language and holds list of Language objects) and a ListView with
 panels that are wrapper for other fields (TextField, TextAreaField. etc).
 example:
 Form
   DropdownChoice (Language selection)
   Panel1
   Label
   TextField  (fot title)
   Panel2
   Label
   TextAreaField (for description)
  Submit

 Another component on same page is a DataGridView to list Translation
 records
 from data source.

 The problem is when I press submit button and onSubmit() method is
 executed.
 - If form is empty, meaning form was never populated before, the
 getDefaultModelObject() method returns Language object , which is obviously
 the wrong object, cause I specificaly set it to the same that grid uses
 (Translation).

 - If I select a record from grid and form gets populated with record data,
 onSubmit()  I get the Translation object which is the one I wanted.

 Does anyone have any idea what's wrong ? Any tip would be fine.

 Some info:
 - onInitialize() method returns Translation object when
 getDefaultModelObject() is called.

 kind regards

 Armando





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Form-model-changes-when-onSubmit-method-is-called-for-the-first-time-tp2956133p2956133.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




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


Re: mountBookmarkablePage and BookmarkablePageLink with PageParameters

2010-10-13 Thread Jeremy Thomerson
Create a quickstart and attach it to a JIRA.

On Tue, Oct 5, 2010 at 4:05 AM, virtualizer jan.bic...@ppimedia.de wrote:



 Altuğ Bilgin Altıntaş wrote:
 
  Also could you please try without Test1  just
 
  add(new BookmarkablePageLink(testlink1, Test1.class, pp));
 
  Which wicket version ?
 

 Without generic type it is the same problem.

 I´m using 1.4.9.

 I have the same problem if I don´t use PageParameters and
 mount(/some/path, PackageName.forClass(Test1.class))

 Thanks!
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/mountBookmarkablePage-and-BookmarkablePageLink-with-PageParameters-tp2954926p2955651.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




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


Re: using cometd

2010-10-13 Thread Rodolfo Hansen
Yes, this message is safe to ignore. 

It is the bayeux implementation stating JSONCommented is deprecated. 

Later versions of push do not try to use it.

On Tue, 2010-10-12 at 19:32 -0700, fachhoch wrote:

 JSONCommented


Re: could not serialize the page java.lang.OutOfMemoryError: PermGen space

2010-10-13 Thread Altuğ Bilgin Altıntaş
http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html

2010/10/13 fachhoch fachh...@gmail.com


 I added   this to   eclipse -XX:PermSize=256m -XX:MaxPermSize=512m

 but the problem is   I cannot start my jetty container I get this error



 Error occurred during initialization of VM
 Could not reserve enough space for object heap

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/could-not-serialize-the-page-java-lang-OutOfMemoryError-PermGen-space-tp2993745p2994036.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 update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread gouthamrv

I would like to know how to update a panel when we select a drop down chioce
values, that is in onUpdate() method.

My custom panel has AjaxFallbackDefaultDataTable.

Below is Panel and drop down components code. When user selects date, I want
to replace my entire Panel. Currently I have commened that
target.addComponent code, but I want to have implementation here. Any
suggestions?


ListDealHistory dealHistoryList = ServicesCaller
.getAllDealHistoryRecords();
DealHistoryTablePanel dealHistoryTablePanel = new 
DealHistoryTablePanel(
deal_history_table_panel, dealHistoryList);
dealHistoryTablePanel.setOutputMarkupId(true);

add(dealHistoryTablePanel);

IModelList? extends String dateChoices = new
AbstractReadOnlyModelList? extends String() {
@Override
public ListString getObject() {
ListString list = new ArrayListString();
list.add(Last 3 months);
list.add(Last 6 months);
return list;
}
};

final DropDownChoiceString datesDropDown = new 
DropDownChoiceString(
dates, new PropertyModelString(this, 
selectedDate),
dateChoices);
datesDropDown.add(new 
AjaxFormComponentUpdatingBehavior(onchange) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
//target.addComponent(dealHistoryTablePanel);
}
});
add(datesDropDown);

 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994412.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 update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread Jeremy Thomerson
On Wed, Oct 13, 2010 at 3:33 PM, gouthamrv goutha...@yahoo.com wrote:


 I would like to know how to update a panel when we select a drop down
 chioce
 values, that is in onUpdate() method.

 My custom panel has AjaxFallbackDefaultDataTable.

 Below is Panel and drop down components code. When user selects date, I
 want
 to replace my entire Panel. Currently I have commened that
 target.addComponent code, but I want to have implementation here. Any
 suggestions?


ListDealHistory dealHistoryList = ServicesCaller
.getAllDealHistoryRecords();
DealHistoryTablePanel dealHistoryTablePanel = new
 DealHistoryTablePanel(
deal_history_table_panel,
 dealHistoryList);
dealHistoryTablePanel.setOutputMarkupId(true);

add(dealHistoryTablePanel);

IModelList? extends String dateChoices = new
 AbstractReadOnlyModelList? extends String() {
@Override
public ListString getObject() {
ListString list = new ArrayListString();
list.add(Last 3 months);
list.add(Last 6 months);
return list;
}
};

final DropDownChoiceString datesDropDown = new
 DropDownChoiceString(
dates, new PropertyModelString(this,
 selectedDate),
dateChoices);
datesDropDown.add(new
 AjaxFormComponentUpdatingBehavior(onchange) {
@Override
protected void onUpdate(AjaxRequestTarget target) {

  //target.addComponent(dealHistoryTablePanel);
}
});
add(datesDropDown);


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994412.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



The idea you have should work - you just repaint the table / panel in the
onUpdate.  However, since you are pre-loading the table with data in your
constructor, the table will not retrieve updated values based on the changed
dropdownchoice value.  Instead of calling your database or service layer in
the constructor (nearly always a bad idea), you should do that in a model,
like:

IModelListFoo listModel = new LoadableDetachableModelListFoo() {
  public ListFoo load() {
MyService.getLotsOfFooBasedOn(thePropertyThatIsChangedByYourDropDown);
  }
}

Doing that will make your table automatically update when it's repainted
after the drop down changes values.

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


Re: How to update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread gouthamrv

I think you are right. I have changed my code as you suggested, now it is
saying no records found. Here is the rest of the code. I think I am missing
something, can you please suggest?

DealHistoryDataProvider dataProvider = new DealHistoryDataProvider();
AjaxFallbackDefaultDataTableDealHistory ajaxFallbackDefaultDataTable = new
AjaxFallbackDefaultDataTableDealHistory(deal_history_table,
historyColumns, dataProvider, ROWS_PER_PAGE);

public class DealHistoryDataProvider extends
SortableDataProviderDealHistory {
private ListDealHistory dealHistoryList = new 
ArrayListDealHistory();

/**
 * @see org.apache.wicket.markup.repeater.data.IDataProvider#size()
 */
public int size() {
return this.dealHistoryList.size();
}

@Override
public Iterator? extends DealHistory iterator(int first, int count) {
 return this.dealHistoryList.subList(first, first + 
count).iterator();
}

@Override
public IModel model(DealHistory object) {
IModelListDealHistory model = new
LoadableDetachableModelListDealHistory() {
@Override
public ListDealHistory load() {
dealHistoryList = 
ServicesCaller.getAllDealHistoryRecords();
return dealHistoryList;
}
};
return model;
}
}
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994557.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 update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread Jeremy Thomerson
You're not implementing your data provider correctly.  The model(Foo) method
is called AFTER the iterator method.  The intent is so that it can wrap the
Foo in a LoadableDetachableModel (or some other appropriate alternative)
that loads only a single row.  Your iterator and size methods are the ones
that should go to your database / service layer.

NOTE: You really don't want to go get all records just to return a sublist.
 That's a bad idea in almost all cases, unless you're dealing with small
datasets, in which case, just use a ListView and IModelListFoo rather
than the whole data provider.

On Wed, Oct 13, 2010 at 5:50 PM, gouthamrv goutha...@yahoo.com wrote:


 I think you are right. I have changed my code as you suggested, now it is
 saying no records found. Here is the rest of the code. I think I am missing
 something, can you please suggest?

 DealHistoryDataProvider dataProvider = new DealHistoryDataProvider();
 AjaxFallbackDefaultDataTableDealHistory ajaxFallbackDefaultDataTable =
 new
 AjaxFallbackDefaultDataTableDealHistory(deal_history_table,
 historyColumns, dataProvider, ROWS_PER_PAGE);

 public class DealHistoryDataProvider extends
 SortableDataProviderDealHistory {
private ListDealHistory dealHistoryList = new
 ArrayListDealHistory();

/**
 * @see org.apache.wicket.markup.repeater.data.IDataProvider#size()
 */
public int size() {
return this.dealHistoryList.size();
}

@Override
public Iterator? extends DealHistory iterator(int first, int
 count) {
 return this.dealHistoryList.subList(first, first +
 count).iterator();
}

@Override
public IModel model(DealHistory object) {
IModelListDealHistory model = new
 LoadableDetachableModelListDealHistory() {
@Override
public ListDealHistory load() {
dealHistoryList =
 ServicesCaller.getAllDealHistoryRecords();
return dealHistoryList;
}
};
return model;
}
 }
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994557.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




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


Re: How to update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread gouthamrv

I am still have issues, is it possible for you to provide an example of data
provider implementaion for the requirement I have?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994648.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 update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread Jeremy Thomerson
Sure, http://www.lmgtfy.com/?q=example+idataproviderl=1

On Wed, Oct 13, 2010 at 7:16 PM, gouthamrv goutha...@yahoo.com wrote:


 I am still have issues, is it possible for you to provide an example of
 data
 provider implementaion for the requirement I have?
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994648.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




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


Re: How to update a Panel when user selects a drop down chioce in Wicket?

2010-10-13 Thread Jeremy Thomerson
Also, if you haven't seen it, look at the Wicket Examples:
http://wicketstuff.org/wicket14/

And specifically, this page:
http://wicketstuff.org/wicket14/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.PagingPage

On Wed, Oct 13, 2010 at 7:45 PM, Jeremy Thomerson jer...@wickettraining.com
 wrote:

 Sure, http://www.lmgtfy.com/?q=example+idataproviderl=1


 On Wed, Oct 13, 2010 at 7:16 PM, gouthamrv goutha...@yahoo.com wrote:


 I am still have issues, is it possible for you to provide an example of
 data
 provider implementaion for the requirement I have?
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-update-a-Panel-when-user-selects-a-drop-down-chioce-in-Wicket-tp2994412p2994648.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




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




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


Getting the html output of a wicket page

2010-10-13 Thread elesi

Hello guys,

I'm trying to send a email with a body that is HTML-formatted...and I would
to use wicket to write it out...

Is there a way that I could store the markup (with all the tags and stuff)
of a wicket-rendered web page into a string variable?

I thought the getMarkupResourceStream() would work, but i don't know where
it will be called...



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Getting-the-html-output-of-a-wicket-page-tp2994739p2994739.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: Getting the html output of a wicket page

2010-10-13 Thread Martin Makundi
Hi!

Try this:

http://apache-wicket.1842946.n4.nabble.com/WebPage-geting-string-tp2993717p2993717.html

**
Martin

2010/10/14 elesi jsar...@gmail.com:

 Hello guys,

 I'm trying to send a email with a body that is HTML-formatted...and I would
 to use wicket to write it out...

 Is there a way that I could store the markup (with all the tags and stuff)
 of a wicket-rendered web page into a string variable?

 I thought the getMarkupResourceStream() would work, but i don't know where
 it will be called...



 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Getting-the-html-output-of-a-wicket-page-tp2994739p2994739.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