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

2010-10-14 Thread Thomas Kappler

On 10/13/10 16:25, fachhoch wrote:


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


This is not *the* heap (for objects) as others have said, it's the 
permanent generation heap, which is a different memory section used by 
the JVM, for instance for interning Strings and for loaded classes. 
Google for more info.


If you get Could not reserve enough space for object heap when 
starting up, you don't have enough memory on the machine.



--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: The Long, Long Dependency Trail

2010-09-23 Thread Thomas Kappler

On 09/23/10 14:28, Ichiro Furusato wrote:

Hello,

I've been working with Wicket for about a week now and things were
moving along all cruisy until I started adding Hibernate and
Databinder dependencies into my POM. Then all hell broke loose and I
seem to now find myself in the NoClassDefFoundError, then find and
manually install jar cycle. I mean, things with Wicket were just so,
well, SENSIBLE, and now I'm back in nightmare-programming-land again.


This will probably only apply to smaller projects, but I'd like to offer 
my experience as an example. I recently made a Wicket app with JPA, 
Hibernate, and Jetty not using any dependency manager at all. I 
downloaded the Jars from each project's website, put them into lib/, and 
made a very small Ant build.xml containing


path id=compile.classpath
pathelement path=${build.home}/
fileset dir=./lib
include name=*.jar/
/fileset
pathelement path=${classpath}/
/path

It worked without problems. Sometimes simple is better. Of course, if 
you need a ton of other libraries, it may get too complicated.


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: announcing Granite - a Wicket-Scala-DB4O web application stack

2010-09-22 Thread Thomas Kappler

On 09/22/10 03:41, Sam Stainsby wrote:

Today we officially announced our project to provide a Wicket-DB4O-Scala
web application stack:

http://sustainablesoftware.com.au/blog/?p=77

I’m pleased to announce a new web application framework, called Granite,
and an associated set of reusable libraries, called Uniscala. Please note
that this is a work in progress: we are not announcing a release yet, or
even a beta. A number people have started asking about the project, and
so I felt it would be helpful to let the wider world know what is going
on.

Granite is a lightweight framework for the rapid development of web
applications. It is based on the very cool and richly featured Apache
Wicket web framework. Granite uses an embedded object database that
avoids the need for SQL or Object-Relational Mappers (ORMs), and, in the
Wicket tradition, is proud of, if not smug about, its distinct lack of
external XML configuration files.


Hey,

I find that quite exciting.

Now that you've done the hard work of fitting a non-relational store 
into a Wicket-based framework, do you think it would be hard to 
substitute other data stores such as Redis, CouchDB, BDB for DB4O?


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: A beginner's tutorial

2010-08-05 Thread Thomas Kappler

On 08/05/10 17:36, H. Turgut Uyar wrote:


Since it's a database course I'm also planning to show examples of using
other backends like Berkeley DB, db4o, and Netmind Persistence.


It would be very interesting if you make some of the documentation and 
code for this public. There are not many examples of backing Wicket with 
a non-relational data store, and even if it's principally 
straightforward, examples are always nice.


Otherwise, thanks for publishing this tutorial, I like it and I think 
it's useful.


Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: OutOfMemoryError PermGen Space...

2010-07-23 Thread Thomas Kappler

On 07/22/10 20:30, James Carman wrote:

Guys, our production server is running into an error from time to
time.  I get the below stack trace after the site has been running for
a while.  It's not running in development mode.  It's running in
deployment mode.  Any thoughts?


Are you by chance using String.intern()? That is a candidate for filling 
up the PermGen space.


As Andreas noted, the stack trace can be completely irrelevant to the 
reason for running out of memory.


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Docu/Examples of Models and Generics in Wicket 1.4?

2010-06-25 Thread Thomas Kappler

On 06/25/10 09:17, Alessandro Bottoni wrote:

Hi All,
I'm new to Wicket and I'm studying it using Wicket in Action. As you
surely know, this book is based on Wicket 1.3, that does NOT use
generics, while the current version is 1.4 and DOES use them (as will do
the next ones).

Put aside this page:

https://cwiki.apache.org/WICKET/migrating-to-wicket-14.html#MigratingtoWicket1.4-Modelchanges

I was unable to find any other documentation and/or example  regarding
the use of Java Generics with Wicket 1.4. (Actually, there is also this
historically-interesting report of the discussion about generics:
https://cwiki.apache.org/WICKET/generics.html).


Why do you see the need for documentation specific to generics in 
Wicket? Once you understand Java generics, their usage in Wicket is 
straightforward. Consult the Javadocs, and even that is often 
unnecessary---for an IModelT, T must be the type of the model object, 
for instance.


Please ask some more specific questions if you have any.

Cheers,
Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Wicket vendor lockin and backwards compatibility, 1.4/1.5

2010-05-21 Thread Thomas Kappler

On 05/21/10 14:57, napple fabble wrote:


We're starting a new project and thinking about using Wicket for presentation
layer.

One concern is about backwards compatibility and support. I understand 1.5
is coming and in not fully backwards compatible.

The concerns:

If we start with wicket 1.4.8, a few years from now all development is done
to 1.5.x and no one cares about boring old 1.4 anymore.


No different from any other web framework, or any software for that 
matter. Do you have a specific concern with Wicket in that regard?


-- Thomas
--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Combo Box (help!)

2010-05-06 Thread Thomas Kappler
On 05/06/2010 09:44 PM, Brian Mulholland wrote:
 This is a second asking, so sorry if I am being impatient, but I was
 hoping to see a response to this.
 
 I've got a combo box with the list in a List of string arrays (code
 and decode).  The bean has the currently selected code.  I created a
 DropDownChoice with a custom ChoceRenderer as below.  The CR interface
 is invoked for both the acquisition of the bean value and for each row
 of the list, which is why the below code checks the type of object
 coming in.
 
 This works great when displaying, but when the value comes back to the
 server, it is loaded back into the bean as
 [Ljava.lang.String;@3c6f3c6f.  It looks like the Object.toString().
 What am I doing wrong here?
 

The ChoiceRenderer is only used for the display of the options on the
page, not for saving. The IModel's setObject() is called then, which in
that case is the PropertyModel calling setId() on the bean, with the
current Object as argument. So you need to implement an IModel that's a
little more intelligent and basically does what the renderer does: pick
the first element if it's an array, the whole String otherwise.

From a design point of view it looks like this logic should maybe be in
the bean, or at least in a helper class so you can use it from both the
Model and the ChoiceRenderer.

-- Thomas


 DropDownChoice ddc = new DropDownChoice(id, new PropertyModel(bean,
 id), listOfStringArrays, new IChoiceRenderer(){
@Override
public Object getDisplayValue(Object array) {
if(array instanceof String)
return (String) array;
else if(array.getClass().isArray()){
String[] result = (String[]) array;
return result[1];
}
else
throw new RuntimeException(Huh?);
}
 
@Override
public String getIdValue(Object array, int arg1) {
if(array instanceof String)
return (String) array;
else if(array.getClass().isArray())
{
String[] result = (String[]) array;
return result[0];
}
else
throw new RuntimeException(Huh?);
}
 });
 
 


-- 
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Type Inference for Wicket 1.4

2010-04-15 Thread Thomas Kappler

On 04/15/10 13:06, James Perry wrote:

I can sympathise with that. However I don't think it would be a
maintenance nightmare if the constructors are set to private; but that
would mean a dramatic API change for such convenience and I'm guessing
you're not willing to do this.


Apart from the huge change for questionable benefit, that would also 
remove inheritance, which is essential to the Wicket way, because you 
can't extend a class with private constructors only. If you can, get a 
hold of Bloch, Effective Java, and read the insightful chapter on the 
constructor vs. static factory method trade-off.


-- Thomas




Best,
James.

On 14 April 2010 17:01, Igor Vaynbergigor.vaynb...@gmail.com  wrote:

you are going to have one factory method for each constructor, its
going to be a pita to maintain. not something we will want in core.

-igor

On Wed, Apr 14, 2010 at 8:51 AM, James Perry
james.austin.pe...@gmail.com  wrote:

I am looking to migrate from Wicket 1.3 and Wicket 1.4 and I really
like the type-safe goodies but I do not like its verbosity. I was
thinking of writing a patch that provides factories to improve the
brevity by type inference of the generic invariant.

This is an example of my idea:

ModelMySuperLongNameForASimpleFooObject  model = Model.newModel();

public staticT  ModelT  newModel() {
return new ModelT();
}

Feedback welcomed. :-)

--
Best,
James.

-
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




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Looking for a less chatty auto-complete component?

2010-03-15 Thread Thomas Kappler

On 03/15/10 02:42, Ben Hutchison wrote:

Hi all,

We're developing a wicket web-application that makes heavy use of
auto-complete text fields populated from slow back-end (mainframe) web
services.

Concerned that standard auto-complete behavior will be too chatty and
result in many calls to slow services, we're keen on an alternative less
chatty model:

- No autocomplete behavior is triggered until at least N (eg 3)
characters have been entered.
- When N characters are entered, a query is performed, once.
- These results are cached client-side, and subsequent character entry
simply narrows the search in the pre-retrieved results.
- If any of the first N characters in the string are altered, the cache
results are discarded and a new query is performed.


All this should be doable with reasonable effort by overriding 
AutoCompleteTextField's getChoices(). I've never stored things 
client-side, but I'm sure you can find how to do that in the archives or 
the wiki. Apart from that, you would do something like that:



String prevInput;
ListString suggestions;

@Override
protected IteratorString getChoices(String input)
{
if (!suggestions.isEmpty()  firstNEqual(input, prevInput)
// narrow down existing suggestions
else if (input.length() = MIN_INPUT_LENGTH)
// backend service query, filling suggestions
else
return Collections.StringemptyList().iterator();
}

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Interaction behavior / site

2010-03-12 Thread Thomas Kappler

On 03/11/10 22:36, Thorsten wrote:

On Thu, 11 Mar 2010, Michael O'Cleirigh wrote:

Hi Michael,


The content of the tooltip should be a panel.  The panel's model can
contain the ListInteger  of the increases you want offered and then
it can use a repeater or ListView to render each option.  If the
links were AjaxLink subclasses you could set their model to be the
particular Integer they represented and then within the
onClick(final AjaxRequestTarget target) method handle the necessary
changes to your totals.


I'm still confused. My main page looks like this:
html
 span wicket:id=tooltip  Click on me, and a tooltip will show up
 /span
/html

class MainPage extends WebPage {
 final Label tooltipHolder = new Label(tooltip, asdf);
 add(tooltipHolder);
 tooltipHolder.setOutputMarkupId(true);
 tooltipHolder.add( new QTipBehaviour( new TooltipPanel(??? ));
}

So I don't have hany markup-id for the panel. I could define it in the
html as a hidden div, but is there a way of without an additional div?


I don't know QTipbehaviour, but it should take care of that. That's how 
it works with ModalWindow, for instance.


If you just define a simple TooltipPanel and try it out, what happens?

-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: ListView + dynamic database Model

2010-03-02 Thread Thomas Kappler

On 03/02/10 11:55, marioosh.net wrote:

Sorry for my poor english ;)

I have ListView and model like below. I need tabs to reload sometimes,
so my model is dynamic and get tabs from database.
But i see that something is wrong. When i want to get Tab object by
getModelObject() in populateItem method i suppoused that i got it
directly, but i see that all the times the getObject() method of model
is triggered making for all items new list (new db request) !


That's exactly what is supposed to happen, as getModelObject() is just a 
shorthand for getModel().getObject(). And in your getObject(), you do 
the database request.


If you need to avoid those database reloads, look into 
LoadableDetachableModels.


-- Thomas




How to get Tab objects for items without making wasting time database
request ???


IModel model = new IModel() {
public Object getObject() {
System.out.println(getObject...);
...
// getting list from DB
ListTab  list = ;
return list;
}

public void setObject(Object object) {}
public void detach() {
}};

ListView tabs = new ListView(tabs, model) {
@Override
protected void populateItem(ListItem item) {
item.getModelObject(); /*- new 
list, and new list,
and new list.. :(
}
};




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Question about WicketTester and using my class which extends WebApplication

2010-02-25 Thread Thomas Kappler

On 02/25/10 17:47, Eric Reagan wrote:

Hello,
  I am pretty well new to wicket and I am running into a problem I was
wondering if anyone knew how to solve. I have a class which extends the
WebApplication class. I have a static get method which is outlined below
   public static MyApp get(){
  return (MyApp) Application.get();
   }
  I then have the standard getHomePage() which returns null. In my Wicket
tester application I am trying to test what the getHomePage() for my app
returns. So when I try and construct a tester like WicketTester tester = new
WicketTester(MyApp.get()) I get the following error:
   org.apache.wicket.WicketRuntimeException there is no application
attached to the current thread.


You need to instantiate the application for WicketTester:
WicketTester tester = new WicketTester(new MyApp())

cheers,
Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: component .... not found on page

2010-02-03 Thread Thomas Kappler

On 02/02/10 23:35, Eugene Malan wrote:

Of course the quickstart worked just fine, so I had to add the layers of
junk back on to find out where it was going wrong.

Eventually the last thing I added back on was the cause a broken
link in the head section.
link rel=shortcut icon href= type=images/x-icon /


Exactly the problem I had described a week or so ago :-) Empty image 
sources cause page reloads.


--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: webapp authentication

2010-02-03 Thread Thomas Kappler

On 02/03/10 17:20, Martin Asenov wrote:


I need only to authenticate users when they attempt to login.

Not just call something like this:

User user = MyUtilities.getUserByCredentials(name, password);

if (user == null) return false;
else ...do further processing

I want something more secure than this.


What security problems do you see here? Either the database can 
authenticate this user/password combination, or it can't.


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: java heap space IAuthorizationStrategy

2010-01-29 Thread Thomas Kappler

On 01/29/10 08:38, Martin Asenov wrote:

Hello guys! Very strange exception occurred yesterday when trying to set 
IAuthorizationStrategy to my webapp. Here's the exception:

SEVERE: An exception or error occurred in the container during the request 
processing
java.lang.OutOfMemoryError: Java heap space at 
java.util.Arrays.copyOfRange(Arrays.java:3209)


Looks like an endless loop. Get a compelte stacktrace to confirm that.

Maybe your AccessDeniedPage is a subclass of AdministrationPage or 
DomainRequiredPage? Then a non-authenticated user would try to access a 
page, would be redirected to the AccessDeniedPage which would not be 
allowed, redirect, repeat.




these are the first 2 lines of the exception. Here's my MyAythStrategy class:

public class MyAuthStrategy implements IAuthorizationStrategy {

private UserContext context = ((AppSession)Session.get()).getContext();

public MyAuthStrategy() {}

public boolean isActionAuthorized(Component arg0, Action arg1)
{
return true;
}

publicT extends Component  boolean isInstantiationAuthorized(ClassT 
 componentClass)
{

if (BaseFrame.class.isAssignableFrom(componentClass)) {

if 
(AdministrationPage.class.isAssignableFrom(componentClass)) {
if (context.getRole().equals(Role.ROOT) || 
context.getRole().equals(Role.ADMIN))
return true;
else
throw new 
RestartResponseAtInterceptPageException(AccessDeniedPage.class);
} else if 
(DomainRequiredPage.class.isAssignableFrom(componentClass)) {
if (context.getDomain() == null)
throw new 
RestartResponseAtInterceptPageException(AccessDeniedPage.class);
else
return true;
}   
}
return true;

}

}

AdministrationPage and DomainRequiredPage are my tagging interfaces.

When I set that strategy to my webapp I get the above mentioned exception.

Hope someone helps!

Thanks,
Martin

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




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Nasty problem with component not found and images [solved]

2010-01-29 Thread Thomas Kappler

On 01/28/10 09:35, Marat Radchenko wrote:

You could file enhancement request to make
EmptySrcAttributeCheckFilter also report images whose src starts with
#.


Cool, I didn't even know about this filter. Its javadoc nicely explains 
the issue.


I filed WICKET-2709 to make it check for src=#, too.

-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Trying to pass object to server side

2010-01-29 Thread Thomas Kappler

On 01/29/10 17:46, Raj Kaushik wrote:

Hi I am trying to manually pass certifcate to the server before
authentication. But so far I am not successful.


The standard way to store things that must survive a request/response 
cycle is in the Session. See the java doc for Session and Application:


Session Properties - Arbitrary objects can be attached to a Session by 
installing a session factory on your Application class which creates 
custom Session subclasses that have typesafe properties specific to the 
application (see Application for details). [...]


-- Thomas




// -- In the test client  --

//WebApplication  object is given wicketTester = new
WicketTester(webApp);
wicketTester.getApplication().getResourceSettings().setResourceStreamLocator(new
CustomResourceStreamLocator()); //An attribute is set to the request
MockHttpServletRequest request = wicketTester.getServletRequest();
request.setAttribute(javax.servlet.request.X509Certificate,
readCertificate());

wicketTester.startPage(SignIn.class);

// -- In the Server side // During DEBUG I trace the call to the
following 2 times // One: when new Wicket Tester is created // Two:
after startPage

WebRequest webRequest = (WebRequest)request; HttpServletRequest
servletRequest = webRequest.getHttpServletRequest(); X509Certificate
certs[] =
(X509Certificate[])servletRequest.getAttribute(javax.servlet.request.X509Certificate);

 if(certs != null){ setClientCertificate(certs[0]); }

The problem is that the certificates are always null. How is it
possible to pass on the object to the server side at the right time
of the life cycle.

Any help or suggestions are highly appreciated.


Raj Kaushik rajv...@yahoo.com

-



To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org

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




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: Nasty problem with component not found and images [solved]

2010-01-28 Thread Thomas Kappler

On 01/27/10 21:51, Steve Swinsburg wrote:

Thomas,

Thanks for this. I may also have run into the multiple page load you
say this might cause. Can you confirm if this is the case for anyimg
src=# /  and goes away when its justimg /  ?


I can confirm it happens for any img src=# /, with Firefox 3.5.

An img / without source is not valid HTML, so I'd try to avoid it. I 
didn't try what happens in that case. I worked around the problem by 
extracting the img into a separate Panel. I add() this panel whenever 
I have an image to display, and a dummy WebMarkupContainer when I don't.


-- Thomas



On 28/01/2010, at 2:54 AM, Riyad Kalla wrote:


Thomas, as someone who frequently likes trying really dumb things
-- I appreciate you giving a heads up on this issue. I was likely
going to run into this at some point anyway ;)

On Wed, Jan 27, 2010 at 3:46 AM, Thomas Kappler
thomas.kapp...@isb-sib.chwrote:


Earlier this month, there was a thread [1] about the component
not found problem. I can't reply as I wasn't subscribed yet.

[1]
http://old.nabble.com/component-xxx:yyy:zzz-not-found-on-page-td27080437.html




I had the same problem recently, and after banging my head against the wall

for a while, I figured it out.

I had a RepeatingView on the page that consisted of markup
containers that had some text, and some had an external image
(hosted outside the wicket app), while others did not. I tought
I'd keep it simple and wroteimg src=# /  in the markup. In
the Java code, I'd check each item whether it had a URL to an
image, and if so, would insert that into the src attribute with
an AttributeModifier. For the other items it just stayed at the
# value.

Now # means the current page, so for each page load, the
browser would actually load the page several times, once for each
emptyimg. When using ajax, this completely breaks things, of
course (besides making the page really slow).

Note that an empty value of src= can also cause this at least
with older versions of Firefox.

Making it so that theimg  markup is only inserted for actual
images solved it.

Maybe that was really dumb, but I thought I'd share it for the
mailing list archive.

-- Thomas

--
---



Thomas Kapplerthomas.kapp...@isb-sib.ch

Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
CMU, rue Michel Servet 1 1211 Geneve 4 Switzerland
http://www.uniprot.org
---




-

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







--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: know the last page user comes from

2010-01-28 Thread Thomas Kappler

On 01/28/10 09:36, Martin Asenov wrote:

Hello, everyone, I was just wondering how could I know what's the page the user 
comes from, when he comes into a new page. In need that in order to redirect to 
previous page in my access denied page.


Do you know about Component.continueToOriginalDestination() ?

-- Thomas
--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: know the last page user comes from

2010-01-28 Thread Thomas Kappler

On 01/28/10 10:01, Martin Asenov wrote:

Yes I know about it, but never used it, is it suitable in the case I mentioned 
above? Would you give me some hints on how to implement it?


Sure, here's some code from a small internal app I wrote recently. I got 
most of it from either the wiki or the list archive, but I can't find it 
right now.



If a page needs authentication and the user is not signed in, I throw a 
RestartResponseAtInterceptPageException. This IAuthorizationStrategy is 
set in WebApplication.init(), via 
getSecuritySettings().setAuthorizationStrategy(...). Code:



public class SimpleAuthorizationStrategy implements IAuthorizationStrategy
{

public boolean isActionAuthorized(Component arg0, Action arg1)
{
return true;
}

@SuppressWarnings(unchecked)
public boolean isInstantiationAuthorized(Class componentClass)
{
// Does this page need authentication?
if 
(AuthenticatedBasePage.class.isAssignableFrom(componentClass))
{
if (NewtSession.get().isSignedIn())
return true;
else
throw new 
RestartResponseAtInterceptPageException(SignInPage.class);
}
return true;
}
}

Then in my sign-in page, I can just say

if (NewtSession.get().authenticate(username.value(), password.value()))
{
if (!continueToOriginalDestination())
setResponsePage(getApplication().getHomePage());
...

The continueToOriginalDestination() gets the user to where the 
RestartResponseAtInterceptPageException was thrown.


HTH,
Thomas




-Original Message-
From: Thomas Kappler [mailto:thomas.kapp...@isb-sib.ch]
Sent: Thursday, January 28, 2010 10:47 AM
To: users@wicket.apache.org
Subject: Re: know the last page user comes from

On 01/28/10 09:36, Martin Asenov wrote:

Hello, everyone, I was just wondering how could I know what's the page the user 
comes from, when he comes into a new page. In need that in order to redirect to 
previous page in my access denied page.


Do you know about Component.continueToOriginalDestination() ?

-- Thomas



--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Nasty problem with component not found and images [solved]

2010-01-27 Thread Thomas Kappler
Earlier this month, there was a thread [1] about the component not 
found problem. I can't reply as I wasn't subscribed yet.


[1] 
http://old.nabble.com/component-xxx:yyy:zzz-not-found-on-page-td27080437.html


I had the same problem recently, and after banging my head against the 
wall for a while, I figured it out.


I had a RepeatingView on the page that consisted of markup containers 
that had some text, and some had an external image (hosted outside the 
wicket app), while others did not. I tought I'd keep it simple and wrote 
img src=# / in the markup. In the Java code, I'd check each item 
whether it had a URL to an image, and if so, would insert that into the 
src attribute with an AttributeModifier. For the other items it just 
stayed at the # value.


Now # means the current page, so for each page load, the browser 
would actually load the page several times, once for each empty img. 
When using ajax, this completely breaks things, of course (besides 
making the page really slow).


Note that an empty value of src= can also cause this at least with 
older versions of Firefox.


Making it so that the img markup is only inserted for actual images 
solved it.


Maybe that was really dumb, but I thought I'd share it for the mailing 
list archive.


-- Thomas

--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: images not under the context root directory

2010-01-27 Thread Thomas Kappler

On 01/27/10 15:57, Jonas wrote:

Have you tried the following:

WebComponent image = new WebComponent(someWicketId);
image.add(new SimpleAttributeModifier(src, http://.jpg;));
add(image);

with markup

img wicket:id=someWicketId /


that should work just fine...

if you cannot hardcode the image url, you can use the following
instead of SimpleAttributeModifier
image.add(new AttributeModifier(src, true new
AbstractReadOnlyModelString() {
 public String getObject() {
 String url = ... (fetch the image url from anywhere else)
 // e.g. '/xxx//image893748.png'
 return url;
 }
));


Or, maybe a bit nicer, encapsulate it into a component and let the URI 
come from a Model, as usual in Wicket:


class ExternalImageUri
extends WebComponent
{
public ExternalImageUri(String id, IModelString uri)
{
super(id, uri);
add(new AttributeModifier(src, true, uri));
}

@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
checkComponentTag(tag, img);
}
}


This in the Wiki at 
http://cwiki.apache.org/WICKET/how-to-load-an-external-image.html.



-- Thomas



2010/1/27 François Meilletfm...@meillet.com:

Hi Wicketers,

I have a directory, /xxx/images with uploaded images, which is not under the 
application context root directory.
How can I serve them as static images ?

I tried the StaticImage class I found in the forum 
(http://old.nabble.com/Plain-IMG-src-urls-td21547371.html#a21547543 )
but it doesn't work for me. It just work if the image files are under the 
context root directory.

Thanks for your help.

François




-
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




--
---
  Thomas Kapplerthomas.kapp...@isb-sib.ch
  Swiss Institute of Bioinformatics Tel: +41 22 379 51 89
  CMU, rue Michel Servet 1
  1211 Geneve 4
  Switzerland  http://www.uniprot.org
---

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



Re: PropertyModel implementing IComponentInheritedModel

2008-07-07 Thread Thomas Kappler
On Mon, Jul 7, 2008 at 10:17 AM, Johan Compagner [EMAIL PROTECTED] wrote:
 CompoundPropertyModel cpm = new CompoundPropertyModel();
 Form form = new Form(form, cpm)
 form.add(new TextField(name, cpm.bind(firstName));

Perfect! Had overlooked that.

Thanks,
Thomas


 On Mon, Jul 7, 2008 at 8:59 AM, Maurice Marrink [EMAIL PROTECTED] wrote:

 Have you seen BoundCompoundPropertyModel?

 It sounds like you are looking for that behavior.

 Maurice

 On Sun, Jul 6, 2008 at 9:42 AM, Thomas Kappler [EMAIL PROTECTED]
 wrote:
  Thanks, Johan. Perhaps I wasn't clear enough about the motivation.
 
  On Sun, Jul 6, 2008 at 6:51 AM, Johan Compagner [EMAIL PROTECTED]
 wrote:
  Why should the propertymodel be an inherited?
 
  Well, to have model sharing. So why not just use a CPM? Because it has
  another difference to PM: you don't give the property expression
  explicitly, but the component name is used. When you don't want that
  (keep your HTML independent of your Java), or can't do that (reusable
  panels), you can't use CPM.
 
  So, what I'd like is a CompoundPropertyModel(Object, String) that
  works like in PM: Construct with a wrapped (IModel) or unwrapped
  (non-IModel) object and a property expression that works on the given
  model..
 
  I feel like I'm missing something basic here, sorry - perhaps you can
  enlighten me why this wouldn't make sense.
 
  Cheers,
  Thomas
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PropertyModel implementing IComponentInheritedModel

2008-07-06 Thread Thomas Kappler
Thanks, Johan. Perhaps I wasn't clear enough about the motivation.

On Sun, Jul 6, 2008 at 6:51 AM, Johan Compagner [EMAIL PROTECTED] wrote:
 Why should the propertymodel be an inherited?

Well, to have model sharing. So why not just use a CPM? Because it has
another difference to PM: you don't give the property expression
explicitly, but the component name is used. When you don't want that
(keep your HTML independent of your Java), or can't do that (reusable
panels), you can't use CPM.

So, what I'd like is a CompoundPropertyModel(Object, String) that
works like in PM: Construct with a wrapped (IModel) or unwrapped
(non-IModel) object and a property expression that works on the given
model..

I feel like I'm missing something basic here, sorry - perhaps you can
enlighten me why this wouldn't make sense.

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



PropertyModel implementing IComponentInheritedModel

2008-07-05 Thread Thomas Kappler
Hi,

if I haven't overlooked something, there's no variant of PropertyModel
implementing IComponentInheritedModel.

IComponentInheritedModel demands only one method, wrapOnInheritance.
Looking at the implementation of CompoundPropertyModel,
wrapOnInheritance does nothing but return an
AttachedCompoundPropertyModel, which in turn seems not specific to
CompoundPropertyModel.

Shouldn't the same approach work in PropertyModel? Is there a downside
to making a model an IComponentInheritedModel?

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Clicking a tree leaf and confirmation

2008-04-24 Thread Thomas Kappler
Hi Federico,

you gain a lot of flexibility when overriding newNodeComponent()
instead.  There, you return a custom Panel where you can do what you
want, i.e., add the link with all desired functionality.  And you can
of course give your Panel any constructor you like.

An example from our project:

protected Component newNodeComponent(String id, IModel model) {
return new SenseLinkPanel(id, SensesTabPanel.this,
(DefaultMutableTreeNode) 
model.getObject())
.setOutputMarkupId(true);
}

SenseLinkPanel is basically an AjaxLink with the right onClick()
functionality.  You see that via the constructor it gets the TreeNode
it represents, and the Panel the tree is in to update it via AJAX.

Cheers,
Thomas


On Thu, Apr 24, 2008 at 12:38 PM, Federico Fanton [EMAIL PROTECTED] wrote:
 Hi all!
  First of all, I'd like to celebrate the achieved complete elimination of JSF 
 from our project here, thanks to Wicket :)

  Next, I'm facing a little problem..
  I have a LinkTree and I'd like to make it ask for confirmation (via a JS 
 alert) whenever the user clicks on a leaf.. If the user confirms, a component 
 of the page should be AJAX-refreshed, otherwise nothing happens.
  The AJAX part works right now, I need to add the confirmation bit.. I 
 thought I'd override BaseTree.newLink and decorate the AJAX call, but from 
 that method I can't tell if the link will be related to a leaf or a folder.. 
 Am I going the wrong way? Maybe newLink(id, callback) could be expanded to 
 something like newLink(id, callback, model)?

  Many thanks for your attention!


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Pageless component at AjaxRequestTarget detach

2008-04-24 Thread Thomas Kappler
Hi,

we have a BaseTree where we implemented reordering of tree nodes via
drag and drop, using wicketstuff-scriptaculous.  Everything seems to
work, i.e., you can work with the page as intended.  In the logs we
see an error on each drop event, however:

org.apache.wicket.RequestCycle detach
SEVERE: there was an error cleaning up target
[EMAIL PROTECTED] markupIdToComponent
[{containerb9=[MarkupContainer [Component id = container, page = No
Page, path = 21:nodeComponent:container.SenseLinkPanel$1]], SNIP
}], prependJavascript [[Droppables.remove($(containerb9));]],
appendJavascript [[new Effect.Highlight('containerb9',
{}
);
]].
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = container, page = No Page, path =
21:nodeComponent:container.SenseLinkPanel$1]]
at org.apache.wicket.Component.getPage(Component.java:1658)
at 
org.apache.wicket.ajax.AjaxRequestTarget.detach(AjaxRequestTarget.java:437)
[...]

I verified in the debugger that this happens not during our code, but
in the ajax update after everything is done.  The component
container is the (only) top-level component of the panel
representing a tree node.  So, somehow during the node reordering, the
node panel seems to lose its page.

On the UI side, the nodes are DefaultMutableTreeNodes, and the
reordering is basically one line:
dropNode.add(dragNode);

I suspect it might be a bug in there, but I'm not sure where to start.
 Also, as I said, it seems to do no harm.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tree redrawing

2008-04-15 Thread Thomas Kappler
They don't redraw themselves on mouseover.  Must be an IE issue.

Thomas


On Tue, Apr 15, 2008 at 1:30 PM, rzsolt [EMAIL PROTECTED] wrote:

  It seems that wicket Tree items always redraw themself when I drag the mouse
  over them. Why? I have a page with two panels on it: a menu tree on the left
  and a form panel on the right. Actually the right side form is submitted by
  an ajax request and with the help of the LasyLoadingPanel because the
  response time may be long. During this when I move the mouse around the menu
  tree, the tree items disappear because they are not able to refresh
  themself. It seems this only happens using IE6, firefox is not effected.
  --
  View this message in context: 
 http://www.nabble.com/Tree-redrawing-tp16699639p16699639.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Hibernate with wicket

2008-04-10 Thread Thomas Kappler
Hi,

you should ask databinder-related questions in its forum at
http://databinder.net/forum/viewforum.php?f=1st=0sk=tsd=dstart=0.

As to your questions, are you not using maven?  If not, you could
still have a look at the Maven pom.xml file of the baseball project to
figure out the dependencies, but you have to follow the transitive
dependencies.

Thomas


On Thu, Apr 10, 2008 at 3:37 PM, tbt [EMAIL PROTECTED] wrote:

  Hi

  Can anyone tell me the list of jar files that are needed to run databinder.
  I am having trouble running the baseball example.

  Thanks
  tbt


  adrienleroy wrote:
  
   you can take a look at the databinder project : http://databinder.net/
  
  
   tbt wrote:
  
   Hi
  
   I'm using a static block to save resources so that hibernate does not
   have to initialize a session each time a transaction needs to be done.
  
   
  
   static SessionFactory sessionFactory;
  
static
{
try
{
Configuration hibernateConfig  = new Configuration();
URL cfg = 
 HibernateSession.class.getResource(hibernate.cfg.xml);
sessionFactory = 
 hibernateConfig.configure(cfg).buildSessionFactory();
}
catch (Exception e)
{
e.printStackTrace();
}
}
  
  
   public Session getHibernateSession()
{
return sessionFactory.openSession();
}
  
   
 ...
  
   Is this method a correct way to integrate hibernate with wicket and also
   saving resources at the same time. (If I create an instance of a
   SessionFactory, the application runs very slowly)
  
   Thanks
   tbt
  
  
  

  --
  View this message in context: 
 http://www.nabble.com/Hibernate-with-wicket-tp16607352p16608597.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to Create a link in a treeview

2008-04-09 Thread Thomas Kappler
Hi,

you should base your tree on BaseTree, as it implements a lot of
things for you.  Then, you implement newNodeComponent(), where you can
create any component (e.g. a link) to represent a tree node.  The
component you create there is not tree-specific.

Cheers,
Thomas


On Wed, Apr 9, 2008 at 7:59 AM, ouss [EMAIL PROTECTED] wrote:


  No one can help me ?
  --
  View this message in context: 
 http://www.nabble.com/How-to-Create-a-link-in-a-treeview-tp16557773p16580102.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Ajax update works from second time on

2008-04-02 Thread Thomas Kappler
Thanks for your suggestions.  It was a model problem, after all: after
I had written to the list, I observed that it wasn't that the first
update never happened, but that all updates happened one iteration too
late, i.e., user handles A - nothing happens, user handles B - A
disappears from the ListView, etc.  So in addition to
target.addComponent(listViewContainer) I added an explicit
listViewContainer.detach().  I thought that that happens
automatically, but apparently not; now it works.

At least it got me to finally install Firebug, it' great!

Cheers,
Thomas

On Tue, Apr 1, 2008 at 11:41 AM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
 Yeah, and if you dont know it. Firebug is great for that..

  http://www.getfirebug.com/



  Johan Compagner wrote:

  So the serverside is not called the first time at all? (you have debugged
 that?)
  Then it seems that it is a javascript issue. Look in the browser why
  it isnt called.
 
  On 3/31/08, Thomas Kappler [EMAIL PROTECTED] wrote:
 
 
   Hi,
  
   I'm seeing a strange behavior on one of my pages.  Using
   wicketstuff-scriptaculous, users drag a row from a ListView to another
   component.  This triggers an association between the two model
   objects, which is also persisted via Hibernate.  Relevant code:
  
  protected void onDrop(Component component,
   AjaxRequestTarget target) {
  if (component.getModelObject() instanceof Fiche) {
  // a fiche being dropped
  Fiche f = (Fiche) component.getModelObject();
  sense.getFiches().add(f);
  DataStaticService.getHibernateSession().flush();
  
 DataStaticService.getHibernateSession().merge(sense);
  
   DataStaticService.getHibernateSession().getTransaction().commit();
  sensesPanel.update(node, target);
  }
  }
  
   The update() in the last line triggers a target.addComponent() of the
   panel containing the ListView, which should cause it to remove the
   dropped element, as it has been handled.  (The model backing the
   ListView is the result of a database query getting the Fiches which
   are not associated to a Sense.)
  
   Now, what I see is that the first drop after the page is loaded
   doesn't trigger the update, the ListView stays untouched.  However,
   when I drop the second and more elements, it starts working.  But the
   first dropped element is always displayed, so the ListView is always
   off by one.  A manual page reload again causes the next drop to not
   update the ListView.
  
   What gives?  The fact that it starts working at some time seems to
   indicate my backend/domain logic is correct.  I can post more code,
   but perhaps someone can already give a direction where to look.
  
   Cheers,
   Thomas
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 

  --
  -Wicket for love

  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684




  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How do I get a change in my tree model to be displayed?

2008-03-31 Thread Thomas Kappler
Hi,

first of all, in the first line of the loop, shouldn't node be nextNode?

Then, you're directly calling listener methods, which are supposed to
be callbacks, i.e., they are called by the framework when, and after,
a selection or expansion happens. You should use the methods offered
by ITreeState, such as expandNode(node) (as you do with selectNode).
Your listener methods will be called, if you added your listener to
the tree.

Cheers,
Thomas


   final ITreeState treeState = getTreeState();
   final TreeNode[] path = node.getPath();
   for( final TreeNode nextNode : path )
   {
   treeState.selectNode( node, true );
   nodeExpanded( nextNode );
   nodeSelected( nextNode );
   }

   invalidateAll();

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Ajax update works from second time on

2008-03-31 Thread Thomas Kappler
Hi,

I'm seeing a strange behavior on one of my pages.  Using
wicketstuff-scriptaculous, users drag a row from a ListView to another
component.  This triggers an association between the two model
objects, which is also persisted via Hibernate.  Relevant code:

protected void onDrop(Component component,
AjaxRequestTarget target) {
if (component.getModelObject() instanceof Fiche) {
// a fiche being dropped
Fiche f = (Fiche) component.getModelObject();
sense.getFiches().add(f);
DataStaticService.getHibernateSession().flush();
DataStaticService.getHibernateSession().merge(sense);

DataStaticService.getHibernateSession().getTransaction().commit();
sensesPanel.update(node, target);
}
}

The update() in the last line triggers a target.addComponent() of the
panel containing the ListView, which should cause it to remove the
dropped element, as it has been handled.  (The model backing the
ListView is the result of a database query getting the Fiches which
are not associated to a Sense.)

Now, what I see is that the first drop after the page is loaded
doesn't trigger the update, the ListView stays untouched.  However,
when I drop the second and more elements, it starts working.  But the
first dropped element is always displayed, so the ListView is always
off by one.  A manual page reload again causes the next drop to not
update the ListView.

What gives?  The fact that it starts working at some time seems to
indicate my backend/domain logic is correct.  I can post more code,
but perhaps someone can already give a direction where to look.

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket group on linkedin

2008-03-31 Thread Thomas Kappler
On Mon, Mar 31, 2008 at 4:37 PM, Nino Saturnino Martinez Vazquez Wael
[EMAIL PROTECTED] wrote:
  This is the group invitation url, I believe..

  http://www.linkedin.com/e/gis/80181/73AB8A016DFF

Seems to work.  I registered, approval is pending.

Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Trees and DnD?

2008-03-26 Thread Thomas Kappler
On Wed, Mar 26, 2008 at 1:50 AM, James Carman
[EMAIL PROTECTED] wrote:
 Is there a way to enable drag-n-drop in a Wicket tree?  Our users have
  a usecase where they want to be able to build a hierarchical list of
  stuff and they want to be able to move stuff around easily and
  reorder nodes.  Is there an example out there?  Has someone done this
  before?

We're currently working on it.  We use wicketstuff-scriptaculous, and
so far it seems to work, but some things are still missing.

The basic idea is straightforward: each node is a DraggableTarget (for
accepting drops), and has a DraggableBehavior (for being dragged).

Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Trees and DnD?

2008-03-26 Thread Thomas Kappler
On Wed, Mar 26, 2008 at 3:04 PM, Ryan Sonnek [EMAIL PROTECTED] wrote:
   We're currently working on it.  We use wicketstuff-scriptaculous, and
so far it seems to work, but some things are still missing.

  Please let me know if you run into anything that's missing.

Sorry, I meant missing in our own app, so I cannot yet definitely say
whether it works, or post code.  So far, nothing in
(wicketstuff-)scriptaculous seems to be missing.

Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Trees and DnD?

2008-03-26 Thread Thomas Kappler
On Wed, Mar 26, 2008 at 3:27 PM, James Carman
[EMAIL PROTECTED] wrote:
 On Wed, Mar 26, 2008 at 9:04 AM, Thomas Kappler [EMAIL PROTECTED] wrote:
We're currently working on it.  We use wicketstuff-scriptaculous, and
so far it seems to work, but some things are still missing.
  
The basic idea is straightforward: each node is a DraggableTarget (for
accepting drops), and has a DraggableBehavior (for being dragged).
  

  Are you guys planning on sharing your work with the rest of the Wicket
  community?

I am.  Most likely the whole app will be GPL'ed, we're currently
ironing out the last issues.  If not, I'll be able to at least share
code snippets.

Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Enable ghosting in wicketstuff-scriptaculous

2008-03-18 Thread Thomas Kappler
Hi,

first of all, sorry if this is the wrong list, but AFAIK there's no
wicketstuff ML and the JIRA doesn't list the scriptaculous component
as a project.

We wanted ghosting
(http://wiki.script.aculo.us/scriptaculous/show/Draggable) in our
wicketstuff-scriptaculous enabled drag'n'drop, but it's not
integrated.  The attached trivial patch fixes that.  Is there a
specific reason why it's left out from the wicketstuff behavior?

Cheers,
Thomas


wicketstuff-scriptaculous-ghosting-patch
Description: video/ms-wm
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Enable ghosting in wicketstuff-scriptaculous

2008-03-18 Thread Thomas Kappler
Wow, that was quick!  Thanks a lot!

Thomas


On Tue, Mar 18, 2008 at 5:44 PM, Ryan Sonnek [EMAIL PROTECTED] wrote:
 done!

  patch has been applied.  bamboo should publish a new snapshot jar any
  minute now.



  On Tue, Mar 18, 2008 at 11:27 AM, Ryan Sonnek [EMAIL PROTECTED] wrote:
   Hey, thanks for the patch.
  
The only reason it wasn't added is that no-one had requested it.  =)
i'll be happy to apply the patch and push out a new release ASAP.
  
Thanks again!
  
  
  
On Tue, Mar 18, 2008 at 11:21 AM, Thomas Kappler
[EMAIL PROTECTED] wrote:
 Hi,

  first of all, sorry if this is the wrong list, but AFAIK there's no
  wicketstuff ML and the JIRA doesn't list the scriptaculous component
  as a project.

  We wanted ghosting
  (http://wiki.script.aculo.us/scriptaculous/show/Draggable) in our
  wicketstuff-scriptaculous enabled drag'n'drop, but it's not
  integrated.  The attached trivial patch fixes that.  Is there a
  specific reason why it's left out from the wicketstuff behavior?

  Cheers,
  Thomas

 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [vote] Release 1.4 with only generics and stop support for 1.3

2008-03-17 Thread Thomas Kappler
+1

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



MultiFileUpload: Update page for each file

2008-03-17 Thread Thomas Kappler
Hi all,

I'm using the MultiFileUploadField on a page derived from the example
one http://wicketstuff.org/wicket13/upload/multi.  Now I'd like to
show the progress, but not of the upload itself, as the files are not
that big.  Instead, the time consuming part is some processing that is
done for each file upon upload.

It would be enough to update a ListView resp. its model, so that each
file appears in the list as soon as it's processed.  As the body of
onSubmit() is basically a loop iterating over the files, it would be
fine to trigger the update at the end of the loop body.  However, I
don't get how to do that when I don't have an AjaxRequestTarget.

protected void onSubmit() {
for (final FileUpload upload : uploads) {
File newFile = new File(getUploadFolder(), 
upload.getClientFileName());

// upload
newFile.createNewFile();
upload.writeTo(newFile);

// process it
DataStaticService.ensureSession(new 
SingleFileBibEntryReader(newFile));

// PAGE/PANEL UPDATE: newFile is processed
}
}

I don't know if what I want is even possible as multipart-enabled ajax
forms don't work AFAIK.

Could I attach a Behavior to the ListView showing the processed files?
 But how to trigger it?

Any hints?

Best,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: A link-o-label needed

2008-03-14 Thread Thomas Kappler
On Fri, Mar 14, 2008 at 3:26 PM, James Carman
[EMAIL PROTECTED] wrote:
 Yeah, the output would be something like:

  a href=... wicket:id=myLinkspan wicket:id=myLinkLabel //a

  off the top of my head.  You might want to tell the label to just
  render its body, also.

What do you mean with the last sentence?  I add labels to links all
the time and it works fine.

Best,
Thomas


  On 3/14/08, Vitaly Tsaplin [EMAIL PROTECTED] wrote:
  Thanks James,
  
  I wrote a subclass of a wicket link to archive this, but simple
adding a label as a child to a link seams to be a really good idea :)
  
  
  Vitaly
  
  
On Fri, Mar 14, 2008 at 3:17 PM, James Carman
[EMAIL PROTECTED] wrote:
 Have you tried adding a label to your link?  I do this with images.  I
  don't see why you wouldn't be able to do it with labels.



  On 3/14/08, Vitaly Tsaplin [EMAIL PROTECTED] wrote:
  Hi experts,
  
  Does anyone know how to create a label link in wicket? In other
words I need a clickable label or a link which acts as a label 
 taking
its text from a model exactly like a wicket's label.
  
  Vitaly
  

 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Sorting a list

2008-03-06 Thread Thomas Kappler
databinder has MoveUpButton and MoveDownButton, which do the job in
ListViews.  If you don't use databinder, you can still have a look at
the source.

databinder.net

Cheers,
Thomas


On Thu, Mar 6, 2008 at 6:35 PM, jeredm [EMAIL PROTECTED] wrote:

  I should have been more clear that I need to create a control to allow the
  user to change the order in a list.  I am able to sort the list before it is
  rendered just fine.  What I need to do is to loop through the table once it
  has been re-ordered by the user and then set a sort order in the DB based on
  the order of the rows in the table.

  I believe the solution Ryan mentioned earlier in this thread is capable of
  doing what I need, but I have not been able to get it to work yet in the
  context that I need it.  I was able to get his solution working with an
  unordered list in a WebPage, but the panel I need the list/table on is
  swapped in via AJAX which seems to be creating a javascript error.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to view SetQuestionaire like ListView uses List

2008-03-01 Thread Thomas Kappler
Hi,

you need a repeater.  See http://wicketstuff.org/wicket13/repeater/
for examples.

Thomas


On Sat, Mar 1, 2008 at 2:01 PM, wiki [EMAIL PROTECTED] wrote:

  Hi I have a set of questionaires
  I know how to display List of Quesitonaires
  {
   ListQuestionaire a=user.getQuestionaire();
   ListView v=new ListView()
implementedabstract methods
  };
   but don't know if i have SetQuestionaire q=user.getQuestionaire();
  how to display them.
  Thanks
  --
  View this message in context: 
 http://www.nabble.com/How-to-view-Set%3CQuestionaire%3E-like-ListView-uses-List-tp15773242p15773242.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can i add multiple lines to a node-link in tree?

2008-02-28 Thread Thomas Kappler
On Thu, Feb 28, 2008 at 10:54 AM, Newgro [EMAIL PROTECTED] wrote:

  firstly sorry if i brought you to the wrong way - i use a treetable, not a
  tree. My effects on code below is that the nodes are diplayed only in one
  row. The second row is not visible.

OK, I have never used TreeTable, and I cannot test it right now, but
it should not affect the MultiLineLabel where it appears.  Perhaps
it's that the \n is the last character, try adding something after it.
 Other than that, no idea.

Thomas


  My html:
  wicket:panel
   form wicket:id=treeform
 div class=tree wicket:id=treeTable/div
   /form
  /wicket:panel

  My data code
  public String getName() {
   StringBuilder sb= new StringBuilder();
   sb.append(EZ: ).append(getPrice(getRoomRate().getPrice())).append( €);
   sb.append( DZ: ).append(getPrice(getRoomRate().getPrice2())).append(
  €\n); -- here the newline!!
   sb.append(  ().append(getDate(getRoomRate().getFromDate()));
   sb.append( - );
   sb.append(getDate(getRoomRate().getToDate())).append());
   return sb.toString();
  }


  Here is my code:

 TreeTable tree = new TreeTable(treeTable, treeModel, columns) {

   /**
* Represents a content of a cell in TreeColumn (column containing the
  actual tree).
* This has been copied to switch the label to a multiline instance.
* @author Matej Knopp
* @author r.dieckmann
*/
   class MyTreeFragment extends Fragment {

 /**
  * Constructor.
  * @param id the wicket:id of component
  * @param node current
  * @param level
  * @param renderNodeCallback
  *The call back for rendering nodes
  */
 @SuppressWarnings(deprecation)
 public MyTreeFragment(String id, final TreeNode node, int level,
  final IRenderNodeCallback renderNodeCallback) {
   super(id, fragment);

   add(newIndentation(this, indent, node, level));
   add(newJunctionLink(this, link, image, node));

   MarkupContainer nodeLink = newNodeLink(this, nodeLink, node);
   nodeLink.add(newNodeIcon(nodeLink, icon, node));
   nodeLink.add(new MultiLineLabel(label, new
  AbstractReadOnlyModel() {
 /**
  * @see
  org.apache.wicket.model.AbstractReadOnlyModel#getObject()
  */
 public Object getObject() {
   return renderNodeCallback.renderNode(node);
 }
   }));
   add(nodeLink);
 }
   }

   /**
* @see
  
 org.apache.wicket.extensions.markup.html.tree.table.TreeTable#newTreePanel(org.apache.wicket.MarkupContainer,
  java.lang.String, javax.swing.tree.TreeNode, int,
  
 org.apache.wicket.extensions.markup.html.tree.table.TreeTable.IRenderNodeCallback)
*/
   @Override
   protected Component newTreePanel(MarkupContainer pParent, String pId,
  TreeNode pNode, int pLevel, IRenderNodeCallback pRenderNodeCallback) {
 return new MyTreeFragment(pId, pNode, pLevel, pRenderNodeCallback);
   }

   /**
* @see
  
 org.apache.wicket.extensions.markup.html.tree.DefaultAbstractTree#newNodeLink(org.apache.wicket.MarkupContainer,
  java.lang.String, javax.swing.tree.TreeNode)
*/
   protected MarkupContainer newNodeLink(MarkupContainer pParent, String
  pId, final TreeNode pNode) {
 MarkupContainer m = newLink(pParent, pId, new ILinkCallback() {

   /**
* @see
  
 org.apache.wicket.extensions.markup.html.tree.DefaultAbstractTree.ILinkCallback#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
*/
   public void onClick(AjaxRequestTarget target) {
 if (!getTreeState().isNodeSelected(pNode)) {
   getTreeState().selectNode(pNode, true);
   onNodeLinkClicked(target, pNode);
   updateTree(target);
 }
   }
 });
 DefaultMutableTreeNode t = (DefaultMutableTreeNode) pNode;
 if (t.getUserObject() instanceof TreeModelCategoryBean) {
   TreeModelCategoryBean c = (TreeModelCategoryBean)
  t.getUserObject();
   ICategoryTO categoryTO = c.getCategory();
   m.setEnabled(categoryTO != null  categoryTO.isAvailable());
 }
 return m;
   }

   /**
* @see
  
 org.apache.wicket.extensions.markup.html.tree.DefaultAbstractTree#onNodeLinkClicked(org.apache.wicket.ajax.AjaxRequestTarget,
  javax.swing.tree.TreeNode)
*/
   protected void onNodeLinkClicked(AjaxRequestTarget pTarget, TreeNode
  pNode) {
 super.onNodeLinkClicked(pTarget, pNode);
 DefaultMutableTreeNode dnode = (DefaultMutableTreeNode) pNode;
 ITreeModelBean current = (ITreeModelBean) dnode.getUserObject();
 if (current instanceof TreeModelCategoryBean) {
   refreshNodes(pTarget, pNode);
 } else if (current instanceof TreeModelPackageBean) {
   refreshNodes(pTarget, 

Re: Can i add multiple lines to a node-link in tree?

2008-02-27 Thread Thomas Kappler
On Wed, Feb 27, 2008 at 2:55 PM, Newgro [EMAIL PROTECTED] wrote:

  i got it now with the multilinelabel. The text i add to a node contains an
  \n. But i only see one row. I experimented a bit with the css, but i can't
  get the tree node to show me 2 lines.

I just tried it, it works for me.  Added \n bla for testing:

add(new MultiLineLabel(sense, senseLabel + \n bla));

In the HTML it's a span.

No idea what the problem could be, best show the relevant code.

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Mounting dynamic URLs

2008-02-27 Thread Thomas Kappler
Hi Martjin,

Nathan has implemented that in his Recipe Book example app:
http://databinder.net/recipe.  Have a look at the first constructor of
RecipeBook.

Thomas



On Wed, Feb 27, 2008 at 4:31 PM, Martijn Lindhout
[EMAIL PROTECTED] wrote:
 Hi All,

  How do I mount a friendly URL with a dynamic last part. I.e. I want the
  following URL's to be handled by a profile page which contents depends on
  the last part. Is this possible?

  http://localhost/myApp/profile/wsmith
  http://localhost/myApp/profile/stiger

  --
  Martijn Lindhout
  JointEffort IT Services
  http://www.jointeffort.nl
  [EMAIL PROTECTED]
  +31 (0)6 18 47 25 29


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can i add multiple lines to a node-link in tree?

2008-02-22 Thread Thomas Kappler
Hi Per,

did you try using a wicket.markup.html.basic.MultiLineLabel?

If your tree nodes have more than one component, encapsulate them into
a Panel and return instances of that from
BaseTree.newNodeComponent(String id, IModel model).

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: listView sorting question

2008-01-24 Thread Thomas Kappler
On Jan 23, 2008 10:35 PM, Beyonder Unknown [EMAIL PROTECTED] wrote:
 The use case is that, I have a page that renders a listview, and I need to 
 add a link that sorts the list when clicked. My listView uses 
 LoadableDetachableModel that retrieves data using hibernate backend.

In my current app, I have a ListView with three different ways of
sorting, each using several fields (columns of the ListView).  The
user can choose the ordering from a DropDownChoice.  I implemented it
with databinder's HibernateListModel.

The sorting is encapsulated in ICriteriaBuilders, with one abstract
one containing the query itself, which is the always the same.

private abstract class FicheSort implements ICriteriaBuilder {
HibernateListModel list = new HibernateListModel(Fiche.class, 
this);
public void build(Criteria criteria) {
criteria.add( fichesForCurrentLemma() );   // the query 
itself
// ...
}
protected abstract String getDisplayName();
}
private class SortRenderer implements IChoiceRenderer {
public Object getDisplayValue(Object object) {
return ((FicheSort)object).getDisplayName();
}
public String getIdValue(Object object, int index) {
return String.valueOf(index);
}
}
private class AlphabeticalSort extends FicheSort {
@Override
public void build(Criteria criteria) {
super.build(criteria);
criteria.addOrder( Order.asc(entry) );
criteria.addOrder( Order.asc(siglumDate) );
criteria.addOrder( Order.asc(siglum) );
}
@Override
protected String getDisplayName() {
return Alphabetisch;
}
}
   // Two more like AlphabeticalSort
   // ...

With one of the sorting methods, I instantiate a databinder
HibernateListModel, which is the model for the ListView:

final HibernateListModel alphabeticalFicheList =
new HibernateListModel(Fiche.class, new 
AlphabeticalSort());

final FicheListView sortableFicheView = new
FicheListView(sortableFicheView,
alphabeticalFicheList); 

Changing the sorting method when the user selects another choice in
the DDC, whose model is a List of all the concrete ICriteriaBuilders,
is simply:

protected void onUpdate(AjaxRequestTarget target) {
FicheSort sort = (FicheSort) 
orderChoice.getModelObject();
sortableFicheView.setModel(sort.list);
target.addComponent(sortableFicheViewContainer);
}

The downside is that the data is retrieved from the DB each time,
although I'm not sure whether Hibernate or the DB itself recognize
that and cache accordingly.

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Get from input from a ModalWindow

2008-01-24 Thread Thomas Kappler
Hi Stefan,

it was indeed a problem with the models involved there.  It looked
fine to me, so I suspected the modal window, and that wiki page I
linked also gave me the impression that there was something with modal
windows in that regard, but I should have checked first in an ordinary
page.

Thanks!
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Get from input from a ModalWindow

2008-01-22 Thread Thomas Kappler
Hi,

I have a ModalWindow with a form, having some dropdown choices and
text fields.  It should be simple, but I can't get the user input when
the window is closed.  There is no domain model object behind the
form, I just need a list of Strings from the form, although I could,
of course, make up a wrapper POJO for that.

I found the example on
http://cwiki.apache.org/WICKET/pass-form-input-from-modal-window-back-to-the-caller-page.html,
but I'm not sure I get it.  Is chooserPanel the modal window?  If so,
how and when is yourValue set?  Via the form's onSubmit, I guess, but
when is that triggered?

Thanks,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dynamically adding text fields

2007-12-27 Thread Thomas Kappler
On Dec 26, 2007 11:32 PM, Ken Anderson [EMAIL PROTECTED] wrote:

 I have a use case that will require the user to add multiple text fields to a
 form using an add button.

See this wiki page:
http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html

Have a list of text fields, create a ListView based on this list, and
add the ListView to a WebMarkupContainer or similar.

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to open a popup in onSubmit() of a Form

2007-12-21 Thread Thomas Kappler
Do you know about
org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow?  It
seems to do almost what you want, or at least you can look at the
source.

Cheers,
Thomas

On Dec 21, 2007 9:56 AM, thomas jaeckle [EMAIL PROTECTED] wrote:

 Hi again.
 I found a solution, but it isn't very nice:

 First I implemented a AjaxForm like the AjaxButton is implemented (why isn't
 there a AjaxForm delivered with Wicket?):

 public abstract class AjaxForm extends Form
 {
public AjaxForm(String id)
{
   super(id);

   add(new AjaxFormSubmitBehavior(this, onsubmit)
   {
  private static final long serialVersionUID = 1L;

  protected void onSubmit(AjaxRequestTarget target)
  {
 AjaxForm.this.onSubmit(target);
  }

  protected void onError(AjaxRequestTarget target)
  {
 AjaxForm.this.onError(target);
  }

  protected CharSequence getEventHandler()
  {
 return new
 AppendingStringBuffer(super.getEventHandler()).append(; return false;);
  }

  protected IAjaxCallDecorator getAjaxCallDecorator()
  {
 return AjaxForm.this.getAjaxCallDecorator();
  }
   });
}

protected IAjaxCallDecorator getAjaxCallDecorator()
{
   return null;
}

protected void onError(AjaxRequestTarget target)
{
}

protected abstract void onSubmit(AjaxRequestTarget target);
 }



 Now I can do:

 AjaxForm form = new AjaxForm(form)
 {
private static final long serialVersionUID = 1L;

protected void onSubmit(AjaxRequestTarget target)
{
   PopupSettings popupSettings = new PopupSettings(PageMap.forName(id_
 + textField.getConvertedInput()),
 PopupSettings.RESIZABLE).setHeight(768).setWidth(1024);

   PageParameters tmpParameters = new PageParameters();
   tmpParameters.add(id, (String)
 partnerSearchTextField.getConvertedInput());

popupSettings.setTarget(' + urlFor(PrBrsPage.class,
 tmpParameters).toString() + ');

final String orgPopupString = popupSettings.getPopupJavaScript();
int i = orgPopupString.indexOf(return false;);
String popupString = popupSettings.getPopupJavaScript().substring(0,
 i-1);

if (target != null)
{
   target.appendJavascript(popupString);
   // focusComponent(null) to prevent that the main window regains
 focus
   target.focusComponent(null);
}
}
 };


 But I don't really like this solution. If someone has an idea how to make
 this nicer, please speak ;)

 regards Thomas
 --
 View this message in context: 
 http://www.nabble.com/How-to-open-a-popup-in-onSubmit%28%29-of-a-Form-tp14435932p14452239.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Getting position of elements in a ListView

2007-12-04 Thread Thomas Kappler
Hi all,

I use a ListView holding Components to implement a dynamic form, i.e.,
where the user can add and remove DropDownChoices herself.  (See
http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html.)

Now, a problem is the removal of elements when the user clicks the
remove link next to a DDC.  My original code looks like that:

ListView menuList = new ListView(MENU_LIST_ID, dropdownMenus) {
public void populateItem(final ListItem item) {
final DropDownChoice choice = (DropDownChoice)item.getModelObject();
item.add(choice);
AjaxFallbackLink removeMenuLink = new
AjaxFallbackLink(REMOVE_MENU_LINK_ID) {
public void onClick(final AjaxRequestTarget target) {
// Parent is the ListView, its model object is the
list of menus.
ListPositionAwareDropDownChoice choices =
(ListPositionAwareDropDownChoice)
item.getParent().getModelObject();
choices.remove(choice); 

target.addComponent(enclosingContainer);
}
};
removeMenuLink.add(new Label(REMOVE_MENU_LINK_TEXT_ID,
removeMenuLinkText));
item.add(removeMenuLink);
}

However, choices.remove(choice) doesn't always work because the list
doesn't seem to contain the DDC choice, i.e., equals() is not true.

So I thought of removing the DDC by their position in the list, but
that means I have to store it myself.  Currently, I extended DDC,
adding getPos() and setPos().  The line where the removal happens now
looks like that:
choices.remove( ((PositionAwareDropDownChoice)choice).getPos() );

It seems a bit clunky and verbose to me.  Does anyone know of a better way?

Cheers,
Thomas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]