1 7 8 package javax.accessibility; 9 10 import java.util.Locale ; 11 import java.beans.PropertyChangeListener ; 12 import java.beans.PropertyChangeSupport ; 13 import java.beans.PropertyChangeEvent ; 14 import java.awt.IllegalComponentStateException ; 15 16 63 public abstract class AccessibleContext { 64 65 73 public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName"; 74 75 84 public static final String ACCESSIBLE_DESCRIPTION_PROPERTY = "AccessibleDescription"; 85 86 103 public static final String ACCESSIBLE_STATE_PROPERTY = "AccessibleState"; 104 105 114 public static final String ACCESSIBLE_VALUE_PROPERTY = "AccessibleValue"; 115 116 124 public static final String ACCESSIBLE_SELECTION_PROPERTY = "AccessibleSelection"; 125 126 134 public static final String ACCESSIBLE_CARET_PROPERTY = "AccessibleCaret"; 135 136 143 public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY = "AccessibleVisibleData"; 144 145 154 public static final String ACCESSIBLE_CHILD_PROPERTY = "AccessibleChild"; 155 156 167 public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY = "AccessibleActiveDescendant"; 168 169 177 public static final String ACCESSIBLE_TABLE_CAPTION_CHANGED = 178 "accessibleTableCaptionChanged"; 179 180 188 public static final String ACCESSIBLE_TABLE_SUMMARY_CHANGED = 189 "accessibleTableSummaryChanged"; 190 191 199 public static final String ACCESSIBLE_TABLE_MODEL_CHANGED = 200 "accessibleTableModelChanged"; 201 202 210 public static final String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED = 211 "accessibleTableRowHeaderChanged"; 212 213 219 public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED = 220 "accessibleTableRowDescriptionChanged"; 221 222 230 public static final String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED = 231 "accessibleTableColumnHeaderChanged"; 232 233 239 public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED = 240 "accessibleTableColumnDescriptionChanged"; 241 242 250 public static final String ACCESSIBLE_ACTION_PROPERTY = 251 "accessibleActionProperty"; 252 253 263 public static final String ACCESSIBLE_HYPERTEXT_OFFSET = 264 "AccessibleHypertextOffset"; 265 266 284 public static final String ACCESSIBLE_TEXT_PROPERTY 285 = "AccessibleText"; 286 287 301 public static final String ACCESSIBLE_INVALIDATE_CHILDREN = 302 "accessibleInvalidateChildren"; 303 304 324 public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED = 325 "accessibleTextAttributesChanged"; 326 327 337 public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED = 338 "accessibleComponentBoundsChanged"; 339 340 346 protected Accessible accessibleParent = null; 347 348 354 protected String accessibleName = null; 355 356 362 protected String accessibleDescription = null; 363 364 371 private PropertyChangeSupport accessibleChangeSupport = null; 372 373 377 private AccessibleRelationSet relationSet 378 = new AccessibleRelationSet (); 379 380 395 public String getAccessibleName() { 396 return accessibleName; 397 } 398 399 413 public void setAccessibleName(String s) { 414 String oldName = accessibleName; 415 accessibleName = s; 416 firePropertyChange(ACCESSIBLE_NAME_PROPERTY,oldName,accessibleName); 417 } 418 419 431 public String getAccessibleDescription() { 432 return accessibleDescription; 433 } 434 435 449 public void setAccessibleDescription(String s) { 450 String oldDescription = accessibleDescription; 451 accessibleDescription = s; 452 firePropertyChange(ACCESSIBLE_DESCRIPTION_PROPERTY, 453 oldDescription,accessibleDescription); 454 } 455 456 474 public abstract AccessibleRole getAccessibleRole(); 475 476 488 public abstract AccessibleStateSet getAccessibleStateSet(); 489 490 496 public Accessible getAccessibleParent() { 497 return accessibleParent; 498 } 499 500 508 public void setAccessibleParent(Accessible a) { 509 accessibleParent = a; 510 } 511 512 522 public abstract int getAccessibleIndexInParent(); 523 524 529 public abstract int getAccessibleChildrenCount(); 530 531 541 public abstract Accessible getAccessibleChild(int i); 542 543 555 public abstract Locale getLocale() throws IllegalComponentStateException ; 556 557 572 public void addPropertyChangeListener(PropertyChangeListener listener) { 573 if (accessibleChangeSupport == null) { 574 accessibleChangeSupport = new PropertyChangeSupport (this); 575 } 576 accessibleChangeSupport.addPropertyChangeListener(listener); 577 } 578 579 586 public void removePropertyChangeListener(PropertyChangeListener listener) { 587 if (accessibleChangeSupport != null) { 588 accessibleChangeSupport.removePropertyChangeListener(listener); 589 } 590 } 591 592 599 public AccessibleAction getAccessibleAction() { 600 return null; 601 } 602 603 610 public AccessibleComponent getAccessibleComponent() { 611 return null; 612 } 613 614 621 public AccessibleSelection getAccessibleSelection() { 622 return null; 623 } 624 625 632 public AccessibleText getAccessibleText() { 633 return null; 634 } 635 636 643 public AccessibleEditableText getAccessibleEditableText() { 644 return null; 645 } 646 647 648 655 public AccessibleValue getAccessibleValue() { 656 return null; 657 } 658 659 667 public AccessibleIcon [] getAccessibleIcon() { 668 return null; 669 } 670 671 678 public AccessibleRelationSet getAccessibleRelationSet() { 679 return relationSet; 680 } 681 682 689 public AccessibleTable getAccessibleTable() { 690 return null; 691 } 692 693 714 public void firePropertyChange(String propertyName, 715 Object oldValue, 716 Object newValue) { 717 if (accessibleChangeSupport != null) { 718 if (newValue instanceof PropertyChangeEvent ) { 719 PropertyChangeEvent pce = (PropertyChangeEvent )newValue; 720 accessibleChangeSupport.firePropertyChange(pce); 721 } else { 722 accessibleChangeSupport.firePropertyChange(propertyName, 723 oldValue, 724 newValue); 725 } 726 } 727 } 728 } 729 | Popular Tags |