fix TV bug where you could not convert multiple variables at the same time, also add set units field closes #940

This commit is contained in:
Scott Fennell 2020-02-06 12:19:55 -06:00
parent a6dbf0fa33
commit ea6ff1b233
2 changed files with 33 additions and 1 deletions

View File

@ -156,6 +156,9 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
/** field for manually entering variables */
JXTextField manualField;
/** field for manually entering variables */
JXTextField unitField;
/** check box for toggling Variable Tree visibility */
protected JCheckBoxMenuItem variableTreeCheckBox;
@ -1703,6 +1706,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
});
}};
constraints.weightx = 1;
add(manualField, constraints);
constraints.weightx = 0;
@ -1723,8 +1727,37 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
}
}
}), constraints);
constraints = new GridBagConstraints() {{
gridy = 1;
fill = BOTH;
}};
add(new JXLabel(" Set Units: "), constraints);
unitField = new JXTextField() {{
setAction(new AbstractAction() {
{
putValue(SHORT_DESCRIPTION, "Manually change units for all selected rows");
}
public void actionPerformed(ActionEvent actionEvent) {
try {
variableTable.setValueAt(getText(), 0, 2);
}
catch (IndexOutOfBoundsException indexOutOfBoundsException) {
JOptionPane.showMessageDialog(getMainFrame(),
"No variables selected", "No variables selected",
JOptionPane.ERROR_MESSAGE);
}
}
});
}};
constraints.weightx = 1;
add(unitField, constraints);
}};
add(manualPanel, BorderLayout.SOUTH);
}}) {{
setName("innerSplitPane");

View File

@ -431,7 +431,6 @@ public class VariableTable extends JXTable {
variable + "\" units to \"" + units + "\"");
ioException.printStackTrace(System.err);
}
break;
}
}