Method from javax.swing.JList$AccessibleJList Detail: |
public void addAccessibleSelection(int i) {
JList.this.addSelectionInterval(i, i);
}
Adds the specified selected item in the object to the object's
selection. If the object supports multiple selections,
the specified item is added to any existing selection, otherwise
it replaces any existing selection in the object. If the
specified item is already selected, this method has no effect. |
public void clearAccessibleSelection() {
JList.this.clearSelection();
}
Clears the selection in the object, so that nothing in the
object is selected. |
public void contentsChanged(ListDataEvent e) {
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
}
List Data Listener contents changed method. Used to fire the visible data property change |
public Accessible getAccessibleAt(Point p) {
int i = locationToIndex(p);
if (i >= 0) {
return new AccessibleJListChild(JList.this, i);
} else {
return null;
}
}
Returns the Accessible child contained at
the local coordinate Point , if one exists.
Otherwise returns null . |
public Accessible getAccessibleChild(int i) {
if (i >= getModel().getSize()) {
return null;
} else {
return new AccessibleJListChild(JList.this, i);
}
}
Return the nth Accessible child of the object. |
public int getAccessibleChildrenCount() {
return getModel().getSize();
}
Returns the number of accessible children in the object. If all
of the children of this object implement Accessible, than this
method should return the number of children of this object. |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LIST;
}
Get the role of this object. |
public AccessibleSelection getAccessibleSelection() {
return this;
}
Get the AccessibleSelection associated with this object. In the
implementation of the Java Accessibility API for this class,
return this object, which is responsible for implementing the
AccessibleSelection interface on behalf of itself. |
public Accessible getAccessibleSelection(int i) {
int len = getAccessibleSelectionCount();
if (i < 0 || i >= len) {
return null;
} else {
return getAccessibleChild(JList.this.getSelectedIndices()[i]);
}
}
Returns an Accessible representing the specified selected item
in the object. If there isn't a selection, or there are
fewer items selected than the integer passed in, the return
value will be null . |
public int getAccessibleSelectionCount() {
return JList.this.getSelectedIndices().length;
}
Returns the number of items currently selected.
If no items are selected, the return value will be 0. |
public AccessibleStateSet getAccessibleStateSet() {
AccessibleStateSet states = super.getAccessibleStateSet();
if (selectionModel.getSelectionMode() !=
ListSelectionModel.SINGLE_SELECTION) {
states.add(AccessibleState.MULTISELECTABLE);
}
return states;
}
Get the state set of this object. |
public void intervalAdded(ListDataEvent e) {
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
}
List Data Listener interval added method. Used to fire the visible data property change |
public void intervalRemoved(ListDataEvent e) {
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
}
List Data Listener interval removed method. Used to fire the visible data property change |
public boolean isAccessibleChildSelected(int i) {
return isSelectedIndex(i);
}
Returns true if the current child of this object is selected. |
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
Object oldValue = e.getOldValue();
Object newValue = e.getNewValue();
// re-set listData listeners
if (name.compareTo("model") == 0) {
if (oldValue != null && oldValue instanceof ListModel) {
((ListModel) oldValue).removeListDataListener(this);
}
if (newValue != null && newValue instanceof ListModel) {
((ListModel) newValue).addListDataListener(this);
}
// re-set listSelectionModel listeners
} else if (name.compareTo("selectionModel") == 0) {
if (oldValue != null && oldValue instanceof ListSelectionModel) {
((ListSelectionModel) oldValue).removeListSelectionListener(this);
}
if (newValue != null && newValue instanceof ListSelectionModel) {
((ListSelectionModel) newValue).addListSelectionListener(this);
}
firePropertyChange(
AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
}
}
Property Change Listener change method. Used to track changes
to the DataModel and ListSelectionModel, in order to re-set
listeners to those for reporting changes there via the Accessibility
PropertyChange mechanism. |
public void removeAccessibleSelection(int i) {
JList.this.removeSelectionInterval(i, i);
}
Removes the specified selected item in the object from the object's
selection. If the specified item isn't currently selected, this
method has no effect. |
public void selectAllAccessibleSelection() {
JList.this.addSelectionInterval(0, getAccessibleChildrenCount() -1);
}
Causes every selected item in the object to be selected
if the object supports multiple selections. |
public void valueChanged(ListSelectionEvent e) {
int oldLeadSelectionIndex = leadSelectionIndex;
leadSelectionIndex = JList.this.getLeadSelectionIndex();
if (oldLeadSelectionIndex != leadSelectionIndex) {
Accessible oldLS, newLS;
oldLS = (oldLeadSelectionIndex >= 0)
? getAccessibleChild(oldLeadSelectionIndex)
: null;
newLS = (leadSelectionIndex >= 0)
? getAccessibleChild(leadSelectionIndex)
: null;
firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
oldLS, newLS);
}
firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
// Process the State changes for Multiselectable
AccessibleStateSet s = getAccessibleStateSet();
ListSelectionModel lsm = JList.this.getSelectionModel();
if (lsm.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION) {
if (!s.contains(AccessibleState.MULTISELECTABLE)) {
s.add(AccessibleState.MULTISELECTABLE);
firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
null, AccessibleState.MULTISELECTABLE);
}
} else {
if (s.contains(AccessibleState.MULTISELECTABLE)) {
s.remove(AccessibleState.MULTISELECTABLE);
firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
AccessibleState.MULTISELECTABLE, null);
}
}
}
List Selection Listener value change method. Used to fire
the property change |