Package org.apache.karaf.shell.table

Examples of org.apache.karaf.shell.table.Col


        this.webContainerService = webContainerService;
    }
   
    public Object doExecute() throws Exception {
      ShellTable table = new ShellTable();
        table.column(new Col("ID"));
        table.column(new Col("State"));
        table.column(new Col("Web-State"));
        table.column(new Col("Level"));
        table.column(new Col("Web-ContextPath"));
        table.column(new Col("Name"));
       
        java.util.List<WebBundle> webBundles = webContainerService.list();
        if (webBundles != null && !webBundles.isEmpty()) {
            for (WebBundle webBundle : webBundles) {
              table.addRow().addContent(
View Full Code Here


    protected void printMethodList(CommandSession session, PrintStream out, SortedMap<String, String> commands) {
        Terminal term = (Terminal) session.get(".jline.terminal");
        int termWidth = term != null ? term.getWidth() : 80;
        out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("COMMANDS").a(Ansi.Attribute.RESET));
        ShellTable table = new ShellTable().noHeaders().separator(" ").size(termWidth);
        table.column(new Col("Command").maxSize(35));
        table.column(new Col("Description"));
        for (Map.Entry<String,String> entry : commands.entrySet()) {
            String key = NameScoping.getCommandNameWithoutGlobalPrefix(session, entry.getKey());
            table.addRow().addContent(key, entry.getValue());
        }
        table.print(out, true);
View Full Code Here

public class ShellTableTest {

    @Test
    public void testTable() {
        ShellTable table = new ShellTable();
        table.column(new Col("id").alignRight().maxSize(5));
        table.column(new Col("Name").maxSize(20));
        table.column(new Col("Centered").alignCenter());

        table.addRow().addContent(1, "Test", "Description");
        table.addRow().addContent(20, "My name", "Description");

        Row row = table.addRow();
View Full Code Here

    }

    @Test
    public void testGrow() {
        ShellTable table = new ShellTable().size(10);
        table.column(new Col("1"));
        table.column(new Col("2"));

        table.addRow().addContent("1", "2");

        StringWriter writer = new StringWriter();
        PrintStream out = new PrintStream(new WriterOutputStream(writer));
View Full Code Here

    }

    @Test
    public void testShrink() {
        ShellTable table = new ShellTable().size(10);
        table.column(new Col("1").maxSize(5));
        table.column(new Col("2").alignRight());

        table.addRow().addContent("quite long", "and here an even longer text");

        StringWriter writer = new StringWriter();
        PrintStream out = new PrintStream(new WriterOutputStream(writer));
View Full Code Here

    }

    @Test
    public void testTooSmall() {
        ShellTable table = new ShellTable().size(2);
        table.column(new Col("1").maxSize(5));
        table.column(new Col("2").alignRight());

        table.addRow().addContent("quite long", "and here an even longer text");

        StringWriter writer = new StringWriter();
        PrintStream out = new PrintStream(new WriterOutputStream(writer));
View Full Code Here

    }

    @Test
    public void testNoFormat() {
        ShellTable table = new ShellTable();
        table.column(new Col("first"));
        table.column(new Col("second"));

        table.addRow().addContent("first column", "second column");

        StringWriter writer = new StringWriter();
        PrintStream out = new PrintStream(new WriterOutputStream(writer));
View Full Code Here

    @Test
    public void testNoFormatWithCustomSeparator() {
        ShellTable table = new ShellTable();
        table.separator(";");
        table.column(new Col("first"));
        table.column(new Col("second"));

        table.addRow().addContent("first column", "second column");

        StringWriter writer = new StringWriter();
        PrintStream out = new PrintStream(new WriterOutputStream(writer));
View Full Code Here

    }

    protected Object doExecute() throws Exception {
        SortedMap<String, PackageRequirement> imports = packageService.getImports();
        ShellTable table = new ShellTable();
        table.column(new Col(onlyPackage ? "Package name" : "Filter"));
        table.column(new Col("Optional"));
        table.column(new Col("ID"));
        table.column(new Col("Bundle Name"));
        table.column(new Col("Resolveable"));
       
        for (String filter : imports.keySet()) {
            PackageRequirement req = imports.get(filter);
            Bundle bundle = req.getBundle();
            String firstCol = onlyPackage ? req.getPackageName() : req.getFilter();
View Full Code Here

    }

  private void showExports() {
    SortedMap<String, PackageVersion> exports = packageService.getExports();
        ShellTable table = new ShellTable();
        table.column(new Col("Package Name"));
        table.column(new Col("Version"));
        table.column(new Col("ID"));
        table.column(new Col("Bundle Name"));
       
        for (String key : exports.keySet()) {
            PackageVersion pVer = exports.get(key);
            for (Bundle bundle : pVer.getBundles()) {
                table.addRow().addContent(pVer.getPackageName(),pVer.getVersion().toString(), bundle.getBundleId(), bundle.getSymbolicName());
View Full Code Here

TOP

Related Classes of org.apache.karaf.shell.table.Col

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.