MVCfx

org.scalafx.extras.mvcfx.MVCfx
abstract class MVCfx[T <: ControllerFX](fxmlFilePath: String)(implicit tag: ClassTag[T])

MVCfx is the "root" class for creation of UI components using MVCfx pattern. It instantiates and binds together the model, the controller, and the view (FXML).

The implementation of a class that extends MVCfx is very simple, it only needs instance of the model and information about location of the FXML resource. For example:

import org.scalafx.extras.mvcfx.MVCfx

class StopWatch(val model: StopWatchModel = new StopWatchModel())
 extends MVCfx[StopWatchController]("StopWatch.fxml"):

 def controllerInstance: StopWatchController = new StopWatchController(model)

The implementation will include:

  • StopWatch extends MVCfx
  • StopWatchModel extends ModelFX
  • StopWatchController extends ControllerFX
  • StopWatch.fxml

The complete example in in demo module.

See more details on MVCfx see MVCfx Pattern wiki.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

Create an instance of a controller.

Create an instance of a controller.

Example:

 def controllerInstance: MyController = new MyController(model)

where MyController extends ControllerFX

Attributes

def model: ModelFX

UI model for this component.

UI model for this component.

Attributes

Concrete methods

def createStage(title: String): Stage

Create a stage containing this component. The model is initialized on a separate thread.

Create a stage containing this component. The model is initialized on a separate thread.

Attributes

Concrete fields

lazy val view: Parent

Top level UI node for this component.

Top level UI node for this component.

Attributes