How to disable traversing table rows for SortableTable

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

How to disable traversing table rows for SortableTable

Postby omeroksuzler » Thu Jan 25, 2018 2:23 am

My problem is that, when I scroll the mouse wheel it selects the rows by 3 back and forth, also with the arrow keys, I want to disable selecting next/previous row. So far, I have tried disabling arrow keys by using key binding, which it doesn't respond to and tried setting setwheelscrollingenabled(false) but didn't work. Is there a feature of SortableTable to achieve this?
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Thu Jan 25, 2018 2:43 am

I just tried extending AbstractNavigableTableModel for my own table model and overridden isNavigableAt and isNavigationOn methods and returned false for both, didn't work.
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Thu Jan 25, 2018 9:45 am

By default, the navigable feature only used on TAB and ENTER key. You can override this method below on NavigableTable to apply to arrow keys.

protected boolean isNavigationKey(KeyStroke ks) {
return ks == null || ks.getKeyCode() == KeyEvent.VK_TAB || ks.getKeyCode() == KeyEvent.VK_ENTER;
}
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Thu Jan 25, 2018 10:53 am

JIDE Support wrote:By default, the navigable feature only used on TAB and ENTER key. You can override this method below on NavigableTable to apply to arrow keys.

protected boolean isNavigationKey(KeyStroke ks) {
return ks == null || ks.getKeyCode() == KeyEvent.VK_TAB || ks.getKeyCode() == KeyEvent.VK_ENTER;
}

Thanks, I got that part, but it also shouldn't choose the next/previous rows while using the mouse wheel.
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Thu Jan 25, 2018 12:31 pm

I don't think it looks mouse wheel at all.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Thu Jan 25, 2018 1:13 pm

JIDE Support wrote:I don't think it looks mouse wheel at all.

It doesn't listen to it no, it is the same way in most of the examples too. When you scroll the wheel, it natively traverses the rows or something.

I think I have found it:
In one of Jide examples NavigationSortableTable was used and is exactly what I need:
http://www.jidesoft.com/javadoc/com/jid ... Table.html
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Thu Jan 25, 2018 1:46 pm

You probably misunderstood the purpose of NavigableTable. NavigableTable was designed for software that works in a mouseless environment where there are a lot of keyboard input in the table. User can tab or enter to go to the next editable cells instead of stopping at every single cell. That's why it doesn't care mouse wheel or mouse click which will stop at every single cell regardless of the navigable settings.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Wed Feb 07, 2018 4:51 am

So, what I was doing is creating a FilterableTableModel and then giving it to SortableTable. Then, I would give the SortableTable instance to a JScrollPane and a PageNavigationBar instance. When I check the code in PageNavigationBar, in the constructor, it creates and adds a mouse wheel listener to the TableScrollPane object provided to the constructor. How can I disable this behaviour or move around it?
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Wed Feb 07, 2018 9:04 am

You can just remove the mouse wheel listener after the constructor. There is a way to query the listeners, iterate through all of them and remove the correct one.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Wed Feb 07, 2018 9:18 am

JIDE Support wrote:You can just remove the mouse wheel listener after the constructor. There is a way to query the listeners, iterate through all of them and remove the correct one.

I tried getting the listeners but everytime I tried, an empty array was returned. Thing is, it doesn't add the listener to the passed JComponent, it first assigns it to its own JComponent b and adds the listener to b. I had no success getting the listeners of b so far.
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Thu Feb 08, 2018 9:49 am

Code: Select all
    public PageNavigationBar(TableScrollPane pane) {
        if (pane == null) {
            return;
        }
        _component = pane;
        _component.addMouseWheelListener(createMouseWheelListener());


It is the TableScrollPane you passed in.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby omeroksuzler » Thu Feb 08, 2018 12:22 pm

JIDE Support wrote:
Code: Select all
    public PageNavigationBar(TableScrollPane pane) {
        if (pane == null) {
            return;
        }
        _component = pane;
        _component.addMouseWheelListener(createMouseWheelListener());


It is the TableScrollPane you passed in.


There are 3 different constructors as I remember, I use the one that receives a JTable, nonetheless, all constructors have this line see:
Code: Select all
_component.addMouseWheelListener(createMouseWheelListener());
omeroksuzler
 
Posts: 16
Joined: Wed Nov 15, 2017 11:52 pm

Re: How to disable traversing table rows for SortableTable

Postby richw » Wed Apr 11, 2018 11:45 am

JIDE Support wrote:By default, the navigable feature only used on TAB and ENTER key. You can override this method below on NavigableTable to apply to arrow keys.

protected boolean isNavigationKey(KeyStroke ks) {
return ks == null || ks.getKeyCode() == KeyEvent.VK_TAB || ks.getKeyCode() == KeyEvent.VK_ENTER;
}


I am having a similar problem, except I am extending HierarchicalTable and trying to override isNavigationKey so that Enter no longer changes focus to the next row.

I've tested that my method is being called, but no matter what my implementation, the behavior on the table stays the same. The arrow keys navigate up and down, and the enter key navigates down. I've even tried returning just true or false and nothing changes the behavior. I've also used a debugger to confirm that my code is being called.

Do you have any advice on what the issue might be? Or is there anyone I can contact for more support?
richw
 
Posts: 4
Joined: Mon Apr 09, 2018 11:44 am

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Wed Apr 11, 2018 1:15 pm

I am not sure if you use it in the right way. isNavigationKey alone doesn't do anything. isCellNavigable method should also be implemented to determine which cell can be navigated to.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby richw » Wed Apr 11, 2018 3:05 pm

JIDE Support wrote:I am not sure if you use it in the right way. isNavigationKey alone doesn't do anything. isCellNavigable method should also be implemented to determine which cell can be navigated to.


Hi, I tried doing that and I still can't get the behavior I'm looking for (or even change the behavior at all).

Here's an example of what I'm doing:

Code: Select all
public class FmsTable extends HierarchicalTable {

    @Override
    protected boolean isNavigationKey(KeyStroke ks) {
        return false;
    }

    @Override
    public boolean isCellNavigable(int i, int i1) {
        return false;
    }


I would expect this to make it so that nothing can be navigated using the keyboard. But when I instantiate this table and use it, all behavior remains the same as before. I can still navigate with up and down arrows, and go to the next row using enter.
richw
 
Posts: 4
Joined: Mon Apr 09, 2018 11:44 am

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Wed Apr 11, 2018 5:37 pm

You can't return false isCellNavigable for all cells. If so, it will have no effect. The trigger for the cell navigable is the cell that is currently focused has to return true in isCellNavigable. Then it will find the next navigable cell based on the key you pressed.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: How to disable traversing table rows for SortableTable

Postby richw » Tue Apr 17, 2018 10:46 am

JIDE Support wrote:You can't return false isCellNavigable for all cells. If so, it will have no effect. The trigger for the cell navigable is the cell that is currently focused has to return true in isCellNavigable. Then it will find the next navigable cell based on the key you pressed.


I realized why your suggestion didn't work for what I want.

I'm not trying to navigate between cells or edit cells. I'm talking about the blue selection of an entire row. The kind of selection that happens when you single-click a row or use the up and down arrows.
richw
 
Posts: 4
Joined: Mon Apr 09, 2018 11:44 am

Re: How to disable traversing table rows for SortableTable

Postby richw » Tue Apr 17, 2018 1:04 pm

What I am looking for is a way to change the types of events that trigger a new event for any ListSelectionListeners, etc. So I need to change the way ListSelections are triggered (and remove the ENTER key as a way to trigger a selection of the next row.)
richw
 
Posts: 4
Joined: Mon Apr 09, 2018 11:44 am

Re: How to disable traversing table rows for SortableTable

Postby aryanarvind » Wed Jul 22, 2020 1:05 pm

Hello,

Is Jide not taking any support questions?
Is there any update on this?
I completely understand what this requirement was and we want the same behavior.
When you scroll in the table selection is an overkill, we want scroll to be quick using mouse wheel, if there are events attached to the selection, this is going to be a problem with performance.

Thanks & Regards,
Aravind
aryanarvind
 
Posts: 108
Joined: Mon May 14, 2007 12:37 pm

Re: How to disable traversing table rows for SortableTable

Postby JIDE Support » Wed Jul 22, 2020 4:49 pm

This thread is too old. Please start a new thread for it. Clearly, we couldn't understand each other in this post so it didn't go anywhere.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 15 guests

cron