Watch, Follow, &
Connect with Us
Public Report
Report From: JBuilder/Database    [ Add a report in this area ]  
Report #:  7226   Status: Reported
Bug in db-express when using JdbCombobox with Datasetview and picklist
Project:  JBuilder Build #:  10.0.176.116
Version:    10.0 Submitted By:   olaf raether
Report Type:  Basic functionality failure Date Reported:  2/9/2004 1:30:53 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
The Problem becomes visible when you use
a JdbCombobox in combination with a
DataSetView and picklists in the storagedataset.

testcase is added.

Steps to Reproduce:
Try the following testcase:

import java.awt.*;
import com.borland.jbcl.layout.*;
import javax.swing.*;
import com.borland.dbswing.*;
import com.borland.dx.dataset.*;

/**
* testcase to demonstrate JdbComboBox Bug
*
* I have one Dataset with one row in it and a Dataset, which is used
as picklist.
* Furthermore i have a DatasetView, based on the Dataset with a
filter in it.
* The filter only accept ID4s > 1, so the sample datarow is ignored
by the filter.
*
* For the Lookup-Fields in the DatasetView i added two JdbComboBoxes.
*
* 1. When you start the class there is row shown in the DSV, that
comes from anywhere ???
* 2. Remove the JdbComboBoxes from the panel start again, everything
is ok !
* 3. Adding one more row to the dataset, that the DSV-filter has one
row two accept, it works too.
*
* So the bug is there when the DSV is empty on start up.
*
* This problem occurs not only with TableDataset4s. It4s the same
with QueryDataset.
*
*
*
* 02/06/2004
* o.raether@eprosoft.de
*
*/

public class Panel2 extends JPanel {
  XYLayout xYLayout1 = new XYLayout();
  TableDataSet tdsEmp = new TableDataSet();
  TableDataSet tdsLookup = new TableDataSet();
  Column colID = new Column();
  Column colNAME = new Column();
  Column colFIRST = new Column();
  Column colLOOKUP = new Column();
  Column colCODE = new Column();
  DataSetView dsvEmp = new DataSetView();
  TableScrollPane tableScrollPane1 = new TableScrollPane();
  JdbTable jdbTable1 = new JdbTable();
  TableScrollPane tableScrollPane2 = new TableScrollPane();
  JdbTable jdbTable2 = new JdbTable();
  Column colLOOKUPID = new Column();
  Column colLOOKUPTEXT = new Column();
  JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
  JdbNavToolBar jdbNavToolBar2 = new JdbNavToolBar();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  Column colLOOKUP2 = new Column();
  JLabel jLabel4 = new JLabel();
  JdbComboBox jdbComboBox1 = new JdbComboBox();
  JdbComboBox jdbComboBox2 = new JdbComboBox();

  public Panel2() {
    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }
  void jbInit() throws Exception {
    dsvEmp.setStorageDataSet(tdsEmp);
    dsvEmp.addRowFilterListener(new
Panel2_dsvEmp_rowFilterAdapter(this));
    colCODE.setColumnName("CODE");
    colCODE.setDataType(com.borland.dx.dataset.Variant.INT);
    colCODE.setPreferredOrdinal(4);
    colCODE.setSqlType(0);
    colCODE.setServerColumnName("NeueSpalte1");
    colLOOKUP.setCaption("LU 1");
    colLOOKUP.setColumnName("LOOKUPID");
    colLOOKUP.setDataType(com.borland.dx.dataset.Variant.INT);
    colLOOKUP.setPickList(new
com.borland.dx.dataset.PickListDescriptor(tdsLookup, new String[]
{"LOOKUPID"}, new String[] {"LOOKUPTEXT"}, new String[] {"LOOKUPID"},
"LOOKUPTEXT", false));
    colLOOKUP.setPreferredOrdinal(1);
    colLOOKUP.setSqlType(0);
    colLOOKUP.setServerColumnName("NeueSpalte3");
    colFIRST.setColumnName("FIRST");
    colFIRST.setDataType(com.borland.dx.dataset.Variant.STRING);
    colFIRST.setPreferredOrdinal(3);
    colFIRST.setSqlType(0);
    colFIRST.setServerColumnName("NeueSpalte1");
    colNAME.setColumnName("NAME");
    colNAME.setDataType(com.borland.dx.dataset.Variant.STRING);
    colNAME.setPreferredOrdinal(2);
    colNAME.setSqlType(0);
    colNAME.setServerColumnName("NeueSpalte2");
    colID.setColumnName("ID");
    colID.setDataType(com.borland.dx.dataset.Variant.INT);
    colID.setPreferredOrdinal(0);
    colID.setSqlType(0);
    colID.setServerColumnName("NeueSpalte1");
    this.setLayout(xYLayout1);
    xYLayout1.setWidth(827);
    xYLayout1.setHeight(605);
    jdbTable1.setDataSet(tdsEmp);
    jdbTable2.setDataSet(dsvEmp);
    colLOOKUPID.setColumnName("LOOKUPID");
    colLOOKUPID.setDataType(com.borland.dx.dataset.Variant.INT);
    colLOOKUPID.setPreferredOrdinal(0);
    colLOOKUPID.setSqlType(0);
    colLOOKUPID.setServerColumnName("NeueSpalte1");
    colLOOKUPTEXT.setColumnName("LOOKUPTEXT");
    colLOOKUPTEXT.setDataType(com.borland.dx.dataset.Variant.STRING);
    colLOOKUPTEXT.setPreferredOrdinal(1);
    colLOOKUPTEXT.setSqlType(0);
    colLOOKUPTEXT.setServerColumnName("NeueSpalte2");
    tdsLookup.setColumns(new Column[] {colLOOKUPID, colLOOKUPTEXT});
    jdbNavToolBar1.setDataSet(dsvEmp);
    jdbNavToolBar2.setDataSet(tdsEmp);
    jLabel1.setFont(new java.awt.Font("Dialog", 0, 14));
    jLabel1.setText("DSV");
    jLabel2.setText("TableDataset");
    jLabel2.setFont(new java.awt.Font("Dialog", 0, 14));
    jLabel3.setFont(new java.awt.Font("Dialog", 0, 12));
    jLabel3.setToolTipText("");
    jLabel3.setText("<== Who added this row ?");
    colLOOKUP2.setCaption("LU2");
    colLOOKUP2.setColumnName("LOOKUP2");
    colLOOKUP2.setDataType(com.borland.dx.dataset.Variant.INT);
    colLOOKUP2.setPickList(new
com.borland.dx.dataset.PickListDescriptor(tdsLookup, new String[]
{"LOOKUPID"}, new String[] {"LOOKUPTEXT"}, new String[] {"LOOKUP2"},
"LOOKUPTEXT", false));
    colLOOKUP2.setPreferredOrdinal(5);
    colLOOKUP2.setSqlType(0);
    colLOOKUP2.setServerColumnName("NeueSpalte1");
    tdsEmp.setColumns(new Column[] {colID, colLOOKUP, colNAME,
colFIRST, colCODE, colLOOKUP2});
    jLabel4.setText("<== Remove the Combo, and it works");
    jLabel4.setToolTipText("");
    jLabel4.setFont(new java.awt.Font("Dialog", 0, 12));
    jdbComboBox1.setColumnName("LOOKUPID");
    jdbComboBox1.setDataSet(dsvEmp);
    jdbComboBox2.setColumnName("LOOKUP2");
    jdbComboBox2.setDataSet(dsvEmp);
    this.add(jLabel1,  new XYConstraints(20, 5, -1, -1));
    this.add(jLabel2, new XYConstraints(6, 206, -1, -1));
    this.add(tableScrollPane2,  new XYConstraints(12, 34, 520, 116));
    this.add(jdbNavToolBar1, new XYConstraints(12, 155, 445, 30));
    this.add(jdbNavToolBar2, new XYConstraints(3, 379, 462, 40));
    this.add(tableScrollPane1,  new XYConstraints(5, 238, 534, 131));
    this.add(jLabel3,   new XYConstraints(542, 60, -1, -1));
    this.add(jLabel4,  new XYConstraints(458, 10, -1, -1));
    this.add(jdbComboBox1, new XYConstraints(64, 6, 191, 24));
    this.add(jdbComboBox2, new XYConstraints(269, 5, 187, 25));
    tableScrollPane1.getViewport().add(jdbTable1, null);
    tableScrollPane2.getViewport().add(jdbTable2, null);

    tdsEmp.open();
    tdsEmp.insertRow(true);
    tdsEmp.setInt("ID",1);
    tdsEmp.setString("NAME","Me");
    tdsEmp.setString("FIRST","Max");
    tdsEmp.setInt("LOOKUPID",2);
    tdsEmp.setInt("LOOKUP2",1);
    tdsEmp.post();


    // Adding these lines, everything is ok !
    //
/*
    tdsEmp.insertRow(true);
    tdsEmp.setInt("ID",2);
    tdsEmp.setString("NAME","You");
    tdsEmp.setString("FIRST","Heinz");
    tdsEmp.setInt("LOOKUPID",1);
    tdsEmp.setInt("LOOKUP2",2);
    tdsEmp.post();
*/

    tdsLookup.open();

    tdsLookup.insertRow(true);
    tdsLookup.setInt("LOOKUPID",1);
    tdsLookup.setString("LOOKUPTEXT","LOOKUPTEXT 1");
    tdsLookup.post();

    tdsLookup.insertRow(true);
    tdsLookup.setInt("LOOKUPID",2);
    tdsLookup.setString("LOOKUPTEXT","LOOKUPTEXT 2");
    tdsLookup.post();
  }

  void dsvEmp_filterRow(ReadRow row, RowFilterResponse response) {
    // Only ID4s greater 1 are shown !
    if (row.getInt("ID") > 1)
      response.add();
  }
}

class Panel2_dsvEmp_rowFilterAdapter implements
com.borland.dx.dataset.RowFilterListener {
  Panel2 adaptee;

  Panel2_dsvEmp_rowFilterAdapter(Panel2 adaptee) {
    this.adaptee = adaptee;
  }
  public void filterRow(ReadRow row, RowFilterResponse response) {
    adaptee.dsvEmp_filterRow(row, response);
  }

  public static void main (String[] argc) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new Panel2());
    frame.setSize(700,480);
    frame.setVisible(true);
  }

}
Workarounds
First i thought it is a problem of the JdbCombobox.

But i think the error is in dbexpress in the class Lookup.java
in the method lookup !. There is a call

pickListDataSet.dataSetStore.lookup(...)

which should only be called, when the top-Dataset is not empty.

Hope this is the right hint.
Attachment
None
Comments

None

Server Response from: ETNACODE01