import jexer.bits.CellAttributes;
import jexer.event.TKeypressEvent;
-import jexer.event.TMenuEvent;
import jexer.event.TMouseEvent;
import jexer.event.TResizeEvent;
-import jexer.menu.TMenu;
import static jexer.TKeypress.*;
/**
THICK,
}
+ /**
+ * If true, put a grid of numbers in the cells.
+ */
+ private static final boolean DEBUG = false;
+
/**
* Row label width.
*/
/**
* Extra rows to add.
*/
- private static final int EXTRA_ROWS = 10;
+ private static final int EXTRA_ROWS = (DEBUG ? 10 : 0);
/**
* Extra columns to add.
*/
- private static final int EXTRA_COLUMNS = 10 * (8 + 1);
+ private static final int EXTRA_COLUMNS = (DEBUG ? 10 * (8 + 1) : 0);
// ------------------------------------------------------------------------
// Variables --------------------------------------------------------------
for (int j = 0; j < width + EXTRA_COLUMNS;
j += columns.get(0).width) {
- Cell cell = new Cell(this, 0, 0, /* j, i, */ columns.get(0).width,
+ Cell cell = new Cell(this, 0, 0, columns.get(0).width,
rows.get(0).height, column, row);
- // DEBUG: set a grid of cell index labels
- // TODO: remove this
- cell.setText("" + row + " " + column);
+ if (DEBUG) {
+ // For debugging: set a grid of cell index labels.
+ cell.setText("" + row + " " + column);
+ }
rows.get(row).add(cell);
columns.get(column).add(cell);
if ((i == 0) &&
activate(columns.get(selectedColumn).get(selectedRow));
alignGrid();
-
- // Set the menu to match the flags.
- getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_ROW_LABELS).
- setChecked(showRowLabels);
- getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_COLUMN_LABELS).
- setChecked(showColumnLabels);
- getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_ROW).
- setChecked(highlightRow);
- getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_COLUMN).
- setChecked(highlightColumn);
-
-
}
// ------------------------------------------------------------------------
bottomRightCorner();
}
- /**
- * Handle posted menu events.
- *
- * @param menu menu event
- */
- @Override
- public void onMenu(final TMenuEvent menu) {
- TInputBox inputBox;
-
- switch (menu.getId()) {
- case TMenu.MID_TABLE_RENAME_COLUMN:
- inputBox = inputBox(i18n.getString("renameColumnInputTitle"),
- i18n.getString("renameColumnInputCaption"),
- getColumnLabel(selectedColumn), TMessageBox.Type.OKCANCEL);
- if (inputBox.isOk()) {
- setColumnLabel(selectedColumn, inputBox.getText());
- }
- break;
- case TMenu.MID_TABLE_RENAME_ROW:
- inputBox = inputBox(i18n.getString("renameRowInputTitle"),
- i18n.getString("renameRowInputCaption"),
- getRowLabel(selectedRow), TMessageBox.Type.OKCANCEL);
- if (inputBox.isOk()) {
- setRowLabel(selectedRow, inputBox.getText());
- }
- break;
- case TMenu.MID_TABLE_VIEW_ROW_LABELS:
- showRowLabels = getApplication().getMenuItem(menu.getId()).getChecked();
- break;
- case TMenu.MID_TABLE_VIEW_COLUMN_LABELS:
- showColumnLabels = getApplication().getMenuItem(menu.getId()).getChecked();
- break;
- case TMenu.MID_TABLE_VIEW_HIGHLIGHT_ROW:
- highlightRow = getApplication().getMenuItem(menu.getId()).getChecked();
- break;
- case TMenu.MID_TABLE_VIEW_HIGHLIGHT_COLUMN:
- highlightColumn = getApplication().getMenuItem(menu.getId()).getChecked();
- break;
- case TMenu.MID_TABLE_BORDER_NONE:
- topBorder = Border.NONE;
- leftBorder = Border.NONE;
- for (int i = 0; i < columns.size(); i++) {
- columns.get(i).rightBorder = Border.NONE;
- }
- for (int i = 0; i < rows.size(); i++) {
- rows.get(i).bottomBorder = Border.NONE;
- rows.get(i).height = 1;
- }
- break;
- case TMenu.MID_TABLE_BORDER_ALL:
- topBorder = Border.SINGLE;
- leftBorder = Border.SINGLE;
- for (int i = 0; i < columns.size(); i++) {
- columns.get(i).rightBorder = Border.SINGLE;
- }
- for (int i = 0; i < rows.size(); i++) {
- rows.get(i).bottomBorder = Border.SINGLE;
- rows.get(i).height = 2;
- }
- break;
- case TMenu.MID_TABLE_BORDER_CELL_NONE:
- if (selectedRow == 0) {
- topBorder = Border.NONE;
- }
- if (selectedColumn == 0) {
- leftBorder = Border.NONE;
- }
- columns.get(selectedColumn).rightBorder = Border.NONE;
- rows.get(selectedRow).bottomBorder = Border.NONE;
- rows.get(selectedRow).height = 1;
- break;
- case TMenu.MID_TABLE_BORDER_CELL_ALL:
- if (selectedRow == 0) {
- topBorder = Border.SINGLE;
- }
- if (selectedColumn == 0) {
- leftBorder = Border.SINGLE;
- }
- columns.get(selectedColumn).rightBorder = Border.SINGLE;
- rows.get(selectedRow).bottomBorder = Border.SINGLE;
- rows.get(selectedRow).height = 2;
- break;
- case TMenu.MID_TABLE_BORDER_RIGHT:
- columns.get(selectedColumn).rightBorder = Border.SINGLE;
- break;
- case TMenu.MID_TABLE_BORDER_LEFT:
- if (selectedColumn == 0) {
- leftBorder = Border.SINGLE;
- } else {
- columns.get(selectedColumn - 1).rightBorder = Border.SINGLE;
- }
- break;
- case TMenu.MID_TABLE_BORDER_TOP:
- if (selectedRow == 0) {
- topBorder = Border.SINGLE;
- } else {
- rows.get(selectedRow - 1).bottomBorder = Border.SINGLE;
- rows.get(selectedRow - 1).height = 2;
- }
- break;
- case TMenu.MID_TABLE_BORDER_BOTTOM:
- rows.get(selectedRow).bottomBorder = Border.SINGLE;
- rows.get(selectedRow).height = 2;
- break;
- case TMenu.MID_TABLE_BORDER_DOUBLE_BOTTOM:
- rows.get(selectedRow).bottomBorder = Border.DOUBLE;
- rows.get(selectedRow).height = 2;
- break;
- case TMenu.MID_TABLE_BORDER_THICK_BOTTOM:
- rows.get(selectedRow).bottomBorder = Border.THICK;
- rows.get(selectedRow).height = 2;
- break;
- case TMenu.MID_TABLE_DELETE_LEFT:
- deleteCellShiftLeft();
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_DELETE_UP:
- deleteCellShiftUp();
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_DELETE_ROW:
- deleteRow(selectedRow);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_DELETE_COLUMN:
- deleteColumn(selectedColumn);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_INSERT_LEFT:
- insertColumnLeft(selectedColumn);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_INSERT_RIGHT:
- insertColumnRight(selectedColumn);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_INSERT_ABOVE:
- insertRowAbove(selectedColumn);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_INSERT_BELOW:
- insertRowBelow(selectedColumn);
- activate(columns.get(selectedColumn).get(selectedRow));
- break;
- case TMenu.MID_TABLE_COLUMN_NARROW:
- columns.get(selectedColumn).width--;
- for (Cell cell: getSelectedColumn().cells) {
- cell.setWidth(columns.get(selectedColumn).width);
- cell.field.setWidth(columns.get(selectedColumn).width);
- }
- for (int i = selectedColumn + 1; i < columns.size(); i++) {
- columns.get(i).setX(columns.get(i).getX() - 1);
- }
- break;
- case TMenu.MID_TABLE_COLUMN_WIDEN:
- columns.get(selectedColumn).width++;
- for (Cell cell: getSelectedColumn().cells) {
- cell.setWidth(columns.get(selectedColumn).width);
- cell.field.setWidth(columns.get(selectedColumn).width);
- }
- for (int i = selectedColumn + 1; i < columns.size(); i++) {
- columns.get(i).setX(columns.get(i).getX() + 1);
- }
- break;
- case TMenu.MID_TABLE_FILE_SAVE_CSV:
- // TODO
- break;
- case TMenu.MID_TABLE_FILE_SAVE_TEXT:
- // TODO
- break;
- default:
- super.onMenu(menu);
- }
-
- // Fix/redraw the display.
- alignGrid();
- }
-
// ------------------------------------------------------------------------
// TWidget ----------------------------------------------------------------
// ------------------------------------------------------------------------
alignGrid();
}
+ /**
+ * Get the highlight row flag.
+ *
+ * @return true if the selected row is highlighted
+ */
+ public boolean getHighlightRow() {
+ return highlightRow;
+ }
+
+ /**
+ * Set the highlight row flag.
+ *
+ * @param highlightRow if true, the selected row will be highlighted
+ */
+ public void setHighlightRow(final boolean highlightRow) {
+ this.highlightRow = highlightRow;
+ }
+
+ /**
+ * Get the highlight column flag.
+ *
+ * @return true if the selected column is highlighted
+ */
+ public boolean getHighlightColumn() {
+ return highlightColumn;
+ }
+
+ /**
+ * Set the highlight column flag.
+ *
+ * @param highlightColumn if true, the selected column will be highlighted
+ */
+ public void setHighlightColumn(final boolean highlightColumn) {
+ this.highlightColumn = highlightColumn;
+ }
+
+ /**
+ * Get the show row labels flag.
+ *
+ * @return true if row labels are shown
+ */
+ public boolean getShowRowLabels() {
+ return showRowLabels;
+ }
+
+ /**
+ * Set the show row labels flag.
+ *
+ * @param showRowLabels if true, the row labels will be shown
+ */
+ public void setShowRowLabels(final boolean showRowLabels) {
+ this.showRowLabels = showRowLabels;
+ }
+
+ /**
+ * Get the show column labels flag.
+ *
+ * @return true if column labels are shown
+ */
+ public boolean getShowColumnLabels() {
+ return showColumnLabels;
+ }
+
+ /**
+ * Set the show column labels flag.
+ *
+ * @param showColumnLabels if true, the column labels will be shown
+ */
+ public void setShowColumnLabels(final boolean showColumnLabels) {
+ this.showColumnLabels = showColumnLabels;
+ }
+
/**
* Get the number of columns.
*
}
/**
- * Save contents to file.
+ * Save contents to file in CSV format.
*
* @param filename file to save to
* @throws IOException if a java.io operation throws
*/
- public void saveToFilename(final String filename) throws IOException {
+ public void saveToCsvFilename(final String filename) throws IOException {
+ // TODO
+ }
+
+ /**
+ * Save contents to file in text format with lines.
+ *
+ * @param filename file to save to
+ * @throws IOException if a java.io operation throws
+ */
+ public void saveToTextFilename(final String filename) throws IOException {
// TODO
}
throw new IndexOutOfBoundsException("Column count is " +
columns.size() + ", requested index " + column);
}
+
+ if (width < 4) {
+ // Columns may not be smaller than 4 cells wide.
+ return;
+ }
+
+ int delta = width - columns.get(column).width;
columns.get(column).width = width;
+ for (Cell cell: columns.get(column).cells) {
+ cell.setWidth(columns.get(column).width);
+ cell.field.setWidth(columns.get(column).width);
+ }
+ for (int i = column + 1; i < columns.size(); i++) {
+ columns.get(i).setX(columns.get(i).getX() + delta);
+ }
+ if (column == columns.size() - 1) {
+ bottomRightCorner();
+ } else {
+ alignGrid();
+ }
}
/**
}
insertRowAt(selectedRow);
selectedRow++;
+ activate(columns.get(selectedColumn).get(selectedRow));
}
/**
int idx = selectedRow + 1;
if (idx < rows.size()) {
insertRowAt(idx);
+ activate(columns.get(selectedColumn).get(selectedRow));
return;
}
}
rows.add(newRow);
alignGrid();
+ activate(columns.get(selectedColumn).get(selectedRow));
}
/**
if (selectedRow == rows.size()) {
selectedRow--;
}
+ activate(columns.get(selectedColumn).get(selectedRow));
bottomRightCorner();
}
}
insertColumnAt(selectedColumn);
selectedColumn++;
+ activate(columns.get(selectedColumn).get(selectedRow));
}
/**
int idx = selectedColumn + 1;
if (idx < columns.size()) {
insertColumnAt(idx);
+ activate(columns.get(selectedColumn).get(selectedRow));
return;
}
}
columns.add(newColumn);
alignGrid();
+ activate(columns.get(selectedColumn).get(selectedRow));
}
/**
if (selectedColumn == columns.size()) {
selectedColumn--;
}
+ activate(columns.get(selectedColumn).get(selectedRow));
bottomRightCorner();
}
}
}
+ /**
+ * Set all borders across the entire table to Border.NONE.
+ */
+ public void setBorderAllNone() {
+ topBorder = Border.NONE;
+ leftBorder = Border.NONE;
+ for (int i = 0; i < columns.size(); i++) {
+ columns.get(i).rightBorder = Border.NONE;
+ }
+ for (int i = 0; i < rows.size(); i++) {
+ rows.get(i).bottomBorder = Border.NONE;
+ rows.get(i).height = 1;
+ }
+ bottomRightCorner();
+ }
+
+ /**
+ * Set all borders across the entire table to Border.SINGLE.
+ */
+ public void setBorderAllSingle() {
+ topBorder = Border.SINGLE;
+ leftBorder = Border.SINGLE;
+ for (int i = 0; i < columns.size(); i++) {
+ columns.get(i).rightBorder = Border.SINGLE;
+ }
+ for (int i = 0; i < rows.size(); i++) {
+ rows.get(i).bottomBorder = Border.SINGLE;
+ rows.get(i).height = 2;
+ }
+ alignGrid();
+ }
+
+ /**
+ * Set all borders around the selected cell to Border.NONE.
+ */
+ public void setBorderCellNone() {
+ if (selectedRow == 0) {
+ topBorder = Border.NONE;
+ }
+ if (selectedColumn == 0) {
+ leftBorder = Border.NONE;
+ }
+ columns.get(selectedColumn).rightBorder = Border.NONE;
+ rows.get(selectedRow).bottomBorder = Border.NONE;
+ rows.get(selectedRow).height = 1;
+ bottomRightCorner();
+ }
+
+ /**
+ * Set all borders around the selected cell to Border.SINGLE.
+ */
+ public void setBorderCellSingle() {
+ if (selectedRow == 0) {
+ topBorder = Border.SINGLE;
+ }
+ if (selectedColumn == 0) {
+ leftBorder = Border.SINGLE;
+ }
+ columns.get(selectedColumn).rightBorder = Border.SINGLE;
+ rows.get(selectedRow).bottomBorder = Border.SINGLE;
+ rows.get(selectedRow).height = 2;
+ alignGrid();
+ }
+
+ /**
+ * Set the column border to the right of the selected cell to
+ * Border.SINGLE.
+ */
+ public void setBorderColumnRightSingle() {
+ columns.get(selectedColumn).rightBorder = Border.SINGLE;
+ alignGrid();
+ }
+
+ /**
+ * Set the column border to the right of the selected cell to
+ * Border.SINGLE.
+ */
+ public void setBorderColumnLeftSingle() {
+ if (selectedColumn == 0) {
+ leftBorder = Border.SINGLE;
+ } else {
+ columns.get(selectedColumn - 1).rightBorder = Border.SINGLE;
+ }
+ alignGrid();
+ }
+
+ /**
+ * Set the row border above the selected cell to Border.SINGLE.
+ */
+ public void setBorderRowAboveSingle() {
+ if (selectedRow == 0) {
+ topBorder = Border.SINGLE;
+ } else {
+ rows.get(selectedRow - 1).bottomBorder = Border.SINGLE;
+ rows.get(selectedRow - 1).height = 2;
+ }
+ alignGrid();
+ }
+
+ /**
+ * Set the row border below the selected cell to Border.SINGLE.
+ */
+ public void setBorderRowBelowSingle() {
+ rows.get(selectedRow).bottomBorder = Border.SINGLE;
+ rows.get(selectedRow).height = 2;
+ alignGrid();
+ }
+
+ /**
+ * Set the row border below the selected cell to Border.DOUBLE.
+ */
+ public void setBorderRowBelowDouble() {
+ rows.get(selectedRow).bottomBorder = Border.DOUBLE;
+ rows.get(selectedRow).height = 2;
+ alignGrid();
+ }
+
+ /**
+ * Set the row border below the selected cell to Border.THICK.
+ */
+ public void setBorderRowBelowThick() {
+ rows.get(selectedRow).bottomBorder = Border.THICK;
+ rows.get(selectedRow).height = 2;
+ alignGrid();
+ }
+
}
import jexer.event.TCommandEvent;
import jexer.event.TKeypressEvent;
+import jexer.event.TMenuEvent;
import jexer.event.TMouseEvent;
import jexer.event.TResizeEvent;
import jexer.menu.TMenu;
+import jexer.menu.TMenuItem;
import static jexer.TCommand.*;
import static jexer.TKeypress.*;
getApplication().enableMenuItem(TMenu.MID_TABLE_INSERT_BELOW);
getApplication().enableMenuItem(TMenu.MID_TABLE_COLUMN_NARROW);
getApplication().enableMenuItem(TMenu.MID_TABLE_COLUMN_WIDEN);
+ getApplication().enableMenuItem(TMenu.MID_TABLE_FILE_OPEN_CSV);
getApplication().enableMenuItem(TMenu.MID_TABLE_FILE_SAVE_CSV);
getApplication().enableMenuItem(TMenu.MID_TABLE_FILE_SAVE_TEXT);
+
+ if (tableField != null) {
+
+ // Set the menu to match the flags.
+ TMenuItem menuItem = getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_ROW_LABELS);
+ if (menuItem != null) {
+ menuItem.setChecked(tableField.getShowRowLabels());
+ }
+ menuItem = getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_COLUMN_LABELS);
+ if (menuItem != null) {
+ menuItem.setChecked(tableField.getShowColumnLabels());
+ }
+ menuItem = getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_ROW);
+ if (menuItem != null) {
+ menuItem.setChecked(tableField.getHighlightRow());
+ }
+ menuItem = getApplication().getMenuItem(TMenu.MID_TABLE_VIEW_HIGHLIGHT_COLUMN);
+ if (menuItem != null) {
+ menuItem.setChecked(tableField.getHighlightColumn());
+ }
+ }
}
/**
getApplication().disableMenuItem(TMenu.MID_TABLE_INSERT_BELOW);
getApplication().disableMenuItem(TMenu.MID_TABLE_COLUMN_NARROW);
getApplication().disableMenuItem(TMenu.MID_TABLE_COLUMN_WIDEN);
+ getApplication().disableMenuItem(TMenu.MID_TABLE_FILE_OPEN_CSV);
getApplication().disableMenuItem(TMenu.MID_TABLE_FILE_SAVE_CSV);
getApplication().disableMenuItem(TMenu.MID_TABLE_FILE_SAVE_TEXT);
}
try {
// TODO
if (false) {
- tableField.saveToFilename(filename);
+ tableField.saveToCsvFilename(filename);
}
} catch (IOException e) {
messageBox(i18n.getString("errorDialogTitle"),
return;
}
- if (command.equals(cmSave)) {
- try {
- String filename = fileSaveBox(".");
- if (filename != null) {
- tableField.saveToFilename(filename);
- }
- } catch (IOException e) {
- messageBox(i18n.getString("errorDialogTitle"),
- MessageFormat.format(i18n.
- getString("errorSavingFile"), e.getMessage()));
+ // Didn't handle it, let children get it instead
+ super.onCommand(command);
+ }
+
+ /**
+ * Handle posted menu events.
+ *
+ * @param menu menu event
+ */
+ @Override
+ public void onMenu(final TMenuEvent menu) {
+ TInputBox inputBox;
+
+ switch (menu.getId()) {
+ case TMenu.MID_TABLE_RENAME_COLUMN:
+ inputBox = inputBox(i18n.getString("renameColumnInputTitle"),
+ i18n.getString("renameColumnInputCaption"),
+ tableField.getColumnLabel(tableField.getSelectedColumnNumber()),
+ TMessageBox.Type.OKCANCEL);
+ if (inputBox.isOk()) {
+ tableField.setColumnLabel(tableField.getSelectedColumnNumber(),
+ inputBox.getText());
}
return;
+ case TMenu.MID_TABLE_RENAME_ROW:
+ inputBox = inputBox(i18n.getString("renameRowInputTitle"),
+ i18n.getString("renameRowInputCaption"),
+ tableField.getRowLabel(tableField.getSelectedRowNumber()),
+ TMessageBox.Type.OKCANCEL);
+ if (inputBox.isOk()) {
+ tableField.setRowLabel(tableField.getSelectedRowNumber(),
+ inputBox.getText());
+ }
+ return;
+ case TMenu.MID_TABLE_VIEW_ROW_LABELS:
+ tableField.setShowRowLabels(getApplication().getMenuItem(
+ menu.getId()).getChecked());
+ return;
+ case TMenu.MID_TABLE_VIEW_COLUMN_LABELS:
+ tableField.setShowColumnLabels(getApplication().getMenuItem(
+ menu.getId()).getChecked());
+ return;
+ case TMenu.MID_TABLE_VIEW_HIGHLIGHT_ROW:
+ tableField.setHighlightRow(getApplication().getMenuItem(
+ menu.getId()).getChecked());
+ return;
+ case TMenu.MID_TABLE_VIEW_HIGHLIGHT_COLUMN:
+ tableField.setHighlightColumn(getApplication().getMenuItem(
+ menu.getId()).getChecked());
+ return;
+ case TMenu.MID_TABLE_BORDER_NONE:
+ tableField.setBorderAllNone();
+ return;
+ case TMenu.MID_TABLE_BORDER_ALL:
+ tableField.setBorderAllSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_CELL_NONE:
+ tableField.setBorderCellNone();
+ return;
+ case TMenu.MID_TABLE_BORDER_CELL_ALL:
+ tableField.setBorderCellSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_RIGHT:
+ tableField.setBorderColumnRightSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_LEFT:
+ tableField.setBorderColumnLeftSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_TOP:
+ tableField.setBorderRowAboveSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_BOTTOM:
+ tableField.setBorderRowBelowSingle();
+ return;
+ case TMenu.MID_TABLE_BORDER_DOUBLE_BOTTOM:
+ tableField.setBorderRowBelowDouble();
+ return;
+ case TMenu.MID_TABLE_BORDER_THICK_BOTTOM:
+ tableField.setBorderRowBelowThick();
+ return;
+ case TMenu.MID_TABLE_DELETE_LEFT:
+ tableField.deleteCellShiftLeft();
+ return;
+ case TMenu.MID_TABLE_DELETE_UP:
+ tableField.deleteCellShiftUp();
+ return;
+ case TMenu.MID_TABLE_DELETE_ROW:
+ tableField.deleteRow(tableField.getSelectedRowNumber());
+ return;
+ case TMenu.MID_TABLE_DELETE_COLUMN:
+ tableField.deleteColumn(tableField.getSelectedColumnNumber());
+ return;
+ case TMenu.MID_TABLE_INSERT_LEFT:
+ tableField.insertColumnLeft(tableField.getSelectedColumnNumber());
+ return;
+ case TMenu.MID_TABLE_INSERT_RIGHT:
+ tableField.insertColumnRight(tableField.getSelectedColumnNumber());
+ return;
+ case TMenu.MID_TABLE_INSERT_ABOVE:
+ tableField.insertRowAbove(tableField.getSelectedColumnNumber());
+ return;
+ case TMenu.MID_TABLE_INSERT_BELOW:
+ tableField.insertRowBelow(tableField.getSelectedColumnNumber());
+ return;
+ case TMenu.MID_TABLE_COLUMN_NARROW:
+ tableField.setColumnWidth(tableField.getSelectedColumnNumber(),
+ tableField.getColumnWidth(tableField.getSelectedColumnNumber()) - 1);
+ return;
+ case TMenu.MID_TABLE_COLUMN_WIDEN:
+ tableField.setColumnWidth(tableField.getSelectedColumnNumber(),
+ tableField.getColumnWidth(tableField.getSelectedColumnNumber()) + 1);
+ return;
+ case TMenu.MID_TABLE_FILE_OPEN_CSV:
+ // TODO
+ return;
+ case TMenu.MID_TABLE_FILE_SAVE_CSV:
+ // TODO
+ return;
+ case TMenu.MID_TABLE_FILE_SAVE_TEXT:
+ // TODO
+ return;
+ default:
+ break;
}
- // Didn't handle it, let children get it instead
- super.onCommand(command);
+ super.onMenu(menu);
}
// ------------------------------------------------------------------------
i18n.getString("statusBarOpen"));
statusBar.addShortcutKeypress(kbF10, cmMenu,
i18n.getString("statusBarMenu"));
+
+ // Synchronize the menu with tableField's flags.
+ onFocus();
}
/**