Skip to content

Commit 258a590

Browse files
committed
Initial implementation of helper methods and Model-View-X pattern.
1 parent c529175 commit 258a590

File tree

21 files changed

+1039
-1
lines changed

21 files changed

+1039
-1
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default line separator behavior, in case people don't have core.autocrlf set.
2+
* text=auto

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
syntax: glob
2+
3+
*.class
4+
build/
5+
out/
6+
lib/
7+
.settings/
8+
.cache
9+
.metadata/
10+
.idea/
11+
.idea/*
12+
.gradle/
13+
.history
14+
target
15+
lib_managed
16+
project/boot
17+
project/target
18+
*.iml
19+
*.log
20+
*.bak
21+
.classpath
22+
.project
23+
*.orig
24+
.worksheet/
25+
*.sc
26+
.externalToolBuilders/

.jvmopts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-Dfile.encoding=UTF8
2+
-Xms512M
3+
-Xmx1536M
4+
-Xss2M
5+
-XX:+CMSClassUnloadingEnabled

.sbtopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Dfile.encoding=UTF-8

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
sudo: false
2+
3+
language: scala
4+
scala:
5+
- 2.10.6
6+
- 2.11.8
7+
- 2.12.1
8+
9+
before_install:
10+
- "export DISPLAY=:99.0"
11+
- "sh -e /etc/init.d/xvfb start"
12+
13+
jdk:
14+
- oraclejdk8
15+
16+
install: true
17+
18+
script:
19+
- java -version
20+
- sbt test
21+
22+
branches:
23+
only:
24+
- master
25+
- stable
26+
27+
notifications:
28+
email:
29+
30+
31+
# Work around for default old version of Java provided by Travis CI
32+
addons:
33+
apt:
34+
packages:
35+
- oracle-java8-installer

ReadMe.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
ScalaFX Extras
22
==============
33

4-
Addition to ScalaFX to simplify use.
4+
Additions to ScalaFX that do not have corresponding concepts in JavaFX. The key parts are helper methods in `org.scalafx.extras` and support for a working with Model-View and FXML.
55

6+
Module `scalafx-extras-demos` has a demo StopWatch application that illustrates uses of the Model-View and FXML API.
7+
8+
9+
ScalaFX Extras is still quite experimental and APIs may change significantly.
10+
11+
12+
Discussion and Support
13+
----------------------
14+
15+
Please use [ScalaFX Users Group](https://groups.google.com/forum/#!forum/scalafx-users). Please report issues using the projects Issue tracker.
16+
17+
18+
License
19+
-------
20+
21+
BSD-3-Clause ScalaFX license.

build.sbt

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import java.net.URL
2+
3+
import scala.xml._
4+
5+
// @formatter:off
6+
7+
//
8+
// Environment variables used by the build:
9+
// GRAPHVIZ_DOT_PATH - Full path to Graphviz dot utility. If not defined Scaladocs will be build without diagrams.
10+
// JAR_BUILT_BY - Name to be added to Jar metadata field "Built-By" (defaults to System.getProperty("user.name")
11+
//
12+
13+
val projectVersion = "0.1.0-SNAPSHOT"
14+
val versionTagDir = if (projectVersion.endsWith("SNAPSHOT")) "master" else "v" + projectVersion
15+
16+
// ScalaFX project
17+
lazy val scalaFXExtrasProject = Project(
18+
id = "scalafx-extras",
19+
base = file("scalafx-extras"),
20+
settings = scalaFXExtrasSettings ++ Seq(
21+
description := "The ScalaFX Extras",
22+
fork in run := true,
23+
scalacOptions in(Compile, doc) ++= Seq(
24+
"-sourcepath", baseDirectory.value.toString,
25+
"-doc-root-content", baseDirectory.value + "/src/main/scala/root-doc.creole",
26+
"-doc-source-url", "https://github.com/SscalaFX-Extras/scalafx-extras/blob/" + versionTagDir + "/scalafx/€{FILE_PATH}.scala"
27+
) ++ (Option(System.getenv("GRAPHVIZ_DOT_PATH")) match {
28+
case Some(path) => Seq("-diagrams", "-diagrams-dot-path", path)
29+
case None => Seq.empty[String]
30+
})
31+
)
32+
)
33+
34+
// ScalaFX Demos project
35+
lazy val scalaFXExtrasDemosProject = Project(
36+
id = "scalafx-extras-demos",
37+
base = file("scalafx-extras-demos"),
38+
settings = scalaFXExtrasSettings ++ Seq(
39+
description := "The ScalaFX Extras demonstrations",
40+
fork in run := true,
41+
javaOptions ++= Seq(
42+
"-Xmx512M",
43+
"-Djavafx.verbose"
44+
),
45+
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
46+
publishArtifact := false
47+
)
48+
) dependsOn (scalaFXExtrasProject % "compile;test->test")
49+
50+
// Resolvers
51+
lazy val sonatypeNexusSnapshots = "Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
52+
lazy val sonatypeNexusStaging = "Sonatype Nexus Staging" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
53+
54+
// Add snapshots to root project to enable compilation with Scala SNAPSHOT compiler,
55+
// e.g., 2.11.0-SNAPSHOT
56+
resolvers += sonatypeNexusSnapshots
57+
58+
// Common settings
59+
lazy val scalaFXExtrasSettings = Seq(
60+
organization := "org.scalafx",
61+
version := projectVersion,
62+
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"),
63+
scalaVersion <<= crossScalaVersions { versions => versions.head },
64+
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8", "-feature"),
65+
scalacOptions in(Compile, doc) ++= Opts.doc.title("ScalaFX Extras API"),
66+
scalacOptions in(Compile, doc) ++= Opts.doc.version(projectVersion),
67+
scalacOptions in(Compile, doc) += s"-doc-external-doc:${scalaInstance.value.libraryJar}#http://www.scala-lang.org/api/${scalaVersion.value}/",
68+
scalacOptions in(Compile, doc) ++= Seq("-doc-footer", s"ScalaFX Extras API v.$projectVersion"),
69+
javacOptions ++= Seq(
70+
"-target", "1.8",
71+
"-source", "1.8",
72+
"-Xlint:deprecation"),
73+
libraryDependencies ++= Seq(
74+
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
75+
"org.scalafx" %% "scalafx" % "8.0.102-R11",
76+
"org.scalafx" %% "scalafxml-core-sfx8" % "0.2.2",
77+
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
78+
"junit" % "junit" % "4.12" % "test"),
79+
autoAPIMappings := true,
80+
manifestSetting,
81+
publishSetting,
82+
fork in Test := true,
83+
parallelExecution in Test := false,
84+
resolvers += sonatypeNexusSnapshots,
85+
// print junit-style XML for CI
86+
testOptions in Test <+= (target in Test) map {
87+
t => Tests.Argument(TestFrameworks.ScalaTest, "-u", "%s" format (t / "junitxmldir"))
88+
},
89+
shellPrompt in ThisBuild := { state => "sbt:" + Project.extract(state).currentRef.project + "> " }
90+
) ++ mavenCentralSettings
91+
92+
lazy val manifestSetting = packageOptions <+= (name, version, organization) map {
93+
(title, version, vendor) =>
94+
Package.ManifestAttributes(
95+
"Created-By" -> "Simple Build Tool",
96+
"Built-By" -> Option(System.getenv("JAR_BUILT_BY")).getOrElse(System.getProperty("user.name")),
97+
"Build-Jdk" -> System.getProperty("java.version"),
98+
"Specification-Title" -> title,
99+
"Specification-Version" -> version,
100+
"Specification-Vendor" -> vendor,
101+
"Implementation-Title" -> title,
102+
"Implementation-Version" -> version,
103+
"Implementation-Vendor-Id" -> vendor,
104+
"Implementation-Vendor" -> vendor
105+
)
106+
}
107+
108+
lazy val publishSetting = publishTo <<= version {
109+
version: String =>
110+
if (version.trim.endsWith("SNAPSHOT"))
111+
Some(sonatypeNexusSnapshots)
112+
else
113+
Some(sonatypeNexusStaging)
114+
}
115+
116+
// Metadata needed by Maven Central
117+
// See also http://maven.apache.org/pom.html#Developers
118+
lazy val mavenCentralSettings = Seq(
119+
homepage := Some(new URL("http://www.scalafx.org/")),
120+
startYear := Some(2016),
121+
licenses := Seq(("BSD", new URL("https://github.com/scalafx/scalafx-extras/blob/master/LICENSE.txt"))),
122+
pomExtra <<= (pomExtra, name, description) {
123+
(pom, name, desc) => pom ++ Group(
124+
<scm>
125+
<url>https://github.com/scalafx/scalafx-extras</url>
126+
<connection>scm:git:https://github.com/scalafx/scalafx-extras.git</connection>
127+
</scm>
128+
)
129+
}
130+
)

project/build.properties

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (c) 2011-2016, 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+
sbt.version=0.13.13
29+

project/plugin.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scalacOptions ++= Seq("-unchecked", "-deprecation")

project/sbt-sonatype.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// [https://github.com/xerial/sbt-sonatype]
2+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
3+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

0 commit comments

Comments
 (0)