SV: Bug of Wicket when iterate the form using iterator()?

2008-12-01 Thread Wilhelmsen Tor Iver
 The only problem right now is the cast to Component[]. The 
 fix is easy, just change it to Object[]. The optimization 
 makes a lot of sense and there is reason why it can't really 
 be simple.

The simplest explanation is that the (synthetic) array classes both
extend Object but are not in the same inheritance tree:

   [L.../Component;
  /
java.lang.Object
  \
   [Ljava/lang/Object;

Thus the casting fails (at runtime).

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



SV: How to update base page panel from child page?

2008-12-14 Thread Wilhelmsen Tor Iver
 My question is how to ask the cart section to updates its 
 state (and redraw it) from a child page?

Just add the superclass element to the AjaxRequetTarget parameter. This
means either holding a reference to it (e.g. a protected instance field)
or better, use get(path:to:cart) to get at it. Remember that all
elements that should be updated via Ajax needs to have called
setOutputMarkupId(true) on them so that the Javascript libraries can
adddress them.

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



SV: Dynamic wizard content

2009-01-13 Thread Wilhelmsen Tor Iver

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://servicedesk.arrive.no

 

 * As far as I understand, all steps are constructed at the 
 same time. How, then, can I make the content of step B dynamic?

No it's rendered at render time; what you want to do is use a model
which step A configures; e.g. a LoadableDetachableModel which receives
properties from step A and then will load the actual data when asked to
by the view.

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



SV: referencing page from panel?

2009-01-16 Thread Wilhelmsen Tor Iver
 I have a panel that is on a page and the panel needs to be 
 able to reference another panel on the same page.

In the code, you can either keep instance variables pointing to the two
panels in the page source (since they are on the same page they are in
the same Page) and go via those in the action code, or use
getPage().get(path:to:panel) and cast to the panel class.

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



Re: Please Please Portlet

2009-03-04 Thread Wilhelmsen Tor Iver
 (using Netbeans, wicket 1.4rc2, glassfish v3, 
 portlet-container from open-portal project)

I thought the portlet-container in effect was dead since the Sun Portal
is dead? They have ditched that in favor of a solution based on Liferay
5.2 called Web Space (codename WebSynergy during development):
https://webspace.dev.java.net/download.html - note that it uses
Glassfish v2.1 in case you require features from v3.

Around here we use a patched snapshot of 1.4 (using an adapted version
of the older portlet 2.0 patch) for Wicket portlets. (Or have I been
sleeping and we get real Portlet 2.0 out of the box in 1.4 now?)

I noticed some differences between what we do (which works :) ) and what
you posted:

1) In web.xml we have a filter mapping for each portlet:

filter-mapping
filter-namebookmark/filter-name
url-pattern/basic/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherINCLUDE/dispatcher
dispatcherFORWARD/dispatcher
dispatcherERROR/dispatcher
/filter-mapping

2) We also declare the application in the filter element:

init-param
param-nameapplicationClassName/param-name

param-valueno.nsb.intranet.bookmark.wicket.BookmarkApplication
/param-value
/init-param

3) You also seem to be missing an init-parameter for viewPage, in our
case e.g.

init-param
namewicketFilterPath/name
value/basic/value
/init-param
init-param
nameviewPage/name
value/basic/list/value
/init-param

   though in theory it should use the application's getHomePage(), I
guess...

4) We do not have anything in sun-web.xml, though I guess we would
benefit from a shared classloader with Web Space.

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



SV: Correct use of RangeValidator

2009-03-17 Thread Wilhelmsen Tor Iver
 WicketMessage: Exception 'java.lang.ClassCastException: 
 java.lang.Integer' occurred during validation 
 org.apache.wicket.validation.validator.RangeValidator on component 
 2:body:recvAnalisysForm:intField Root 
 cause:java.lang.ClassCastException: java.lang.Integer at 
 java.lang.String.compareTo(String.java:90)

According to the error message, the validator gets a String value here;
have you checked the actual IModel used by the field? The default Model
for *TextField uses String IIRC...

IModelInteger model = new PropertyModelInteger(theBean, intField);
RequiredTextFieldInteger intField = new
RequiredTextFieldInteger(intField, model);
intField.add(new RangeValidatorInteger(0, 100));

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



SV: How can I share text resources with multiple web applications?

2009-03-20 Thread Wilhelmsen Tor Iver
 It's a *wicket* archetype that uses Maven as a build tool.

But if it *breaks* the assumptions made by all other plugins used by
Maven as a build tool, is it then not an archetype that *abuses* Maven
as a build tool? :)

What other contexts would you want to use this *wicket* archetype that
does not involve Maven? If none, why should it not create a project
structure that Maven likes? Yes, you can override *anything* in Maven if
you want to, but *do* you really want to?

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



SV: How can I share text resources with multiple web applications?

2009-03-20 Thread Wilhelmsen Tor Iver
 There is no sane reason why anyone would put the html, js, 
 css and properties resources in any place except *next* to 
 the corresponding.java file. Your .java file can not function 
 without the .html file. Your component will fail if the 
 .properties file is not available. When the js file can't be 
 found your component is useless.

Correct for the *runtime* view of files, and a Maven build will combine
the packages in src/main/java and src/main/resources so that the two are
merged.

What Maven likes, however is that at *coding* and *building* time that
the Java source files, and their related resources, are in different
root folders. The main reasons I have seen for this is resource
filtering and support for multiple resource folders (sharing resources
between projects for instance).

 Wicket goes beyond the call of duty to provide developers 
 with the means to encapsulate your components, bringing 
 Object Oriented design and programming to the web tier. 

Yes, but that's salesman talk. :) And is not at all affected by Maven's
preferences.

 Moving the necessary resources outside the package folder 
 into a separate directory structure breaks this encapsulation 
 is definitely not the Wicket Way (tm).

It retains the package structure, but the packages start out in two (or
more) different root folders when coding, being merged in the build
process.

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



SV: generics

2008-07-15 Thread Wilhelmsen Tor Iver
Brill Pappin [EMAIL PROTECTED] wrote:
 I'd say that WIcket *is a product*, and as such the consumers 
 of that product have the final say.

Not any more than you can e.g. go to Ford Motor Co. and demand they make
this and that modification to the design of the Mustang, for instance.
Like most consumers your way of saying is to choose whether to buy/use
the product or not, and it falls on the developer/manufacturer to fuind
out why you do or do not buy/use it.

(Walton's famous the customer is always right has a corollary: If
someone is wrong they simply is not a customer. :) )

 It's up to the core committers to do the best job they can to make
sure their 
 consumers are getting what they need...

Not unless you want to start paying them to do so, becoming their boss
in the process. As they have pointed out, Wicket is not their job but
their hobby of sorts.

However: Since it is an OSS product you can download the source and
modify it as much as you like (like I did when I applied the portlet 2.0
patch to the 1.3 and 1.4 trees locally), even creating your own fork of
it if you so desire. You see, the consumers are also the potential
workers in the OSS world: if only a group of users want a feature it
falls on them to implement it.

 just because it's 
 an OS project that we don't have to buy, doesn't mean that 
 the project doesn't depend on people using it.

It does, but if it does not suit people's need they will look elsewhere.
There is a ton of web application frameworks out there to choose from.
If you like the separation of template and code in Wicket, try looking
into e.g. Facelets, which is JSF without the cursed mess called JSP.

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



SV: getRequestUrl behavior difference between page call and ajax call

2008-08-04 Thread Wilhelmsen Tor Iver
 - when loading the page from the browser, the URL is returned 
 including the page parameters;

Yes, that would be a GET-method request.

 - when updating through AJAX, the URL is returned without the 
 page parameters.

AAJAX requests are often POST-method. In POST requests the parameters
are most often encoded in the body of the request.

 Shouldn't the AJAX call incorporate these page parameters 
 such that the results are consistent?

Not necessarily: the programmer normally picks up the parameters on the
other side of the HTTPServletRequest which deals with such
differences. However, you could see if there is a way to tell the AJAX
library to use GET requests...

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



SV: Need to open the Link in another window

2008-09-25 Thread Wilhelmsen Tor Iver
 Try:
 Link lk = new ExternalLink(lk, http://...;) {
 @Override
 protected void onComponentTag(ComponentTag tag) {
 super.onComponentTag(tag);
 tag.put(target, _blank);
 }
 };

A bit overkill: You might instead want to add an AttributeModifier to
the link element.

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



SV: more than one html file accessible

2008-10-01 Thread Wilhelmsen Tor Iver

Override init() and add

mountBookmarkablePage(/stats, StatisticPage.class);

- Tor Iver

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



SV: XMLHttpRequest.open(...)

2008-11-07 Thread Wilhelmsen Tor Iver
 that XMLHttpRequest.open(...) are disallowed if they target 
 for another domain, than the one the document is in?
 Like disallowing cross-site calls?

Yes, to avoid cross-site scripting attacks; remember Javascript has
globally accessible objects so if cross-site scripting was allowed then
an attacker could make a script which went through the browser's open
documents looking for a particular library and modify that.

Presumably a signed Javascript will be allowed to perform a cross-site
connection.

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



SV: force client to use GET method

2008-11-10 Thread Wilhelmsen Tor Iver
 Ok.. that didn't stop the client from submitting the form of 
 the previous page again. 
 Any other solutions to preventing double submissions?

Tell people to use a less stupid browser than IE? (Which is the one with
that behavior if memory serves)? :)

Real solution: Use a hidden token that you use to check whether the
particular form already has been posted, and in that case just skip the
form processing and work on the already processed object, something like
this in onSubmit():

// MapString, DataObject objectmap...

// FormDataObject

String tokenvalue = form.get(token);
DataObject obj = objectmap.get(tokenvalue);
if (obj == null) {
// Not already handled
obj = this.getModelObject();
// TODO Persist or whatever
// Put in map
objectmap.put(tokenvalue, obj);
}
// TODO Operate on obj

Instead of this thrown-together example using an objectmap (which will
get filled with garbage), use the session.

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



SV: Controlling the order of resource files

2009-08-17 Thread Wilhelmsen Tor Iver
 It is like I need another selection mechanism for resource file which
 is not
 the locale but something that is specific to the logic of my
 application.

Look at styles, i.e. Session.setStyle(String) and the documentation there for 
resource lookup. Basically the style tag goes before the locale, e.g. 
MyPage_foo_nl.properties for locale nl and style foo.


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



Re: Hide component when instantiating component not authorized to

2009-08-25 Thread Wilhelmsen Tor Iver
 I implemented the desired solution by duplicating the complete
 org.apache.wicket.authentication.AuthenticatedWebApplication class in
 our
 source tree, 

What was wrong with implementing IAuthorizationStrategy.isActionAuthorized() 
and adding getSecuritySettings().setAuthorizationStrategy(new 
YourParticularImplementation()); in your Application.init()? The action to test 
for is Component.RENDER.

- Tor Iver

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



SV: Hide component when instantiating component not authorized to

2009-08-25 Thread Wilhelmsen Tor Iver
 What was wrong with implementing
 IAuthorizationStrategy.isActionAuthorized() and adding
 getSecuritySettings().setAuthorizationStrategy(new
 YourParticularImplementation()); in your Application.init()? The action
 to test for is Component.RENDER.

Ah, perhaps the other method is more to your question 
(isInstantiationAuthorized()), and also set the 
IUnauthorizedComponentInstantiationListener in the security settings to an 
implementation that sets the component invisible, or throws a RuntimeException 
you probably need to handle in the code that tries to instantiate the component.

- Tor Iver

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



Wicket and FindBugs

2009-08-25 Thread Wilhelmsen Tor Iver
It seems that our developers frequently mistakenly forget to use item.add() 
and end up writing add() in ListView sublasses and the like. This sounds like 
a job for FindBugs, do anyone know of any existing FindBugs plugin that deals 
with common mistakes in Wicket code?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





SV: ajax - navigate to new location

2009-09-04 Thread Wilhelmsen Tor Iver
 target.prependJavascript(window.location.href=google.com);
 
 Is there a better way of doing this?

Doubtful; Ajax is primarily concerned with NOT replacing the whole page. If you 
always replace the page use a normal link instead which lets you set a 
RedirectRequestTarget for instance.

- Tor Iver

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



SV: Move shared wicket components to a base page?

2009-10-05 Thread Wilhelmsen Tor Iver
 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).

This indicates to me you are not using wicket:child / in the parent's markup 
and/or not using wicket:extend.../wicket:extend in the child page's markup.

- Tor Iver

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



Re: Nav bar - stateful

2009-10-05 Thread Wilhelmsen Tor Iver
 Is there any way of making a nav bar like this:
 
 wicket:link
   a href=HomePage.htmlBrowse/a |
   a href=Search.htmlSearch/a
 /wicket:link
 
 Stateful, i.e. only one instance of each page is created. So if you
 were
 on the home page and clicked the 'Search' link, then clicked the
 'Browse' link, the state of all your components would be remembered.

You probably need a custom AutoLinkResolver which creates links that check an 
internal map for an existing page of that type, or creates it (and puts it in a 
map) if absent.

- Tor Iver

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



SV: iPhone webapp support?

2009-10-06 Thread Wilhelmsen Tor Iver
 Are people still making fun of your huge nokia? ;-)

... or the side-talking 1st gen nGage :P (parodied a lot here: 
http://www.sidetalkin.com/photos.html )

On a more serious note, Wicket apps should run well in the iPhone's Safari 
browser, but if you want to support small devices in general you should look 
into client detection and using the style feature to server more compact pages.

- Tor Iver

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



AutoCompleteTextField, IConverter and required

2009-10-11 Thread Wilhelmsen Tor Iver
I have an AutoCompleteTextField with a POJO model; I override getConverter() to 
return a converter that looks up the field value in the same list that 
getChoices() uses for filtering. Which works fine if you actually put something 
into the field that matches.

However, if you type a non-mathing value, the converter returns null; this is 
AFAICS the correct way to deal with  failed conversion, and I expected a 
validation message to that effect. However, instead the null value is accepted, 
and even though the field is declared to be required, the form is submitted, 
and when re-rendered the field is of course blank due to the null model value.

Any ideas? Problem occurred in 1.4.0 and 1.4.2 (noticed I was using an old 
version and upgraded, but same behavior). Would it be better to use the 
TextField/AutoCompleteBehavior combo manually? Or should the converter be 
returned by the ConverterLocator instead?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





SV: Wicket 1.4.2 Released!

2009-10-12 Thread Wilhelmsen Tor Iver
 Why there are no SVN tags anymore ?
 svn ls http://svn.apache.org/repos/asf/wicket/tags/  does not have tags
 for
 1.4.1 and 1.4.2

Wicket's not fond of such conventions it seems :) - use 
http://svn.apache.org/repos/asf/wicket/releases/ instead.

- Tor Iver


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



DateLabel, joda-time and Liferay locales

2009-10-13 Thread Wilhelmsen Tor Iver
It seems joda-time used by DateLabel has an issue with Liferay's use of the 
locale nb_NO (for Norwegian bokmål in Norwayas opposed to the more common 
no_NO, where it seems to default to U.S. locale and UTC instead of native 
(CET+DST here) - i.e. it seems to use both components to decide timezone 
instead of just the country. What is the best approach to get around this?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.nomailto:toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





Re: Getting the Choose Option on page reload

2009-11-09 Thread Wilhelmsen Tor Iver
 I have 2 drop-downs and a search button my page. When the page is
 loaded
 for the first time, the first option in both the drop-downs is Choose
 Option. Now if I select some value and click Search, the page is
 rendered again and the Choose Option is gone forever. But I want it
 back. How do I go this?

It is a consequence of disabling null values; you need to tell the dropdown to 
accept null values which is what Choose Option represents:

theDropdownComponent.setNullValid(true);

You will also want to override the display value property in the .properties 
file:

theDropdownComponent.null_valid=Not set

- Tor Iver

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



SV: Get all active session objects

2009-11-09 Thread Wilhelmsen Tor Iver
 Yep, we need something to take those obj out from there.

Maybe a collection of weak references?

- Tor Iver

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



SV: wicket 1.4 : Link with no model

2009-11-17 Thread Wilhelmsen Tor Iver
 or a shorter
 
 Link? foo = new LinkVoid

... or wait for JDK 1.7 where you can do

LinkVoid foo = new Link

Which is more useful in cases like

MapString, ListFoo fie = new HashMap();

- Tor Iver


SV: Wicket Ajax in JBOSS Portal

2009-12-01 Thread Wilhelmsen Tor Iver
 It looks like JBoss portal support is incomplete... If I send you a
 minimalistic AJAX portlet which works in eXo, would you mind adapting
 it for
 JBoss (web.xml  portlet.xml) and try and see if it works? HTH!

We use Glassfish + Webspace/Liferay, but ended up using a mapping

filter-mapping
filter-namealltopic/filter-name
url-pattern/alltopic/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherINCLUDE/dispatcher
dispatcherFORWARD/dispatcher
dispatcherERROR/dispatcher
/filter-mapping

for the mappings. At least with this complete dispatcher set, Ajax works fine 
in portlet context here.

- Tor Iver


SV: validate() form (Form.class) - how to validate form by hand?

2009-12-11 Thread Wilhelmsen Tor Iver
 But in Wicket 1.4.3 the validate() method is protected so it's not
 visible. By the way actually only hasError() method is public.

In your Form class you can just override it with public visibility when you 
need it to be.

- Tor Iver
 

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



SV: enclosure changes in 1.4.4

2009-12-13 Thread Wilhelmsen Tor Iver
 Consistency is one of wicket's strengths. My tiny vote for 1.4.4
 
 -- Tony

+1

I never interpreted wicket:enclosure (as documented) as allowing the child 
attribute to reference a component anywhere else than inside the enclosure.

- Tor Iver

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



SV: applet in wicket .. exception thrown ...

2009-12-21 Thread Wilhelmsen Tor Iver
 Problem adding an applet to wicket still remains the same.. can some 1
 help

1) Be aware that applets are not loaded from WEB-INF/classes, but it seems you 
know this.
2) The class attribute value should not end in .class since that can make some 
browsers try to load HelloWorld.class.class instead.
3) Remember to add the class' package as a folder structure under webapp and 
use that package when naming the class in the applet element. 

- Tor Iver


SV: Handling Ajax session expired

2009-12-28 Thread Wilhelmsen Tor Iver
 jsessionid works

... but leads to lots of boilerplate where you need to rewrite all URLs 
targeted at your app's code. I guess Wicket can do that for you, but still...

- Tor Iver

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



SV: Handling Ajax session expired

2009-12-29 Thread Wilhelmsen Tor Iver
 I guess the servlet container handles jsessionid transparently.

Yes, coming in (either cookie or in the URI) and setting the cookie; but it 
does not normally add it to links in the output from your webapp, that is the 
framework or developer's responsibility.

- Tor Iver

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



SV: wicketstuff portlets - where did it go?

2009-12-31 Thread Wilhelmsen Tor Iver
 Ah looks like I may have found it:
 http://wicket-stuff.svn.sourceforge.net/viewvc/wicket-
 stuff/attic/wicket-portlets/

probably put in the attic because Wicket has supported portlets natively 
since 1.4-m3 or thereabouts.

- Tor Iver


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



SV: creating item after form is submitted via ajax

2009-12-31 Thread Wilhelmsen Tor Iver
 I'm doing that. I'm doing what the link referenced earlier in this
 thread
 said to do.

Wicket Ajax cannot update anything that isn't in the DOM. You need a 
placeholder element for what you want to render in the Ajax, e.g.

add(new 
WebMarkupContainer(panel2).setVisible(false).setOutputMarkupPlaceholderTag(true));

...
// in the Ajax method:

Panel2 replacement = new Panel2(panel2);
replacement.setOutputMarkupId(true);
getPage().replace(replacement);
target.addComponent(replacement);

- Tor Iver

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



Re: Hello World Portlet

2010-01-03 Thread Wilhelmsen Tor Iver
 What I find unclear, is the way it functions. It extends a wicker
 portlet, but the application is ran from WebApplication instance that
 mounts EditPage, HeaderPage, and doesn't seem to have any direct link
 to the WicketPortlet.

The link is via the filter mapping and page mounting. Case in point:

1) You use a WicketFilter in web.xml as normal, this is the one that knows of 
the Application. However, for the portlet case you need to add 
init-param
param-namedetectPortletContext/param-name
param-valuetrue/param-value
/init-param
to the filter definition so that it can detect the portlet API things like 
PortletRequest etc.

2) In portlet.xml you use WicketPortlet, but need at least two things :

2.1) To tell the portlet of the path. This would be the same path that the 
associated filter-mapping in web.xml:
init-param
namewicketFilterPath/name
value/foo/value
/init-param
2.2) Tell it the paths to use for the various modes, at least VIEW; These need 
to be bookmarkable, mounted Pages:
init-param
nameviewPage/name
value/foo/view/value
/init-param
in this case the Application needs to have mountBookmarkablePage(/view, 
SomePage.class);

Note that you normally either need one Application per portlet, or few ones 
with multiple Pages mounted for the various portlets.

- Tor Iver

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



SV: Hello World Portlet

2010-01-04 Thread Wilhelmsen Tor Iver
For Servlet 2.4/2.5 I have found (depending on container) that you need to add 
the dispatchers involved, like so:

   filter-mapping
   filter-namewicket.report/filter-name
   url-pattern/report/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherINCLUDE/dispatcher
dispatcherFORWARD/dispatcher
dispatcherERROR/dispatcher
   /filter-mapping

- Tor Iver

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



SV: More than one access denied page

2010-01-05 Thread Wilhelmsen Tor Iver
 I would like to have two access denied pages according to some
 parameters.
 Is this possible?

In your implementation of IUnauthorizedComponentInstantiationListener check for 
the parameters (e.g. placed into the request or the like) and set a different 
responsepage or redirect to a different page based on this.

- Tor Iver

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



SV: Wicket and portlets JSR 286

2010-01-05 Thread Wilhelmsen Tor Iver
 I am having a problem finding a resource or an example for portlets
 communications with events processEvent(EventRequest request,
 EventResponse response)
 how do I dispatch and event from wicket page? for example if I have a
 ViewPage and I need to send an event to a subscribed portlet , how do
 I do it ?

It seems WicketPortlet does not override GenericPortlet.processEvent() at least 
as of 1.4.3; try subclassing WicketPortlet and add @ProcessEvent(eventname) 
annotation to a method of your own.

As for routing you should be able to configure that in your container combined 
with the relevant elements in portlet.xml. Dispatching is done via the 
PortletResponse.setEvent() as the spec says.

- Tor Iver

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



SV: SV: Wicket and portlets JSR 286

2010-01-06 Thread Wilhelmsen Tor Iver
 java.lang.IllegalArgumentException: Payload has not the right class at
 org.apache.jetspeed.events.EventCoordinationServiceImpl.createEvent(Eve
 ntCoordinationServiceImpl.java:98) 

This is the portlet container complaining about:

 ReportType report = new ReportType();
 report.setReportPath(SomePath);
 response.setEvent(qname, report);

Keep in mind that the XML event definition declares both the qualified name and 
the payload class; Jetspeed apparently checks that the object is of the 
declared type. What is your event definition?

- Tor Iver

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



SV: DiskPageStore file increasing to max size by only refreshing a HomePage

2010-01-07 Thread Wilhelmsen Tor Iver
 hmmm... but we are talking about something very basic: the home page!

Have you set it unversioned? How about trying to make it stateless?

- Tor Iver


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



SV: DiskPageStore file increasing to max size by only refreshing a HomePage

2010-01-07 Thread Wilhelmsen Tor Iver
 about unversioned, i have just done a quick test on wicket-examples 
 helloworld, adding serialVersionUID (not informed in the examples) and
 the
 result is the same: pagestore file increasing to the infinite (max
 size of
 course :)

I meant Wicket's

setVersioned(false);

the serialVersionUID is just for binary serialization, as long as the fields do 
not change the computed value the VM generates for you should be the same.

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



SV: Any servlet filter- like WebRequest interceptor or filter ?

2010-01-11 Thread Wilhelmsen Tor Iver
 public RequestCycle newRequestCycle(Request request, Response response)
 {
 ServletWebRequest servletWebRequest = (ServletWebRequest) request;
 HttpServletRequest hreq =
 servletWebRequest.getHttpServletRequest();
 ServletContext context = hreq.getSession().getServletContext();
 WebApplicationContext wac =
 WebApplicationContextUtils.getWebApplicationContext(context);
 final UserDao userDao = (UserDao) wac.getBean(userDao);
 
 It works too , but it is much ugly...

I think it would improve if you instead did

@SpringBean
UserDAO userDAO;

to let the InjectorHelper do its magic.

- Tor Iver

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



SV: Help with Wicket Adoption Numbers

2010-01-12 Thread Wilhelmsen Tor Iver
 you've got to admit it's a short distance between bloody fist fights in
 a
 basement for no purpose whatsoever and using struts.

Hm, it seems the slogan Struts 2: Not As Bad As Struts 1 did not catch on.

- Tor Iver


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



SV: Wicket Portlets and Liferay

2010-01-13 Thread Wilhelmsen Tor Iver
We are running Wicket + Liferay (Webspace) in Glassfish 2, and experience no 
problems; IIRC Glassfish uses the same Catalina engine as Tomcat?

 
 For AJAX/resource requests, another supports element for mime-type
 text/xml is needed.

This sounds like a Tomcat issue, our portlets use Ajax fine without such a 
mime-type setting.

 2) Name congruence in deployment descriptors
 
 The name in the pattern under //filter-mapping/url-pattern in web.xml
 (e.g. /testPortlet/*) has to match with the value under
 //portlet/portlet-name in portlet.xml, otherwise the portlet will not
 be
 rendered, or you get StackOverflowExceptions in LR.

Again, possibly a Tomcat issue, in Glassfish we use e.g. a name 
LocalMessagesPortlet with the filter-mapping /localmessages/* with no issues

 The requested resource (/hellowicket-portlet-1.0-
 SNAPSHOT/testPortlet/)
 is not available. instead of the actual portlet content.

I would recommend using a more readable build/finalName pom.xml setting instead 
of the version-appended artifact name unless you want to deploy multiple 
versions.

- Tor Iver

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



SV: The Field 'emailInput' is required

2010-01-21 Thread Wilhelmsen Tor Iver
 I have a Form with the id=test and a Textfield=EMAIL.

Claim the first, then:

 The Textfield I added with add(new RequiredTextFieldString(emailInput)).

Claim the second.

These conflict, because the id used in the actual code is emailInput.

 test.EMAIL.Required=test
 EMAIL.Required=test

So that needs to have EMAIL replaced with the id used which was emailInput.

HTH. HAND. :)

- Tor Iver

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



Re: Wicket and (or) restlet

2009-04-07 Thread Wilhelmsen Tor Iver
 Jonathan, can you elaborate? Why do you think jersey is 
 better? Have you any experience of integrating it with wicket?

We use Jersey for REST here, mostly because it is Sun's reference
implementation of JAX-RS (and thus will most likely be updated fastest).
As for the options:

* Restlet: Implemented the REST ideas in a custom way before JAX-RS was
specced, spec support seems crowbared in
* RestEasy: Is a JBoss project, and there is as always a certain danger
of the fish hook that leads you into the rest of the JBoss stack. Now,
we are probably going to use JBoss ESB for some service orchestration,
but their ESB will not support REST-based services (I think only Mule
and ServiceMix do at the moment) until the 5.0 release which is a way
off.
* CXF: Axis and Xfire had a child, but it might be that it ends up as a
bloated mess since they are trying to implement all sorts of services in
one library. We do use it for SOAP services though.

What you need to be aware of is that the JAX-RS spec is purely server
oriented, and each implementation adds its own extension (like client
libraries and proxying, content type support, JAXB/JSON magic etc.) so
you do run the risk of vendor lock-in whichever you pick. But can you
really have vendor lock-in over free stuff? :)

Wicket could conceivably be morphed into a top layer to REST services
(human-oriented interaction using forms and resource links), but to work
seamlessly you probably end up with some very hairy URL coding
strategies, resource models etc. that could make wicket-rest break
Wicket for ordinary MVC purposes if running in the same webapp...

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



Breadcrumbs and raw URLs

2009-04-20 Thread Wilhelmsen Tor Iver
We have an issue where we are using a CMS that provides an API for
getting article components in a peculiar way: Links are sent over as a
raw HTML element followed by a link element followed by the rest of
the HTML. So a link like a href=http://foo/fie; is sent as 
1. HTML: a href=
2. Link: EXTERNAL, http://foo/fie
3. HTML: 

Now, some of these links are article ids that we want to turn into
wicket-extensions breadcrumb links in a BreadCrumbBar. Using the
BreadCrumbLink does not work since we don't actually have a HTML
template element to apply the Link to. 

Is there a way to use urlFor() or the like to create links that updates
the breadcrumb model with our BreadCrumbPanel subclass for the linked
id, i.e. IBreadCrumbModel.setActive(new ArticlePanel(...))?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no




Re: Breadcrumbs and raw URLs

2009-05-07 Thread Wilhelmsen Tor Iver
 Is there a way to use urlFor() or the like to create links 
 that updates the breadcrumb model with our BreadCrumbPanel 
 subclass for the linked id, i.e. 
 IBreadCrumbModel.setActive(new ArticlePanel(...))?

*crickets*

Anyway, I finally found the likely answer in the form of an extended
PageRequestTarget.

However, it seems the call to urlFor() returns a link that does not
invoke the code as expected; it just re-renders the same page and panel
instead of invoking my object. Am I doing something wrong regarding the
urlFor call? Does the request target object need to be registered
somewhere?

// ...

CharSequence urlFor = RequestCycle.get().urlFor(new
ChangeArticleRequestTarget(getPage(), token.getLinkData()));


public static class ChangeArticleRequestTarget extends
PageRequestTarget {

private String articleId;

public ChangeArticleRequestTarget(Page page, String
articleId) {
super(page);
this.articleId = articleId;
}

@Override
public void respond(RequestCycle requestCycle) {
Page page = getPage();
BreadCrumbBar bar = (BreadCrumbBar)
page.get(breadCrumbBar);
try {
ArticlePanel newPanel = new
ArticlePanel(articlePanel, bar, new
ModelInteger(Integer.valueOf(articleId)));
page.replace(newPanel);
bar.setActive(newPanel);
page.dirty();
}
catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

super.respond(requestCycle);
}



}

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



SV: Wicket SWFObject

2009-05-08 Thread Wilhelmsen Tor Iver
 I just figured out that the deal is that SWFObject doesn't 
 like to be set visible false on page load then visible true via Ajax.
 
 Any thoughts on how to get around this?

Ajax in Wicket needs the page DOM to have an element with the id it is
supposed to replace with the output of a (now visible) component; by
default an invisible Wicket component has no output at all.

The traditional way to overcome this is to call
setOutputMarkupPlaceholderTag(true) on the (initially invisible)
component when you add it; that will make Wicket insert an empty element
with the required id. (It also implicitly calls setOutputMarkupId(true)
which is something else that the Ajax support needs to work properly.)

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



SV: Component creation and initialization

2009-05-17 Thread Wilhelmsen Tor Iver
 2 - A constructor is for constructing - your object should 
 not be in an incomplete state when the constructor is 
 finished (such a state that methods such as isVisible can not 
 be called)

Tha language ensures that the object is complete when the constructor
exits, but with the exception of immutalbe objects, as a component it
is not complete. People are e.g. adding to lists at runtime, leading to
possible subcomponent initialiation later on in the relevant method of
a Loop or ListView for instance. It could also be argued for instance
that a LoadableDetachableModel is /intentionally/ incomplete when the
constructor exits. Overriding methods like isVisible() is also a form of
hack to postpone a property value to a later time (basically the
component stops having a real property called visible since the setter
modifies a variable that the getter does not care about).

The desire to have completeness after constructor completion also runs
afoul with modern ideas like IoC where it is left to an outside agent to
complete configuration of a component.

However, I agree that the attention of the thread originator should be
on the models.

- Tor Iver

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



Custom FeedbackPanel in portlets

2009-05-18 Thread Wilhelmsen Tor Iver
I made a FeedbackPanel to apply the Portlet 2.0 CSS classes to relevant 
messages. In my naïvetè I assumed I could just override 
getCSSClass(FeedbackMessage), but that is called both to set a style on the 
li item AND on the contained span element. Is there any reason for this, 
especially since the HTML template has class attributes on both of them and 
thus applies it to both? I ended up making a HTML template leaving out the 
class attribute on the span, but still...

(Quoth the source:)

final Component label = 
newMessageDisplayComponent(message, message);
final AttributeModifier levelModifier = new 
AttributeModifier(class, replacementModel);
label.add(levelModifier);
listItem.add(levelModifier);
listItem.add(label);


Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no




Re: inserting urls in script variables

2009-06-12 Thread Wilhelmsen Tor Iver
   param name=file value={{URL HERE}}

Put some wicket:id on that, then add a WebComponent for it that you add
an AttributeModifier to, which sets the value attribute.

 When I try to do the obvious, replace the {{URL_HERE}} part 
 with span wicket:id=downloadMsf/span  it complains 
 about non-valid XML and such.

There are basically two groups of web frameworks: 

The strict group parses the HTML in the templates and (if they use
their own tags) requires the templates to conform to XHTML syntax. Tags
and attributes specific to the framework form parts of proper XML
namespaces. Wicket, Facelets and Tapestry belong to this group as far as
I know. These are the more powerfuil since they can manipulate the DOM
at render time while maintaining a designer-friendly template without
too much mess. 

The lenient group only bothers with its own tags/commands etc. and
treats the rest of the template as just text that should be outputted to
the stream without a question about structure. JSP, Velocity, Webmacro
and many others belong to this group, which is large because it is far
easier to write parsers for this approach, for some definitions of
easier :). This is the reason you can do e.g. a href=%= url % in
JSP because JSP turns that into outputting of the string a href=\,
the value of url, then the string \. It never sees the a element.
However, since it deals with JSP and JSTL tags in the same step, you
cannot do e.g. c:if test=%= somevariable % but need to use EL
instead. 

(Did I mention that JSP is a horrid mess and EL is just mascara on a
pig? Well, consider it mentioned. :) )

- Tor Iver

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



SV: Two null choices in a DropDownChoice?

2009-06-15 Thread Wilhelmsen Tor Iver
 Does anyone know of a simple way to have more than one option 
 with a null value in a DropDownChoice?

Well, how would you disambiguate between them? Null usually means
unset in the context of DDC, but here you have semantic meanings to
the choices, so they should be real objects.

A better solution is to have constant values that you treat specially,
e.g. if the domain objects are of type Name, add two elements at the top
of the list for the DDC.

public class Name {

public static final Name ANY_VALUE = new Name(-1, --- Any Name
);
public static final Name NO_MATTER_VALUE = new Name(-2, ---
Names Don't Matter );

...
private int id;
private String name;
...

}

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



SV: redirect to mailto

2009-06-26 Thread Wilhelmsen Tor Iver
 How do I redirect to a mailto: url? This doesn't seem to work:

Mailto is a browser-managed protocol that does not use http; and the
Ajax response does not go to the browser but is analyzed by the Ajax
implementation. 

Perhaps adding custom Javascript in the requestTarget to do a
window.open() on the URL will work, but that is as close as you get
unless you want to ditch the use of Ajax.

- Tor Iver

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



SV: Test Methods for Querying Component Tree

2009-07-10 Thread Wilhelmsen Tor Iver
 To address this, I wrote some code that gets the component tree, and
 either returns a List, or a string with the components' id's and
 classes. It can be found at http://gist.github.com/144041.
 
 Is this useful to anyone?  Is there a better way for me to view the
 component tree at runtime/test time?

WicketTester has #debugComponentTrees() which seems to do most of what you 
want, or you can use WicketTesterHelper#getComponentData(). Do they cover the 
same needs as your code?

- Tor Iver

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



Re: Wicket pages as actions

2009-08-06 Thread Wilhelmsen Tor Iver

 http://localhost:8080/web/?wicket:interface=:3:logout::ILinkListener::
 
 I don't see the need to expose implementation details (i.e. ?wicket in
 the
 URL) at this point. Therefore, does it make more sense that the
 LogoutPage
 (the response page) itself performs the logout action? The link for
 logging
 out would then simply become a bookmarkable link to the logout page.
 For
 some reason, this doesn't really feel right to me, though.

It does make sense to me; in that case you just mount(/logout, 
LogoutPage.class); in your app, and sign out in a suitable method. Having it as 
a separate page you can also give a goodbye message to the user.

 I'd much rather keep the functionality as is and, instead, have the URL
 disguised. I do understand the basics of URL mounting and encoding but
 don't
 understand how I can use it to disguise this particular scenario.

Try looking into the relationship between IRequestTarget (which you can 
reimplement your button as) and IRequestTargetUrlCodingStrategy and/or urlFor().

- Tor Iver

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



SV: pannels with diffrent width and height

2009-08-10 Thread Wilhelmsen Tor Iver
 I have created panel.now i want to show that panel with diffrent width
 and
 height  in another page(3 panels).

div wicket:id=panel1 style=height: 100px; width: 50px
Will be replaced with contents of wicket:panel element
/div

Or betters, use classes in nested elements that you specify outside of the 
templates.

- Tor Iver

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



SV: pannels with diffrent width and height

2009-08-10 Thread Wilhelmsen Tor Iver
 it will place one bye one
 but i need next to next.column wise

Well, either use a Table with three columns to represent the panels or use div 
with CSS float: etc. in the page template.

- Tor Iver

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



SV: How to handle Runtime Exception in wicket?

2009-08-13 Thread Wilhelmsen Tor Iver
 how to redirect to external url say www.google.com in case
 runtimeexception
 occurs

You need to drill down to the HttpServletResponse and call sendRedirect().

- Tor Iver

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



SV: Portlet and ... 2.0 (How to pass parameters?)

2009-08-13 Thread Wilhelmsen Tor Iver
 But it will be the portlet class the responsible for handling
 processing. So the only way to pass information from the onClick
 function to the
 portlet application for rendering (for example) is using the portlet
 session.

But why would you want to go via the Application? The WicketPortlet is mostly 
just the front controller responsible for mapping between the portlet world 
and the Wicket world: Either use a custom WebSession for the portlet app, or 
pass the values you need in the PageParameters you send to the response page in 
your onClick()/onSubmit(). This assumes the onClick() is for a link on a Page 
that is part of the portlet application. Rendering is left to these Pages.

 I also saw that in the portlet example, the examples structure is
 initialized by the WicketExamplesMenuPortlet and sent to the
 WicketExamplesMenuApplication using the servlet context. But this will
 overbloat the servlet attributes storage space. Also this should be
 solved if webpages could access to the portlet class directly.
 
 Why to do this way?

The Examples portlet is a bit strange compared to how you would normally do 
things it seems.

 1.- Onclick: Put the Id on the session like above.
 2.- Portlet.DoView: Recover id from session and store it in
 shared render params.
 3.- Delete it from session.
 
 
 Is this the correct way to do it?

You could try making normal PortletURLs instead of using Wicket Link 
elements; use setProperty()/addProperty() to set the portlet parameter. 
Presumably Wicket's Portlet API implementation will deal with the mapping just 
as it does today with mapping to and from PageParameters.

- Tor Iver

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



SV: Override fragments in subclasses

2010-01-25 Thread Wilhelmsen Tor Iver
 So in my parent html :
 body
   span wicket:id=myDiv/span
   div wicket:id=myNewPanel/div
   div wicket:id=myNewPanel2/div
 /body
 
 And add a label with id myDiv in related parent java. This part is
 common to all classes.
 
 But when I render the TestFormOne, that doesn't work because,
 apparently the label myDiv must be define in subclass.

You should add a default component for it in the parent class then use 
replace() in subclasses as needed.

- Tor Iver 


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



SV: SV: Override fragments in subclasses

2010-01-25 Thread Wilhelmsen Tor Iver
 public abstract class TestForm extends WebPage {
 
 public TestForm() {
 add(new Label(myDiv, my div from test form)); = common to
 every
 concrete page
 add(createDivWithComponent(myNewPanel)); = has to be
 redefine by
 each concrete page
 add(createDivWithComponent2(myNewPanel2)); = has to be
 redefine
 by each concrete page
 
 }
 
 protected abstract WebMarkupContainer createDivWithComponent(String
 divId);
 
 protected abstract WebMarkupContainer
 createDivWithComponent2(String
 divId);
 }

An alternative is to have these either provide default/null components or throw 
WicketRuntimeExceptions.

 
 body
 
   div wicket:id=myNewPanel/div
   div wicket:id=myNewPanel2/div
 /body
 


 protected WebMarkupContainer createDivWithComponent2(String divId)
 {
 WebMarkupContainer container = new WebMarkupContainer(divId);
 WebMarkupContainer container2 = new WebMarkupContainer(div1);
 container2.add(new Label(label2,My very good label 2));
 container.add(container2);
 return container;
 }
 
 }
 
 body
 
   div wicket:id=myNewPanel/div
   div wicket:id=myNewPanel2/div
 /body

That markup is missing the div1 and label2 markup, but it does not get that 
far because

 And this is the error message I get : 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).1. [Component id = myDiv]

... this means that there is no markup for the component you added at the start 
of the parent constructor:
add(new Label(myDiv, my div from test form));

- Tor Iver



SV: Repeating View Horizontally

2010-01-28 Thread Wilhelmsen Tor Iver
 How do you make repeating view to repeat the items horizontally? The
 number
 of items is not known at the time of creating the markup.

Repeaters do not care about horizontal vs. vertical; it all comes down to the 
markup.

E.g. you can have a ListView which generates a sequence of table cells:

trtd wicket:id=myListspan wicket:id=subelementSubelement 
here/span/td/tr

where you have a new ListViewFoo(myList, ...)

- Tor Iver

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



Re: Save a form's markup

2010-02-02 Thread Wilhelmsen Tor Iver
 I would like to save a form's markup as a string when the form's submit
 button is pressed. The part that I am having difficulty with is
 understanding how to use wicket to grab a form's rendered markup. I
 have a
 feeling it must be pretty simple, but I'm getting lost in the wicket
 documentation. Any tips?

Look at org.apache.wicket.response.StringResponse and examples using that.

- Tor Iver

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



Re: Very strange exception

2010-02-03 Thread Wilhelmsen Tor Iver
 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).

When you do

add(new Label(label, ...

in a Page, you also need something like

span wicket:id=labelThis gets replaced/span

in your HTML template.

- Tor Iver

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



SV: Fix super(new CompoundPropertyModel(this)) error in the WIA book

2010-02-05 Thread Wilhelmsen Tor Iver
   super(new CompoundPropertyModel(this));

This seems wrong: A call to super() cannot reference this directly or 
indirectly:

JLS §8.8.7 says:
It is a compile-time error for a constructor to directly or indirectly invoke 
itself through a series of one or more explicit constructor invocations 
involving this.

- Tor Iver

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



Re: How reRender a component from parent page?

2010-02-09 Thread Wilhelmsen Tor Iver
 The problem are in HomePage.java in the onClick... this don't reRender
 my componente in the header.

Are you sure? The real problem seems that your itens label uses an implicit 
model based on the constructor-time value of getAmount(), and which is never 
changed.

Look into using a model instead, e.g. a StringResourceModel with a substitution 
based on a PropertyModel that gets the amount from the cart.

- Tor Iver

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



SV: Frames for layout

2010-02-10 Thread Wilhelmsen Tor Iver
 Yes, but don't do that. Frames were outlawed in 2001 and should stay
 that way.

+1

Frames create a shedload of problems both for the developer and for the user

- Tor Iver

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



Authorization and

2010-02-12 Thread Wilhelmsen Tor Iver
We have an app with three user types and two user levels (read  or 
read-write in effect). We want to use these in authorization, and thought about 
an approach using annotations. However, at the point of the Wicket auth. 
interface methods, only class-targeted annotations are visible, and that will 
lead to excessive subclassing (especially since Java does not let you annotate 
anonymous inner classes).

Would it be a better approach to use behaviorless Behavior objects that we 
add to the relevant components and look for in isActionAuthorized()?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





SV: Quick fix for the dreaded org.hibernate.LazyInitializationException with WicketTester

2010-02-16 Thread Wilhelmsen Tor Iver
 After about 5 minutes of omfg not that error again, I think I found a
 quick hack to avoid org.hibernate.LazyInitializationException with
 WicketTester. I've checked everywhere on the lists but didn't find a
 similar
 solution, so apologies if someone else already posted this. There may
 also
 be a better way to do it.

I thought the medicine against LazyInitializationException was 
spring-hibernate's OpenSessionInViewFilter, where you leave to the filter to 
open and close the session at the beginning and end of the request?

- Tor Iver

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



SV: [OT] Apache con 2010 europe, when?

2010-02-25 Thread Wilhelmsen Tor Iver
Then there is JavaZone in Oslo later on.

- Tor Iver


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



Re: format float/double in dataview

2010-02-26 Thread Wilhelmsen Tor Iver
 new SimpleAttributeModifier(text-align, right) on the Label?

text-align is not a known attribute. It is a CSS property so 
SimpleAttributeModifier(style, text-align: right) could work, or there is 
an attribute align that may or may not be OK depending on HTML spec.

- Tor Iver

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



SV: Make Wicket component ID HTML element ID?

2010-02-28 Thread Wilhelmsen Tor Iver
 I notice one thing that is not what I want: instead of generating
 wanted HTML element ID such as signInOut or feedback, Wicket added
 one number or letter to wicket ID as HTML element ID (for example:
 signInOut4, feedbackb).
 
 How can I overcome this?

Are you sure you want to? Do you use any repeaters (ListView, Loop, 
RepeatingView)? In that case you actually want this disambiguation so that you 
don't end up with multiple elements with the same id which messes with any Ajax 
you want to use.

- Tor Iver

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



SV: How to Store Wicket to XML File?

2010-03-08 Thread Wilhelmsen Tor Iver
  Any one Have idea about how to Store wicket fields(TextField) to
 XML
 File?

Why would you want to do that? Usually you only store the model value, storing 
the field itself is only relevant for the page serializing.

- Tor Iver

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



SV: Where to use MarkupStream

2010-03-09 Thread Wilhelmsen Tor Iver
 How to use Markupstream? where to use ?

You use that normally only when you need to make very custom code, e.g. your 
own tags. For most other situations, adding Behaviors is the preferred way of 
altering components.

- Tor Iver

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



Re: Announcing: visural-wicket 0.5 released - open source wicket components

2010-03-10 Thread Wilhelmsen Tor Iver
 hello, I have another problem, with DropDown this time. If I have only
 one
 DropDown on my page, everything works great. But when I add another
 DropDown
 to the page, with diferent datasource, the first DropDown shows data
 from
 the second datasource. All DropDowns share the same datasource.

The only explanation I have is that somehow you are reusing the same underlying 
model for the two dropdowns... Or rather that when you configured the model for 
the second you overwrote configuration of the first. Remember to create new 
model objects.

- Tor Iver

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



SV: why is hashcode() called on page deserialization?

2010-03-15 Thread Wilhelmsen Tor Iver
 java.lang.NullPointerException
  at com.company.project.event.SMSEvent.hashCode(SMSEvent.java:334)

This looks a lot like an exception we get in one project as well, where a bean 
serialized into the DiskPageStore comes back with all properties set to null 
(including the ones tested for in hashCode() thus the NPE). Could this have 
happened during serialization, i.e. that the object write operation somehow 
failed to write any properties? The bean in question does not have any 
transient fields, and there is no custom object writer or reader.

- Tor Iver

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



SV: Replace Choose one from DropDownChoice?

2010-03-17 Thread Wilhelmsen Tor Iver
Also setNullValid(true) otherwise the blank option will disappear once you have 
made a choice or the model has a value.

- Tor I.


 -Opprinnelig melding-
 Fra: Martin Asenov [mailto:mase...@velti.com]
 Sendt: 17. mars 2010 15:23
 Til: users@wicket.apache.org
 Emne: RE: Replace Choose one from DropDownChoice?
 
 I don't understand , Chang...
 
 If you want non selection to be  , then say
 
 null=  (without the quotes)
 
 Otherwise if you don't want null selection, you say
 component.setNullValid(false); and you're fine
 
 Best,
 Martin
 
 -Original Message-
 From: David Chang [mailto:david_q_zh...@yahoo.com]
 Sent: Wednesday, March 17, 2010 3:48 PM
 To: users@wicket.apache.org
 Subject: RE: Replace Choose one from DropDownChoice?
 
 Martin,
 
 Thanks so much for chiming in. I tried the
 
 null=
 
 approach. The blank line in the dropdown list simply disappears. As I
 said in my requirements, I hope to have it there no matter whether a
 value is selected or not, no matter whether it is a required field or
 not.
 
 Again, thanks for help!
 Best,
 David
 
 --- On Wed, 3/17/10, Martin Asenov mase...@velti.com wrote:
 
  From: Martin Asenov mase...@velti.com
  Subject: RE: Replace Choose one from DropDownChoice?
  To: users@wicket.apache.org users@wicket.apache.org
  Date: Wednesday, March 17, 2010, 9:08 AM
  Hi, David!
 
  Let's presume your webapplication class is called
  WebApp.java. In the same directory where it is present,
  create WebApp.properties with the following line:
 
  null=
 
  that way every single 'choose one' label will be replaced
  with .
 
  P.S. Don't forget to include the props files in the pom as
  a resource.
 
  Best,
  Martin
 
  -Original Message-
  From: David Chang [mailto:david_q_zh...@yahoo.com]
 
  Sent: Wednesday, March 17, 2010 3:03 PM
  To: users@wicket.apache.org
  Subject: Replace Choose one from DropDownChoice?
 
 
  Hello, I understand that there must be a solution for this.
  I googled for some time and found one or two results that
  seem to match what I am looking but they did not answer my
  question. Tried myself, not successful. So I want to ask
  folks here. I have a form and it has a dropdown list. Here
  are my requirements:
 
  1. Replace Choose one with a blank line
 
  2. This blank line is the first option and it is always
  listed no matter whether a value is selected or not, no
  matter whether the form field of this dropdown list is
  required or not.
 
  3. I am using ChoiceRenderer to convert between selection
  and objects.
 
  4. This behavior is applicable to all DropDownChoice.
 
  How can meet these requirement?
 
  Thanks for your help!
 
  Regards.
 
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


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



SV: Make FeedbackPanel occupy zero space when having no messages?

2010-03-18 Thread Wilhelmsen Tor Iver
 How can I make FeedbackPanel occupy zero space when having no messages?

Override isVisible() to test if there are any messages to show, and call 
setOutputMarkupPlaceholder(true);

- Tor Iver

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



SV: Text replace with component

2010-03-22 Thread Wilhelmsen Tor Iver
 Now I want to replace %destinationLink% with new BookmarkableLink(...);
 
 I am using GNU Gettext translations(.po files), thats why such
 solution...
 
 Is it possible or is there any reasonable way to do this?

Look into the various urlFor() methods. In your case in particular 

String url = RequestCycle.get().urlFor(SomePage.class, somePageParameters);

- Tor Iver


Re: A web site developed with Wicket

2010-03-22 Thread Wilhelmsen Tor Iver
 After using CSS for layout things for two years my summary is:
 
   Use tables for layout, CSS for the rest
 
 It it simple, it works, and it doesn't break in each new version of IE

The question then becomes: what do you use to lay out tabular data? :)

(IE is broken in all versions, and its CSS support is lacking (see the 
euphemism there). Users should be encouraged to switch; to adapt web design to 
cater for it is akin to avoid using words missing from a spell checker's 
incomplete dictionary when writing. You should not have to adapt to software 
bugs.)

- Tor Iver

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



SV: Displaying HTML

2010-04-06 Thread Wilhelmsen Tor Iver

 I
 want to display the same on for example a label, is there any component
 that
 displays the text as HTML , i mean i dont want to see the tags, i want
 to
 see some formatted text.

Use a Label, but call setEscapeModelStrings(false) on it.

-- 
- Tor Iver

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



SV: IE6 issue regarding Wicket JS and Ajax

2010-04-12 Thread Wilhelmsen Tor Iver
 its a browser from August 27, 2001 ... thats 9 years ago..
 
 So who is using opera 6 ? Or Netscape 7? Or Safari 1.0 ?

Sadly, IE6 is also a central component in some Active/X-based apps used in some 
companies, apps which actually manage to BREAK on newer releases of IE. So they 
are held captive by those apps until they are rewritten...

- Tor Iver

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



SV: uploadprogressbar

2010-04-13 Thread Wilhelmsen Tor Iver
 Hi,
 I'm trying to use an upload progressbar,
 the problem is that it does not appear whent I use an ajaxsubmit button
 but
 appears when i used the form onSubmit method.
 what could be the problem.

Possibly it starts out invisible, and in that case you need to call 
progressbar.setOutputPlaceholderTag(true) in order to have something there for 
Ajax to update.

- Tor Iver

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



SV: Question on close button of modal windows

2010-04-15 Thread Wilhelmsen Tor Iver
 You could do it with JQuery directly, or implement WiQuery dialog.

The latter is preferrable, because if you close a ModalWindow in the browser 
with no roundtrip then the server side state will not be notified that it is 
closed, and thus might reappear if the page is refreshed as a whole.

- Tor Iver

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



SV: Type Inference for Wicket 1.4

2010-04-15 Thread Wilhelmsen Tor Iver
 ModelMySuperLongNameForASimpleFooObject model = Model.newModel();

Go on a hike in the Greek islands for six months, when you come back download 
Java 1.7 where you can do neato stuff like

ModelMySuperLongNameForASimpleFooObject model = new Model();

Or use an IDE which automatically fills the second set of braces for you (I 
think most except Apple's XCode do).

(Young whippersnappers have it too easy - imagine back in the day, typing - in 
vi, with no code completion - insanely long namespace-mangled names of C 
methods in libraries like Xt...)

- Tor Iver

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



SV: Shadow text on input fields

2010-04-26 Thread Wilhelmsen Tor Iver
The problem is not the Wicket side of things, but the browser side. Should 
Wicket test for HTML 5 support, and fall back to a Javascript hack?

- Tor Iver

 -Opprinnelig melding-
 Fra: Josh Kamau [mailto:joshnet2...@gmail.com]
 Sendt: 26. april 2010 13:29
 Til: users@wicket.apache.org
 Emne: Re: Shadow text on input fields
 
 I wish we could have something like myTextField.setDefaultText(Type
 text
 here);
 
 On Mon, Apr 26, 2010 at 11:55 AM, Josh Kamau joshnet2...@gmail.com
 wrote:
 
  Thanks Marjtin
 
 
  On Mon, Apr 26, 2010 at 11:27 AM, Martijn Dashorst 
  martijn.dasho...@gmail.com wrote:
 
  If you can get away with it, you can use HTML5's placeholder text:
 
  http://diveintohtml5.org/forms.html
 
  Martijn
 
  On Mon, Apr 26, 2010 at 9:19 AM, Josh Kamau joshnet2...@gmail.com
  wrote:
   Hi guys;
  
   I would like to put some shadow text on the form input fields that
   disappears when one starts editing the field. The kind that
 appears on
   facebook fields. How do i do it. Most likely its not a wicket
 issue but
  i
   really need assistance in this. Am not very good in javascript.
  
   Kind regards
  
   Josh
  
 
 
 
  --
  Become a Wicket expert, learn from the best:
 http://wicketinaction.com
  Apache Wicket 1.4 increases type safety for web applications
  Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.7
 
  
 -
  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



SV: DropDownChoice problem

2010-04-28 Thread Wilhelmsen Tor Iver
 After adding the dropdown to the form, i am able to save the record
 properly. However, when i display a  form with an existing record,
 
 the DropDownChoice is not showing the current 'nationality' and it is
 only
 showing Choose One;

Sounds like Wicket gets confused regarding value/id, try setting an 
IChoiceRenderer, e.g.

lstNationality.setChoiceRenderer(new ChoiceRenderer(name, id));

- Tor Iver

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



SV: wicket:message attribute in regular html tags with child components

2010-04-29 Thread Wilhelmsen Tor Iver
 i meant where do you expect the localized message to be rendered into?
 if wicket:message is attached to the table tag?

Well, since he is using the attribute version of wicket:message, I guess he 
expects the output from

  table wicket:message=summary:myresource

to be

table summary=localized message with key myresource

- Tor Iver



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



SV: Error out in middle of page without filling in remaining components

2010-05-02 Thread Wilhelmsen Tor Iver
 Let's say you encounter an error halfway through the constructor of a
 page,
 and you want to display error(error message) and then return without
 processing rest of components?  It doesn't seem like this is possible
 in
 wicket because it makes you fill in all components or else it barfs.
 Am I wrong, or is there a way to do this in wicket?

1) Ideally, a constructor does NOTHING other than
   - validate arguments, and throw necessary exception if they are wrong
   - set properties (no side-effects) that will be used by other business 
methods later

In Wicket, Swing etc., the latter also covers setting up component hierarchies. 
So actual errors should only appear later, e.g. as a consequence of a LDM 
failing to connect to a database at render time.

2) If that is not an option, the way to interrupt a constructor is the same way 
as for any other method, throw and exception. For instance a 
WicketRuntimeException.

- Tor Iver


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



TinyMCE + TextArea + Jackrabbit

2010-05-04 Thread Wilhelmsen Tor Iver
Using wicketstuff tinymce 1.4.1 attached to a TextArea, it seems I cannot get 
it to stop escaping the resulting HTML:

TextAreaString textArea = new 
TextAreaString(threadSubjectTextInput, new ModelString());
textArea.setEscapeModelStrings(false);
TinyMCESettings settings = new TinyMCESettings();
settings.setToolbarLocation(TinyMCESettings.Location.top);
TinyMceBehavior behavior = new TinyMceBehavior(settings);
textArea.add(behavior);

Obtaining value:
String article = 
getForm().get(threadSubjectTextInput).getDefaultModelObjectAsString();

Setting property on JCR node:

articleNode.setProperty(articleText, article);

Rendering the output from the Jackrabbit Node:

   articleItem.add(new Label(forumArticle, 
article.getArticleText()).setEscapeModelStrings(false));

Is there some other code which might escape the HTML?

Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





SV: TinyMCE + TextArea + Jackrabbit

2010-05-04 Thread Wilhelmsen Tor Iver
 Using wicketstuff tinymce 1.4.1 attached to a TextArea, it seems I
 cannot get it to stop escaping the resulting HTML:
 
 TextAreaString textArea = new
 TextAreaString(threadSubjectTextInput, new ModelString());
 textArea.setEscapeModelStrings(false);
 TinyMCESettings settings = new TinyMCESettings();
 settings.setToolbarLocation(TinyMCESettings.Location.top);
 TinyMceBehavior behavior = new TinyMceBehavior(settings);
 textArea.add(behavior);

Forget it, it was code from a copy  paste developer, worked when I added the 
escape call to the other copy of this code... 

- Tor Iver

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



SV: Best practises question

2010-05-18 Thread Wilhelmsen Tor Iver
 Well, I think that's quite obvious when you consider that each page is
 the root of a tree (not directed, acyclic graph) of components.
 Each component can have at most one parent.

But you can pass a component to a different page/component without adding it; 
like in the example of having a back link which wants a page to navigate back 
to. If you keep that Page in an instance variable in the back-from Page you 
will needlessly serialize that, too, unless you use a PageReference.

- Tor Iver

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



SV: Request Https page

2010-05-19 Thread Wilhelmsen Tor Iver
 https://localhost:8080/test

Typically, a container will have a HTTPS-enabled connector on a different port; 
in Glassfish by default it is 8181, on Tomcat it is by default disabled but 
seems to have the value 8443 in a default server.xml (443 being the assigned 
port that you need root/admin privileges to open).

So if you enable it on Tomcat it would be

https://localhost:8443/test

- Tor Iver

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



SV: adding behaviours

2010-05-20 Thread Wilhelmsen Tor Iver
 hey, what is the prefered approach?

Try using an IVisitor you pass to visitChildren() in the outermost component.

- Tor Iver

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



Null from urlFor() on

2010-05-20 Thread Wilhelmsen Tor Iver
We are trying to tunnel some images from a content system, and run into a 
problem trying to make URLs for them via UrLResourceStream: Stepping through 
the code we see some instanceof-testing but none which deals with this 
particular resource type. Is there some missing code somewhere or a better 
approach to use?

WebMarkupContainer cont = new WebMarkupContainer(image);
try {
URL image = new 
URL(http://servername/servletname/path?parameter=velue;);
UrlResourceStream stream = new UrlResourceStream(image);
ResourceStreamRequestTarget target = new 
ResourceStreamRequestTarget(stream);
CharSequence link = urlFor(target); // RETURNS NULL
cont.add(new SimpleAttributeModifier(src, link));
} catch (MalformedURLException e) {
e.printStackTrace();
}
this.add(cont);


Med vennlig hilsen

TOR IVER WILHELMSEN
Senior systemutvikler
Arrive AS
T (+47) 48 16 06 18
E-post: toriv...@arrive.no
http://www.arrive.no
http://servicedesk.arrive.no





SV: Very interesting question... my boss complain about one of my implementations...

2010-05-28 Thread Wilhelmsen Tor Iver
 My boss said that it is not a good practice and he recomended  to use
 something like in Struts called Timers, do we have something like
 that in
 wickets¿?

Try looking into Quartz, a library for such things. The lack of a standard 
scheduling framework outside of JMX is a problem in JEE in general...

However, the Struts Timer seems to measure rendering time, so I am not sure 
why your boss thought that would help.

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/util/Timer.html

- Tor Iver


SV: DropDownChoice behaviour

2010-05-31 Thread Wilhelmsen Tor Iver
 I would like to know what's the outcome of setting setNullValid(true) -
 -
 is it that the choices will start with an empty string choice?

The empty choice is there for null model objects whether nullValid is true or 
false, the difference is that if you call setNullValid(false), then the option 
will be removed for non-null model values, and if you try and submit the form 
using a null value it will fail validation.

- Tor Iver



  1   2   3   >