Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now MyPageTestUi test will pass and changes can be seen below:

2. Add tabs for this page

a. Modify the unit test

MyPageTestUi.java

Code Block
java
java

    public void testDisplay() {
        SiteTestHelper.assertNoException(tester);
        SiteTestHelper.assertNoUserError(tester);
        assertLinkPresent("link:first");
        assertLinkPresent("link:second");
    }

If we run this test again, it will fail:

[junit]  Test org.sipfoundry.sipxconfig.site.admin.mypackage.MyPageTestUi FAILED

.................................................

[concat] testcase: MyPageTestUi
[concat] junit.framework.AssertionFailedErrorjunit.framework.AssertionFailedError: Unable to find link with id [link:first]

b. Add the tabs

We will modify previously created files as follows:

MyPage.html

Code Block
xml
xml

<div jwcid="@common/Border" useDojo="true" borderTitle="ognl:borderTitle">
  <span jwcid="@common/TabNavigation" tabNames="ognl:{'first', 'second'}" selectedTab="ognl:tab"/>
  <div id="settings-content">
    <span jwcid="@common/ErrorMsg"/>
    <span jwcid="@RenderBlock" block="ognl:components.get(tab + 'Tab')"/>
  </div>
  <div jwcid="firstTab@Block">
    <span jwcid="@common/QuickHelp" value="message:quick.help.firstTab" />
    <form jwcid="firstForm@Form" id="firstForm">
      MY FIRST TAB
    </form>
  </div>
  <div jwcid="secondTab@Block">
    <span jwcid="@common/QuickHelp" value="message:quick.help.secondTab" />
    <form jwcid="secondForm@Form" id="secondForm">
      MY SECOND TAB
    </form>
  </div>
</div>

MyPage.properties

Code Block
xml
xml

title=My title page
tab.first=First tab
tab.second=Second tab
quick.help.firstTab=TBD 1
quick.help.secondTab=TBD 2

MyPage.java

Code Block
java
java

package org.sipfoundry.sipxconfig.site.admin.mypackage;

public abstract class MyPage extends SipxBasePage {

    @Bean
    public abstract SipxValidationDelegate getValidator();

    @Persist
    @InitialValue("literal:first")
    public abstract String getTab();

    public void pageBeginRender(PageEvent event) {
        if (!TapestryUtils.isValid(this)) {
            return;
        }
    }
}

Now MyPageTestUi test will pass and changes can be seen below: Image Added

II User portal