it.tidalwave.role.ui.javafx.example.large.Main Maven / Gradle / Ivy
/*
* #%L
* *********************************************************************************************************************
*
* SteelBlue
* http://steelblue.tidalwave.it - git clone [email protected]:tidalwave/steelblue-src.git
* %%
* Copyright (C) 2015 - 2015 Tidalwave s.a.s. (http://tidalwave.it)
* %%
*
* *********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* *********************************************************************************************************************
*
* $Id$
*
* *********************************************************************************************************************
* #L%
*/
package it.tidalwave.role.ui.javafx.example.large;
import javax.annotation.Nonnull;
import javafx.application.Platform;
import org.springframework.context.ApplicationContext;
import it.tidalwave.ui.javafx.JavaFXSpringApplication;
import it.tidalwave.role.ui.javafx.example.large.mainscreen.MainScreenPresentationControl;
/***********************************************************************************************************************
*
* The main class extends {@link JavaFXSpringApplication} and invokes a starting method on a controller that boots
* the application.
*
* @author Fabrizio Giudici
* @version $Id$
*
**********************************************************************************************************************/
public class Main extends JavaFXSpringApplication
{
/*******************************************************************************************************************
*
* Usually {@code main()} does nothing more than a typical {@code main()} of a typical JavaFX application.
* JavaFX and Spring are automatically booted with an implicit configuration:
*
*
* - The FXML resource for the main UI is loaded from the same package as this class, and the name's
* {@code Application.fxml}
* - A splash screen is created from a FXML resource in the same package as this class and name
* {@code Splash.fxml}, It is rendered on the screen while the system is initialised in background.
*
*
******************************************************************************************************************/
public static void main (final @Nonnull String ... args)
{
try
{
Platform.setImplicitExit(true);
launch(args);
}
catch (Throwable t)
{
// Don't use logging facilities here, they could be not initialized
t.printStackTrace();
System.exit(-1);
}
}
/*******************************************************************************************************************
*
* {@inheritDoc}
*
* This method allows to change some default settings, if needed.
*
******************************************************************************************************************/
@Override
public void init()
{
// setUseAquaFxOnMacOsX(true);
super.init(); // always call super.init()!!
}
/*******************************************************************************************************************
*
* {@inheritDoc}
*
* This method retrieves a reference to the main controller and boots it.
*
******************************************************************************************************************/
@Override
protected void onStageCreated (final @Nonnull ApplicationContext applicationContext)
{
applicationContext.getBean(MainScreenPresentationControl.class).start();
}
}