From 2e779e05f4fcd20f00fa3a056c687426f631935d Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Fri, 2 Apr 2021 17:01:23 -0500 Subject: [PATCH] Hooked up rename and delete column features to the UI --- .../outlaweditor/ui/impl/SheetEditorControllerImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java index afb5cc55..0b0afb5b 100644 --- a/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java +++ b/OutlawEditor/src/main/java/org/badvision/outlaweditor/ui/impl/SheetEditorControllerImpl.java @@ -72,6 +72,8 @@ public class SheetEditorControllerImpl extends SheetEditorController { createMenuItem("Insert Row", () -> insertRow(new Row(), getSelectedRow())), createMenuItem("Clone Row", () -> cloneRow(editor.getSheet().getRows().getRow().get(getSelectedRow()))), createMenuItem("Delete Row", () -> deleteRowWithConfirmation(editor.getSheet().getRows().getRow().get(getSelectedRow()))), + createMenuItem("Delete Column", () -> deleteColumnWithConfirmation(editor.getSheet().getColumns().getColumn().get(getSelectedColumn()))), + createMenuItem("Rename Column", () -> renameColumn(editor.getSheet().getColumns().getColumn().get(getSelectedColumn()))), createMenuItem("Sort ascending", () -> { int sortCol = table.getSelectionModel().getFocusedCell().getColumn(); table.setComparator((a,b)->compare(getCellFromRow(a, sortCol), getCellFromRow(b, sortCol))); @@ -99,6 +101,10 @@ public class SheetEditorControllerImpl extends SheetEditorController { return table.getSelectionModel().getFocusedCell().getRow(); } + private int getSelectedColumn() { + return table.getSelectionModel().getFocusedCell().getColumn(); + } + @Override public void doImport(ActionEvent event) { FileChooser openFileDialog = new FileChooser();