Internationalisation

This commit is contained in:
Antoine Bartuccio 2017-06-13 10:22:42 +02:00
parent 9e2814d7df
commit d5e76f437b
6 changed files with 22 additions and 17 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Explanation of demo + structure
file -> packages

View File

@ -4,10 +4,9 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<Pane fx:id="mainPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="608.0" prefWidth="813.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.sierpinski.gui.FXMLViewerController"> <Pane fx:id="mainPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="653.0" prefWidth="615.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.sarl.demos.sierpinski.gui.FXMLViewerController">
<children> <children>
<Canvas fx:id="drawZone" height="600.0" layoutX="199.0" layoutY="4.0" rotate="180.0" scaleX="-1.0" width="600.0" /> <Canvas fx:id="drawZone" height="600.0" layoutX="8.0" layoutY="3.0" rotate="180.0" scaleX="-1.0" width="600.0" />
<Button layoutX="26.0" layoutY="45.0" mnemonicParsing="false" onAction="#actionSetup" text="Setup" /> <Button fx:id="multiplyButton" layoutX="14.0" layoutY="612.0" mnemonicParsing="false" onAction="#actionMultiply" text="%DivideButtonText" />
<Button fx:id="multiplyButton" disable="true" layoutX="26.0" layoutY="89.0" mnemonicParsing="false" onAction="#actionMultiply" text="Multiply" />
</children> </children>
</Pane> </Pane>

View File

@ -1,27 +1,32 @@
package io.sarl.demos.sierpinski package io.sarl.demos.sierpinski
import javafx.application.Application import io.sarl.demos.sierpinski.gui.FXMLViewerController
import javafx.stage.Stage
import javafx.fxml.FXMLLoader
import java.net.URL import java.net.URL
import java.util.ResourceBundle
import javafx.application.Application
import javafx.fxml.FXMLLoader
import javafx.fxml.JavaFXBuilderFactory import javafx.fxml.JavaFXBuilderFactory
import javafx.scene.Parent import javafx.scene.Parent
import javafx.scene.Scene import javafx.scene.Scene
import io.sarl.demos.sierpinski.gui.FXMLViewerController import javafx.stage.Stage
class FractalesFXApplications extends Application { class FractalesFXApplications extends Application {
private var loader: FXMLLoader private var loader : FXMLLoader
private val bundle : ResourceBundle = ResourceBundle.getBundle(
FractalesFXApplications.getPackage.name.replaceAll("\\.", "/") + "/" + FractalesFXApplications.simpleName);
@Override @Override
public def start(stage: Stage) throws Exception { public def start(stage: Stage) throws Exception {
var location: URL = getClass().getResource("FractalesFXApplication.fxml") var location: URL = getClass().getResource("FractalesFXApplication.fxml")
loader = new FXMLLoader() loader = new FXMLLoader()
loader.setLocation(location) loader.setLocation(location)
loader.setBuilderFactory(new JavaFXBuilderFactory) loader.setBuilderFactory(new JavaFXBuilderFactory)
loader.resources = bundle
var root: Parent = loader.load(location.openStream) as Parent var root: Parent = loader.load(location.openStream) as Parent
var scene: Scene = new Scene(root) var scene: Scene = new Scene(root)
scene.stylesheets.add(class.getResource("ViewerController.css").toExternalForm) scene.stylesheets.add(class.getResource("ViewerController.css").toExternalForm)
stage.setTitle("SARL Demo: Sierpinski Fractal Animation") stage.setTitle(bundle.getString("TITLE"))
stage.setScene(scene) stage.setScene(scene)
stage.show stage.show
} }

View File

@ -0,0 +1,2 @@
TITLE=SARL Demo: Sierpinski Fractals Animation
DivideButtonText=Divide

View File

@ -0,0 +1,2 @@
TITLE=SARL Démo: Animation des Fractales de Sierpinski
DivideButtonText=Diviser

View File

@ -7,7 +7,6 @@ import javafx.fxml.FXML
import javafx.scene.canvas.Canvas import javafx.scene.canvas.Canvas
import javafx.scene.control.Button import javafx.scene.control.Button
import io.sarl.lang.core.Event import io.sarl.lang.core.Event
import javafx.^event.ActionEvent
import io.sarl.demos.sierpinski.agents.Fractal import io.sarl.demos.sierpinski.agents.Fractal
import io.janusproject.Boot import io.janusproject.Boot
import io.sarl.demos.sierpinski.objects.Square import io.sarl.demos.sierpinski.objects.Square
@ -50,18 +49,14 @@ class FXMLViewerController implements EventListener {
} }
} }
@FXML protected def actionSetup() { @FXML protected def actionMultiply() {
if (!setuped){ if (!setuped){
multiplyButton.setDisable(false)
Launcher.main( Launcher.main(
new Square(new Vector2D(0.0, 0.0), new Square(new Vector2D(0.0, 0.0),
600.0 600.0
), this ) ), this )
setuped = true setuped = true
} }
}
@FXML protected def actionMultiply() {
var m = new Multiply var m = new Multiply
m.source = new Address(ispace.spaceID, id) m.source = new Address(ispace.spaceID, id)
this.ispace.emit(m) this.ispace.emit(m)