- Fixed unhandled exception when user hits ctrl+ENTER with no data or bad data in the multiply text field.

- Changed variable from foo to tableFrame.  I find that tableFrame is more descriptive.
 - Added ability to use space as well as enter to open the selected table.  Using space seems to retain the selected table where enter instead shifts focus to the top level ROM node.
This commit is contained in:
Scotthew 2012-10-09 10:34:19 -07:00
parent e327afd360
commit baa2aa8867
3 changed files with 12 additions and 13 deletions

View File

@ -88,8 +88,8 @@ public class MDIDesktopPane extends JDesktopPane {
}
moveToFront(frame);
frame.setVisible(true);
TableFrame foo = (TableFrame) frame;
parent.updateTableToolBar(foo.getTable(), true);
TableFrame tableFrame = (TableFrame) frame;
parent.updateTableToolBar(tableFrame.getTable(), true);
try {
frame.setSelected(true);
} catch (PropertyVetoException e) {

View File

@ -49,10 +49,7 @@ public class RomTree extends JTree implements MouseListener {
setFont(new Font("Tahoma", Font.PLAIN, 11));
// key binding actions
Action enterAction = new AbstractAction() {
/**
*
*/
Action tableSelectAction = new AbstractAction() {
private static final long serialVersionUID = -6008026264821746092L;
@Override
@ -66,7 +63,9 @@ public class RomTree extends JTree implements MouseListener {
};
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");
this.getActionMap().put("enter", enterAction);
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "space");
this.getActionMap().put("enter", tableSelectAction);
this.getActionMap().put("space", tableSelectAction);
}
public ECUEditor getEditor() {
@ -97,13 +96,12 @@ public class RomTree extends JTree implements MouseListener {
editor.displayTable(node.getFrame());
}
setLastSelectedRom(selectedRow);
editor.getEditorMenuBar().updateMenu();
editor.getToolBar().updateButtons();
} catch (NullPointerException ex) {
}
}
private void setLastSelectedRom(Object selectedNode) {
TreePath selectedPath = getSelectionPath();
if (selectedNode instanceof TableTreeNode || selectedNode instanceof CategoryTreeNode || selectedNode instanceof RomTreeNode)
{
Object lastSelectedPathComponent = getLastSelectedPathComponent();

View File

@ -183,9 +183,6 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene
// key binding actions
Action enterAction = new AbstractAction() {
/**
*
*/
private static final long serialVersionUID = -6008026264821746092L;
@Override
@ -366,7 +363,11 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene
}
public void multiply() {
table.multiply(Double.parseDouble(setValueText.getText()));
try{
table.multiply(Double.parseDouble(setValueText.getText()));
}catch(NumberFormatException nex) {
// Do Nothing. setValueText is null or not a valid double.
}
}
public void incrementFine() {