0 Replies Latest reply on Aug 21, 2008 4:01 AM by jan_e

    how to get shuttleList target Selection

    jan_e

      Hi,

      i have proplems with receiving the target values from a list shuttle. I want to how the values can be processed to the server?


      Here is my Source...

      ShuttleConverter:

      public class ListShuttleConverter implements javax.faces.convert.Converter{
      
       public Object getAsObject(FacesContext context, UIComponent component,
       String value) {
      
       int index = value.indexOf(':');
      
       return new ListShuttleObject(value.substring(0, index), value.substring(index + 1));
       }
      
       public String getAsString(FacesContext context, UIComponent component,
       Object value) {
      
       ListShuttleObject optionItem = (ListShuttleObject) value;
       return optionItem.getLabel() + ":" + optionItem.getValue();
       }
      
      }


      my bean:
      public class ListShuttleObject implements Serializable{
       private static final long serialVersionUID = -588991230841587261L;
       private String label;
       private String value;
      
       public ListShuttleObject() {
      
       }
      
       public ListShuttleObject(String label, String value) {
       super();
       this.label = label;
       this.value = value;
       }
      
       public ListShuttleObject(SelectItem item){
       this.label = item.getLabel();
       this.value = item.getValue().toString();
       }
      
       public boolean equals(Object obj){
       if (this == obj)
       return true;
       if (obj == null)
       return false;
       if (getClass() != obj.getClass())
       return false;
       final ListShuttleObject other = (ListShuttleObject) obj;
       if (value == null) {
       if (other.value != null)
       return false;
       } else if (!value.equals(other.value))
       return false;
       if (label == null) {
       if (other.label != null)
       return false;
       } else if (!label.equals(other.label))
       return false;
       return true;
       }
      
       public int hashCode() {
       final int prime = 31;
       int result = 1;
       result = prime * result + ((value == null) ? 0 : value.hashCode());
       result = prime * result + ((label == null) ? 0 : label.hashCode());
       return result;
       }
      
       public SelectItem getAsSelectItem(){
       return new SelectItem(value, label);
       }
      
       public String getLabel() {
       return label;
       }
      
       public void setLabel(String label) {
       this.label = label;
       }
      
       public String getValue() {
       return value;
       }
      
       public void setValue(String value) {
       this.value = value;
       }
      }
      


      a part of the view:
       private List<ListShuttleObject> meetingAll = new ArrayList<ListShuttleObject>();
       private List<ListShuttleObject> meeting = new ArrayList<ListShuttleObject>();
       private List<ListShuttleObject> meetingSource = new ArrayList<ListShuttleObject>();
       private List<ListShuttleObject> meetingTarget = new ArrayList<ListShuttleObject>();


      the beanScope:
      <t:aliasBeansScope>
       <t:aliasBean alias="#{dialog}" value="meetingTypeSearch" />
       <t:aliasBean alias="#{reRender}" value="meeting_type"/>
       <t:aliasBean alias="#{sourceLabel}" value="#{trans.project_projectSearch_meeting_type}"/>
       <t:aliasBean alias="#{targetLabel}" value="#{trans.MeetingChosen}"/>
       <t:aliasBean alias="#{sourceValue}" value="#{projectSearchView.meetingAll}"/>
       <t:aliasBean alias="#{targetValue}" value="#{projectSearchView.meeting}"/>
       <t:aliasBean alias="#{sourceSelection}" value="#{projectSearchView.meetingSource}"/>
       <t:aliasBean alias="#{targetSelection}" value="#{projectSearchView.meetingTarget}"/>
       <t:aliasBean alias="#{converter}" value="#{projectSearchView.listConverter}"/>
       <f:subview id="meetingTypeSearchSubView">
       <jsp:include page="../popup/ajaxListShuttle.jsp" />
       </f:subview>
      </t:aliasBeansScope>
      


      and last but not least the jsp:
      <bis:modalDialog id="listShuttleModalDialog" dialogName="#{dialog}" height="300" width="500">
       <rich:listShuttle
       sourceSelection="#{sourceSelection}"
       targetSelection="#{targetSelection}"
       sourceValue="#{sourceValue}"
       targetValue="#{targetValue}"
       converter="#{converter}"
       var="items"
       sourceCaptionLabel="#{sourceLabel}"
       targetCaptionLabel="#{targetLabel}"
       id="listShuttel"
       orderControlsVisible="false"
       fastOrderControlsVisible="false">
       <rich:column>
       <h:outputText value="#{items.label}"></h:outputText>
       </rich:column>
       </rich:listShuttle>
       <h:panelGroup>
       <a4j:commandButton
       value="#{trans.personBtnSelect}"
       styleClass="btnSubmit"
       oncomplete="#{dialog}.hide();" reRender="#{reRender}" />
      
       <a4j:commandButton
       value="#{trans.popupSearchSaveBtnCancel}"
       styleClass="btnSubmit"
       oncomplete="#{dialog}.hide();"
       reRender="#{reRender}"/>
       </h:panelGroup>
      </bis:modalDialog>



      i would be pleased about some help