Example usage for com.vaadin.server FontAwesome TABLE

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

Introduction

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

Prototype

FontAwesome TABLE

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

Click Source Link

Usage

From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java

License:Apache License

Component buildTestMenu() {
    final CssLayout menu = new CssLayout();
    menu.addStyleName("large-icons");

    final Label logo = new Label("Va");
    logo.setSizeUndefined();//w  w  w .j a v  a2s  . co m
    logo.setPrimaryStyleName("valo-menu-logo");
    menu.addComponent(logo);

    Button b = new Button("Reference <span class=\"valo-menu-badge\">3</span>");
    b.setIcon(FontAwesome.TH_LIST);
    b.setPrimaryStyleName("valo-menu-item");
    b.addStyleName("selected");
    b.setHtmlContentAllowed(true);
    menu.addComponent(b);

    b = new Button("API");
    b.setIcon(FontAwesome.BOOK);
    b.setPrimaryStyleName("valo-menu-item");
    menu.addComponent(b);

    b = new Button("Examples <span class=\"valo-menu-badge\">12</span>");
    b.setIcon(FontAwesome.TABLE);
    b.setPrimaryStyleName("valo-menu-item");
    b.setHtmlContentAllowed(true);
    menu.addComponent(b);

    return menu;
}

From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java

License:Apache License

private void initializeDatabaseChangeLog() {
    changelogLayout = createVerticalLayout("about.database.caption", "about.database.description",
            FontAwesome.TABLE);

    BeanItemContainer<DatabaseChangeLog> data = new BeanItemContainer<>(DatabaseChangeLog.class);
    data.addAll(changeLog);// w  ww  .  j a v  a  2s .c  om

    Grid display = new Grid(data);
    display.setSizeFull();
    display.setFrozenColumnCount(1);
    display.setColumns("id", "fileName", "dateExecuted", "comments", "liquibase");

    formatColumn(display, "id", "about.database", 10);
    formatColumn(display, "fileName", "about.database", 20);
    formatColumn(display, "dateExecuted", "about.database", 20);
    formatColumn(display, "comments", "about.database", 40);
    formatColumn(display, "liquibase", "about.database", 10);
    changelogLayout.addComponent(display);
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.HomeView.java

License:Open Source License

void buildLayout(int browserHeight, int browserWidth, WebBrowser browser) {
    // clean up first
    // homeview_content.removeAllComponents();
    removeAllComponents();//from ww w . ja  v a 2s.  co  m
    setSpacing(true);

    // updateView(browserWidth, browserWidth, browser);

    // view overall statistics
    // VerticalLayout homeViewDescription = new VerticalLayout();

    /*
     * Label statContent; if (numberOfProjects > 0) { statContent = new
     * Label(String.format("You have %s Sub-Project(s)", numberOfProjects));
     * setHeader(String.format("Total number of Sub-Projects: %s", numberOfProjects)); } else {
     * statContent = new Label(
     * String.format("You have no projects so far. Please contact your project manager."));
     * statContent.addStyleName(ValoTheme.LABEL_FAILURE);
     * statContent.addStyleName(ValoTheme.LABEL_LARGE); }
     */

    // homeViewDescription.setWidth("100%");
    // homeview_content.addComponent(homeViewDescription);

    // table
    // VerticalLayout tableSection = new VerticalLayout();
    // VerticalLayout tableSectionContent = new VerticalLayout();

    // tableSectionContent.setCaption("Sub-Projects");
    // tableSectionContent.setIcon(FontAwesome.TABLE);
    // tableSectionContent.addComponent(this.table);
    addComponent(projectGrid);
    addComponent(buttonLayoutSection);
    setExportButton();

    setCaption("Sub-Projects");
    setIcon(FontAwesome.TABLE);

    // tableSection.setMargin(new MarginInfo(false, false, false, false));

    projectGrid.setWidth(100, Unit.PERCENTAGE);
    projectGrid.setSelectionMode(SelectionMode.SINGLE);
    projectGrid.setResponsive(true);

    export.setIcon(FontAwesome.DOWNLOAD);

    // tableSection.setWidth("100%");
    // tableSectionContent.setWidth("100%");

    // tableSection.addComponent(tableSectionContent);
    // homeview_content.addComponent(tableSection);
    setWidth(100, Unit.PERCENTAGE);
    setResponsive(true);
    // this.addComponent(homeview_content);
}

From source file:org.jumpmind.metl.ui.views.design.EditModelPanel.java

License:Open Source License

public EditModelPanel(ApplicationContext context, String modelId, boolean readOnly) {
    this.context = context;
    this.model = new Model(modelId);
    this.readOnly = readOnly;
    context.getConfigurationService().refresh(model);

    ButtonBar buttonBar = new ButtonBar();
    addComponent(buttonBar);/*from   w  w  w  . j a v  a2 s.  co m*/

    if (!readOnly) {
        addEntityButton = buttonBar.addButton("Add Entity", FontAwesome.TABLE);
        addEntityButton.addClickListener(new AddEntityClickListener());

        addAttributeButton = buttonBar.addButton("Add Attribute", FontAwesome.COLUMNS);
        addAttributeButton.addClickListener(new AddAttributeClickListener());

        editButton = buttonBar.addButton("Edit", FontAwesome.EDIT);
        editButton.addClickListener(new EditClickListener());

        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O);
        removeButton.addClickListener(new RemoveClickListener());

        importButton = buttonBar.addButton("Import ...", FontAwesome.DOWNLOAD);
        importButton.addClickListener(new ImportClickListener());
    }

    filterField = buttonBar.addFilter();
    filterField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            filterField.setValue(event.getText());
            treeTable.removeAllItems();
            addAll(event.getText(), EditModelPanel.this.model.getModelEntities());
        }
    });

    treeTable.setSizeFull();
    treeTable.setCacheRate(100);
    treeTable.setPageLength(100);
    treeTable.setImmediate(true);
    treeTable.setSelectable(true);
    treeTable.setMultiSelect(true);
    treeTable.addGeneratedColumn("name", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final AbstractObject obj = (AbstractObject) itemId;
            if (lastEditItemIds.contains(itemId) && !readOnly) {
                ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                    protected void save(String text) {
                        obj.setName(text);
                        EditModelPanel.this.context.getConfigurationService().save(obj);
                    };
                };
                t.setWidth(100, Unit.PERCENTAGE);
                t.setValue(obj.getName());
                t.focus();
                t.selectAll();
                return t;
            } else {
                return UiUtils.getName(filterField.getValue(), obj.getName());
            }
        }
    });
    treeTable.setColumnHeader("name", "Name");

    treeTable.addGeneratedColumn("description", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                        protected void save(String text) {
                            obj.setDescription(text);
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        };
                    };
                    t.setWidth(100, Unit.PERCENTAGE);
                    t.setValue(obj.getDescription());
                    return t;
                } else {
                    return UiUtils.getName(filterField.getValue(), obj.getDescription());
                }
            }
            if (itemId instanceof ModelEntity) {
                final ModelEntity obj = (ModelEntity) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    ImmediateUpdateTextField t = new ImmediateUpdateTextField(null) {
                        protected void save(String text) {
                            obj.setDescription(text);
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        };
                    };
                    t.setWidth(100, Unit.PERCENTAGE);
                    t.setValue(obj.getDescription());
                    return t;
                } else {
                    return UiUtils.getName(filterField.getValue(), obj.getDescription());
                }
            } else
                return null;
        }
    });
    treeTable.setColumnHeader("description", "Description");

    treeTable.addGeneratedColumn("type", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    final ComboBox cbox = new ComboBox();
                    cbox.setNullSelectionAllowed(false);
                    for (DataType dataType : DataType.values()) {
                        cbox.addItem(dataType.name());
                    }
                    cbox.setValue(obj.getType());
                    cbox.addValueChangeListener(new ValueChangeListener() {
                        public void valueChange(ValueChangeEvent event) {
                            obj.setType((String) cbox.getValue());
                            EditModelPanel.this.context.getConfigurationService().save(obj);
                        }
                    });
                    cbox.addBlurListener(new BlurListener() {
                        public void blur(BlurEvent event) {
                            Collection<?> items = treeTable.getItemIds();
                            boolean found = false;
                            for (Object item : items) {
                                if (item.equals(obj)) {
                                    found = true;
                                } else if (found) {
                                    selectOnly(item);
                                    editSelectedItem();
                                    break;
                                }
                            }
                        }
                    });

                    return cbox;
                } else {
                    return obj.getType();
                }
            } else {
                return null;
            }
        }
    });
    treeTable.setColumnHeader("type", "Type");

    treeTable.addGeneratedColumn("pk", new ColumnGenerator() {
        public Object generateCell(Table source, Object itemId, Object columnId) {
            if (itemId instanceof ModelAttribute) {
                final ModelAttribute obj = (ModelAttribute) itemId;
                if (lastEditItemIds.contains(itemId) && !readOnly) {
                    final CheckBox cbox = new CheckBox();
                    cbox.setValue(obj.isPk());
                    cbox.setImmediate(true);
                    cbox.addValueChangeListener(event -> togglePk(obj));
                    cbox.addBlurListener(new BlurListener() {
                        public void blur(BlurEvent event) {
                            Collection<?> items = treeTable.getItemIds();
                            boolean found = false;
                            for (Object item : items) {
                                if (item.equals(obj)) {
                                    found = true;
                                } else if (found) {
                                    selectOnly(item);
                                    editSelectedItem();
                                    break;
                                }
                            }
                        }
                    });

                    return cbox;
                } else if (obj.isPk()) {
                    return new Label(FontAwesome.KEY.getHtml(), ContentMode.HTML);
                }
            }
            return null;
        }
    });
    treeTable.setColumnHeader("pk", "PK");
    treeTable.setColumnWidth("pk", 40);

    treeTable.addItemClickListener(new TreeTableItemClickListener());
    treeTable.addValueChangeListener(new TreeTableValueChangeListener());
    enterKeyListener = new ShortcutListener("Enter", KeyCode.ENTER, null) {
        public void handleAction(Object sender, Object target) {
            lastEditItemIds = Collections.emptySet();
            treeTable.refreshRowCache();
        }
    };

    addComponent(treeTable);
    setExpandRatio(treeTable, 1.0f);

    HorizontalLayout hlayout = new HorizontalLayout();
    addComponent(hlayout);

    Button collapseAll = new Button("Collapse All");
    collapseAll.addStyleName(ValoTheme.BUTTON_LINK);
    collapseAll.addStyleName(ValoTheme.BUTTON_SMALL);
    hlayout.addComponent(collapseAll);
    collapseAll.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            for (Object itemId : treeTable.getItemIds()) {
                treeTable.setCollapsed(itemId, true);
            }
        }
    });

    Button expandAll = new Button("Expand All");
    expandAll.addStyleName(ValoTheme.BUTTON_LINK);
    expandAll.addStyleName(ValoTheme.BUTTON_SMALL);
    hlayout.addComponent(expandAll);
    expandAll.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            for (Object itemId : treeTable.getItemIds()) {
                treeTable.setCollapsed(itemId, false);
            }
        }
    });

    addAll("", model.getModelEntities());

    setButtonsEnabled();
}

From source file:org.jumpmind.metl.ui.views.design.EditModelPanel.java

License:Open Source License

protected void addModelEntity(ModelEntity modelEntity) {
    treeTable.addItem(modelEntity);
    treeTable.setItemIcon(modelEntity, FontAwesome.TABLE);
    treeTable.setChildrenAllowed(modelEntity, false);
}

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

License:Open Source License

protected List<DbTreeNode> getTableTreeNodes(IDdlReader reader, DbTreeNode parent, String catalogName,
        String schemaName) {/*from   w w w  .  j  av  a2 s .c  o m*/
    List<DbTreeNode> list = new ArrayList<DbTreeNode>();
    List<String> tables = reader.getTableNames(catalogName, schemaName, TABLE_TYPES);

    Collections.sort(tables, new Comparator<String>() {
        @Override
        public int compare(String o1, String o2) {
            return o1.toUpperCase().compareTo(o2.toUpperCase());
        }
    });

    for (String tableName : tables) {
        String excludeRegex = settingsProvider.get().getProperties()
                .get(Settings.SQL_EXPLORER_EXCLUDE_TABLES_REGEX);
        if (!tableName.matches(excludeRegex) && !tableName.toUpperCase().matches(excludeRegex)
                && !tableName.toLowerCase().matches(excludeRegex)) {

            DbTreeNode treeNode = new DbTreeNode(this, tableName, NODE_TYPE_TABLE, FontAwesome.TABLE, parent);
            if (catalogName != null) {
                treeNode.getProperties().setProperty(PROPERTY_CATALOG_NAME, catalogName);
            }
            if (schemaName != null) {
                treeNode.getProperties().setProperty(PROPERTY_SCHEMA_NAME, schemaName);
            }

            list.add(treeNode);
        }
    }
    return list;
}

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  av  a  2  s . co 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.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexInfoPanelItem.java

License:Open Source License

@Override
protected Component getComponent(VertexRef ref, GraphContainer container) {
    final FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*from  ww  w.  ja  v  a  2s .c om*/
    formLayout.setMargin(false);

    ((AbstractBusinessServiceVertex) ref).accept(new BusinessServiceVertexVisitor<Void>() {
        @Override
        public Void visit(BusinessServiceVertex vertex) {
            final BusinessService businessService = businessServiceManager
                    .getBusinessServiceById(vertex.getServiceId());
            formLayout.addComponent(createLabel("Reduce function",
                    getReduceFunctionDescription(businessService.getReduceFunction())));

            // Apply Reduce Function specific details
            businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() {
                @Override
                public Void visit(HighestSeverity highestSeverity) {
                    return null;
                }

                @Override
                public Void visit(HighestSeverityAbove highestSeverityAbove) {
                    return null;
                }

                @Override
                // Threshold is not very transparent, we add an Explain Button in these cases
                public Void visit(Threshold threshold) {
                    final Button explainButton = createButton("Explain", "Explain the Threshold function",
                            FontAwesome.TABLE, (Button.ClickListener) event -> {
                                ThresholdExplanationWindow explainWindow = new ThresholdExplanationWindow(
                                        SimulationAwareStateMachineFactory
                                                .createSimulatedStateMachine(businessServiceManager,
                                                        container.getCriteria())
                                                .explain(businessService,
                                                        (Threshold) businessService.getReduceFunction()));
                                UI.getCurrent().addWindow(explainWindow);
                            });
                    explainButton.setStyleName(BaseTheme.BUTTON_LINK);
                    formLayout.addComponent(explainButton);
                    return null;
                }
            });
            return null;
        }

        @Override
        public Void visit(IpServiceVertex vertex) {
            IpService ipService = businessServiceManager.getIpServiceById(vertex.getIpServiceId());
            formLayout.addComponent(createLabel("Interface", ipService.getIpAddress()));
            formLayout.addComponent(createLabel("Service", ipService.getServiceName()));
            if (!ipService.getServiceName().equals(vertex.getLabel())) {
                formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
            }
            return null;
        }

        @Override
        public Void visit(ReductionKeyVertex vertex) {
            formLayout.addComponent(createLabel("Reduction Key", vertex.getReductionKey()));
            if (!vertex.getReductionKey().equals(vertex.getLabel())) {
                formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
            }
            return null;
        }
    });

    return formLayout;
}

From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexInfoPanelItemProvider.java

License:Open Source License

private Component createComponent(AbstractBusinessServiceVertex ref, GraphContainer graphContainer) {
    final FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*from   www  .ja  v  a2  s.c om*/
    formLayout.setMargin(false);

    ref.accept(new BusinessServiceVertexVisitor<Void>() {
        @Override
        public Void visit(BusinessServiceVertex vertex) {
            final BusinessService businessService = businessServiceManager
                    .getBusinessServiceById(vertex.getServiceId());
            formLayout.addComponent(createLabel("Reduce function",
                    getReduceFunctionDescription(businessService.getReduceFunction())));

            // Apply Reduce Function specific details
            businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() {
                @Override
                public Void visit(HighestSeverity highestSeverity) {
                    return null;
                }

                @Override
                public Void visit(HighestSeverityAbove highestSeverityAbove) {
                    return null;
                }

                @Override
                // Threshold is not very transparent, we add an Explain Button in these cases
                public Void visit(Threshold threshold) {
                    final Button explainButton = createButton("Explain", "Explain the Threshold function",
                            FontAwesome.TABLE, (Button.ClickListener) event -> {
                                ThresholdExplanationWindow explainWindow = new ThresholdExplanationWindow(
                                        SimulationAwareStateMachineFactory
                                                .createSimulatedStateMachine(businessServiceManager,
                                                        graphContainer.getCriteria())
                                                .explain(businessService,
                                                        (Threshold) businessService.getReduceFunction()));
                                UI.getCurrent().addWindow(explainWindow);
                            });
                    explainButton.setStyleName(BaseTheme.BUTTON_LINK);
                    formLayout.addComponent(explainButton);
                    return null;
                }

                @Override
                public Void visit(ExponentialPropagation exponentialPropagation) {
                    return null;
                }
            });
            return null;
        }

        @Override
        public Void visit(IpServiceVertex vertex) {
            IpService ipService = businessServiceManager.getIpServiceById(vertex.getIpServiceId());
            formLayout.addComponent(createLabel("Interface", ipService.getIpAddress()));
            formLayout.addComponent(createLabel("Service", ipService.getServiceName()));
            if (!ipService.getServiceName().equals(vertex.getLabel())) {
                formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
            }
            return null;
        }

        @Override
        public Void visit(ReductionKeyVertex vertex) {
            formLayout.addComponent(createLabel("Reduction Key", vertex.getReductionKey()));
            if (!vertex.getReductionKey().equals(vertex.getLabel())) {
                formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
            }
            return null;
        }
    });

    return formLayout;
}

From source file:pl.exsio.frameset.vaadin.module.util.usergen.UserGenModule.java

License:Open Source License

private CSVExporter createCsvExporter(Table csvTable) {
    CSVExporter exporter = new CSVExporter(csvTable);
    exporter.setCaption(t("export"));
    exporter.setIcon(FontAwesome.TABLE);
    return exporter;
}