/** * Searches an element by its data value. This method is called by the * setSelectedItem method and returns the first occurence of the element. * * @param anItem the item * @return the index of the item or -1 if not found. */ private int findDataElementIndex(final Object anItem) { if (anItem == null) { throw new NullPointerException("Item to find must not be null"); } for (int i = 0; i < this.data.size(); i++) { final ComboBoxItemPair datacon = (ComboBoxItemPair) this.data.get(i); if (anItem.equals(datacon.getKey())) { return i; } } return -1; }
/** * Searches an element by its data value. This method is called by the * setSelectedItem method and returns the first occurence of the element. * * @param anItem the item * @return the index of the item or -1 if not found. */ private int findDataElementIndex(final Object anItem) { if (anItem == null) { throw new NullPointerException("Item to find must not be null"); } for (int i = 0; i < this.data.size(); i++) { final ComboBoxItemPair datacon = (ComboBoxItemPair) this.data.get(i); if (anItem.equals(datacon.getKey())) { return i; } } return -1; }
/** * Searches an element by its data value. This method is called by the * setSelectedItem method and returns the first occurence of the element. * * @param anItem the item * @return the index of the item or -1 if not found. */ private int findDataElementIndex(final Object anItem) { if (anItem == null) { throw new NullPointerException("Item to find must not be null"); } for (int i = 0; i < data.size(); i++) { final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(i); if (anItem.equals(datacon.getKey())) { return i; } } return -1; }
/** * Returns the key from the given index. * * @param index the index of the key. * @return the the key at the specified index. */ public Object getKeyAt(final int index) { if (index >= data.size()) { return null; } if (index < 0) { return null; } final ComboBoxItemPair datacon = (ComboBoxItemPair) data.get(index); if (datacon == null) { return null; } return datacon.getKey(); }
/** * Returns the key from the given index. * * @param index the index of the key. * @return the the key at the specified index. */ public Object getKeyAt(final int index) { if (index >= this.data.size()) { return null; } if (index < 0) { return null; } final ComboBoxItemPair datacon = (ComboBoxItemPair) this.data.get(index); if (datacon == null) { return null; } return datacon.getKey(); }
/** * Returns the key from the given index. * * @param index the index of the key. * @return the the key at the specified index. */ public Object getKeyAt(final int index) { if (index >= this.data.size()) { return null; } if (index < 0) { return null; } final ComboBoxItemPair datacon = (ComboBoxItemPair) this.data.get(index); if (datacon == null) { return null; } return datacon.getKey(); }