Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » How to retrieve a Scene in an e4 application?
How to retrieve a Scene in an e4 application? [message #1367777] Mon, 19 May 2014 19:17 Go to next message
Eclipse UserFriend
I want to implement a timeout feature in my application - if there is no user interaction for some time, the view should do something. In this case, I need to add an event filter in the whole scene in order to grab the events that restart the timeout timer i.e. mouse and keyboard events.

I tried to get a Scene from the BorderPane that is being injected in the @PostConstruct of my Part class, but the scene is null. I noticed that borderPane.getParent() is a org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer but it seems that there is no method to retrieve the scene.

Is it possible to get the scene in an e4 + e(fx)clipse application? If not, is there another approach to achieve this timeout feature?

Thanks in advance.
Re: How to retrieve a Scene in an e4 application? [message #1367818 is a reply to message #1367777] Mon, 19 May 2014 19:45 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
...is there another approach to achieve this timeout feature?


Well, I was able to do it by adding the event filter in the BorderPane, so it seems that it's covering all the screen (I'm using a single Part in full screen).

Anyway, I think that having access to the Scene or Stage is not that useful in an e4 application. Most of the properties can be setted in the e4xmi, like size, full screen, title, etc.
Re: How to retrieve a Scene in an e4 application? [message #1368608 is a reply to message #1367777] Tue, 20 May 2014 03:38 Go to previous messageGo to next message
Eclipse UserFriend
The reason the scene is null is that in the it gets attached to the
UI-Structure at the end of the creation process which makes it perform a
lot better than adding things piece by piece.

2 Options:
----------
a) attach a listener to the sceneProperty
b) use DI the Scene as well as the Stage can be retrieved through it

@Inject
Scene scene

@Inject
Stage stage

Not that those can change e.g. if you detach a part from the workbench
in an extra floating window!

Tom

On 20.05.14 01:17, Fernando Paz wrote:
> I want to implement a timeout feature in my application - if there is no
> user interaction for some time, the view should do something. In this
> case, I need to add an event filter in the whole scene in order to grab
> the events that restart the timeout timer i.e. mouse and keyboard events.
>
> I tried to get a Scene from the BorderPane that is being injected in the
> @PostConstruct of my Part class, but the scene is null. I noticed that
> borderPane.getParent() is a
> org.eclipse.fx.ui.workbench.renderers.fx.DefPartRenderer but it seems
> that there is no method to retrieve the scene.
>
> Is it possible to get the scene in an e4 + e(fx)clipse application? If
> not, is there another approach to achieve this timeout feature?
>
> Thanks in advance.
Re: How to retrieve a Scene in an e4 application? [message #1370220 is a reply to message #1368608] Tue, 20 May 2014 19:08 Go to previous message
Eclipse UserFriend
Thanks for the clarification. You've been doing a great job with the e(fx)clipse by the way.

Cheers
Previous Topic:Swing in JavaFX in SWT
Next Topic:Classloader Problem with e4fx
Goto Forum:
  


Current Time: Wed May 07 09:06:50 EDT 2025

Powered by FUDForum. Page generated in 0.05004 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top