Skip to content
Snippets Groups Projects
Commit ee3d518f authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

Jasenen nayttaminen

parent d7b18c13
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package fxKerho;
import java.awt.Desktop;
import java.io.IOException;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
......@@ -11,11 +12,15 @@ import fi.jyu.mit.fxgui.ComboBoxChooser;
import fi.jyu.mit.fxgui.Dialogs;
import fi.jyu.mit.fxgui.ListChooser;
import fi.jyu.mit.fxgui.ModalController;
import fi.jyu.mit.fxgui.TextAreaOutputStream;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.text.Font;
import kerho.Jasen;
import kerho.Kerho;
import kerho.SailoException;
......@@ -33,6 +38,7 @@ public class KerhoGUIController implements Initializable {
@FXML private ComboBoxChooser<String> cbKentat;
@FXML private Label labelVirhe;
@FXML private ListChooser<Jasen> chooserJasenet;
@FXML private ScrollPane panelJasen;
private String kerhonnimi = "kelmit";
......@@ -120,10 +126,15 @@ public class KerhoGUIController implements Initializable {
// Tästä eteenpäin ei käyttöliittymään suoraan liittyvää koodia
private Kerho kerho;
private TextArea areaJasen = new TextArea(); // TODO: poista lopuksi
private void alusta() {
panelJasen.setContent(areaJasen);
areaJasen.setFont(new Font("Courier New", 12));
panelJasen.setFitToHeight(true);
chooserJasenet.clear();
chooserJasenet.addSelectionListener(e -> naytaJasen());
}
......@@ -201,6 +212,18 @@ public class KerhoGUIController implements Initializable {
}
}
private void naytaJasen() {
Jasen jasenKohdalla = chooserJasenet.getSelectedObject();
if (jasenKohdalla == null) return;
areaJasen.setText("");
try (PrintStream os = TextAreaOutputStream.getTextPrintStream(areaJasen)) {
jasenKohdalla.tulosta(os);
}
}
/**
* Astetaan käytettävä kerho
......
......@@ -107,7 +107,7 @@
<Label text="Jäsenen tiedot" BorderPane.alignment="CENTER" />
</top>
<center>
<ScrollPane fitToWidth="true" pannable="true" BorderPane.alignment="CENTER">
<ScrollPane fx:id="panelJasen" fitToWidth="true" pannable="true" BorderPane.alignment="CENTER">
<content>
<GridPane hgap="10.0">
<columnConstraints>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment