You need to catch the response of the page event and return it back from
your component handler i.e

On your component

public Object onActionFromShowDetail(ProvinceInFY element) {

    logger.info("Communicate to parent page via EventBubbeling Call
for Full View :["+element.getTitle()+"]");
    Long l = element.getId();
    CaptureResultCallback<Object> resultCallback = new
CaptureResultCallback<>();
    resources.triggerEvent("ShowDetailsViaBubble", new Object[]{l},
resultCallback);

    return resultCallback.getResult();
}


And on your page


@OnEvent(value="ShowDetailsViaBubble")
private Object onShowDetailsViaBubble(long l) {
    return DetailUserNice.class;
}


You don't need to inject the page and use Pagerenderlinksource since you
are not passing any context on that page.

You can return the page class directly.


Dimitris Zenios



On Sun, Jul 24, 2016 at 1:27 AM, Jochimsen, Janko <
janko.jochim...@urios-beratung.de> wrote:

> Hello,
> I am sorry that I need your advice again:
> In more than one case I have to use EventBubbling or a call from a
> JavaScript script to a Component. That looks all very nice but it seems to
> generate a wired problem. The separation to the Component leads to a
> situation that the user interaction (directly or via the JS script) will be
> revived by the component. In my case that interaction should lead to a call
> of another page.
> As we have EventBubbeling in Tapestry I promote the call from the
> receiving component to the page via
>
>       @Inject
>       private ComponentResources resources;
>
>       public boolean  onActionFromShowDetail(ProvinceInFY element) {
>             logger.info("Communicate to parent page via EventBubbeling
> Call for Full View :["+element.getTitle()+"]");
>             Long l = element.getId();
>             resources.triggerEvent("ShowDetailsViaBubble", new
> Object[]{l}, null);
>
>            return false;
>       }
>
> In the java class for the page I implement the receiving base method this
> way
> public void   onShowDetailsViaBubble(Object[] values) {
>             Long l = (Long) values[0];
>             long elementid = l;
>             logger.info("Bubbled up with id " + elementid);
>
>       }
> To that point everything runs fine. But I want to go to another page from
> here and that seems to be impossible. If I return and Object of a injected
> Page. I will get an exception saying that this return type is not allowed.
>
> Next I tried:
>
> @InjectPage
> DetailUserNice detailPage;
>
>
> Link link =
> pageRenderLinkSource.createPageRenderLink(detailPage.getClass());
>
> Directly or in a sub-method.
>
> At one point the console tells me
>
> [INFO] InternalModule.PageLoader Loaded page 'nav/user/DetailUserNice'
> (it) in 19,247 ms
>
> But then it updates the main page that I want to leave.
>
> Any suggestions?
>
> Thank you in advance.
>
>
> Janko
>
>

Reply via email to