Watch, Follow, &
Connect with Us
Public Report
Report From: JBuilder/Components/dbSwing    [ Add a report in this area ]  
Report #:  23438   Status: Reported
Cursor Down (VK_DOWN) still (!!) doesn t work in JDBTable when DataSet is readonly
Project:  JBuilder Build #:  12.0.206.0
Version:    12 Submitted By:   olaf raether
Report Type:  Basic functionality failure Date Reported:  1/12/2006 6:08:03 AM
Severity:    Serious / Highly visible problem Last Updated:
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: None
Description
Cursor Down (VK_DOWN) doesn t work in JDBTable when DataSet is readonly.

This Bug is present since Version 4 of JBuilder.
Time to fix ist.
Look at qc number 11180. I think this describes the same problem
Steps to Reproduce:
1. Create Dataset with Data
2. Set property readonly=true
3. Create a panel + Scrollpane + Jdbtable


Workarounds
import com.borland.dbswing.*;
import javax.swing.*;
import java.awt.event.*;
import com.borland.dx.dataset.*;

public class JdbTableExt extends JdbTable {
    public JdbTableExt() {
        super();
    }

    class AppendRowAction extends AbstractAction {
        private AppendRowAction() {
            super("append-row");
        }

        public void actionPerformed(ActionEvent e) {
            DataSet dataSet = JdbTableExt.this.getDataSet();
            boolean readOnly = true;

            if (dataSet instanceof StorageDataSet)
                readOnly = ((StorageDataSet) dataSet).isReadOnly();

            readOnly = readOnly |
                       (!JdbTableExt.this.isEditable()
                        && dataSet != null
                        && dataSet.isEnableInsert()
                        && !dataSet.isEditingNewRow()
                        && dataSet.isEditable()
                       );

            try {
                if (!readOnly && dataSet.atLast())
                    dataSet.insertRow(false);
                else
                    dataSet.next();
            } catch (DataSetException ex) {
                DBExceptionHandler.handleException(dataSet, JdbTableExt.this,
                        ex);
            }

        } // end action performed

    } // end class


    public void updateUI() {
        super.updateUI();

        unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0));

        registerKeyboardAction(new AppendRowAction(),
                               KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
                               JComponent.WHEN_FOCUSED);
    }

}
Attachment
None
Comments

Lori Olson at 1/12/2006 3:19:12 PM -
As stated in the description, this bug is a duplicate of 11180, and should be closed.  The reporter should vote for the previously reported bug.

Server Response from: ETNACODE01