se ejecuto limpieza del codigo, reformateo del codigo y optimizacion de los imports por parte del IDE

This commit is contained in:
Daniel Cortes
2019-01-20 02:16:59 -03:00
parent 4ddc2b2ee7
commit b14222c875
42 changed files with 293 additions and 326 deletions

View File

@@ -36,7 +36,7 @@ public class EgresosTableModel extends AbstractTableModel {
private NumberFormat nf;
public EgresosTableModel(){
public EgresosTableModel() {
super();
this.columns = new String[]{"", "Descripcion", "Valor", "Tipo"};
this.rows = new ArrayList<>();
@@ -61,31 +61,31 @@ public class EgresosTableModel extends AbstractTableModel {
public void addRow(Egreso egreso) {
rows.add(egreso);
this.fireTableRowsInserted(getRowCount()-1, getRowCount()-1);
this.fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
}
public void removeRow(int row){
public void removeRow(int row) {
this.rows.remove(row);
this.fireTableRowsDeleted(row,row);
this.fireTableRowsDeleted(row, row);
}
public void removeRows(){
public void removeRows() {
int rowCount = getRowCount();
if(rowCount > 0){
if (rowCount > 0) {
this.rows.clear();
this.fireTableRowsDeleted(0, rowCount-1);
this.fireTableRowsDeleted(0, rowCount - 1);
}
}
public void setEgreso(int editingId, Egreso egreso) {
this.rows.set(editingId, egreso);
this.fireTableRowsUpdated(0,getRowCount()-1);
this.fireTableRowsUpdated(0, getRowCount() - 1);
}
@Override
public Object getValueAt(int row, int col) {
switch (col){
switch (col) {
case 0:
return rows.get(row).getNro();
case 1:
@@ -98,7 +98,7 @@ public class EgresosTableModel extends AbstractTableModel {
return null;
}
public Egreso getEgreso(int row){
public Egreso getEgreso(int row) {
return rows.get(row);
}

View File

@@ -37,7 +37,7 @@ public class FondoTableModel extends AbstractTableModel {
private NumberFormat nf;
public FondoTableModel(){
public FondoTableModel() {
super();
this.columns = new String[]{"Valor", "Descripcion"};
this.rows = new ArrayList<>();
@@ -62,31 +62,31 @@ public class FondoTableModel extends AbstractTableModel {
public void addRow(CalculoFondo calculoFondo) {
rows.add(calculoFondo);
this.fireTableRowsInserted(getRowCount()-1, getRowCount()-1);
this.fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
}
public void removeRow(int row){
public void removeRow(int row) {
this.rows.remove(row);
this.fireTableRowsDeleted(row,row);
this.fireTableRowsDeleted(row, row);
}
public void removeRows(){
public void removeRows() {
int rowCount = getRowCount();
if(rowCount > 0){
if (rowCount > 0) {
this.rows.clear();
this.fireTableRowsDeleted(0, rowCount-1);
this.fireTableRowsDeleted(0, rowCount - 1);
}
}
public void setCalculoFondo(int editingId, CalculoFondo calculoFondo) {
this.rows.set(editingId, calculoFondo);
this.fireTableRowsUpdated(0,getRowCount()-1);
this.fireTableRowsUpdated(0, getRowCount() - 1);
}
@Override
public Object getValueAt(int row, int col) {
switch (col){
switch (col) {
case 0:
return nf.format(rows.get(row).getValor());
case 1:
@@ -95,7 +95,7 @@ public class FondoTableModel extends AbstractTableModel {
return null;
}
public CalculoFondo getCalculoFondo(int row){
public CalculoFondo getCalculoFondo(int row) {
return rows.get(row);
}
}

View File

@@ -37,7 +37,7 @@ public class IngresosTableModel extends AbstractTableModel {
public IngresosTableModel() {
super();
this.columns = new String[]{"Valor","N° Z Inicial", "N° Z Final", "N° Inicial", "N° Final", "Tipo"};
this.columns = new String[]{"Valor", "N° Z Inicial", "N° Z Final", "N° Inicial", "N° Final", "Tipo"};
this.rows = new ArrayList<>();
this.nf = NumberFormat.getIntegerInstance();
}

View File

@@ -29,10 +29,7 @@ import org.mariuszgromada.math.mxparser.Expression;
import javax.swing.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.NumberFormat;
import java.text.ParseException;
/**
* Crea un JTextField que formatea automaticamente su texto como un integer el cual se puede obtener
@@ -59,7 +56,7 @@ public class NumberFormatedTextField extends JTextField {
/**
* Guarda el integer entregado y lo muestra en el campo.
*/
public void setValue(int value){
public void setValue(int value) {
this.value = value;
this.setText(nf.format(value));
}
@@ -67,11 +64,11 @@ public class NumberFormatedTextField extends JTextField {
/**
* Llama a readValue por un bug seguramente relacionado con el focus listener:
* - No actualizaba el valor al momento de hacer requestfocus a otro componente, probablemente porque no alcanza
* a realizarse la accion antes que ocurra la siguiente
*
* a realizarse la accion antes que ocurra la siguiente
* <p>
* Fuerza a que se lea el valor en el textfield antes de retornarlo
*/
public int getValue(){
public int getValue() {
this.readValue();
return this.value;
}
@@ -80,14 +77,14 @@ public class NumberFormatedTextField extends JTextField {
* Lee el valor en el texto, ejecuta la operacion matematica que en caso que exista una y la almacena en el valor
* Si la operacion matematica es invalida, almacenara un 0
*/
private void readValue(){
private void readValue() {
String currentText = this.getText();
String stripedDots = currentText.replace(".", "");
String stripedDots = currentText.replace(".", "");
Expression expression = new Expression(stripedDots);
if(expression.checkSyntax()){
if (expression.checkSyntax()) {
this.value = (int) Math.floor(expression.calculate());
}else{
} else {
this.value = 0;
}
}
@@ -95,11 +92,11 @@ public class NumberFormatedTextField extends JTextField {
/**
* Formatea el value y lo muestra en el field
*/
private void formatText(){
private void formatText() {
this.setText(nf.format(this.value));
}
private class FieldFocusListener implements FocusListener{
private class FieldFocusListener implements FocusListener {
/**
* Selecciona todo al momento de ganar foco
*/