code moved from pm-wicket-utils