Ejemplo n.º 1
0
  // expand the folder to show folder's children
  public void zExpand(FolderItem folderItem) throws HarnessException {

    String locator = "css=td#zti__main_Contacts__" + folderItem.getId() + "_nodeCell" + ">div.";
    // already expanded or not have sub folders
    if (!sIsElementPresent(locator + Locators.COLLAPSE_NODE)) {
      return;
    }
    SleepUtil.sleepMedium();
    if (this.sIsElementPresent(locator + Locators.COLLAPSE_NODE)) {
      sMouseDown(locator + Locators.COLLAPSE_NODE);
    }
    zWaitForElementPresent(locator + Locators.EXPAND_NODE);
  }
Ejemplo n.º 2
0
  /* (non-Javadoc)
   * @see framework.ui.AbsTree#zTreeItem(framework.ui.Action, framework.items.FolderItem)
   */
  public AbsPage zTreeItem(Action action, IItem addressbook) throws HarnessException {
    tracer.trace("Click " + action + " on addressbook " + addressbook);

    // Validate the arguments
    if ((action == null) || (addressbook == null)) {
      throw new HarnessException("Must define an action and addressbook");
    }
    FolderItem folder = null;
    TagItem tag = null;
    if (!(addressbook instanceof FolderItem)) {
      tag = (TagItem) addressbook;
      // throw new HarnessException("Must use FolderItem as argument, but was "+
      // addressbook.getClass());
    } else {

      folder = (FolderItem) addressbook;
    }
    AbsPage page = null;
    String locator = null;

    if (action == Action.A_LEFTCLICK) {

      // choose target addressbook to move contact to (done for TouchPad)
      locator =
          "css=div[id^='ext-tagview'] div[id^='ext-simplelistitem'] div[id^='ext-element']:contains('"
              + tag.getName()
              + "')";
      page = null;
    } else if (action == Action.A_RIGHTCLICK) {

      locator = "id=zti__main_Contacts__" + folder.getId() + "_textCell";
      if (!this.sIsElementPresent(locator)) {
        throw new HarnessException("Unable to locator folder in tree " + locator);
      }

      this.zRightClickAt(locator, "");
      zWaitForBusyOverlay();

      return (null);

    } else {
      throw new HarnessException("Action " + action + " not yet implemented");
    }

    if (locator == null) {
      throw new HarnessException("no locator defined for action: " + action);
    }

    if (!this.sIsElementPresent(locator)) {
      throw new HarnessException("Unable to locator folder in tree " + locator);
    }

    // By default, left click at locator
    zClick(locator);
    zWaitForBusyOverlay();

    if (page != null) {
      page.zWaitForActive();
    }

    return (page);
  }
Ejemplo n.º 3
0
  protected AbsPage zTreeItem(Action action, Button option, FolderItem folderItem)
      throws HarnessException {

    AbsPage page = null;
    String actionLocator = null;
    String optionLocator = null;

    if ((action == null) || (option == null) || (folderItem == null)) {
      throw new HarnessException("Must define an action, option, and addressbook");
    }

    logger.info(
        myPageName() + " zTreeItem(" + action + ", " + option + "," + folderItem.getName() + ")");
    tracer.trace(action + " then " + option + " on Folder Item = " + folderItem.getName());

    if (folderItem.getName().equals("USER_ROOT")) {
      actionLocator = "css=div#ztih__main_Contacts__ADDRBOOK_div";
    } else {
      actionLocator = "css=div#zti__main_Contacts__" + folderItem.getId() + "_div";
    }

    if (action == Action.A_RIGHTCLICK) {

      if (option == Button.B_TREE_NEWFOLDER) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='NEW_ADDRBOOK'] td[id$='_title']";
        page =
            new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_DELETE) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='DELETE_WITHOUT_SHORTCUT'] td[id$='_title']";
        page = null;

      } else if (option == Button.B_RENAME) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='RENAME_FOLDER'] td[id$='_title']";
        page =
            new DialogRenameFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_TREE_EDIT) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EDIT_PROPS'] td[id$='_title']";
        page =
            new DialogEditFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_TREE_FOLDER_EMPTY) {

        optionLocator =
            "css=div[id^='ZmActionMenu_contacts_ADDRBOOK'] div[id^='EMPTY_FOLDER'] td[id$='_title']";
        page =
            new DialogWarning(
                DialogWarning.DialogWarningID.EmptyFolderWarningMessage,
                MyApplication,
                ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else if (option == Button.B_SHARE) {

        optionLocator =
            "css=div[id='ZmActionMenu_contacts_ADDRBOOK'] div[id='SHARE_ADDRBOOK'] td[id$='_title']";
        page = new DialogShare(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else {
        throw new HarnessException("implement action:" + action + " option:" + option);
      }

      if (actionLocator != null) {

        zRightClickAt(actionLocator, "0,0");
        zWaitForBusyOverlay();
      }

      if (optionLocator != null) {

        zClickAt(optionLocator, "0,0");
        zWaitForBusyOverlay();
      }

      if (page != null) {
        page.zWaitForActive();
      }

      return page;

    } else if (action == Action.A_LEFTCLICK) {

      if (option == Button.B_TREE_NEWFOLDER) {

        zClickAt("css=div[class^=ImgNewContactsFolder][class*=ZWidget]", "0,0");
        page =
            new DialogCreateFolder(MyApplication, ((AppAjaxClient) MyApplication).zPageAddressbook);

      } else {
        throw new HarnessException("implement action:" + action + " option:" + option);
      }

    } else {
      throw new HarnessException("implement action:" + action + " option:" + option);
    }

    if (page != null) {
      page.zWaitForActive();
    }

    return page;
  }