Re: Problems with Wicket 7.5.0 and Wicket Bootstrap 0.10.10 using a custom NotificationPanel

2016-10-27 Thread Joachim Rohde
Wow. Thanks a lot.

On 10/27/2016 03:17 PM, Martin Grigorov wrote:
> 0.10.11 should be at Maven Central any time soon!
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Thu, Oct 27, 2016 at 3:06 PM, Martin Grigorov 
> wrote:
> 
>> The release script is running...
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Thu, Oct 27, 2016 at 3:03 PM, Francesco Chicchiriccò <
>> ilgro...@apache.org> wrote:
>>
>>>
>>>
>>> On 2016-10-27 14:40 (+0200), Joachim Rohde  wrote:
>>>> Great. Thanks for the fast reply Martin. Do you have already a clue
>>> when a new version of Wicket Bootstrap will be released?
>>>
>>> ..or an easy way to backport your fix?
>>>
>>> Regards.
>>>
>>>
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
> 

-- 
SOLVIT GmbH
Joachim Rohde

Softwareentwicklung

Lise-Meitner-Straße 4
24941 Flensburg

Telefon: +49 461 57 49 85 94
Fax: +49 461 57 49 88 99

Geschäftsführung:
Benjamin Klink,
Karsten Paulsen,
Helge Werlein

Amtsgericht Flensburg HRB 9450 FL
St.-Nr.: 15/296/14057 - USt-Id.: DE 283 368 011

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



Re: Problems with Wicket 7.5.0 and Wicket Bootstrap 0.10.10 using a custom NotificationPanel

2016-10-27 Thread Joachim Rohde
Great. Thanks for the fast reply Martin. Do you have already a clue when a new 
version of Wicket Bootstrap will be released?

On 10/27/2016 02:18 PM, Martin Grigorov wrote:
> Hi,
> 
> Good news!
> It is a bug in Wicket Bootstrap:
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-7.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/dialog/Alert.html#L10
> 
> This  uses a Label in Java. (No idea why).
> Since https://issues.apache.org/jira/browse/WICKET-6219 this is not
> possible.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Thu, Oct 27, 2016 at 1:10 PM, Joachim Rohde  wrote:
> 
>> We are having a custom FeedbackPanel which extends from NotificationPanel.
>> After upgrading from Wicket 7.4.0 to 7.5.0 an
>> unexpected runtime exception is thrown as soon as an error message should
>> be rendered (see below).
>>
>> I have created a quickstart with a simple link which demonstrates this
>> behavior. With Wicket 7.4.0 everything works as
>> expected. With Wicket 7.5.0 you'll get an exception.
>>
>> When using the Wicket FeedbackPanel everything works fine. I have no clue
>> if this is a bug in Wicket itself or Wicket
>> Bootstrap. Any help is appreciated.
>>
>> Joachim
>>
>>
>> The generated exception:
>>
>> Unexpected RuntimeException
>>
>> Last cause: The component(s) below failed to render. Possible reasons
>> could be that: 1) you have added a component in
>> code but forgot to reference it in the markup (thus the component will
>> never be rendered), 2) if your components were
>> added in a parent container then make sure the markup for the child
>> container includes them in .
>>
>> 1. [Component id = message]
>>
>> Stacktrace
>>
>> Root cause:
>>
>> org.apache.wicket.WicketRuntimeException: The component(s) below failed
>> to render. Possible reasons could be that: 1)
>> you have added a component in code but forgot to reference it in the
>> markup (thus the component will never be rendered),
>> 2) if your components were added in a parent container then make sure the
>> markup for the child container includes them
>> in .
>>
>> 1. [Component id = message]
>>
>>  at org.apache.wicket.Page.checkRendering(Page.java:666)
>>  at org.apache.wicket.Page.endComponentRender(Page.java:317)
>>  at org.apache.wicket.page.XmlPartialPageUpdate.writeComponent(
>> XmlPartialPageUpdate.java:127)
>>  at org.apache.wicket.page.PartialPageUpdate.writeComponents(
>> PartialPageUpdate.java:248)
>>  at org.apache.wicket.page.PartialPageUpdate.writeTo(
>> PartialPageUpdate.java:161)
>>  at org.apache.wicket.ajax.AjaxRequestHandler.respond(
>> AjaxRequestHandler.java:358)
>>  at org.apache.wicket.request.cycle.RequestCycle$
>> HandlerExecutor.respond(RequestCycle.java:895)
>>  at org.apache.wicket.request.RequestHandlerStack.execute(
>> RequestHandlerStack.java:64)
>>  at org.apache.wicket.request.RequestHandlerStack.execute(
>> RequestHandlerStack.java:97)
>>  at org.apache.wicket.request.cycle.RequestCycle.execute(
>> RequestCycle.java:265)
>>  at org.apache.wicket.request.cycle.RequestCycle.
>> processRequest(RequestCycle.java:222)
>>  at org.apache.wicket.request.cycle.RequestCycle.
>> processRequestAndDetach(RequestCycle.java:293)
>>  at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(
>> WicketFilter.java:261)
>>  at org.apache.wicket.protocol.http.WicketFilter.
>> processRequest(WicketFilter.java:203)
>>  at org.apache.wicket.protocol.http.WicketFilter.doFilter(
>> WicketFilter.java:284)
>>  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:239)
>>  at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>>  at org.apache.catalina.core.StandardWrapperValve.invoke(
>> StandardWrapperValve.java:217)
>>  at org.apache.catalina.core.StandardContextValve.invoke(
>> StandardContextValve.java:106)
>>  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
>> AuthenticatorBase.java:502)
>>  at org.apache.catalina.core.StandardHostValve.invoke(
>> StandardHostValve.java:142)
>>  at org.apache.catalina.valves.ErrorReportValve.invoke(
>> ErrorReportValve.java:79)
>>  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(
>> AbstractAccessLogValve.java:616)
&g

Re: How to correctly implement a custom error page

2016-09-07 Thread Joachim Rohde
Thanks. Again I learned something new.

On 09/07/2016 12:47 PM, Martin Grigorov wrote:
> Hi,
> 
> You can also use PageRequestHandlerTracker to get a reference to the
> requested page (first handler) and to the response page (last handler).
> Everything else looks good to me!
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Wed, Sep 7, 2016 at 11:36 AM, Joachim Rohde  wrote:
> 
>> Hi,
>>
>> I need to enrich the ExceptionErrorPage with some additional information.
>> Currently I have a working solution but I'm
>> not sure, if this is the correct way.
>>
>> My first try was (in my Application-class):
>>
>> /**
>>  * Define our own exception mapper.
>>  */
>> @Override
>> public IProvider getExceptionMapperProvider() {
>> return new IProvider() {
>>
>> @Override
>> public IExceptionMapper get() {
>> return new MyCustomExceptionMapper();
>> }
>> };
>> }
>>
>> /**
>>  * Our own exception mapper, so that we can display further
>> information on the error page
>>  * in case of an exception.
>>  */
>> public class MyCustomExceptionMapper extends DefaultExceptionMapper {
>>
>> @Override
>> public IRequestHandler map(Exception e) {
>> return new RenderPageRequestHandler(new PageProvider(new
>> MyErrorPage(e, super.extractCurrentPage(;
>> }
>>
>> }
>>
>> MyErrorPage extends from ExceptionErrorPage and overwrites
>> getErrorMessage(Throwable throwable).
>>
>> During development this works just fine but it was not feeling right.
>> Therefore I proposed a patch to implement a
>> hook-method (https://issues.apache.org/jira/browse/WICKET-6240) where
>> Martin mentioned:
>>
>> "The recommended way to do this is to register custom
>> IRequestCycleListener and override its #onException() method.
>> If the exception is IWicketInternalException then return null, otherwise
>> return RenderPageRequestHandler with a custom
>> page that renders all the information you need."
>>
>> So, at the moment I'm having in my init-method:
>>
>> getRequestCycleListeners().add(new AbstractRequestCycleListener() {
>> @Override
>> public IRequestHandler onException(RequestCycle cycle,
>> Exception ex) {
>> if (ex instanceof IWicketInternalException) {
>> return null;
>> } else {
>> Page page = null;
>>
>> IRequestHandler handler =
>> cycle.getActiveRequestHandler();
>>
>> if (handler == null) {
>> handler = cycle.getRequestHandlerScheduledAfte
>> rCurrent();
>> }
>>
>> if (handler instanceof IPageRequestHandler) {
>> IPageRequestHandler pageRequestHandler =
>> (IPageRequestHandler) handler;
>> page = (Page) pageRequestHandler.getPage();
>> }
>>
>> return new RenderPageRequestHandler(new
>> PageProvider(new MyErrorPage(ex, page)));
>> }
>> }
>>
>> });
>>
>> The code to retrieve the page comes basically from 
>> DefaultExceptionMapper#extractCurrentPage().
>> My question: is this the
>> way to go? Or can I simplify the code any further?
>>
>> Joachim
>>
>> -
>> 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



How to correctly implement a custom error page

2016-09-07 Thread Joachim Rohde
Hi,

I need to enrich the ExceptionErrorPage with some additional information. 
Currently I have a working solution but I'm
not sure, if this is the correct way.

My first try was (in my Application-class):

/**
 * Define our own exception mapper.
 */
@Override
public IProvider getExceptionMapperProvider() {
return new IProvider() {

@Override
public IExceptionMapper get() {
return new MyCustomExceptionMapper();
}
};
}

/**
 * Our own exception mapper, so that we can display further information on 
the error page
 * in case of an exception.
 */
public class MyCustomExceptionMapper extends DefaultExceptionMapper {

@Override
public IRequestHandler map(Exception e) {
return new RenderPageRequestHandler(new PageProvider(new 
MyErrorPage(e, super.extractCurrentPage(;
}

}

MyErrorPage extends from ExceptionErrorPage and overwrites 
getErrorMessage(Throwable throwable).

During development this works just fine but it was not feeling right. Therefore 
I proposed a patch to implement a
hook-method (https://issues.apache.org/jira/browse/WICKET-6240) where Martin 
mentioned:

"The recommended way to do this is to register custom IRequestCycleListener and 
override its #onException() method.
If the exception is IWicketInternalException then return null, otherwise return 
RenderPageRequestHandler with a custom
page that renders all the information you need."

So, at the moment I'm having in my init-method:

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
@Override
public IRequestHandler onException(RequestCycle cycle, Exception 
ex) {
if (ex instanceof IWicketInternalException) {
return null;
} else {
Page page = null;

IRequestHandler handler = cycle.getActiveRequestHandler();

if (handler == null) {
handler = 
cycle.getRequestHandlerScheduledAfterCurrent();
}

if (handler instanceof IPageRequestHandler) {
IPageRequestHandler pageRequestHandler = 
(IPageRequestHandler) handler;
page = (Page) pageRequestHandler.getPage();
}

return new RenderPageRequestHandler(new PageProvider(new 
MyErrorPage(ex, page)));
}
}

});

The code to retrieve the page comes basically from 
DefaultExceptionMapper#extractCurrentPage(). My question: is this the
way to go? Or can I simplify the code any further?

Joachim

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



Re: Chrome extension and Eclipse plugin for wicket-source helper are updated!

2016-08-25 Thread Joachim Rohde
For the NetBeans users who couldn't use this great tool till now: I just 
uploaded a NetBeans plugin under
https://github.com/JoachimRohde/NBWicketSourcePlugin

Joachim

On 08/22/2016 03:30 AM, Jenny Brown wrote:
> About 5 years ago, I created wicket-source, a set of extensions that let
> you inspect a wicket component in your browser, and click a button to go to
> that line of your source code in Eclipse.
> 
> As time went on, the browser extensions drifted out of compatibility, to
> the sadness of those who used them.  Eventually even the workarounds
> stopped working.
> 
> So this weekend, I update the Chrome wicket-source extension for Chrome 48
> (updated in chrome web store) and updated the Eclipse plugin (jar is on
> github) for Eclipse Neon.   (Yeah!!!)
> 
> Screenshots, details, and download links are on the wiki:
> 
> https://github.com/jennybrown8/wicket-source/wiki
> 
> The server-side wicket application module still works as before, and is
> available for Wicket 7.
> 
> The Firefox plugin was deprecated, and requires a full rewrite from
> scratch, so it's not usable for now.  I'll try to come back to this when
> Firefox Web Extensions and Firebug 3 stabilize and provide the APIs I need
> for it to work.
> 
> I forked the project when I separated from the employer where it was
> created, so there is a new package name for the extensions that have been
> updated.  At this time, the maven coordinates for the web application
> server-side plugin remain with the old name.  The wiki documents all of
> this.
> 
> I looked at Eclipse Marketplace and the self-hosting was confusing; if
> someone familiar with that wants to pair with me to try to get it properly
> submitted, I can try.  I don't have my own hosting service for the binaries.
> 
> Jenny Brown
> 

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



Re: Evicting the page store to force Wicket to create a new instance of a page after using the back-button

2016-04-18 Thread Joachim Rohde
Strange, my reply on friday didn't make it to the mailing-list, so here once 
again:

Thanks to Thorsten Schöning & subes for their feedback, even though none of the 
suggestions worked for my case. But it
helped somehow to think about it from a different perspective. I was thinking 
way too complicated. (My solution is at
the end fo the mail).

@Thorsten:
The user is not the only criteria deciding the visibility. We have several 
links and a lot of them have additional
criteria depending on the state of the application. I am also aware of the 
discussion setVisible vs. isVisible. But on
our project we decided to use isVisible as long as there is no significant 
performance penalty.
Beside that after fixing the problem with the links, I could reproduce the 
problematic behaviour with other pages which
relied on the user-object.

@subes:
I tried also to call invalidate() in my signOut()-method which resulted in a 
stackoverflow since invalidate() calls
itself signout() which resulted in an endless loop.
And replaceSession() was also not helpful since Wicket tried to load the last 
page from the page store and render the
components which needed the user-object which was not there anymore.

How I fixed it:

In MySession I just check if the user is null and throw an PageExpiredException 
if it is.

   public User getUser() {
if (user == null) {
throw new PageExpiredException("No user available. Page seems to be 
expired.");
}
return user;
}

This way I'm always getting to the log-in page if the user-object does not 
exists. My initial thought was, to empty the
page store so that Wicket tries to create a new instance of the page and the 
AuthorizeInstantiation annotation would
have redirected to the login-page. Do not ask me why I was thinking so 
complicated in the beginning.

Have a nice weekend.

On 04/14/2016 03:35 PM, Joachim Rohde wrote:
> Hello,
> 
> short version of my question: how do I evict the page store to force Wicket 
> to create a new instance after using the
> back-button?
> 
> Longer version:
> 
> A user is redirected after login to my main page. On my main page I have 
> several links in onInitialize() which
> overwrites isVisible checking the role of the logged-in user, like this:
> 
> @AuthorizeInstantiation({MyRole.sAdmin})
> public abstract class AbstractSecureBasePage extends AbstractBasePage 
> implements ModelDetacher {
> [...]
> add(new Link("managementLink") {
> @Override
> public void onClick() {
> setResponsePage(Management.class);
> }
> 
> @Override
> public boolean isVisible() {
> return MySession.get().getUser().hasRole(MyRole.ADMIN);
> }
> });
> [...]
> }
> 
> My session:
> 
> public class MySession extends AuthenticatedWebSession {
> [...]
> @Override
> public void signOut() {
> 
> user = null;
> 
> final RequestCycle requestCycle = RequestCycle.get();
> 
> if (RequestCycle.get() != null && requestCycle.getRequest() != null
> && 
> ServletWebRequest.class.isAssignableFrom(RequestCycle.get().getRequest().getClass()))
>  {
> LOGGER.log(Level.FINE, "Invalidating HttpSession-object {0}",
> ((ServletWebRequest) 
> RequestCycle.get().getRequest()).getContainerRequest().getSession().getId());
> ((ServletWebRequest) 
> RequestCycle.get().getRequest()).getContainerRequest().getSession().invalidate();
> }
> super.signOut();
> }
> }
> 
> After the log-out the user is redirected back to the login-page. If the user 
> now click the browsers back button Wicket
> tries to fetch the last page from the page store and checks the links 
> visibility which will result in a
> NullPointerException due to the fact that getUser() returns null.
> 
> I attempted several solutions:
> 
> 1) Checking in every isVisible() if the user is null. This *does* work but I 
> have quite a lot of links and I would like
> to go with this solution only if I cannot find any other.
> 
> 2) Checking at the very beginning of onInitialize() if the user is null. This 
> does not work since the components are
> coming from the page store and onInitialize() is not called.
> 
> 3) Overwriting onBeforeRender() of the main page. This does not work since 
> it's only called if a component is visible.
> 
> 4) My next idea was, to empty the page store within my signOut-method.
> I tried several things:
>getApplication().getSessionStore().destroy();
>getPageManager().clear();
>getPageManager().destroy()

Re: Evicting the page store to force Wicket to create a new instance of a page after using the back-button

2016-04-15 Thread Joachim Rohde
Thanks to Thorsten Schöning & subes for their feedback, even though none of the 
suggestions worked for my case. But it
helped somehow to think about it from a different perspective. I was thinking 
way too complicated. (My solution is at
the end fo the mail).

@Thorsten:
The user is not the only criteria deciding the visibility. We have several 
links and a lot of them have additional
criteria depending on the state of the application. I am also aware of the 
discussion setVisible vs. isVisible. But on
our project we decided to use isVisible as long as there is no significant 
performance penalty.
Beside that after fixing the problem with the links, I could reproduce the 
problematic behaviour with other pages which
relied on the user-object.

@subes:
I tried also to call invalidate() in my signOut()-method which resulted in a 
stackoverflow since invalidate() calls
itself signout() which resulted in an endless loop.
And replaceSession() was also not helpful since Wicket tried to load the last 
page from the page store and render the
components which needed the user-object which was not there anymore.

How I fixed it:

In MySession I just check if the user is null and throw an PageExpiredException 
if it is.

   public User getUser() {
if (user == null) {
throw new PageExpiredException("No user available. Page seems to be 
expired.");
}
return user;
}

This way I'm always getting to the log-in page if the user-object does not 
exists. My initial thought was, to empty the
page store so that Wicket tries to create a new instance of the page and the 
AuthorizeInstantiation annotation would
have redirected to the login-page. Do not ask me why I was thinking so 
complicated in the beginning.

Have a nice weekend.

On 04/14/2016 03:35 PM, Joachim Rohde wrote:
> Hello,
> 
> short version of my question: how do I evict the page store to force Wicket 
> to create a new instance after using the
> back-button?
> 
> Longer version:
> 
> A user is redirected after login to my main page. On my main page I have 
> several links in onInitialize() which
> overwrites isVisible checking the role of the logged-in user, like this:
> 
> @AuthorizeInstantiation({MyRole.sAdmin})
> public abstract class AbstractSecureBasePage extends AbstractBasePage 
> implements ModelDetacher {
> [...]
> add(new Link("managementLink") {
> @Override
> public void onClick() {
> setResponsePage(Management.class);
> }
> 
> @Override
> public boolean isVisible() {
> return MySession.get().getUser().hasRole(MyRole.ADMIN);
> }
> });
> [...]
> }
> 
> My session:
> 
> public class MySession extends AuthenticatedWebSession {
> [...]
> @Override
> public void signOut() {
> 
> user = null;
> 
> final RequestCycle requestCycle = RequestCycle.get();
> 
> if (RequestCycle.get() != null && requestCycle.getRequest() != null
> && 
> ServletWebRequest.class.isAssignableFrom(RequestCycle.get().getRequest().getClass()))
>  {
> LOGGER.log(Level.FINE, "Invalidating HttpSession-object {0}",
> ((ServletWebRequest) 
> RequestCycle.get().getRequest()).getContainerRequest().getSession().getId());
> ((ServletWebRequest) 
> RequestCycle.get().getRequest()).getContainerRequest().getSession().invalidate();
> }
> super.signOut();
> }
> }
> 
> After the log-out the user is redirected back to the login-page. If the user 
> now click the browsers back button Wicket
> tries to fetch the last page from the page store and checks the links 
> visibility which will result in a
> NullPointerException due to the fact that getUser() returns null.
> 
> I attempted several solutions:
> 
> 1) Checking in every isVisible() if the user is null. This *does* work but I 
> have quite a lot of links and I would like
> to go with this solution only if I cannot find any other.
> 
> 2) Checking at the very beginning of onInitialize() if the user is null. This 
> does not work since the components are
> coming from the page store and onInitialize() is not called.
> 
> 3) Overwriting onBeforeRender() of the main page. This does not work since 
> it's only called if a component is visible.
> 
> 4) My next idea was, to empty the page store within my signOut-method.
> I tried several things:
>getApplication().getSessionStore().destroy();
>getPageManager().clear();
>getPageManager().destroy();
>getPageManager().commitRequest();
> None of them worked.
> 
> 

Evicting the page store to force Wicket to create a new instance of a page after using the back-button

2016-04-14 Thread Joachim Rohde
Hello,

short version of my question: how do I evict the page store to force Wicket to 
create a new instance after using the
back-button?

Longer version:

A user is redirected after login to my main page. On my main page I have 
several links in onInitialize() which
overwrites isVisible checking the role of the logged-in user, like this:

@AuthorizeInstantiation({MyRole.sAdmin})
public abstract class AbstractSecureBasePage extends AbstractBasePage 
implements ModelDetacher {
[...]
add(new Link("managementLink") {
@Override
public void onClick() {
setResponsePage(Management.class);
}

@Override
public boolean isVisible() {
return MySession.get().getUser().hasRole(MyRole.ADMIN);
}
});
[...]
}

My session:

public class MySession extends AuthenticatedWebSession {
[...]
@Override
public void signOut() {

user = null;

final RequestCycle requestCycle = RequestCycle.get();

if (RequestCycle.get() != null && requestCycle.getRequest() != null
&& 
ServletWebRequest.class.isAssignableFrom(RequestCycle.get().getRequest().getClass()))
 {
LOGGER.log(Level.FINE, "Invalidating HttpSession-object {0}",
((ServletWebRequest) 
RequestCycle.get().getRequest()).getContainerRequest().getSession().getId());
((ServletWebRequest) 
RequestCycle.get().getRequest()).getContainerRequest().getSession().invalidate();
}
super.signOut();
}
}

After the log-out the user is redirected back to the login-page. If the user 
now click the browsers back button Wicket
tries to fetch the last page from the page store and checks the links 
visibility which will result in a
NullPointerException due to the fact that getUser() returns null.

I attempted several solutions:

1) Checking in every isVisible() if the user is null. This *does* work but I 
have quite a lot of links and I would like
to go with this solution only if I cannot find any other.

2) Checking at the very beginning of onInitialize() if the user is null. This 
does not work since the components are
coming from the page store and onInitialize() is not called.

3) Overwriting onBeforeRender() of the main page. This does not work since it's 
only called if a component is visible.

4) My next idea was, to empty the page store within my signOut-method.
I tried several things:
   getApplication().getSessionStore().destroy();
   getPageManager().clear();
   getPageManager().destroy();
   getPageManager().commitRequest();
None of them worked.

getPageManager().destroy(); provokes even a NullPointerException within Wicket 
itself (after using the back-button):

java.lang.NullPointerException
 at 
org.apache.wicket.page.PageStoreManager$SessionEntry.getPage(PageStoreManager.java:203)
 at 
org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.getPage(PageStoreManager.java:357)
 at 
org.apache.wicket.page.AbstractPageManager.getPage(AbstractPageManager.java:82)
 at 
org.apache.wicket.page.PageManagerDecorator.getPage(PageManagerDecorator.java:50)
 at 
org.apache.wicket.page.PageAccessSynchronizer$2.getPage(PageAccessSynchronizer.java:246)
 at 
org.apache.wicket.DefaultMapperContext.getPageInstance(DefaultMapperContext.java:113)
 at 
org.apache.wicket.core.request.handler.PageProvider.getStoredPage(PageProvider.java:299)
 at 
org.apache.wicket.core.request.handler.PageProvider.isNewPageInstance(PageProvider.java:211)
 at 
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.processHybrid(AbstractBookmarkableMapper.java:261)
 at 
org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper.mapRequest(AbstractBookmarkableMapper.java:365)
 at 
org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:150)
 at 
org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:189)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:219)
 at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
 at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
 at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
[...]

Line 203 of the PageStoreManager looks like:

// not found, ask pagestore for the page
return getPageStore().getPage(sessionId, id);

I am not sure if here should be a null-check on getPageStore (since I have no 
clue what should be returned if
getPageStore() returns null).

Long story short: is there a more elegant solution to my problem than the first 
solution that I've tried?
I had the hope I could em

Re: Gmap3 custom Icon

2013-07-17 Thread Joachim Rohde

Hi Tom,

you need to pass a valid URL (as a string) to GIcon, e.g.:

Icon hotelIcon = new GIcon("http://www.yourdomain/img/Hotel.png";);

In case you are using Maven and Spring I would suggest that you inject 
the base-URL depending on the Maven-profile into a variable so that you 
don't have to worry about setting the right URL.


I defined a variable

public static String IMAGES_URL = "";

in my Wicket-Application-class and in my applicationContext.xml I 
defined the bean:




${myapplication.imgUrl}



In my pom.xml I have two profiles:

production


http://mydomain.com/myapplication/images/
deployment




development


http://localhost:8084/myapplication/images/
development



If I want to create a GIcon now, I do it like this:

new GIcon(MyApplication.IMAGES_URL + "Hotel.png");

This way you can keep your custom images within your project without 
worrying if you are on your development machine or deploying your 
application to a productive server. You just need to choose the right 
Maven profile.


Joachim

On 07/17/2013 03:55 PM, tomatconvien wrote:

Hi to all,

I am trying to customize the default marker.png by defining GIcon with a
custom xxx.png but it just doesn´t want to show up in my map.
The default marker.png is shown without problems. I am getting no errors.
Can someone help me out on this one? I am using wicket 6.8.0 with
wicketstuff-gmap3 6.8.0.

My code is:

gmap = new ExtendedGmap("gmap");
add(gmap);

gmap.setOutputMarkupId(true);
gmap.setPanControlEnabled(true);
gmap.setMapType(GMapType.ROADMAP);
gmap.setDraggingEnabled(true);
gmap.setMapTypeControlEnabled(true);
gmap.setStreetViewControlEnabled(true);
gmap.setScaleControlEnabled(true);
gmap.setScrollWheelZoomEnabled(true);

GIcon hotelIcon = new GIcon("Hotel.png");
GLatLng centerLatLng = new
GLatLng(offerModel.getObject().getHotel().getLatitude(),
offerModel.getObject().getHotel().getLongitude());
GMarkerOptions centerOptions = new GMarkerOptions(gmap, centerLatLng,
"Hotel", hotelIcon, null);
GMarker centerMarker = new GMarker(centerOptions);
gmap.addOverlay(centerMarker);  
gmap.setCenter(centerLatLng);

Thanks for your advice.

Tom





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Gmap3-custom-Icon-tp4660309.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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



[Wicketstuff] Google Maps 3 component

2012-08-09 Thread Joachim Rohde

Hello,

maybe someone might be interested that I have uploaded a component for 
Google Maps 3 today which can be found at GitHub under 
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gmap3-parent/gmap3 
(I'm not sure when the snapshots are build so it might be necessary to 
build the project from source still)


A (still) very brief overview can be found in the Wiki: 
https://github.com/wicketstuff/core/wiki/Gmap3


And the examples are under 
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/gmap3-parent/gmap3-examples


So, if anyone is in the need of such a component or just want to play a 
bit with it, I would appreciate to hear any feedback.


Joachim Rohde

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



HTML files not reloading in Netbeans on save - quick hack solution

2011-02-02 Thread Joachim Rohde

Hi,
for those of you who are developing Wicket applications with Netbeans 
will have encountered the annoyance that since Netbeans version 6.8 
changes of HTML-files are not immediately visible after saving. I wrote 
a short blog entry regarding this topic which might be of interest: 
http://adelio.org/wicket-reloading-html-files-in-netbeans-english/


Joachim

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



Re: Form values are not submitted if form-component is initially not visible

2010-09-17 Thread Joachim Rohde

Am 17.09.2010 21:16, schrieb Jeremy Thomerson:

Thanks for the answer. But if I'm adding my form to the target the
visibility of the components does not change anymore. Anything else I'm
overseeing?
 


It should.  Did you look in the wicket ajax log window?  Did you add
form.setOutputMarkupId(true) ?
   
OutputMarkupId was already set to true. But that was also not the 
solution. I found out what was going wrong. The markup screwed things up.


Before my markup looked like this:



[...]




But forms within tables seem to be invalid. If I rearrange the markup to 
this:





 [...]




everything works as expected. Why can't browser just be as strict as 
compilers? *sigh*

Thanks anyway for your time Jeremy.


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



Re: Form values are not submitted if form-component is initially not visible

2010-09-17 Thread Joachim Rohde

Am 17.09.2010 07:21, schrieb Jeremy Thomerson:

On Thu, Sep 16, 2010 at 5:17 PM, Joachim Rohde   

wrote:
 
   

I have a listview which is displaying in each row some data within a form,
among other things a date (as a label which is initially shown)
and a Panel containing a (wiquery-)datepicker (which is initially hiding).
Each row also has an edit-link (AjaxLink) and a save-link (SubmitLink).
After clicking the edit-link I'm hiding the date-label and display my panel
with the datepicker.

My problem is now that after clicking the SubmitLink I'm getting a
null-value from my datePicker.

If I am setting the visibility of my panel from the very beginning to
"true" and omit adding my panel to the AjaxRequestTarget within my AjaxLink,
everything
works as expected: the datepicker is returning the selected value.

What am I doing wrong here? How can I display my panel via Ajax and getting
anyway my form-values submitted?

I tried already several hours to find a solution, searched the mailing list
and web but I don't find any solution. So thanks in advance for any
suggestion.

Joachim


PS:
Here are the relevant pieces of code:

My Listview:

ListView tiltos = new ListView("myList", myList)
{

@Override
protected void populateItem(final ListItem listItem)
{

Form form = new Form("form");
listItem.add(form);

// the actual date is set later in the code
final Label dateToBuy = new Label("dayToBuy", "keine
Angabe");
dateToBuy.setOutputMarkupId(true);
dateToBuy.setOutputMarkupPlaceholderTag(true);
form.add(dateToBuy)

final EditDatePanel editDate = new
EditDatePanel("editDate");

// if i set this to true and ommit the line later,
everything works
editDate.setVisible(false);

editDate.setOutputMarkupId(true);
editDate.setOutputMarkupPlaceholderTag(true);
form.add(editDate);

final SubmitLink saveLink = new SubmitLink("saveLink")
{

@Override
public void onSubmit()
{
// the output here is always null if the
editDatePanel
// is added to the AjaxRequestTarget (see following
lines)
System.out.println("test = " + editDate.getTest());
}
}

final AjaxLink editLink = new AjaxLink("editLink")
{

@Override
public void onClick(AjaxRequestTarget target)
{
dateToBuy.setVisible(false);
editDate.setVisible(true);
target.addComponent(dateToBuy);

// this one causes my form not to submit any values
   // if I ommit it everything works
target.addComponent(editDate,
editDate.getMarkupId());
}
};

form.add(editLink);
}

}


The markup to my listview:







01.06.2010








My panel (which is, at least I think so, irrelevant to my problem):

public final class EditDatePanel extends Panel
{

private Date test;

public EditDatePanel(String id)
{
super(id);

DatePicker  datePicker = new
DatePicker("datePicker", new PropertyModel(this, "test")) {
public void onModelChanging()
{
System.out.println("geht los jetzt!");
}
};
datePicker.setNumberOfMonths(new
DatePickerNumberOfMonths(new Short((short) 1)));
datePicker.setShowButtonPanel(false);
datePicker.setShowOn(ShowOnEnum.FOCUS);

datePicker.setOutputMarkupId(true);
datePicker.setOutputMarkupPlaceholderTag(true);

datePicker.setVisible(true);
add(datePicker);
}

public Date getTest()
{
return test;
}

public void setTest(Date test)
{
this.test = test;
System.out.println("test   x: " +test);
}
}

The markup to my panel:





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


 

Add the entire form to the AjaxRequestTarget.  The form's action URL is
out-of-date and pulls up the old version of the page.

   
Thanks for the answer. But if I'm adding my form to the target the 
visibility of the components does not change anymore. Anything el

Form values are not submitted if form-component is initially not visible

2010-09-16 Thread Joachim Rohde
I have a listview which is displaying in each row some data within a 
form, among other things a date (as a label which is initially shown)

and a Panel containing a (wiquery-)datepicker (which is initially hiding).
Each row also has an edit-link (AjaxLink) and a save-link (SubmitLink).
After clicking the edit-link I'm hiding the date-label and display my 
panel with the datepicker.


My problem is now that after clicking the SubmitLink I'm getting a 
null-value from my datePicker.


If I am setting the visibility of my panel from the very beginning to 
"true" and omit adding my panel to the AjaxRequestTarget within my 
AjaxLink, everything

works as expected: the datepicker is returning the selected value.

What am I doing wrong here? How can I display my panel via Ajax and 
getting anyway my form-values submitted?


I tried already several hours to find a solution, searched the mailing 
list and web but I don't find any solution. So thanks in advance for any 
suggestion.


Joachim


PS:
Here are the relevant pieces of code:

My Listview:

ListView tiltos = new ListView("myList", myList)
{

@Override
protected void populateItem(final ListItem listItem)
{

Form form = new Form("form");
listItem.add(form);

// the actual date is set later in the code
final Label dateToBuy = new Label("dayToBuy", "keine 
Angabe");

dateToBuy.setOutputMarkupId(true);
dateToBuy.setOutputMarkupPlaceholderTag(true);
form.add(dateToBuy)

final EditDatePanel editDate = new 
EditDatePanel("editDate");


// if i set this to true and ommit the line later, 
everything works

editDate.setVisible(false);

editDate.setOutputMarkupId(true);
editDate.setOutputMarkupPlaceholderTag(true);
form.add(editDate);

final SubmitLink saveLink = new SubmitLink("saveLink")
{

@Override
public void onSubmit()
{
// the output here is always null if the 
editDatePanel
// is added to the AjaxRequestTarget (see 
following lines)

System.out.println("test = " + editDate.getTest());
}
}

final AjaxLink editLink = new AjaxLink("editLink")
{

@Override
public void onClick(AjaxRequestTarget target)
{
dateToBuy.setVisible(false);
editDate.setVisible(true);
target.addComponent(dateToBuy);

// this one causes my form not to submit any values
   // if I ommit it everything works
target.addComponent(editDate, 
editDate.getMarkupId());

}
};

form.add(editLink);
}

}


The markup to my listview:







01.06.2010








My panel (which is, at least I think so, irrelevant to my problem):

public final class EditDatePanel extends Panel
{

private Date test;

public EditDatePanel(String id)
{
super(id);

DatePicker datePicker = new 
DatePicker("datePicker", new PropertyModel(this, "test")) {

public void onModelChanging()
{
System.out.println("geht los jetzt!");
}
};
datePicker.setNumberOfMonths(new 
DatePickerNumberOfMonths(new Short((short) 1)));

datePicker.setShowButtonPanel(false);
datePicker.setShowOn(ShowOnEnum.FOCUS);

datePicker.setOutputMarkupId(true);
datePicker.setOutputMarkupPlaceholderTag(true);

datePicker.setVisible(true);
add(datePicker);
}

public Date getTest()
{
return test;
}

public void setTest(Date test)
{
this.test = test;
System.out.println("test   x: " +test);
}
}

The markup to my panel:





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



Re: Changes of html-files are not directly available - need to re-deploy

2010-02-10 Thread Joachim Rohde
I found out what was wrong. Quite a rookie mistake: I relied on my IDE. 
As I mentioned I am using Netbeans where I have installed the Wicket 
plugin 
(http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=3586). 
It was the plugin which was copying the HTML files to the correct 
(server) folder after saving changes. And this behaviour is broken in 
Netbeans 6.8. In Netbeans 6.7.1 the plugin is working perfectly. I guess 
I didn't realize that the plugin is not compatible with NB 6.8 because 
on one hand the rest of the plugin seems to work perfectly (at least the 
parts that I am using) and on the other hand I was working the last 
weeks more on the backend of my project so that I didn't realize after 
the upgrade of Netbeans that not everything was working as expected. For 
now I'm using Netbeans 6.7.1 again.

Thanks for the help.


Am 09.02.2010 21:38, schrieb Riyad Kalla:

Joachim,

Troubleshooting redeployment issues can be maddening. The *very first*
thing you have to rule out is that the file is actually getting placed
on disk in the deployed location. I don't know how NetBeans handles
it's deployments, if it points Tomcat at the internal project and runs
"in place" or if it actually copies out the project contents on-disk
to some deployed location.

Regardless, find the deployed location. Go change your HTML, save it,
then using a file explorer, go to the deployed location and manually
open the file that is in the deployed location (e.g. using Gedit on
Ubuntu) and confirm that those changes are in that HTML.

If they are, then the issue would be with Wicket polling and seeing
the changes and reloading them. If you don't see the changes, then the
issue is with NetBeans either not placing the files in the right
location or not being *Able to* place them -- i.e. a permission
problem (That running as root should have addressed).

NOTE: 1 last thing, I don't know how you are running Tomcat, but if
you are running it externally make sure it's running as the same user
as NetBeans. Othertiwse you could run into a silly situation of
NetBeans writing out files as "root" and Tomcat trying to read/load
the deployed files but not having read-perms on those "root-owned"
files.

Just want to avoid weirdness.

-R

On Tue, Feb 9, 2010 at 1:33 PM, Joachim Rohde
  wrote:
   

First of all: I asked this question already at
http://www.coderanch.com/t/481846/Application-Frameworks/Application-Frameworks/Wicket-Changes-html-files-are
where no one could help me.

To my problem:

I have here a little bug which is completly weird in my opinion.
Usually when you are changing a html-file, you just need to save it and it
is directly available in the browser after a refresh. But this behaviour is
not working in my environment. I always have to deploy the complete project.
It is not a problem of my project. I verified this by trying the exactly
same project and also the quickstart from the official Wicket site on a
different machine where it works as expected. So it must be somewhere in my
configuration but I cannot figured it out where / what / why.

Machine one, where it is not working runs on Ubuntu 9.10, IDE is Netbeans
6.8 with Maven 2.2.1, server is a Tomcat 6.0.24 (also tried Tomcat 6.0.18
and also Jetty).
Machine two, where it is working runs on Windows XP, IDE is Netbeans 6.7.1
with Maven 2.2.1, server is a Tomcat 6.0.18.

I am definitely running the development mode (verified this also by calling
Application.get().getConfigurationType()). I tried the Wicket versions
1.4.4, 1.4.5 and 1.4.6. All the same. On the Ubuntu-System it's not working.
I also tried already to start Netbeans as root-user on the Linux-system,
just in case some access rights on my file-system are not sufficient.
Without any change in the result.

Only thing I found while searching was
http://markmail.org/message/fqpioxh7dir67ttj#query:wicket%20html%20refresh+page:1+mid:ca74uawyqzjyj5v5+state:results
where a mismatched dependency was the problem. But this does not seem to be
my problem. In JIRA I couldn't find anything related.

Anyone else encountered this problem? And even if not, I'm also open for
blue shots what I might try because I have no clue what might cause this
behaviour. Or anyone knows in which class the code for the reloading
resides? I haven't found it yet, after a quick glance at the wicket sources.
Help here is really appreciated. Thanks in advance for any comments.

-
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



Eingehende eMail ist virenfrei.
Von AVG überprüft - www

Changes of html-files are not directly available - need to re-deploy

2010-02-09 Thread Joachim Rohde
First of all: I asked this question already at 
http://www.coderanch.com/t/481846/Application-Frameworks/Application-Frameworks/Wicket-Changes-html-files-are 
where no one could help me.


To my problem:

I have here a little bug which is completly weird in my opinion.
Usually when you are changing a html-file, you just need to save it and 
it is directly available in the browser after a refresh. But this 
behaviour is not working in my environment. I always have to deploy the 
complete project. It is not a problem of my project. I verified this by 
trying the exactly same project and also the quickstart from the 
official Wicket site on a different machine where it works as expected. 
So it must be somewhere in my configuration but I cannot figured it out 
where / what / why.


Machine one, where it is not working runs on Ubuntu 9.10, IDE is 
Netbeans 6.8 with Maven 2.2.1, server is a Tomcat 6.0.24 (also tried 
Tomcat 6.0.18 and also Jetty).
Machine two, where it is working runs on Windows XP, IDE is Netbeans 
6.7.1 with Maven 2.2.1, server is a Tomcat 6.0.18.


I am definitely running the development mode (verified this also by 
calling Application.get().getConfigurationType()). I tried the Wicket 
versions 1.4.4, 1.4.5 and 1.4.6. All the same. On the Ubuntu-System it's 
not working. I also tried already to start Netbeans as root-user on the 
Linux-system, just in case some access rights on my file-system are not 
sufficient. Without any change in the result.


Only thing I found while searching was 
http://markmail.org/message/fqpioxh7dir67ttj#query:wicket%20html%20refresh+page:1+mid:ca74uawyqzjyj5v5+state:results 
where a mismatched dependency was the problem. But this does not seem to 
be my problem. In JIRA I couldn't find anything related.


Anyone else encountered this problem? And even if not, I'm also open for 
blue shots what I might try because I have no clue what might cause this 
behaviour. Or anyone knows in which class the code for the reloading 
resides? I haven't found it yet, after a quick glance at the wicket sources.

Help here is really appreciated. Thanks in advance for any comments.

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