Merge branch 'revert-72cb4943' into 'main'

Revert "Hello world"

See merge request odabasioglu1/sae5!4
main
Odabasioglu Cemal 2023-11-07 12:49:28 +00:00
commit 2a671dfe2d
2 changed files with 135 additions and 48 deletions

View File

@ -1,32 +0,0 @@
buildscript {
ext.kotlin_version = '1.2.51'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
compileKotlin {
kotlinOptions.jvmTarget= "1.8"
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'no.tornado:tornadofx:1.7.16'
testCompile "junit:junit:4.11"
testCompile 'org.assertj:assertj-core:3.9.0'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
task wrapper(type: Wrapper) {
gradleVersion = "4.6"
}

View File

@ -1,27 +1,146 @@
package example import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.foundation.layout.*
import androidx.compose.material.TextField
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import javafx.geometry.Pos @Composable
import tornadofx.* @Preview
fun App() {
class HelloWorld : View() { MaterialTheme {
override val root = hbox { val currentPage = remember { mutableStateOf("accueil") }
label("Hello world")
when (currentPage.value) {
"accueil" -> {
AccueilPage(
onAjouterMotClick = { currentPage.value = "formulaire" },
onImporterClick = { /* Action d'importation */ },
onExporterClick = { /* Action d'exportation */ }
)
} }
"formulaire" -> {
FormulairePage(onAnnulerClick = { currentPage.value = "accueil" })
} }
class HelloWorldStyle : Stylesheet() {
init {
root {
prefWidth = 400.px
prefHeight = 400.px
alignment = Pos.CENTER
fontSize = 50.px
} }
} }
} }
class HelloWorldApp : App(HelloWorld::class, HelloWorldStyle::class) @Composable
fun AccueilPage(
onAjouterMotClick: () -> Unit,
onImporterClick: () -> Unit,
onExporterClick: () -> Unit
) {
Column(
modifier = Modifier
.fillMaxSize() // Fills the maximum available width
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
fun main(args: Array<String>) { ) {
launch<HelloWorldApp>() Text(text = "Glossaire", style = MaterialTheme.typography.h5)
Button(onClick = onAjouterMotClick) {
Text("Ajouter un mot")
}
Button(onClick = onImporterClick) {
Text("Importer un fichier CSV")
}
Button(onClick = onExporterClick) {
Text("Exporter un fichier CSV")
}
}
}
@Composable
fun FormulairePage(onAnnulerClick: () -> Unit) {
MaterialTheme {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Nouveau contexte métier", style = MaterialTheme.typography.h5)
val mot = remember { mutableStateOf("") }
TextField(
value = mot.value,
onValueChange = { mot.value = it },
label = { Text("Mot") }
)
val description = remember { mutableStateOf("") }
TextField(
value = description.value,
onValueChange = { description.value = it },
label = { Text("Description") }
)
val contextePrincipal = remember { mutableStateOf("") }
TextField(
value = contextePrincipal.value,
onValueChange = { contextePrincipal.value = it },
label = { Text("Contexte principal") }
)
val contexte2 = remember { mutableStateOf("") }
TextField(
value = contexte2.value,
onValueChange = { contexte2.value = it },
label = { Text("Contexte 2") }
)
val lieA = remember { mutableStateOf("") }
TextField(
value = lieA.value,
onValueChange = { lieA.value = it },
label = { Text("Lié à") }
)
val synonyme = remember { mutableStateOf("") }
TextField(
value = synonyme.value,
onValueChange = { synonyme.value = it },
label = { Text("Synonyme") }
)
val antonyme = remember { mutableStateOf("") }
TextField(
value = antonyme.value,
onValueChange = { antonyme.value = it },
label = { Text("Antonyme") }
)
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Button(onClick = onAnnulerClick) {
Text("Annuler")
}
Button(onClick = { /* Action de validation */ }) {
Text("Valider")
}
}
}
}
}
fun main() = application {
Window(onCloseRequest = ::exitApplication) {
App()
}
} }