示例#1
0
  public MetricsAreaFragment getMetricsArea(String title) {
    ////// add property
    By selector =
        By.xpath(
            ".//table[contains(@class, '"
                + PropUtils.get("metrics.container.class")
                + "')][.//h3[text()='"
                + title
                + "']]");
    WebElement element = null;
    try {
      element = getContentRoot().findElement(selector);
    } catch (NoSuchElementException exc) {
      return null;
    }
    MetricsAreaFragment area = Graphene.createPageFragment(MetricsAreaFragment.class, element);

    Map<String, String> metricGrid =
        element
            .findElement(By.className(PropUtils.get("metrics.grid.class")))
            .findElements(By.tagName("tr"))
            .stream()
            .collect(
                Collectors.toMap(
                    e ->
                        e.findElement(By.className(PropUtils.get("metrics.grid.nominal.class")))
                            .getText(),
                    e ->
                        e.findElement(By.className(PropUtils.get("metrics.grid.numerical.class")))
                            .getText()));

    area.setMetricGrid(metricGrid);

    return area;
  }
  /**
   * Returns the ConfigArea portion of page as given implementation. Not reliable - you might need
   * to override this method.
   *
   * @param clazz
   * @param <T>
   * @return
   */
  public <T extends ConfigAreaFragment> T getConfig(Class<T> clazz) {
    By selector =
        getConfigSelector(); // TODO: replace with proper selector once there is a usable class
    WebElement configRoot = getContentRoot().findElement(selector);
    T config = Graphene.createPageFragment(clazz, configRoot);

    return config;
  }
  public ResourceTableFragment getResourceTable() {
    By selector = ByJQuery.selector(".default-cell-table[role='grid']:visible");
    WebElement tableRoot = getContentRoot().findElement(selector);
    ResourceTableFragment table =
        Graphene.createPageFragment(ResourceTableFragment.class, tableRoot);

    return table;
  }
 @Override
 public List<RECORD> getAllVisibleRecords() {
   List<RECORD> result = new ArrayList<RECORD>();
   for (WebElement recordRoot : recordsElements) {
     result.add(Graphene.createPageFragment(recordClass, recordRoot));
   }
   return result;
 }
 @Override
 public List<RECORD> getRecordsInRow(int rowIndex) {
   List<RECORD> result = new ArrayList<RECORD>();
   if (getNumberOfRows() - 1 > rowIndex) {
     throw new IllegalArgumentException(
         "There is not so many rows! Requesting: "
             + rowIndex
             + ", but there is only: "
             + getNumberOfRows());
   }
   List<WebElement> recordsInParticularRow =
       rowElements.get(rowIndex).findElements(ByJQuery.selector(JQUERY_SEL_RECORD));
   for (WebElement recordRoot : recordsInParticularRow) {
     result.add(Graphene.createPageFragment(recordClass, recordRoot));
   }
   return result;
 }
 public ResourceTableFragment getResourceTable() {
   return Graphene.createPageFragment(ResourceManager.class, root).getResourceTable();
 }
示例#7
0
 /** Creates a page fragment for menu group. */
 protected AbstractPopupMenu createSubMenuFragment(WebElement itemElement) {
   return Graphene.createPageFragment(getClass(), itemElement);
 }
  private AdvancedSelectBox getContextPicker(String label) {
    WebElement pickerRoot = getContextPickerRootByLabel(label);
    AdvancedSelectBox selectBox = Graphene.createPageFragment(AdvancedSelectBox.class, pickerRoot);

    return selectBox;
  }
 @Override
 public RECORD getRecord(int n) {
   return Graphene.createPageFragment(recordClass, recordsElements.get(n));
 }