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>
<ul class="inheritance">
<li>mt.ListaCargada</li>
<li>mt.TablaData</li>
</ul>
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html lang="es">
<head>
<!-- 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">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
@ -70,9 +70,9 @@
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<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 class="classUseContainer">No usage of mt.ListaCargada</div>
<div class="classUseContainer">No usage of mt.TablaData</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->

View File

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

View File

@ -12,11 +12,12 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
@ -28,16 +29,14 @@ import javafx.stage.Stage;
import org.w3c.dom.Document;
import java.io.File;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.regex.Matcher;
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;
public class MenuController {
private Maquina maquina = null;
@FXML
private MenuBar menuBar;
@ -48,17 +47,6 @@ public class MenuController extends VBox implements Initializable {
@FXML
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
*
@ -90,7 +78,7 @@ public class MenuController extends VBox implements Initializable {
menuIndiv.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);
tableView.skinProperty().addListener((source, oldWidth, newWidth) -> {
final TableHeaderRow header = (TableHeaderRow) tableView.lookup("TableHeaderRow");
@ -98,17 +86,20 @@ public class MenuController extends VBox implements Initializable {
});
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
ObservableList<ListaCargada> listaCargadas = FXCollections.observableArrayList();
ObservableList<TablaData> tablaData = FXCollections.observableArrayList();
Pattern pattern = Pattern.compile("(\\(.*\\)) = (\\(.*\\))");
for (int i = 0; i < maquina.getMaquina().getEstados().size(); i++) {
Matcher matcher = pattern.matcher(maquina.getMaquina().getEstados().get(i).toString());
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.setItems(listaCargadas);
tableView.setItems(tablaData);
tableView.getColumns().get(0).setText("(qi,si)");
tableView.getColumns().get(1).setText("(qj,sj,movimiento)");
contenido.getChildren().add(tableView);
@ -133,6 +124,7 @@ public class MenuController extends VBox implements Initializable {
* Menu opción reconocimiento lote
*/
@FXML
@SuppressWarnings("unchecked")
protected void reconoceLote() throws Exception {
Scene parentScene = menuBar.getScene();
Stage parentStage = (Stage) parentScene.getWindow();
@ -141,11 +133,36 @@ public class MenuController extends VBox implements Initializable {
fxmlLoader.setLocation(getClass().getResource("lote.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 640, 480);
scene.setUserData(maquina);
scene.getStylesheets().add("/mt/mt.css");
Stage stage = new Stage();
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(parentStage);
stage.setTitle("Reconocimiento por lotes");
stage.setMinHeight(480);
stage.setMinWidth(640);
stage.setScene(scene);
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;
public class ListaCargada {
public class TablaData {
private final SimpleStringProperty primer;
private final SimpleStringProperty segundo;
public ListaCargada(SimpleStringProperty primer, SimpleStringProperty segundo) {
public TablaData(SimpleStringProperty primer, SimpleStringProperty segundo) {
this.primer = primer;
this.segundo = segundo;
}
public ListaCargada(String primer, String segundo) {
public TablaData(String primer, String segundo) {
this.primer = new SimpleStringProperty(primer);
this.segundo = new SimpleStringProperty(segundo);
}

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017 Christopher Cromer
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.
-->
<?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">
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?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">
<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>
<Button text="Run MT" onAction="#runLote"/>
</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?>
<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>
<TableColumn fx:id="columna1" sortable="false" text="(qi,si)">
<TableColumn sortable="false">
<cellValueFactory>
<PropertyValueFactory property="primer"/>
</cellValueFactory>
</TableColumn>
<TableColumn fx:id="columna2" sortable="false" text="(qj,sj,movimiento)">
<TableColumn sortable="false">
<cellValueFactory>
<PropertyValueFactory property="segundo"/>
</cellValueFactory>