Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Add io.sarl.javafx library into the SDK.
- Loading branch information
1 parent
eedfcb6
commit 355e241
Showing
22 changed files
with
634 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-SymbolicName: io.sarl.javafx;singleton:=true | ||
Bundle-Version: 0.7.0.qualifier | ||
Bundle-Vendor: %Bundle-Vendor | ||
Bundle-Name: %Bundle-Name | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Export-Package: io.sarl.javafx | ||
Require-Bundle: io.sarl.util;bundle-version="0.7.0", | ||
io.sarl.core;bundle-version="0.7.0", | ||
org.eclipse.osgi;bundle-version="3.12.50" |
3 changes: 3 additions & 0 deletions
3
main/apiplugins/io.sarl.javafx/OSGI-INF/l10n/bundle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Properties file for io.sarl.core | ||
Bundle-Vendor = SARL.io | ||
Bundle-Name = SARL JavaFX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
source.. = src,\ | ||
src-gen | ||
src.excludes = **/*.sarlbin | ||
bin.includes = META-INF/,\ | ||
OSGI-INF/,\ | ||
. | ||
bin.excludes = **/*.java._trace,\ | ||
**/*.sarlbin,\ | ||
**/*.sarl | ||
jre.compilation.profile = JavaSE-1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.sarl</groupId> | ||
<artifactId>io.sarl.plugins.api</artifactId> | ||
<version>0.7.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>io.sarl.javafx</artifactId> | ||
<packaging>eclipse-plugin</packaging> | ||
<name>SDK JavaFX Library</name> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.sarl.maven</groupId> | ||
<artifactId>sarl-maven-plugin</artifactId> | ||
<!-- Maven extension mechanism seems not working due to the tycho module type. | ||
The different goals must be explicitly provided. --> | ||
<executions> | ||
<execution> | ||
<id>sarl-compiler-init</id> | ||
<phase>initialize</phase> | ||
<goals> | ||
<goal>initialize</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>sarl-compiler-compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>sarl-compiler-clean</id> | ||
<phase>clean</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<tycho>true</tycho> | ||
<source>${compiler.level}</source> | ||
<target>${compiler.level}</target> | ||
<encoding>${project.build.sourceEncoding}</encoding> | ||
<input>src/</input> | ||
<output>src-gen/</output> | ||
<runJavaCompiler>true</runJavaCompiler> | ||
<generateInlines>true</generateInlines> | ||
<generateStorageFiles>true</generateStorageFiles> | ||
<generateTraceFiles>true</generateTraceFiles> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
<configuration> | ||
<sourceDirectories> | ||
<sourceDirectory>src</sourceDirectory> | ||
</sourceDirectories> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<!-- ======================================= --> | ||
<!-- ==== Release Management === --> | ||
<!-- ======================================= --> | ||
<profiles> | ||
<profile> | ||
<id>default-profile</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-source-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
<profile> | ||
<id>maven-release-of-javafx-plugin</id> | ||
<activation> | ||
<property> | ||
<name>publicSarlApiModuleSet</name> | ||
<value>true</value> | ||
</property> | ||
</activation> | ||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.arakhne.afc.maven</groupId> | ||
<artifactId>tag-replacer</artifactId> | ||
<configuration> | ||
<sources> | ||
<source>${project.basedir}/src</source> | ||
<source>${project.basedir}/src-gen</source> | ||
</sources> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<configuration> | ||
<sourcepath>${project.build.directory}/generated-sources/java</sourcepath> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
72 changes: 72 additions & 0 deletions
72
main/apiplugins/io.sarl.javafx/src/io/sarl/javafx/FXBehavior.sarl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2018 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sarl.javafx | ||
|
||
import io.sarl.lang.core.Agent | ||
import io.sarl.core.AgentKilled | ||
import io.sarl.core.Behaviors | ||
import io.sarl.core.InnerContextAccess | ||
import io.sarl.core.Lifecycle | ||
|
||
/** Specific behavior for an agent that enables it to interact with | ||
* a JavaFX user interface. | ||
* | ||
* @author $Author: sgalland$ | ||
* @version $FullVersion$ | ||
* @mavengroupid $GroupId$ | ||
* @mavenartifactid $ArtifactId$ | ||
* @since 0.7 | ||
*/ | ||
behavior FXBehavior { | ||
|
||
uses Lifecycle, InnerContextAccess, Behaviors | ||
|
||
var exited = false | ||
|
||
/** Constructor. | ||
* | ||
* @param controller the JavaFX controller to be linked to. | ||
*/ | ||
new (owner : Agent, controller : FxViewerController) { | ||
super(owner) | ||
controller.UISpace.register(asEventListener) | ||
} | ||
|
||
|
||
/** Kill itself on Exit signal when no inner agent. | ||
*/ | ||
on AppExit [!hasMemberAgent] { | ||
killMe | ||
} | ||
|
||
/** Transmit Exit signal to all inner agent. | ||
*/ | ||
on AppExit [!exited && hasMemberAgent] { | ||
exited = true | ||
innerContext.defaultSpace.emit(ID, new AppExit) | ||
} | ||
|
||
on AgentKilled [exited && it.inInnerDefaultSpace && !hasMemberAgent] { | ||
killMe | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
main/apiplugins/io.sarl.javafx/src/io/sarl/javafx/FxApplication.sarl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2018 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sarl.javafx | ||
|
||
import javafx.application.Application | ||
import javafx.fxml.FXMLLoader | ||
import javafx.stage.Stage | ||
|
||
/** | ||
* Abstract implementation of a JavaFX application that is embedding SARL agents. | ||
* | ||
* @author $Author: sgalland$ | ||
* @version $FullVersion$ | ||
* @mavengroupid $GroupId$ | ||
* @mavenartifactid $ArtifactId$ | ||
* @since 0.7 | ||
*/ | ||
abstract class FxApplication extends Application { | ||
|
||
/** The JavaFX loader. | ||
*/ | ||
var loader : FXMLLoader | ||
|
||
/** Start the JavaFX application. | ||
* | ||
* @param stage the JavaFX stage. | ||
*/ | ||
final override start(stage : Stage) { | ||
this.loader = stage.doApplicationStart | ||
stage.show | ||
} | ||
|
||
/** Kill the agents and stop the JavaFX application. | ||
*/ | ||
override stop { | ||
if (loader !== null && loader.controller instanceof FxViewerController) { | ||
(loader.controller as FxViewerController).safeExit | ||
} | ||
super.stop | ||
} | ||
|
||
/** Start the application. This function must be overridden within the application software | ||
* in order to initialize the JavaFX user interface that is dedicated to the application. | ||
* | ||
* @param stage the JavaFX stage. That is used for initializing JavaFX. | ||
* @return the loader of FXML, i.e. of uuser interface, that is dedicated to the application. | ||
*/ | ||
protected abstract def doApplicationStart(stage : Stage) : FXMLLoader | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
main/apiplugins/io.sarl.javafx/src/io/sarl/javafx/FxEvents.sarl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2018 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sarl.javafx | ||
|
||
/* Triggered when the JavaFX application needs to be exited. | ||
* | ||
* @author $Author: sgalland$ | ||
* @version $FullVersion$ | ||
* @mavengroupid $GroupId$ | ||
* @mavenartifactid $ArtifactId$ | ||
* @since 0.7 | ||
*/ | ||
event AppExit |
Oops, something went wrong.