AliasesDropDown(IApplication app) { super(); _myApp = app; final AliasesDropDownModel model = new AliasesDropDownModel(app, this); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } // Under JDK1.4 an empty JComboBox has an almost zero width. else { final Dimension dm = getPreferredSize(); dm.width = 100; setPreferredSize(dm); } addActionListener(this); setMaximumSize(getPreferredSize()); app.getDataCache().addAliasesListener(new MyAliasesListener(model, this)); this.setName(this.getClass().getCanonicalName()); }
/** * Load from <TT>DataCache</TT>. */ private void load() { Iterator<ISQLAlias> it = _myApp.getDataCache().aliases(); while (it.hasNext()) { addAlias(it.next()); } }
AliasesDropDown(IApplication app) { super(); _myApp = app; final AliasesDropDownModel model = new AliasesDropDownModel(app, this); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } // Under JDK1.4 an empty JComboBox has an almost zero width. else { final Dimension dm = getPreferredSize(); dm.width = 100; setPreferredSize(dm); } addActionListener(this); setMaximumSize(getPreferredSize()); app.getDataCache().addAliasesListener(new MyAliasesListener(model, this)); this.setName(this.getClass().getCanonicalName()); }
/** * Remove an <TT>ISQLAlias</TT> from this model. * * @param alias <TT>ISQLAlias</TT> to be removed. */ private void removeAlias(ISQLAlias alias) { _aliasDropDown.setEnabled(false); removeElement(alias); if (_aliasDropDown.getModel().getSize() > 0) { _aliasDropDown.setSelectedIndex(0); } _aliasDropDown.setEnabled(true); } }
/** * Remove an <TT>ISQLAlias</TT> from this model. * * @param alias <TT>ISQLAlias</TT> to be removed. */ private void removeAlias(ISQLAlias alias) { _aliasDropDown.setEnabled(false); removeElement(alias); if (_aliasDropDown.getModel().getSize() > 0) { _aliasDropDown.setSelectedIndex(0); } _aliasDropDown.setEnabled(true); } }
/** * Add an <TT>ISQLAlias</TT> to this model. * * @param alias <TT>ISQLAlias</TT> to be added. */ private void addAlias(ISQLAlias alias) { _aliasDropDown.setEnabled(false); addElement(alias); if (_aliasDropDown.getModel().getSize() > 0) { _aliasDropDown.setSelectedIndex(0); } _aliasDropDown.setEnabled(true); }
/** * Add an <TT>ISQLAlias</TT> to this model. * * @param alias <TT>ISQLAlias</TT> to be added. */ private void addAlias(ISQLAlias alias) { _aliasDropDown.setEnabled(false); addElement(alias); if (_aliasDropDown.getModel().getSize() > 0) { _aliasDropDown.setSelectedIndex(0); } _aliasDropDown.setEnabled(true); }
/** * Load from <TT>DataCache</TT>. */ private void load() { Iterator<ISQLAlias> it = _myApp.getDataCache().aliases(); while (it.hasNext()) { addAlias(it.next()); } }
/** * Default ctor. Listen to the <TT>DataCache</TT> object for additions * and removals of aliases from the cache. */ public AliasesDropDownModel(IApplication app, AliasesDropDown drop) { super(); _myApp = app; _aliasDropDown = drop; load(); //_app.getDataCache().addAliasesListener(new MyAliasesListener(this)); }
/** * Default ctor. Listen to the <TT>DataCache</TT> object for additions * and removals of aliases from the cache. */ public AliasesDropDownModel(IApplication app, AliasesDropDown drop) { super(); _myApp = app; _aliasDropDown = drop; load(); //_app.getDataCache().addAliasesListener(new MyAliasesListener(this)); }