当前位置: 首页>>代码示例>>Java>>正文


Java DIV.table方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV.table方法的典型用法代码示例。如果您正苦于以下问题:Java DIV.table方法的具体用法?Java DIV.table怎么用?Java DIV.table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV的用法示例。


在下文中一共展示了DIV.table方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateRoleDetails

import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV; //导入方法依赖的package包/类
/**
 * Given a div, a name for this data, and some pairs of data, generate a nice HTML table. If contents is empty (of size zero), then a mesage will be printed
 * that there were no items instead of an empty table.
 * 
 * @param div
 * @param detailsName
 * @param contents
 */
protected <T1 extends TableContent,T2> void generateRoleDetails(DIV<Hamlet> parent, String divSelector, String detailsName, Iterable<Entry<T1,T2>> contents) {
  final DIV<DIV<Hamlet>> div = parent.div(divSelector).h3(BOLD, detailsName);

  int offset = 0;
  TABLE<DIV<DIV<Hamlet>>> table = null;
  TBODY<TABLE<DIV<DIV<Hamlet>>>> tbody = null;
  for (Entry<T1,T2> content : contents) {
    if (null == table) {
      table = div.table("ui-widget-content ui-corner-bottom");
      tbody = table.tbody();
    }
    
    TR<TBODY<TABLE<DIV<DIV<Hamlet>>>>> row = tbody.tr(offset % 2 == 0 ? EVEN : ODD);
    
    // Defer to the implementation of the TableContent for what the cell should contain
    content.getKey().printCell(row);

    // Only add the second column if the element is non-null
    // This also lets us avoid making a second method if we're only making a one-column table
    if (null != content.getValue()) {
      row.td(content.getValue().toString());
    }

    row._();

    offset++;
  }

  // If we made a table, close it out
  if (null != table) {
    tbody._()._();
  } else {
    // Otherwise, throw in a nice "no content" message
    div.p("no-table-contents")._("None")._();
  }
  
  // Close out the initial div
  div._();
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:48,代码来源:ContainerStatsBlock.java

示例2: doIndex

import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV; //导入方法依赖的package包/类
@VisibleForTesting
protected void doIndex(Hamlet html, String providerName) {
  ClusterDescription clusterStatus = appView.getClusterStatus();
  DIV<Hamlet> div = html.div("general_info")
                        .h1("index_header",
                            "Application: '" + clusterStatus.name + "'");

  UL<DIV<Hamlet>> ul = div.ul();

  ul.li("Total number of containers for application: " + appView.getNumOwnedContainers());
  ul.li("Application created: " +
        getInfoAvoidingNulls(StatusKeys.INFO_CREATE_TIME_HUMAN));
  ul.li("Application last flexed: " + getInfoAvoidingNulls(StatusKeys.INFO_FLEX_TIME_HUMAN));
  ul.li("Application running since: " + getInfoAvoidingNulls(StatusKeys.INFO_LIVE_TIME_HUMAN));
  ul.li("Application HDFS storage path: " + clusterStatus.dataPath);
  ul.li("Application configuration path: " + clusterStatus.originConfigurationPath);

  ul._()._();

  html.div("provider_info").h3(providerName + " specific information");
  ul = div.ul();
  addProviderServiceOptions(providerService, ul, clusterStatus);
  ul._()._();

  html.div("container_instances").h3("Component Instances");

  Hamlet.TABLE<DIV<Hamlet>> table = div.table();
  table.tr()
       .th("Component")
       .th("Desired")
       .th("Actual")
       .th("Outstanding Requests")
       .th("Failed")
       .th("Failed to start")
       ._();

  List<RoleStatus> roleStatuses = appView.cloneRoleStatusList();
  Collections.sort(roleStatuses, new RoleStatus.CompareByName());
  for (RoleStatus status : roleStatuses) {
    table.tr()
         .td(status.getName())
         .th(String.format("%d", status.getDesired()))
         .th(String.format("%d", status.getActual()))
         .th(String.format("%d", status.getRequested()))
         .th(String.format("%d", status.getFailed()))
         .th(String.format("%d", status.getStartFailed()))
          ._();
  }

  table._()._();
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:52,代码来源:IndexBlock.java


注:本文中的org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV.table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。