RegisterSearchFAQ UsergroupsLog in
Horizontal scroll bug when using LockedModel

 
Reply to topic    Citra Technologies Forum Index » Report a Bug View previous topic
View next topic

Horizontal scroll bug when using LockedModel
Author Message
navTeam2



Joined: 14 Jan 2011
Posts: 97

Post Horizontal scroll bug when using LockedModel Reply with quote
Hi,

Using version 4.2.4

When using an AdvancedJScrollPane with a getLockedModel and showDummyColumn(true), we stumbled upon strange behaviours:

The testbench is really simple:
A table with two columns, an AdvancedJScrollPane with first column locked.
Table is showing dummy column.
One row.

Resize the dialog so the horizontal scrollbar is visible.
Click on the cell on the right to have it selected: The scrollpane is automatically scrolled so that the cell is made visible. BUT, first bug, the scrollpane is scrolled right, beyond its limit:we now see many pixels beyond the right of the cell. We could not scroll so much when only using the horizontal scroll bar.

Other related bugs:
In this situation, left click in the dummy column (that should not be visible) and drag right: whenever the mouse cursor reached the right side of the dialog, it is repositionned to the left, within the table.
If we happen to do a big drag on the right, the cursor jumps many pixels on the left of the dialog and is now stuck there.

Could be funny if our customers hadn't noticed...

Code:

public class AdvancedJTableTest2 {

   public static void main(String[] args) {
      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      String[] cols = { "Name", "Middlename" };
      final ObjectTableModel ltm = new ObjectTableModel(cols) {

         private static final long serialVersionUID = 1L;

         @Override
         public Class<?> getColumnClass(int column) { return String.class; }

         @Override
         public Object getValueAt(Object o, int index) { return "value" + index; }

         @Override
         public void setValueAt(Object o, Object aValue, int index) { // useless
         }
      };

      ltm.addRow("OneItem");


      AdvancedJTable table = new AdvancedJTable(ltm);

      table.setShowDummyColumn(true);
      AdvancedJScrollPane scrollPane = new AdvancedJScrollPane(table);
      scrollPane.getLockedModel().setLockedColumns(1, LockedTableModel.LEFT_DIRECTION);
      frame.setContentPane(scrollPane);
      frame.setSize(new Dimension(100, 100));
      frame.setVisible(true);
   }
}


Thanks to anyone with a workaround.

By the way, we saw this in the changelog:
13/1/2016 - version 4.1.57
-------------------
-Mouse event absolute coordinates are now not changed during translations due to locked rows/columns.

Maybe it's related.
Tue Oct 25, 2016 8:44 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hello,

I will look into it, thanks!
Tue Nov 08, 2016 11:33 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hi,

There were a number of issues with scrolling, they have now been fixed.

Thanks
Fri Nov 18, 2016 7:22 am View user's profile Send private message
navTeam2



Joined: 14 Jan 2011
Posts: 97

Post Reply with quote
Hi,
Glad to see you're back, and we hope you're fine again.

We tried 4.2.5 and the bug we reported is fixed.

Still, because of autoscrolls, the user is able to scroll right beyond what the horizontal scrollbar would normally allow.
I guess this should be prevented to be consistent with the horizontal scrollbar behaviour.

Here a snippet to reproduce:
1. Make the first cell selected.
2. Click the cell and drag it to the right edge of the table... As 'autoscrolls' is true, dragging along the right edge does unwanted scrolling!

Code:

public class AdvancedJTableTest2 {

   public static void main(String[] args) {
      JFrame frame = new JFrame();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      String[] cols = { "Name", "Middlename" };
      final ObjectTableModel ltm = new ObjectTableModel(cols) {

         private static final long serialVersionUID = 1L;

         @Override
         public Class<?> getColumnClass(int column) {
            return String.class;
         }

         @Override
         public Object getValueAt(Object o, int index) {
            return "value" + index;
         }

         @Override
         public void setValueAt(Object o, Object aValue, int index) { // useless
         }
      };

      ltm.addRow("OneItem");


      AdvancedJTable table = new AdvancedJTable(ltm);

      table.setShowDummyColumn(true);
      frame.setContentPane(new AdvancedJScrollPane(table));
      frame.setSize(new Dimension(100, 100));
      table.setDragEnabled(true);
      table.setTransferHandler(new TransferHandler() {

         @Override
         public int getSourceActions(JComponent c) {
            return COPY_OR_MOVE;
         }

         @Override
         public boolean canImport(TransferSupport support) {
            return true;
         }

         @Override
         protected Transferable createTransferable(JComponent c) {
            return new StringSelection("data");
         }

      });
      frame.setVisible(true);
   }
}


Maybe it's kinda difficult to 'fix'. Please report back whether there's a workaround or if it's fixable.

Kind regards,

NavTeam
Mon Nov 21, 2016 8:15 am View user's profile Send private message
support



Joined: 21 Feb 2006
Posts: 1463

Post Reply with quote
Hi,

This is now fixed, the table was scrolling to the last dummy column.

Thank you!
Mon Nov 21, 2016 2:00 pm View user's profile Send private message
navTeam2



Joined: 14 Jan 2011
Posts: 97

Post Reply with quote
Hi, ok it works fine with 4.2.7, thank you!
Tue Nov 22, 2016 10:19 am View user's profile Send private message
Display posts from previous:    

Reply to topic    Citra Technologies Forum Index » Report a Bug All times are GMT - 5 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group