How to programmatically Center a MWindow and Access his Rendering Tag. [message #1128245] |
Mon, 07 October 2013 13:46 |
Ghislain Mustermann Messages: 24 Registered: April 2013 |
Junior Member |
|
|
I want to build a e(fx)clipse E4 Application which has a Login (MTrimmeredWindow) as start Window. But although i used Rendering Tag like "shellMaximized" my E4xmi dont center itself. I saw in E4 Forum a Post from Thomas.
I wanted to used it so like described in Forum but i couldnt. I cant see no Display and no Monitor.
How can i then programmatically access the Display and Monitor like in E4?
Can i access Rendering Tags like :
- efx.window.scene.3d
- efx.window.undecorated
- efx.window.decoration.fxml
programmatically from a Addon for Example?
Thanks
[Updated on: Wed, 09 October 2013 09:18] Report message to a moderator
|
|
|
|
|
Re: How to programmatically Center a MWindow and Access his Rendering Tag. [message #1129027 is a reply to message #1128626] |
Tue, 08 October 2013 08:04 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
That can't work, there's no stage at this point, the handler should look
like this:
public class StartupLifeCycleHandler {
private boolean ok;
@PostContextCreate
boolean login(@FXMLLoader FXMLLoaderFactory factory) {
Stage s = new Stage();
// ...
s.showAndWait();
return ok;
}
}
I think will work as well but you need to give it a try, in case you
are not called come back here.
Tom
On 08.10.13 00:10, Ghislain Mustermann wrote:
> Hallo Tom,
>
> Thank you for the Answers.
> First of all i misuse "shellMaximized", i wanted to FullScreen my
> Window. But thats another Story.
>
> You said that i better use LifeCycleHook. Well i saw a tutorial from
> http://www.vogella.com/articles/Eclipse4LifeCycle/article.html, and with
> my newbie knowledge about E4 i tried to transpose it to e(fx)clipse E4
> like this :
> 1. I added into my plugin.xml an Extension with name lifeCycleURI with a
> Value pointing to a Class.
> 2. The Class look like this where i got a warning about restrictive use
> of PostContextCreate :
>
>
> import java.io.IOException;
>
> import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
> import org.eclipse.equinox.app.IApplicationContext;
> import org.eclipse.fx.ui.di.FXMLBuilder;
> import org.eclipse.fx.ui.di.FXMLLoader;
> import org.eclipse.fx.ui.di.FXMLLoaderFactory;
>
> import javafx.scene.layout.AnchorPane;
> import javafx.stage.Stage;
>
> @SuppressWarnings("restriction")
> public class StartupLifeCycleHandler {
>
> @PostContextCreate
> void postContextCreate(IApplicationContext appContext, Stage
> primaryStage,
> @FXMLLoader FXMLLoaderFactory factory) {
>
> System.out.println("Enter PostContextCreate");
>
> FXMLBuilder<AnchorPane> builder = factory
> .loadRequestorRelative("LoginScreenView.fxml");
> try {
> AnchorPane anchorPane = builder.load();
> primaryStage.centerOnScreen();
> primaryStage.setScene(anchorPane.getScene());
>
> } catch (IOException e) {
> e.printStackTrace();
> }
>
> // close the static splash screen
> appContext.applicationRunning();
> }
> }
>
>
> While compiling i got no Errors but i can't see my LoginScreen, the
> sysout i wrote cant either be shown. Is something missing in my approach
> or i really dont get the point?
>
> Thanks
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05204 seconds