Search in sources :

Example 6 with Label

use of com.vaadin.ui.Label in project opennms by OpenNMS.

the class PluginManagerAdminApplication method init.

/* (non-Javadoc)
	 * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
	 */
@Override
public void init(VaadinRequest request) {
    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);
    // dynamically inject style for non write borders - avoids changing themes css
    // Get the stylesheet of the page
    Styles styles = Page.getCurrent().getStyles();
    // inject the new font size as a style. We need .v-app to override Vaadin's default styles here
    styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    addHeader(request);
    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);
        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            // adds space between links
            Label label = new Label("   ", ContentMode.HTML);
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }
    PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager);
    m_rootLayout.addComponent(pluginManagerUIMainPanel);
    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f);
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) PluginManagerUIMainPanel(org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) Styles(com.vaadin.server.Page.Styles) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 7 with Label

use of com.vaadin.ui.Label in project opennms by OpenNMS.

the class InfoPanel method refreshInfoArea.

private void refreshInfoArea() {
    removeAllComponents();
    if (expanded) {
        staticComponents.forEach(sc -> addComponent(sc));
        dynamicComponents.forEach(c -> addComponent(c));
        // Add an empty component with width = 350px to always force the max length
        // This is required as otherwise the left area of the info panel would be empty, even if the info panel
        // is not shown.
        Label label = new Label();
        label.setWidth(350, Unit.PIXELS);
        addComponent(label);
        // Add a graph container to trigger backshift graph renderings on each update
        addComponent(new InlineGraphContainer());
    } else {
        addComponent(toggleButton);
    }
}
Also used : Label(com.vaadin.ui.Label) InlineGraphContainer(org.opennms.features.vaadin.components.graph.InlineGraphContainer)

Example 8 with Label

use of com.vaadin.ui.Label in project opennms by OpenNMS.

the class ToolbarPanel method handleLayerButton.

private void handleLayerButton(GraphContainer graphContainer) {
    // Toggle layer button
    boolean enableLayerButton = graphContainer.getTopologyServiceClient().getGraphProviders().size() > 1;
    layerButton.setEnabled(enableLayerButton);
    // update the layer layout
    layerLayout.removeAllComponents();
    if (enableLayerButton) {
        graphContainer.getTopologyServiceClient().getGraphProviders().forEach(topologyProvider -> {
            boolean selected = topologyProvider.getNamespace().equals(graphContainer.getTopologyServiceClient().getNamespace());
            final TopologyProviderInfo topologyProviderInfo = topologyProvider.getTopologyProviderInfo();
            final Label nameLabel = new Label(topologyProviderInfo.getName());
            VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.addComponent(nameLabel);
            verticalLayout.addStyleName(Styles.LAYOUT);
            if (selected) {
                verticalLayout.addStyleName(Styles.SELECTED);
            }
            verticalLayout.addLayoutClickListener((event) -> graphContainer.selectTopologyProvider(topologyProvider, Callbacks.applyDefaults()));
            layerLayout.addComponent(verticalLayout);
        });
    } else {
        setLayerLayoutVisible(false);
    }
}
Also used : Label(com.vaadin.ui.Label) TopologyProviderInfo(org.opennms.features.topology.api.topo.TopologyProviderInfo) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 9 with Label

use of com.vaadin.ui.Label in project opennms by OpenNMS.

the class BreadcrumbComponent method graphChanged.

@Override
public void graphChanged(GraphContainer graphContainer) {
    final BreadcrumbCriteria criteria = Criteria.getSingleCriteriaForGraphContainer(graphContainer, BreadcrumbCriteria.class, true);
    final HorizontalLayout breadcrumbLayout = (HorizontalLayout) getCompositionRoot();
    breadcrumbLayout.removeAllComponents();
    // Verify that breadcrumbs are enabled
    if (graphContainer.getTopologyServiceClient().getBreadcrumbStrategy() == BreadcrumbStrategy.SHORTEST_PATH_TO_ROOT) {
        final Collection<Vertex> displayVertices = graphContainer.getGraph().getDisplayVertices();
        if (!displayVertices.isEmpty()) {
            final PathTree pathTree = BreadcrumbPathCalculator.findPath(graphContainer.getTopologyServiceClient(), displayVertices.stream().map(v -> (VertexRef) v).collect(Collectors.toSet()));
            final List<Breadcrumb> breadcrumbs = pathTree.toBreadcrumbs();
            criteria.setBreadcrumbs(breadcrumbs);
        }
        for (Breadcrumb eachBreadcrumb : criteria.getBreadcrumbs()) {
            if (breadcrumbLayout.getComponentCount() >= 1) {
                breadcrumbLayout.addComponent(new Label(" > "));
            }
            breadcrumbLayout.addComponent(createButton(graphContainer, eachBreadcrumb));
        }
    }
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) Label(com.vaadin.ui.Label) Breadcrumb(org.opennms.features.topology.api.support.breadcrumbs.Breadcrumb) BreadcrumbCriteria(org.opennms.features.topology.api.support.breadcrumbs.BreadcrumbCriteria) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 10 with Label

use of com.vaadin.ui.Label in project opennms by OpenNMS.

the class BSMDashlet method createRow.

private HorizontalLayout createRow(BusinessService service) {
    HorizontalLayout rowLayout = new HorizontalLayout();
    rowLayout.setSizeFull();
    rowLayout.setSpacing(true);
    final Status severity = m_businessServiceManager.getOperationalStatus(service);
    Label nameLabel = new Label(service.getName());
    nameLabel.setSizeFull();
    nameLabel.setStyleName("h3");
    nameLabel.addStyleName("bright");
    nameLabel.addStyleName("severity");
    nameLabel.addStyleName(severity.getLabel());
    rowLayout.addComponent(nameLabel);
    return rowLayout;
}
Also used : Status(org.opennms.netmgt.bsm.service.model.Status) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

Label (com.vaadin.ui.Label)158 HorizontalLayout (com.vaadin.ui.HorizontalLayout)45 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)40 VerticalLayout (com.vaadin.ui.VerticalLayout)33 Embedded (com.vaadin.ui.Embedded)29 Button (com.vaadin.ui.Button)18 GridLayout (com.vaadin.ui.GridLayout)17 Link (com.vaadin.ui.Link)14 ClickEvent (com.vaadin.ui.Button.ClickEvent)13 Table (com.vaadin.ui.Table)13 ClickListener (com.vaadin.ui.Button.ClickListener)11 TextField (com.vaadin.ui.TextField)10 Item (com.vaadin.data.Item)9 ExternalResource (com.vaadin.server.ExternalResource)9 StreamResource (com.vaadin.terminal.StreamResource)8 PostConstruct (javax.annotation.PostConstruct)8 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)6 ExternalResource (com.vaadin.terminal.ExternalResource)6 Component (com.vaadin.ui.Component)6 Panel (com.vaadin.ui.Panel)5