Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/mt/LoteController.java
This commit is contained in:
carlos 2017-07-03 16:08:14 +00:00
commit 5ee076eb53
7 changed files with 75 additions and 38 deletions

View File

@ -109,7 +109,7 @@
<li>java.lang.Object</li> <li>java.lang.Object</li>
<li> <li>
<ul class="inheritance"> <ul class="inheritance">
<li>mt.ListaCargada</li> <li>mt.TablaData</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -3,7 +3,7 @@
<html lang="es"> <html lang="es">
<head> <head>
<!-- Generated by javadoc (1.8.0_131) on Thu Jun 29 22:57:17 CLT 2017 --> <!-- Generated by javadoc (1.8.0_131) on Thu Jun 29 22:57:17 CLT 2017 -->
<title>Uses of Class mt.ListaCargada</title> <title>Uses of Class mt.TablaData</title>
<meta name="date" content="2017-06-29"> <meta name="date" content="2017-06-29">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script> <script type="text/javascript" src="../../script.js"></script>
@ -70,9 +70,9 @@
</a></div> </a></div>
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ========= END OF TOP NAVBAR ========= -->
<div class="header"> <div class="header">
<h2 title="Uses of Class mt.ListaCargada" class="title">Uses of Class<br>mt.ListaCargada</h2> <h2 title="Uses of Class mt.TablaData" class="title">Uses of Class<br>mt.TablaData</h2>
</div> </div>
<div class="classUseContainer">No usage of mt.ListaCargada</div> <div class="classUseContainer">No usage of mt.TablaData</div>
<!-- ======= START OF BOTTOM NAVBAR ====== --> <!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom"> <div class="bottomNav"><a name="navbar.bottom">
<!-- --> <!-- -->

View File

@ -15,8 +15,7 @@ public class LoteController {
protected void runLote() throws Exception { protected void runLote() throws Exception {
Scene scene = vboxLote.getScene(); Scene scene = vboxLote.getScene();
Maquina maquina = (Maquina) scene.getUserData(); Maquina maquina = (Maquina) scene.getUserData();
int[] estados = {5}; if (maquina.comprobarCadena(new StringBuilder("000111###"), 5)) {
if (maquina.comprobarCadena(new StringBuilder("000111###"),estados)) {
MT.mostrarMensaje("Resultado", "Reconce"); MT.mostrarMensaje("Resultado", "Reconce");
} }
else { else {

View File

@ -12,11 +12,12 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.MenuBar; import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.layout.Priority; import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
@ -28,16 +29,14 @@ import javafx.stage.Stage;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import java.io.File; import java.io.File;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* Controlar las acciones cuando una opción es elegido en el menu. * Controlar las acciones cuando una opción es elegido en el menu.
*/ */
public class MenuController extends VBox implements Initializable { public class MenuController {
Maquina maquina = null; private Maquina maquina = null;
@FXML @FXML
private MenuBar menuBar; private MenuBar menuBar;
@ -48,17 +47,6 @@ public class MenuController extends VBox implements Initializable {
@FXML @FXML
private MenuItem menuLote; private MenuItem menuLote;
/**
* Inicialicar el menu con el idioma.
*
* @param location Tiene URL de FXML en uso.
* @param resourceBundle Tiene recursos qu se pasa al controller.
*/
@Override
public void initialize(URL location, ResourceBundle resourceBundle) {
// No es necesario poner algo aqui porque el programa mt no se usa los resourceBundles
}
/** /**
* Menu opción cargar transiciones * Menu opción cargar transiciones
* *
@ -90,7 +78,7 @@ public class MenuController extends VBox implements Initializable {
menuIndiv.setDisable(false); menuIndiv.setDisable(false);
menuLote.setDisable(false); menuLote.setDisable(false);
} }
TableView<ListaCargada> tableView = FXMLLoader.load(getClass().getResource("transiciones.fxml")); TableView<TablaData> tableView = FXMLLoader.load(getClass().getResource("tabla.fxml"));
VBox.setVgrow(tableView, Priority.ALWAYS); VBox.setVgrow(tableView, Priority.ALWAYS);
tableView.skinProperty().addListener((source, oldWidth, newWidth) -> { tableView.skinProperty().addListener((source, oldWidth, newWidth) -> {
final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow"); final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow");
@ -98,17 +86,20 @@ public class MenuController extends VBox implements Initializable {
}); });
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
ObservableList<ListaCargada> listaCargadas = FXCollections.observableArrayList(); ObservableList<TablaData> tablaData = FXCollections.observableArrayList();
Pattern pattern = Pattern.compile("(\\(.*\\)) = (\\(.*\\))"); Pattern pattern = Pattern.compile("(\\(.*\\)) = (\\(.*\\))");
for (int i = 0; i < maquina.getMaquina().getEstados().size(); i++) { for (int i = 0; i < maquina.getMaquina().getEstados().size(); i++) {
Matcher matcher = pattern.matcher(maquina.getMaquina().getEstados().get(i).toString()); Matcher matcher = pattern.matcher(maquina.getMaquina().getEstados().get(i).toString());
while (matcher.find()) { while (matcher.find()) {
listaCargadas.add(new ListaCargada(matcher.group(1), matcher.group(2))); tablaData.add(new TablaData(matcher.group(1), matcher.group(2)));
} }
} }
tableView.setEditable(true); tableView.setEditable(true);
tableView.setItems(listaCargadas); tableView.setItems(tablaData);
tableView.getColumns().get(0).setText("(qi,si)");
tableView.getColumns().get(1).setText("(qj,sj,movimiento)");
contenido.getChildren().add(tableView); contenido.getChildren().add(tableView);
@ -133,6 +124,7 @@ public class MenuController extends VBox implements Initializable {
* Menu opción reconocimiento lote * Menu opción reconocimiento lote
*/ */
@FXML @FXML
@SuppressWarnings("unchecked")
protected void reconoceLote() throws Exception { protected void reconoceLote() throws Exception {
Scene parentScene = menuBar.getScene(); Scene parentScene = menuBar.getScene();
Stage parentStage = (Stage) parentScene.getWindow(); Stage parentStage = (Stage) parentScene.getWindow();
@ -141,11 +133,36 @@ public class MenuController extends VBox implements Initializable {
fxmlLoader.setLocation(getClass().getResource("lote.fxml")); fxmlLoader.setLocation(getClass().getResource("lote.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 640, 480); Scene scene = new Scene(fxmlLoader.load(), 640, 480);
scene.setUserData(maquina); scene.setUserData(maquina);
scene.getStylesheets().add("/mt/mt.css");
Stage stage = new Stage(); Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL); stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(parentStage); stage.initOwner(parentStage);
stage.setTitle("Reconocimiento por lotes"); stage.setTitle("Reconocimiento por lotes");
stage.setMinHeight(480);
stage.setMinWidth(640);
stage.setScene(scene); stage.setScene(scene);
stage.show(); stage.show();
TableView<TablaData> tableView = FXMLLoader.load(getClass().getResource("tabla.fxml"));
VBox.setVgrow(tableView, Priority.ALWAYS);
tableView.skinProperty().addListener((source, oldWidth, newWidth) -> {
final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow");
header.reorderingProperty().addListener((observable, oldValue, newValue) -> header.setReordering(false));
});
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<TablaData, String> columna1 = (TableColumn<TablaData, String>) tableView.getColumns().get(0);
columna1.setCellFactory(TextFieldTableCell.forTableColumn());
columna1.setOnEditCommit(
columna -> columna.getTableView().getItems().get(columna.getTablePosition().getRow()).setPrimer(columna.getNewValue())
);
tableView.getColumns().get(0).setText("Cadena");
tableView.getColumns().get(0).setEditable(true);
tableView.getColumns().get(1).setText("Aceptada/Rechazada");
tableView.getColumns().get(1).setEditable(false);
VBox contenido = (VBox) scene.lookup("#contenidoLote");
contenido.getChildren().add(tableView);
} }
} }

View File

@ -2,17 +2,17 @@ package mt;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
public class ListaCargada { public class TablaData {
private final SimpleStringProperty primer; private final SimpleStringProperty primer;
private final SimpleStringProperty segundo; private final SimpleStringProperty segundo;
public ListaCargada(SimpleStringProperty primer, SimpleStringProperty segundo) { public TablaData(SimpleStringProperty primer, SimpleStringProperty segundo) {
this.primer = primer; this.primer = primer;
this.segundo = segundo; this.segundo = segundo;
} }
public ListaCargada(String primer, String segundo) { public TablaData(String primer, String segundo) {
this.primer = new SimpleStringProperty(primer); this.primer = new SimpleStringProperty(primer);
this.segundo = new SimpleStringProperty(segundo); this.segundo = new SimpleStringProperty(segundo);
} }

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (c) 2017 Christopher Cromer Copyright (c) 2017 Christopher Cromer
Copyright (c) 2017 Carlos Faúndez Copyright (c) 2017 Carlos Faúndez
@ -7,13 +8,33 @@ This file is part of mt. It is subject to the license terms in the LICENSE file
This file may not be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file. 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.geometry.Insets?>
<?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.*?>
<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"> <?import javafx.scene.text.Text?>
<VBox xmlns:fx="http://javafx.com/fxml/1" fx:id="vboxLote" prefHeight="480.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8.0.131" fx:controller="mt.LoteController">
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS"> <ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
<VBox alignment="CENTER" VBox.vgrow="ALWAYS" fx:id="contenido"> <VBox alignment="CENTER" VBox.vgrow="ALWAYS">
<VBox fx:id="contenidoLote" alignment="CENTER" VBox.vgrow="ALWAYS">
<padding>
<Insets left="5.0" right="5.0" top="5.0" bottom="5.0"/>
</padding>
</VBox>
<HBox alignment="CENTER" spacing="10.0">
<Text>Cadena:</Text>
<TextField id="cadena" fx:id="cadena" HBox.hgrow="ALWAYS"/>
<Button onAction="#agregarCadena" text="Agregar"/>
<padding>
<Insets left="5.0" right="5.0" top="5.0" bottom="5.0"/>
</padding>
</HBox>
<HBox alignment="CENTER" spacing="10.0">
<Button onAction="#runLote" text="Run MT"/>
<Button onAction="#cerrar" text="Cerrar"/>
<padding>
<Insets left="5.0" right="5.0" top="5.0" bottom="5.0"/>
</padding>
</HBox>
</VBox> </VBox>
<Button text="Run MT" onAction="#runLote"/>
</ScrollPane> </ScrollPane>
</VBox> </VBox>

View File

@ -13,12 +13,12 @@ This file may not be copied, modified, propagated, or distributed except accordi
<?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.GridPane?>
<TableView xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.92" fx:id="tableView" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS" GridPane.columnIndex="0" GridPane.rowIndex="0"> <TableView xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.92" fx:id="tableView" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS" GridPane.columnIndex="0" GridPane.rowIndex="0">
<columns> <columns>
<TableColumn fx:id="columna1" sortable="false" text="(qi,si)"> <TableColumn sortable="false">
<cellValueFactory> <cellValueFactory>
<PropertyValueFactory property="primer"/> <PropertyValueFactory property="primer"/>
</cellValueFactory> </cellValueFactory>
</TableColumn> </TableColumn>
<TableColumn fx:id="columna2" sortable="false" text="(qj,sj,movimiento)"> <TableColumn sortable="false">
<cellValueFactory> <cellValueFactory>
<PropertyValueFactory property="segundo"/> <PropertyValueFactory property="segundo"/>
</cellValueFactory> </cellValueFactory>