List of usage examples for com.vaadin.server FontAwesome RETWEET
FontAwesome RETWEET
To view the source code for com.vaadin.server FontAwesome RETWEET.
Click Source Link
From source file:org.opennms.netmgt.bsm.vaadin.adminpage.BusinessServiceMainLayout.java
License:Open Source License
public BusinessServiceMainLayout(BusinessServiceManager businessServiceManager) { m_businessServiceManager = Objects.requireNonNull(businessServiceManager); m_table = new BusinessServiceTreeTable(businessServiceManager); setSizeFull();//from ww w. j ava 2 s .co m // Create button final Button createButton = UIHelper.createButton("New Business Service", null, FontAwesome.PLUS_SQUARE, (Button.ClickListener) event -> { final BusinessService businessService = m_businessServiceManager.createBusinessService(); final BusinessServiceEditWindow window = new BusinessServiceEditWindow(businessService, m_businessServiceManager); window.addCloseListener(e -> m_table.refresh()); getUI().addWindow(window); }); createButton.setId("createButton"); // Collapse all final Button collapseButton = UIHelper.createButton("Collapse All", null, FontAwesome.FOLDER, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, true)); }); collapseButton.setId("collapseButton"); // Expand all final Button expandButton = UIHelper.createButton("Expand All", null, FontAwesome.FOLDER_OPEN, (Button.ClickListener) event -> { m_table.getContainerDataSource().getItemIds().forEach(id -> m_table.setCollapsed(id, false)); }); expandButton.setId("expandButton"); // Refresh final Button refreshButton = UIHelper.createButton("Refresh Table", null, FontAwesome.REFRESH, (Button.ClickListener) event -> { m_table.refresh(); }); refreshButton.setId("refreshButton"); // Reload daemon final Button reloadButton = UIHelper.createButton("Reload Daemon", "Reloads the Business Service State Machine", FontAwesome.RETWEET, (Button.ClickListener) event -> { m_businessServiceManager.triggerDaemonReload(); }); reloadButton.setId("reloadButton"); // Group the create and collapse buttons on the left HorizontalLayout leftButtonGroup = new HorizontalLayout(); leftButtonGroup.setSpacing(true); leftButtonGroup.addComponent(createButton); leftButtonGroup.addComponent(collapseButton); leftButtonGroup.addComponent(expandButton); leftButtonGroup.setDefaultComponentAlignment(Alignment.TOP_LEFT); // Group the refresh and reload buttons to the right HorizontalLayout rightButtonGroup = new HorizontalLayout(); rightButtonGroup.setSpacing(true); rightButtonGroup.addComponent(refreshButton); rightButtonGroup.addComponent(reloadButton); rightButtonGroup.setDefaultComponentAlignment(Alignment.TOP_RIGHT); // Build the upper layout HorizontalLayout upperLayout = new HorizontalLayout(); upperLayout.setSpacing(true); upperLayout.addComponent(leftButtonGroup); upperLayout.addComponent(rightButtonGroup); upperLayout.setComponentAlignment(leftButtonGroup, Alignment.TOP_LEFT); upperLayout.setComponentAlignment(rightButtonGroup, Alignment.TOP_RIGHT); upperLayout.setWidth(100, Unit.PERCENTAGE); addComponent(upperLayout); // Add some space between the upper layout and the table Label sz = new Label(""); sz.setWidth(null); sz.setHeight(5, Unit.PIXELS); addComponent(sz); /** * add the table to the layout */ addComponent(m_table); setExpandRatio(m_table, 1.0f); /** * initial refresh of table */ m_table.refresh(); }