org.eclipse.swt.accessibility.Accessible类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.eclipse.swt.accessibility.Accessible类的一些代码示例,展示了Accessible类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Accessible类的具体详情如下:
包路径:org.eclipse.swt.accessibility.Accessible
类名称:Accessible

Accessible介绍

[英]Instances of this class provide a bridge between application code and assistive technology clients. Many platforms provide default accessible behavior for most widgets, and this class allows that default behavior to be overridden. Applications can get the default Accessible object for a control by sending it getAccessible, and then add an accessible listener to override simple items like the name and help string, or they can add an accessible control listener to override complex items. As a rule of thumb, an application would only want to use the accessible control listener to implement accessibility for a custom control.
[中]此类实例提供了应用程序代码和辅助技术客户端之间的桥梁。许多平台为大多数小部件提供默认的可访问行为,这个类允许覆盖默认行为。应用程序可以通过发送控件getAccessible来获取该控件的默认可访问对象,然后添加一个可访问的侦听器以覆盖简单项,如名称和帮助字符串,或者可以添加一个可访问的控件侦听器以覆盖复杂项。根据经验,应用程序只希望使用可访问控件侦听器实现自定义控件的可访问性。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

private void initAccessibleLink() {
  Accessible accessible = this.getAccessible();
  accessible.addAccessibleListener(new AccessibleAdapter() {
    public void getName(AccessibleEvent e) {
      e.result = label.getText();
    }
    public void getHelp(AccessibleEvent e) {
      e.result = label.getToolTipText();
    }
  });
  accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
    public void getRole(AccessibleControlEvent e) {
      e.detail = ACC.ROLE_LINK;
    }
    public void getState(AccessibleControlEvent e) {
      if (hasFocus)
        e.detail = ACC.STATE_FOCUSABLE | ACC.STATE_LINKED
            | ACC.STATE_FOCUSED;
      else
        e.detail = ACC.STATE_FOCUSABLE | ACC.STATE_LINKED;
    }
  });
}
private void initAccessibleLabel() {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
  public void handleEvent(Event event) {
    if (selectedIndex == -1) {
      accessible.setFocus(ACC.CHILDID_SELF);
    } else {
      accessible.setFocus(selectedIndex);
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

Accessible getAccessible(final Accessible accessibleTable) {
  if (accessible == null) {
    accessible = new Accessible(accessibleTable);
    accessible.addAccessibleListener(new AccessibleAdapter() {
      @Override
      public void getName(AccessibleEvent e) {
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      @Override
      public void getChildAtPoint(AccessibleControlEvent e) {
    accessible.addAccessibleTableCellListener(new AccessibleTableCellListener() {
      @Override
      public void getColumnHeaders(AccessibleTableCellEvent e) {

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

accessible.addAccessibleListener(new AccessibleAdapter() {
  public void getName (AccessibleEvent e) {
    String name = null;
accessible.addAccessibleTextListener(new AccessibleTextExtendedAdapter() {
  public void getCaretOffset(AccessibleTextEvent e) {
    e.offset = StyledText.this.getCaretOffset();
accessible.addAccessibleEditableTextListener(new AccessibleEditableTextListener() {
  public void setTextAttributes(AccessibleTextAttributeEvent e) {
accessible.addAccessibleAttributeListener(new AccessibleAttributeAdapter() {
  public void getAttributes(AccessibleAttributeEvent e) {
    StyledText st = StyledText.this;
accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
  public void getRole(AccessibleControlEvent e) {
    e.detail = ACC.ROLE_TEXT;

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void initAccessibleChevronTb() {
  chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
    @Override
    public void getName(AccessibleEvent e) {
      if (e.childID != ACC.CHILDID_SELF) {
        if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
          e.result = chevronItem.getToolTipText();
        }
      }
    }
  });
}
void onKeyDown (Event event) {

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

getAccessible ().addAccessibleListener (accessibleAdapter);
text.getAccessible ().addAccessibleListener (accessibleAdapter);
list.getAccessible ().addAccessibleListener (accessibleAdapter);
arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
 public void getName (AccessibleEvent e) {
  e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
 public void getCaretOffset (AccessibleTextEvent e) {
  e.offset = text.getCaretPosition ();
getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
 public void getChildAtPoint (AccessibleControlEvent e) {
  Point testPoint = toControl (e.x, e.y);
text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
 public void getRole (AccessibleControlEvent e) {
  e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL;
arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
 public void getDefaultAction (AccessibleControlEvent e) {
  e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.views.properties.tabbed

accessible.addAccessibleListener(new AccessibleAdapter() {
accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
    accessible.setFocus(ACC.CHILDID_SELF);
addListener(SWT.FocusIn, event -> accessible.setFocus(ACC.CHILDID_SELF));

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

int get_accChild(int /*long*/ varChild, int /*long*/ ppdispChild) {
  VARIANT v = getVARIANT(varChild);
  if (v.vt != COM.VT_I4) return COM.E_INVALIDARG;
  if (v.lVal == COM.CHILDID_SELF) {
    if (DEBUG) print(this + ".IAccessible::get_accChild(" + v.lVal + ") returning " + getAddress() + hresult(COM.S_OK));
    AddRef();
    COM.MoveMemory(ppdispChild, new int /*long*/[] { getAddress() }, OS.PTR_SIZEOF);
    return COM.S_OK;
  final int childID = osToChildID(v.lVal);
  int code = COM.S_FALSE;
  Accessible osAccessible = null;
            accChild.dispose();
            accChild.item = null;
            found = true;
        osAccessible = new Accessible(this, addr[0]);
        osAccessible.item = item;
        if (!found) {
        osAccessible.addAccessibleListener(new AccessibleAdapter() {
          @Override
          public void getName(AccessibleEvent e) {
  for (int i = 0; i < accessibleControlListenersSize(); i++) {
    AccessibleControlListener listener = accessibleControlListeners.get(i);
    listener.getChild(event);
  if (accessible == null) accessible = osAccessible;

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

accessible.addAccessibleListener(new AccessibleAdapter() {
  @Override
  public void getName(AccessibleEvent e) {
accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
  @Override
  public void getRole(AccessibleControlEvent e) {
accessible.addAccessibleValueListener(new AccessibleValueAdapter() {
  @Override
  public void setCurrentValue(AccessibleValueEvent e) {

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

private void initButton(Image im, final String tt) {
  toolButton.setImage(im);
  toolButton.setToolTipText(tt);
  toolbar.setVisible(true);
  toolbar.getParent().requestLayout(); // must layout
  if (currentAccessibleListener != null)
    toolbar.getAccessible().removeAccessibleListener(currentAccessibleListener);
  currentAccessibleListener = new AccessibleAdapter() {
    @Override
    public void getName(AccessibleEvent e) {
      e.result = tt;
    }
  };
  toolbar.getAccessible().addAccessibleListener(currentAccessibleListener);
}

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

private void initAccessibleLabel() {
    Accessible accessible = label.getAccessible();
    accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
      public void getState(AccessibleControlEvent e) {
        if (hasFocus)
          e.detail = ACC.STATE_READONLY | ACC.STATE_FOCUSABLE
              | ACC.STATE_SELECTABLE | ACC.STATE_LINKED
              | ACC.STATE_FOCUSED;
        else
          e.detail = ACC.STATE_READONLY | ACC.STATE_FOCUSABLE
              | ACC.STATE_SELECTABLE | ACC.STATE_LINKED;

      }
    });
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Invokes platform specific functionality to allocate a new accessible object.
 * <p>
 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
 * API for <code>Accessible</code>. It is marked public only so that it
 * can be shared within the packages provided by SWT. It is not
 * available on all platforms, and should never be called from
 * application code.
 * </p>
 *
 * @param control the control to get the accessible object for
 * @return the platform specific accessible object
 *
 * @noreference This method is not intended to be referenced by clients.
 */
public static Accessible internal_new_Accessible (Control control) {
  return new Accessible (control);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

getAccessible().setFocus(selectedItem);
getAccessible().selectionChanged();

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

messageLabel.setFont(JFaceResources.getDialogFont());
messageLabel.getAccessible().addAccessibleAttributeListener(
    new AccessibleAttributeAdapter() {
      @Override

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

acc.addAccessibleListener(accAdapter);
acc.addAccessibleTextListener(accTextExtendedAdapter);
acc.addAccessibleEditableTextListener(accEditableTextListener);
acc.addAccessibleAttributeListener(accAttributeAdapter);
acc.addAccessibleControlListener(accControlAdapter);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void initAccessibleChevronTb() {
  chevronTb.getAccessible().addAccessibleListener(new AccessibleAdapter() {
    @Override
    public void getName(AccessibleEvent e) {
      if (e.childID != ACC.CHILDID_SELF) {
        if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
          e.result = chevronItem.getToolTipText();
        }
      }
    }
  });
}
void onKeyDown (Event event) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

getAccessible ().addAccessibleListener (accessibleAdapter);
text.getAccessible ().addAccessibleListener (accessibleAdapter);
list.getAccessible ().addAccessibleListener (accessibleAdapter);
arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
  @Override
  public void getName (AccessibleEvent e) {
getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
  @Override
  public void getCaretOffset (AccessibleTextEvent e) {
getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
  @Override
  public void getChildAtPoint (AccessibleControlEvent e) {
text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
  @Override
  public void getRole (AccessibleControlEvent e) {
arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
  @Override
  public void getDefaultAction (AccessibleControlEvent e) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

super(parent, style);
getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
  @Override
  public void getRole(AccessibleControlEvent e) {

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

/**
 * Invokes platform specific functionality to allocate a new accessible object.
 * <p>
 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
 * API for <code>Accessible</code>. It is marked public only so that it
 * can be shared within the packages provided by SWT. It is not
 * available on all platforms, and should never be called from
 * application code.
 * </p>
 *
 * @param control the control to get the accessible object for
 * @return the platform specific accessible object
 *
 * @noreference This method is not intended to be referenced by clients.
 */
public static Accessible internal_new_Accessible (Control control) {
  return new Accessible (control);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

messageLabel.setFont(JFaceResources.getDialogFont());
messageLabel.getAccessible().addAccessibleAttributeListener(
    new AccessibleAttributeAdapter() {
      @Override

相关文章