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

The following examples show how to use com.vaadin.ui.Label#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: TargetTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private Label getTargetPollTime(final Object itemId) {
    final Label statusLabel = new Label();
    statusLabel.addStyleName(ValoTheme.LABEL_SMALL);
    statusLabel.setHeightUndefined();
    statusLabel.setContentMode(ContentMode.HTML);
    final String pollStatusToolTip = (String) getContainerDataSource().getItem(itemId)
            .getItemProperty(SPUILabelDefinitions.VAR_POLL_STATUS_TOOL_TIP).getValue();
    if (StringUtils.hasText(pollStatusToolTip)) {
        statusLabel.setValue(FontAwesome.EXCLAMATION_CIRCLE.getHtml());
        statusLabel.setDescription(pollStatusToolTip);
    } else {
        statusLabel.setValue(FontAwesome.CLOCK_O.getHtml());
        statusLabel.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_IN_TIME));
    }

    return statusLabel;
}
 
Example 2
Source File: HomeViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 6 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();
	
	content = new VerticalLayout();
	content.setSpacing(true);
	content.setMargin(true);
	setCompositionRoot(content);
							
	caption = new Label("This is Home View", ContentMode.HTML);
	caption.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(caption);
	
	loginInfo = new Label("This is Home View", ContentMode.HTML);
	loginInfo.addStyleName(ValoTheme.LABEL_H2);
	content.addComponent(loginInfo);
			
}
 
Example 3
Source File: DefaultGridHeader.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Builds the title HorizontalLayout containing two labels.
 *
 * @return title as HorizontalLayout
 */
protected HorizontalLayout buildTitleHorizontalLayout() {

    prefixText = new Label();
    prefixText.setValue(titleText);
    prefixText.addStyleName(ValoTheme.LABEL_SMALL);
    prefixText.addStyleName(ValoTheme.LABEL_BOLD);
    prefixText.setSizeUndefined();

    title = new Label();
    title.setSizeFull();
    title.setImmediate(true);
    title.setWidth("100%");
    title.addStyleName(ValoTheme.LABEL_SMALL);
    title.addStyleName("text-bold");
    title.addStyleName("text-cut");
    title.addStyleName("header-caption-right");

    prefixWithTitle = new HorizontalLayout();
    prefixWithTitle.setMargin(false);
    prefixWithTitle.setSpacing(true);
    prefixWithTitle.setSizeFull();
    prefixWithTitle.addStyleName("header-caption");

    prefixWithTitle.addComponent(prefixText);
    prefixWithTitle.setComponentAlignment(prefixText, Alignment.TOP_LEFT);
    prefixWithTitle.setExpandRatio(prefixText, 0.0F);

    prefixWithTitle.addComponent(title);
    prefixWithTitle.setComponentAlignment(title, Alignment.TOP_LEFT);
    prefixWithTitle.setExpandRatio(title, 1.0F);

    return prefixWithTitle;
}
 
Example 4
Source File: AdminViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
@Override
public void postConstruct() {	
	super.postConstruct();
	setSizeFull();
	layout = new CssLayout();
	layout.setSizeFull();
	setCompositionRoot(layout);
	
	
	final Label label = new Label("This is admin only view");
	label.addStyleName(ValoTheme.LABEL_H2);
	layout.addComponent(label);		
	
}
 
Example 5
Source File: AbstractTableDetailsLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected void createComponents() {
    captionPrefix = new Label(getDefaultCaption());
   captionPrefix.setImmediate(true);
    captionPrefix.addStyleName(ValoTheme.LABEL_SMALL);
    captionPrefix.addStyleName(ValoTheme.LABEL_BOLD);
    captionPrefix.setSizeUndefined();

    captionNameVersion = new Label();
    captionNameVersion.setImmediate(true);
    captionNameVersion.setId(getDetailsHeaderCaptionId());
    captionNameVersion.setWidth("100%");
    captionNameVersion.addStyleName(ValoTheme.LABEL_SMALL);
    captionNameVersion.addStyleName("text-bold");
    captionNameVersion.addStyleName("text-cut");
    captionNameVersion.addStyleName("header-caption-right");

    editButton = SPUIComponentProvider.getButton("", "", i18n.getMessage(UIMessageIdProvider.TOOLTIP_UPDATE), null,
            false, FontAwesome.PENCIL_SQUARE_O, SPUIButtonStyleNoBorder.class);
    editButton.setId(getEditButtonId());
    editButton.addClickListener(this::onEdit);
    editButton.setEnabled(false);

    manageMetadataBtn = SPUIComponentProvider.getButton("", "",
            i18n.getMessage(UIMessageIdProvider.TOOLTIP_METADATA_ICON), null, false, FontAwesome.LIST_ALT,
            SPUIButtonStyleNoBorder.class);
    manageMetadataBtn.setId(getMetadataButtonId());
    manageMetadataBtn.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_METADATA_ICON));
    manageMetadataBtn.addClickListener(this::showMetadata);
    manageMetadataBtn.setEnabled(false);

    detailsTab = SPUIComponentProvider.getDetailsTabSheet();
    detailsTab.setImmediate(true);
    detailsTab.setWidth(98, Unit.PERCENTAGE);
    detailsTab.setHeight(90, Unit.PERCENTAGE);
    detailsTab.addStyleName(SPUIStyleDefinitions.DETAILS_LAYOUT_STYLE);
    detailsTab.setId(getTabSheetId());
}
 
Example 6
Source File: TargetBulkUpdateWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label getStatusCountLabel() {
    final Label countLabel = new Label();
    countLabel.setImmediate(true);
    countLabel.addStyleName("bulk-upload-label");
    countLabel.setVisible(false);
    countLabel.setCaptionAsHtml(true);
    countLabel.setId(UIComponentIdProvider.BULK_UPLOAD_COUNT);
    return countLabel;
}
 
Example 7
Source File: GroupsLegendLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Label createLoadingLabel() {
    final Label label = new LabelBuilder().visible(false).name("").buildLabel();
    label.addStyleName("rollout-target-count-loading");
    label.setImmediate(true);
    label.setSizeUndefined();
    label.setValue(i18n.getMessage("label.rollout.calculating"));
    return label;
}
 
Example 8
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label createUsernameLabel(final String label, final String username) {
    String loadAndFormatUsername = "";
    if (!StringUtils.isEmpty(username)) {
        loadAndFormatUsername = UserDetailsFormatter.loadAndFormatUsername(username);
    }

    final Label nameValueLabel = new Label(getBoldHTMLText(label) + loadAndFormatUsername, ContentMode.HTML);
    nameValueLabel.setSizeFull();
    nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);
    nameValueLabel.addStyleName(LABEL_STYLE);
    nameValueLabel.setDescription(loadAndFormatUsername);
    return nameValueLabel;
}
 
Example 9
Source File: FilterByStatusLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void getFilterTargetsStatusLayout() {

        getTargetFilterStatuses();

        addStyleName("target-status-filters");
        setMargin(false);

        final Label targetFilterStatusLabel = new LabelBuilder().name(i18n.getMessage("label.filter.by.status"))
                .buildLabel();

        targetFilterStatusLabel.addStyleName("target-status-filters-title");

        addComponent(targetFilterStatusLabel);
        setComponentAlignment(targetFilterStatusLabel, Alignment.MIDDLE_CENTER);
        final HorizontalLayout buttonLayout = new HorizontalLayout();
        buttonLayout.setStyleName("status-button-layout");
        buttonLayout.addComponent(unknown);
        buttonLayout.setComponentAlignment(unknown, Alignment.MIDDLE_CENTER);
        buttonLayout.addComponent(inSync);
        buttonLayout.setComponentAlignment(inSync, Alignment.MIDDLE_CENTER);
        buttonLayout.addComponent(pending);
        buttonLayout.setComponentAlignment(pending, Alignment.MIDDLE_CENTER);
        buttonLayout.addComponent(error);
        buttonLayout.setComponentAlignment(error, Alignment.MIDDLE_CENTER);
        buttonLayout.addComponent(registered);
        buttonLayout.setComponentAlignment(registered, Alignment.MIDDLE_CENTER);
        addComponent(buttonLayout);
        setComponentAlignment(buttonLayout, Alignment.MIDDLE_LEFT);

        final HorizontalLayout overdueLayout = new HorizontalLayout();
        final Label overdueLabel = new LabelBuilder().name(i18n.getMessage("label.filter.by.overdue")).buildLabel();
        overdueLayout.setStyleName("overdue-button-layout");
        overdueLayout.addComponent(overdue);
        overdueLayout.setComponentAlignment(overdue, Alignment.MIDDLE_LEFT);
        overdueLayout.addComponent(overdueLabel);
        overdueLayout.setComponentAlignment(overdueLabel, Alignment.MIDDLE_LEFT);
        addComponent(overdueLayout);
        setComponentAlignment(overdueLayout, Alignment.MIDDLE_LEFT);

    }
 
Example 10
Source File: SignUpViewImpl.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
@Override
public void postConstruct() {
	super.postConstruct();		
	setSizeFull();
	
	layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);
	setCompositionRoot(layout);
	
	infoLabel = new Label("Vaadin4Spring Security Demo - SignUp");
	infoLabel.addStyleName(ValoTheme.LABEL_H2);
	infoLabel.setSizeUndefined();
	layout.addComponent(infoLabel);
	layout.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
	
	container = new VerticalLayout();
	container.setSizeUndefined();
	container.setSpacing(true);
	layout.addComponent(container);
	layout.setComponentAlignment(container, Alignment.MIDDLE_CENTER);
	layout.setExpandRatio(container, 1);
					
	form = new FormLayout();
	form.setWidth("400px");
	form.setSpacing(true);
	container.addComponent(form);
	buildForm();
				
	btnSignUp = new Button("Signup", FontAwesome.FLOPPY_O);
	btnSignUp.addStyleName(ValoTheme.BUTTON_FRIENDLY);
	btnSignUp.addClickListener(this);
	container.addComponent(btnSignUp);
	container.setComponentAlignment(btnSignUp, Alignment.MIDDLE_CENTER);

}
 
Example 11
Source File: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static Label createCountLabel() {
    final Label groupSize = new LabelBuilder().visible(false).name("").buildLabel();
    groupSize.addStyleName(ValoTheme.LABEL_TINY + " " + "rollout-target-count-message");
    groupSize.setImmediate(true);
    groupSize.setSizeUndefined();
    return groupSize;
}
 
Example 12
Source File: HawkbitCommonUtil.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get formatted label.Appends ellipses if content does not fit the label.
 *
 * @param labelContent
 *            content
 * @return Label
 */
public static Label getFormatedLabel(final String labelContent) {
    final Label labelValue = new Label(labelContent, ContentMode.TEXT);
    labelValue.setSizeFull();
    labelValue.addStyleName(SPUIDefinitions.TEXT_STYLE);
    labelValue.addStyleName("label-style");
    labelValue.addStyleName("avoid-tooltip");
    return labelValue;
}
 
Example 13
Source File: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private static Label getPercentHintLabel() {
    final Label percentSymbol = new Label("%");
    percentSymbol.addStyleName(ValoTheme.LABEL_TINY + " " + ValoTheme.LABEL_BOLD);
    percentSymbol.setSizeUndefined();
    return percentSymbol;
}
 
Example 14
Source File: MainLayout.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 4 votes vote down vote up
@PostConstruct
public void postConstuct() {
	setSizeFull();
	eventBus.subscribe(this);
	
	navbar = new HorizontalLayout();
	navbar.setWidth("100%");
	navbar.setMargin(true);
	navbar.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
	addComponent(navbar);
	
	final Label brand = new Label("Vaadin4Spring Security Demo");
	brand.addStyleName(ValoTheme.LABEL_H2);
	brand.addStyleName(ValoTheme.LABEL_NO_MARGIN);
	navbar.addComponent(brand);
	navbar.setComponentAlignment(brand, Alignment.MIDDLE_LEFT);
	navbar.setExpandRatio(brand, 1);
	
	btnHome = new Button("Home", FontAwesome.HOME);
	btnHome.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnHome.setData(ViewToken.HOME);
	btnHome.addClickListener(this);
	navbar.addComponent(btnHome);
	
	btnUser = new Button("User home", FontAwesome.USER);
	btnUser.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnUser.setData(ViewToken.USER);
	btnUser.addClickListener(this);
	navbar.addComponent(btnUser);
	
	btnAdmin = new Button("Admin home", FontAwesome.USER_MD);
	btnAdmin.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnAdmin.setData(ViewToken.ADMIN);
	btnAdmin.addClickListener(this);
	navbar.addComponent(btnAdmin);
	
	btnAdminHidden = new Button("Admin secret", FontAwesome.EYE_SLASH);
	btnAdminHidden.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnAdminHidden.setData(ViewToken.ADMIN_HIDDEN);
	btnAdminHidden.addClickListener(this);
	navbar.addComponent(btnAdminHidden);
	
	btnSignIn = new Button("Sign in", FontAwesome.SIGN_IN);
	btnSignIn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnSignIn.setData(ViewToken.SIGNIN);
	btnSignIn.addClickListener(this);
	navbar.addComponent(btnSignIn);
	
	btnSignUp = new Button("Sign up", FontAwesome.PENCIL_SQUARE_O);
	btnSignUp.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnSignUp.setData(ViewToken.SIGNUP);
	btnSignUp.addClickListener(this);
	navbar.addComponent(btnSignUp);
					
	btnLogout = new Button("Logout", FontAwesome.SIGN_OUT);
	btnLogout.setData("-");
	btnLogout.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	navbar.addComponent(btnLogout);
	btnLogout.addClickListener(new ClickListener() {
		
		@Override
		public void buttonClick(ClickEvent event) {
			logout();			
		}
	});
	
	viewContainer = new Panel();
	viewContainer.setSizeFull();
	addComponent(viewContainer);
	setExpandRatio(viewContainer, 1);				
}
 
Example 15
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 16
Source File: ServiceDescBasic.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    addStyleName(Reindeer.PANEL_LIGHT);
    setHeight("100%");

    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addStyleName("service-desc-basic");
    setContent(layout);

    // サービス基本情報
    VerticalLayout leftLayout = new VerticalLayout();
    leftLayout.setMargin(false);
    leftLayout.setSpacing(false);
    leftLayout.setWidth("100%");
    leftLayout.setHeight("100%");

    left = new BasicInfoOpe();
    left.setWidth("100%");
    leftLayout.addComponent(left);
    leftLayout.setExpandRatio(left, 1.0f);
    layout.addComponent(leftLayout);

    // 表同士の間隔をあける
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");
    layout.addComponent(padding);

    Label padding2 = new Label("");
    padding2.setWidth("1px");
    layout.addComponent(padding2);

    // 割り当てサーバ
    VerticalLayout rightLayout = new VerticalLayout();
    rightLayout.setMargin(false);
    rightLayout.setSpacing(false);
    rightLayout.setWidth("100%");
    rightLayout.setHeight("100%");

    right = new AttachServersOpe();
    right.setWidth("100%");
    rightLayout.addComponent(right);
    serverOpe = new ServiceSvrOperation();
    rightLayout.addComponent(serverOpe);
    rightLayout.setExpandRatio(right, 1.0f);
    layout.addComponent(rightLayout);

    layout.setExpandRatio(leftLayout, 40);
    layout.setExpandRatio(rightLayout, 60);
}
 
Example 17
Source File: ChipsterAdminUI.java    From chipster with MIT License 4 votes vote down vote up
public Component getTitle() {
	Label label = new Label("Chipster admin");
	label.addStyleName("title");
	label.setWidth(250, Unit.PIXELS);
	return label;
}
 
Example 18
Source File: ServerDescBasic.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setMargin(true);
    layout.setSpacing(false);
    layout.addStyleName("server-desc-basic");

    HorizontalLayout layout2 = new HorizontalLayout();
    layout2.setWidth("100%");
    layout2.setHeight("100%");
    layout2.setMargin(true);
    layout2.setSpacing(true);
    layout2.addStyleName("server-desc-basic");

    // サーバ基本情報
    left = new BasicInfo();
    left.setWidth("100%");
    layout2.addComponent(left);

    // 表同士の間隔をあける
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");
    layout2.addComponent(padding);

    Label padding2 = new Label("");
    padding2.setWidth("1px");
    layout2.addComponent(padding2);

    // 割り当てサービス
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        right = new AttachService();
        right.setHeight("100%");
        right.setWidth("100%");
        layout2.addComponent(right);
    }

    layout2.setExpandRatio(left, 40);
    if (right != null) {
        layout2.setExpandRatio(right, 60);
    } else {
        VerticalLayout dummyLayout = new VerticalLayout();
        dummyLayout.setSizeFull();
        layout2.addComponent(dummyLayout);
        layout2.setExpandRatio(dummyLayout, 60);
    }

    layout.addComponent(layout2);
    layout.setExpandRatio(layout2, 1.0f);
}
 
Example 19
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
public AzureDetailTab(InstanceDto instance, PlatformDto platform, ImageDto image) {
    this.instance = instance;
    this.platform = platform;
    this.image = image;

    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setWidth(COMBOBOX_WIDTH);
    sizeSelect.setNullSelectionAllowed(false);

    availabilitySetSelect = new ComboBox(ViewProperties.getCaption("field.availabilitySet"));
    availabilitySetSelect.setWidth(COMBOBOX_WIDTH);
    availabilitySetSelect.setNullSelectionAllowed(false);

    locationField = new TextField(ViewProperties.getCaption("field.location"));
    locationField.setImmediate(true);
    locationField.setWidth(TEXT_WIDTH);

    affinityField = new TextField(ViewProperties.getCaption("field.affinityGroup"));
    affinityField.setImmediate(true);
    affinityField.setWidth(TEXT_WIDTH);

    cloudServiceField = new TextField(ViewProperties.getCaption("field.cloudService"));
    cloudServiceField.setImmediate(true);
    cloudServiceField.setWidth(TEXT_WIDTH);

    subnetSelect = new ComboBox(ViewProperties.getCaption("field.subnet"));
    subnetSelect.setImmediate(true);
    subnetSelect.setWidth(COMBOBOX_WIDTH);
    subnetSelect.setNullSelectionAllowed(false);
    subnetSelect.setItemCaptionPropertyId(CIDR_BLOCK_CAPTION_ID);
    subnetSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);

    storageAccountField = new TextField(ViewProperties.getCaption("field.storageAccount"));
    storageAccountField.setImmediate(true);
    storageAccountField.setWidth(COMBOBOX_WIDTH);

    Label spacer = new Label(" ");
    spacer.addStyleName("desc-padding-horizontal");
    spacer.setHeight("5px");

    form.getLayout().addComponent(sizeSelect);
    form.getLayout().addComponent(availabilitySetSelect);
    form.getLayout().addComponent(subnetSelect);
    form.getLayout().addComponent(spacer);

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.setMargin(false);

    form.getLayout().addComponent(layout);

    addComponent(form);

    InstanceStatus status = InstanceStatus.fromStatus(instance.getInstance().getStatus());
    if (status != InstanceStatus.STOPPED) {
        // サーバがStopped以外の場合は、詳細設定タブ自体を変更不可とする
        form.setEnabled(false);
    } else {
        // 停止時は、いくつかの項目を変更不可とする
        locationField.setEnabled(false);
        // サーバが作成済みのとき、変更不可
        if (StringUtils.isNotEmpty(instance.getAzureInstance().getInstanceName())) {
            subnetSelect.setEnabled(false);
            // TODO 可用性セットが設定済みの場合も変更可能かもしれないが、
            // 現段階では、APIから可用性セットの情報を取得できないのでサーバー作成済みの場合、変更不可とする
            availabilitySetSelect.setEnabled(false);
        }
    }
}
 
Example 20
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);
}