As AjaxTabbedPanelTab is stateless (dynamic element) you should help him
maintain its selected state by binding isSelected to a settable variable.
If you do not, it will appears selected on the client view, but will not be
considered selected on the server side and thus may not takeValuesFromRequest
when submitting your form, see AjaxTabbedPanelTab source :
/**
* Do nothing if not visible.
*/
public void takeValuesFromRequest(WORequest request, WOContext context)
{
if (isVisble(context.component()) && (isSelected == null ||
isSelected(context.component())) ) {
super.takeChildrenValuesFromRequest(request, context);
}
}
Cheers,
Alex
Le 17 janv. 2011 à 21:59, Chuck Hill a écrit :
>
> On Jan 17, 2011, at 12:52 PM, Theodore Petrosky wrote:
>
>> Chuck,
>>
>> Now that it is working, I want to know a little more. You suggested:
>>
>>>>>
>>>>> theUser() should get called again when you select
>>> another tab. Try logging this.theUser from that
>>
>> I don't understand what gets called when I select another tab.
>
> The bindings for that tab will be evaluated. I was suggesting that you have
>
> public User theUser() {
> System.out.println("Returning user " + theUser);
> return theUser;
> }
>
> To see if it was returning a null user.
>
>
> Chuck
>
>> I choose to try the isSelected binding as I was reading:
>>
>> isSelected optional, boolean true if this tab is initially selected when
>> the page is first rendered, defaults to false. If present and can be set, is
>> set to true when this tab is selected and to false when it is no longer the
>> selected tab
>>
>> For me this falls under the heading of learning more about webobjects. If I
>> can understand what you are suggesting here perhaps I can actually learn
>> something.
>>
>> Ted
>>
>>
>>
>>> I confess to having no idea why that
>>> made it work. This is not what I was suggesting, but
>>> if it works...
>>>
>>> Chuck
>>>
>>>
>>> On Jan 16, 2011, at 3:47 PM, Theodore Petrosky wrote:
>>>
>>>> ok here is what I did to get it to work.
>>>>
>>>> in the WOD I added a isSelected binding:
>>>>
>>>> Tab2: AjaxTabbedPanelTab {
>>>> id="Tab2";
>>>> name = "Menus";
>>>> isSelected = Tab2Selected;
>>>> }
>>>>
>>>>
>>>> and in the Java:
>>>>
>>>>
>>>> public boolean Tab2Selected() {
>>>> return tab2Selected;
>>>> }
>>>>
>>>> /**
>>>> * @param tab2Selected the tab2Selected to set
>>>> */
>>>> public void setTab2Selected(boolean tab2Selected) {
>>>> NSLog.out.appendln("setTab2Selected
>>> = " + tab2Selected);
>>>>
>>>> this.tab2Selected = tab2Selected;
>>>> }
>>>>
>>>> That's all I did and it is working as expected.
>>>>
>>>> I don't know if that is what you were suggesting. But
>>> it works.
>>>>
>>>> Ted
>>>>
>>>>
>>>>
>>>> --- On Sun, 1/16/11, Chuck Hill <[email protected]>
>>> wrote:
>>>>
>>>>> From: Chuck Hill <[email protected]>
>>>>> Subject: Re: AjaxTabbedPanel ??? V2
>>>>> To: "Theodore Petrosky" <[email protected]>
>>>>> Cc: "[email protected]
>>> List List" <[email protected]>
>>>>> Date: Sunday, January 16, 2011, 4:39 PM
>>>>>
>>>>> On Jan 16, 2011, at 12:58 PM, Theodore Petrosky
>>> wrote:
>>>>>
>>>>>> yes if I make Tab2 the default tab then the
>>> problem
>>>>> reverses.
>>>>>
>>>>> Then the problem is in your code and use of
>>> bindings, not
>>>>> the tabbed panel.
>>>>>
>>>>>
>>>>>> here is the code that is called to pass the
>>> User into
>>>>> the AMD
>>>>>>
>>>>>>
>>>>>> public WOActionResults editUserMeta() {
>>>>>>
>>>>>> EditUserMeta nextPage
>>> =
>>>>>
>>> (EditUserMeta)pageWithName(EditUserMeta.class.getName());
>>>>>>
>>> nextPage.setTheUser(aUserToEdit);
>>>>>>
>>>>>> return nextPage;
>>>>>> }
>>>>>>
>>>>>> in EditUserMeta.java I have:
>>>>>>
>>>>>> public void setTheUser(User theUser) {
>>>>>> this.theUser =
>>> theUser;
>>>>>>
>>>>>
>>>>>>
>>> NSLog.out.appendln("theUser = "
>>>>> +
>>> theUser.valueForKey("fullNameString"));
>>>>>>
>>> NSLog.out.appendln("theUser
>>>>> seesUserManagement = " +
>>>>>
>>> theUser.securitySettings().seesClientManagement());
>>>>>>
>>>>>> }
>>>>>>
>>>>>> When I access the AMD here is my log info:
>>>>>>
>>>>>> Jan 16 13:12:40 TheWorkTracker[50828] INFO
>>>>> NSLog - theUser = Admin
>>>>>> Jan 16 13:12:40 TheWorkTracker[50828] INFO
>>>>> NSLog - theUser seesUserManagement = true
>>>>>>
>>>>>> Interesting that
>>>>> theUser.securitySettings().seesClientManagement()
>>> is true
>>>>> however the checkbox never is set.
>>>>>
>>>>> theUser() should get called again when you select
>>> another
>>>>> tab. Try logging this.theUser from that
>>
>>
>>
>>
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall
> knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/products/practical_webobjects
>
>
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]