Java Code Examples for com.vaadin.ui.GridLayout#setColumnExpandRatio()

The following examples show how to use com.vaadin.ui.GridLayout#setColumnExpandRatio() . 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: UploadArtifactView.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private GridLayout createMainLayout() {
    createDetailsAndUploadLayout();
    mainLayout = new GridLayout(3, 1);
    mainLayout.setSizeFull();
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("fullSize");
    mainLayout.addComponent(filterByTypeLayout, 0, 0);
    mainLayout.addComponent(smTableLayout, 1, 0);
    mainLayout.addComponent(detailAndUploadLayout, 2, 0);

    mainLayout.setRowExpandRatio(0, 1.0F);
    mainLayout.setColumnExpandRatio(1, 0.5F);
    mainLayout.setColumnExpandRatio(2, 0.5F);

    return mainLayout;
}
 
Example 2
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 3
Source File: DistributionsView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void createMainLayout() {
    mainLayout = new GridLayout(4, 1);
    mainLayout.setSizeFull();
    mainLayout.setSpacing(true);
    mainLayout.setStyleName("fullSize");

    mainLayout.addComponent(filterByDSTypeLayout, 0, 0);
    mainLayout.addComponent(distributionTableLayout, 1, 0);
    mainLayout.addComponent(softwareModuleTableLayout, 2, 0);
    mainLayout.addComponent(filterBySMTypeLayout, 3, 0);
    mainLayout.setRowExpandRatio(0, 1.0F);
    mainLayout.setColumnExpandRatio(1, 0.5F);
    mainLayout.setColumnExpandRatio(2, 0.5F);
}
 
Example 4
Source File: StorageAdminPanel.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
protected Panel newPanel(String title)
{
    Panel panel = new Panel(title);
    GridLayout layout = new GridLayout(2, 2);
    layout.setWidth(100.0f, Unit.PERCENTAGE);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.2f);
    layout.setColumnExpandRatio(1, 0.8f);
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    panel.setContent(layout);
    return panel;
}
 
Example 5
Source File: TimeLogComp.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
protected TimeLogComp() {
    this.itemTimeLoggingService = AppContextUtil.getSpringBean(ItemTimeLoggingService.class);
    this.withMargin(false);

    HorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel dateInfoHeader = ELabel.html(VaadinIcons.CLOCK.getHtml() + " " +
            UserUIContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME));
    header.addComponent(dateInfoHeader);

    if (hasEditPermission()) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent ->
                showEditTimeWindow(beanItem)).withStyleName(WebThemes.BUTTON_LINK);
        header.addComponent(editBtn);
    }
    header.addComponent(ELabel.fontIcon(VaadinIcons.QUESTION_CIRCLE).withDescription(UserUIContext.getMessage
            (TimeTrackingI18nEnum.TIME_EXPLAIN_HELP)).withStyleName(WebThemes.INLINE_HELP));

    this.addComponent(header);

    layout = new GridLayout(2, 3);
    layout.setSpacing(true);
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, false, true));
    layout.setColumnExpandRatio(1, 1.0f);
    this.addComponent(layout);
}
 
Example 6
Source File: DateInfoComp.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public void displayEntryDateTime(ValuedBean bean) {
    this.removeAllComponents();
    this.withMargin(false);
    Label dateInfoHeader = ELabel.html(VaadinIcons.CALENDAR.getHtml() + " " +
            UserUIContext.getMessage(ProjectCommonI18nEnum.SUB_INFO_DATES)).withStyleName("info-hdr");
    this.addComponent(dateInfoHeader);

    GridLayout layout = new GridLayout(2, 2);
    layout.setSpacing(true);
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, false, true));
    layout.setColumnExpandRatio(1, 1.0f);

    try {
        LocalDateTime createdDate = (LocalDateTime) PropertyUtils.getProperty(bean, "createdtime");
        layout.addComponent(new ELabel(UserUIContext.getMessage(ProjectCommonI18nEnum.ITEM_CREATED_DATE)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth(), 0, 0);
        layout.addComponent(new ELabel(UserUIContext.formatPrettyTime(createdDate)).withDescription(UserUIContext.formatDateTime(createdDate)), 1, 0);


        LocalDateTime updatedDate = (LocalDateTime) PropertyUtils.getProperty(bean, "lastupdatedtime");
        layout.addComponent(new ELabel(UserUIContext.getMessage(ProjectCommonI18nEnum.ITEM_UPDATED_DATE)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth(), 0, 1);
        layout.addComponent(new ELabel(UserUIContext.formatPrettyTime(updatedDate)).withDescription(UserUIContext.formatDateTime(updatedDate)), 1, 1);

        this.addComponent(layout);
    } catch (Exception e) {
        LOG.error("Get date is failed {}", BeanUtility.printBeanObj(bean));
    }
}
 
Example 7
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 8
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);
    }