private void addValue(T value) { Object key = keyProvider.getKey(value); if (valueKeyToIndex.containsKey(key)) { throw new IllegalArgumentException("Duplicate value: " + value); } valueKeyToIndex.put(key, values.size()); values.add(value); addListBoxItem(renderer.render(value)); assert values.size() == getListBox().getItemCount(); }
private void updateListBox() { if (value != null) { for (T item : value) { Object key = keyProvider.getKey(item); Integer index = valueKeyToIndex.get(key); if (index == null) { addValue(item); } index = valueKeyToIndex.get(key); getListBox().setItemSelected(index, true); } } } }
@SuppressWarnings("unchecked") private K getObjectId(T value) { return (K) dataGrid.getDataGrid().getKeyProvider().getKey(value); }
/** * Get the key for the specified row value. * * @param rowValue the row value * @return the key */ private Object getRowValueKey(T rowValue) { return (keyProvider == null || rowValue == null) ? rowValue : keyProvider.getKey(rowValue); }
/** * Get the key for the specified value. * * @param value the value * @return the key */ private Object getKey(C value) { return (keyProvider == null || value == null) ? value : keyProvider.getKey(value); } }
/** * Get the key for a list item. The default implementation returns the item * itself. * * @param item the list item * @return the key that represents the item */ public Object getKey(T item) { return keyProvider == null ? item : keyProvider.getKey(item); }
@Override public Object getKey(T item) { return (keyProvider == null || item == null) ? item : keyProvider.getKey(item); }
/** * Returns the key for the value of this node using the parent's * implementation of NodeInfo.getKey(). */ protected Object getValueKey() { return parentNodeInfo.getProvidesKey().getKey(value); }
/** * Get the key for the specified value. If a keyProvider is not specified or the value is null, * the value is returned. If the key provider is specified, it is used to get the key from * the value. * * @param value the value * @return the key */ public Object getValueKey(T value) { ProvidesKey<T> keyProvider = getKeyProvider(); return (keyProvider == null || value == null) ? value : keyProvider.getKey(value); }
private void updateListBox() { Object key = keyProvider.getKey(value); Integer index = valueKeyToIndex.get(key); if (index == null) { addValue(value); } index = valueKeyToIndex.get(key); getListBox().setSelectedIndex(index); } }
private void addValue(T value) { Object key = keyProvider.getKey(value); if (valueKeyToIndex.containsKey(key)) { throw new IllegalArgumentException("Duplicate value: " + value); } valueKeyToIndex.put(key, values.size()); values.add(value); getListBox().addItem(renderer.render(value)); assert values.size() == getListBox().getItemCount(); }
/** * Get the key for the specified row value. * * @param rowValue the row value * @return the key */ private Object getRowValueKey(T rowValue) { return (keyProvider == null || rowValue == null) ? rowValue : keyProvider.getKey(rowValue); }
/** * Get the key for the specified row value. * * @param rowValue the row value * @return the key */ private Object getRowValueKey(T rowValue) { return (keyProvider == null || rowValue == null) ? rowValue : keyProvider.getKey(rowValue); }
/** * Get the key for the specified value. * * @param value the value * @return the key */ private Object getKey(C value) { return (keyProvider == null || value == null) ? value : keyProvider.getKey(value); } }
/** * Get the key for a list item. The default implementation returns the item * itself. * * @param item the list item * @return the key that represents the item */ public Object getKey(T item) { return keyProvider == null ? item : keyProvider.getKey(item); }
@Override public Object getKey(T item) { return (keyProvider == null || item == null) ? item : keyProvider.getKey(item); }
/** * Get the key for a list item. The default implementation returns the item * itself. * * @param item the list item * @return the key that represents the item */ public Object getKey(T item) { return keyProvider == null ? item : keyProvider.getKey(item); }
@Override public Object getKey(T item) { return (keyProvider == null || item == null) ? item : keyProvider.getKey(item); }
/** * Get the key for the specified value. * * @param value the value * @return the key */ private Object getKey(C value) { return (keyProvider == null || value == null) ? value : keyProvider.getKey(value); } }
/** * Return true if the value is part of the accepted values list of this component. */ public boolean isAccepted(T value) { Object key = keyProvider.getKey(value); return valueKeyToIndex.containsKey(key); }