--- On Fri, 1/14/11, Michael Sharp <[email protected]> wrote:


> I do use TabbedPanel in an AMD so
> I'll try.
> 
> Any errors in eclipse console or javascript errors in the
> browser?

No errors

WOD and java for AMD

EditUserModalDialog : AjaxModalDialog {
        id = "editUserDialog";
        showOpener = false;
        locked = true;
        slideDownDuration = "0.2";
        slideUpDuration = "0.2";
        action = editUserMeta;
        onClose = refreshUserList;
        closeUpdateContainerID ="tableBody";
        transitions=true;
}

AMD is called from an opener:

EditUserOpener: AjaxModalDialogOpener {
        label = current.fullNameString; 
        dialogId = "editUserDialog";
        action = selectUserToEdit;
        title = EditUserMDTitle;
}

public WOActionResults editUserMeta() {
        TWTUser_EditMetaComponent nextPage = 
(TWTUser_EditMetaComponent)pageWithName(TWTUser_EditMetaComponent.class.getName());
        nextPage.setTheUser(aUserToEdit);
                
        return nextPage;
}


> 
> Is it a problem with Tab2 or with any tab after the initial
> tab is displayed. If you give Tab2 the binding of
> "isSelected = true;" does it display the correct behaviour?
> 
> > the tabpanel is on an AjaxModalDialog, when I create
> the modal dialog, I pass in a user object. user has a to one
> relationship with securitySettings.
> 
> So when you say pass in an object, you mean supplied as a
> binding to the component where the AMD is declared?
> 
> I can't reproduce the problem, maybe the contents of your
> .wod for TabbedPanel, Tab1 & Tab2 might help..

Here is all the code:


<style>
  .ajaxTabbedPanel {
    width: auto;
    border-bottom: 1px solid #c0c0c0;
    padding: 10px 0 0 20px;
  }

  .ajaxTabbedPanelTab-selected {
    display: inline;
    padding: 3px 7px 1px 7px;
    background: #ffffff;
    border: 1px solid #c0c0c0;
    border-bottom: 0;
  }

  .ajaxTabbedPanelTab-unselected {
    display: inline;
    padding: 2px 7px 0 7px;
    background: #f0f0f0;
    border: 1px solid #c0c0c0;
    border-bottom: 0;
    color: #c0c0c0;
  }

  .ajaxTabbedPanelTab-selected a {
    font-weight: bold;
    font-size: 12pt;
    color: #0066CC;
    padding: 6px;
  }

  .ajaxTabbedPanelTab-unselected a {
    font-size: 10pt;
    padding: 6px;
    color: #a0a0a0;
  }

  .ajaxTabbedPanelPanes {
    width:97%;
    padding-left: 0px;
    margin: 2%;
    min-height: 300px;
    overflow: auto;
  }

  .ajaxTabbedPanelPane-selected {
    list-style-type: none;
    display: block;
    padding: 10px;
  }

  .ajaxTabbedPanelPane-unselected {
    list-style-type: none;
    display: none;
  }

  .tabBox {
    border: 1px solid #c0c0c0;
    height: 400px;
    width: 620px;
    overflow: auto;
  }
  
  tr.meta1 {
  height:30px
  }
</style>
<wo:WOForm multipleSubmit = true>
  <div class = "tabBox">
    <webObject name = "TabbedPanel">
      <webObject name = "Tab1">
        <table class = "tableDefs" width = "550">
          <tr class = "meta1">
            <td width = "110">First Name</td>
            <td><wo:WOTextField value = "$theUser.firstName" size = "65" /></td>
          </tr>
           <tr class = "meta1">
            <td width="35%">Last Name</td>
            <td><wo:WOTextField value = "$theUser.lastName" size = "65" /></td>
          </tr>
           <tr class = "meta1">
            <td>Title</td>
            <td><webobject name = "EmployeeTitlePopUp" /></td>
          </tr>
        </table>
      
      </webObject>
      <webObject name = "Tab2">

<table width = "250">
          <tr>
            <td>
              <div>Sees Employee Management: 
                <wo:WOCheckBox checked = 
"$theSecuritySettings.seesUserManagement" />
                <br />
                <br />
                Sees Client Management: 
                <wo:WOCheckBox checked = 
"$theSecuritySettings.seesClientManagement" />
                <br />
                <br />
                Sees Settings Management: 
                <wo:WOCheckBox checked = 
"$theUser.securitySettings.seesSettingsManagement" />
                <br />
                <br />
                Sees Work Management: 
                <wo:WOCheckBox checked = 
"$theUser.securitySettings.seesWorkManagement" />
                <br />
                <br />
                Sees Billing Management: 
                <wo:WOCheckBox checked = 
"$theUser.securitySettings.seesBillingManagement" />
                <br />
                <br />
                Sees Time Management: 
                <wo:WOCheckBox disabled = application.noTimeTracking checked = 
"$theUser.securitySettings.seesTimeManagement" />
                <br />
                <br />
                Sees Task Management: 
                <wo:WOCheckBox disabled = application.noTimeTracking checked = 
"$theUser.securitySettings.seesTaskManagement" />
              </div>
              <br />
            </td>
          </tr>
        </table>

 </webObject>
    </webObject>
  </div>
  <br />
  <wo:AjaxSubmitButton action = "$save" value = "Save" /><wo:AjaxSubmitButton 
action = "$cancelEdits" value = "Cancel" />
</wo:WOForm>
<div id = "busydiv" style = "display: none;"> <webobject name = "BusyImage" /> 
Loading... </div>
<p style = "width: 600px;"> </p>

WOD


TabbedPanel: AjaxTabbedPanel {
        id = "tabbedPanel";
        busyDiv = "busydiv";
}

Tab1: AjaxTabbedPanelTab {
        id = "tab1";
        name = "Employee";
        isSelected = true;
}

Tab2: AjaxTabbedPanelTab {
        name = "Menus";
        refreshOnSelect=true;
        
}

BusyImage : WOImage {
  framework = "Ajax";
  filename = "wait30.gif";
}

EmployeeTitlePopUp : WOPopUpButton {
        list = eTitleList;
        selection = theUser.employeeTitle;
        displayString = theUser.employeeTitle.eTitleTitle;
        item = theUser.employeeTitle;
        
}

JAVA

package com.eltek.components;

import com.eltek.model.EmployeeTitle;
import com.eltek.model.SecuritySettings;
import com.eltek.model.User;
import com.webobjects.appserver.WOContext;
import com.webobjects.appserver.WOResponse;

import er.ajax.AjaxModalDialog;
import er.extensions.components.ERXComponent;
import com.webobjects.appserver.WOActionResults;
import com.webobjects.eoaccess.EOGeneralAdaptorException;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSLog;
import com.webobjects.foundation.NSValidation.ValidationException;

public class EditUserMeta extends ERXComponent {
    public String formValueA;
        public String formValueB;
        public String formValueC;
        private User theUser;
        public NSArray<EmployeeTitle> eTitleList;
        private SecuritySettings theSecuritySettings;


        public EditUserMeta(WOContext context) {
        super(context);
    }

        public void appendToResponse(WOResponse response, WOContext context) {

        eTitleList = 
EmployeeTitle.fetchEmployeeTitles(theUser().editingContext(), 
EmployeeTitle.IS_ACTIVE.eq(true), EmployeeTitle.E_TITLE_TITLE.ascs());

        super.appendToResponse(response, context);
        }
        
        public WOActionResults save() {
                
                try {
                        theUser().editingContext().saveChanges();
                } catch (ValidationException e) {
                        NSLog.out.appendln("ValidationException e = " + 
e.getMessage());

                } catch (EOGeneralAdaptorException e) {
                        NSLog.out.appendln("EOGeneralAdaptorException e = "
                                        + e.getMessage());
                }
                
                theUser().editingContext().revert();

                AjaxModalDialog.close(context());
                return null;
        }

        public void setTheUser(User theUser) {
                this.theUser = theUser;
                
                //experiment with new accessor for the security settings
                
                this.setTheSecuritySettings(theUser.securitySettings());
        }

        public User theUser() {
                return theUser;
        }

        public WOActionResults cancelEdits() {
                
                theUser().editingContext().revert();

                AjaxModalDialog.close(context());
                return null;
        }

        public void setTheSecuritySettings(SecuritySettings 
theSecuritySettings) {
                this.theSecuritySettings = theSecuritySettings;
        }

        public SecuritySettings theSecuritySettings() {
                return theSecuritySettings;
        }
}


> 
> Sharpy..
> 
> > 
> > on panel one, I am displaying and editing user
> metadata. on panel two, I want to edit some security
> settings.
> > 
> > if i put on tab one:
> > see user area <wo:WOCheckBox checked =
> "$theUser.securitySettings.seesUserManagement" />
> > 
> > I get the checkbox with this user seesUserManagement
> setting.
> > 
> > However, if this same code is on tab two, there is no
> connection to the object.
> > 
> > 
> > <wo:WOForm multipleSubmit = true;>
> >  <div class = "tabBox">
> >    <webObject name = "TabbedPanel">
> >      <webObject name = "Tab1">
> >        <table class =
> "tableDefs" width = "550">
> >          <tr class =
> "meta1">
> >            <td width
> = "110">First Name</td>
> >           
> <td><wo:WOTextField value = "$theUser.firstName"
> size = "65" /></td>
> >          </tr>
> > 
> >        </table>
> > <br/><br/>
> > 
> > see user area <wo:WOCheckBox checked =
> "$theUser.securitySettings.seesUserManagement" />
> > 
> > </webObject  name = "Tab1">
> > 
> > <webObject name = "Tab2">
> > 
> > <wo:WOCheckBox checked =
> "$theUser.securitySettings.seesUserManagement" />
> > 
> > </webObject name = "Tab2">
> > </webObject name = "TabbedPanel">
> > </div>      
> > <wo:AjaxSubmitButton action = "$cancelEdits" value
> = "Cancel" /><wo:AjaxSubmitButton action = "$save"
> value = "Save" />
> > </wo:WOForm>
> > 
> > 
> > why doesn't tab2 connect to
> "$theUser.securitySettings.seesUserManagement" 
> > 
> > on tab1 the checkbox is checked (correct) however on
> tab2 no check.
> > 
> > I don't even know if I am explaining this clearly
> enough.
> > 
> > Help, please.
> > 
> > Ted
> > 
> > 
> > 
> > 
> > _______________________________________________
>

Any help would be appreciated


Ted





 _______________________________________________
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]

Reply via email to