home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WizardViewSubDbQuerySort.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  5.4 KB  |  122 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.ui.OrderedListModel;
  4. import asp.util.ResourceUtil;
  5. import asp.wizard.util.UiUtil;
  6. import com.sun.java.swing.DefaultListModel;
  7. import com.sun.java.swing.JComboBox;
  8. import com.sun.java.swing.ListModel;
  9. import com.sun.java.swing.table.TableModel;
  10. import java.util.TooManyListenersException;
  11. import java.util.Vector;
  12.  
  13. public class WizardViewSubDbQuerySort extends WizardViewAbstract {
  14.    private static WizardViewAbstract _instance = null;
  15.    private WVPanelDbQuerySort _mainPanel;
  16.    private SubDBQueryData _Data;
  17.    private boolean _updatingTableComboBox = false;
  18.    private Vector _directions;
  19.    // $FF: synthetic field
  20.    static Class class$asp$wizard$WVPanelDbQuerySort;
  21.  
  22.    public static WizardViewAbstract getInstance() {
  23.       if (_instance == null) {
  24.          _instance = new WizardViewSubDbQuerySort();
  25.       }
  26.  
  27.       return _instance;
  28.    }
  29.  
  30.    protected void createMainPanel() {
  31.       this._mainPanel = new WVPanelDbQuerySort();
  32.       this.initListeners();
  33.       this._directions = this.getDirections();
  34.       this._mainPanel._cboDirection.addItem(this._directions.elementAt(0));
  35.       this._mainPanel._cboDirection.addItem(this._directions.elementAt(1));
  36.    }
  37.  
  38.    public Vector getDirections() {
  39.       String Options = ResourceUtil.getResourceString("asp.wizard.res", class$asp$wizard$WVPanelDbQuerySort != null ? class$asp$wizard$WVPanelDbQuerySort : (class$asp$wizard$WVPanelDbQuerySort = class$("asp.wizard.WVPanelDbQuerySort")), "option.headerdirection");
  40.       return UiUtil.strToVector(Options);
  41.    }
  42.  
  43.    private void handleFillRow(Object listItem, Vector rowToFill) {
  44.       String value = this.getSelectedTable() + "." + listItem.toString();
  45.       if (!UiUtil.valueExistsInTableModel(0, this._mainPanel._tbmSortKey, value)) {
  46.          rowToFill.addElement(value);
  47.          rowToFill.addElement(this._directions.elementAt(0));
  48.       }
  49.  
  50.    }
  51.  
  52.    protected void initListeners() {
  53.       ListToTablePanel l2tSort = this._mainPanel._l2tPickSortKey;
  54.       l2tSort.getTableComboBox().addItemListener(new 1(this));
  55.  
  56.       try {
  57.          l2tSort.addXferItemListener(new 2(this));
  58.       } catch (TooManyListenersException e) {
  59.          System.err.println(((Throwable)e).getMessage());
  60.       }
  61.  
  62.    }
  63.  
  64.    public WVPanelBase getMainPanel() {
  65.       return this._mainPanel;
  66.    }
  67.  
  68.    public JComboBox getTableCombo() {
  69.       return this._mainPanel._l2tPickSortKey.getTableComboBox();
  70.    }
  71.  
  72.    public void setTableComboBoxModel(OrderedListModel comboModel) {
  73.       this._updatingTableComboBox = true;
  74.       JComboBox comboBox = this.getTableCombo();
  75.  
  76.       try {
  77.          UiUtil.populateCombo(comboBox, comboModel);
  78.          if (((DefaultListModel)comboModel).getSize() > 0) {
  79.             comboBox.setSelectedIndex(0);
  80.          }
  81.       } finally {
  82.          this._updatingTableComboBox = false;
  83.       }
  84.  
  85.    }
  86.  
  87.    public String getSelectedTable() {
  88.       return this.getTableCombo().getSelectedItem().toString();
  89.    }
  90.  
  91.    public TableModel getSorts() {
  92.       return this._mainPanel._l2tPickSortKey.getTable().getModel();
  93.    }
  94.  
  95.    public void setFieldListModel(ListModel lm) {
  96.       this._mainPanel._l2tPickSortKey.setListModel(lm);
  97.    }
  98.  
  99.    public void commit() {
  100.       this._mainPanel._l2tPickSortKey.commitChanges();
  101.    }
  102.  
  103.    // $FF: synthetic method
  104.    static Class class$(String class$) {
  105.       try {
  106.          return Class.forName(class$);
  107.       } catch (ClassNotFoundException forName) {
  108.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  109.       }
  110.    }
  111.  
  112.    // $FF: synthetic method
  113.    static boolean access$0(WizardViewSubDbQuerySort $0) {
  114.       return $0._updatingTableComboBox;
  115.    }
  116.  
  117.    // $FF: synthetic method
  118.    static void access$1(WizardViewSubDbQuerySort $0, Object $1, Vector $2) {
  119.       $0.handleFillRow($1, $2);
  120.    }
  121. }
  122.