コード例 #1
0
ファイル: CFMenuBar.java プロジェクト: SAFSDEV/Core
  /**
   * <em>Note:</em> Try to get The value of "text" property of a menuitem. Needed to be overrided
   * for other application than Swing. For example: For java, "text" is the text property. But for
   * .NET, "Text" is.
   *
   * @param menuObj A TestObject represents menu or menuItem.
   * @return The value of "text" property of a menuitem.
   */
  protected String getPropertyText(TestObject menuObject) {
    String debugmsg = getClass().getName() + ".getTextProperty() ";
    String text = "";

    try {
      text = (String) menuObject.getProperty(TEXT_PROPERTY);
    } catch (PropertyNotFoundException x) {
      Log.debug(
          debugmsg
              + x.getMessage()
              + ". Property "
              + TEXT_PROPERTY
              + " not found for"
              + menuObject.getObjectClassName());
    }

    return text;
  }
コード例 #2
0
ファイル: CFMenuBar.java プロジェクト: SAFSDEV/Core
  /**
   * @param menuObject
   * @return True if the menuObject is a popupMenu; False otherwise.
   * @throws SAFSException
   */
  protected boolean isPopupMenu(TestObject menuObject) throws SAFSException {
    String debugmsg = getClass().getName() + ".isPopupMenu() ";
    boolean isMenuBar = false;

    String ui = null;
    try {
      ui = (String) menuObject.getProperty(UITYPE_PROPERTY);
    } catch (PropertyNotFoundException x) {
      Log.debug(
          debugmsg
              + x.getMessage()
              + ". Property "
              + UITYPE_PROPERTY
              + " not found for"
              + menuObject.getObjectClassName());
      throw new SAFSException(
          "Property " + UITYPE_PROPERTY + " not found for" + menuObject.getObjectClassName());
    }

    isMenuBar = UITYPE_POPUPMENU.equalsIgnoreCase(ui);

    return isMenuBar;
  }
コード例 #3
0
ファイル: CFMenuBar.java プロジェクト: SAFSDEV/Core
  /**
   * <em>Note:</em> Needed to be override in subclass. "uIClassID" is a property specific for java
   * swing object, we use this property to test what UI Component it is. This can only work for
   * swing.
   *
   * @param menuObject A TestObject represents a MenuBar or PopupMenu or Menu or MenuItem
   * @return True if the TestObject is MenuBar or PopupMenu. False otherwise.
   * @throws SAFSException
   */
  protected boolean isMenuBar(TestObject menuObject) throws SAFSException {
    String debugmsg = getClass().getName() + ".isMenuBar() ";
    boolean isMenuBar = false;

    String ui = null;
    try {
      // Other non-Swing components may not have similar properties
      ui = (String) menuObject.getProperty(UITYPE_PROPERTY);
    } catch (PropertyNotFoundException x) {
      Log.debug(
          debugmsg
              + x.getMessage()
              + ". Property "
              + UITYPE_PROPERTY
              + " not found for"
              + menuObject.getObjectClassName());
      throw new SAFSException(
          "Property " + UITYPE_PROPERTY + " not found for" + menuObject.getObjectClassName());
    }

    isMenuBar = UITYPE_MENUBAR.equalsIgnoreCase(ui) || UITYPE_POPUPMENU.equalsIgnoreCase(ui);

    return isMenuBar;
  }