initial commit: overall class structure and small maven-compatible tornadofx app
This commit is contained in:
50
ide/ide.iml
Normal file
50
ide/ide.iml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="3" platform="JVM 1.8" useProjectSettings="false">
|
||||
<compilerSettings />
|
||||
<compilerArguments>
|
||||
<option name="jvmTarget" value="1.8" />
|
||||
<option name="languageVersion" value="1.3" />
|
||||
<option name="apiVersion" value="1.2" />
|
||||
<option name="pluginOptions">
|
||||
<array />
|
||||
</option>
|
||||
<option name="pluginClasspaths">
|
||||
<array />
|
||||
</option>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="no.tornado:tornadofx:1.7.17" level="project" />
|
||||
<orderEntry type="module" module-name="befunge" />
|
||||
<orderEntry type="library" name="Maven: no.tornado:tornadofx:1.7.17" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.glassfish:javax.json:1.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.json:javax.json-api:1.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-reflect:1.2.60" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test-junit:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test-common:1.3.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
87
ide/pom.xml
Normal file
87
ide/pom.xml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>befide</groupId>
|
||||
<artifactId>ide</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>befide ide</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<kotlin.version>1.3.0</kotlin.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- befide.befunge module -->
|
||||
<dependency>
|
||||
<groupId>befide</groupId>
|
||||
<artifactId>befunge</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- tornadofx -->
|
||||
<dependency>
|
||||
<groupId>no.tornado</groupId>
|
||||
<artifactId>tornadofx</artifactId>
|
||||
<version>1.7.17</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kotlin -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test-junit</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<!--<testSourceDirectory>src/test/kotlin</testSourceDirectory>-->
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
46
ide/src/main/kotlin/befide/ide/Sample.kt
Normal file
46
ide/src/main/kotlin/befide/ide/Sample.kt
Normal file
@@ -0,0 +1,46 @@
|
||||
package befide.ide
|
||||
|
||||
import befide.befunge.b93.B93Interpreter
|
||||
import befide.befunge.core.Interpreter
|
||||
import javafx.beans.property.SimpleIntegerProperty
|
||||
import javafx.scene.Parent
|
||||
import javafx.scene.control.Label
|
||||
import tornadofx.*
|
||||
|
||||
class SampleView : View() {
|
||||
private val controller: SampleController by inject()
|
||||
|
||||
override val root: Parent by fxml()
|
||||
|
||||
private val width: Label by fxid()
|
||||
private val height: Label by fxid()
|
||||
|
||||
init {
|
||||
importStylesheet(resources["style.css"])
|
||||
|
||||
width.bind(controller.width)
|
||||
height.bind(controller.height)
|
||||
}
|
||||
}
|
||||
|
||||
class SampleController : Controller() {
|
||||
private val bf: Interpreter = B93Interpreter()
|
||||
|
||||
val width = SimpleIntegerProperty()
|
||||
val height = SimpleIntegerProperty()
|
||||
|
||||
init {
|
||||
bf.fungeChanged += { updateFungeLabels() }
|
||||
|
||||
updateFungeLabels()
|
||||
}
|
||||
|
||||
fun updateFungeLabels() {
|
||||
width.set(bf.funge.width)
|
||||
height.set(bf.funge.height)
|
||||
}
|
||||
}
|
||||
|
||||
class SampleApp : App() {
|
||||
override val primaryView = SampleView::class
|
||||
}
|
||||
16
ide/src/main/resources/befide/ide/SampleView.fxml
Normal file
16
ide/src/main/resources/befide/ide/SampleView.fxml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<GridPane alignment="CENTER" minHeight="-Infinity" minWidth="-Infinity" prefHeight="200.0" prefWidth="300.0"
|
||||
xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Label text="Width: " styleClass="lbl"
|
||||
fx:id="widthLabel"/>
|
||||
<Label text="Height: " styleClass="lbl"
|
||||
fx:id="heightLabel" GridPane.rowIndex="1"/>
|
||||
<Label text="{width}" styleClass="val"
|
||||
fx:id="width" GridPane.columnIndex="1"/>
|
||||
<Label text="{height}" styleClass="val"
|
||||
fx:id="height" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||
</GridPane>
|
||||
16
ide/src/main/resources/befide/ide/style.css
Normal file
16
ide/src/main/resources/befide/ide/style.css
Normal file
@@ -0,0 +1,16 @@
|
||||
.lbl {
|
||||
-fx-text-fill: maroon;
|
||||
}
|
||||
|
||||
.val {
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
#heightLabel {
|
||||
-fx-font-style: italic;
|
||||
}
|
||||
|
||||
GridPane {
|
||||
-fx-font-size: 20px;
|
||||
-fx-font-family: Consolas, monospace;
|
||||
}
|
||||
Reference in New Issue
Block a user