Skip to content

Commit d67856c

Browse files
committed
Feature: #48 (comment)
Cell data popup: When the popup is pinned it is updated by table selection change and single mouse click. --> Refactoring and documentation
1 parent 24a1b7b commit d67856c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

sql12/core/src/net/sourceforge/squirrel_sql/fw/datasetviewer/celldatapopup/CellDataDialogHandler.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,24 @@ public class CellDataDialogHandler
5151
private static final StringManager s_stringMgr = StringManagerFactory.getStringManager(CellDataDialogHandler.class);
5252

5353
/**
54-
* function to create the popup display when called from JTable
54+
* Method to open a cell data popup dialog.
55+
* This method is called when a cell is double-clicked.
56+
* <p>
57+
* This method does nothing when a pinned cell data dialog exists
58+
* because refreshes of a pinned cell data dialog are handled by
59+
* {@link #showSelectedValueInPinnedCellDataDialog(JTable, boolean)}
5560
*/
5661
public static void showDialog(JTable table,
5762
ColumnDisplayDefinition colDef,
5863
MouseEvent evt,
5964
boolean isModelEditable)
6065
{
66+
CellDataDialog pinnedCellDataDialog = Main.getApplication().getPinnedCellDataDialogHandler().getPinnedCellDataDialog();
67+
if(null != pinnedCellDataDialog)
68+
{
69+
return;
70+
}
71+
6172
Point pt = evt.getPoint();
6273
int rowIx = table.rowAtPoint(pt);
6374
int colIx = table.columnAtPoint(pt);
@@ -72,23 +83,16 @@ public static void showDialog(JTable table,
7283
editor.cancelCellEditing();
7384
}
7485

75-
CellDataDialog pinnedCellDataDialog = Main.getApplication().getPinnedCellDataDialogHandler().getPinnedCellDataDialog();
76-
if(null == pinnedCellDataDialog)
77-
{
78-
createAndShowCellDataDialog(table, table.getColumnName(colIx), rowIx, colIx, colDef, obj, isModelEditable, evt);
79-
}
80-
81-
// Redundant because handled by showSelectedValueInPinnedCellDataDialog(...) below
82-
//else
83-
//{
84-
// pinnedCellDataDialog.initCellDisplayPanel(table, table.getColumnName(colIx), rowIx, colIx, colDef, obj, isModelEditable, true);
85-
//}
86+
createAndShowCellDataDialog(table, table.getColumnName(colIx), rowIx, colIx, colDef, obj, isModelEditable, evt);
8687
}
8788

89+
/**
90+
* This method refreshes data in a pinned cell data dialog.
91+
* It is called when the cell selection changes.
92+
*/
8893
public static void showSelectedValueInPinnedCellDataDialog(JTable table, boolean isModelEditable)
8994
{
9095
CellDataDialog pinnedCellDataDialog = Main.getApplication().getPinnedCellDataDialogHandler().getPinnedCellDataDialog();
91-
9296
if(null == pinnedCellDataDialog)
9397
{
9498
return;

0 commit comments

Comments
 (0)