Example usage for com.vaadin.ui HorizontalLayout setHeight

List of usage examples for com.vaadin.ui HorizontalLayout setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui HorizontalLayout setHeight.

Prototype

@Override
    public void setHeight(float height, Unit unit) 

Source Link

Usage

From source file:org.ikasan.dashboard.ui.topology.window.CategorisedErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(4, 7);
    layout.setWidth("100%");
    layout.setSpacing(true);//from   w  ww.jav  a  2 s .  co m
    layout.setColumnExpandRatio(0, .10f);
    layout.setColumnExpandRatio(1, .30f);
    layout.setColumnExpandRatio(2, .05f);
    layout.setColumnExpandRatio(3, .30f);

    Label errorOccurrenceDetailsLabel = new Label(" Categorised Error Occurence Details", ContentMode.HTML);
    Label errorCategoryLabel = new Label();

    if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.BLOCKER)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.BAN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.BAN.getHtml() + " Blocker", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.CRITICAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.EXCLAMATION.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.EXCLAMATION.getHtml() + " Critical", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.MAJOR)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_UP.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_UP.getHtml() + " Major", ContentMode.HTML);
    } else if (categorisedErrorOccurrence.getErrorCategorisation().getErrorCategory()
            .equals(ErrorCategorisation.TRIVIAL)) {
        errorOccurrenceDetailsLabel = new Label(
                VaadinIcons.ARROW_DOWN.getHtml() + " Categorised Error Occurence Details", ContentMode.HTML);
        errorCategoryLabel = new Label(VaadinIcons.ARROW_DOWN.getHtml() + " Trivial", ContentMode.HTML);
    }

    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 3, 0);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.categorisedErrorOccurrence.getErrorOccurrence().getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    Label errorMessageLabel = new Label("Error Message:");
    errorMessageLabel.setSizeUndefined();
    layout.addComponent(errorMessageLabel, 0, 5);
    layout.setComponentAlignment(errorMessageLabel, Alignment.TOP_RIGHT);

    final TextArea errorMessageTextArea = new TextArea();
    errorMessageTextArea.setWidth("650px");
    errorMessageTextArea.setRows(6);
    errorMessageTextArea
            .setValue(this.categorisedErrorOccurrence.getErrorCategorisation().getErrorDescription());

    layout.addComponent(errorMessageTextArea, 1, 5, 3, 5);

    AceEditor editor = new AceEditor();
    editor.setCaption("Error Details");
    editor.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    label = new Label("Error Category:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    layout.addComponent(errorCategoryLabel, 3, 1);
    layout.setComponentAlignment(errorCategoryLabel, Alignment.MIDDLE_LEFT);

    label = new Label("System Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField systemAction = new TextField();
    systemAction.setValue(this.categorisedErrorOccurrence.getErrorOccurrence().getAction());
    systemAction.setReadOnly(true);
    systemAction.setWidth("80%");
    layout.addComponent(systemAction, 3, 2);

    label = new Label("User Action:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField userAction = new TextField();
    userAction.setValue("");
    userAction.setReadOnly(true);
    userAction.setWidth("80%");
    layout.addComponent(userAction, 3, 3);

    label = new Label("User Action By:");
    label.setSizeUndefined();
    layout.addComponent(label, 2, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    Label userActionBy = new Label();
    userActionBy.setValue("");
    userActionBy.setReadOnly(true);
    userActionBy.setWidth("80%");
    layout.addComponent(userActionBy, 3, 4);

    AceEditor eventEditor = new AceEditor();
    eventEditor.setCaption("Event Payload");

    if (this.categorisedErrorOccurrence.getErrorOccurrence().getEvent() != null) {
        eventEditor
                .setValue(new String((byte[]) this.categorisedErrorOccurrence.getErrorOccurrence().getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(300, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    //      wrapperLayout.addComponent(vSplitPanel, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.ikasan.dashboard.ui.topology.window.ErrorOccurrenceViewWindow.java

License:BSD License

protected Panel createErrorOccurrenceDetailsPanel() {
    Panel errorOccurrenceDetailsPanel = new Panel();

    GridLayout layout = new GridLayout(2, 6);
    layout.setSizeFull();/*w  ww. j a  v  a  2s. co m*/
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.25f);
    layout.setColumnExpandRatio(1, 0.75f);

    Label errorOccurrenceDetailsLabel = new Label("Error Occurence Details");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    layout.addComponent(errorOccurrenceDetailsLabel);

    Label label = new Label("Module Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 1);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf1 = new TextField();
    tf1.setValue(this.errorOccurrence.getModuleName());
    tf1.setReadOnly(true);
    tf1.setWidth("80%");
    layout.addComponent(tf1, 1, 1);

    label = new Label("Flow Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 2);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf2 = new TextField();
    tf2.setValue(this.errorOccurrence.getFlowName());
    tf2.setReadOnly(true);
    tf2.setWidth("80%");
    layout.addComponent(tf2, 1, 2);

    label = new Label("Component Name:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 3);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf3 = new TextField();
    tf3.setValue(this.errorOccurrence.getFlowElementName());
    tf3.setReadOnly(true);
    tf3.setWidth("80%");
    layout.addComponent(tf3, 1, 3);

    label = new Label("Date/Time:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 4);
    layout.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);

    TextField tf4 = new TextField();
    tf4.setValue(new Date(this.errorOccurrence.getTimestamp()).toString());
    tf4.setReadOnly(true);
    tf4.setWidth("80%");
    layout.addComponent(tf4, 1, 4);

    label = new Label("Error Message:");
    label.setSizeUndefined();
    layout.addComponent(label, 0, 5);
    layout.setComponentAlignment(label, Alignment.TOP_RIGHT);

    TextArea tf5 = new TextArea();
    tf5.setValue(this.errorOccurrence.getErrorMessage());
    tf5.setReadOnly(true);
    tf5.setWidth("80%");
    tf5.setRows(3);
    layout.addComponent(tf5, 1, 5);

    GridLayout wrapperLayout = new GridLayout(1, 4);
    wrapperLayout.setMargin(true);
    wrapperLayout.setWidth("100%");

    TabSheet tabsheet = new TabSheet();
    tabsheet.setSizeFull();

    AceEditor editor = new AceEditor();
    //      editor.setCaption("Error Details");
    editor.setValue(this.errorOccurrence.getErrorDetail());
    editor.setReadOnly(true);
    editor.setMode(AceMode.xml);
    editor.setTheme(AceTheme.eclipse);
    editor.setHeight(470, Unit.PIXELS);
    editor.setWidth("100%");

    AceEditor eventEditor = new AceEditor();
    //      eventEditor.setCaption("Event Payload");

    if (this.errorOccurrence.getEvent() != null) {
        eventEditor.setValue(new String((byte[]) this.errorOccurrence.getEvent()));
    }

    eventEditor.setReadOnly(true);
    eventEditor.setMode(AceMode.java);
    eventEditor.setTheme(AceTheme.eclipse);
    eventEditor.setHeight(470, Unit.PIXELS);
    eventEditor.setWidth("100%");

    HorizontalLayout formLayout = new HorizontalLayout();
    formLayout.setWidth("100%");
    formLayout.setHeight(230, Unit.PIXELS);
    formLayout.addComponent(layout);
    wrapperLayout.addComponent(formLayout, 0, 0);

    //      VerticalSplitPanel vSplitPanel = new VerticalSplitPanel();
    //      vSplitPanel.setWidth("100%");
    //      vSplitPanel.setHeight(800, Unit.PIXELS);
    //      vSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setSizeFull();
    h1.setMargin(true);
    h1.addComponent(eventEditor);
    //      vSplitPanel.setFirstComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setSizeFull();
    h2.setMargin(true);
    h2.addComponent(editor);
    //      vSplitPanel.setSecondComponent(h2);

    tabsheet.addTab(h2, "Error Details");
    tabsheet.addTab(h1, "Event Payload");

    wrapperLayout.addComponent(tabsheet, 0, 1);

    errorOccurrenceDetailsPanel.setContent(wrapperLayout);
    return errorOccurrenceDetailsPanel;
}

From source file:org.investovator.ui.nngaming.DashboardPlayingView.java

License:Open Source License

private void createUI() {

    //Setup Layout
    content = new VerticalLayout();
    content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    HorizontalLayout row1 = new HorizontalLayout();
    HorizontalLayout row2 = new HorizontalLayout();
    HorizontalLayout row3 = new HorizontalLayout();

    row1.setWidth("100%");
    row2.setWidth("100%");
    row3.setWidth("100%");

    row1.setHeight(50, Unit.PERCENTAGE);
    row2.setHeight(20, Unit.PERCENTAGE);
    row3.setHeight(30, Unit.PERCENTAGE);

    row1.setMargin(new MarginInfo(true, true, false, true));
    row2.setMargin(new MarginInfo(true, true, false, true));
    row3.setMargin(new MarginInfo(true, true, true, true));

    content.addComponent(row1);/*  www.  j a v a 2 s  .  c  o m*/
    content.addComponent(row2);
    content.addComponent(row3);

    currentPriceChart = new BasicChart();
    quantityChart = new QuantityChart();
    orderBookSell = getSellSideTable();
    orderBookSell.addStyleName("center-caption");
    orderBookBuy = getBuySideTable();
    orderBookBuy.addStyleName("center-caption");
    quoteUI = new QuoteUI();
    userPortfolio = new UserPortfolio();

    HorizontalLayout orderBookLayout = new HorizontalLayout();
    orderBookLayout.setWidth("100%");
    orderBookLayout.addComponent(orderBookSell);
    orderBookLayout.addComponent(orderBookBuy);
    orderBookLayout.setComponentAlignment(orderBookSell, Alignment.MIDDLE_RIGHT);
    orderBookLayout.setComponentAlignment(orderBookBuy, Alignment.MIDDLE_LEFT);

    VerticalLayout orderBook = new VerticalLayout();
    orderBook.addComponent(orderBookLayout);

    orderBook.setCaption("Order Book");
    quoteUI.setCaption("Quote UI");
    userPortfolio.setCaption(Session.getCurrentUser().toUpperCase(Locale.US) + " - Portfolio Summary");

    orderBook.addStyleName("center-caption");
    quoteUI.addStyleName("center-caption");
    userPortfolio.addStyleName("center-caption");

    row1.addComponent(currentPriceChart);
    row2.addComponent(quantityChart);
    row3.setSpacing(true);
    row3.addComponent(orderBook);
    row3.addComponent(quoteUI);
    row3.addComponent(userPortfolio);
    row3.setExpandRatio(orderBook, 1.2f);
    row3.setExpandRatio(quoteUI, 1.0f);
    row3.setExpandRatio(userPortfolio, 1.0f);

    row1.setComponentAlignment(currentPriceChart, Alignment.MIDDLE_CENTER);
    row2.setComponentAlignment(quantityChart, Alignment.MIDDLE_CENTER);

    content.setSizeFull();
    this.setContent(content);

}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicStockDataView.java

License:Open Source License

private HorizontalLayout setUpTopBar() {
    HorizontalLayout components = new HorizontalLayout();
    components.setWidth("100%");

    HorizontalLayout addChartComponents = new HorizontalLayout();
    components.addComponent(addChartComponents);

    //create the stocks drop down list
    availableStocksList = new ComboBox();
    addChartComponents.addComponent(availableStocksList);
    availableStocksList.setImmediate(true);

    //        availableStocksList.setCaption("Stock");
    availableStocksList.setNullSelectionAllowed(false);
    for (String stock : DataPlaybackEngineStates.playingSymbols) {
        availableStocksList.addItem(stock);
    }//w  ww . jav  a 2  s  . c o  m
    availableStocksList.select(availableStocksList.getItemIds().toArray()[0]);

    //available attributes list
    availableDataItems = new NativeSelect();
    addChartComponents.addComponent(availableDataItems);
    //        availableDataItems.setCaption("Data: ");

    for (TradingDataAttribute attr : setSelectableAttributes()) {
        availableDataItems.addItem(attr);
    }
    availableDataItems.setNullSelectionAllowed(false);
    availableDataItems.select(availableDataItems.getItemIds().toArray()[0]);

    availableDataItems.setImmediate(true);

    //add chart button
    Button addChartButton = new Button("Add");
    addChartComponents.addComponent(addChartButton);
    addChartButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            addPlotToChart();
        }
    });

    //Remove charts section
    HorizontalLayout removeChartsComponents = new HorizontalLayout();
    components.addComponent(removeChartsComponents);

    //plotted charts list
    this.plottedItemsList = new ComboBox();
    removeChartsComponents.addComponent(this.plottedItemsList);
    this.plottedItemsList.setImmediate(true);
    //        this.plottedItemsList.setCaption("Drawn Charts");
    this.plottedItemsList.setNullSelectionAllowed(true);

    //remove plot button
    Button removeChartButton = new Button("Remove");
    removeChartsComponents.addComponent(removeChartButton);
    removeChartButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            removePlotFromChart();
        }
    });

    //clear all button
    Button clearAllButton = new Button("Clear All");
    removeChartsComponents.addComponent(clearAllButton);

    clearAllButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            clearTimeline();
        }
    });

    //set the alignments
    components.setComponentAlignment(addChartComponents, Alignment.MIDDLE_CENTER);
    components.setComponentAlignment(removeChartsComponents, Alignment.MIDDLE_CENTER);
    components.setHeight(50, Unit.PIXELS);

    return components;
}

From source file:org.opennms.features.topology.app.internal.TopologyUI.java

License:Open Source License

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 * /* w w w . ja  v  a2 s. com*/
 * @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) {
        }

        // Icon can be null
        tabSheet.addTab(view, viewContrib.getTitle(), viewContrib.getIcon());

        // If the component supports the HasExtraComponents interface, then add the extra 
        // 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) {
                            // Bizarrely enough, getSelectedTab() returns the contained
                            // Component, not the Tab itself.
                            //
                            // 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;
}

From source file:org.opennms.features.vaadin.nodemaps.internal.NodeMapsApplication.java

License:Open Source License

/**
 * Gets a {@link TabSheet} view for all widgets in this manager.
 * /*from   ww  w  . j  av  a  2  s.c  om*/
 * @return TabSheet
 */
private Component getTabSheet() {
    // Use an absolute layout for the bottom panel
    AbsoluteLayout bottomLayout = new AbsoluteLayout();
    bottomLayout.setSizeFull();

    final TabSheet tabSheet = new TabSheet();
    tabSheet.setSizeFull();

    for (final SelectionAwareTable view : new SelectionAwareTable[] { m_alarmTable, m_nodeTable }) {
        // Icon can be null
        tabSheet.addTab(view, (view == m_alarmTable ? "Alarms" : "Nodes"), null);

        // If the component supports the HasExtraComponents interface, then add the extra 
        // components to the tab bar
        try {
            final 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 (final 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() {
                    @Override
                    public void selectedTabChange(final SelectedTabChangeEvent event) {
                        final TabSheet source = (TabSheet) event.getSource();
                        if (source == tabSheet) {
                            // Bizarrely enough, getSelectedTab() returns the contained
                            // Component, not the Tab itself.
                            //
                            // 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;
}

From source file:org.ripla.web.controllers.RiplaBody.java

License:Open Source License

/**
 * Returns the default menu bar's layout component.<br />
 * Subclasses may override.//from ww  w .  j  a v a2 s .  c o m
 * 
 * @return {@link HorizontalLayout} the default layout for the menu bar.
 */
protected HorizontalLayout getDftMenuBarLayout() {
    final HorizontalLayout outLayout = new HorizontalLayout();
    outLayout.setStyleName("ripla-menubar"); //$NON-NLS-1$
    outLayout.setMargin(new MarginInfo(false, false, false, true));
    outLayout.setWidth("100%"); //$NON-NLS-1$
    outLayout.setHeight(32, Unit.PIXELS);
    return outLayout;
}

From source file:org.ripla.web.controllers.RiplaBody.java

License:Open Source License

private Component createToolbar(final Label inSeparator) {
    final HorizontalLayout outToolbar = new HorizontalLayout();
    outToolbar.setStyleName("ripla-toolbar"); //$NON-NLS-1$
    outToolbar.setWidth("100%"); //$NON-NLS-1$
    outToolbar.setSpacing(true);//from  ww w.  j a v  a2s .  co m
    outToolbar.setMargin(new MarginInfo(false, true, false, true));
    outToolbar.setHeight(22, Unit.PIXELS);

    final Label lExpand = new Label("&#160;", ContentMode.HTML);
    lExpand.setWidth("100%");
    outToolbar.addComponent(lExpand);
    outToolbar.setExpandRatio(lExpand, 1);

    final Iterator<IToolbarItem> lItems = ToolbarItemRegistry.INSTANCE.getSortedItems().iterator();
    boolean lFirst = true;
    while (lItems.hasNext()) {
        final IToolbarItem lItem = lItems.next();
        final IToolbarItemCreator lFactory = lItem.getCreator();
        final Component lComponent = lFactory == null ? lItem.getComponent()
                : lFactory.createToolbarItem(application, getUser());
        if (lComponent == null) {
            continue;
        }

        if (!lFirst) {
            final Label lSeparator = getSeparator(inSeparator);
            outToolbar.addComponent(lSeparator);
            outToolbar.setComponentAlignment(lSeparator, Alignment.MIDDLE_CENTER);
        }
        lFirst = false;

        outToolbar.addComponent(lComponent);
        outToolbar.setComponentAlignment(lComponent, Alignment.MIDDLE_CENTER);
        lItem.registerToolbarActionListener(new IToolbarActionListener() { // NOPMD
            @Override
            public void processAction(final IToolbarAction inAction) {
                inAction.run();
            }
        });
    }

    return outToolbar;
}

From source file:org.ripla.web.demo.skin.modest.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setStyleName("demo-header"); //$NON-NLS-1$
    out.setWidth("100%"); //$NON-NLS-1$
    out.setHeight(65, Unit.PIXELS);

    final Label lTitle = LabelHelper.createLabel("Ripla Demo [with modest skin]", "demo-header-text");
    lTitle.setSizeUndefined();// w  w w  . j  a  v a  2 s . c  o  m
    out.addComponent(lTitle);

    return out;
}

From source file:org.ripla.web.demo.skin.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout out = new HorizontalLayout();
    out.setStyleName("demo-header"); //$NON-NLS-1$
    out.setMargin(true);/*from  w w  w.  ja  v a 2s. c  om*/
    out.setWidth("100%"); //$NON-NLS-1$
    out.setHeight(90, Unit.PIXELS);

    final Label lTitle = LabelHelper.createLabel("Ripla Demo Application", "demo-header-text");
    lTitle.setSizeUndefined();
    out.addComponent(lTitle);
    out.setComponentAlignment(lTitle, Alignment.MIDDLE_CENTER);

    return out;
}