0 Replies Latest reply on May 13, 2011 4:06 AM by azur666

    Error when reRender listShuttle

    azur666 Newbie

      Hi!!

      I have a problem with the component listShuttle I hope someone can solve.

       

      I turn to for help with my problem.


       

      My source code is:

       

      ExportarAzu.java

       

      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import static org.jboss.seam.ScopeType.CONVERSATION;
      
      
      
      
      import java.util.List;
      import java.util.ArrayList;
      
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      
      
      
      
      @Stateful
      @Scope(CONVERSATION)
      @Name("exportarAzu")
      public class ExportarAzu implements ExportarAzuInterface {
      
      
          private String mnemonic = "Name";
          private String deviceAddress = "InternalIpAddress";
          private String deviceType = "Model";
          private String accessAddress = "AccessIpAddress";
          private String SNMPCommunity = "SnmpCommunity";
          private String userFTPName = "FtpUser";
          private String userFTPPassword = "FtpKey";
          private String category1 = "Category1";
          private String category2 = "Cat  2";       //Cat+space+space+2
          private String user1 = "User1";
          private String user2 = "User2";
      
      
      
      
         private List<String>availableProperties;
         private List<String>selectedProperties;
      
      
      
      
      
      
         public void setAvailableProperties(List<String> l)
          {
                availableProperties = l;
          }
      
      
          public List<String> getAvailableProperties()
          {
      
      
                if (availableProperties == null)
                {
                      availableProperties = new ArrayList<String>();
                      availableProperties.add(accessAddress);
                      availableProperties.add(SNMPCommunity);
                      availableProperties.add(userFTPName);
                      availableProperties.add(userFTPPassword);
                      availableProperties.add(category1);
                      availableProperties.add(category2);
                      availableProperties.add(user1);
                      availableProperties.add(user2);
      
      
                }
                return availableProperties;
          }
      
      
          public void setSelectedProperties(List<String>l)
          {
                selectedProperties = l;
          }
      
      
          public List<String> getSelectedProperties()
          {
                if (selectedProperties == null)
                {
                      selectedProperties = new ArrayList<String>();
                      selectedProperties.add(mnemonic);
                      selectedProperties.add(deviceAddress);
                      selectedProperties.add(deviceType);
                }
                if(availableProperties != null)
                {
                          if (availableProperties.contains(mnemonic))
                          {
                                int index = availableProperties.indexOf(mnemonic);
                                selectedProperties.add(0, availableProperties.get(index));
                                availableProperties.remove(index);
                          }
                          if (availableProperties.contains(deviceAddress))
                          {
                                int index = availableProperties.indexOf(deviceAddress);
                                selectedProperties.add(1, availableProperties.get(index));
                                availableProperties.remove(index);
                          }
                          if (availableProperties.contains(deviceType))
                          {
                                int index = availableProperties.indexOf(deviceType);
                                selectedProperties.add(2, availableProperties.get(index));
                                availableProperties.remove(index);
                          }
                }
      
      
                return selectedProperties;
          }
      
      
                @Remove
                public void destroy(){}
       }
      
      

       

      ExportarAzuInterface.java

       

       

      import java.util.List;
      
      
      import javax.ejb.Remove;
      
      
      public interface ExportarAzuInterface {
      
                public void setAvailableProperties(List<String> l);
      
      
          public List<String> getAvailableProperties();
      
      
          public void setSelectedProperties(List<String>l);
      
      
          public List<String> getSelectedProperties();
      
      
                public void destroy();
      }
      
      

       

      ExportarAzu.xhtml

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                                                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:rich="http://richfaces.org/rich"
                      template="layout/template.xhtml"
          xmlns:c="http://java.sun.com/jstl/core">
      <ui:define name="body">
          <h:form styleClass="main">
      
      
      
                    <a4j:region>
      
                               <rich:messages>
      
                                          <f:facet name="errorMarker">
      
                                                  <h:graphicImage value="/img/error.gif" />   
      
                                          </f:facet>
      
                                  </rich:messages>
      
                                  <rich:toolBar id="toolBar" itemSeparator="line" height="28px">
                                      <c:forEach items="#{exportarAzu.selectedProperties}" var="item">
                                          <h:panelGroup>
                                              <h:outputLink value="#" style="color:#{a4jSkin.generalTextColor}; text-decoration:none;" >
                                                  <h:outputText value="#{item}" />
                                              </h:outputLink>
                                          </h:panelGroup>
                                      </c:forEach>
                                  </rich:toolBar>
                                  <rich:spacer height="20" />
      
                                  <rich:listShuttle sourceValue="#{exportarAzu.availableProperties}"
                                                                      targetValue="#{exportarAzu.selectedProperties}" 
                                                                                                   var="items" listsHeight="150"
                                                                                                   id ="listas"
                                      sourceListWidth="130" targetListWidth="130" sourceCaptionLabel="Available Items"
                                      targetCaptionLabel="Currently Active Items"> 
      
                                      <rich:column>
                                          <h:outputText value="#{items}"></h:outputText>
                                      </rich:column>
                                           <a4j:support             event="onlistchanged"
                                                                                                   reRender="toolBar, listas"
                                                                                                     status="status"
                                                                                                      queue="exportCardsQueue"
                                                                             ignoreDupResponses="true"/>
                                  </rich:listShuttle>
      
                          </a4j:region>
                </h:form>
          <h:form styleClass="innerForm">
              <h:panelGrid columns="2" styleClass="panelModalPanel" columnClasses="columnLeftModalPanel, columnRightModalPanel">
                        <s:button id="cancel"
                                                                                      value="${messages.actionDone}"
                                                                     styleClass="boton"
                                                                              view="/FichasList.xhtml"
                                                                    onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'" 
                                                                     onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"/>
                                    </h:panelGrid>
      
      
          </h:form>
       </ui:define>
      </ui:composition>
      
      

       

      ExportarAzu.page.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      
      <page xmlns="http://jboss.com/products/seam/pages"
      
      
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
      
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
      
      
            login-required="true">
      
                <begin-conversation join="true"/>
      
      
      
      
      
      
      </page>
      
      

       

       

      error.PNG

       

      The problem occurs when setting, for example, Category2=”Cat  2 “(Cat+ two spaces+ 2). When there are two spaces or more in any field I have the following error when I select any data from the list for a second time.

       

                                                              j_id288:listas: Validation Error: Value Cat 2 is not valid

       

      The problem is when   reRender="toolbar,listas", in particular when reRender==>"listas"

       

      If  reRender="toolbar", nothing happens, only happens when reRender="listas" (the listShuttle), and I need to repaint listShuttle


       

       

       

      After this, the listShutlle is not working well.

       

       

      Please, help me.

      Thank you very much.

       

       

       

      Nobody can help me??????

      I don't  find the error.

       

      El mensaje fue editado por: Azur g.