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


Java Table类代码示例

本文整理汇总了Java中org.springframework.shell.support.table.Table的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: issuebranches

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
/**
 * List the branches with their tickets of the git repository.
 *
 * @param projectName
 * @return
 * @throws Exception
 */
@CliCommand("git issuebranches")
public Table issuebranches(@CliOption(key = { "" }, mandatory = true) String projectName,
		@CliOption(key = "resolved", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") Boolean resolved)
		throws Exception {

	Project project = ReleaseTrains.getProjectByName(projectName);
	TicketBranches ticketBranches = git.listTicketBranches(project);

	Table table = new Table();
	table.addHeader(1, new TableHeader("Branch"));
	table.addHeader(2, new TableHeader("Status"));
	table.addHeader(3, new TableHeader("Description"));

	ticketBranches.stream().sorted().//
			filter(branch -> ticketBranches.hasTicketFor(branch, resolved)).//
			forEachOrdered(branch -> {

				Optional<Ticket> ticket = ticketBranches.findTicket(branch);

				table.addRow(branch.toString(), //
						ticket.map(t -> t.getTicketStatus().getLabel()).orElse(""), //
						ticket.map(t -> t.getSummary()).orElse(""));
			});

	return table;
}
 
开发者ID:spring-projects,项目名称:spring-data-dev-tools,代码行数:34,代码来源:GitCommands.java

示例2: renderMultiValueMap

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
/**
 * Renders a 2 columns wide table with the given headers and rows. If headers are provided it should match with the
 * number of columns.
 *
 * @param rows    rows of the table, each value will be added as a new row with the same key
 * @param headers headers of the table
 * @return formatted table
 */
public static String renderMultiValueMap(Map<String, List<String>> rows, String... headers) {
  Table table = createTable(headers);
  if (rows != null) {
    for (String key : rows.keySet()) {
      List<String> values = rows.get(key);
      if (values != null) {
        for (String value : values) {
          table.addRow(key, value);
        }
      }
    }
  }
  return format(table);
}
 
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:23,代码来源:TableRenderer.java

示例3: renderMapValueMap

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
/**
 * Renders a 3 columns wide table with the given headers and rows. If headers are provided it should match with the
 * number of columns.
 *
 * @param rows    rows of the table, value map will be added as the last 2 columns to the table
 * @param headers headers of the table
 * @return formatted table
 */
public static String renderMapValueMap(Map<String, Map<String, String>> rows, String... headers) {
  Table table = createTable(headers);
  if (rows != null) {
    for (String key1 : rows.keySet()) {
      Map<String, String> values = rows.get(key1);
      if (values != null) {
        for (String key2 : values.keySet()) {
          table.addRow(key1, key2, values.get(key2));
        }
      }
    }
  }
  return format(table);
}
 
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:23,代码来源:TableRenderer.java

示例4: createTable

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
private static Table createTable(String... headers) {
  Table table = new Table();
  if (headers != null) {
    int column = 1;
    for (String header : headers) {
      table.addHeader(column++, new TableHeader(header));
    }
  }
  return table;
}
 
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:11,代码来源:TableRenderer.java

示例5: toString

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
@Override
public String toString() {
  Table table = new Table();
  for (int i = 0; i < header.length; i++) {
    table.addHeader(i + 1, new TableHeader(header[i]));
  }
  for (T element : collection) {
    for (String[] row : provider.getRows(element)) {
      table.addRow(row);
    }
  }
  return TableRenderer.renderTextTable(table);
}
 
开发者ID:apache,项目名称:lens,代码行数:14,代码来源:CollectionTable.java

示例6: format

import org.springframework.shell.support.table.Table; //导入依赖的package包/类
private static String format(Table table) {
  table.calculateColumnWidths();
  return table.toString();
}
 
开发者ID:hortonworks,项目名称:ambari-shell,代码行数:5,代码来源:TableRenderer.java


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