All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.bbmsoft.iocfx.Standalone Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
package net.bbmsoft.iocfx;

import javafx.scene.layout.Region;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import net.bbmsoft.iocfx.StageService.ExitPolicy;

/**
 * Base interface for standalone applications.
 * 
 * @author Michael Bachmann
 *
 */
public interface Standalone {

	/**
	 * Provide an {@code ExitPolicy} for the application's main stage.
	 * 
	 * @return the application's main stage's exit policy
	 */
	public default ExitPolicy getExitPolicy() {
		return ExitPolicy.SHUTDOWN_ON_STAGE_EXIT;
	}

	/**
	 * Customizes the stage before it is shown. Override this e.g. to apply a
	 * {@link StageStyle} before the stage is made visible for the first time.
	 * 
	 * @param primaryStage
	 *            the application's main stage
	 */
	public default void prepareStage(Stage primaryStage) {

	}

	/**
	 * Interface for components that represent an application main window and bring
	 * their own UI layout. The root region provided by this compoennt will
	 * automatically be put into a stage and shown.
	 * 

* Before the Stage is shown, it will be passed into the * {@link #prepareStage(Stage)} method, giving developers the opportunity to * customize the stage, e.g. to {@link Stage#initStyle(StageStyle) initialize a * stage style}. By default, {@code prepareStage()} does nothing. *

* Additionally, an {@code Application} component can provide a customized * {@link ExitPolicy} by overriding the {@link #getExitPolicy()} method. The * default is {@link ExitPolicy#SHUTDOWN_ON_STAGE_EXIT}. * * @author Michael Bachmann * */ public interface Application extends Standalone { /** * Provide this application's root layout node. This will be put in a stage and * shown. This method will always be called on the JavaFX Application Thread. *

* Currently, IoCFX will call this method only once per instance, however this * may change in future versions, so it is advised to make sure that this method * does not create a new layout every time it is called. * * @return the application layout's root node */ public Region getRootNode(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy