css file doesn't load for app handlers [message #1731710] |
Mon, 09 May 2016 12:45 |
Matthew Montgomery Messages: 5 Registered: May 2016 |
Junior Member |
|
|
Good morning. I am currently working on an e4 application project that implements e(fx)clipse plug-ins. One plugin implements a .css file as a styleclass. When I add the plugin to the main e4 application window, all the changes of the .css file make it just fine. I grab the plugin with the following code:
public class ProjectPart {
@PostConstruct
public void postConstruct(IEclipseContext context, BorderPane parent) {
try {
InjectingFXMLLoader<Node> loader = InjectingFXMLLoader.create(context, ProjectPart.class, "Project.fxml");
parent.setCenter(loader.load());
} catch (IOException e) {
e.printStackTrace();
}
}
}
I added a menu drop down (File->Open) to the e4 window that opens the same plugin in a new window. When I open the plugin through this method however, the changes of the .css file do not make it over to the new window. Right now this is how I'm bringing in the plugin in the handler class:
public class Open {
@Execute
public void execute(IEclipseContext context, BorderPane parent ) {
try {
Stage stage = new Stage();
VBox root = (VBox)FXMLLoader.load(getClass().getResource("Open.fxml"));
Scene scene = new Scene(root,355,530);
stage.setScene(scene);
stage.show();
}
catch(Exception e) {
e.printStackTrace();
}
}
}
Both Project.fxml and Open.fxml just contain a VBox that includes the plugin I need.
I'm not sure why the e4 application class can bring in the .css changes, but the handler class cannot. Are there any other steps needed to bring in the .css class?
Thanks.
|
|
|
Re: css file doesn't load for app handlers [message #1731736 is a reply to message #1731710] |
Mon, 09 May 2016 16:52 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Because the renderers setup the stage scene appropriately, loading the
CSS-Files using the current theme setting.
To make that work in your new stage as well you need to:
@Execute
void execute(ThemeManager mgr) {
...
Scene scene = new Scene(root,355,530);
Registration r = mgr.registerScene(scene);
stage.setOnClose( e -> r.dispose())
}
Tom
On 09.05.16 14:49, Matthew Montgomery wrote:
> Good morning. I am currently working on an e4 application project that
> implements e(fx)clipse plug-ins. One plugin implements a .css file as a
> styleclass. When I add the plugin to the main e4 application window, all
> the changes of the .css file make it just fine. I grab the plugin with
> the following code:
>
> public class ProjectPart {
> @PostConstruct
> public void postConstruct(IEclipseContext context, BorderPane parent) {
> try {
> InjectingFXMLLoader<Node> loader =
> InjectingFXMLLoader.create(context, ProjectPart.class, "Project.fxml");
> parent.setCenter(loader.load());
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
> }
>
>
> I added a menu drop down (File->Open) to the e4 window that opens the
> same plugin in a new window. When I open the plugin through this method
> however, the changes of the .css file do not make it over to the new
> window. Right now this is how I'm bringing in the plugin in the handler
> class:
>
> public class Open {
>
> @Execute
> public void execute(IEclipseContext context, BorderPane parent ) {
> try {
> Stage stage = new Stage();
> VBox root =
> (VBox)FXMLLoader.load(getClass().getResource("Open.fxml"));
> Scene scene = new Scene(root,355,530);
> stage.setScene(scene);
> stage.show();
> }
>
> catch(Exception e) {
> e.printStackTrace();
> }
> }
> }
>
>
> Both Project.fxml and Open.fxml just contain a VBox that includes the
> plugin I need.
> I'm not sure why the e4 application class can bring in the .css changes,
> but the handler class cannot. Are there any other steps needed to bring
> in the .css class?
>
> Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02937 seconds