🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12553

Re: using JdbComboBox

#12553
From: stephan nagy
Date: Wed, 23 Dec 1998 00:00
57 lines
2355 bytes
When using Jdbcombobox and a QueryDataSet you need to define a picklist
for
the component.
What I ended up doing was extending the class and overriding the
bindDataSet() method with the following:

  private void bindDataSet() throws DataSetException {

   Column column;
    if (boundDataSet != null && boundDataSet.isOpen() &&
       (column = boundDataSet.hasColumn(columnName)) != null) {
      PickListDescriptor pickList = column.getPickList();
      if (pickList != null) {
       DataSet pds = pickList.getPickListDataSet();

        String[] dispCols = pickList.getPickListDisplayColumns();
        Object[] items = new String[pds.getRowCount()];
        pds.first();
        while (!pds.atLast()) {
          Variant value = new Variant();
          pds.getVariant(dispCols[0], value);
          items[pds.getRow()] = value;
          pds.next();
        }
        setItems(items);
      } else {
        DataSet ds = boundDataSet;

        Object[] items = new Object[ds.getRowCount()];
        ds.first();
          for(int x=0;x <  ds.getRowCount(); x++) {
         Variant value = new Variant();
         ds.getVariant(columnName,value);
            items[ds.getRow()] = value;
            ds.next();
        }
        setItems(items);
      }
    }
  }

Now it works like expected.

hope this helps,
-stephan

Jeroen Zwartepoorte wrote:

> Thanks for the reply BUT...
>
> I know that already. I want to use it like the dbSwing components are
> meant to be used. That means that i just want to set the dataset &
> columnname property and that i want the dbSwing component to do the
> rest.
>
> Jeroen Zwartepoorte
> Jeroen@xs4all.nl
Technical Details
Message-ID: <3681209B.B6E5FBE2@anatec.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3674E09D.5F0EF8E8@xs4all.nl> <36750452.E538E24@mhinformatics.ch> <36753365.91502C1D@xs4all.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,d70ee309a476f00b
X-Google-Attributes: gid111d45,public
From: stephan nagy <snagy@anatec.com>
Subject: Re: using JdbComboBox
Date: 1998/12/23
Message-ID: <3681209B.B6E5FBE2@anatec.com>
X-Deja-AN: 425217204
Content-Transfer-Encoding: 7bit
References: <3674E09D.5F0EF8E8@xs4all.nl> <36750452.E538E24@mhinformatics.ch> <36753365.91502C1D@xs4all.nl>
To: Jeroen Zwartepoorte <Jeroen@xs4all.nl>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing