Empezar por lote

This commit is contained in:
Chris Cromer 2017-07-03 13:22:01 -04:00
parent 19f6c45033
commit 5a04629ac7
4 changed files with 62 additions and 4 deletions

View File

@ -0,0 +1,25 @@
package mt;
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
public class LoteController {
@FXML
private VBox vboxLote;
/**
* Boton Run MT de lote
*/
@FXML
protected void runLote() throws Exception {
Scene scene = vboxLote.getScene();
Maquina maquina = (Maquina) scene.getUserData();
if (maquina.comprobarCadena(new StringBuilder("000111###"), 5)) {
MT.mostrarMensaje("Resultado", "Reconce");
}
else {
MT.mostrarMensaje("Resultado", " No reconce");
}
}
}

View File

@ -23,6 +23,7 @@ import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.FileChooser;
import javafx.stage.Modality;
import javafx.stage.Stage;
import org.w3c.dom.Document;
@ -36,6 +37,8 @@ import java.util.regex.Pattern;
* Controlar las acciones cuando una opción es elegido en el menu.
*/
public class MenuController extends VBox implements Initializable {
Maquina maquina = null;
@FXML
private MenuBar menuBar;
@ -65,7 +68,6 @@ public class MenuController extends VBox implements Initializable {
protected void cargarTransiciones() throws Exception {
Scene scene = menuBar.getScene();
Stage stage = (Stage) scene.getWindow();
Maquina maquina;
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Abrir archivo XML");
File archivo = fileChooser.showOpenDialog(stage);
@ -88,7 +90,7 @@ public class MenuController extends VBox implements Initializable {
menuIndiv.setDisable(false);
menuLote.setDisable(false);
}
TableView<ListaCargada> tableView = FXMLLoader.load(getClass().getResource("tabla.fxml"));
TableView<ListaCargada> tableView = FXMLLoader.load(getClass().getResource("transiciones.fxml"));
VBox.setVgrow(tableView, Priority.ALWAYS);
tableView.skinProperty().addListener((source, oldWidth, newWidth) -> {
final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow");
@ -120,7 +122,7 @@ public class MenuController extends VBox implements Initializable {
}
/**
* Menu opción reconocimiento indivual
* Menu opción reconocimiento individual
*/
@FXML
protected void reconoceIndividual() {
@ -131,7 +133,19 @@ public class MenuController extends VBox implements Initializable {
* Menu opción reconocimiento lote
*/
@FXML
protected void reconoceLote() {
protected void reconoceLote() throws Exception {
Scene parentScene = menuBar.getScene();
Stage parentStage = (Stage) parentScene.getWindow();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("lote.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 640, 480);
scene.setUserData(maquina);
Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(parentStage);
stage.setTitle("Reconocimiento por lotes");
stage.setScene(scene);
stage.show();
}
}

19
src/mt/lote.fxml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017 Christopher Cromer
Copyright (c) 2017 Carlos Faúndez
This file is part of mt. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution.
This file may not be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file.
-->
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:id="vboxLote" fx:controller="mt.LoteController" prefHeight="480.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8.0.92">
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
<VBox alignment="CENTER" VBox.vgrow="ALWAYS" fx:id="contenido">
</VBox>
<Button text="Run MT" onAction="#runLote"/>
</ScrollPane>
</VBox>