Example usage for com.vaadin.server FontAwesome DOWNLOAD

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

Introduction

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

Prototype

FontAwesome DOWNLOAD

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

Click Source Link

Usage

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

License:Open Source License

protected DbTree buildDbTree() {

    final DbTree tree = new DbTree(databaseProvider, settingsProvider);
    tree.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override//from   w  w  w . j a  v  a 2  s .c  o m
        public void valueChange(ValueChangeEvent event) {
            Set<DbTreeNode> nodes = dbTree.getSelected();
            if (nodes != null) {
                for (DbTreeNode treeNode : nodes) {
                    IDb db = dbTree.getDbForNode(treeNode);
                    QueryPanel panel = getQueryPanelForDb(db);
                    if (panel == null && db != null) {
                        openQueryWindow(db);
                    }
                }

                String selectedTabCaption = null;
                for (IInfoPanel panel : infoTabs) {
                    selectedTabCaption = panel.getSelectedTabCaption();
                    contentTabs.removeComponent(panel);
                }
                infoTabs.clear();

                if (nodes.size() > 0) {
                    DbTreeNode treeNode = nodes.iterator().next();
                    if (treeNode != null && treeNode.getType().equals(DbTree.NODE_TYPE_DATABASE)) {
                        IDb db = dbTree.getDbForNode(treeNode);
                        DatabaseInfoPanel databaseInfoTab = new DatabaseInfoPanel(db, settingsProvider.get(),
                                selectedTabCaption);
                        Tab tab = contentTabs.addTab(databaseInfoTab, db.getName(), FontAwesome.DATABASE, 0);
                        tab.setClosable(true);
                        selectContentTab(databaseInfoTab);
                        infoTabs.add(databaseInfoTab);
                    }
                    if (treeNode != null && treeNode.getType().equals(DbTree.NODE_TYPE_TABLE)) {
                        Table table = treeNode.getTableFor();
                        if (table != null) {
                            IDb db = dbTree.getDbForNode(treeNode);
                            TableInfoPanel tableInfoTab = new TableInfoPanel(table, user, db,
                                    settingsProvider.get(), SqlExplorer.this, selectedTabCaption);
                            Tab tab = contentTabs.addTab(tableInfoTab, table.getFullyQualifiedTableName(),
                                    FontAwesome.TABLE, 0);
                            tab.setClosable(true);
                            selectContentTab(tableInfoTab);
                            infoTabs.add(tableInfoTab);
                        }
                    } else if (treeNode != null && treeNode.getType().equals(DbTree.NODE_TYPE_TRIGGER)) {
                        Table table = treeNode.getParent().getTableFor();
                        IDdlReader reader = dbTree.getDbForNode(treeNode).getPlatform().getDdlReader();
                        Trigger trigger = reader.getTriggerFor(table, treeNode.getName());
                        if (trigger != null) {
                            IDb db = dbTree.getDbForNode(treeNode);
                            TriggerInfoPanel triggerInfoTab = new TriggerInfoPanel(trigger, db,
                                    settingsProvider.get(), selectedTabCaption);
                            Tab tab = contentTabs.addTab(triggerInfoTab, trigger.getName(),
                                    FontAwesome.CROSSHAIRS, 0);
                            tab.setClosable(true);
                            selectContentTab(triggerInfoTab);
                            infoTabs.add(triggerInfoTab);
                        }
                    }
                }
            }
        }
    });
    tree.registerAction(new DbTreeAction("Query", QUERY_ICON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            openQueryWindow(nodes);
        }
    }, DbTree.NODE_TYPE_DATABASE, DbTree.NODE_TYPE_CATALOG, DbTree.NODE_TYPE_SCHEMA, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Select", QUERY_ICON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            generateSelectForSelectedTables();
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Insert", QUERY_ICON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            generateDmlForSelectedTables(DmlType.INSERT);
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Update", QUERY_ICON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            generateDmlForSelectedTables(DmlType.UPDATE);
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Delete", QUERY_ICON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            generateDmlForSelectedTables(DmlType.DELETE);
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Drop", FontAwesome.ARROW_DOWN) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            dropSelectedTables();
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Import", FontAwesome.DOWNLOAD) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            if (nodes.size() > 0) {
                IDb db = dbTree.getDbForNode(nodes.iterator().next());
                new DbImportDialog(db.getPlatform(), dbTree.getSelectedTables()).showAtSize(0.6);
            }
        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Export", FontAwesome.UPLOAD) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            if (nodes.size() > 0) {
                IDb db = dbTree.getDbForNode(nodes.iterator().next());
                new DbExportDialog(db.getPlatform(), dbTree.getSelectedTables(), findQueryPanelForDb(db))
                        .showAtSize(0.6);
            }
        }
    }, DbTree.NODE_TYPE_TABLE, DbTree.NODE_TYPE_TRIGGER);

    tree.registerAction(new DbTreeAction("Fill", FontAwesome.BEER) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {
            if (nodes.size() > 0) {
                IDb db = dbTree.getDbForNode(nodes.iterator().next());
                new DbFillDialog(db.getPlatform(), dbTree.getSelectedTables(), findQueryPanelForDb(db))
                        .showAtSize(0.6);
            }

        }
    }, DbTree.NODE_TYPE_TABLE);

    tree.registerAction(new DbTreeAction("Copy Name", FontAwesome.COPY) {
        private static final long serialVersionUID = 1L;

        @Override
        public void handle(Set<DbTreeNode> nodes) {

            for (DbTreeNode treeNode : nodes) {
                IDb db = dbTree.getDbForNode(nodes.iterator().next());
                DatabaseInfo dbInfo = db.getPlatform().getDatabaseInfo();
                final String quote = dbInfo.getDelimiterToken();
                final String catalogSeparator = dbInfo.getCatalogSeparator();
                final String schemaSeparator = dbInfo.getSchemaSeparator();

                Table table = treeNode.getTableFor();
                if (table != null) {
                    QueryPanel panel = findQueryPanelForDb(db);
                    panel.appendSql(table.getQualifiedTableName(quote, catalogSeparator, schemaSeparator));
                    contentTabs.setSelectedTab(panel);
                }
            }
        }
    }, DbTree.NODE_TYPE_TABLE);

    return tree;

}

From source file:org.vaadin.gridfiledownloader.GridFileDownloader.java

License:Apache License

/**
 * Adds a download column with propertyId {@link FontAwesome#DOWNLOAD} to
 * the Grid and registers it with this extension.
 *
 * @see GridFileDownloader#setDownloadColumn(Object)
 *//*from   w w  w  .  j  a  v  a  2 s. co m*/
protected void addDownloadColumn() {
    Indexed dataSource = grid.getContainerDataSource();
    FontAwesome icon = FontAwesome.DOWNLOAD;
    dataSource.addContainerProperty(icon, String.class, createDownloadHtml());
    grid.getColumn(icon).setRenderer(new HtmlRenderer());
    grid.getHeaderRow(0).getCell(icon).setHtml(createDownloadHtml());
    grid.getColumn(icon).setSortable(false);
    setDownloadColumn(icon);
}

From source file:org.vaadin.gridfiledownloader.GridFileDownloader.java

License:Apache License

/**
 * Creates the HTML content of the generated download column.
 *
 * @return HTML content as String/*from w w  w . ja  v  a 2  s  . co  m*/
 */
protected String createDownloadHtml() {
    return FontAwesome.DOWNLOAD.getHtml();
}

From source file:org.vaadin.gridfiledownloadertest.GridFileDownloaderUI.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*  ww  w . j a va 2 s  .c om*/
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    final Grid grid = new Grid("Attachment grid");
    grid.setHeightMode(HeightMode.ROW);
    grid.setHeightByRows(5);
    grid.setSelectionMode(SelectionMode.NONE);

    Column column = grid.addColumn("filename");
    column.setHeaderCaption("File name");
    column.setExpandRatio(1);

    Indexed dataSource = grid.getContainerDataSource();
    for (int i = 1; i <= 5; ++i) {
        DownloadPojo cp = new DownloadPojo(i);
        Item item = dataSource.addItem(cp);
        item.getItemProperty("filename").setValue(cp.getName());
    }
    layout.addComponent(grid);
    addGridFileDownloader(grid);

    // set tooltip for the default download column
    grid.setCellDescriptionGenerator(new CellDescriptionGenerator() {

        @Override
        public String getDescription(CellReference cell) {
            if (FontAwesome.DOWNLOAD.equals(cell.getPropertyId())) {
                return "download";
            }
            return null;
        }
    });

    // clear the header
    HeaderCell downloadHeader = grid.getHeaderRow(0).getCell(FontAwesome.DOWNLOAD);
    downloadHeader.setHtml("");
}

From source file:org.vaadin.viritin.it.MNotificationExapmle.java

License:Apache License

@Override
public Component getTestComponent() {
    MVerticalLayout layout = new MVerticalLayout(new MLabel("MNotification Examples").withStyleName("h1"),
            new MHorizontalLayout(new MButton(FontAwesome.COMMENT, "Humanized", new Button.ClickListener() {
                @Override/*from www  . ja  v a2s.c o m*/
                public void buttonClick(Button.ClickEvent event) {
                    MNotification.humanized("Humanized", "This is a humanized notification!")
                            .withIcon(FontAwesome.COMMENT);
                }
            }).withStyleName("primary"), new MButton(FontAwesome.TIMES, "Error", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    MNotification.error("Error", "This is an error notification!").withIcon(FontAwesome.TIMES);
                }
            }).withStyleName("danger"),
                    new MButton(FontAwesome.EXCLAMATION_TRIANGLE, "Warning", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.warning("Warning", "This is a warning notification!")
                                    .withIcon(FontAwesome.EXCLAMATION_TRIANGLE);
                        }
                    }), new MButton(FontAwesome.DOWNLOAD, "Tray", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.tray("Tray", "This is a tray notification!")
                                    .withIcon(FontAwesome.DOWNLOAD);
                        }
                    }).withStyleName("friendly"),
                    new MButton(FontAwesome.WHEELCHAIR, "Assistive", new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            MNotification.assistive("Assistive", "This is an assistive notification!");
                        }
                    }).withStyleName("quiet"))).withFullWidth();

    return layout;
}

From source file:pl.exsio.ca.module.terrain.evidence.FilesDataTable.java

License:Open Source License

protected void addDownloadButtonColumn() {
    dataComponent.addGeneratedColumn("", new Table.ColumnGenerator() {

        @Override//  ww  w. ja  v a  2 s .c  o m
        public Component generateCell(final Table source, final Object itemId, final Object columnId) {

            final Button download = new Button("", FontAwesome.DOWNLOAD);
            final TerrainFile terrainFile = ((EntityItem<TerrainFile>) dataComponent.getItem(itemId))
                    .getEntity();
            Resource res = new StreamResource(new StreamSource() {

                @Override
                public InputStream getStream() {
                    return new ByteArrayInputStream(terrainFile.getData());
                }
            }, terrainFile.getName());
            FileDownloader fd = new FileDownloader(res);
            fd.extend(download);
            download.setImmediate(true);
            download.setStyleName("link");
            return download;
        }
    });
}

From source file:qbic.vaadincomponents.TSVDownloadComponent.java

License:Open Source License

public TSVDownloadComponent() {
    // TODO progress bar not used atm because the labels in available UpdateProgressBar classes are
    // too specific
    // probably not needed anyway since ProjInformationComponent seems to show when everything is
    // complete//from ww w  . j a v  a  2  s .co m
    // this.bar = new ProgressBar();
    // this.info = new Label();
    // info.setCaption("Preparing Spreadsheets");
    // addComponent(info);
    // addComponent(bar);

    downloads = new HorizontalLayout();
    downloads.setCaption("Spreadsheets");
    downloads.setSpacing(true);
    dlEntities = new Button("Sample Sources");
    dlExtracts = new Button("Sample Extracts");
    dlPreps = new Button("Sample Preparations");

    dlEntities.setStyleName(ValoTheme.BUTTON_LINK);
    dlEntities.setIcon(FontAwesome.DOWNLOAD);

    dlExtracts.setStyleName(ValoTheme.BUTTON_LINK);
    dlExtracts.setIcon(FontAwesome.DOWNLOAD);

    dlPreps.setStyleName(ValoTheme.BUTTON_LINK);
    dlPreps.setIcon(FontAwesome.DOWNLOAD);

    dlEntities.setEnabled(false);
    dlExtracts.setEnabled(false);
    dlPreps.setEnabled(false);
    downloads.addComponent(dlEntities);
    downloads.addComponent(dlExtracts);
    downloads.addComponent(dlPreps);
    addComponent(downloads);
}