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

Vaihe 7 - Tulostus

parent 9f33c8f8
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -482,13 +482,10 @@ public class KerhoGUIController implements Initializable {
public void tulostaValitut(TextArea text) {
try (PrintStream os = TextAreaOutputStream.getTextPrintStream(text)) {
os.println("Tulostetaan kaikki jäsenet");
Collection<Jasen> jasenet = kerho.etsi("", -1);
for (Jasen jasen:jasenet) {
for (Jasen jasen: chooserJasenet.getObjects()) {
tulosta(os, jasen);
os.println("\n\n");
}
} catch (SailoException ex) {
Dialogs.showMessageDialog("Jäsenen hakemisessa ongelmia! " + ex.getMessage());
}
}
}
package fxKerho;
import fi.jyu.mit.fxgui.Dialogs;
import fi.jyu.mit.fxgui.ModalController;
import fi.jyu.mit.fxgui.ModalControllerInterface;
import javafx.fxml.FXML;
import javafx.print.PrinterJob;
import javafx.scene.control.TextArea;
import javafx.scene.web.WebEngine;
/**
* Tulostuksen hoitava luokka
......@@ -21,7 +22,14 @@ public class TulostusController implements ModalControllerInterface<String> {
@FXML private void handleTulosta() {
Dialogs.showMessageDialog("Ei osata vielä tulostaa");
// Dialogs.showMessageDialog("Ei osata vielä tulostaa");
PrinterJob job = PrinterJob.createPrinterJob();
if ( job != null && job.showPrintDialog(null) ) {
WebEngine webEngine = new WebEngine();
webEngine.loadContent("<pre>" + tulostusAlue.getText() + "</pre>");
webEngine.print(job);
job.endJob();
}
}
......
......@@ -11,6 +11,7 @@ import org.junit.runners.Suite.SuiteClasses;
*/
@RunWith(Suite.class)
@SuiteClasses({
/*
kanta.test.HetuTarkistusTest.class,
kanta.test.SisaltaaTarkistajaTest.class,
kanta.test.TietueTest.class,
......@@ -19,6 +20,7 @@ import org.junit.runners.Suite.SuiteClasses;
kerho.test.HarrastusTest.class,
kerho.test.HarrastuksetTest.class,
kerho.test.KerhoTest.class
*/
})
public class AllTests {
//
......
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