3 Replies Latest reply on Jun 11, 2008 6:35 AM by Peter Wendland

    HELP!!!! rich:picklist does not load pre-filled value list

    Peter Wendland Newbie

      Hello together,

      I need Your support on an issue I don't have any further ideas on.... I have following picklist:

       <rich:panel id="adminPW13RPRolePrivs">
       <f:facet name="header">
       <h:outputText value="Gruppen-Rechte-Zuordnungen" style="font-size: 120%; background-color: transparent;" />
       </f:facet>
      
       <h:form>
       <h:panelGrid id="adminPW50" columns="3">
       <rich:scrollableDataTable id="adminPW51rolesList" height="100px" width="320px" sortMode="single"
       rowKeyVar="rrkv" frozenColCount="1" columnClasses="col"
       value="#{adminBean.allRoles4Alloc}" var="roles4Alloc" rendered="true"
       binding="#{adminBean.role4AllocTable}"
       selection="#{adminBean.role4AllocSelection}">
       <rich:column id="adminPW52Ident" width="80px">
       <f:facet name="header"><h:outputText value="Bezeichnung" /></f:facet>
       <h:outputText value="#{roles4Alloc.ident}" />
       </rich:column>
       <rich:column id="adminPW53Desc" width="200px">
       <f:facet name="header"><h:outputText value="Beschreibung" /></f:facet>
       <h:outputText value="#{roles4Alloc.desc}" />
       </rich:column>
       </rich:scrollableDataTable>
      
       <h:panelGroup>
       <rich:spacer width="50px" />
       </h:panelGroup>
       <h:panelGroup>
       <h:panelGrid id="adminPW54" columns="1">
       <a4j:commandButton value="Gruppe bearbeiten" reRender="adminPW56MPEdPriv"
       action="#{adminBean.takeRolePrivSelection}"
       oncomplete="javascript:Richfaces.showModalPanel('adminPW55MPEdPriv');" />
       </h:panelGrid>
       </h:panelGroup>
       </h:panelGrid>
       </h:form>
      
       <rich:modalPanel id="adminPW55MPEdPriv" autosized="true" zindex="200">
       <f:facet name="header">
       <h:outputText value="Rechte-Zuordnungen bearbeiten" />
       </f:facet>
       <h:form>
       <h:panelGrid id="adminPW56MPEdPriv" columns="1">
       <h:outputText value="Ausgewaehlte Gruppe: #{adminBean.tmpRole4Alloc.ident}" />
       <h:panelGroup>
       <rich:spacer height="20px" />
       <rich:spacer width="30px" />
       <h:outputText value="Verfuegbare Rechte" />
       <rich:spacer width="250px" />
       <h:outputText value="Ausgewaehlte Rechte" />
       </h:panelGroup>
       </h:panelGrid>
      
       <rich:pickList id="adminPW57PickList" value="#{adminBean.selectedRolePrivs}" showButtonsLabel="false"
       sourceListWidth="300" targetListWidth="300" >
       <f:selectItems value="#{adminBean.allPrivs}" />
       </rich:pickList>
      
       <rich:spacer height="30px" />
       <rich:spacer width="250px" />
       <a4j:commandButton value="Speichern" action="#{adminBean.modifyRolePriv}" />
       <rich:spacer width="30px" />
       <a4j:commandButton value="Schliessen" action="#{adminBean.invokeAdminPage}" />
       </h:form>
       </rich:modalPanel>
      
       </rich:panel>
      


      and following Java code:
      public class AdminBean
      {
       private String ident, desc;
       private String status = "";
      
       private Role tmpRole, tmpRole4Alloc;
      
       private SimpleSelection role4AllocSelection = new SimpleSelection();
       private SimpleSelection rolePrivSelection = new SimpleSelection();
      
       private UIScrollableDataTable role4AllocTable;
       private UIScrollableDataTable rolePrivTable;
       private UIScrollableDataTable privTable;
      
       private ArrayList<Role> selectedRole4Alloc = new ArrayList<Role>();
       private List<SelectItem> rolesOptions = new ArrayList<SelectItem>();
       private ArrayList<Role> selectedRolePriv = new ArrayList<Role>();
      
       private ArrayList<Facet> role4AllocColumns = new ArrayList<Facet>();
       private ArrayList<Facet> privColumns = new ArrayList<Facet>();
       private ArrayList<Facet> rolePrivColumns = new ArrayList<Facet>();
      
       private List<Role> allRoles4Alloc = new ArrayList<Role>();
       private List<SelectItem> allPrivs = new ArrayList<SelectItem>();
       private List<RolePriv> allRolePrivs = new ArrayList<RolePriv>();
       private List<String> selectedRolePrivs = new ArrayList<String>();
      
      // ...
      
       public void takeRolePrivSelection()
       {
       System.out.println("SEAK-log: ");
       System.out.println("SEAK-log: --------- entered takeRolePrivSelection() ---------");
      
       getSelectedRole4Alloc().clear();
       Iterator<Object> iterator = getRole4AllocSelection().getKeys();
       while (iterator.hasNext())
       {
       Object key = iterator.next();
       role4AllocTable.setRowKey(key);
       if (role4AllocTable.isRowAvailable())
       {
       getSelectedRole4Alloc().add((Role) role4AllocTable.getRowData());
       setTmpRole4Alloc((Role) role4AllocTable.getRowData());
       }
       }
      
       String role = getTmpRole4Alloc().getIdent();
       allRolePrivs = (List<RolePriv>) Util.checkDbCriteria(RolePriv.class, "role", role);
      
       for (int i = 0; i < allRolePrivs.size(); i++)
       {
       RolePriv rolePriv = (RolePriv) allRolePrivs.get(i);
       String priv = rolePriv.getPriv();
       selectedRolePrivs.add(priv);
       }
       System.out.println("SEAK-log: --------- exited takeRolePrivSelection() ---------");
       }
      
      // ...
      }
      


      The target-value-list is already pre-filled with 2 entries. I want these 2 entries being displayed in the GUI, but it doesn't work.
      screenshot of the GUI:

      I am now really frustrated, because I think I've done everything right, but it doesn't work...hence it looks so simple.....:-(( .... -> note: I took the example from the RF-LiveDemo...

      regards, Peter