Resource Link Problem

2010-12-03 Thread Peter Diefenthaeler
Hi all,
I'm using a Resource Link with a WebResource to show a PDF Document in the 
browser. This works fine for Websphere 6.1.0.2 on Windows 2003 Server but 
fails on WebSphere  6.1.0.2 on Solaris:

[03.12.10 08:59:32:930 CET] 0024 SystemOut O 2010-12-03 
08:59:32,929 returning fileResource ... 
at 
com.csc.pts.mmg.web.panels.mandate.MandateLinksPanel$1.getResourceStream(MandateLinksPanel.java:95)
[03.12.10 08:59:32:935 CET] 0024 SystemOut O 2010-12-03 
08:59:32,931 String index out of range: -1 
at 
org.apache.wicket.RequestCycle.logRuntimeException(RequestCycle.java:1529)
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at java.lang.String.substring(String.java:1735)
at 
com.ibm.ws.webcontainer.webapp.WebApp.getMimeType(WebApp.java:2109)
at 
com.ibm.ws.webcontainer.facade.ServletContextFacade.getMimeType(ServletContextFacade.java:84)
at org.apache.wicket.Response.detectContentType(Response.java:358)
at 
org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.configure(ResourceStreamRequestTarget.java:236)
at 
org.apache.wicket.request.target.resource.ResourceStreamRequestTarget.respond(ResourceStreamRequestTarget.java:150)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1267)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1334)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484)
at 
org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at 
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at 
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at 
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
at 
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at 
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at 
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at 
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at 
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at 
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at 
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at 
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at 
com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at 
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510) 


The code in Wicket:

WebResource pdfSignatureDocument = new WebResource() {

private static final long serialVersionUID = 1L;

@Override
protected void setHeaders(WebResponse response) {
super.setHeaders(response);
response.setAttachmentHeader(
signature.pdf);
}

@Override
public IResourceStream getResourceStream() {
 
log.debug(Printing mandate PDF for 
mandate
+ selectedMandate
.getReference());
ArrayListSerializable list = new 
ArrayListSerializable();
list.add(selectedMandate);
MmgReportManager rm = new 
MmgReportManager();
File pdfMandate = null;
try {
pdfMandate = 
rm.exportReportAsFile(ReportTypes.SELECTED_MANDATE, list, 
SupportedFileTypes.PDF);
} catch (PtsException e) {
log.error(e);
   

Re: Data Sharing with InlineFrame Pages

2010-12-03 Thread Martin Grigorov
Hi Dan,

I don't have time to investigate deeper your application but here are the
common recommendations:
 - don't share components between pages
 - share their models. even better - share just pointers which will be used
by the models to find the data

Martin

On Fri, Dec 3, 2010 at 3:28 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 I tracked down the gotcha and assembled the attached quickstart project
 to demonstrate it. Can someone please clarify whether this is a bug or an
 intentional design limitation? It's definitely unintuitive for those
 unfamiliar with Wicket's page serialization tricks.

 In my case, the issue manifests itself when the Page within an InlineFrame
 (call it InlinePage) has a reference to a component in the outer Page (call
 it HomePage). After InlinePage handles a request, it gets serialized into a
 page map entry along with the referenced component within HomePage, and
 HomePage's PageHolder. But HomePage gets serialized separately, and includes
 *its own copy* of the referenced component. Ultimately this manifests as a
 corrupt object graph where a component's parent does not contain the
 component itself [i.e. getParent().get(getId()) is null].

 I believe this issue did not occur in one of the two uses I describe below
 because SecondLevelCachePageMap keeps a deserialized copy of the most
 recently accessed Page, averting the corruption that occurs in the
 serialization roundtrip. I have not actually verified this however.

 Much care and thought has obviously gone into handling multiple pages in a
 single request, but given this use case's (subtle) failure, I'm left
 wondering when it is appropriate. It seems like the only safe ways to share
 data bidirectionally between pages are (1) through a model that maintains
 the value outside of the session/page map, or (2) through AJAX callbacks via
 the client browser. True?

 Dan

 On Wed, Dec 1, 2010 at 6:22 PM, Dan Retzlaff dretzl...@gmail.com wrote:

 Hello,

 I have a page with an embedded InlineFrame which is used to submit a
 multipart form. I would like the InlineFrame's page to share a model object
 with the parent page. This way the parent page can control the workflow
 after the form is submitted. However, something is preventing model changes
 made during the form submission from being visible in subsequent requests to
 the parent page. My guess is that issue stems from the way in which the
 child page (with its reference to the parent page) is being serialized into
 the page store because the subsequent parent requests see the *unmodified
 * model object.

 Further confusing me is the fact that I use the same upload panel with the
 InlineFrame in two different pages, and in one of the two the model change
 *is* seen by the parent. I'm no PageMap expert, but I debugged into
 Session enough to see that the page versions are the same between the form
 submission request and the subsequent parent page request in both
 cases. There is obviously some gotcha that I've stumbled into on one page
 and not the other.

 Can anyone decipher what may be going on? Or recommend a best practice for
 sharing data with an embedded iframe page?

 I am using Wicket 1.4.13.

 Thanks,
 Dan




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



Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Nivedan Nadaraj
Hi
Yeah so at present, what I do is when the user

1. Adds a new phone number, I add this to the existing list of phoneNumbers
in the UI but yet to be persisted
2. User now clicks Save - This saves the Main object ie a Person and since
the new phone number is added to the collection while I save Person the
enclosed associations (phones) also gets persisted
3. I now, get the saved Person from backend and re-render the Person
Information and the list of Phones(including the new one I added)
4. All fine so far
5. Now when i navigate /intermittently it breaks.

This is response to your  i think better way would be persisting a user's
new entry  and then showing
him the actual list which is a reflection of your database..

Cheers for the thoughts
Niv


On Fri, Dec 3, 2010 at 3:48 PM, vineet semwal vineetsemwal1...@gmail.comwrote:

 afaik,if your collection is lazy ,you will be able to initialize it in the
 same session ..
 if you are trying to initialize it in a new/different session you will not
 be able to initialize it..
 what i did was making sure that you have a associate collection which is in
 the same session..
 i think better way would be persisting a user's new entry  and then showing
 him the actual list which is a reflection of your database..


 On Fri, Dec 3, 2010 at 12:50 PM, Nivedan Nadaraj shravann...@gmail.com
 wrote:

  Vineet
  I have not tried that. In this scenario, it will overwrite the phone's
 the
  user may have added to a list on the UI and is yet to be persisted. If
 you
  know what I mean.
 
  1, Initial fetch of Subject along with his phones ( 5 items)
  2. User adds a new phone number to the subject ( 5 + 1 (yet to be
  persisted)
  3. If user navigates and the load() gets a list of Phones for the subject
  it
  will overwrite the ones user has added.
 
  Not sure if that made sense, thanks for your thoughts
  Will ping back
  Niv
 
 
  On Thu, Dec 2, 2010 at 5:43 PM, vineet semwal 
 vineetsemwal1...@gmail.com
  wrote:
 
   do you see the exception when you try this?
@Override
 protected Object load() {
// return containerForm.getModelObject().getPhoneList();
   return service.getRequiredObject(*).getPhoneList(); //or any thing like
  it
   ..
  
 }
  
   On Thu, Dec 2, 2010 at 12:12 PM, Nivedan Nadaraj 
 shravann...@gmail.com
   wrote:
  
Hi James
   
Thanks for the time. I use the CPM for the whole use case. Mmm..is
 LDM
mandatory for such a use case? Am open for thoughts just want the
 best
   way
to implement it.
Can you explain a bit further what your thought was please?
   
Thank you
Regards
   
   
   
   
On Thu, Dec 2, 2010 at 2:13 PM, James Carman 
  ja...@carmanconsulting.com
wrote:
   
 Just make sure your form's model is a LDM too.

 On Thu, Dec 2, 2010 at 12:23 AM, Nivedan Nadaraj 
   shravann...@gmail.com
 wrote:
  Hi All
 
  I am guessing this is more of a Hibernate thing/issue but if some
  one
has
  encountered this and has a explanation that I can probably use
 from
   the
  Wicket front would be great.
 
  https://forum.hibernate.org/viewtopic.php?f=1t=1008473
 
 
  I have a LazyIntializationException when i page through some
 items.
  I
use
  the PageableListView, the List item(s) are entities that are
   retrieved
 via
  an association Person.phones which is  a Set type.
  The funny thing is, the LIException is intermittent. I am also
  using
  OpenSessionInViewFilter. Any thoughts?
 
  By the way the this is the load() implemenation, I have set the
  Model
  Object's phoneList with a list of values fetched via the
   Service-DAO.
I
  have used this with other entities without association and it
 works
 but
 I
  guess is a different scenario(not associations)
 
  Model = new LoadableDetachableModelObject() {
 @Override
 protected Object load() {
 return
  containerForm.getModelObject().getPhoneList();
 }
 };
  }
 
  If someone has any thoughts would appreiciate hearing from you.
 
 
  Cheers
 


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


   
  
  
  
   --
   regards,
   Vineet Semwal
  
 



 --
 regards,
 Vineet Semwal



Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Nivedan Nadaraj
Dan,

Thanks mate. I am yet to digest all that. I am going to get back to you and
see if it all helped.

Thank you for the time
Cheers
niv

On Fri, Dec 3, 2010 at 1:06 AM, Dan Retzlaff dretzl...@gmail.com wrote:

 Yes, copying entities from the entity's association collection into another
 collection will initialize the collection. If you're still getting an LIE,
 there may be another association at play (a child of Phone?).

 Note that I don't fully endorse the session reattachment aspect I posted.
 Not only is weaving those Hibernate classes a little tricky and a lot of
 hacky, it can cause undesirable amounts of entities to be added into the
 session. James' suggestion of putting the collection behind a Wicket model
 is more elegant. To this end, you might develop a utility which, given a
 list of Persons, returns an IModelListPerson while storing only their
 IDs in the session. In the following code, BasicDao.getIdentifier() and
 BasicDao.get() simply map to Hibernate Session methods of the same name for
 entity class T.

 public static T IModelListT createListModelFromObjects(final
 BasicDaoT dao, ListT objectList) {
 final ListSerializable idList = new
 ArrayListSerializable(objectList.size());
 for (T object : objectList) {
 idList.add(dao.getIdentifier(object));
 }
  return new LoadableDetachableModelListT(objectList) {
 @Override
 protected ListT load() {
 return loadList(dao, idList);
 }
 };
 }

 private static T ListT loadList(BasicDaoT dao, List? extends
 Serializable idList) {
 ListT loadList = new ArrayListT(idList.size());
 for (Serializable id : idList) {
 loadList.add(dao.get(id));
 }
 return loadList;
 }


 On Wed, Dec 1, 2010 at 10:26 PM, Nivedan Nadaraj shravann...@gmail.com
 wrote:

  Hi Dan,
 
  Thanks for your time most appreciated.
 
  1. Option 1 as you may agree, not always is a good thing to do so I would
  drop that.
 
  2. Option 2 - I have tried this in the following manner.
 
  As part of the look up for the Subjects via the DAO, I iterate through
 the
  list of Person.Phones collection and assign them into a
 CollectionPhones
  and set it into a value Object with has a List. This is because i cannot
  use
  the Set in the PageableListView. In doing so, I have forced the entities
 in
  the collection/proxy to be intialised isn't it? Looks like even with this
  it
  beats me.
 
  3. Option 3 - I have to read up more on how I can use this code/or
  something
  similar, we use Spring for DI.
 
  Further, each time I want to view a Person detail, I do a second look up
  when the user clicks from a list of Persons. I send issue a lookup into
 the
  DAO to get the Person's details afresh(the exact same method I used to
 list
  all Subjects in the first place), so this again would have refreshed the
  Phones collection on the Person in context.
 
  I will try to track it down I guess it has to do with session anyway. I
  also
  use the CPM to hold the Model for the whole page. Not a LDM.
 
  Thanks again for the time
  Cheers
  Niv
 
 
  On Thu, Dec 2, 2010 at 1:47 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
 
   Hi Nivedan,
  
   Even though the subsequent requests have a Session open, the entities
  with
   the uninitialized collections don't know about it. I'm sure if you
 track
  it
   down, you can explain the intermittent behavior by prior access to
 the
   collection when the original session is open.
  
   I'd say you can either (1) configure Hibernate to load the collections
 to
   load unlazily, (2) manually access the collections to force them to
   initialize in the specific cases you're encountering LIEs, or (3)
 employ
   some kind of AOP hack to reinject the new session right before the
   collection is accessed. They're all kind of ugly, and I've never heard
 of
   anyone else doing the last, but it's been working well for my team.
  
   For your reference, here is the AspectJ aspect I wrote. (We use Guice
 for
   dependency injection.)
  
   /**
* Reattaches entities whose lazy collections are about to be
 initialized
* p
* Can we keep track of all lazy relationships that get initialized,
 and
* uninitialize them at the end of the request? This would prevent
   referenced
* entities from being serialized and replicated (unless separate
   references
* were created to them).
*
* @author dan
*/
   @Aspect
   public class ReattachAspect {
   private static final Logger LOG =
 Logger.getLogger(ReattachAspect.class);
  
   private ProviderSession sessionProvider;
  
   @Before(call(public final void
   org.hibernate.proxy.AbstractLazyInitializer.initialize()) 
   target(initializer))
   public void reattachLazyInitializer(LazyInitializer initializer) {
   if (initializer.getSession() == null  sessionProvider != null) {
   if (LOG.isDebugEnabled()) {
   LOG.debug(reattaching session to lazy initializer for  +
   initializer.getEntityName());
   }
   Session session = sessionProvider.get();
   

Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread vineet semwal
afaik problem is you are doing form.getmodelobject(),that form could be ajax
submitted and so you are trying to initialize associate
collection in different session..

i don't understand your 1. and 2.
why are you adding to list when user has not clicked on save ?

i think adding a new phone number or entry should itself means a new entry
is persisted and user is shown the new list..


On Fri, Dec 3, 2010 at 2:29 PM, Nivedan Nadaraj shravann...@gmail.comwrote:

 Hi
 Yeah so at present, what I do is when the user

 1. Adds a new phone number, I add this to the existing list of phoneNumbers
 in the UI but yet to be persisted
 2. User now clicks Save - This saves the Main object ie a Person and since
 the new phone number is added to the collection while I save Person the
 enclosed associations (phones) also gets persisted
 3. I now, get the saved Person from backend and re-render the Person
 Information and the list of Phones(including the new one I added)
 4. All fine so far
 5. Now when i navigate /intermittently it breaks.

 This is response to your  i think better way would be persisting a user's
 new entry  and then showing
 him the actual list which is a reflection of your database..

 Cheers for the thoughts
 Niv


 On Fri, Dec 3, 2010 at 3:48 PM, vineet semwal vineetsemwal1...@gmail.com
 wrote:

  afaik,if your collection is lazy ,you will be able to initialize it in
 the
  same session ..
  if you are trying to initialize it in a new/different session you will
 not
  be able to initialize it..
  what i did was making sure that you have a associate collection which is
 in
  the same session..
  i think better way would be persisting a user's new entry  and then
 showing
  him the actual list which is a reflection of your database..
 
 
  On Fri, Dec 3, 2010 at 12:50 PM, Nivedan Nadaraj shravann...@gmail.com
  wrote:
 
   Vineet
   I have not tried that. In this scenario, it will overwrite the phone's
  the
   user may have added to a list on the UI and is yet to be persisted. If
  you
   know what I mean.
  
   1, Initial fetch of Subject along with his phones ( 5 items)
   2. User adds a new phone number to the subject ( 5 + 1 (yet to be
   persisted)
   3. If user navigates and the load() gets a list of Phones for the
 subject
   it
   will overwrite the ones user has added.
  
   Not sure if that made sense, thanks for your thoughts
   Will ping back
   Niv
  
  
   On Thu, Dec 2, 2010 at 5:43 PM, vineet semwal 
  vineetsemwal1...@gmail.com
   wrote:
  
do you see the exception when you try this?
 @Override
  protected Object load() {
 // return containerForm.getModelObject().getPhoneList();
return service.getRequiredObject(*).getPhoneList(); //or any thing
 like
   it
..
   
  }
   
On Thu, Dec 2, 2010 at 12:12 PM, Nivedan Nadaraj 
  shravann...@gmail.com
wrote:
   
 Hi James

 Thanks for the time. I use the CPM for the whole use case. Mmm..is
  LDM
 mandatory for such a use case? Am open for thoughts just want the
  best
way
 to implement it.
 Can you explain a bit further what your thought was please?

 Thank you
 Regards




 On Thu, Dec 2, 2010 at 2:13 PM, James Carman 
   ja...@carmanconsulting.com
 wrote:

  Just make sure your form's model is a LDM too.
 
  On Thu, Dec 2, 2010 at 12:23 AM, Nivedan Nadaraj 
shravann...@gmail.com
  wrote:
   Hi All
  
   I am guessing this is more of a Hibernate thing/issue but if
 some
   one
 has
   encountered this and has a explanation that I can probably use
  from
the
   Wicket front would be great.
  
   https://forum.hibernate.org/viewtopic.php?f=1t=1008473
  
  
   I have a LazyIntializationException when i page through some
  items.
   I
 use
   the PageableListView, the List item(s) are entities that are
retrieved
  via
   an association Person.phones which is  a Set type.
   The funny thing is, the LIException is intermittent. I am also
   using
   OpenSessionInViewFilter. Any thoughts?
  
   By the way the this is the load() implemenation, I have set the
   Model
   Object's phoneList with a list of values fetched via the
Service-DAO.
 I
   have used this with other entities without association and it
  works
  but
  I
   guess is a different scenario(not associations)
  
   Model = new LoadableDetachableModelObject() {
  @Override
  protected Object load() {
  return
   containerForm.getModelObject().getPhoneList();
  }
  };
   }
  
   If someone has any thoughts would appreiciate hearing from you.
  
  
   Cheers
  
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  

howto track translations

2010-12-03 Thread Frank van Lankvelt
in the process of expanding the number of languages my wicket
application is available in, I'm running into the question of tracking
properties files.
In particular, I want to be able to get some kind of feedback about
missing translations; mismatches between property files would be
sufficient.

How do you do this?  Is there a maven plugin that I've missed, or
perhaps a standalone tool?

cheers, Frank

-- 
Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
(0)20 522 4466
USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA.
94954 •  +1 877 414 4776 (toll free)
Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC
H2T 1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  i...@onehippo.com

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.

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



Re: howto track translations

2010-12-03 Thread Peter Miklosko
Not sure how other IDEs but in IntelliJ once you have at least one
translation beside default and you open any of them there at the bottom of
the freame are two tabs to switch between Text and Resource bundle. In
Resource bundle view it will highlight in red any property that is not
available in some translations. This is default functionality of IDE.

Peter

On 3 December 2010 09:40, Frank van Lankvelt f.vanlankv...@onehippo.comwrote:

 in the process of expanding the number of languages my wicket
 application is available in, I'm running into the question of tracking
 properties files.
 In particular, I want to be able to get some kind of feedback about
 missing translations; mismatches between property files would be
 sufficient.

 How do you do this?  Is there a maven plugin that I've missed, or
 perhaps a standalone tool?

 cheers, Frank

 --
 Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
 (0)20 522 4466
 USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA.
 94954 •  +1 877 414 4776 (toll free)
 Canada•   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC
 H2T 1S5  •  +1 (514) 316 8966
 www.onehippo.com  •  www.onehippo.org  •  i...@onehippo.com
 
 This e-mail may be privileged and/or confidential, and the sender does
 not waive any related rights and obligations. Any distribution, use or
 copying of this e-mail or the information it contains by other than an
 intended recipient is unauthorized. If you received this e-mail in
 error, please advise me (by return e-mail or otherwise) immediately.

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




Re: howto track translations

2010-12-03 Thread Peter Karich
 See differences (only) with the following snippet which assumes the 
correct/original properties in messages.properties ('englisch').
It will create a property file for the missing keys for 'de' (german) 
and shows which original keys are unused


  public static void main(String[] args) throws IOException {
new CheckI18N().start();
}


public void start() throws IOException {
Properties english = new Properties();

english.load(getClass().getResourceAsStream(messages.properties));


Properties de = new Properties();
de.load(getClass().getResourceAsStream(messages_de.properties));

// replace FastMap with LinkedHashMap
SetString deKeys = FastSet.newInstance();
MapString, String missingInDE = new TreeMap();
SetString unusedInDE = FastSet.newInstance();

for (EntryObject, Object entry : de.entrySet()) {
deKeys.add(entry.getKey().toString());
}

for (EntryObject, Object entry : english.entrySet()) {
if (!deKeys.contains(entry.getKey().toString()))
missingInDE.put(entry.getKey().toString(), 
entry.getValue().toString());

}

for (String deKey : deKeys) {
if (english.get(deKey) == null)
unusedInDE.add(deKey);
}

System.out.println(en: + english.size());

System.out.println(de: + deKeys.size());
System.out.println(missing in de: + missingInDE.size());
System.out.println(unused in de: + unusedInDE.size());

System.out.println(\n\n==\nmissing in de:\n);
outAsProperties(missingInDE);

System.out.println(\n\n==\nunused in de:\n);
for (String str : unusedInDE) {
System.out.println(str);
}
}

public void outAsProperties(MapString, String map) {
for (EntryString, String entry : map.entrySet()) {
System.out.println(entry.getKey() + = + entry.getValue());
}
}


in the process of expanding the number of languages my wicket
application is available in, I'm running into the question of tracking
properties files.
In particular, I want to be able to get some kind of feedback about
missing translations; mismatches between property files would be
sufficient.

How do you do this?  Is there a maven plugin that I've missed, or
perhaps a standalone tool?

cheers, Frank




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



Internationalization: dynamic message for feedback Panel

2010-12-03 Thread sap2000

Hello,
In my code following lines are present and works as expected.

.java file for Panel contains a FeedbackPanel and displays warning message
using following code:
info(getLocalizer().getString(deleteConfirm, this));

application.properties file contains
deleteConfirm: Do you want to delete user from the list?

What is required now, is to include user name to the existing message.
e.g. Do you want to delete user 'XYZ' from the list?
Since user name will be available at runtime, dynamically how can it be
included in the message?



 


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3070945.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: Internationalization: dynamic message for feedback Panel

2010-12-03 Thread Ernesto Reinaldo Barreiro
I think you can do it as follows:

deleteConfirm: Do you want to delete user ${name} from the list?

and

getLocalizer().getString(deleteConfirm, this, new ModelUser(user));

Assuming User is a bean with  a getName() method.

Ernesto

On Fri, Dec 3, 2010 at 12:31 PM, sap2000 sap2...@indiatimes.com wrote:

 Hello,
 In my code following lines are present and works as expected.

 .java file for Panel contains a FeedbackPanel and displays warning message
 using following code:
 info(getLocalizer().getString(deleteConfirm, this));

 application.properties file contains
 deleteConfirm: Do you want to delete user from the list?

 What is required now, is to include user name to the existing message.
 e.g. Do you want to delete user 'XYZ' from the list?
 Since user name will be available at runtime, dynamically how can it be
 included in the message?






 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3070945.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: howto track translations

2010-12-03 Thread Frank van Lankvelt
thanks; I seem to be getting this hint more and more often.
It's not built into my IDE, eclipse, hopefully there is a plugin with
similar functionality.

cheers, Frnak

On Fri, Dec 3, 2010 at 11:43 AM, Peter Miklosko peter.b...@gmail.com wrote:
 Not sure how other IDEs but in IntelliJ once you have at least one
 translation beside default and you open any of them there at the bottom of
 the freame are two tabs to switch between Text and Resource bundle. In
 Resource bundle view it will highlight in red any property that is not
 available in some translations. This is default functionality of IDE.

 Peter

 On 3 December 2010 09:40, Frank van Lankvelt 
 f.vanlankv...@onehippo.comwrote:

 in the process of expanding the number of languages my wicket
 application is available in, I'm running into the question of tracking
 properties files.
 In particular, I want to be able to get some kind of feedback about
 missing translations; mismatches between property files would be
 sufficient.

 How do you do this?  Is there a maven plugin that I've missed, or
 perhaps a standalone tool?

 cheers, Frank

 --
 Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
 (0)20 522 4466
 USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA.
 94954 •  +1 877 414 4776 (toll free)
 Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC
 H2T 1S5  •  +1 (514) 316 8966
 www.onehippo.com  •  www.onehippo.org  •  i...@onehippo.com
 
 This e-mail may be privileged and/or confidential, and the sender does
 not waive any related rights and obligations. Any distribution, use or
 copying of this e-mail or the information it contains by other than an
 intended recipient is unauthorized. If you received this e-mail in
 error, please advise me (by return e-mail or otherwise) immediately.

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






-- 
Hippo Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31
(0)20 522 4466
USA  • San Francisco 755 Baywood Drive, Second Floor •  Petaluma, CA.
94954 •  +1 877 414 4776 (toll free)
Canada    •   Montréal  5369 Boulevard St-Laurent #430 •  Montréal QC
H2T 1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  i...@onehippo.com

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.

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



Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread James Carman
Why not read the phones into a different list that you edit and
when you're done, you update the entity.

On Fri, Dec 3, 2010 at 2:20 AM, Nivedan Nadaraj shravann...@gmail.com wrote:
 Vineet
 I have not tried that. In this scenario, it will overwrite the phone's the
 user may have added to a list on the UI and is yet to be persisted. If you
 know what I mean.

 1, Initial fetch of Subject along with his phones ( 5 items)
 2. User adds a new phone number to the subject ( 5 + 1 (yet to be persisted)
 3. If user navigates and the load() gets a list of Phones for the subject it
 will overwrite the ones user has added.

 Not sure if that made sense, thanks for your thoughts
 Will ping back
 Niv


 On Thu, Dec 2, 2010 at 5:43 PM, vineet semwal 
 vineetsemwal1...@gmail.comwrote:

 do you see the exception when you try this?
         �...@override
           protected Object load() {
              // return containerForm.getModelObject().getPhoneList();
 return service.getRequiredObject(*).getPhoneList(); //or any thing like it
 ..

           }

 On Thu, Dec 2, 2010 at 12:12 PM, Nivedan Nadaraj shravann...@gmail.com
 wrote:

  Hi James
 
  Thanks for the time. I use the CPM for the whole use case. Mmm..is LDM
  mandatory for such a use case? Am open for thoughts just want the best
 way
  to implement it.
  Can you explain a bit further what your thought was please?
 
  Thank you
  Regards
 
 
 
 
  On Thu, Dec 2, 2010 at 2:13 PM, James Carman ja...@carmanconsulting.com
  wrote:
 
   Just make sure your form's model is a LDM too.
  
   On Thu, Dec 2, 2010 at 12:23 AM, Nivedan Nadaraj 
 shravann...@gmail.com
   wrote:
Hi All
   
I am guessing this is more of a Hibernate thing/issue but if some one
  has
encountered this and has a explanation that I can probably use from
 the
Wicket front would be great.
   
https://forum.hibernate.org/viewtopic.php?f=1t=1008473
   
   
I have a LazyIntializationException when i page through some items. I
  use
the PageableListView, the List item(s) are entities that are
 retrieved
   via
an association Person.phones which is  a Set type.
The funny thing is, the LIException is intermittent. I am also using
OpenSessionInViewFilter. Any thoughts?
   
By the way the this is the load() implemenation, I have set the Model
Object's phoneList with a list of values fetched via the
 Service-DAO.
  I
have used this with other entities without association and it works
   but
   I
guess is a different scenario(not associations)
   
Model = new LoadableDetachableModelObject() {
  �...@override
           protected Object load() {
               return containerForm.getModelObject().getPhoneList();
           }
       };
}
   
If someone has any thoughts would appreiciate hearing from you.
   
   
Cheers
   
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



 --
 regards,
 Vineet Semwal



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



Re: Internationalization: dynamic message for feedback Panel

2010-12-03 Thread sap2000

ok. thank you.
but is there any way when you don't have a bean?

- Shantanu
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3071012.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



Extending Wicket's Button class to do some extra styling

2010-12-03 Thread Stefan Droog
Hi all,

I want to extend Wicket's Button to do some extra styling (image/etc):

What I want to write in my markup is:

button wicket:id=myButton type=submit class=positive

So my own implementation of the button is responsible for adding the image
and the label.

The expected HTML output should be:

button type=submit class=positive
img src=/images/icons/tick.png/
Save
/button

What is the best approach to do this?

Thanks in advance,

Stefan


Re: Internationalization: dynamic message for feedback Panel

2010-12-03 Thread Ernesto Reinaldo Barreiro
What do you want to use instead? A map? I think it will also work with
a map: map.put(name, Bla Bla). If not I think old Java style
properties  are also supported (thought I'm not 100% sure)

property = The user {0} will be deleted. Proceed?

and then passing an array of Object.

Ernesto


On Fri, Dec 3, 2010 at 1:47 PM, sap2000 sap2...@indiatimes.com wrote:

 ok. thank you.
 but is there any way when you don't have a bean?

 - Shantanu
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3071012.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: Internationalization: dynamic message for feedback Panel

2010-12-03 Thread Eugene Malan
I just happened to be in that part of my code , so here goes :

MapString, String map = new HashMapString, String();
map.put(username, user.getDisplayName);
MapModelString, String values = new MapModelString, String(map);
String message = getLocalizer().getString(deleteConfirm, values);
etc...
--
Eugene

On 03 Dec 2010, at 8:01 AM, Ernesto Reinaldo Barreiro wrote:

 What do you want to use instead? A map? I think it will also work with
 a map: map.put(name, Bla Bla). If not I think old Java style
 properties  are also supported (thought I'm not 100% sure)
 
 property = The user {0} will be deleted. Proceed?
 
 and then passing an array of Object.
 
 Ernesto
 
 
 On Fri, Dec 3, 2010 at 1:47 PM, sap2000 sap2...@indiatimes.com wrote:
 
 ok. thank you.
 but is there any way when you don't have a bean?
 
 - Shantanu
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3071012.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: Internationalization: dynamic message for feedback Panel

2010-12-03 Thread Eugene Malan
I just happened to be in that part of my code , so here goes :

MapString, String map = new HashMapString, String();
map.put(username, user.getDisplayName);
MapModelString, String values = new MapModelString, String(map);
String message = getLocalizer().getString(deleteConfirm, values);
etc...
--
Eugene

On 03 Dec 2010, at 8:01 AM, Ernesto Reinaldo Barreiro wrote:

 What do you want to use instead? A map? I think it will also work with
 a map: map.put(name, Bla Bla). If not I think old Java style
 properties  are also supported (thought I'm not 100% sure)
 
 property = The user {0} will be deleted. Proceed?
 
 and then passing an array of Object.
 
 Ernesto
 
 
 On Fri, Dec 3, 2010 at 1:47 PM, sap2000 sap2...@indiatimes.com wrote:
 
 ok. thank you.
 but is there any way when you don't have a bean?
 
 - Shantanu
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Internationalization-dynamic-message-for-feedback-Panel-tp3070945p3071012.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



Ajax and ModalWindow Strange behaviour

2010-12-03 Thread Poko Booth
Hi all, here's the case:

I have an object, let's say a, which has a member b which has two members:
owner and driver of same type.
In a page I have a checkbox which when being pressed, sets driver = owner
and the opposite and I have the components bellow:

TextFieldString ownerName with PropertyModel(a,b.owner.firstname);
TextFieldString driverName with PropertyModel(a,b.driver.firstname);

When the checkbox is pressed [true] the driverName component is disabled.
The checkbox has an ajax event behavior to do the job/rerendering of the
appropriate components.
So far so good.

I have a modal window in the page at another point and after I open/close it
[without messing with the b object at all] the checkbox's behiavior
becomes weird.
When the driverName is rerendered, it has no value. The driverName was one
of 20 components that need to be rerendered. Before openening the modal
window everything works fine, after I close it the inputs are being drawn
with empty strings instead of the real values.
*If I call driverName.modelChanged() in the checkbox's ajax event behavior
then everything goes as expected.
Why is that?*


Any ideas?
Thanx,
Poko


Re: Ajax and ModalWindow Strange behaviour

2010-12-03 Thread Martin Makundi
Maybe this: http://www.mail-archive.com/users@wicket.apache.org/msg35946.html

**
Martin

2010/12/3 Poko Booth poko.bo...@gmail.com:
 Hi all, here's the case:

 I have an object, let's say a, which has a member b which has two members:
 owner and driver of same type.
 In a page I have a checkbox which when being pressed, sets driver = owner
 and the opposite and I have the components bellow:

 TextFieldString ownerName with PropertyModel(a,b.owner.firstname);
 TextFieldString driverName with PropertyModel(a,b.driver.firstname);

 When the checkbox is pressed [true] the driverName component is disabled.
 The checkbox has an ajax event behavior to do the job/rerendering of the
 appropriate components.
 So far so good.

 I have a modal window in the page at another point and after I open/close it
 [without messing with the b object at all] the checkbox's behiavior
 becomes weird.
 When the driverName is rerendered, it has no value. The driverName was one
 of 20 components that need to be rerendered. Before openening the modal
 window everything works fine, after I close it the inputs are being drawn
 with empty strings instead of the real values.
 *If I call driverName.modelChanged() in the checkbox's ajax event behavior
 then everything goes as expected.
 Why is that?*


 Any ideas?
 Thanx,
 Poko


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



Re: Ajax and ModalWindow Strange behaviour

2010-12-03 Thread Poko Booth
Nope...Just tried that, same result. I can't understand why
components.modalChanged() fixes this problematic behavior... Why is the
modal window messing with the parent page's components model???

Thanx for the answer though, you were too fast, thought it would be it :)

On Fri, Dec 3, 2010 at 3:58 PM, Martin Makundi 
martin.maku...@koodaripalvelut.com wrote:

 Maybe this:
 http://www.mail-archive.com/users@wicket.apache.org/msg35946.html

 **
 Martin

 2010/12/3 Poko Booth poko.bo...@gmail.com:
  Hi all, here's the case:
 
  I have an object, let's say a, which has a member b which has two
 members:
  owner and driver of same type.
  In a page I have a checkbox which when being pressed, sets driver = owner
  and the opposite and I have the components bellow:
 
  TextFieldString ownerName with PropertyModel(a,b.owner.firstname);
  TextFieldString driverName with PropertyModel(a,b.driver.firstname);
 
  When the checkbox is pressed [true] the driverName component is
 disabled.
  The checkbox has an ajax event behavior to do the job/rerendering of the
  appropriate components.
  So far so good.
 
  I have a modal window in the page at another point and after I open/close
 it
  [without messing with the b object at all] the checkbox's behiavior
  becomes weird.
  When the driverName is rerendered, it has no value. The driverName was
 one
  of 20 components that need to be rerendered. Before openening the modal
  window everything works fine, after I close it the inputs are being drawn
  with empty strings instead of the real values.
  *If I call driverName.modelChanged() in the checkbox's ajax event
 behavior
  then everything goes as expected.
  Why is that?*
 
 
  Any ideas?
  Thanx,
  Poko
 

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




Re: Extending Wicket's Button class to do some extra styling

2010-12-03 Thread Alexander Morozov


class StyledButton extends Button {

 public StyledButton(...) {
   super();
   add(new SimpleAttributeModifier(class, positive));
 }

 @Override
 protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
openTag) {
   replaceComponentTagBody(markupStream, openTag,  );
 }

}

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Extending-Wicket-s-Button-class-to-do-some-extra-styling-tp3071023p3071104.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: Extending Wicket's Button class to do some extra styling

2010-12-03 Thread Stefan Droog
Thanks for your reply but I prefer to add the image and label via

add(new Image(..,...));
add(new Label(..,..));

Instead of replacing the body.

Is that possible as well?

Stefan


2010/12/3 Alexander Morozov alexander.v.moro...@gmail.com



 class StyledButton extends Button {

  public StyledButton(...) {
   super();
   add(new SimpleAttributeModifier(class, positive));
  }

  @Override
  protected void onComponentTagBody(MarkupStream markupStream, ComponentTag
 openTag) {
   replaceComponentTagBody(markupStream, openTag,  );
  }

 }

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Extending-Wicket-s-Button-class-to-do-some-extra-styling-tp3071023p3071104.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: Ajax and ModalWindow Strange behaviour

2010-12-03 Thread Poko Booth
Hmmm.. Turns out it's not the modal window the one causing the problem.
The modal was activated by an ajaxsubmitlink and the page form had required
components thus errors took place.
I changed those links to ajaxlinks and the problem now appears only after
the user submits the page form with required errors.
Is this the normal behavior?

On Fri, Dec 3, 2010 at 4:12 PM, Poko Booth poko.bo...@gmail.com wrote:

 Nope...Just tried that, same result. I can't understand why
 components.modalChanged() fixes this problematic behavior... Why is the
 modal window messing with the parent page's components model???

 Thanx for the answer though, you were too fast, thought it would be it :)


 On Fri, Dec 3, 2010 at 3:58 PM, Martin Makundi 
 martin.maku...@koodaripalvelut.com wrote:

 Maybe this:
 http://www.mail-archive.com/users@wicket.apache.org/msg35946.html

 **
 Martin

 2010/12/3 Poko Booth poko.bo...@gmail.com:
  Hi all, here's the case:
 
  I have an object, let's say a, which has a member b which has two
 members:
  owner and driver of same type.
  In a page I have a checkbox which when being pressed, sets driver =
 owner
  and the opposite and I have the components bellow:
 
  TextFieldString ownerName with PropertyModel(a,b.owner.firstname);
  TextFieldString driverName with PropertyModel(a,b.driver.firstname);
 
  When the checkbox is pressed [true] the driverName component is
 disabled.
  The checkbox has an ajax event behavior to do the job/rerendering of the
  appropriate components.
  So far so good.
 
  I have a modal window in the page at another point and after I
 open/close it
  [without messing with the b object at all] the checkbox's behiavior
  becomes weird.
  When the driverName is rerendered, it has no value. The driverName was
 one
  of 20 components that need to be rerendered. Before openening the modal
  window everything works fine, after I close it the inputs are being
 drawn
  with empty strings instead of the real values.
  *If I call driverName.modelChanged() in the checkbox's ajax event
 behavior
  then everything goes as expected.
  Why is that?*
 
 
  Any ideas?
  Thanx,
  Poko
 

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





re: howto track translations

2010-12-03 Thread Marzia Forli
maybe this can help you:
http://cal10n.qos.ch/index.html


  

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



IMarkupResourceStreamProvider for ListView

2010-12-03 Thread alex shubert
Hello

I got the following error trying to provide custom render for ListView
 WicketMessage: The component(s) below failed to render. A common problem is 
 that you have added a component in code but forgot to reference it in the 
 markup (thus the component will never be rendered).

New class  signature is
private abstract class EnumListViewT extends ListViewT implements
IMarkupResourceStreamProvider

I was sure getMarkupResourceStream will be called then EnumListView is
to be added to a page.
But it never happens, debug pointer never suspends execution at this point.

What may be wrong? (except my English ofc)

-- 
Best regards
Alex

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



Re: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread Martin Grigorov
you need to call MarkupContainer#renderAssociatedMarkup()

see https://gist.github.com/468502 for an example with
WebMarkupContainerWithAssociatedMarkup

On Fri, Dec 3, 2010 at 3:36 PM, alex shubert alex.shub...@gmail.com wrote:

 Hello

 I got the following error trying to provide custom render for ListView
  WicketMessage: The component(s) below failed to render. A common problem
 is that you have added a component in code but forgot to reference it in the
 markup (thus the component will never be rendered).

 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider

 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.

 What may be wrong? (except my English ofc)

 --
 Best regards
 Alex

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




Re: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread Eugene Malan
You might want to check that you are adding your components in the correct 
place, hierarchically speaking...

I always forget to add elements to the item like so...

protected abstract void populateItem(final ListItemT item){
item.add(new Component(...));  -- correct
add(new Component(...)); --- WRONG


I imagine getMarkupResourceStream is not called because one of the validations 
that check the tree of components failed.

--
Eugene

On 03 Dec 2010, at 9:36 AM, alex shubert wrote:

 Hello
 
 I got the following error trying to provide custom render for ListView
 WicketMessage: The component(s) below failed to render. A common problem is 
 that you have added a component in code but forgot to reference it in the 
 markup (thus the component will never be rendered).
 
 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider
 
 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.
 
 What may be wrong? (except my English ofc)
 
 -- 
 Best regards
 Alex
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



Re: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread Eugene Malan
Alex, please ignore me listen to Martin. My english reading skills need 
improving :-)
On 03 Dec 2010, at 9:47 AM, Eugene Malan wrote:

 You might want to check that you are adding your components in the correct 
 place, hierarchically speaking...
 
 I always forget to add elements to the item like so...
 
 protected abstract void populateItem(final ListItemT item){
item.add(new Component(...));  -- correct
add(new Component(...)); --- WRONG
 
 
 I imagine getMarkupResourceStream is not called because one of the 
 validations that check the tree of components failed.
 
 --
 Eugene
 
 On 03 Dec 2010, at 9:36 AM, alex shubert wrote:
 
 Hello
 
 I got the following error trying to provide custom render for ListView
 WicketMessage: The component(s) below failed to render. A common problem 
 is that you have added a component in code but forgot to reference it in 
 the markup (thus the component will never be rendered).
 
 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider
 
 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.
 
 What may be wrong? (except my English ofc)
 
 -- 
 Best regards
 Alex
 
 -
 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: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread alex shubert
Martin,

thanks a lot.

On 3 December 2010 17:45, Martin Grigorov mgrigo...@apache.org wrote:
 you need to call MarkupContainer#renderAssociatedMarkup()

 see https://gist.github.com/468502 for an example with
 WebMarkupContainerWithAssociatedMarkup

 On Fri, Dec 3, 2010 at 3:36 PM, alex shubert alex.shub...@gmail.com wrote:

 Hello

 I got the following error trying to provide custom render for ListView
  WicketMessage: The component(s) below failed to render. A common problem
 is that you have added a component in code but forgot to reference it in the
 markup (thus the component will never be rendered).

 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider

 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.

 What may be wrong? (except my English ofc)

 --
 Best regards
 Alex

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






-- 
Best regards
Alex

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



Re: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread alex shubert
Looks like onComponentTagBody is never called for ListView
I overrided  it with copy-paste from Panel and .. nothing. Even If I
replace method body with Exception nothing happens...



On 3 December 2010 17:45, Martin Grigorov mgrigo...@apache.org wrote:
 you need to call MarkupContainer#renderAssociatedMarkup()

 see https://gist.github.com/468502 for an example with
 WebMarkupContainerWithAssociatedMarkup

 On Fri, Dec 3, 2010 at 3:36 PM, alex shubert alex.shub...@gmail.com wrote:

 Hello

 I got the following error trying to provide custom render for ListView
  WicketMessage: The component(s) below failed to render. A common problem
 is that you have added a component in code but forgot to reference it in the
 markup (thus the component will never be rendered).

 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider

 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.

 What may be wrong? (except my English ofc)

 --
 Best regards
 Alex

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






-- 
Best regards
Alex

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



Re: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread Martijn Dashorst
Read the ListView javadoc: it states that a ListView has no markup
itself. Override ListItem's onComponentTagBody instead...

Martijn

On Fri, Dec 3, 2010 at 4:15 PM, alex shubert alex.shub...@gmail.com wrote:
 Looks like onComponentTagBody is never called for ListView
 I overrided  it with copy-paste from Panel and .. nothing. Even If I
 replace method body with Exception nothing happens...



 On 3 December 2010 17:45, Martin Grigorov mgrigo...@apache.org wrote:
 you need to call MarkupContainer#renderAssociatedMarkup()

 see https://gist.github.com/468502 for an example with
 WebMarkupContainerWithAssociatedMarkup

 On Fri, Dec 3, 2010 at 3:36 PM, alex shubert alex.shub...@gmail.com wrote:

 Hello

 I got the following error trying to provide custom render for ListView
  WicketMessage: The component(s) below failed to render. A common problem
 is that you have added a component in code but forgot to reference it in the
 markup (thus the component will never be rendered).

 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider

 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.

 What may be wrong? (except my English ofc)

 --
 Best regards
 Alex

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






 --
 Best regards
 Alex

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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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



Re: WiQuery broken by adding component to AjaxRequestTarget

2010-12-03 Thread guydog28

More information:  Looking at the wicket ajax debug, it appears that it is
placing the javascript to open the dialog ahead of the
$(#component).dialog(...)  Basically, the plugin rendering javascript is
being executed AFTER dialog.open(target), and therefore you never see it.  
Anything you add to target.appendJavascript (including dialog.open(target)
which does this under the covers) will be executed prior to the
plugin.render javascript.  At least my understanding is that you can't open
a dialog that isn't yet a dialog!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/WiQuery-broken-by-adding-component-to-AjaxRequestTarget-tp3066621p3071233.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



Remove Child in IVisitor causes problems

2010-12-03 Thread jbrookover

Hey all, 

Interesting thing I encountered today.  I have a Panel that provides it's
own markupstream that is dynamically created from XML/XSLT.  Essentially, it
scans the markup stream for wicket:ids and then calls a
getWicketComponent(String wicketId) that generates different components
based on the id prefix (e.g. wicket:id=addContentBar_3).  Recently, I've
been wanting to redraw this panel via AJAX, changing the markup and adding
and removing child components accordingly.

Haven't had much trouble up to this point until I tried to remove multiple
stale components (e.g. a component that was generated from the previous
markup but doesn't exist in the new markup).  I tried to use an IVisitor..

visitChildren(new IVisitorComponent() {
  public Object component(Component component) {
if (/* component is stale */)
  component.remove();
return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}

I discovered that IVisitor just does a simple run through an array and
removing the component adjusted the size/count of the array, messing up the
traversal and preventing other components from being removed.

I've solved this by just keeping a list of stale components and removing
them after the traversal, but it seems like their should either be
documentation/warnings about modifying the child list in a Visitor and/or a
change in the implementation to support this?  An iterator?  It's probably
rare enough that documentation would suffice :)

I'm just happy that Wicket has allowed me to do the niftiness I described
above :)

Jake
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Remove-Child-in-IVisitor-causes-problems-tp3071290p3071290.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



mounting SharedResource with known parameters, i.e. MixedParamUrlCodingStrategy

2010-12-03 Thread Doug Leeper
We are currently serving our photos from the following URL:


 http://mydomain.com/base/resources/app/photo?bid=53060cid=22288

However we would like the URL to be:

 http://mydomain.com/base/resources/app/photo/53060/22288/image.jpg

We are currently mounting our shared resource as follows:

getSharedResources().add(photo,   new BusinessPhotoSharedResource());
mountSharedResource(photo, photo);

I would like to be able to something like MixedParamUrlCodingStrategy but for 
resources

mount(new SharedResourceRequestTargetMixedParamUrlCodingStrategy(/photo,
   photo, new String[] { bid, cid, file }));

Is this possible? or provided currently in 1.4.x?  Are there other ways to 
provide this behavior?

Thanks
- Doug

Re: WiQuery broken by adding component to AjaxRequestTarget

2010-12-03 Thread guydog28

Additional supporting details:

from code:
@Override
public void onClick(AjaxRequestTarget target)
{
   
viewReqModal.setModelObject(requirementService.find(66L));
target.addComponent(viewReqModal);
viewReqModal.open(target);
}

Wicket AJAX Debug (the dialog has an accordion in it):

?xml version=1.0
encoding=UTF-8?ajax-responseheader-contribution![CDATA[head
xmlns:wicket=http://wicket.apache.org;script type=text/javascript
src=resources/org.odlabs.wiquery.core.commons.CoreJavaScriptResourceReference/jquery/jquery-1.4.4.js/script
link rel=stylesheet type=text/css
href=resources/org.odlabs.wiquery.ui.themes.WiQueryCoreThemeResourceReference/fusion/jquery-ui-1.8.6.custom.css
/
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.core.CoreUIJavaScriptResourceReference/jquery.ui.core.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.widget.WidgetJavascriptResourceReference/jquery.ui.widget.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.mouse.MouseJavascriptResourceReference/jquery.ui.mouse.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.position.PositionJavascriptResourceReference/jquery.ui.position.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.dialog.DialogJavaScriptResourceReference/jquery.ui.dialog.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.draggable.DraggableJavaScriptResourceReference/jquery.ui.draggable.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.resizable.ResizableJavaScriptResourceReference/jquery.ui.resizable.js/script
script type=text/javascript
src=resources/org.odlabs.wiquery.ui.accordion.AccordionJavaScriptResourceReference/jquery.ui.accordion.js/script
/head]]/header-contributioncomponent id=viewRequirement10
![CDATA[!-- the content is here but I have ommitted it to slim things
down--]]/componentevaluate![CDATA[$('#viewRequirementDialog4').dialog('open');]]/evaluateevaluate![CDATA[$('#viewRequirementDialog4').dialog({autoOpen:
false, position: 'center', height: 700, width: 1000, modal: true, resizable:
false})
;]]/evaluateevaluate![CDATA[$('#requirementViewAccordion5').accordion({autoHeight:
false})
;]]/evaluate/ajax-response

As you can see with the EVALUATE statements at the end, the javascript you
manually append to the target (dialog.open()) occurs before the
WiQueryCoreHeaderContributor.renderPlugin jQuery statements.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/WiQuery-broken-by-adding-component-to-AjaxRequestTarget-tp3066621p3071306.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Google App Engine Compatible

2010-12-03 Thread jgardner16

Hi I am building an app on google app engine following the tutorial mentioned
above and it's working fine except it seems like it's serializing data to
session table and everyone once in a while it exceeds the 1MB blog limit. 
Is there something that can done about this like tell it not to serialize
certain things?
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Google-App-Engine-Compatible-tp1889511p3071624.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Google App Engine Compatible

2010-12-03 Thread jgardner16

May have found answer here
http://thoughts.inphina.com/2010/10/20/managing-wicket-serialization-problem-on-google-app-engine/.


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Google-App-Engine-Compatible-tp1889511p3071659.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: IMarkupResourceStreamProvider for ListView

2010-12-03 Thread alex shubert
Martijn
thanks for your patience and help. Sometimes I miss obvious things.
Only one question left: why onComponentTagBody  implemented on
ListView if it's never called?
I miss something clear again?


On 3 December 2010 18:18, Martijn Dashorst martijn.dasho...@gmail.com wrote:
 Read the ListView javadoc: it states that a ListView has no markup
 itself. Override ListItem's onComponentTagBody instead...

 Martijn

 On Fri, Dec 3, 2010 at 4:15 PM, alex shubert alex.shub...@gmail.com wrote:
 Looks like onComponentTagBody is never called for ListView
 I overrided  it with copy-paste from Panel and .. nothing. Even If I
 replace method body with Exception nothing happens...



 On 3 December 2010 17:45, Martin Grigorov mgrigo...@apache.org wrote:
 you need to call MarkupContainer#renderAssociatedMarkup()

 see https://gist.github.com/468502 for an example with
 WebMarkupContainerWithAssociatedMarkup

 On Fri, Dec 3, 2010 at 3:36 PM, alex shubert alex.shub...@gmail.com wrote:

 Hello

 I got the following error trying to provide custom render for ListView
  WicketMessage: The component(s) below failed to render. A common problem
 is that you have added a component in code but forgot to reference it in 
 the
 markup (thus the component will never be rendered).

 New class  signature is
 private abstract class EnumListViewT extends ListViewT implements
 IMarkupResourceStreamProvider

 I was sure getMarkupResourceStream will be called then EnumListView is
 to be added to a page.
 But it never happens, debug pointer never suspends execution at this point.

 What may be wrong? (except my English ofc)

 --
 Best regards
 Alex

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






 --
 Best regards
 Alex

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





 --
 Become a Wicket expert, learn from the best: http://wicketinaction.com

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





-- 
Best regards
Alex

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



ModalWindow open on page load (without ajax)

2010-12-03 Thread hok

Hello,
I'm trying to open a modal window without ajax request (when the page is
loaded). I've looked at 
https://issues.apache.org/jira/browse/WICKET-12
https://issues.apache.org/jira/browse/WICKET-12 

but trying the proposed solution does not work in my case. I can see in the
log that the window's panel is created but the window itself does not open
when the page is loaded. The code that I'm using is:

public class TestPage extends WebPage {

public TestPage() {
}

@Override
protected void onInitialize() {
super.onInitialize();

ModalWindow window = new ModalWindow(modal_window) {
private static final long serialVersionUID = 
-2976925047468282833L;

@Override
protected boolean makeContentVisible() {
if (getWebRequest().isAjax() == false) {
return true;
} else {
return false;
}
}

};
window.setContent(new EmptyPanel(window.getContentId()));
add(window);
}
}

and for the markup file:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:wicket=http://wicket.apache.org/; xml:lang=en lang=en
head
titleWicket test/title
/head
body  
div wicket:id=modal_windowModal window/div
/body
/html

Is there something wrong in the code? Thanks in advance.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ModalWindow-open-on-page-load-without-ajax-tp3071714p3071714.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Google App Engine Compatible

2010-12-03 Thread Rodolfo Hansen
Are you by any change using the maven-gae-plugin ?

If so, did you use archetype supplied?



On Fri, 2010-12-03 at 11:48 -0800, jgardner16 wrote:

 May have found answer here
 http://thoughts.inphina.com/2010/10/20/managing-wicket-serialization-problem-on-google-app-engine/.
 
 




Re: ModalWindow open on page load (without ajax)

2010-12-03 Thread Ernesto Reinaldo Barreiro
Hope this helps

http://apache-wicket.1842946.n4.nabble.com/opening-ModalWindow-on-page-load-td3055618.html

Proposed solution works for me.

Regards,

Ernesto.



On Fri, Dec 3, 2010 at 9:32 PM, hok ivanvasi...@gmail.com wrote:

 Hello,
 I'm trying to open a modal window without ajax request (when the page is
 loaded). I've looked at
 https://issues.apache.org/jira/browse/WICKET-12
 https://issues.apache.org/jira/browse/WICKET-12

 but trying the proposed solution does not work in my case. I can see in the
 log that the window's panel is created but the window itself does not open
 when the page is loaded. The code that I'm using is:

 public class TestPage extends WebPage {

        public TestPage() {
        }

       �...@override
        protected void onInitialize() {
                super.onInitialize();

                ModalWindow window = new ModalWindow(modal_window) {
                        private static final long serialVersionUID = 
 -2976925047468282833L;

                       �...@override
                        protected boolean makeContentVisible() {
                                if (getWebRequest().isAjax() == false) {
                                        return true;
                                } else {
                                        return false;
                                }
                        }

                };
                window.setContent(new EmptyPanel(window.getContentId()));
                add(window);
        }
 }

 and for the markup file:

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
     http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
        xmlns:wicket=http://wicket.apache.org/; xml:lang=en lang=en
 head
    titleWicket test/title
 /head
 body
        div wicket:id=modal_windowModal window/div
 /body
 /html

 Is there something wrong in the code? Thanks in advance.
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/ModalWindow-open-on-page-load-without-ajax-tp3071714p3071714.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: Validate after Submit?

2010-12-03 Thread andrea del bene

Hi,

you can implement a custom IValidator to attach to userid field or a 
custom IFormValidato for your input form. Do you think they could   work 
for your application?

Hi,

a general Question, and I am interested in how you would solve that?

I have a couple of form elements, that I want to submit.
I send some values to a backend and get an error code back - say an Enum
with errorcode and Message Error, User-ID already registered.

What I want to do now is, i want to assign this errormessage to the
inputtextfield for userid.

All Fields are hidden within Panels, so in the Page, I do not have access to
the TextFIeld itself, and I do not want to make it accessible through some
kind of getters or something.

is there a way to assign an Error to a component from outside (with a
FormVisitor or something)?
Just looking for some directions.

Thanks




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



Re: Initiating File Download through Ajax is not working

2010-12-03 Thread val360

Hi

It's mostly working for me as well, except that the downloaded file has
.html appended to it's name.  Any hints?

-Val
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Initiating-File-Download-through-Ajax-is-not-working-tp2289784p3071504.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: Initiating File Download through Ajax is not working

2010-12-03 Thread Ernesto Reinaldo Barreiro
Show your code?

Ernesto

On Fri, Dec 3, 2010 at 7:06 PM, val360 val_wic...@360works.com wrote:

 Hi

 It's mostly working for me as well, except that the downloaded file has
 .html appended to it's name.  Any hints?

 -Val
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Initiating-File-Download-through-Ajax-is-not-working-tp2289784p3071504.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: Initiating File Download through Ajax is not working

2010-12-03 Thread val360

final AJAXDownload download = new AJAXDownload() {
  @Override
  protected IResourceStream getResourceStream() {
return new FileResourceStream(theDatabase.getFile());
  }

  @Override
  protected String getFileName() {
return theDatabase.getFile().getAbsoluteFile().getName();  //FIX!!! the
filename gets .html appended to it.
  }
};
add(download);

add( new AjaxLink(download) {
public void onClick( AjaxRequestTarget target ) {
if( theDatabase.isOpen() ) {
target.appendJavascript( alert('The database is open, 
close or pause the
db first.'); );
} else {
download.initiate( target );
}
}
});

And this class is unchanged:

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AbstractAjaxBehavior;
import
org.apache.wicket.request.target.resource.ResourceStreamRequestTarget;
import org.apache.wicket.util.resource.IResourceStream;

/**
 * @author Sven Meier
 * @author Ernesto Reinaldo Barreiro (reier...@gmail.com)
 */
public abstract class AJAXDownload extends AbstractAjaxBehavior
{
/**
 * Call this method to initiate the download.
 */
public void initiate(AjaxRequestTarget target)
{
CharSequence url = getCallbackUrl();

target.appendJavascript(window.location.href=' + url + ');
}

public void onRequest()
{
getComponent().getRequestCycle().setRequestTarget(
new 
ResourceStreamRequestTarget(getResourceStream(), getFileName()));
}

/**
 * @see ResourceStreamRequestTarget#getFileName()
 */
protected String getFileName()
{
return null;
}

/**
 * Hook method providing the actual resource stream.
 */
protected abstract IResourceStream getResourceStream();
}
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Initiating-File-Download-through-Ajax-is-not-working-tp2289784p3071816.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: Data Sharing with InlineFrame Pages

2010-12-03 Thread Dan Retzlaff
Thanks for the response, Martin. I'm with you on lack of free time. :)

Using a model is not sufficient. The gotcha is that it's very important
where that model lives in the component graph. If both pages hold a
reference to the model, then serialization/deserialization causes the object
aliasing problem demonstrated in my quickstart. The only solution compatible
with Wicket's serialization logic (other than a model that points outside of
Wicket) is for a single page to own the model, and for the other page to
access the model through a public getter on the first. This requirement is
only obvious to me after spending a day in Wicket's serialization code. I'd
say it's gotcha
wikihttps://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-Gotchasworthy,
but maybe sharing data between pages with session-backed models is
relatively uncommon.

As an aside, it's amazing that this page serialization stuff has been so
transparent to me until now. Nice work, Wicket devs!

Dan

On Fri, Dec 3, 2010 at 12:40 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi Dan,

 I don't have time to investigate deeper your application but here are the
 common recommendations:
  - don't share components between pages
  - share their models. even better - share just pointers which will be used
 by the models to find the data

 Martin

 On Fri, Dec 3, 2010 at 3:28 AM, Dan Retzlaff dretzl...@gmail.com wrote:

  I tracked down the gotcha and assembled the attached quickstart project
  to demonstrate it. Can someone please clarify whether this is a bug or an
  intentional design limitation? It's definitely unintuitive for those
  unfamiliar with Wicket's page serialization tricks.
 
  In my case, the issue manifests itself when the Page within an
 InlineFrame
  (call it InlinePage) has a reference to a component in the outer Page
 (call
  it HomePage). After InlinePage handles a request, it gets serialized into
 a
  page map entry along with the referenced component within HomePage, and
  HomePage's PageHolder. But HomePage gets serialized separately, and
 includes
  *its own copy* of the referenced component. Ultimately this manifests as
 a
  corrupt object graph where a component's parent does not contain the
  component itself [i.e. getParent().get(getId()) is null].
 
  I believe this issue did not occur in one of the two uses I describe
 below
  because SecondLevelCachePageMap keeps a deserialized copy of the most
  recently accessed Page, averting the corruption that occurs in the
  serialization roundtrip. I have not actually verified this however.
 
  Much care and thought has obviously gone into handling multiple pages in
 a
  single request, but given this use case's (subtle) failure, I'm left
  wondering when it is appropriate. It seems like the only safe ways to
 share
  data bidirectionally between pages are (1) through a model that maintains
  the value outside of the session/page map, or (2) through AJAX callbacks
 via
  the client browser. True?
 
  Dan
 
  On Wed, Dec 1, 2010 at 6:22 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:
 
  Hello,
 
  I have a page with an embedded InlineFrame which is used to submit a
  multipart form. I would like the InlineFrame's page to share a model
 object
  with the parent page. This way the parent page can control the workflow
  after the form is submitted. However, something is preventing model
 changes
  made during the form submission from being visible in subsequent
 requests to
  the parent page. My guess is that issue stems from the way in which the
  child page (with its reference to the parent page) is being serialized
 into
  the page store because the subsequent parent requests see the
 *unmodified
  * model object.
 
  Further confusing me is the fact that I use the same upload panel with
 the
  InlineFrame in two different pages, and in one of the two the model
 change
  *is* seen by the parent. I'm no PageMap expert, but I debugged into
  Session enough to see that the page versions are the same between the
 form
  submission request and the subsequent parent page request in both
  cases. There is obviously some gotcha that I've stumbled into on one
 page
  and not the other.
 
  Can anyone decipher what may be going on? Or recommend a best practice
 for
  sharing data with an embedded iframe page?
 
  I am using Wicket 1.4.13.
 
  Thanks,
  Dan
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 



Re: Wicket-Hibernate Related LazyInitializationException

2010-12-03 Thread Eelco Hillenius
Yep, or least something comparable. You need to re-attach those
objects you're using to the session somehow, and often the easiest way
to do that is to just load them again if they were previously
detached. If you worry about the database being hit more than you
want, you are probably prematurely optimizing, and if you still worry,
you should fix this by through Hibernate's (or your own) second level
cache, not by keeping your model objects inflated between requests.

As a general rule, something we often repeat on this list, if you work
with Hibernate managed objects in Wicket models, use detachable models
(LDM is a common one) and make sure that these objects are 'deflated'
between requests, meaning that e.g. you only keep references to their
ids, or e.g. the algorithm to get the objects back again when needed.

Eelco


On Wed, Dec 1, 2010 at 10:13 PM, James Carman
ja...@carmanconsulting.com wrote:
 Just make sure your form's model is a LDM too.

 On Thu, Dec 2, 2010 at 12:23 AM, Nivedan Nadaraj shravann...@gmail.com 
 wrote:
 Hi All

 I am guessing this is more of a Hibernate thing/issue but if some one has
 encountered this and has a explanation that I can probably use from the
 Wicket front would be great.

 https://forum.hibernate.org/viewtopic.php?f=1t=1008473


 I have a LazyIntializationException when i page through some items. I use
 the PageableListView, the List item(s) are entities that are retrieved via
 an association Person.phones which is  a Set type.
 The funny thing is, the LIException is intermittent. I am also using
 OpenSessionInViewFilter. Any thoughts?

 By the way the this is the load() implemenation, I have set the Model
 Object's phoneList with a list of values fetched via the Service-DAO. I
 have used this with other entities without association and it works  but I
 guess is a different scenario(not associations)

 Model = new LoadableDetachableModelObject() {
   �...@override
            protected Object load() {
                return containerForm.getModelObject().getPhoneList();
            }
        };
 }

 If someone has any thoughts would appreiciate hearing from you.


 Cheers


 -
 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: Logout (Session destroy) on the last (stateful) page?

2010-12-03 Thread Igor Vaynberg
it is a good idea to always redirect to a bookmarkable url after
invalidating your session.

-igor

On Thu, Dec 2, 2010 at 2:08 AM, Ernesto Reinaldo Barreiro
reier...@gmail.com wrote:
 e.g. you could:

 1-Place and AbstractDefaultAjaxBehavior on you page (e.g. to some div
 on your page). Use urlFor to generate the URL to this behavior.  On

 respond(AjaxRequestTarget target) {
    Invalidate your session.
 }

 2-Make your page implement IHeaderContributor and on

 public void renderHead(IHeaderResponse response)  {
                response.renderOnDomReadyJavascript(here use jquery AJAX to 
 call
 URL of step 1);
 }

 Ernesto

 On Thu, Dec 2, 2010 at 10:54 AM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
 Hi Matt,

 I see. Then maybe adding some onDomReady javascript to
 ConfirmationPage that simply goes back to the server and invalidates
 the session? Probably this can't use wicket AJAX machinery: because
 that will probably will also trigger a redirect.

 Regards,

 Ernesto

 On Thu, Dec 2, 2010 at 10:46 AM, Matthias Keller
 matthias.kel...@ergon.ch wrote:
 Hi Ernesto

 No that's not possible because the ConfirmationPage is *stateful* and
 contains lots of information from the session/page state, so it must be
 allowed to display the pre-rendered page once but after that request, the
 session must be invalidated.

 Thanks

 Matt

 On 2010-12-02 10:34, Ernesto Reinaldo Barreiro wrote:

 Matt,

 Can't you just do some kind of trick so that your ConfirmationPage is
 served as the home page? So that you invalidate the session but at
 getHomePage() you temporarily return your ConfirmationPage?

 Regards,

 Ernesto

 On Thu, Dec 2, 2010 at 10:06 AM, Matthias Keller
 matthias.kel...@ergon.ch  wrote:

 Hi Randy

 Yes it appears to have something to do with that. Our app uses the
 REDIRECT_BUFFER by default (we never actively configured this though)
 which
 appears to be a sensible option for normal operation. I'm not very
 familiar
 with the render strategies but you appear to be right: The page is
 actually
 rendered at the end of the previous request where the session is
 invalidated
 too. Then a redirect happens to the pre-rendered page which fails because
 the Session is already gone...

 Is there any hook that will be called at the end of the second request
 serving the pre-rendered content?
 I found a workaround for the moment: In the previous page, I explicitly
 set
 setRedirect(false); but this has the consequence that if the user hits
 reload on the confirmation page, he will first be asked about resending
 the
 POST parameters...

 Anything we could do to invalidate the session at the end of the serving
 of
 the prerendered page?

 Thanks a lot

 Matt

 On 2010-12-01 20:44, Randy S. wrote:

 Does the redirect to the home page happen because of Wicket's default
 render
 strategy (REDIRECT_TO_BUFFER) that causes two requests?  You invalidate
 session on the first which redirects to the buffered response. When the
 second request comes in expecting to get the already-rendered response,
 you
 get a new session.


 On Wed, Dec 1, 2010 at 11:53 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com    wrote:

 Hi!

 I am curious too. For this reason we had to build our logoutpage so
 that it invalidtes session logically but not in httpsession sense.

 Only clicking something from login page will do that.

 But it's a hack, I would like to know what's the proper way ;)

 **
 Martin



 2010/12/1 Matthias Kellermatthias.kel...@ergon.ch:

 Hi

 I've got the following problem:
 After a user completes a wizard, he sees a last confirmation page

 containing

 some data, thus it must be a stateful page called by the following
 code

 from

 the wizard:

 setResponsePage(new ConfirmationPage(myBean));

 This ConfirmationPage must only be displayed once, thus if the user
 does

 a

 refresh it must not be available anymore.
 I expected that I would be able to call  session.invalidate() from

 somewhere

 within the ConfirmationPage's onAfterRender or onDetach methods.
 Unfortunately, whenever I do this, the user is automatically
 redirected

 to

 the home page without a trace in the logs
 Any idea how to do that?

 Thanks

 Matt







 -
 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: Remove Child in IVisitor causes problems

2010-12-03 Thread Igor Vaynberg
please create a jira issue to add the warning.

-igor

On Fri, Dec 3, 2010 at 8:10 AM, jbrookover jbrooko...@cast.org wrote:

 Hey all,

 Interesting thing I encountered today.  I have a Panel that provides it's
 own markupstream that is dynamically created from XML/XSLT.  Essentially, it
 scans the markup stream for wicket:ids and then calls a
 getWicketComponent(String wicketId) that generates different components
 based on the id prefix (e.g. wicket:id=addContentBar_3).  Recently, I've
 been wanting to redraw this panel via AJAX, changing the markup and adding
 and removing child components accordingly.

 Haven't had much trouble up to this point until I tried to remove multiple
 stale components (e.g. a component that was generated from the previous
 markup but doesn't exist in the new markup).  I tried to use an IVisitor..

 visitChildren(new IVisitorComponent() {
  public Object component(Component component) {
    if (/* component is stale */)
      component.remove();
    return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
 }

 I discovered that IVisitor just does a simple run through an array and
 removing the component adjusted the size/count of the array, messing up the
 traversal and preventing other components from being removed.

 I've solved this by just keeping a list of stale components and removing
 them after the traversal, but it seems like their should either be
 documentation/warnings about modifying the child list in a Visitor and/or a
 change in the implementation to support this?  An iterator?  It's probably
 rare enough that documentation would suffice :)

 I'm just happy that Wicket has allowed me to do the niftiness I described
 above :)

 Jake
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Remove-Child-in-IVisitor-causes-problems-tp3071290p3071290.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: Logout (Session destroy) on the last (stateful) page?

2010-12-03 Thread Ernesto Reinaldo Barreiro
Isn't this what will happen next time he tried to visit any page on
the server?

Ernesto

On Sat, Dec 4, 2010 at 5:13 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 it is a good idea to always redirect to a bookmarkable url after
 invalidating your session.

 -igor

 On Thu, Dec 2, 2010 at 2:08 AM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
 e.g. you could:

 1-Place and AbstractDefaultAjaxBehavior on you page (e.g. to some div
 on your page). Use urlFor to generate the URL to this behavior.  On

 respond(AjaxRequestTarget target) {
    Invalidate your session.
 }

 2-Make your page implement IHeaderContributor and on

 public void renderHead(IHeaderResponse response)  {
                response.renderOnDomReadyJavascript(here use jquery AJAX to 
 call
 URL of step 1);
 }

 Ernesto

 On Thu, Dec 2, 2010 at 10:54 AM, Ernesto Reinaldo Barreiro
 reier...@gmail.com wrote:
 Hi Matt,

 I see. Then maybe adding some onDomReady javascript to
 ConfirmationPage that simply goes back to the server and invalidates
 the session? Probably this can't use wicket AJAX machinery: because
 that will probably will also trigger a redirect.

 Regards,

 Ernesto

 On Thu, Dec 2, 2010 at 10:46 AM, Matthias Keller
 matthias.kel...@ergon.ch wrote:
 Hi Ernesto

 No that's not possible because the ConfirmationPage is *stateful* and
 contains lots of information from the session/page state, so it must be
 allowed to display the pre-rendered page once but after that request, the
 session must be invalidated.

 Thanks

 Matt

 On 2010-12-02 10:34, Ernesto Reinaldo Barreiro wrote:

 Matt,

 Can't you just do some kind of trick so that your ConfirmationPage is
 served as the home page? So that you invalidate the session but at
 getHomePage() you temporarily return your ConfirmationPage?

 Regards,

 Ernesto

 On Thu, Dec 2, 2010 at 10:06 AM, Matthias Keller
 matthias.kel...@ergon.ch  wrote:

 Hi Randy

 Yes it appears to have something to do with that. Our app uses the
 REDIRECT_BUFFER by default (we never actively configured this though)
 which
 appears to be a sensible option for normal operation. I'm not very
 familiar
 with the render strategies but you appear to be right: The page is
 actually
 rendered at the end of the previous request where the session is
 invalidated
 too. Then a redirect happens to the pre-rendered page which fails because
 the Session is already gone...

 Is there any hook that will be called at the end of the second request
 serving the pre-rendered content?
 I found a workaround for the moment: In the previous page, I explicitly
 set
 setRedirect(false); but this has the consequence that if the user hits
 reload on the confirmation page, he will first be asked about resending
 the
 POST parameters...

 Anything we could do to invalidate the session at the end of the serving
 of
 the prerendered page?

 Thanks a lot

 Matt

 On 2010-12-01 20:44, Randy S. wrote:

 Does the redirect to the home page happen because of Wicket's default
 render
 strategy (REDIRECT_TO_BUFFER) that causes two requests?  You invalidate
 session on the first which redirects to the buffered response. When the
 second request comes in expecting to get the already-rendered response,
 you
 get a new session.


 On Wed, Dec 1, 2010 at 11:53 AM, Martin Makundi
 martin.maku...@koodaripalvelut.com    wrote:

 Hi!

 I am curious too. For this reason we had to build our logoutpage so
 that it invalidtes session logically but not in httpsession sense.

 Only clicking something from login page will do that.

 But it's a hack, I would like to know what's the proper way ;)

 **
 Martin



 2010/12/1 Matthias Kellermatthias.kel...@ergon.ch:

 Hi

 I've got the following problem:
 After a user completes a wizard, he sees a last confirmation page

 containing

 some data, thus it must be a stateful page called by the following
 code

 from

 the wizard:

 setResponsePage(new ConfirmationPage(myBean));

 This ConfirmationPage must only be displayed once, thus if the user
 does

 a

 refresh it must not be available anymore.
 I expected that I would be able to call  session.invalidate() from

 somewhere

 within the ConfirmationPage's onAfterRender or onDetach methods.
 Unfortunately, whenever I do this, the user is automatically
 redirected

 to

 the home page without a trace in the logs
 Any idea how to do that?

 Thanks

 Matt







 -
 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