如何添加Oracle ADF selectOneChoice的tab索引?如何添加Oracle ADF的selectOneChoice的選項卡索引?
1
A
回答
4
不幸的是,你不能在標準的JSF級別上控制它。至少,不是標準組件和渲染器。指定的tabindex
將應用於所有生成的元素(我不需要ADF,但我想它是單選按鈕)。
您可以考慮覆蓋與af:selectOneChoice
關聯的渲染器,以便它接受一個附加屬性tabindexes
或接受逗號分隔的索引字符串,並將其應用於隨後生成的單選按鈕上。
您需要查閱有問題的組件的ADF文檔,以確定它屬於哪個組件系列以及它正在使用哪個渲染器。一旦發現,你基本上需要創建一個類,它會覆蓋renderOption()
方法(至少,它在JSF標準com.sun.faces.renderkit.html_basic.RadioRenderer
類中正好使用該名稱)。你基本上需要複製的方法邏輯(不知道ADF,但基本的JSF實現是開源的)和下面的邏輯添加到它:
String tabindexes = (String) component.getAttributes().get("tabindexes");
if (tabindexes != null) {
String[] tabindexItems = tabindexes.split("\\s*,\\s*");
String indexKey = component.getClientId(context) + "_currentTabIndex";
Integer index = (Integer) component.getAttributes().get(indexKey);
if (index == null || index == tabindexItems.length) {
index = 0; // Note this thus restarts at 0 if there are more selectitems than tabindexes. Just to be on the safe side.
}
String tabindex = tabindexItems[index];
component.getAttributes().put(indexKey, ++index); // We need to save it for the next generated input element.
writer.writeAttribute("tabindex", tabindex, "tabindex");
}
如果您在faces-config.xml
聲明自定義呈現如下
<render-kit>
<renderer>
<component-family>put here the component family of af:selectOneChoice</component-family>
<renderer-type>put here the renderer type of af:selectOneChoice</renderer-type>
<renderer-class>com.example.YourCustomRadioRenderer</renderer-class>
</renderer>
</render-kit>
那麼你可以使用額外的屬性tabindexes
如下:
<af:selectOneChoice .... >
<f:attribute name="tabindexes" value="1,3,5,7,2,4,6,8" />
,你甚至可以把一些EL它,這樣就可以得到它作爲來自bean屬性的(生成的)字符串。
<af:selectOneChoice .... >
<f:attribute name="tabindexes" value="#{bean.tabindexes}" />
希望這給了新的見解。
相關問題
- 1. 從ADF中的selectOneChoice獲取選定值,而不是索引
- 2. selectOneChoice in ADF
- 3. jQuery選項卡 - 獲取之前選定選項卡的索引
- 4. Visual Studio添加引用.NET選項卡和瀏覽選項卡
- 5. 在現有「添加」選項卡之前添加動態引導選項卡
- 6. 相對選項卡索引
- 7. jquery-ui選項卡 - 添加選項卡
- 8. 設置選項卡索引
- 9. 如何清除舊選項卡並在選項卡上添加新選項卡
- 10. 如何設置選項卡容器中的活動選項卡而不使用選項卡的索引?
- 11. 選項卡欄選定索引更多選項卡
- 12. Twitter的引導 - 動態添加/刪除選項卡和選項卡內容
- 13. 如何在JPanel上添加選項卡
- 14. 如何將選項卡添加到TabView
- 15. 在關閉gwt中的一個選項卡後選項卡索引問題
- 16. jQuery UI選項卡選擇索引
- 17. ASP.NET C#GridView選項卡索引問題
- 18. 如何在自定義選項卡的每個選項卡中添加圖標?
- 19. 如何將WPF表單添加到選項卡控件的選項卡中
- 20. 如何設置TTabSet組件的選項卡的圖像索引
- 21. 動態更改活動選項卡索引jQuery UI選項卡
- 22. JqWidget選項卡 - 動態添加ajax內容的選項卡
- 23. 使用GWT中的選項卡動態添加選項卡
- 24. 從不同的選項卡添加GWT選項卡
- 25. 動態添加選項卡
- 26. 動態添加選項卡
- 27. jQuery UI選項卡:獲取當前選項卡索引
- 28. JavaFX的8:添加新的選項卡
- 29. 如何將選項卡添加到dotProject的項目頁面?
- 30. 如何找到控件的默認選項卡索引?
你想設置一個selectOneChoice的選項卡索引,或者你想使用組件內的選項卡? – Bozho 2009-12-22 22:55:48
我只是試圖添加selectOneChoice的選項卡索引。非常感謝您的幫助。 – 2009-12-22 23:52:14