User selected a new row.
From the ListSelectionListener interface.
@param source The source.
@param iStartRow The starting row.
@param iEndRow The ending row..
@param iSelectType The type of selection.
@return boolean If the selection changed, return true
433697
public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
    {
        int iOldSelection = m_iSelectedRow;
        if (m_iSelectedRow == iEndRow)
            m_iSelectedRow = iStartRow;
        else
            m_iSelectedRow = iEndRow;
        
        if (source instanceof JTable)
            m_iSelectedRow = ((JTable)source).getSelectedRow();
        
        try {
            this.updateIfNewRow(m_iSelectedRow);
        } catch (Exception ex)  {
            if (!(source instanceof Component))
                source = null;  // Never
            if (!this.displayError(ex, (Component)source))
                ex.printStackTrace();
        }
        return (iOldSelection != m_iSelectedRow);
    }
1191779
public void select(ArrayList selection) {
		list.clearSelection();
		int[] selected = new int[selection.size()];
		for (int i=0;i<selection.size();i++) {
			selected[i] = sprites.indexOf(selection.get(i));
		}
		list.setSelectedIndices(selected);
		
		sheetPanel.setSelection(selection);
	}
817589
public void setSelection(long identifier, boolean fireOnClick) {
        SelectExtension<IDrawerItem> select = getAdapter().getExtension(SelectExtension.class);
        if (select != null) {
            select.deselect();
            select.selectByIdentifier(identifier, false, true);

            //we also have to call the general notify
            Pair<IDrawerItem, Integer> res = getAdapter().getItemById(identifier);
            if (res != null) {
                Integer position = res.second;
                notifySelect(position != null ? position : -1, fireOnClick);
            }
        }
    }
202795
public void setSelected(boolean bSelected)
    {
        int iCount = this.getFieldCount();
        for (int i = 0; i < iCount; i++)
        {
            this.getField(i).setSelected(bSelected);
        }
    }
1329768
private int[] getSelectedRows() {
        int iMin = model.getMinSelectionIndex();
        int iMax = model.getMaxSelectionIndex();

        if( (iMin == -1) || (iMax == -1) ) {
            return new int[0];
        }

        int[] rvTmp = new int[1 + (iMax - iMin)];
        int n = 0;
        for( int i = iMin; i <= iMax; i++ ) {
            if( model.isSelectedIndex(i) ) {
                rvTmp[n++] = i;
            }
        }
        int[] rv = new int[n];
        System.arraycopy(rvTmp, 0, rv, 0, n);
        return rv;
    }
781513
private void addInstSelect(final Select _select, final AbstractDataElement<?> _element, final Object _attrOrClass,
                               final Type _currentType)
        throws CacheReloadException
    {
        if (StringUtils.isNotEmpty(_element.getPath()) && !this.instSelects.containsKey(_element.getPath())) {
            final Select instSelect = Select.get();
            for (final AbstractElement<?> selectTmp : _select.getElements()) {
                if (!selectTmp.equals(_element)) {
                    if (selectTmp instanceof LinktoElement) {
                        instSelect.addElement(new LinktoElement().setAttribute(((LinktoElement) selectTmp)
                                        .getAttribute()));
                    } else if (selectTmp instanceof LinkfromElement) {
                        instSelect.addElement(new LinkfromElement().setAttribute(((LinkfromElement) selectTmp)
                                        .getAttribute()).setStartType(((LinkfromElement) selectTmp).getStartType()));
                    } else if (selectTmp instanceof ClassElement) {
                        instSelect.addElement(new ClassElement()
                                        .setClassification(((ClassElement) selectTmp).getClassification())
                                        .setType(((ClassElement) selectTmp).getType()));
                    } else if (selectTmp instanceof AttributeSetElement) {
                        instSelect.addElement(new AttributeSetElement()
                                        .setAttributeSet(((AttributeSetElement) selectTmp).getAttributeSet())
                                        .setType(((ClassElement) selectTmp).getType()));
                    }
                }
            }
            if (_element instanceof LinkfromElement) {
                instSelect.addElement(new LinkfromElement().setAttribute((Attribute) _attrOrClass).setStartType(
                                _currentType));
                instSelect.addElement(new InstanceElement(((Attribute) _attrOrClass).getParent()));
            } else if (_element instanceof LinktoElement) {
                instSelect.addElement(new LinktoElement().setAttribute((Attribute) _attrOrClass));
                instSelect.addElement(new InstanceElement(_currentType));
            } else if (_element instanceof ClassElement) {
                instSelect.addElement(new ClassElement().setClassification((Classification) _attrOrClass)
                                .setType(_currentType));
                instSelect.addElement(new InstanceElement((Type) _attrOrClass));
            } else if (_element instanceof AttributeSetElement) {
                instSelect.addElement(new AttributeSetElement().setAttributeSet((AttributeSet) _attrOrClass)
                                .setType(_currentType));
                instSelect.addElement(new InstanceElement((Type) _attrOrClass));
            }
            this.instSelects.put(_element.getPath(), instSelect);
        }
    }
1335707
public void addSelectionChangedListener(ISelectionChangedListener listener)
	{
		if (fOutlineViewer != null)
		{
			fOutlineViewer.addSelectionChangedListener(listener);
		} else
		{
			fSelectionChangedListeners.add(listener);
		}
	}
1238024
public void onFeatureSelected(FeatureSelectedEvent event) {
		Feature feature = event.getFeature();

		// Only select if it is actually deselected:
		boolean selected = false;
		ListGridRecord[] selections = getSelection();
		for (ListGridRecord selection : selections) {
			if (selection.getAttribute(FIELD_NAME_FEATURE_ID).equals(feature.getId())) {
				selected = true;
				break;
			}
		}

		// If deselected, find the correct row and select:
		if (!selected) {
			ListGridRecord[] records = this.getRecords();
			for (int i = 0; i < records.length; i++) {
				if (records[i].getAttribute(FIELD_NAME_FEATURE_ID).equals(feature.getId())) {
					selectRecord(i);
					break;
				}
			}
		}
	}
701001
public boolean isCellPresent(String searchElement, int columnId, SearchType... searchTypes) {
        ready();
        GridCell cell = new GridCell(columnId, searchElement, searchTypes).setContainer(this);
        boolean selected;
        do {
            selected = cell.isElementPresent();
        } while (!selected && scrollPageDown());
        return selected;
    }
238138
public void select(Item item, boolean considerSelectableFlag) {
        if (considerSelectableFlag && !item.isSelectable()) {
            return;
        }
        item.withSetSelected(true);
        if (mSelectionListener != null) {
            mSelectionListener.onSelectionChanged(item, true);
        }
    }
617396
public Integer getSelectedRow() {
        final Object result = getStateHelper().eval(PropertyKeys.selectedRow);
        if (result == null) {
            return null;
        }
        return Integer.valueOf(result.toString());
    }
543594
public void select(final boolean considerSelectableFlag) {
        mFastAdapter.recursive(new AdapterPredicate<Item>() {
            @Override
            public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) {
                select(lastParentAdapter, item, -1, false, considerSelectableFlag);
                return false;
            }
        }, false);
        mFastAdapter.notifyDataSetChanged();
    }
1203177
private boolean isSelect(String action, String expected) {
        // wait for element to be displayed
        if (!is.select()) {
            reporter.fail(action, expected, Element.CANT_SELECT + prettyOutput() + NOT_A_SELECT);
            // indicates element not an input
            return false;
        }
        return true;
    }
1197825
protected void fireMySelectionChanged(MyListSelectionEvent event)
    {
        this.selectionChanged(event.getSource(), event.getRow(), event.getRow(), event.getType());  // Make sure model knows
        // Guaranteed to return a non-null array
        Object[] listeners = listenerList.getListenerList();
        // Process the listeners last to first, notifying
        // those that are interested in this event
        for (int i = listeners.length-2; i>=0; i-=2)
        {
            if (listeners[i] == MyListSelectionListener.class)
                if (listeners[i] != event.getSource())  // Don't send it back to source
            { // Send this message
                ((MyListSelectionListener)listeners[i+1]).selectionChanged(event);
            }
        }
    }
273899
def unselectRow(self, row):
        ''
        if id(row) in self._selectedRows:
            del self._selectedRows[id(row)]
            return True
        else:
            return False
1313921
private static void setSelections(final WComponent component, final boolean selected) {
		if (component instanceof WCheckBox) {
			((WCheckBox) component).setSelected(selected);
		} else if (component instanceof WCheckBoxSelect) {
			WCheckBoxSelect select = (WCheckBoxSelect) component;
			select.setSelected(selected ? select.getOptions() : new ArrayList(0));
		} else if (component instanceof WMultiSelect) {
			WMultiSelect list = (WMultiSelect) component;
			list.setSelected(selected ? list.getOptions() : new ArrayList(0));
		} else if (component instanceof WDataTable) {
			WDataTable table = (WDataTable) component;

			if (table.getSelectMode() == SelectMode.MULTIPLE) {
				if (selected) {
					TableDataModel model = table.getDataModel();
					int rowCount = model.getRowCount();

					List<Integer> indices = new ArrayList<>(rowCount);

					for (int i = 0; i < rowCount; i++) {
						if (model.isSelectable(i)) {
							indices.add(i);
						}
					}

					table.setSelectedRows(indices);
				} else {
					table.setSelectedRows(new ArrayList<Integer>(0));
				}
			}
		} else if (component instanceof Container) {
			Container container = (Container) component;
			final int childCount = container.getChildCount();

			for (int i = 0; i < childCount; i++) {
				WComponent child = container.getChildAt(i);
				setSelections(child, selected);
			}
		}
	}
606452
@Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        // Save the supplied value to the date picker.
        setCellEditorValue(value);
        // Draw the appropriate background colors to indicate a selected or unselected state.
        if (isSelected) {
            if (matchTableSelectionBackgroundColor) {
                datePicker.getComponentDateTextField().setBackground(table.getSelectionBackground());
                datePicker.setBackground(table.getSelectionBackground());
            } else {
                datePicker.zDrawTextFieldIndicators();
            }
        }
        if (!isSelected) {
            if (matchTableBackgroundColor) {
                datePicker.getComponentDateTextField().setBackground(table.getBackground());
                datePicker.setBackground(table.getBackground());
            } else {
                datePicker.zDrawTextFieldIndicators();
            }
        }
        // Draw the appropriate borders to indicate a focused or unfocused state.
        if (hasFocus) {
            datePicker.setBorder(borderFocusedCell);
        } else {
            datePicker.setBorder(borderUnfocusedCell);
        }
        // If needed, adjust the minimum row height for the table.
        zAdjustTableRowHeightIfNeeded(table);
        // This fixes a bug where the date text could "move around" during a table resize event.
        datePicker.getComponentDateTextField().setScrollOffset(0);
        // Return the date picker component.
        return datePicker;
    }