<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gembin

    OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

    HBase, Hadoop, ZooKeeper, Cassandra

    Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

    There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

    About Me

     

    SWT Accessibility

    最近由于項目的需要,研究了一下SWT的Accessibility。關于Accessibility,這是一個很難纏的search,給殘疾人用的東東,正常人基本上不會用到,網上文章少之又少。可以查閱到的一篇來自于IBM developerWorks的文章:使用 Eclipse 創建易訪問的應用程序:介紹

    易 訪問性是一個總括的術語,它包括生成使具有各種殘疾的人易用的產品所涉及的所有東西和人。美國已經立法,不符合Accessibility規范的軟件不能 夠在政府部門銷售。在美國,創建易訪問的應用程序的主要商業(對比人道主義)驅動力是 Rehabilitation Act 1998 年的修正法案,稱為 Section 508。Section 508 要求聯邦機構使他們的信息技術對帶有殘疾的人易于訪問。


    Eclipse 擁有一個包含 API:org.eclipse.swt.accessibility 的易訪問性包。Eclipse 3.0 易訪問性特征是基于 MSAA 1.3 程序設計模型所提供的功能。您可以將 Eclipse 中的 Accessible 對象聯系到每個控件上,并且 org.eclipse.swt.accessibility 接口中的方法集對應 MSAA 1.3 IAccessible 界面中的消息集。

     org.eclipse.swt.accessibility 的接口    

    Interface Summary
    AccessibleControlListener Classes that implement this interface provide methods that deal with the events that are generated when an accessibility client sends a message to a control.
    AccessibleListener Classes that implement this interface provide methods that deal with the events that are generated when an accessibility client sends a message to a control.
    AccessibleTextListener Classes that implement this interface provide methods that deal with the events that are generated when an accessibility client sends a message to a control.

    SWT 自身包含的控件中只有寥寥幾個用到了Accessibility,JFace里也不多。看了所有的Accessibility相關代碼,只能總結一部分規律:
    1. 一般的復雜控件是沒有必要定義Accessibility的。
    2. 如果是模擬實現一個比較簡單的基本控件,比如Combo,Label,Spinner等,有必要定義Accessibility。  
    3. 所有的自定義控件都要實現AccessibleControlListener接口。
    4. 所有的包含文本框的控件都要實現AccessibleTextListener接口。
    5. 設置AccessibleListener的getHelp( )最好是給控件加上Tooltip,因為Wineyes這些屏幕閱讀器閱讀都是根據Tooltip,無視getHelp( )的設置。
    6. 設置AccessibleListener的getName( ),一般來說,可以設置為這個控件相關聯的Label的Text或者該控件上的某部分文字,自己斟酌考慮設置。
    7. getKeyboardShortcut( ),考慮控件的快捷操作方式,如果需要的話。

    以下是CCombo的Accessibility代碼:

    void initAccessible() {
        AccessibleAdapter accessibleAdapter = new AccessibleAdapter () {
           publicvoid getName (AccessibleEvent e) {
               String name = null;
               Label label = getAssociatedLabel ();
               if (label != null) {
                  name = stripMnemonic (label.getText());
               }
               e.result = name;
           }
           publicvoid getKeyboardShortcut(AccessibleEvent e) {
               String shortcut = null;
               Label label = getAssociatedLabel ();
               if (label != null) {
                  String text = label.getText ();
                  if (text != null) {
                      char mnemonic = _findMnemonic (text);
                      if (mnemonic != '\0') {
                         shortcut = "Alt+"+mnemonic;
                      }
                  }
               }
               e.result = shortcut;
           }
           publicvoid getHelp (AccessibleEvent e) {
               e.result = getToolTipText ();
           }
        };
        getAccessible ().addAccessibleListener (accessibleAdapter);
        text.getAccessible ().addAccessibleListener (accessibleAdapter);
        list.getAccessible ().addAccessibleListener (accessibleAdapter);
        arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
           publicvoid getName (AccessibleEvent e) {
               e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open");
           }
           publicvoid getKeyboardShortcut (AccessibleEvent e) {
               e.result = "Alt+Down Arrow";
           }
           publicvoid getHelp (AccessibleEvent e) {
               e.result = getToolTipText ();
           }
        });
     
        getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
           publicvoid getCaretOffset (AccessibleTextEvent e) {
               e.offset = text.getCaretPosition ();
           }
           publicvoid getSelectionRange(AccessibleTextEvent e) {
               Point sel = text.getSelection();
               e.offset = sel.x;
               e.length = sel.y - sel.x;
           }
        });
       
        getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
           publicvoid getChildAtPoint (AccessibleControlEvent e) {
               Point testPoint = toControl (e.x, e.y);
               if (getBounds ().contains (testPoint)) {
                  e.childID = ACC.CHILDID_SELF;
               }
           }
          
           publicvoid getLocation (AccessibleControlEvent e) {
               Rectangle location = getBounds ();
               Point pt = toDisplay (location.x, location.y);
               e.x = pt.x;
               e.y = pt.y;
               e.width = location.width;
               e.height = location.height;
           }
          
           publicvoid getChildCount (AccessibleControlEvent e) {
               e.detail = 0;
           }
          
           publicvoid getRole (AccessibleControlEvent e) {
               e.detail = ACC.ROLE_COMBOBOX;
           }
          
           publicvoid getState (AccessibleControlEvent e) {
               e.detail = ACC.STATE_NORMAL;
           }
     
           publicvoid getValue (AccessibleControlEvent e) {
               e.result = getText ();
           }
        });
     
        text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
           publicvoid getRole (AccessibleControlEvent e) {
               e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL;
           }
        });
     
        arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
           publicvoid getDefaultAction (AccessibleControlEvent e) {
               e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open");
           }
        });
    }

    在SWT控件中,包含Accessibility功能的控件有:CCombo,CLabel,CTableFolder,StyledText。

    posted on 2008-03-30 02:13 gembin 閱讀(679) 評論(0)  編輯  收藏 所屬分類: SWT

    導航

    統計

    常用鏈接

    留言簿(6)

    隨筆分類(440)

    隨筆檔案(378)

    文章檔案(6)

    新聞檔案(1)

    相冊

    收藏夾(9)

    Adobe

    Android

    AS3

    Blog-Links

    Build

    Design Pattern

    Eclipse

    Favorite Links

    Flickr

    Game Dev

    HBase

    Identity Management

    IT resources

    JEE

    Language

    OpenID

    OSGi

    SOA

    Version Control

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    free counters
    主站蜘蛛池模板: 亚洲6080yy久久无码产自国产| 免费网站看v片在线香蕉| 在线观看免费毛片| 亚洲AV无码XXX麻豆艾秋| 亚洲午夜无码久久久久| 18禁男女爽爽爽午夜网站免费| 亚洲色无码一区二区三区| 91精品啪在线观看国产线免费| 国产精品亚洲AV三区| 啦啦啦中文在线观看电视剧免费版| 在线观看亚洲精品专区| 久久亚洲精品AB无码播放| 免费av欧美国产在钱| yy一级毛片免费视频| 亚洲性无码av在线| 手机在线看永久av片免费| 亚洲最大福利视频| 日产乱码一卡二卡三免费| AAA日本高清在线播放免费观看| 亚洲一区二区三区无码国产| 中文字幕亚洲日本岛国片| 久久久www成人免费毛片| 久久国产精品免费一区| 亚洲av无码一区二区三区天堂| 亚洲国产人成网站在线电影动漫| 三年片在线观看免费大全电影| 久久99亚洲网美利坚合众国| 成人免费午夜无码视频| a毛片全部播放免费视频完整18| 日本亚洲成高清一区二区三区| 性盈盈影院免费视频观看在线一区| 久操免费在线观看| 曰批全过程免费视频免费看| 77777亚洲午夜久久多喷| 亚洲av伊人久久综合密臀性色| 男女免费观看在线爽爽爽视频| 花蝴蝶免费视频在线观看高清版 | 国产AV无码专区亚洲AWWW| 日韩免费高清播放器| 综合一区自拍亚洲综合图区| 国产日本亚洲一区二区三区|