List of usage examples for com.google.gwt.dom.client OptionElement setTitle
@Override
public void setTitle(String title)
From source file:org.dashbuilder.renderer.client.selector.SelectorDisplayer.java
License:Apache License
protected void populateSelector() { listBox.clear();/*from w ww .j ava 2 s . c o m*/ final DataColumn firstColumn = dataSet.getColumnByIndex(0); final String firstColumnId = firstColumn.getId(); ColumnSettings columnSettings = displayerSettings.getColumnSettings(firstColumn); final String firstColumnName = columnSettings.getColumnName(); listBox.addItem( "- " + SelectorConstants.INSTANCE.selectorDisplayer_select() + " " + firstColumnName + " -"); SelectElement selectElement = SelectElement.as(listBox.getElement()); NodeList<OptionElement> options = selectElement.getOptions(); // Generate the list entries from the current data set List<Integer> currentFilter = super.filterIndexes(firstColumnId); for (int i = 0; i < dataSet.getRowCount(); i++) { Object obj = dataSet.getValueAt(i, 0); if (obj == null) continue; String value = super.formatValue(obj, firstColumn); listBox.addItem(value); if (currentFilter != null && currentFilter.contains(i)) { listBox.setSelectedIndex(i + 1); } // Generate an option tooltip (only if extra data set columns are defined) int ncolumns = getNumberOfColumns(dataSet); if (ncolumns > 1) { StringBuilder out = new StringBuilder(); for (int j = 1; j < ncolumns; j++) { DataColumn extraColumn = dataSet.getColumnByIndex(j); columnSettings = displayerSettings.getColumnSettings(extraColumn); String extraColumnName = columnSettings.getColumnName(); Object extraValue = dataSet.getValueAt(i, j); if (extraValue != null) { if (j > 1) out.append(" "); String formattedValue = super.formatValue(extraValue, extraColumn); out.append(extraColumnName).append("=").append(formattedValue); } } OptionElement optionElement = options.getItem(i + 1); if (optionElement != null) optionElement.setTitle(out.toString()); } } }
From source file:org.dashbuilder.renderer.client.selector.SelectorDisplayerView.java
License:Apache License
@Override public void setItemTitle(int index, String title) { SelectElement selectElement = SelectElement.as(listBox.getElement()); NodeList<OptionElement> options = selectElement.getOptions(); OptionElement optionElement = options.getItem(index + (hintEnabled ? 1 : 0)); if (optionElement != null) { optionElement.setTitle(title); }//from ww w.j a va 2s. c om }
From source file:org.pentaho.mantle.client.ui.custom.ListBoxTitle.java
License:Open Source License
@Override public void insertItem(String item, HasDirection.Direction dir, String value, int index) { SelectElement select = (SelectElement) this.getElement().cast(); OptionElement option = Document.get().createOptionElement(); this.setOptionText(option, item, dir); option.setValue(value);//from w ww . ja v a 2s.co m option.setTitle(value); int itemCount = select.getLength(); if (index < 0 || index > itemCount) { index = itemCount; } if (index == itemCount) { select.add(option, (OptionElement) null); } else { OptionElement before = (OptionElement) select.getOptions().getItem(index); select.add(option, before); } }