Re: Transaction filters and redirection problem

2009-10-14 Thread Iain Reddick
ponse ); beginTransaction(); filterChain.doFilter( request, wrappedResponse ); doCommit(); endTransaction(); responseWrapper.doCachedRedirect(); ... You could easily put the redirect-delaying code in it's own filter, for re-usabilty. iainr Iain Reddick wrote: Hi, I'm working on a Wicket / Hib

Nullable resource link

2009-10-14 Thread Iain Reddick
Hi, I need to display a resource link conditionally, based on whether a resource exists, or is null. The resource itself is bytes in a database and should not be anchored to a component. How should I handle this, with regard to the resource being nullable? Thanks. iainr ---

Re: Nullable resource link

2009-10-14 Thread Iain Reddick
can't you check the resource before link is rendered? You can create a new resource object empty in the case of null bytesand setVisible(false) or extend link to do this automatically on empty resource... Luca 2009/10/14 Iain Reddick Hi, I need to display a resource link conditional

Re: Nullable resource link

2009-10-14 Thread Iain Reddick
; } } I then can override onPopulate() and add my children that depend on the nullable for construction. It's basically the logic equivalent of "if model is not null, add children". Iain Reddick wrote: I'm fishing for best practice in this type of situation - do I u

Re: Nullable resource link

2009-10-14 Thread Iain Reddick
lass ProvaLink extends ResourceLink { ResourceReference resourceReference; @Override public boolean isVisible() { if(resourceReference==null)return false; else return true; } } *hope to help... Luca 2009/10/14 Iain Reddick I think my best solution is to us

Re: Transaction filters and redirection problem

2009-10-14 Thread Iain Reddick
e? On Wed, Oct 14, 2009 at 5:19 AM, Iain Reddick wrote: For anyone in this situation (having to use a transaction filter), here is a solution that uses a response wrapper to delay the redirect until after the transaction has completed: private class DelayedRedirectWrapper extends HttpServ

Re: Model property name different than wicket:id, is possible?

2009-10-21 Thread Iain Reddick
Hi, You use it like this: (assuming myModel is the compound property model) Label idLabel = new Label("idLabel", myModel.bind("id")); This would give component id "idLabel", using property "id". CompoundPropertyModel.bind() basically returns a PropertyModel. iainr Manuel Corrales wrote:

Re: Best way to do a tracking Nav Bar in Wicket?

2009-06-04 Thread Iain Reddick
Why not just have each page be able to report the section it belongs to ( e.g. getSection() method ). The section navbar component can then simply call that method on it's page and update the bar accordingly. Ben Hutchison wrote: We need to build a Nav Bar that tracks & visually indicates what

XsltTransformerBehavior without component tags

2009-07-13 Thread Iain Reddick
Hi, We are trying to use XsltTransformerBehavior with pre-existing XSLT templates to display various kinds of XML data in a panel. While this is working fine, it looks as if we will have to modify our XSL to take account of the fact that the transforming component's tags become the root elem

Re: Accessing the rowItem from the populateItem of a column

2009-07-15 Thread Iain Reddick
cellItem.getParent().getParent() will get the row component, but it's not a very clean solution. Pierre Goupil wrote: Hello, Can't you just make the parent's field final and use : Parent.this.cellItem ? HTH, Pierre On Wed, Jul 15, 2009 at 11:33 AM, Lorenzo Bolzani wrote: Hi all, I nee

Re: Accessing the rowItem from the populateItem of a column

2009-07-16 Thread Iain Reddick
(); rowItem.add( new SomeBehaviour() ); } } ? Lorenzo Bolzani wrote: 2009/7/15 Iain Reddick : cellItem.getParent().getParent() will get the row component, but it's not a very clean solution. Hi, thanks for the replies. I'm using wicket 1.3.3 and this method was not yet presen

Re: Generic Navigation Panel

2009-07-22 Thread Iain Reddick
You can actually configure the tags that are put around a disabled link at application level, like this: getMarkupSettings().setDefaultBeforeDisabledLink( "" ); getMarkupSettings().setDefaultAfterDisabledLink( "" ); This would give *linktext* for disabled lnks (such as an autolink to the curre

Re: Disabled Auto link bookmarkable page

2009-07-24 Thread Iain Reddick
The wrapping markup used can be set via methods in AbstractLink: setAfterDisabledLink() setBeforeDisabledLink() or, you can set a default at application level: setDefaultAfterDisabledLink() setDefaultBeforeDisabledLink() Cassio wrote: Hello everybody! Does anyone know for what reason an dis

Re: Disabled Auto link bookmarkable page

2009-07-27 Thread Iain Reddick
the that replace the tag at org.apache.wicket.markup.html.link.AbstractLink.disableLink(final ComponentTag tag) method. code: // Change anchor link to span tag tag.setName("span"); 2009/7/24 Iain Reddick The wrapping markup used can be set via method

Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick
Surely this is what you want for a non-ajax solution: class MyPage extends Page { private TabbedPanel tabPanel; ... public MyPage() { tabPanel = new TabPanel(...); add( tabPanel ); ... confirmBtn = new Button("confirm") { private static final long serialVersionUID = 1L;

Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick
Sorry - I've re-read your initial post and see what your issue is. Iain Reddick wrote: Surely this is what you want for a non-ajax solution: class MyPage extends Page { private TabbedPanel tabPanel; ... public MyPage() { tabPanel = new TabPanel(...); add( tab

Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick
confirmBtn = new Button("confirm") { private static final long serialVersionUID = 1L; @Override public void onSubmit() { Page homePage = (HomePage)getPage(); homePage.getTabbedPanel().setSelectedTab(0); } }; Iain Reddick wrote: Sorry - I've re-read your initi

Components and nullable data

2009-07-30 Thread Iain Reddick
Hi all, One of the difficulties I am finding with wicket is the best practice when displaying/using data that is potentially null. Example: I have a "user" object which has a nullable "group" property. I want to show a link to the group details page when the "group" property is not null, bu

Components and nullable data

2009-07-31 Thread Iain Reddick
Is this kind of thinking worth pursuing? add(new Link("editgroup", user) { onclick() { ... } isvisible() { return user.getgroup()!=null; } } ? -igor 2009/7/30 Iain Reddick : > Hi all, > > One of the difficulties I am finding with wicket is the best practice wh

Re: Components and nullable data

2009-08-03 Thread Iain Reddick
ction) { if (action==component.render) { if (component.hasannotation(@HideIfModelIsNull)) { return false; } } return true; } you get this behavior for any component via a simple annot. -igor On Fri, Jul 31, 2009 at 6:39 AM, Iain Reddick wrote: Thanks for the reply - I

Re: Datepicker popup when textfield is selected

2009-08-14 Thread Iain Reddick
see: org.apache.wicket.extensions.yui.calendar.DateField http://static.ddpoker.com/javadoc/wicket-datetime/1.3.3/index.html copenhag copenhagen wrote: Hi, Would it be possible to make the datepicker popup whenever a textfield is selected? Thereby the textfield will be no editable, but only th

Re: Datepicker popup when textfield is selected

2009-08-14 Thread Iain Reddick
Sorry - misread your question. Iain Reddick wrote: see: org.apache.wicket.extensions.yui.calendar.DateField http://static.ddpoker.com/javadoc/wicket-datetime/1.3.3/index.html copenhag copenhagen wrote: Hi, Would it be possible to make the datepicker popup whenever a textfield is selected

Re: Truncating DataTable content

2009-08-24 Thread Iain Reddick
Create some kind of generic StringTruncatingModel that does the "..." truncation on getObject(). In DataTable.populateItem(), wrap the row model in a StringTruncatingModel, before passing to the Label being used to show the string? Linda van der Pal wrote: I thought it would be a cool idea t

Re: Truncating DataTable content

2009-08-24 Thread Iain Reddick
roblem. (I could easily truncate the data in the SortableDataProvider.) The main problem that requires met to dive deeply into the code is my requirement to also show the full data in a tooltip. Regards, Linda Iain Reddick wrote: Create some kind of generic StringTruncatingModel tha

Re: Dynamic Optgroups in Wicket

2009-09-01 Thread Iain Reddick
Looking at the API docs for the Select component, it would seem to be designed for more complex select situations (multi-select and optgroups). Unfortunately, I can't find any examples on using it with dynamically generated optgroups. Can anyone clarify how you would use the component like thi

DropDownChoice and hibernate entities

2009-09-04 Thread Iain Reddick
I'm having difficulty in seeing the best-practice way of handling DDCs who's choices are hibernate persisted entities. Obviously the selection in this case would be a reference to a persisted entity, which is inherently bad, as this would put the entity into the session and also result in a "s

Transaction filters and redirection problem

2009-10-09 Thread Iain Reddick
Hi, I'm working on a Wicket / Hibernate / Spring app, with a configuration that uses spring's OSIV filter and my own transaction filter (basically a transaction per-request pattern). I've run into a problem involving the order of transaction commits and redirect reponses (triggered by setRes

Re: Forms in a base class

2010-04-07 Thread Iain Reddick
If you want to use inheritance: Put your base form in a panel with the associated markup for the base fields (making sure there is a tag in the correct place). Then just extend this panel, adding the required "child" form components and supplying the appropriate markup extension (using ). Re

Re: How to pass object as parameter to popup window

2010-04-14 Thread Iain Reddick
The data you want to show on the page is transient, so it isn't really bookmarkable. Use a regular Link and give the page class a constructor that takes your DTO. Mathias Nilsson wrote: Session or pageParameters - To u

Re: New blog post "Components v.s. Pages"

2010-04-16 Thread Iain Reddick
Thanks - I think insights from more experienced wicket developers are very welcome at the moment. I agree very much with what you say in the post that it's hard to find information about the best "shape" for a wicket application to meet your needs. Also the comment re component swapping - I cer

Re: Form, panel and model reuse (newbie)

2010-04-29 Thread Iain Reddick
In reply to (6) and (7): 6) Do your construction in the constructor. 7) If the JFreeChartImage component implementation is the one seen here: http://wiki.github.com/tita/tita/wicket-jfreechart-tutorial , then it needs re-worked, as it only supports a static image. Instead, the constructor sh

Re: Basic page routing

2010-05-28 Thread Iain Reddick
mountBookmarkablePage is a convenience method for mounting the most common URL form. Look here for more info: https://cwiki.apache.org/WICKET/url-coding-strategies.html You can also create your and mount your own URL decoding strategies. - Original Message - From: "Mike Quilleash" To:

Show/hide form components best practice

2010-06-01 Thread Iain Reddick
Say I have a form with a check box that, when checked, shows some other field (i.e. it controls the visibility of other form components). What is the best approach to handling this? From what I understand, you have 3 options: 1. Add ajax behaviour to the check box (re-render relevant component

Re: Show/hide form components best practice

2010-06-01 Thread Iain Reddick
ns that on form submit, the hidden component will still be validated. Pedro Santos wrote: 2 or 3 since there is no relevant state on the server side you want to consider to implement the component visibility rule. On Tue, Jun 1, 2010 at 7:37 AM, Iain Reddick wrote: Say I have a form with a

Re: Show/hide form components best practice

2010-06-02 Thread Iain Reddick
s() On Tue, Jun 1, 2010 at 5:37 AM, Iain Reddick wrote: Say I have a form with a check box that, when checked, shows some other field (i.e. it controls the visibility of other form components). What is the best approach to handling this? From what I understand, you have 3 options: 1. Add aja

Re: Show/hide form components best practice

2010-06-02 Thread Iain Reddick
e then the answer is simple: write a bit of javascript that does it for you. -igor On Wed, Jun 2, 2010 at 2:53 AM, Iain Reddick wrote: > That's just a server round-trip on client-side state changem, which is > basically (1) in my initial list. > > Basically, this type of form be

Re: Show/hide form components best practice

2010-06-03 Thread Iain Reddick
error ("optional value's length must be at least 3); } }. } }); Cheers, Xavier 2010/6/2 Iain Reddick Here's some example code (wicket 1.3.x): Java: private class TestForm extends Form { private String always; private boolean useOp

Re: Show/hide form components best practice

2010-06-09 Thread Iain Reddick
your requirement of "ignore the input for this component completely", although I don't know how would that be achieved. Of course, in all those comments, I assume you can not rely on javascript nor ajax to perform those validations, in which case the visibility approach simply cou

Re: Show/hide form components best practice

2010-06-16 Thread Iain Reddick
termining whether a form component should be considered in the form submit mechanism?". - Original Message - From: "Iain Reddick" To: users@wicket.apache.org Sent: Wednesday, 9 June, 2010 8:35:13 PM Subject: Re: Show/hide form components best practice Looking at the wic

Re: When object is null

2010-07-27 Thread Iain Reddick
I've come across similar scenarios fairly often - i.e. where a the construction of component is impossible if its model object is null, or some other construction parameter is null. I'm still not sure what the best approach is in this situation. One of the methods I've used is to late-bind the

Model object string manipulation

2010-08-04 Thread Iain Reddick
What's the cleanest way of doing string manipulation with a component that uses a String as a model (e.g. a Label). I'm thinking of mutations such as to uppercase and to lowercase, etc. An obvious place is to do it in the model, but I'm interested to hear what other developer's approaches are.

Re: Model object string manipulation

2010-08-04 Thread Iain Reddick
To elaborate a bit - I'm talking about "one off" situations and also re-usable solutions, such as the aforementioned "to upper" and "to lower" cases. - Original Message - From: "Iain Reddick" To: users@wicket.apache.org Sent: Wednesday, 4

Re: Model object string manipulation

2010-08-04 Thread Iain Reddick
anipulation for reusable situations, or even one off, you can write a simple decorator model -igor On Wed, Aug 4, 2010 at 1:27 PM, Iain Reddick wrote: > To elaborate a bit - I'm talking about "one off" situations and also > re-usable solutions, such as the aforementioned

Re: OT: Best practices regarding service layers & DAOs

2010-08-31 Thread Iain Reddick
Here is an interesting generic query DSL that should work well with Wicket. Clauses can be both added and removed from the query in an OO fashion, unlike Query DSL and Quaere (which seem more focussed on syntax). http://code.google.com/p/hibernate-generic-dao/ On 31/08/2010 04:18, Brian Toppi

Re: JFreeChart with clickable imagemap

2010-10-04 Thread Iain Reddick
Doesn't that code render the chart twice, with the rendering for the image map simply being dumped? On 04/10/2010 07:51, Peter Karich wrote: thanks! Dear all, I've added a new wiki page "JFreeChart with tooltip example

Re: Refreshing loadable detachable model object inside an ajax call

2011-04-14 Thread Iain Reddick
Firstly, that LDM code is broken - calling detach() on load() makes no sense. Also, it will hit hibernate on every call to getObject(), as you aren't caching the loaded Parent entity. This is probably the cause of the hibernate exceptions you are seeing. Check out http://wicketinaction.com/2008

Re: wicket-dnd not working on IE9 and only partially on IE8

2011-06-08 Thread Iain Reddick
Without looking at the implementation, to see if the styling is causing an issue: 1) Delete all style declarations from the css file (i.e. blank it) 2) See if the issue persists - in which case it's probably something else 3) Add your style declarations back one at a time to the css file to see

Re: A safer way to build PropertyModels

2011-07-21 Thread Iain Reddick
I LOLed at this: "Unfortunately, most of us are stuck in Java world where proper functions are still considered science fiction like flying cars and World Peace." - Original Message - From: "Carl-Eric Menzel" To: users@wicket.apache.org Sent: Thursday, 21 July, 2011 7:45:02 PM Subject: