myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Reifenstuel <oel...@web.de>
Subject Re: [Tobago] a listbox in a popup
Date Thu, 22 May 2008 14:33:51 GMT
Hi Volker, hi Helmut;

thanks a lot. Now I'm using a converter, it's really easy.

I solved my problem now without a popup, it is not the best way but it 
works. :-)

Regards,
Tobi

Volker Weber schrieb:
> Hi Tobias,
>
> you need a converter to convert the selected value (which is a string
> at postback time) back into a Autor object.
> Also the selectedAuthor should be type Author, not SelectItem.
>
> As an alternative you can make the selectedAuthor of type String and
> create the selectItems from author.toString().
> Then you don't need a converter, but got loose of the Author object as value.
>
>
> Regards,
>     Volker
>
> 2008/5/21 Tobias Reifenstuel <oeler1@web.de>:
>   
>> Hi Volker,
>>
>> thanks for the fast reply. I don't have any Author-Converter. I didn't know
>> that I have to use them. I just added to my author a method whitch is called
>> "toString" and is what the listbox is showing me.
>>
>> Regards,
>> Tobi
>>
>> Volker Weber schrieb:
>>     
>>> Hi Tobias,
>>>
>>> i think this error message is because of a conversionError in the
>>> selectOneListbox.
>>>
>>> Could you post the code for the Author-Converter?
>>>
>>>
>>> Regards,
>>>    Volker
>>>
>>> 2008/5/19 Tobias Reifenstuel <oeler1@web.de>:
>>>
>>>       
>>>> Hi Helmut, hi All,
>>>>
>>>> thanks a lot for your help, but it still doesn't work. The syntax for the
>>>> action listener method was right. I changed the binding to action, as you
>>>> suggested, and now I get the following log message:
>>>>
>>>> 2008-05-19 15:29:19 ERROR -
>>>> org.apache.myfaces.tobago.context.ResourceManagerImpl:265 - Path not
>>>> found,
>>>> and no fallback. Using empty string.
>>>> resourceDirs = '[tobago-resource, org/apache/myfaces/tobago/renderkit]'
>>>> contentType = 'html' theme = 'speyside' browser = 'mozilla_5_0' subDir =
>>>> 'property' name = 'tobago' suffix = '' key =
>>>> 'javax.faces.component.UISelectOne.INVALID
>>>>
>>>> But i don't know why. Maybe there is something wrong with my backing
>>>> bean:
>>>>
>>>>  private ArrayList<SelectItem> authors;
>>>>    private SelectItem selectedAuthor;
>>>>  ...
>>>>      public void onNew() {
>>>>      LOG.info("authors size: " + authors.size());
>>>>      Author author = new Author();
>>>>      author.setForename("Forename");
>>>>      author.setMiddleName("MiddleName");
>>>>      author.setSurname("Surename");
>>>>      authors.add(new SelectItem(author));
>>>>      LOG.info("authors size: " + authors.size());
>>>>  }
>>>>
>>>> ...
>>>>
>>>> all getter and setter methods are set.
>>>>
>>>> Thanks for any help.
>>>> Tobi
>>>>
>>>> Helmut Swaczinna schrieb:
>>>>
>>>>         
>>>>> Hi Tobi,
>>>>>
>>>>> I think it should work with an ActionListener but I prefer to use
>>>>> Actions
>>>>> for buttons. In this case returning
>>>>> null or void. One reason for not calling the ActionListener may be a
>>>>> wrong
>>>>> method signature. Must be
>>>>> public void onNew(ActionEvent e).
>>>>>
>>>>> Case 4: The id in the renderedPartially attribute is wrong. First, the
>>>>> box
>>>>> is not a naming container, so it is not
>>>>> part of the id, and second, the listbox is not an Ajax component
>>>>> (afaik),
>>>>> so it must be enclosed in a panel or just
>>>>> the box you already have.
>>>>>
>>>>> Hope that helps
>>>>> Helmut
>>>>>
>>>>> ----- Original Message ----- From: "Tobias Reifenstuel" <oeler1@web.de>
>>>>> To: "MyFaces Discussion" <users@myfaces.apache.org>
>>>>> Sent: Sunday, May 18, 2008 12:55 PM
>>>>> Subject: Re: [Tobago] a listbox in a popup
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> Hi Helmut,
>>>>>>
>>>>>> thanks for the fast answer. I tried your suggestion, but it still
>>>>>> doesn't
>>>>>> work. Here are my further tries:
>>>>>>
>>>>>> Case 3 (see code from the first mail except the part wiht the "Add"
>>>>>> button)
>>>>>> I changed this part of the code:
>>>>>>
>>>>>> <tc:attribute name="renderedPartially" value=":page:popup:box"
/>
>>>>>>
>>>>>> The box seems to be reloaded (for a second I can see the scrollbar),
>>>>>> but
>>>>>> without the new value should be added over the onNew method
>>>>>> (ActionListener).
>>>>>> If I look into my logs the method is never called, but why? It is
only
>>>>>> called if I drop the renderedPartially attribute.
>>>>>>
>>>>>>
>>>>>> Case 4
>>>>>> <tc:attribute name="renderedPartially" value=":page:popup:box:listbox"
>>>>>> />
>>>>>> Here the popup doesn't even show up.
>>>>>>
>>>>>> By the way I am using Tobago 1.0.16
>>>>>>
>>>>>>
>>>>>> Thanks for any help.
>>>>>> Tobi
>>>>>>
>>>>>>
>>>>>> Helmut Swaczinna schrieb:
>>>>>>
>>>>>>             
>>>>>>> Hi,
>>>>>>>
>>>>>>> you should render partially the box or panel inside the popup
not the
>>>>>>> popup itself when the App button is clicked.
>>>>>>>
>>>>>>> Helmut
>>>>>>>
>>>>>>> ----- Original Message ----- From: "Tobias Reifenstuel"
>>>>>>> <oeler1@web.de>
>>>>>>> To: <users@myfaces.apache.org>
>>>>>>> Sent: Friday, May 16, 2008 5:03 PM
>>>>>>> Subject: [Tobago] a listbox in a popup
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I have a problem with building a popup with a listbox.
>>>>>>>>
>>>>>>>> Case 1 (see code below):
>>>>>>>> If  I click on the "Add" button the popup will be partially
rendered,
>>>>>>>> but without the new entry inside the listbox. The new entry
should be
>>>>>>>> added
>>>>>>>> by the actionListener.
>>>>>>>>
>>>>>>>> Case 2 (also code below, but without the attribute tag inside
the
>>>>>>>> "Add"
>>>>>>>> button tags):
>>>>>>>> If I drop the tag <tc:attribute name="renderedPartially"
>>>>>>>> value=":page:popup" /> within the "Add" button tags, the
popup
>>>>>>>> disappears
>>>>>>>> after clicking on the button "Add". I can open it again and
the new
>>>>>>>> entry is
>>>>>>>> available, but this is not very user-friendly.
>>>>>>>>
>>>>>>>> For me it seems that the combination of actionListener and
>>>>>>>> renderedPartially doesn't work.
>>>>>>>>
>>>>>>>> <tc:popup id="popup" width="300px" height="200px" >
>>>>>>>>              <tc:box id="box" label="Author input">
>>>>>>>>                  <f:facet name="layout">
>>>>>>>>                      <tc:gridLayout rows="*;50px"/>
>>>>>>>>                  </f:facet>
>>>>>>>>
>>>>>>>>                  <tc:selectOneListbox id="listbox"
>>>>>>>>                      value="#{author.selectedAuthor}">
>>>>>>>>                      <f:selectItems value="#{author.authors}"
/>
>>>>>>>>                  </tc:selectOneListbox>
>>>>>>>>
>>>>>>>>                 <tc:panel id="buttons">
>>>>>>>>                      <f:facet name="layout">
>>>>>>>>                          <tc:gridLayout columns="*;*;*"
/>
>>>>>>>>                      </f:facet>
>>>>>>>>                     <tc:button actionListener="#{author.onNew}"
>>>>>>>> label="Add">
>>>>>>>>                          <tc:attribute name="renderedPartially"
>>>>>>>> value=":page:popup" />
>>>>>>>>                      </tc:button>
>>>>>>>>
>>>>>>>>
>>>>>>>>                      <tc:button label="Ok">
>>>>>>>>                          <tc:attribute name="popupClose"
>>>>>>>> value="afterSubmit" />
>>>>>>>>                          <tc:attribute name="renderedPartially"
>>>>>>>> value=":page:popup" />
>>>>>>>>                      </tc:button>
>>>>>>>>
>>>>>>>>                      <tc:button label="Cancel">
>>>>>>>>                          <tc:attribute name="popupClose"
>>>>>>>> value="immediate" />
>>>>>>>>                      </tc:button>
>>>>>>>>                      <tc:cell />
>>>>>>>>                  </tc:panel>
>>>>>>>>
>>>>>>>>              </tc:box>
>>>>>>>> </tc:popup>
>>>>>>>>
>>>>>>>> Thanks for any helping.
>>>>>>>> Tobi
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>           
>>>
>>>
>>>       
>
>
>
>   

Mime
View raw message