Java Code Examples for com.vaadin.ui.Panel#addStyleName()

The following examples show how to use com.vaadin.ui.Panel#addStyleName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RolloutConfigurationView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.rollout.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 1);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setColumnExpandRatio(1, 1.0F);
        gridLayout.setSizeFull();

        approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, "");
        approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX);
        approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled());
        approvalCheckbox.addValueChangeListener(this);
        approvalConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(approvalCheckbox, 0, 0);
        gridLayout.addComponent(approvalConfigurationItem, 1, 0);

        final Link linkToApprovalHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getRollout());
        gridLayout.addComponent(linkToApprovalHelp, 2, 0);
        gridLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example 2
Source File: AbstractTableLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    setSizeFull();
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout tableHeaderLayout = new VerticalLayout();
    tableHeaderLayout.setSizeFull();
    tableHeaderLayout.setSpacing(false);
    tableHeaderLayout.setMargin(false);

    tableHeaderLayout.setStyleName("table-layout");
    tableHeaderLayout.addComponent(tableHeader);

    tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
    if (isShortCutKeysRequired()) {
        final Panel tablePanel = new Panel();
        tablePanel.setStyleName("table-panel");
        tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
        tablePanel.setContent(table);
        tablePanel.addActionHandler(getShortCutKeysHandler(i18n));
        tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
        tableHeaderLayout.addComponent(tablePanel);
        tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(tablePanel, 1.0F);
    } else {
        tableHeaderLayout.addComponent(table);
        tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(table, 1.0F);
    }

    addComponent(tableHeaderLayout);
    addComponent(detailsLayout);
    setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
    setComponentAlignment(detailsLayout, Alignment.TOP_CENTER);
    setExpandRatio(tableHeaderLayout, 1.0F);
}
 
Example 3
Source File: AuthenticationConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.authentication.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 4);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setSizeFull();
        gridLayout.setColumnExpandRatio(1, 1.0F);

        certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
        certificateAuthCheckbox.addValueChangeListener(this);
        certificateAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(certificateAuthCheckbox, 0, 0);
        gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0);

        targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
        targetSecTokenCheckBox.addValueChangeListener(this);
        targetSecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(targetSecTokenCheckBox, 0, 1);
        gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1);

        gatewaySecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox");
        gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
        gatewaySecTokenCheckBox.addValueChangeListener(this);
        gatewaySecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
        gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);

        downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        downloadAnonymousCheckBox.setId(UIComponentIdProvider.DOWNLOAD_ANONYMOUS_CHECKBOX);
        downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled());
        downloadAnonymousCheckBox.addValueChangeListener(this);
        anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
        gridLayout.addComponent(anonymousDownloadAuthenticationConfigurationItem, 1, 3);

        final Link linkToSecurityHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getSecurity());
        gridLayout.addComponent(linkToSecurityHelp, 2, 3);
        gridLayout.setComponentAlignment(linkToSecurityHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example 4
Source File: PollingConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
PollingConfigurationView(final VaadinMessageSource i18n, final ControllerPollProperties controllerPollProperties,
        final TenantConfigurationManagement tenantConfigurationManagement) {
    this.tenantConfigurationManagement = tenantConfigurationManagement;

    final Duration minDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMinPollingTime());
    final Duration maxDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMaxPollingTime());
    final Duration globalPollTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class));
    final Duration globalOverdueTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class));

    final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class);
    if (!pollTimeConfValue.isGlobal()) {
        tenantPollTime = DurationHelper.formattedStringToDuration(pollTimeConfValue.getValue());
    }

    final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class);
    if (!overdueTimeConfValue.isGlobal()) {
        tenantOverdueTime = DurationHelper.formattedStringToDuration(overdueTimeConfValue.getValue());
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");

    final VerticalLayout vLayout = new VerticalLayout();
    vLayout.setMargin(true);

    final Label headerDisSetType = new Label(i18n.getMessage("configuration.polling.title"));
    headerDisSetType.addStyleName("config-panel-header");
    vLayout.addComponent(headerDisSetType);

    fieldPollTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_POLLING)
            .caption(i18n.getMessage("configuration.polling.time"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalPollTime).tenantDuration(tenantPollTime).build();
    fieldPollTime.addChangeListener(this);
    vLayout.addComponent(fieldPollTime);

    fieldPollingOverdueTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_OVERDUE)
            .caption(i18n.getMessage("configuration.polling.overduetime"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalOverdueTime).tenantDuration(tenantOverdueTime).build();
    fieldPollingOverdueTime.addChangeListener(this);
    vLayout.addComponent(fieldPollingOverdueTime);

    rootPanel.setContent(vLayout);
    setCompositionRoot(rootPanel);
}
 
Example 5
Source File: RepositoryConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.repository.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 3);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setColumnExpandRatio(1, 1.0F);
        gridLayout.setSizeFull();

        final boolean isMultiAssignmentsEnabled = multiAssignmentsConfigurationItem.isConfigEnabled();

        actionAutocloseCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX);
        actionAutocloseCheckBox.setEnabled(!isMultiAssignmentsEnabled);
        actionAutocloseConfigurationItem.setEnabled(!isMultiAssignmentsEnabled);
        actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled());
        actionAutocloseCheckBox.addValueChangeListener(this);
        actionAutocloseConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(actionAutocloseCheckBox, 0, 0);
        gridLayout.addComponent(actionAutocloseConfigurationItem, 1, 0);

        multiAssignmentsCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        multiAssignmentsCheckBox.setId(UIComponentIdProvider.REPOSITORY_MULTI_ASSIGNMENTS_CHECKBOX);
        multiAssignmentsCheckBox.setValue(multiAssignmentsConfigurationItem.isConfigEnabled());
        multiAssignmentsCheckBox.addValueChangeListener(this);
        multiAssignmentsCheckBox.setEnabled(!isMultiAssignmentsEnabled);
        multiAssignmentsConfigurationItem.setEnabled(!isMultiAssignmentsEnabled);
        multiAssignmentsConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(multiAssignmentsCheckBox, 0, 1);
        gridLayout.addComponent(multiAssignmentsConfigurationItem, 1, 1);

        actionAutocleanupCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        actionAutocleanupCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLEANUP_CHECKBOX);
        actionAutocleanupCheckBox.setValue(actionAutocleanupConfigurationItem.isConfigEnabled());
        actionAutocleanupCheckBox.addValueChangeListener(this);
        actionAutocleanupConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(actionAutocleanupCheckBox, 0, 2);
        gridLayout.addComponent(actionAutocleanupConfigurationItem, 1, 2);

        final Link linkToProvisioningHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getProvisioningStateMachine());
        gridLayout.addComponent(linkToProvisioningHelp, 2, 2);
        gridLayout.setComponentAlignment(linkToProvisioningHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example 6
Source File: DefaultDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
        final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n,
        final SpPermissionChecker permChecker) {
    this.systemManagement = systemManagement;
    combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
    changeIcon = new Label();

    if (!permChecker.hasReadRepositoryPermission()) {
        return;
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");
    final VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final Label header = new Label(i18n.getMessage("configuration.defaultdistributionset.title"));
    header.addStyleName("config-panel-header");
    vlayout.addComponent(header);

    final DistributionSetType currentDistributionSetType = getCurrentDistributionSetType();
    currentDefaultDisSetType = currentDistributionSetType.getId();

    final HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setSpacing(true);
    hlayout.setImmediate(true);

    final Label configurationLabel = new LabelBuilder()
            .name(i18n.getMessage("configuration.defaultdistributionset.select.label")).buildLabel();
    hlayout.addComponent(configurationLabel);

    final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
            .findAll(PageRequest.of(0, 100));

    combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
    combobox.setNullSelectionAllowed(false);
    for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
        combobox.addItem(distributionSetType.getId());
        combobox.setItemCaption(distributionSetType.getId(),
                distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");

        if (distributionSetType.getId().equals(currentDistributionSetType.getId())) {
            combobox.select(distributionSetType.getId());
        }
    }
    combobox.setImmediate(true);
    combobox.addValueChangeListener(event -> selectDistributionSetValue());
    hlayout.addComponent(combobox);

    changeIcon.setIcon(FontAwesome.CHECK);
    hlayout.addComponent(changeIcon);
    changeIcon.setVisible(false);

    vlayout.addComponent(hlayout);
    rootPanel.setContent(vlayout);
    setCompositionRoot(rootPanel);
}
 
Example 7
Source File: AbstractView.java    From cia with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the basic layout with panel and footer.
 *
 * @param panelName
 *            the panel name
 */
protected final void createBasicLayoutWithPanelAndFooter(final String panelName) {
	final VerticalLayout layout = createFullSizeVerticalLayout();
	final VerticalLayout pageModeContent = createFullSizeVerticalLayout(false,false);
	layout.addComponent(pageModeContent);

	final HorizontalLayout topHeader = new HorizontalLayout();

	addLogoToHeader(topHeader);
	createTopTitleHeader(topHeader);

	topHeaderRightPanel.removeAllComponents();
	topHeader.addComponent(topHeaderRightPanel);
	topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT);
	topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE);

	createTopHeaderActionsForUserContext();

	topHeaderRightPanel.setWidth("100%");
	topHeaderRightPanel.setHeight("50px");

	topHeader.setWidth("100%");
	topHeader.setHeight("50px");

	pageModeContent.addComponent(topHeader);
	pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER);

	pageModeContent.addComponent(getBarmenu());
	pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER);

	panel = new Panel(panelName);
	panel.addStyleName("v-panel-page-panel");

	panel.setSizeFull();
	pageModeContent.addComponent(panel);
	pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE);

	pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink());
	setContent(layout);

	setWidth(100, Unit.PERCENTAGE);
	setHeight(100, Unit.PERCENTAGE);
	setSizeFull();

}