com.vaadin.ui.VerticalLayout.addStyleName()

Here are the examples of the java api com.vaadin.ui.VerticalLayout.addStyleName() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

15 Source : ManageLayout.java
with Apache License 2.0
from opensecuritycontroller

@SuppressWarnings("serial")
public VerticalLayout createBackup() {
    final VerticalLayout bkpLayout = new VerticalLayout();
    bkpLayout.addStyleName("componentSpacing");
    this.backupButton = new Button("Create Backup");
    this.backupButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                PreplacedwordWindow preplacedwordWindow = new PreplacedwordWindow(ManageLayout.this.validator);
                preplacedwordWindow.setSubmitFormListener(preplacedword -> {
                    try {
                        BackupRequest req = new BackupRequest();
                        req.setBackupPreplacedword(preplacedword);
                        BackupResponse res = ManageLayout.this.backupService.dispatch(req);
                        if (res.isSuccess()) {
                            ViewUtil.iscNotification("Backup Successful!", null, Notification.Type.TRAY_NOTIFICATION);
                            ManageLayout.this.linkContainer.removeAllComponents();
                            createDownloadLink(ManageLayout.this.backupService.getEncryptedBackupFile());
                        }
                    } catch (Exception e) {
                        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
                        log.error("Failed to backup vmiDCServer Database ", e);
                    }
                });
                ViewUtil.addWindow(preplacedwordWindow);
            } catch (Exception e) {
                ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
                log.error("Failed to backup vmiDCServer Database ", e);
            }
        }
    });
    bkpLayout.addComponent(this.backupButton);
    this.linkContainer = new HorizontalLayout();
    File backupFile = this.backupService.getEncryptedBackupFile();
    if (backupFile.exists()) {
        createDownloadLink(backupFile);
    }
    bkpLayout.addComponent(this.linkContainer);
    return bkpLayout;
}

14 Source : MainUI.java
with Apache License 2.0
from opensecuritycontroller

private VerticalLayout buildSidebar() {
    VerticalLayout sideBar = new VerticalLayout();
    sideBar.addStyleName("sidebar");
    sideBar.addComponent(buildMainMenu());
    sideBar.setExpandRatio(this.menu, 1);
    sideBar.setWidth(null);
    sideBar.setHeight("100%");
    return sideBar;
}

14 Source : CRUDBaseSubView.java
with Apache License 2.0
from opensecuritycontroller

private void createSubView(String replacedle, ToolbarButtons[] buttons) {
    setSizeFull();
    final VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(StyleConstants.BASE_CONTAINER);
    layout.setSizeFull();
    final VerticalLayout panel = new VerticalLayout();
    panel.addStyleName("panel");
    panel.setSizeFull();
    layout.addComponent(createHeader(replacedle));
    layout.addComponent(panel);
    if (buttons != null) {
        panel.addComponent(createToolbar(buttons));
    }
    panel.addComponent(createTable());
    panel.setExpandRatio(this.table, 1L);
    layout.setExpandRatio(panel, 1L);
    addComponent(layout);
}

12 Source : CRUDBaseView.java
with Apache License 2.0
from opensecuritycontroller

/**
 * returns an empty View layout containing CRUD ToolBar, CSS layout, Table
 * with columnList and replacedle of the view
 *
 * @param parentreplacedle
 *            replacedle of the parent panel
 * @param parentCRUDButtons
 *            Array Toolbar buttons to diaplay parent panel
 * @param parentMultiSelect
 *            multi select parent table
 * @param childreplacedle
 *            replacedle of child panel
 * @param childCRUDButtons
 *            Array of toolbar buttons to display in child panel
 * @param parentSubViewList
 *            Map of CRUDBaseSubViews with their respective Button captions for Parent Table
 * @param childSubViewList
 *            Map of CRUDBaseSubViews with their respective Button captions for Child Table
 */
public void createView(String parentreplacedle, List<ToolbarButtons> parentCRUDButtons, boolean parentMultiSelect, String childreplacedle, List<ToolbarButtons> childCRUDButtons, Map<String, CRUDBaseSubView<?, ?>> parentSubViewList, Map<String, CRUDBaseSubView<?, ?>> childSubViewMap) {
    boolean addChildTable = childreplacedle != null;
    setSizeFull();
    this.parentSubViewMap = parentSubViewList;
    this.childSubViewMap = childSubViewMap;
    // parent container with header
    this.parentContainerLayout = new VerticalLayout();
    this.parentContainerLayout.addStyleName(StyleConstants.BASE_CONTAINER);
    this.parentContainerLayout.setSizeFull();
    // parent panel with table and CRUD buttons
    final VerticalLayout parentPanel = new VerticalLayout();
    parentPanel.addStyleName("panel");
    parentPanel.setSizeFull();
    this.parentContainerLayout.addComponent(createHeader(parentreplacedle, false));
    this.parentContainerLayout.addComponent(parentPanel);
    this.infoText = new PageInformationComponent();
    this.infoText.addStyleName(StyleConstants.PAGE_INFO_COMPONENT);
    parentPanel.addComponent(this.infoText);
    if (parentCRUDButtons != null) {
        parentPanel.addComponent(createParentToolbar(parentCRUDButtons));
    }
    parentPanel.addComponent(createParentTable(parentMultiSelect));
    // expand parentTable with parentPanel
    parentPanel.setExpandRatio(this.parentTable, 1L);
    // expand parentPanel with parentContainer
    this.parentContainerLayout.setExpandRatio(parentPanel, 1L);
    if (addChildTable) {
        // child container with header
        this.childContainerLayout = new VerticalLayout();
        this.childContainerLayout.addStyleName(StyleConstants.BASE_CONTAINER);
        this.childContainerLayout.setSizeFull();
        // child panel with table and CRUD buttons
        final VerticalLayout childPanel = new VerticalLayout();
        childPanel.addStyleName("panel");
        childPanel.setSizeFull();
        this.childContainerLayout.addComponent(createHeader(childreplacedle, true));
        this.childContainerLayout.addComponent(childPanel);
        if (childCRUDButtons != null) {
            childPanel.addComponent(createChildToolBar(childCRUDButtons));
        }
        // adding table to panel layout
        childPanel.addComponent(createChildTable());
        // expand childTable with childPanel
        childPanel.setExpandRatio(this.childTable, 1L);
        // expand childPanel with childContainer
        this.childContainerLayout.setExpandRatio(childPanel, 1L);
        this.viewSplitter = new VerticalSplitPanel();
        this.viewSplitter.addStyleName(ValoTheme.SPLITPANEL_LARGE);
        this.viewSplitter.addComponent(this.parentContainerLayout);
        this.viewSplitter.addComponent(this.childContainerLayout);
        this.viewSplitter.setImmediate(true);
        this.viewSplitter.setMaxSplitPosition(75, Unit.PERCENTAGE);
        this.viewSplitter.setMinSplitPosition(25, Unit.PERCENTAGE);
        // adding split panel to the main view
        addComponent(this.viewSplitter);
    } else {
        addComponent(this.parentContainerLayout);
    }
}

5 Source : BaseSecurityGroupWindow.java
with Apache License 2.0
from opensecuritycontroller

@SuppressWarnings("serial")
protected Component getSelectionWidget() {
    this.selector = new VerticalLayout();
    this.selector.addStyleName(StyleConstants.VMIDC_WINDOW_CONTENT_WRAPPER);
    this.selector.setSizeFull();
    this.itemsTable = createSelectorTable();
    this.itemsTable.setCaption(VmidcMessages.getString(VmidcMessages_.SELECTOR_replacedLE));
    this.itemsTable.setColumnWidth("name", ITEMS_NAME_COLUMN_WIDTH);
    this.itemsContainer = createItemContainer();
    this.itemsTable.setContainerDataSource(this.itemsContainer);
    this.itemsTable.setVisibleColumns("name");
    this.selectedItemsTable = createSelectorTable();
    this.selectedItemsTable.setCaption(VmidcMessages.getString(VmidcMessages_.SELECTED_replacedLE));
    this.selectedItemsTable.setWidth(SELECTED_TABLE_WIDTH + "px");
    this.selectedItemsTable.setColumnWidth("name", SELECTED_ITEMS_NAME_COLUMN_WIDTH);
    this.selectedItemsTable.setColumnWidth("region", SELECTED_ITEMS_REGION_COLUMN_WIDTH);
    this.selectedItemsTable.setColumnWidth("type", SELECTED_ITEMS_TYPE_COLUMN_WIDTH);
    this.selectedItemsContainer = createItemContainer();
    this.selectedItemsTable.setContainerDataSource(this.selectedItemsContainer);
    this.selectedItemsTable.setVisibleColumns("name", "region", "type", PROTECT_EXTERNAL);
    this.selectedItemsTable.setColumnHeader(PROTECT_EXTERNAL, "Protect External");
    VerticalLayout selectorButtonLayout = new VerticalLayout();
    selectorButtonLayout.addStyleName(StyleConstants.SELECTOR_BUTTON_LAYOUT);
    Button addButton = new Button(VmidcMessages.getString(VmidcMessages_.SELECTOR_TO_BUTTON));
    addButton.addStyleName(StyleConstants.SELECTOR_BUTTON);
    addButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            moveItems(BaseSecurityGroupWindow.this.itemsTable, BaseSecurityGroupWindow.this.selectedItemsTable);
        }
    });
    Button removeButton = new Button(VmidcMessages.getString(VmidcMessages_.SELECTOR_FROM_BUTTON));
    removeButton.addStyleName(StyleConstants.SELECTOR_BUTTON);
    removeButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            moveItems(BaseSecurityGroupWindow.this.selectedItemsTable, BaseSecurityGroupWindow.this.itemsTable);
        }
    });
    selectorButtonLayout.addComponent(addButton);
    selectorButtonLayout.addComponent(removeButton);
    HorizontalLayout selectorLayout = new HorizontalLayout();
    selectorLayout.addComponent(createSelectorTableLayout(this.itemsTable, this.itemsContainer));
    selectorLayout.addComponent(selectorButtonLayout);
    selectorLayout.addComponent(createSelectorTableLayout(this.selectedItemsTable, this.selectedItemsContainer));
    this.selector.addComponent(selectorLayout);
    return this.selector;
}

3 Source : BindSecurityGroupWindow.java
with Apache License 2.0
from opensecuritycontroller

@SuppressWarnings("serial")
private Component getServicePanel() throws ActionNotSupportedException {
    try {
        this.serviceTable = new Table();
        this.serviceTable.setCaption("Services:");
        this.serviceTable.setPageLength(5);
        this.serviceTable.setImmediate(true);
        this.serviceTable.setSelectable(true);
        this.serviceTable.setMultiSelect(false);
        this.serviceTable.setNullSelectionAllowed(false);
        this.serviceTable.setNullSelectionItemId(CRUDBaseView.NULL_SELECTION_ITEM_ID);
        this.serviceTable.addGeneratedColumn(PROPERTY_ID_ENABLED, new CheckBoxGenerator());
        populateServiceTable();
        VerticalLayout selectorButtonLayout = new VerticalLayout();
        selectorButtonLayout.addStyleName(StyleConstants.SELECTOR_BUTTON_LAYOUT);
        Button moveUpButton = new Button(VmidcMessages.getString(VmidcMessages_.ORDER_MOVE_UP_TEXT));
        moveUpButton.setHtmlContentAllowed(true);
        moveUpButton.setDescription(VmidcMessages.getString(VmidcMessages_.ORDER_MOVE_UP_DESC));
        moveUpButton.addStyleName(StyleConstants.SELECTOR_BUTTON);
        moveUpButton.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                moveItem(true);
            }
        });
        Button moveDownButton = new Button(VmidcMessages.getString(VmidcMessages_.ORDER_MOVE_DOWN_TEXT));
        moveDownButton.setHtmlContentAllowed(true);
        moveDownButton.setDescription(VmidcMessages.getString(VmidcMessages_.ORDER_MOVE_DOWN_DESC));
        moveDownButton.addStyleName(StyleConstants.SELECTOR_BUTTON);
        moveDownButton.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                moveItem(false);
            }
        });
        selectorButtonLayout.addComponent(moveUpButton);
        selectorButtonLayout.addComponent(moveDownButton);
        HorizontalLayout selectorLayout = new HorizontalLayout();
        selectorLayout.addComponent(selectorButtonLayout);
        selectorLayout.addComponent(this.serviceTable);
        return selectorLayout;
    } catch (ActionNotSupportedException actionNotSupportedException) {
        throw actionNotSupportedException;
    } catch (Exception e) {
        ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
        log.error("Error while creating Services panel", e);
    }
    return null;
}