Example usage for com.vaadin.server FontAwesome CLONE

List of usage examples for com.vaadin.server FontAwesome CLONE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome CLONE.

Prototype

FontAwesome CLONE

To view the source code for com.vaadin.server FontAwesome CLONE.

Click Source Link

Usage

From source file:org.jumpmind.vaadin.ui.sqlexplorer.TabularResultLayout.java

License:Open Source License

private void createMenuBar() {
    HorizontalLayout resultBar = new HorizontalLayout();
    resultBar.setWidth(100, Unit.PERCENTAGE);
    resultBar.setMargin(new MarginInfo(false, true, false, true));

    HorizontalLayout leftBar = new HorizontalLayout();
    leftBar.setSpacing(true);/* w w w.ja va  2s .  co  m*/
    resultLabel = new Label("", ContentMode.HTML);
    leftBar.addComponent(resultLabel);

    final Label sqlLabel = new Label("", ContentMode.TEXT);
    sqlLabel.setWidth(800, Unit.PIXELS);
    leftBar.addComponent(sqlLabel);

    resultBar.addComponent(leftBar);
    resultBar.setComponentAlignment(leftBar, Alignment.MIDDLE_LEFT);
    resultBar.setExpandRatio(leftBar, 1);

    MenuBar rightBar = new MenuBar();
    rightBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS);
    rightBar.addStyleName(ValoTheme.MENUBAR_SMALL);

    MenuBar.MenuItem refreshButton = rightBar.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            listener.reExecute(sql);
        }
    });
    refreshButton.setIcon(FontAwesome.REFRESH);

    MenuBar.MenuItem exportButton = rightBar.addItem("", new Command() {
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            new ExportDialog(grid, db.getName(), sql).show();
        }
    });
    exportButton.setIcon(FontAwesome.UPLOAD);

    if (isInQueryGeneralResults) {
        MenuBar.MenuItem keepResultsButton = rightBar.addItem("", new Command() {
            private static final long serialVersionUID = 1L;

            @Override
            public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) {
                queryPanel.addResultsTab(refreshWithoutSaveButton(), StringUtils.abbreviate(sql, 20),
                        queryPanel.getGeneralResultsTab().getIcon());
                queryPanel.resetGeneralResultsTab();
            }
        });
        keepResultsButton.setIcon(FontAwesome.CLONE);
        keepResultsButton.setDescription("Save these results to a new tab");
    }

    if (showSql) {
        sqlLabel.setValue(StringUtils.abbreviate(sql, 200));
    }

    resultBar.addComponent(rightBar);
    resultBar.setComponentAlignment(rightBar, Alignment.MIDDLE_RIGHT);

    this.addComponent(resultBar, 0);
}