Skip to content

Commit 8fcac80

Browse files
committed
Provide Scala-3-specific documentation for ControllerFX
1 parent fbee949 commit 8fcac80

File tree

2 files changed

+102
-37
lines changed

2 files changed

+102
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2018, ScalaFX Project
2+
* Copyright (c) 2011-2021, ScalaFX Project
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -28,39 +28,35 @@
2828
package org.scalafx.extras.mvcfx
2929

3030
/**
31-
* The ControllerFX creates connection of the FXML to Scala code and underlying ModelFX for
32-
* the application logic.
33-
*
34-
* Constructor argument names correspond to controls defined in FXML and the model.
35-
* The constructor is used by ScalaFXML macro to automatically expose FXML controls in
36-
* Scala code of the view class.
37-
*
38-
* See more details in the [[org.scalafx.extras.mvcfx `org.scalafx.extras.mvcfx`]] documentation.
39-
*
40-
* Example:
41-
* {{{
42-
* import org.scalafx.extras.mvcfx.ControllerFX
43-
*
44-
* import scalafx.Includes._
45-
* import scalafx.scene.control.{Button, Label}
46-
* import scalafxml.core.macros.sfxml
47-
*
48-
* @sfxml
49-
* class StopWatchController(minutesLabel: Label,
50-
* secondsLabel: Label,
51-
* fractionLabel: Label,
52-
* startButton: Button,
53-
* stopButton: Button,
54-
* resetButton: Button,
55-
* model: StopWatchModel) extends ControllerFX {
56-
* ...
57-
* startButton.disable <== model.running
58-
* stopButton.disable <== !model.running
59-
* resetButton.disable <== model.running
60-
* ...
61-
* }
62-
* }}}
63-
*/
64-
trait ControllerFX {
65-
66-
}
31+
* The ControllerFX creates connection of the FXML to Scala code and underlying ModelFX for the application logic.
32+
*
33+
* Constructor argument names correspond to controls defined in FXML and the model. The constructor is used by ScalaFXML
34+
* macro to automatically expose FXML controls in Scala code of the view class.
35+
*
36+
* See more details in the [[org.scalafx.extras.mvcfx `org.scalafx.extras.mvcfx`]] documentation.
37+
*
38+
* Example:
39+
* {{{
40+
* import org.scalafx.extras.mvcfx.ControllerFX
41+
*
42+
* import scalafx.Includes._
43+
* import scalafx.scene.control.{Button, Label}
44+
* import scalafxml.core.macros.sfxml
45+
*
46+
* @sfxml
47+
* class StopWatchController(minutesLabel: Label,
48+
* secondsLabel: Label,
49+
* fractionLabel: Label,
50+
* startButton: Button,
51+
* stopButton: Button,
52+
* resetButton: Button,
53+
* model: StopWatchModel) extends ControllerFX {
54+
* ...
55+
* startButton.disable <== model.running
56+
* stopButton.disable <== !model.running
57+
* resetButton.disable <== model.running
58+
* ...
59+
* }
60+
* }}}
61+
*/
62+
trait ControllerFX
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2011-2021, ScalaFX Project
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the ScalaFX Project nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL THE SCALAFX PROJECT OR ITS CONTRIBUTORS BE LIABLE
20+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
package org.scalafx.extras.mvcfx
29+
30+
/**
31+
* The ControllerFX creates connection of the FXML to Scala code and underlying ModelFX for the application logic.
32+
*
33+
* Constructor argument names correspond to controls defined in FXML and the model. The constructor is used by ScalaFXML
34+
* macro to automatically expose FXML controls in Scala code of the view class.
35+
*
36+
* See more details in the [[org.scalafx.extras.mvcfx `org.scalafx.extras.mvcfx`]] documentation.
37+
*
38+
* Example:
39+
* {{{
40+
* import org.scalafx.extras.mvcfx.ControllerFX
41+
*
42+
* import scalafx.Includes.*
43+
* import scalafx.scene.control.{Button, Label}
44+
* import scalafxml.core.macros.sfxml
45+
*
46+
* import javafx.scene.control as jfxsc
47+
* import javafx.fxml as jfxf
48+
*
49+
* class StopWatchController(model: StopWatchModel) extends ControllerFX {
50+
*
51+
* @jfxf.FXML
52+
* private var startButton: jfxsc.Button = _
53+
* @jfxf.FXML
54+
* private var stopButton: jfxsc.Button = _
55+
* @jfxf.FXML
56+
* private var resetButton: jfxsc.Button = _
57+
* ...
58+
*
59+
* @jfxf.FXML
60+
* def initialize(): Unit = {
61+
* startButton.disable <== model.running
62+
* stopButton.disable <== !model.running
63+
* resetButton.disable <== model.running
64+
* ...
65+
* }
66+
* }
67+
* }}}
68+
*/
69+
trait ControllerFX

0 commit comments

Comments
 (0)