How to programmatically Center a MWindow and Access his Rendering Tag. [message #1128245] |
Mon, 07 October 2013 09:46  |
Eclipse User |
|
|
|
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 05:18] by 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 04:04   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
Re: How to programmatically Center a MWindow and Access his Rendering Tag. [message #1130170 is a reply to message #1130162] |
Wed, 09 October 2013 05:25  |
Eclipse User |
|
|
|
On 09.10.13 11:16, Ghislain Mustermann wrote:
> Is called i forgot to set my fxml as Scene before send it to stage. Now
> its shown. Thank you for that.
>
> So my last Question, Now that i see my Login, which BEST Practices
> should i use to come to my MWindow and Perspective after a successful
> Login? From LoginController go through the Database connection and
> Authentication or should i use command and so on?
This does not make sense. You stop in the launch process and if you
close the window the process goes on and the initial window will open
itself.
If you wanted to ask how to pass the logged in user, credentials, ...
I'd suggest you push them to the IEclipseContext.
Tom
|
|
|
Powered by
FUDForum. Page generated in 0.07872 seconds