Search in sources :

Example 11 with VerticalLayout

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

the class GrafanaDashletQuickRangePicker method createLayout.

private VerticalLayout createLayout(Map<String, QuickRange> quickRanges) {
    VerticalLayout verticalLayout = new VerticalLayout();
    for (final Map.Entry<String, QuickRange> entry : quickRanges.entrySet()) {
        Button button = new Button(entry.getKey());
        button.addStyleName(BaseTheme.BUTTON_LINK);
        button.addClickListener(e -> {
            for (QuickRangeListener quickRangeListener : quickRangeListeners) {
                quickRangeListener.quickRangeSelected(entry.getValue());
            }
            selectButton(button);
        });
        verticalLayout.addComponent(button);
        buttonMap.put(entry.getValue(), button);
    }
    return verticalLayout;
}
Also used : Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TreeMap(java.util.TreeMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 12 with VerticalLayout

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

the class JmxConfigGeneratorUI method initMainLayout.

/**
	 * Creates the main window and adds the header, main and button panels to
	 * it.
	 */
private void initMainLayout() {
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(headerPanel);
    layout.addComponent(contentPanel);
    layout.setSizeFull();
    // content Panel should use most of the space
    layout.setExpandRatio(contentPanel, 1);
    setContent(layout);
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 13 with VerticalLayout

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

the class WallboardUI method init.

/**
     * Entry point for a VAADIN application.
     *
     * @param request the {@link VaadinRequest} instance
     */
@Override
protected void init(VaadinRequest request) {
    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    rootLayout.setSpacing(true);
    HeaderLayout headerLayout = new HeaderLayout();
    rootLayout.addComponent(headerLayout);
    VerticalLayout portalWrapper = new VerticalLayout();
    portalWrapper.setSizeFull();
    portalWrapper.setMargin(true);
    rootLayout.addComponent(portalWrapper);
    rootLayout.setExpandRatio(portalWrapper, 1);
    setContent(rootLayout);
    Navigator navigator = new Navigator(this, portalWrapper);
    navigator.addView("dashboard", DashboardView.class);
    navigator.addView("wallboard", WallboardView.class);
    navigator.navigateTo("wallboard");
    BeanItemContainer<Wallboard> beanItemContainer = WallboardProvider.getInstance().getBeanContainer();
    for (Wallboard wallboard : beanItemContainer.getItemIds()) {
        if (wallboard.isDefault()) {
            headerLayout.gotoWallboard(wallboard);
            break;
        }
    }
}
Also used : Wallboard(org.opennms.features.vaadin.dashboard.model.Wallboard) Navigator(com.vaadin.navigator.Navigator) VerticalLayout(com.vaadin.ui.VerticalLayout)

Example 14 with VerticalLayout

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

the class AlarmDetailsDashlet method createAlarmComponent.

/**
     * Returns the component for visualising the alarms data.
     *
     * @param onmsAlarm an {@link OnmsAlarm} instance
     * @param onmsNode  an {@link OnmsNode} instance
     * @return component for this alarm
     */
@Deprecated
public Component createAlarmComponent(OnmsAlarm onmsAlarm, OnmsNode onmsNode) {
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    horizontalLayout.addStyleName("alert-details");
    horizontalLayout.addStyleName("alert-details-font");
    horizontalLayout.addStyleName(onmsAlarm.getSeverity().name().toLowerCase());
    VerticalLayout verticalLayout1 = new VerticalLayout();
    VerticalLayout verticalLayout2 = new VerticalLayout();
    horizontalLayout.addComponent(verticalLayout1);
    horizontalLayout.addComponent(verticalLayout2);
    Label lastEvent = new Label();
    lastEvent.setSizeUndefined();
    lastEvent.addStyleName("alert-details-font");
    lastEvent.setCaption("Last event");
    lastEvent.setValue(StringUtils.toStringEfficiently(onmsAlarm.getLastEventTime()));
    Label firstEvent = new Label();
    firstEvent.setSizeUndefined();
    firstEvent.addStyleName("alert-details-font");
    firstEvent.setCaption("First event");
    firstEvent.setValue(StringUtils.toStringEfficiently(onmsAlarm.getFirstEventTime()));
    verticalLayout1.addComponent(firstEvent);
    verticalLayout1.addComponent(lastEvent);
    Label nodeId = new Label();
    nodeId.setSizeUndefined();
    nodeId.addStyleName("alert-details-font");
    nodeId.setCaption("Node Id");
    if (onmsNode != null) {
        nodeId.setValue(onmsNode.getNodeId());
    } else {
        nodeId.setValue("-");
    }
    Label nodeLabel = new Label();
    nodeLabel.setSizeUndefined();
    nodeLabel.addStyleName("alert-details-font");
    nodeLabel.setCaption("Node Label");
    if (onmsNode != null) {
        nodeLabel.setValue(onmsNode.getLabel());
    } else {
        nodeLabel.setValue("-");
    }
    Label logMessage = new Label();
    logMessage.addStyleName("alert-details-font");
    logMessage.setSizeFull();
    logMessage.setCaption("Log message");
    logMessage.setValue(onmsAlarm.getLogMsg().replaceAll("<[^>]*>", ""));
    HorizontalLayout horizontalLayout2 = new HorizontalLayout();
    horizontalLayout2.setSizeFull();
    horizontalLayout2.setSpacing(true);
    horizontalLayout2.addComponent(nodeId);
    horizontalLayout2.addComponent(nodeLabel);
    verticalLayout2.addComponent(horizontalLayout2);
    verticalLayout2.addComponent(logMessage);
    horizontalLayout.setExpandRatio(verticalLayout1, 1.0f);
    horizontalLayout.setExpandRatio(verticalLayout2, 4.0f);
    return horizontalLayout;
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 15 with VerticalLayout

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

the class WallboardConfigView method addNewTabComponent.

/**
     * This method is used to add a new {@link TabSheet.Tab} component. It creates a new window querying the user for the name of the new {@link Wallboard}.
     */
protected void addNewTabComponent() {
    final Window window = new Window("New Ops Board");
    window.setModal(true);
    window.setClosable(false);
    window.setResizable(false);
    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            m_dashboardOverview.refreshTable();
        }
    });
    getUI().addWindow(window);
    window.setContent(new VerticalLayout() {

        TextField name = new TextField("Ops Board Name");

        {
            addComponent(new FormLayout() {

                {
                    setSizeUndefined();
                    setMargin(true);
                    String newName = "Untitled";
                    int i = 1;
                    if (WallboardProvider.getInstance().containsWallboard(newName)) {
                        do {
                            i++;
                            newName = "Untitled #" + i;
                        } while (WallboardProvider.getInstance().containsWallboard(newName));
                    }
                    name.setValue(newName);
                    addComponent(name);
                    name.focus();
                    name.selectAll();
                    name.addValidator(new AbstractStringValidator("Title must be unique") {

                        @Override
                        protected boolean isValidValue(String s) {
                            return (!WallboardProvider.getInstance().containsWallboard(s) && !"".equals(s));
                        }
                    });
                }
            });
            addComponent(new HorizontalLayout() {

                {
                    setMargin(true);
                    setSpacing(true);
                    setWidth("100%");
                    Button cancel = new Button("Cancel");
                    cancel.setDescription("Cancel editing");
                    cancel.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            // NMS-7560: Toggle the tab in order to allow us to click it again
                            m_tabSheet.togglePlusTab();
                            window.close();
                        }
                    });
                    cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
                    addComponent(cancel);
                    setExpandRatio(cancel, 1);
                    setComponentAlignment(cancel, Alignment.TOP_RIGHT);
                    Button ok = new Button("Save");
                    ok.setDescription("Save configuration");
                    ok.addClickListener(new Button.ClickListener() {

                        @Override
                        public void buttonClick(Button.ClickEvent event) {
                            if (name.isValid()) {
                                Wallboard wallboard = new Wallboard();
                                wallboard.setTitle(name.getValue());
                                WallboardProvider.getInstance().addWallboard(wallboard);
                                WallboardProvider.getInstance().save();
                                WallboardEditor wallboardEditor = new WallboardEditor(m_dashletSelector, wallboard);
                                TabSheet.Tab tab = m_tabSheet.addTab(wallboardEditor, wallboard.getTitle());
                                wallboardEditor.setTab(tab);
                                m_wallboardEditorMap.put(wallboard, tab);
                                tab.setClosable(true);
                                m_tabSheet.setSelectedTab(tab);
                                window.close();
                            }
                        }
                    });
                    ok.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
                    addComponent(ok);
                }
            });
        }
    });
}
Also used : Window(com.vaadin.ui.Window) FormLayout(com.vaadin.ui.FormLayout) AbstractStringValidator(com.vaadin.data.validator.AbstractStringValidator) Wallboard(org.opennms.features.vaadin.dashboard.model.Wallboard) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Tab(com.vaadin.ui.TabSheet.Tab) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField)

Aggregations

VerticalLayout (com.vaadin.ui.VerticalLayout)75 Label (com.vaadin.ui.Label)33 HorizontalLayout (com.vaadin.ui.HorizontalLayout)21 Link (com.vaadin.ui.Link)13 Button (com.vaadin.ui.Button)12 ExternalResource (com.vaadin.server.ExternalResource)9 ClickEvent (com.vaadin.ui.Button.ClickEvent)8 PostConstruct (javax.annotation.PostConstruct)8 Panel (com.vaadin.ui.Panel)7 ClickListener (com.vaadin.ui.Button.ClickListener)6 Embedded (com.vaadin.ui.Embedded)5 ExternalResource (com.vaadin.terminal.ExternalResource)4 StreamResource (com.vaadin.terminal.StreamResource)4 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)3 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)3 InputStream (java.io.InputStream)3 PrettyTimeLabel (org.activiti.explorer.ui.custom.PrettyTimeLabel)3 Resource (com.vaadin.terminal.Resource)2 StreamSource (com.vaadin.terminal.StreamResource.StreamSource)2 CssLayout (com.vaadin.ui.CssLayout)2