Package henplus.view

Examples of henplus.view.TableRenderer


             * no args. show available properties
             */
            if (argc == 0) {
                PROP_META[0].resetWidth();
                PROP_META[1].resetWidth();
                final TableRenderer table = new TableRenderer(PROP_META, HenPlus.out());
                for (Map.Entry<String, PropertyHolder> entry : getRegistry().getPropertyMap().entrySet()) {
                    final Column[] row = new Column[3];
                    final PropertyHolder holder = entry.getValue();
                    row[0] = new Column(entry.getKey());
                    row[1] = new Column(holder.getValue());
                    row[2] = new Column(holder.getShortDescription());
                    table.addRow(row);
                }
                table.closeTable();
                return SUCCESS;
            } else if (argc == 1) {
                /*
                 * one arg: show help
                 */
 
View Full Code Here


    // ================== rendering ================

    private void renderInfo(final Map<String, String> info) {

        final TableRenderer table = new TableRenderer(DESC_META, HenPlus.out());

        for (Entry<String,String> entry : info.entrySet()) {
            final String key = entry.getKey();
            final String value = entry.getValue();

            final Column[] row = new Column[2];
            row[0] = new Column(key);
            // don't call toString() on the value as it might be null
            row[1] = new Column(value);

            table.addRow(row);
        }
        table.closeTable();
    }
View Full Code Here

    }

    private void showAliases() {
        DRV_META[0].resetWidth();
        DRV_META[1].resetWidth();
        final TableRenderer table = new TableRenderer(DRV_META, HenPlus.out());
        for(Map.Entry<String,String> entry : _aliases.entrySet()) {
            final Column[] row = new Column[2];
            row[0] = new Column(entry.getKey());
            row[1] = new Column(entry.getValue());
            table.addRow(row);
        }
        table.closeTable();
    }
View Full Code Here

    private void printMetaDataInfo(final MetaProperty[] prop) {
        HenPlus.out().println();
        META_HEADERS[0].resetWidth();
        META_HEADERS[1].resetWidth();
        final TableRenderer table = new TableRenderer(META_HEADERS, HenPlus.out());
        for (int i = 0; i < prop.length; ++i) {
            final Column[] row = new Column[3];
            row[0] = new Column(prop[i].getFieldName());
            row[1] = new Column(prop[i].getTypeName());
            row[2] = new Column(prop[i].getMaxLength());
            table.addRow(row);
        }
        table.closeTable();
    }
View Full Code Here

    private void showSessions() {
        HenPlus.msg().println("current session is marked with '*'");
        for (int i = 0; i < SESS_META.length; ++i) {
            SESS_META[i].resetWidth();
        }
        final TableRenderer table = new TableRenderer(SESS_META, HenPlus.out());
        for (String sessName : _sessionManager.getSessionNames()) {
            final SQLSession session = _sessionManager.getSessionByName(sessName);
            final String prepend = sessName.equals(_currentSessionName) ? " * " : "   ";
            final Column[] row = new Column[5];
            row[0] = new Column(prepend + sessName);
            row[1] = new Column(session.getUsername());
            row[2] = new Column(session.getURL());
            row[3] = new Column(TimeRenderer.renderTime(session.getUptime()));
            row[4] = new Column(session.getStatementCount());
            table.addRow(row);
        }
        table.closeTable();
    }
View Full Code Here

                return SYNTAX_ERROR;
            }
            HenPlus.msg().println("loaded plugins are marked with '*'");
            DRV_META[0].resetWidth();
            DRV_META[1].resetWidth();
            final TableRenderer table = new TableRenderer(DRV_META, HenPlus.out());
            for (Entry<String,Command> entry : _plugins.entrySet()) {
                final Column[] row = new Column[2];
                final Command c = entry.getValue();
                final String clsName = entry.getKey();
                row[0] = new Column((c != null ? "* " : "  ") + clsName);
                if (c != null) {
                    final StringBuilder cmds = new StringBuilder();
                    final String[] cmdList = c.getCommandList();
                    for (int i = 0; i < cmdList.length; ++i) {
                        cmds.append(cmdList[i]).append("\n");
                    }
                    row[1] = new Column(cmds.toString().trim());
                } else {
                    row[1] = new Column(null);
                }
                table.addRow(row);
            }
            table.closeTable();
            return SUCCESS;
        } else if ("plug-in".equals(cmd)) {
            if (argc != 1) {
                return SYNTAX_ERROR;
            }
View Full Code Here

                HenPlus.msg().println("loaded drivers are marked with '*' (otherwise not found in CLASSPATH)");
                DRV_META[0].resetWidth();
                DRV_META[1].resetWidth();
                DRV_META[2].resetWidth();
                DRV_META[3].resetWidth();
                final TableRenderer table = new TableRenderer(DRV_META, HenPlus.out());
                for (Entry<String,DriverDescription> entry : _drivers.entrySet()) {
                    final Column[] row = new Column[4];
                    final DriverDescription desc = entry.getValue();
                    final String dbName = entry.getKey();
                    row[0] = new Column((desc.isLoaded() ? "* " : "  ") + dbName);
                    row[1] = new Column(desc.getClassName());
                    row[2] = new Column(desc.getVersion());
                    row[3] = new Column(desc.getSampleURL());
                    table.addRow(row);
                }
                table.closeTable();
                return SUCCESS;
            } else {
                return SYNTAX_ERROR;
            }
        } else if ("register".equals(cmd)) {
View Full Code Here

    }

    private void showKeyBindings() {
        DRV_META[0].resetWidth();
        DRV_META[1].resetWidth();
        final TableRenderer table = new TableRenderer(DRV_META, HenPlus.out());
        for (Entry<String,String> entry : _bindings.entrySet()) {
            final Column[] row = new Column[2];
            row[0] = new Column(entry.getKey());
            row[1] = new Column(entry.getValue());
            table.addRow(row);
        }
        table.closeTable();
    }
View Full Code Here

             * no args. only show.
             */
            if (argc == 0) {
                SET_META[0].resetWidth();
                SET_META[1].resetWidth();
                final TableRenderer table = new TableRenderer(SET_META, HenPlus.out());
                for (Entry<String,String> entry : _variables.entrySet()) {
                    final Column[] row = new Column[4];
                    row[0] = new Column(entry.getKey());
                    row[1] = new Column(entry.getValue());
                    // row[2] = new Column("");
                    // row[3] = new Column("X");
                    table.addRow(row);
                }
                table.closeTable();
                return SUCCESS;
            } else if (argc >= 2) {
                /*
                 * more than one arg
                 */
 
View Full Code Here

                     * we will show the first column and the description column
                     * or not.
                     */
                    DESC_META[1].setDisplay(!allSameTableName);
                    DESC_META[8].setDisplay(anyDescription);
                    final TableRenderer table = new TableRenderer(DESC_META, HenPlus.out());
                    final Iterator<Column[]> it = rows.iterator();
                    while (it.hasNext()) {
                        table.addRow(it.next());
                    }
                    table.closeTable();

                    if (_interrupted) {
                        return SUCCESS;
                    }

View Full Code Here

TOP

Related Classes of henplus.view.TableRenderer

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.