Menu

#114 GridControl. ButtonColumn actionPerformed not called when

open
nobody
5
2012-12-13
2009-06-17
howard77799
No

Bug title:
GridControl. ButtonColumn actionPerformed not called when

//----------------
Background info:

See Help Discussion: ButtonColumn actionPerformed not called when 2009-06-12 12:06
https://sourceforge.net/forum/message.php?msg_id=7441382

//----------------
Live Scenario

1. I put 2 ButtonColumns in a GridControl as the first two columns added to the GridControl. I locked the left 2 columns by calling gridControl.setLockedColumns(2).

2. Run the app and click in column 3 on the right (not in a locked column). That cell gets cell focus and has a red border (is in cell editing mode).

3. Tab out. Now the cell in column 4 has cell focus (the cell is all blue) and isn't in cell editing mode (doesn't have a red border for the cell).

4. Click the first button (the button on the left in column 1 in the locked cells). The actionPerformed button does not get called. I know because the System.out.println("The row edit button was clicked") doesn't show in the output window.

5. Click the second button (the button in column 2 in the locked cells). It's actionPerformed does get called. The problem only happens on the first button not the second button, and only happens if those 2 buttons are in locked cells on the left.

6. Alter the scenario slightly. In step 3 above, after I tab out of column 3, and column 4 now has cell focus but is not in cell edit mode, I hit F2 so that the column 4 cell is in cell editing mode (has a red border around it), then click the left button. At that point, the ButtonColumn's actionPerformed does get called.

7. Or don't tab out in step 3 and just leave column 3 in cell editing (red border). Type something in column 3 or else leave it blank, it's no difference here for this. Then click the left button. At that point, the first button's actionPerformed does get called.

//-------------------------
Reproduce the bug

I put 2 ButtonColumns as the first two columns on the left in my GridControl using:
gridControl.getColumnContainer().add(getColButton1());
gridControl.getColumnContainer().add(getColButton2());
// (add more columns here so the GridControl has 4 or more columns).

in the getColButton1(), I have:
colButton1 = new ButtonColumn();
colButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("The row edit button was clicked");
editButtonClicked();
}

and I've set the locked columns to be the left 2 columns like this:
gridControl.setLockedColumns(2);

When I run it, I click in column 3 which is a TextColumn, and it gets a red border around it meaning the cell is in cell editing mode. I type some letters like abcdef or anything. Then I TAB OUT of that cell it now the focus is in the next cell which is a DecimalColumn, but now that next cell is all light blue which means the cell is selected but not in cell editing mode.

When I click on the column 1 button, the ButtonColumn's actionPerformed doesn't get called because that "The row edit button was clicked" doesn't show in the output window.

However, this is the interesting part, if I type in column 3 but I DONT TAB OUT, and the red border is STILL IN column 3 meaning that cell still is in cell editing mode, then clicking the button in column 1 calls the ButtonColumn's actionPerformed and I see the "The row edit button was clicked" in the output window.

And if I do this instead, I type in column 3 and I TAB OUT of that cell so now the DecimalColumn in column 4 gets the cell focus, and that cell is ALL BLUE and doesn't have the red border meaning cell editing, and if I click the button in the locked column in column 1, that button's action performed doesn't get called, but now if I hit F2 then the DecimalColumn in column 4 changes from all blue (not in cell editing mode) to have a red border (is in cell editing mode), then I click the button in column 1 at that time that button's actionPerformed gets called and I see the "The row edit button was clicked" in the output window.

To reproduce this bug, the 2 ButtonColumns must be in locked columns from doing a

gridControl.setLockedColumns(2)

If the 2 ButtonColumns are not in locked columns (not doing the setLockedColumns(int), then the bug does not happen. The actionPerformed get called when you click on either button and when the cell focus is in column 3 or 4 in cell editing mode (cell has red border) or not in cell editing mode (cell has all blue color).

Also, the bug only happens on the button in the first column, and doesn't happen on the button in the second column.

If you have 2 ButtonColumns in locked columns, the actionPerformed does get called when you click on the 2nd button when you tabbed out of column 3 and column 4 has cell focus but not in cell editing mode. But in that scenario, the first button's actionPerformed doesn't get called.

The bug to fix here is, find out why the first ButtonColumn when there's 2 ButtonColumns in 2 locked columns the left, the actionPerformed on the ButtonColumn doesn't get called if any cell on the same row is all blue (selected but not in cell editing mode), but the actionPerformed() for the first button does get called if a cell in the same row is in cell edit mode (has a red border).

Thanks. Howard Hoagland.
We're basing our project on OpenSwing and it's gonna be a really a cool thing for our users, thanks for helping us !!!

Discussion


Log in to post a comment.