Example usage for com.vaadin.ui VerticalLayout setSizeFull

List of usage examples for com.vaadin.ui VerticalLayout setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSizeFull.

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java

License:Apache License

private void createMainComponent() {
    VerticalLayout main = new VerticalLayout();
    main.setMargin(false);/*from w ww. j a v a  2s.co m*/
    main.setSizeFull();
    main.addComponent(createToolbar());

    mainSplitPanel = new HorizontalSplitPanel();
    mainSplitPanel.setMargin(false);
    mainSplitPanel.setMaxSplitPosition(80f, HorizontalSplitPanel.UNITS_PERCENTAGE);
    mainSplitPanel.setMinSplitPosition(20f, HorizontalSplitPanel.UNITS_PERCENTAGE);
    mainSplitPanel.setSizeFull();
    mainSplitPanel.setSplitPosition(30f, HorizontalSplitPanel.UNITS_PERCENTAGE);

    taskTable = createTable();
    mainSplitPanel.setFirstComponent(taskTable);

    displayEmptyTask();

    main.addComponent(mainSplitPanel);
    main.setExpandRatio(mainSplitPanel, 1.0f);
    mainComponent = main;
}

From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java

License:Apache License

private Component createTaskSummary(UserTask task) {

    //      TextField name = new TextField("Name");
    //      name.setValue(task.getName());
    //      name.setReadOnly(true);
    //      name.setWidth("100%");

    TextField priority = new TextField("Priority");
    priority.setValue(Integer.toString(task.getPriority()));
    priority.setReadOnly(true);//from ww w .j ava  2s . c o m

    TextField status = new TextField("Status");
    status.setValue(task.getStatus().getDescription());
    status.setReadOnly(true);

    TextArea description = new TextArea("Description");
    description.setSizeFull();
    description.setValue(task.getDescription());
    description.setReadOnly(true);
    description.setRows(3);

    ComponentContainer buttons = createSummaryButtons(task);

    VerticalLayout secondColumnFields = new VerticalLayout();
    secondColumnFields.setMargin(false);
    secondColumnFields.setSizeFull();

    secondColumnFields.addComponent(priority);
    secondColumnFields.addComponent(status);

    HorizontalLayout fieldsLayout = new HorizontalLayout();
    fieldsLayout.setSizeFull();
    fieldsLayout.setMargin(false);
    fieldsLayout.setSpacing(false);
    fieldsLayout.addComponent(description);
    fieldsLayout.addComponent(secondColumnFields);
    fieldsLayout.setExpandRatio(description, 4.0f);
    fieldsLayout.setExpandRatio(secondColumnFields, 1.0f);

    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(false);
    mainLayout.setSizeFull();
    mainLayout.addComponent(fieldsLayout);
    mainLayout.addComponent(buttons);
    mainLayout.setComponentAlignment(buttons, Alignment.TOP_LEFT);
    mainLayout.setExpandRatio(fieldsLayout, 1.0f);

    Panel panel = new Panel("Summary");
    panel.setStyleName("background-transparent");
    panel.setContent(mainLayout);

    return panel;
}

From source file:org.opennms.features.jmxconfiggenerator.webui.ui.ConfigResultView.java

License:Open Source License

public ConfigResultView(JmxConfigGeneratorApplication app) {
    this.app = app;
    setSizeFull();/*  www .ja  v a 2s  .  c  o  m*/

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.addComponent(tabSheet);
    mainLayout.addComponent(buttonPanel);

    tabSheet.setSizeFull();
    // TODO set tab name differently (e.g. SNMP Graph properties snippet)
    tabContentMap.put(OutputDataKey.JmxDataCollectionConfig,
            new TabContent(OutputDataKey.JmxDataCollectionConfig));
    tabContentMap.put(OutputDataKey.SnmpGraphProperties, new TabContent(OutputDataKey.SnmpGraphProperties));
    tabContentMap.put(OutputDataKey.CollectdConfigSnippet, new TabContent(OutputDataKey.CollectdConfigSnippet));

    // add all tabs
    for (TabContent eachContent : tabContentMap.values())
        tabSheet.addTab(eachContent, eachContent.getCaption());
    tabSheet.setSelectedTab(0); // select first component!

    buttonPanel.getNext().setVisible(false); // TODO MVR enable button again and allow to download
    buttonPanel.getNext().setCaption("download all");
    buttonPanel.getNext().setIcon(IconProvider.getIcon(IconProvider.BUTTON_SAVE));

    mainLayout.setExpandRatio(tabSheet, 1);
    setCompositionRoot(mainLayout);
}

From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.MBeansView.java

License:Open Source License

private Layout initContentPanel(NameEditForm form, MBeansContentTabSheet tabSheet) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setSpacing(false);/*from   w w  w  .j a  va 2 s . c  o m*/
    layout.addComponent(form);
    layout.addComponent(tabSheet);
    layout.setExpandRatio(tabSheet, 1);
    return layout;
}

From source file:org.opennms.features.jmxconfiggenerator.webui.ui.mbeans.MBeansView.java

License:Open Source License

private Panel wrapToPanel(Component component) {
    Panel panel = new Panel(component.getCaption());
    panel.setSizeFull();//from  www .  ja  v  a  2  s.c  om

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);
    layout.setSpacing(false);
    layout.setSizeFull();
    layout.addComponent(component);

    panel.setContent(layout);
    component.setCaption(null);
    return panel;
}

From source file:org.opennms.features.pluginmgr.vaadin.pluginmanager.ErrorMessageWindow.java

License:Apache License

public ErrorMessageWindow(SystemMessages systemMessages) {
    super("Full Log Message"); // Set window caption
    center();// w  ww  .  ja v  a  2 s.co  m
    setHeight("75%");
    setWidth("75%");

    // Some basic content for the window
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();

    TextArea ta = new TextArea();
    ta.setWordwrap(true);
    ta.setImmediate(true);
    ta.setWidth("100%");
    ta.setHeight("100%");
    content.addComponent(ta);
    content.setExpandRatio(ta, 1.0f);

    if (systemMessages != null) {
        ta.setValue(systemMessages.getLongMessage());
    } else {
        ta.setValue("Error: systemMessages should not be null");
        LOG.error("Error: systemMessages should not be null");
    }
    ta.setReadOnly(false);

    content.setMargin(true);
    setContent(content);

    // Disable the close button
    setClosable(false);

    // Trivial logic for closing the sub-window
    Button ok = new Button("OK");
    ok.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            close(); // Close the sub-window
        }
    });
    content.addComponent(ok);
}

From source file:org.opennms.features.topology.app.internal.ui.icons.IconSelectionDialog.java

License:Open Source License

public IconSelectionDialog(String selectedIconId) {
    setCaption("Change Icon");
    setModal(true);// ww w .j av  a2  s .  com
    setResizable(false);
    setClosable(false);
    setWidth(700, Unit.PIXELS);
    setHeight(600, Sizeable.Unit.PIXELS);
    addCloseListener(this);

    okButton = new Button("Ok", this);
    okButton.setId("iconSelectionDialog.button.ok");
    cancelButton = new Button("Cancel", this);
    cancelButton.setId("iconSelectionDialog.button.cancel");

    iconSelectionComponent = new IconSelectionComponent(getElementsToShow(), selectedIconId);
    VerticalLayout iconLayout = new VerticalLayout();
    iconLayout.addStyleName("icon-selection-component");
    iconLayout.setSpacing(true);
    iconLayout.setSizeFull();
    iconLayout.addComponent(iconSelectionComponent);

    final HorizontalLayout buttonLayout = new HorizontalLayout(okButton, cancelButton);
    buttonLayout.setSpacing(true);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.setSizeFull();
    mainLayout.addComponent(iconLayout);
    mainLayout.addComponent(buttonLayout);
    mainLayout.setExpandRatio(iconLayout, 1);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    setContent(mainLayout);
    center();
}

From source file:org.opennms.features.topology.netutils.internal.EventsAlarmsWindow.java

License:Open Source License

/**
 * The EventsAlarmsWindow method constructs a sub-window instance which can be added to a
 * main window. The sub-window contains two embedded browsers which are directed at the Events
 * and Alarms page of the selected node/*from   www .ja  va  2  s.  c om*/
 * @param node Selected node
 * @param width Width of main window
 * @param height Height of main window
 * @throws MalformedURLException
 */
public EventsAlarmsWindow(final Node node, final URL eventsURL, final URL alarmsURL)
        throws MalformedURLException {
    super("Events & Alarms" + makeLabel(node));
    eventsBrowser = new Embedded("", new ExternalResource(eventsURL));
    eventsBrowser.setSizeFull();
    alarmsBrowser = new Embedded("", new ExternalResource(alarmsURL));
    alarmsBrowser.setSizeFull();

    setImmediate(true);
    setResizable(false);

    /*Adds the two browsers to separate tabs in a tabsheet layout*/
    m_tabSheet = new TabSheet();
    m_tabSheet.setSizeFull();
    m_tabSheet.addTab(eventsBrowser, "Events");
    m_tabSheet.addTab(alarmsBrowser, "Alarms");

    /*Adds tabsheet component to the main layout of the sub-window*/
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(m_tabSheet);
    layout.setSizeFull();
    setContent(layout);

}

From source file:org.opennms.features.topology.netutils.internal.TracerouteWindow.java

License:Open Source License

/**
 * The TracerouteWindow method constructs a TracerouteWindow component with a size proportionate to the 
 * width and height of the main window./*w  w w .j av a  2s  . co m*/
 * @param node 
 * @param width Width of Main window
 * @param height Height of Main window
 */
public TracerouteWindow(final Node node, final String url) {

    this.tracerouteUrl = url;

    String label = "";
    String ipAddress = "";
    if (node != null) {
        label = node.getLabel();
        ipAddress = node.getIPAddress();
    }
    String caption = "";
    /*Sets up window settings*/
    if (label == null || label.equals("") || label.equalsIgnoreCase(noLabel)) {
        label = "";
    }
    if (!label.equals(""))
        caption = " - " + label;
    setCaption("Traceroute" + caption);
    setImmediate(true);
    setResizable(false);

    /*Initialize the header of the Sub-window with the name of the selected Node*/
    String nodeName = "<div style=\"text-align: center; font-size: 18pt; font-weight:bold;\">" + label
            + "</div>";
    nodeLabel = new Label(nodeName);
    nodeLabel.setContentMode(ContentMode.HTML);

    /*Creating various layouts to encapsulate all of the components*/
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    vSplit = new VerticalSplitPanel();
    topLayout = new VerticalLayout();
    bottomLayout = new VerticalLayout();
    VerticalLayout form = new VerticalLayout();
    GridLayout grid = new GridLayout(2, 2);
    grid.setWidth("420");
    grid.setHeight("62");

    /*Sets up IP Address dropdown with the Name as default*/
    ipDropdown = new NativeSelect();
    ipDropdown.addItem(ipAddress);
    ipDropdown.select(ipAddress);

    /*Creates the Numerical Output Check box and sets up the listener*/
    numericalDataCheckBox = new CheckBox("Use Numerical Node Names");
    numericalDataCheckBox.setImmediate(true);
    numericalDataCheckBox.setValue(false);

    /*Creates the form labels and text fields*/
    Label ipLabel = new Label("IP Address: ");
    Label forcedHopLabel = new Label("Forced Hop IP: ");
    forcedHopField = new TextField();
    forcedHopField.setMaxLength(15);

    /*Add all of the components to the GridLayout*/
    grid.addComponent(ipLabel);
    grid.setComponentAlignment(ipLabel, Alignment.MIDDLE_LEFT);
    grid.addComponent(ipDropdown);
    grid.setComponentAlignment(ipDropdown, Alignment.MIDDLE_LEFT);
    grid.addComponent(forcedHopLabel);
    grid.setComponentAlignment(forcedHopLabel, Alignment.MIDDLE_LEFT);
    grid.addComponent(forcedHopField);
    grid.setComponentAlignment(forcedHopField, Alignment.MIDDLE_LEFT);

    /*Creates the Ping button and sets up the listener*/
    tracerouteButton = new Button("Traceroute");
    tracerouteButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            changeBrowserURL(buildURL());
        }
    });

    /*Adds components to the form and sets the width and spacing*/
    form.addComponent(grid);
    form.addComponent(numericalDataCheckBox);
    form.addComponent(tracerouteButton);
    form.setWidth("100%");
    form.setSpacing(true);

    /*Adds components to the Top Layout and sets the width and margins*/
    topLayout.addComponent(nodeLabel);
    topLayout.setComponentAlignment(nodeLabel, Alignment.MIDDLE_CENTER);
    topLayout.addComponent(form);
    topLayout.setSizeFull();
    topLayout.setMargin(new MarginInfo(true, true, false, true));

    /*Adds components to the Bottom Layout and sets the width and margins*/
    bottomLayout.setSizeFull();
    bottomLayout.setMargin(true);
    bottomLayout.setImmediate(true);

    buildEmbeddedBrowser();

    /*Setting first and second components for the split panel and setting the panel divider position*/
    vSplit.setFirstComponent(topLayout);
    vSplit.setSecondComponent(bottomLayout);
    vSplit.setSplitPosition(splitHeight, Unit.PIXELS);
    vSplit.setLocked(true);

    /*Adds split panel to the main layout and expands the split panel to 100% of the layout space*/
    mainLayout.addComponent(vSplit);
    mainLayout.setExpandRatio(vSplit, 1);

    setContent(mainLayout);
}

From source file:org.opennms.features.vaadin.dashboard.config.ui.PropertiesWindow.java

License:Open Source License

/**
 * Constructor for instantiating a {@link PropertiesWindow} for a given {@link DashletSpec}.
 *
 * @param dashletSpec    the {@link DashletSpec} to edit
 * @param dashletFactory the {@link DashletFactory} for querying the property data
 *//*from  ww  w  .j  a  v a  2 s  . c o  m*/
public PropertiesWindow(final DashletSpec dashletSpec, final DashletFactory dashletFactory) {
    /**
     * Using a vertical layout for content
     */
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);
    //verticalLayout.addStyleName("debug");
    verticalLayout.setSizeFull();
    verticalLayout.setHeight(100, Unit.PERCENTAGE);

    /**
     * Setting up the table object for displaying the parameters
     */
    final Table table = new Table();

    table.setTableFieldFactory(new DefaultFieldFactory() {
        @Override
        public Field<?> createField(Container container, Object itemId, Object propertyId,
                Component uiContext) {
            Field<?> field = super.createField(container, itemId, propertyId, uiContext);
            if (propertyId.equals("Key")) {
                field.setReadOnly(true);
            } else {
                field.setSizeFull();
            }
            return field;
        }
    });

    table.setEditable(true);
    table.setSizeFull();
    table.setImmediate(true);

    table.addContainerProperty("Key", String.class, "");
    table.addContainerProperty("Value", String.class, "");

    /**
     * Filling the date with parameter data
     */
    final Map<String, String> requiredParameters = dashletFactory.getRequiredParameters();

    for (Map.Entry<String, String> entry : requiredParameters.entrySet()) {
        table.addItem(new Object[] { entry.getKey(), dashletSpec.getParameters().get(entry.getKey()) },
                entry.getKey());
    }

    table.setColumnWidth("Key", 100);
    table.setColumnWidth("Value", -1);
    table.setSizeFull();
    verticalLayout.addComponent(table);

    /**
     * Using an additional {@link HorizontalLayout} for layouting the buttons
     */
    HorizontalLayout horizontalLayout = new HorizontalLayout();

    horizontalLayout.setMargin(true);
    horizontalLayout.setSpacing(true);
    horizontalLayout.setWidth(100, Unit.PERCENTAGE);

    /**
     * Adding the cancel button...
     */
    Button cancel = new Button("Cancel");
    cancel.setDescription("Cancel editing properties");
    cancel.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            close();
        }
    });

    cancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE, null);
    horizontalLayout.addComponent(cancel);
    horizontalLayout.setExpandRatio(cancel, 1);
    horizontalLayout.setComponentAlignment(cancel, Alignment.TOP_RIGHT);

    /**
     * ...and the OK button
     */
    Button ok = new Button("Save");
    ok.setDescription("Save properties and close");

    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            for (Map.Entry<String, String> entry : requiredParameters.entrySet()) {
                String newValue = table.getItem(entry.getKey()).getItemProperty("Value").getValue().toString();
                dashletSpec.getParameters().put(entry.getKey(), newValue);
            }

            WallboardProvider.getInstance().save();
            ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Properties");

            close();
        }
    });

    ok.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
    horizontalLayout.addComponent(ok);
    //horizontalLayout.addStyleName("debug");

    /**
     * Adding the layout and setting the content
     */
    verticalLayout.addComponent(horizontalLayout);

    verticalLayout.setExpandRatio(table, 1.0f);

    setContent(verticalLayout);
}