Search in sources :

Example 36 with HorizontalLayout

use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.

the class FormPropertiesForm method initButtons.

protected void initButtons() {
    submitFormButton = new Button();
    cancelFormButton = new Button();
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidth(100, UNITS_PERCENTAGE);
    buttons.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    buttons.addComponent(submitFormButton);
    buttons.setComponentAlignment(submitFormButton, Alignment.BOTTOM_RIGHT);
    buttons.addComponent(cancelFormButton);
    buttons.setComponentAlignment(cancelFormButton, Alignment.BOTTOM_RIGHT);
    Label buttonSpacer = new Label();
    buttons.addComponent(buttonSpacer);
    buttons.setExpandRatio(buttonSpacer, 1.0f);
    addComponent(buttons);
}
Also used : Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 37 with HorizontalLayout

use of com.vaadin.ui.HorizontalLayout in project Activiti by Activiti.

the class TabbedSelectionWindow method initWindowLayout.

protected void initWindowLayout() {
    windowLayout = new HorizontalLayout();
    windowLayout.setSpacing(false);
    windowLayout.setMargin(true);
    windowLayout.setSizeFull();
    setContent(windowLayout);
}
Also used : HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 38 with HorizontalLayout

use of com.vaadin.ui.HorizontalLayout 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 39 with HorizontalLayout

use of com.vaadin.ui.HorizontalLayout 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)

Example 40 with HorizontalLayout

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

the class TopologyUI method getTabSheet.

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 *
 * @return TabSheet
 */
private Component getTabSheet(WidgetManager manager, WidgetContext widgetContext) {
    // Use an absolute layout for the bottom panel
    AbsoluteLayout bottomLayout = new AbsoluteLayout();
    bottomLayout.setSizeFull();
    tabSheet = new TabSheet();
    tabSheet.setSizeFull();
    for (IViewContribution viewContrib : manager.getWidgets()) {
        // Create a new view instance
        final Component view = viewContrib.getView(m_applicationContext, widgetContext);
        try {
            m_graphContainer.getSelectionManager().addSelectionListener((SelectionListener) view);
        } catch (ClassCastException e) {
        }
        try {
            ((SelectionNotifier) view).addSelectionListener(m_graphContainer.getSelectionManager());
        } catch (ClassCastException e) {
        }
        try {
            m_graphContainer.addChangeListener((GraphContainer.ChangeListener) view);
        } catch (ClassCastException e) {
        }
        // Icon can be null
        tabSheet.addTab(view, viewContrib.getTitle(), viewContrib.getIcon());
        // components to the tab bar
        try {
            Component[] extras = ((HasExtraComponents) view).getExtraComponents();
            if (extras != null && extras.length > 0) {
                // For any extra controls, add a horizontal layout that will float
                // on top of the right side of the tab panel
                final HorizontalLayout extraControls = new HorizontalLayout();
                extraControls.setHeight(32, Unit.PIXELS);
                extraControls.setSpacing(true);
                // Add the extra controls to the layout
                for (Component component : extras) {
                    extraControls.addComponent(component);
                    extraControls.setComponentAlignment(component, Alignment.MIDDLE_RIGHT);
                }
                // Add a TabSheet.SelectedTabChangeListener to show or hide the extra controls
                tabSheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

                    private static final long serialVersionUID = 6370347645872323830L;

                    @Override
                    public void selectedTabChange(SelectedTabChangeEvent event) {
                        final TabSheet source = (TabSheet) event.getSource();
                        if (source == tabSheet) {
                            // If the first tab was selected...
                            if (source.getSelectedTab() == view) {
                                extraControls.setVisible(true);
                            } else {
                                extraControls.setVisible(false);
                            }
                        }
                    }
                });
                // Place the extra controls on the absolute layout
                bottomLayout.addComponent(extraControls, "top:0px;right:5px;z-index:100");
            }
        } catch (ClassCastException e) {
        }
        view.setSizeFull();
    }
    // Add the tabsheet to the layout
    bottomLayout.addComponent(tabSheet, "top: 0; left: 0; bottom: 0; right: 0;");
    return bottomLayout;
}
Also used : HasExtraComponents(org.opennms.features.topology.api.HasExtraComponents) AbsoluteLayout(com.vaadin.ui.AbsoluteLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout) GraphContainer(org.opennms.features.topology.api.GraphContainer) SelectionNotifier(org.opennms.features.topology.api.SelectionNotifier) SelectedTabChangeEvent(com.vaadin.ui.TabSheet.SelectedTabChangeEvent) TabSheet(com.vaadin.ui.TabSheet) IViewContribution(org.opennms.features.topology.api.IViewContribution) SelectedTabChangeListener(com.vaadin.ui.TabSheet.SelectedTabChangeListener) LayoutHintComponent(org.opennms.features.topology.app.internal.ui.LayoutHintComponent) BreadcrumbComponent(org.opennms.features.topology.app.internal.ui.breadcrumbs.BreadcrumbComponent) Component(com.vaadin.ui.Component)

Aggregations

HorizontalLayout (com.vaadin.ui.HorizontalLayout)85 Label (com.vaadin.ui.Label)45 Button (com.vaadin.ui.Button)26 VerticalLayout (com.vaadin.ui.VerticalLayout)20 Embedded (com.vaadin.ui.Embedded)19 ClickEvent (com.vaadin.ui.Button.ClickEvent)17 ClickListener (com.vaadin.ui.Button.ClickListener)15 ExternalResource (com.vaadin.terminal.ExternalResource)7 GridLayout (com.vaadin.ui.GridLayout)7 TextField (com.vaadin.ui.TextField)6 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)6 StreamResource (com.vaadin.terminal.StreamResource)5 Link (com.vaadin.ui.Link)5 Panel (com.vaadin.ui.Panel)5 InputStream (java.io.InputStream)4 URL (java.net.URL)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)3 ExternalResource (com.vaadin.server.ExternalResource)3