Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2025 Lablicate GmbH.
* Copyright (c) 2015, 2026 Lablicate GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -318,14 +318,13 @@ public boolean isColumnSelected(Event event, String columnLabel) {
}

/**
* Checks if the cell of the given column was selected.
* ColumnIndex is 0 based.
* Returns the column index of the selected cell or -1 if
* none was selected. ColumnIndex is 0 based.
*
* @param event
* @param columnIndex
* @return boolean
* @return int
*/
public boolean isColumnSelected(Event event, int columnIndex) {
public int getColumnIndex(Event event) {

Table table = getTable();
Rectangle clientArea = table.getClientArea();
Expand All @@ -338,9 +337,7 @@ public boolean isColumnSelected(Event event, int columnIndex) {
for(int i = 0; i < table.getColumnCount(); i++) {
Rectangle rectangle = item.getBounds(i);
if(rectangle.contains(point)) {
if(i == columnIndex) {
return true;
}
return i;
}

if(!visible && rectangle.intersects(clientArea)) {
Expand All @@ -349,11 +346,29 @@ public boolean isColumnSelected(Event event, int columnIndex) {
}

if(!visible) {
return false;
return -1;
}
index++;
}

return -1;
}

/**
* Checks if the cell of the given column was selected.
* ColumnIndex is 0 based.
*
* @param event
* @param columnIndex
* @return boolean
*/
public boolean isColumnSelected(Event event, int columnIndex) {

int index = getColumnIndex(event);
if(index >= 0 && index == columnIndex) {
return true;
}

return false;
}

Expand Down