Modified interface and fixed various things
This commit is contained in:
43
src/mt/ListaCargada.java
Normal file
43
src/mt/ListaCargada.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package mt;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
public class ListaCargada {
|
||||
private final SimpleStringProperty primer;
|
||||
|
||||
private final SimpleStringProperty segundo;
|
||||
|
||||
public ListaCargada(SimpleStringProperty primer, SimpleStringProperty segundo) {
|
||||
this.primer = primer;
|
||||
this.segundo = segundo;
|
||||
}
|
||||
|
||||
public ListaCargada(String primer, String segundo) {
|
||||
this.primer = new SimpleStringProperty(primer);
|
||||
this.segundo = new SimpleStringProperty(segundo);
|
||||
}
|
||||
|
||||
public String getPrimer() {
|
||||
return primer.get();
|
||||
}
|
||||
|
||||
public void setPrimer(String primer) {
|
||||
this.primer.set(primer);
|
||||
}
|
||||
|
||||
public SimpleStringProperty primerProperty() {
|
||||
return primer;
|
||||
}
|
||||
|
||||
public String getSegundo() {
|
||||
return segundo.get();
|
||||
}
|
||||
|
||||
public void setSegundo(String segundo) {
|
||||
this.segundo.set(segundo);
|
||||
}
|
||||
|
||||
public SimpleStringProperty segundoProperty() {
|
||||
return segundo;
|
||||
}
|
||||
}
|
@@ -8,16 +8,20 @@
|
||||
package mt;
|
||||
|
||||
import com.sun.javafx.scene.control.skin.TableHeaderRow;
|
||||
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.TableColumn;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -25,6 +29,8 @@ 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.
|
||||
@@ -33,6 +39,12 @@ public class MenuController extends VBox implements Initializable {
|
||||
@FXML
|
||||
private MenuBar menuBar;
|
||||
|
||||
@FXML
|
||||
private MenuItem menuIndiv;
|
||||
|
||||
@FXML
|
||||
private MenuItem menuLote;
|
||||
|
||||
/**
|
||||
* Inicialicar el menu con el idioma.
|
||||
*
|
||||
@@ -61,21 +73,42 @@ public class MenuController extends VBox implements Initializable {
|
||||
Document documento = xml.leerArchivo(archivo);
|
||||
if (documento != null) {
|
||||
maquina = new Maquina(documento);
|
||||
for (int i = 0; i < maquina.getMaquina().getEstados().size(); i++) {
|
||||
System.out.println(maquina.getMaquina().getEstados().get(i));
|
||||
TableView temp = (TableView) scene.lookup("#tableView");
|
||||
VBox contenido = (VBox) scene.lookup("#contenido");
|
||||
if (temp != null) {
|
||||
// Remover tabla anterior si existe
|
||||
contenido.getChildren().remove(temp);
|
||||
}
|
||||
TableView tableView = FXMLLoader.load(getClass().getResource("tabla.fxml"));
|
||||
HBox.setHgrow(tableView, Priority.ALWAYS);
|
||||
HBox contenido = (HBox) scene.lookup("#contenido");
|
||||
contenido.getChildren().add(tableView);
|
||||
TableColumn tableColumn1 = (TableColumn) tableView.getColumns().get(0);
|
||||
TableColumn tableColumn2 = (TableColumn) tableView.getColumns().get(1);
|
||||
else {
|
||||
Text text = new Text(0, 0, "TRANSICIONES CARGADAS");
|
||||
text.setFill(Color.BLACK);
|
||||
text.setFont(Font.font(java.awt.Font.SANS_SERIF, 25));
|
||||
contenido.getChildren().add(text);
|
||||
|
||||
menuIndiv.setDisable(false);
|
||||
menuLote.setDisable(false);
|
||||
}
|
||||
TableView<ListaCargada> 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));
|
||||
});
|
||||
tableColumn1.prefWidthProperty().bind(tableView.widthProperty().multiply(0.5));
|
||||
tableColumn2.prefWidthProperty().bind(tableView.widthProperty().multiply(0.5));
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
|
||||
ObservableList<ListaCargada> listaCargadas = 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)));
|
||||
}
|
||||
}
|
||||
|
||||
tableView.setEditable(true);
|
||||
tableView.setItems(listaCargadas);
|
||||
|
||||
contenido.getChildren().add(tableView);
|
||||
|
||||
/*if (maquina.comprobarCadena(new StringBuilder("000111###"), 5)) {
|
||||
MT.mostrarMensaje("Resultado", "Reconce");
|
||||
@@ -85,4 +118,20 @@ public class MenuController extends VBox implements Initializable {
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu opción reconocimiento indivual
|
||||
*/
|
||||
@FXML
|
||||
protected void reconoceIndividual() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu opción reconocimiento lote
|
||||
*/
|
||||
@FXML
|
||||
protected void reconoceLote() {
|
||||
|
||||
}
|
||||
}
|
@@ -10,8 +10,8 @@ This file may not be copied, modified, propagated, or distributed except accordi
|
||||
<?import javafx.scene.control.*?>
|
||||
<MenuBar xmlns:fx="http://javafx.com/fxml/1" fx:id="menuBar" fx:controller="mt.MenuController" xmlns="http://javafx.com/javafx/8.0.92">
|
||||
<Menu text="Operaciones">
|
||||
<MenuItem text="Cargar transiciones ..." onAction="#cargarTransiciones"/>
|
||||
<MenuItem text="Reconocimiento indiviudal ..." disable="true" onAction="#cargarTransiciones"/>
|
||||
<MenuItem text="Reconocimiento por lote ..." disable="true" onAction="#cargarTransiciones"/>
|
||||
<MenuItem text="Cargar transiciones" onAction="#cargarTransiciones"/>
|
||||
<MenuItem fx:id="menuIndiv" text="Reconocimiento indiviudal" disable="true" onAction="#reconoceIndividual"/>
|
||||
<MenuItem fx:id="menuLote" text="Reconocimiento por lote" disable="true" onAction="#reconoceLote"/>
|
||||
</Menu>
|
||||
</MenuBar>
|
@@ -12,4 +12,24 @@
|
||||
|
||||
.scroll-pane {
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.table-view {
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
#tableView .table-column {
|
||||
-fx-alignment: CENTER;
|
||||
}
|
||||
|
||||
.table-row-cell:empty {
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.table-row-cell:empty .table-cell {
|
||||
-fx-border-width: 0px;
|
||||
}
|
||||
|
||||
.list-cell:empty {
|
||||
-fx-background-color: transparent;
|
||||
}
|
@@ -8,12 +8,11 @@ This file may not be copied, modified, propagated, or distributed except accordi
|
||||
-->
|
||||
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml/1" prefHeight="480.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8.0.92">
|
||||
<fx:include source="menu.fxml"/>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="CENTER" VBox.vgrow="ALWAYS" fx:id="contenido">
|
||||
</HBox>
|
||||
<VBox alignment="CENTER" VBox.vgrow="ALWAYS" fx:id="contenido">
|
||||
</VBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
@@ -7,12 +7,21 @@ 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.cell.PropertyValueFactory?>
|
||||
<?import javafx.scene.control.TableColumn?>
|
||||
<?import javafx.scene.control.TableView?>
|
||||
<?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" editable="false" text="(qi,si)"/>
|
||||
<TableColumn fx:id="columna2" sortable="false" editable="false" text="(qj,sj,movimiento)"/>
|
||||
<TableColumn fx:id="columna1" sortable="false" text="(qi,si)">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="primer"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
<TableColumn fx:id="columna2" sortable="false" text="(qj,sj,movimiento)">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="segundo"/>
|
||||
</cellValueFactory>
|
||||
</TableColumn>
|
||||
</columns>
|
||||
</TableView>
|
Reference in New Issue
Block a user