This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 7d64923f76 issue #6852 : add navigate-to-column action on TableView
toolbar (#7527)
7d64923f76 is described below
commit 7d64923f766c96103a27b034480434523d37eb16
Author: Matt Casters <[email protected]>
AuthorDate: Wed Jul 15 13:47:48 2026 +0200
issue #6852 : add navigate-to-column action on TableView toolbar (#7527)
Add a toolbar and context-menu action that opens a searchable column
picker and scrolls the table horizontally to the selected column.
---
.../org/apache/hop/ui/core/widget/TableView.java | 57 +++++++++++++++++++++-
.../core/widget/messages/messages_en_US.properties | 4 ++
2 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
b/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
index 5ad738b493..9d64814769 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
@@ -52,6 +52,7 @@ import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.ConstUi;
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.EnterConditionDialog;
+import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.dialog.MessageBox;
import org.apache.hop.ui.core.gui.GuiResource;
@@ -148,6 +149,8 @@ public class TableView extends Composite {
public static final String ID_TOOLBAR_CLEAR_SELECTION =
"tableview-toolbar-10310-clear-selection";
public static final String ID_TOOLBAR_FILTERED_SELECTION =
"tableview-toolbar-10320-filtered-selection";
+ public static final String ID_TOOLBAR_NAVIGATE_TO_COLUMN =
+ "tableview-toolbar-10330-navigate-to-column";
public static final String ID_TOOLBAR_COPY_SELECTED =
"tableview-toolbar-10400-copy-selected";
public static final String ID_TOOLBAR_PASTE_TO_TABLE =
"tableview-toolbar-10410-paste-to-table";
public static final String ID_TOOLBAR_CUT_SELECTED =
"tableview-toolbar-10420-cut-selected";
@@ -727,6 +730,7 @@ public class TableView extends Composite {
toolbarWidgets.enableToolbarItem(ID_TOOLBAR_SELECT_ALL_ROWS, hasRows);
toolbarWidgets.enableToolbarItem(ID_TOOLBAR_CLEAR_SELECTION, hasRows);
toolbarWidgets.enableToolbarItem(ID_TOOLBAR_FILTERED_SELECTION, hasRows);
+ toolbarWidgets.enableToolbarItem(ID_TOOLBAR_NAVIGATE_TO_COLUMN,
columns.length > 0);
}
private MouseListener createTableMouseListener() {
@@ -1424,10 +1428,18 @@ public class TableView extends Composite {
OsHelper.customizeMenuitemText(
BaseMessages.getString(PKG,
"TableView.menu.FilteredSelection")));
miFilter.addListener(SWT.Selection, e -> setFilter());
- new MenuItem(mRow, SWT.SEPARATOR);
miFilter.setEnabled(!readonly);
}
+ if (!removeToolItems.contains(ID_TOOLBAR_NAVIGATE_TO_COLUMN)) {
+ MenuItem miNavigateToColumn = new MenuItem(mRow, SWT.NONE);
+ miNavigateToColumn.setText(
+ OsHelper.customizeMenuitemText(
+ BaseMessages.getString(PKG, "TableView.menu.NavigateToColumn")));
+ miNavigateToColumn.addListener(SWT.Selection, e -> navigateToColumn());
+ new MenuItem(mRow, SWT.SEPARATOR);
+ }
+
if (!removeToolItems.contains(ID_TOOLBAR_COPY_SELECTED)) {
MenuItem miCopy = new MenuItem(mRow, SWT.NONE);
miCopy.setText(
@@ -3957,6 +3969,49 @@ public class TableView extends Composite {
}
}
+ /**
+ * Open a searchable column picker and scroll the table horizontally so the
chosen column is
+ * visible. Useful for wide tables (preview grids, field mapping dialogs,
etc.).
+ */
+ @GuiToolbarElement(
+ root = ID_TOOLBAR,
+ id = ID_TOOLBAR_NAVIGATE_TO_COLUMN,
+ image = "ui/images/search.svg",
+ toolTip = "i18n::TableView.ToolBarWidget.NavigateToColumn.ToolTip")
+ public void navigateToColumn() {
+ if (columns.length == 0) {
+ return;
+ }
+
+ String[] columnNames = new String[columns.length];
+ for (int i = 0; i < columns.length; i++) {
+ columnNames[i] = Const.NVL(columns[i].getName(), "");
+ }
+
+ EnterSelectionDialog dialog =
+ new EnterSelectionDialog(
+ getShell(),
+ columnNames,
+ BaseMessages.getString(PKG, "TableView.NavigateToColumn.Title"),
+ BaseMessages.getString(PKG, "TableView.NavigateToColumn.Message"));
+ String selection = dialog.open();
+ if (selection == null) {
+ return;
+ }
+
+ int index = dialog.getSelectionNr();
+ if (index < 0 || index >= columns.length) {
+ return;
+ }
+
+ // tableColumn[0] is the row-number (#) column; data columns start at
index 1.
+ TableColumn tableCol = tableColumn[index + 1];
+ if (tableCol != null && !tableCol.isDisposed()) {
+ table.showColumn(tableCol);
+ activeTableColumn = index + 1;
+ }
+ }
+
public IRowMeta getRowWithoutValues() {
IRowMeta f = new RowMeta();
f.addValueMeta(new ValueMetaInteger("#"));
diff --git
a/ui/src/main/resources/org/apache/hop/ui/core/widget/messages/messages_en_US.properties
b/ui/src/main/resources/org/apache/hop/ui/core/widget/messages/messages_en_US.properties
index 8beca3c5a4..323a8ec2ba 100644
---
a/ui/src/main/resources/org/apache/hop/ui/core/widget/messages/messages_en_US.properties
+++
b/ui/src/main/resources/org/apache/hop/ui/core/widget/messages/messages_en_US.properties
@@ -62,6 +62,7 @@ TableView.menu.InsertBeforeRow=Insert before this row
TableView.menu.KeepSelected=Keep only selected lines\tCtrl-K
TableView.menu.MoveDown=Move down\tCtrl-DOWN
TableView.menu.MoveUp=Move up\tCtrl-UP
+TableView.menu.NavigateToColumn=Navigate to column
TableView.menu.OptimalSizeWithHeader=Optimal Column size incl. header\tF3
TableView.menu.OptimalSizeWithoutHeader=Optimal Column size excl. header\tF4
TableView.menu.PasteFromClipboard=Paste clipboard to table\tCtrl-V
@@ -72,6 +73,8 @@ TableView.menu.Undo=Undo \: {0} \tCtrl-Z
TableView.menu.UndoNotAvailable=Undo \: not available \tCtrl-Z
TableView.MessageBox.ClearTable.message=Are you sure you want to clear this
table? No undo is possible\!
TableView.MessageBox.ClearTable.title=Question
+TableView.NavigateToColumn.Message=Select the column you want to navigate to
+TableView.NavigateToColumn.Title=Navigate to column
TableView.ToolBarWidget.ClearAllRows.ToolTip=Clear all rows (after
confirmation)
TableView.ToolBarWidget.ClearSelection.ToolTip=Clear selection
TableView.ToolBarWidget.CopySelected.ToolTip=Copy selected rows to clipboard
@@ -84,6 +87,7 @@ TableView.ToolBarWidget.KeepSelected.ToolTip=Keep the
selected rows, delete the
TableView.WebNewlineHint.Label=* Line breaks aren't shown in table cells in
the web version (known limitation). Double-click a cell to view or edit the
full text.
TableView.ToolBarWidget.MoveRowsDown.ToolTip=Move selected rows down
TableView.ToolBarWidget.MoveRowsUp.ToolTip=Move selected rows up
+TableView.ToolBarWidget.NavigateToColumn.ToolTip=Navigate to a column
TableView.ToolBarWidget.PasteSelected.ToolTip=Paste clipboard to the table
after the selected row
TableView.ToolBarWidget.RedoAction.ToolTip=Redo the last action
TableView.ToolBarWidget.SelectAll.ToolTip=Select all rows