We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

Dio83 on 01/31/08


Tagged

jdeveloper


Versions (?)


[FUNCION] crea un SelectOneChoice (combo)


Published in: Java 


Genera un combo por código.

paso 1: arrastrar un selectOneChoice al modo diseño. paso 2: en el value del wizard seleccionar la función.

  1. /** Función que carga el combo de tipo de inmovilizacion con su iterator de su correspondiente vista
  2.   * @return - variable de tipo List que contiene las opciones del combo
  3.   */
  4. public List getComboNOMBRECOMBO() {
  5.  
  6. DCBindingContainer bindcont = ADFUtils.getDCBindingContainer();
  7. DCIteratorBinding iterator = bindcont.findIteratorBinding("ITERADOR_DE_LA_VISTA");
  8. ViewObject view = iterator.getViewObject();
  9.  
  10. List<SelectItem> listEstados = new ArrayList<SelectItem>();
  11. if (view != null && view.getRowCount() > 0) {
  12. Row rowCurrent = view.first();
  13. for (int i = 0; i < view.getRowCount(); i++) {
  14. listEstados.add(new SelectItem(rowCurrent.getAttribute("PRIMARY_KEY_DE_LA_VIEW").toString(),
  15. rowCurrent.getAttribute("DESCRIPCION_DE_LA_VIEW").toString()));
  16. rowCurrent = view.next();
  17. }
  18. }
  19.  
  20. return listEstados;
  21. }

Report this snippet 

You need to login to post a comment.