Issue Details (XML | Word | Printable)

Key: UBA-7370
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: ULC @ UBS
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

ULCTable does not trigger ListSelectionEvent if row is dragged

Created: 22/Jan/08 10:28 AM   Updated: 07/Jan/14 06:42 AM
Component/s: None
Affects Version/s: None
Fix Version/s: Next Release

Time Tracking:
Not Specified

 Description  « Hide
See code snippet below:

To reproduce the issue:

  1. Select a row --> ListSelectionEvent is fired.
  2. Move MouseCursor over another row and drag row --> ListSelectionEvent is not fired.

This behaviour is different from Swing where you have to first select the row before you can drag it.

import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCBorderLayoutPane;
import com.ulcjava.base.application.ULCComponent;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCLabel;
import com.ulcjava.base.application.ULCTable;
import com.ulcjava.base.application.dnd.TransferHandler;
import com.ulcjava.base.application.dnd.Transferable;
import com.ulcjava.base.application.event.IListSelectionListener;
import com.ulcjava.base.application.event.ListSelectionEvent;
import com.ulcjava.base.application.table.AbstractTableModel;
import com.ulcjava.base.client.UITable;
import com.ulcjava.base.client.dnd.AbstractDragSourceListener;
import com.ulcjava.base.client.dnd.DefaultDragSourceListener;
import com.ulcjava.base.development.DevelopmentRunner;

import java.awt.dnd.DragSourceDropEvent;

public class PR7370 extends AbstractApplication {
    public void start() {
        ULCSnippetTable table = new ULCSnippetTable();
        table.setModel(new SnippetTableModel());
        table.getSelectionModel().addListSelectionListener(new IListSelectionListener() {
            public void valueChanged(ListSelectionEvent event) {
                System.out.println("Got ListSelectionEvent " + event);
        ULCLabel label = new ULCLabel("Drop it here !");
        label.setTransferHandler(new LabelTransferHandler());
        ULCFrame frame = new ULCFrame("Snippet");
        frame.getContentPane().add(table, ULCBorderLayoutPane.CENTER);
        frame.getContentPane().add(label, ULCBorderLayoutPane.SOUTH);
    private static class LabelTransferHandler extends TransferHandler {
        public int getTargetActions(ULCComponent component) {
            return TransferHandler.ACTION_COPY;
        public boolean importData(ULCComponent targetComponent, Transferable transferable) {
            System.out.println("LabelTransferHandler importData");
            ULCLabel label = (ULCLabel)targetComponent;
            label.setText("you dropped !!!");
            return true;
        public void exportDone(ULCComponent sourceComponent, Transferable transferable, int dropAction) {
            throw new UnsupportedOperationException();
    private static class SnippetTableModel extends AbstractTableModel {
        public int getColumnCount() {
            return 5;
        public int getRowCount() {
            return 10;
        public Object getValueAt(int row, int column) {
            return row + ":" + column;
    public static class ULCSnippetTable extends ULCTable {
        protected String typeString() {
            return UISnippetTable.class.getName();
    public static class UISnippetTable extends UITable {
        protected AbstractDragSourceListener createDragSourceListener() {
            return new DefaultDragSourceListener(getTransferHandlerAdapter().getSourceActions()) {
                public void dragDropEnd(DragSourceDropEvent event) {
                    // workaround: the following line stops the user interaction monitor
    public static void main(String[] args) {

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Daniel Grob added a comment - 23/Jan/08 01:10 PM
The code snippet in the description describes a possible workaround. To use the workaround you use an extended ULCTable that stops the user interaction monitor whenever the drag & drop operation ends.

Daniel Grob added a comment - 23/Jan/08 01:13 PM

This behaviour is different from Swing where you have to first select the row before you can drag it.

This is a bug in Swing:
In ULC this Swing bug is fixed as part of UBA-700.

Janak Mulani added a comment - 06/Sep/13 07:25 AM