use of javafx.fxml.FXMLLoader in project bitsquare by bitsquare.
the class FxmlViewLoader method loadFromFxml.
private View loadFromFxml(URL fxmlUrl) {
checkNotNull(fxmlUrl, "FXML URL must not be null");
try {
FXMLLoader loader = new FXMLLoader(fxmlUrl, resourceBundle);
loader.setControllerFactory(viewFactory);
loader.load();
Object controller = loader.getController();
if (controller == null)
throw new ViewfxException("Failed to load view from FXML file at [%s]. " + "Does it declare an fx:controller attribute?", fxmlUrl);
if (!(controller instanceof View))
throw new ViewfxException("Controller of type [%s] loaded from FXML file at [%s] " + "does not implement [%s] as expected.", controller.getClass(), fxmlUrl, View.class);
return (View) controller;
} catch (IOException ex) {
throw new ViewfxException(ex, "Failed to load view from FXML file at [%s]", fxmlUrl);
}
}
use of javafx.fxml.FXMLLoader in project PretendYoureXyzzyReborn by devgianlu.
the class GameCell method updateItem.
@Override
protected void updateItem(CGame item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
} else {
FXMLLoader loader = new FXMLLoader(getClass().getResource("GameCell.fxml"));
loader.setController(new Controller(item));
try {
setGraphic(loader.load());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
use of javafx.fxml.FXMLLoader in project PretendYoureXyzzyReborn by devgianlu.
the class PlayerCell method updateItem.
@Override
protected void updateItem(CPlayer item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
} else {
FXMLLoader loader = new FXMLLoader(getClass().getResource("PlayerCell.fxml"));
loader.setController(new Controller(item));
try {
setGraphic(loader.load());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
use of javafx.fxml.FXMLLoader in project PretendYoureXyzzyReborn by devgianlu.
the class UIClient method loadScene.
public static <T> void loadScene(@Nullable Stage stage, String title, String layout, @NotNull T controller) {
FXMLLoader loader = new FXMLLoader(controller.getClass().getResource(layout));
loader.setController(controller);
try {
Parent root = loader.load();
if (stage == null)
stage = new Stage();
stage.setTitle(title);
stage.setScene(new Scene(root));
stage.show();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
use of javafx.fxml.FXMLLoader in project arquivoProject by fader-azevedo.
the class CriarPautaController method scan.
@FXML
private void scan() throws IOException, DocumentException {
int numPDF = 20;
PdfReader[] pdfArray = new PdfReader[numPDF];
DBConnector gerrarPDF = new DBConnector(pdfArray);
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Por favor confirma");
alert.setHeaderText("Desejas Scannear mais uma pagina dessa Pauta?");
alert.setContentText("Caso sim, põe a página no scan!");
((Button) alert.getDialogPane().lookupButton(ButtonType.OK)).setText("Sim");
((Button) alert.getDialogPane().lookupButton(ButtonType.CANCEL)).setText("Não");
// array que vai possibilitar a remocao de pdf
String[] arrayFiles = new String[numPDF];
// array que vai possibilitar a remocao de pdf
int index = 0;
do {
Imaging imaging = new Imaging("myApp", 0);
Result result = imaging.scan(Request.fromJson("{" + "\"output_settings\" : [ {" + " \"type\" : \"save\"," + " \"format\" : \"pdf\"," + " \"save_path\" : \"documentos/pautas\\\\${TMS}${EXT}\"" + "} ]" + "}"), "select", false, false);
// salva o doc
if (result == null) {
return;
}
// formatcao do caminho
String url = result.getPdfFile().getPath().replace("\\", "/");
// busca o doc que acaba de ser guardado
PdfReader pdf = new PdfReader(url);
// preeche o array com a foto salva
gerrarPDF.preecherArrayPDF(pdf);
arrayFiles[index] = url;
index++;
} while (alert.showAndWait().get() == javafx.scene.control.ButtonType.OK);
iconCheck.setVisible(true);
btnScan.setDisable(true);
Calendar cal = Calendar.getInstance();
pdfNome = "pauta_" + new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(cal.getTime());
String pdfCaminho = gerrarPDF.gerrarPDFPauta(pdfNome);
/*ciclo de remocao*/
for (String arrayFile : arrayFiles) {
if (arrayFile != null) {
File f = new File(arrayFile);
f.delete();
}
}
FXMLLoader loader = new FXMLLoader();
loader.load(getClass().getResource("/view/PdfViewer.fxml").openStream());
Parent parent = loader.getRoot();
PdfViewerController pdfController = loader.getController();
pdfController.initialize();
pdfController.loadFile(pdfCaminho);
final Stage dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
Scene dialogScene = new Scene(parent, 500, 620);
dialog.setScene(dialogScene);
dialog.setTitle("Resultado de Scan");
dialog.setResizable(false);
dialog.show();
}
Aggregations