Skip to content

Commit 233e5b6

Browse files
committed
Merge branch 'master' into stable
2 parents c154309 + b57afcc commit 233e5b6

File tree

14 files changed

+124
-66
lines changed

14 files changed

+124
-66
lines changed

.travis.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,20 @@ sudo: false
22

33
language: scala
44
scala:
5-
#- 2.11.12
6-
- 2.12.7
5+
- 2.12.9
6+
- 2.13.0
77

8-
before_install:
9-
- "export DISPLAY=:99.0"
10-
- "sh -e /etc/init.d/xvfb start"
8+
dist: xenial
9+
services:
10+
- xvfb
1111

1212
jdk:
1313
- oraclejdk11
14-
14+
- oraclejdk12
15+
1516
install: true
1617

1718
script:
1819
- java -version
1920
- sbt test
2021

21-
branches:
22-
only:
23-
- master
24-
- stable
25-
26-
notifications:
27-
email:
28-
29-

ReadMe.md

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,18 @@ The demos module has a complete example of an simple application in `ShowMessage
100100

101101
### BusyWorker
102102

103-
BusyWorker helps running UI tasks a separate threads (other than the JavaFX Application thread).
104-
It will show busy cursor and disable specified nodes while task is performed.
103+
BusyWorker helps running a UI task on separate threads (other than the JavaFX Application thread).
104+
It will show busy cursor and disable specified nodes while the task is performed.
105105
It gives an option to show progress and status messages.
106-
`BusyWorker` run tasks and takes care of handling handling exceptions and displaying error dialogs.
107-
There is also option to perform custom finish actions after task is completed.
106+
`BusyWorker` takes care of handling handling exceptions and displaying error dialogs.
107+
It provides for an option to perform custom finish actions after task is completed.
108108

109-
A simple case of using `BusyWorker`.
110-
When the task is running, it will disable the root pane of the `parentWindow` to indicate that a task is performed.
111-
It will also change the cursor in the root pane to busy.
112-
When task is done, the cursor will be changed back to default and root pane will enabled back.
109+
#### Example 1
110+
111+
Below is a simple example of using `BusyWorker`.
112+
When the task is running, `BusyWorker` will disable the root pane of the `parentWindow` to indicate that a task is performed.
113+
It will also change the cursor in the root pane to "busy".
114+
When task is done, the cursor will be changed back to default and root pane will be enabled back.
113115

114116
```scala
115117
new BusyWorker("Simple Task", parentWindow).doTask { () =>
@@ -118,8 +120,9 @@ new BusyWorker("Simple Task", parentWindow).doTask { () =>
118120
}
119121
```
120122

121-
A little bit more elaborated example that updates a progress message and progress indicator.
122-
The full example can be found in the `BusyWorkerDemo`.
123+
#### Examnple 2
124+
125+
Her is a little bit more elaborated example. It updates a progress message and progress indicator.
123126
```scala
124127
val buttonPane: Pane = ...
125128
val progressLabel: Label = ...
@@ -148,14 +151,15 @@ The full example can be found in the `BusyWorkerDemo`.
148151
)
149152
}
150153
```
151-
154+
The full code example can be found in the
155+
[BusyWorkerDemo][BusyWorkerDemo].
152156

153157

154158
### Simpler Use of FXML with MVCfx Pattern
155159

156160
Package `org.scalafx.extras.mvcfx` contains classes for creating with UI components based on FXML.
157161

158-
The demos module has a complete example of a simple application: `StopWatchApp`.
162+
The demos module has a complete example of a simple application: [StopWatchApp][StopWatchDemo].
159163

160164
### ImageDisplay Component
161165

@@ -166,23 +170,33 @@ It can also automatically resizes to parent size.
166170
Demos
167171
-----
168172

169-
Module `scalafx-extras-demos` contains examples of using ScalaFX Extras.
173+
Module [scalafx-extras-demos][scalafx-extras-demos] contains examples of using ScalaFX Extras.
170174

171175
### StopWatch Application
172176

173-
`StopWatchApp` is an application that illustrates uses of the MVCfx: a Model-Controller and SFXML/FXML API.
177+
[StopWatchApp][StopWatchDemo] is an application that illustrates uses of the MVCfx: a Model-Controller and SFXML/FXML API.
178+
179+
![StopWatch Demo](notes/assets/StopWatchDemo.gif)
174180

175181
### ShowMessage Demo
176-
`ShowMessageDemoApp` is a full example of using `ShowMessage` and MVCfx.
182+
183+
[ShowMessageDemoApp][ShowMessageDemo] is a full example of using `ShowMessage` and MVCfx.
184+
185+
![ShowMessage Demo](notes/assets/ShowMessageDemo.gif)
177186

178187
### BusyWorker Demo
179-
`BusyWorkerDemo` illustrated different aspects of using `BusyWorker`.
188+
189+
[BusyWorkerDemo][BusyWorkerDemo] illustrated different aspects of using `BusyWorker`.
190+
191+
![BusyWorker Demo](notes/assets/BusyWorkerDemo.gif)
180192

181193
### ImageDisplay Demo
182194

183-
`ImageDisplayDemoApp` a simple example of an application that can display images,
195+
[ImageDisplayDemoApp][ImageDisplayDemo] a simple example of an application that can display images,
184196
with ability to zoom in, zoom out, and fit to current window. Illustrates use of the `ImageDisplay` component.
185197

198+
![Image Display Demo](notes/assets/ImageDisplayDemo.gif)
199+
186200
Status
187201
------
188202

@@ -200,3 +214,9 @@ License
200214
-------
201215

202216
BSD-3-Clause ScalaFX license.
217+
218+
[scalafx-extras-demos]: scalafx-extras-demos
219+
[BusyWorkerDemo]: scalafx-extras-demos/src/main/scala/org/scalafx/extras/BusyWorkerDemo.scala
220+
[ImageDisplayDemo]: scalafx-extras-demos\src\main\scala\org\scalafx\extras\image\ImageDisplayDemoApp.scala
221+
[ShowMessageDemo]: scalafx-extras-demos\src\main\scala\org\scalafx\extras\showmessage
222+
[StopWatchDemo]: scalafx-extras-demos\src\main\scala\org\scalafx\extras\mvcfx\stopwatch

build.sbt

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import java.net.URL
22

3+
import scala.xml.transform.{RewriteRule, RuleTransformer}
4+
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
5+
36
// @formatter:off
47

58
//
@@ -8,9 +11,9 @@ import java.net.URL
811
// JAR_BUILT_BY - Name to be added to Jar metadata field "Built-By" (defaults to System.getProperty("user.name")
912
//
1013

11-
val projectVersion = "0.3.0"
14+
val projectVersion = "0.3.1-SNAPSHOT"
1215
val versionTagDir = if (projectVersion.endsWith("SNAPSHOT")) "master" else "v" + projectVersion
13-
val _scalaVersions = Seq("2.12.7")
16+
val _scalaVersions = Seq("2.13.0", "2.12.9")
1417
val _scalaVersion = _scalaVersions.head
1518

1619
crossScalaVersions := _scalaVersions
@@ -24,8 +27,15 @@ lazy val OSName = System.getProperty("os.name") match {
2427
}
2528

2629
lazy val JavaFXModuleNames = Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
27-
lazy val JavaFXModuleLibs: Seq[ModuleID] =
28-
JavaFXModuleNames.map(m => "org.openjfx" % s"javafx-$m" % "11" classifier OSName)
30+
lazy val JavaFXModuleLibs: Seq[ModuleID] =
31+
JavaFXModuleNames.map(m => "org.openjfx" % s"javafx-$m" % "12.0.2" classifier OSName)
32+
33+
def isScala2_13plus(scalaVersion: String): Boolean = {
34+
CrossVersion.partialVersion(scalaVersion) match {
35+
case Some((2, n)) if n >= 13 => true
36+
case _ => false
37+
}
38+
}
2939

3040
// ScalaFX Extras project
3141
lazy val scalaFXExtras = (project in file("scalafx-extras")).settings(
@@ -39,7 +49,7 @@ lazy val scalaFXExtras = (project in file("scalafx-extras")).settings(
3949
) ++ (Option(System.getenv("GRAPHVIZ_DOT_PATH")) match {
4050
case Some(path) => Seq("-diagrams", "-diagrams-dot-path", path)
4151
case None => Seq.empty[String]
42-
}) ++ (if (_scalaVersion.startsWith("2.11")) Seq("-Xexperimental") else Seq.empty[String])
52+
})
4353
)
4454

4555
// ScalaFX Extras Demos project
@@ -51,10 +61,10 @@ lazy val scalaFXExtrasDemos = (project in file("scalafx-extras-demos")).settings
5161
"-Xmx512M",
5262
"-Djavafx.verbose"
5363
),
54-
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
64+
scalacOptions ++= Seq("-deprecation"),
5565
publishArtifact := false,
5666
libraryDependencies ++= Seq(
57-
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.0",
67+
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
5868
"ch.qos.logback" % "logback-classic" % "1.2.3"
5969
)
6070
).dependsOn(scalaFXExtras % "compile;test->test")
@@ -76,20 +86,45 @@ lazy val scalaFXExtrasSettings = Seq(
7686
scalacOptions in(Compile, doc) ++= Opts.doc.version(projectVersion),
7787
scalacOptions in(Compile, doc) += s"-doc-external-doc:${scalaInstance.value.libraryJar}#http://www.scala-lang.org/api/${scalaVersion.value}/",
7888
scalacOptions in(Compile, doc) ++= Seq("-doc-footer", s"ScalaFX Extras API v.$projectVersion"),
89+
// If using Scala 2.13 or better, enable macro processing through compiler option
90+
scalacOptions += (if (isScala2_13plus(scalaVersion.value)) "-Ymacro-annotations" else ""),
91+
// If using Scala 2.12 or lower, enable macro processing through compiler plugin
92+
libraryDependencies ++= (
93+
if (!isScala2_13plus(scalaVersion.value))
94+
Seq(compilerPlugin(
95+
"org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full))
96+
else
97+
Seq.empty[sbt.ModuleID]
98+
),
7999
javacOptions ++= Seq(
80100
// "-target", "1.8",
81101
// "-source", "1.8",
82102
"-Xlint:deprecation"),
83103
libraryDependencies ++= Seq(
84104
"com.beachape" %% "enumeratum" % "1.5.13",
85105
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
86-
"org.scalafx" %% "scalafx" % "11-R16",
87-
"org.scalafx" %% "scalafxml-core-sfx8" % "0.4",
88-
"org.scalatest" %% "scalatest" % "3.0.5" % "test"
106+
"org.scalafx" %% "scalafx" % "12.0.2-R18",
107+
"org.scalafx" %% "scalafxml-core-sfx8" % "0.5",
108+
"org.scalatest" %% "scalatest" % "3.0.8" % "test"
89109
) ++ JavaFXModuleLibs,
110+
// Use `pomPostProcess` to remove dependencies marked as "provided" from publishing in POM
111+
// This is to avoid dependency on wrong OS version JavaFX libraries
112+
// See also [https://stackoverflow.com/questions/27835740/sbt-exclude-certain-dependency-only-during-publish]
113+
pomPostProcess := { node: XmlNode =>
114+
new RuleTransformer(new RewriteRule {
115+
override def transform(node: XmlNode): XmlNodeSeq = node match {
116+
case e: Elem if e.label == "dependency" && e.child.exists(c => c.label == "scope" && c.text == "provided") =>
117+
val organization = e.child.filter(_.label == "groupId").flatMap(_.text).mkString
118+
val artifact = e.child.filter(_.label == "artifactId").flatMap(_.text).mkString
119+
val version = e.child.filter(_.label == "version").flatMap(_.text).mkString
120+
Comment(s"provided dependency $organization#$artifact;$version has been omitted")
121+
case _ => node
122+
}
123+
}).transform(node).head
124+
},
90125
autoAPIMappings := true,
91126
manifestSetting,
92-
publishSetting,
127+
publishTo := sonatypePublishToBundle.value,
93128
fork in run := true,
94129
fork in Test := true,
95130
parallelExecution in Test := false,
@@ -117,14 +152,6 @@ lazy val manifestSetting = packageOptions += {
117152
)
118153
}
119154

120-
lazy val publishSetting = publishTo := {
121-
val nexus = "https://oss.sonatype.org/"
122-
if (isSnapshot.value)
123-
Some("snapshots" at nexus + "content/repositories/snapshots")
124-
else
125-
Some("releases" at nexus + "service/local/staging/deploy/maven2")
126-
}
127-
128155
// Metadata needed by Maven Central
129156
// See also http://maven.apache.org/pom.html#Developers
130157
lazy val mavenCentralSettings = Seq(

notes/0.3.1.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
### ScalaFX-Extras Release v.0.3.1
2+
3+
Main objective of this release is to add support for Scala 2.13
4+
5+
Changes:
6+
7+
* [Issue #3][3] Do not catch Throwable
8+
* [Issue #4][4] Do not catch Throwable
9+
10+
11+
To post questions please use [ScalaFX Users Group][scalafx-users] of [StackOverflow ScalaFX][scalafx-overflow]
12+
13+
[scalafx-users]: https://groups.google.com/forum/#!forum/scalafx-users
14+
[scalafx-overflow]: https://stackoverflow.com/questions/tagged/scalafx
15+
16+
[3]: https://github.com/scalafx/scalafx-extras/issues/3
17+
[4]: https://github.com/scalafx/scalafx-extras/issues/4
18+

notes/assets/BusyWorkerDemo.gif

749 KB
Loading

notes/assets/ImageDisplayDemo.gif

3.45 MB
Loading

notes/assets/ShowMessageDemo.gif

4.42 MB
Loading

notes/assets/StopWatchDemo.gif

742 KB
Loading

project/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011-2018, ScalaFX Project
2+
# Copyright (c) 2011-2019, ScalaFX Project
33
# All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
@@ -24,5 +24,5 @@
2424
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
#
27-
sbt.version=1.2.6
27+
sbt.version=1.3.0
2828

project/sbt-sonatype.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// [https://github.com/xerial/sbt-sonatype]
2-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
2+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.7")
33
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")

0 commit comments

Comments
 (0)