Java Code Examples for com.vaadin.ui.ComboBox#setNullSelectionAllowed()

The following examples show how to use com.vaadin.ui.ComboBox#setNullSelectionAllowed() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(sizeSelect);

    // キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(keySelect);

    addComponent(form);
}
 
Example 2
@Override
public void attach() {
    // サーバ名(Prefix)
    prefixField = new TextField(ViewProperties.getCaption("field.serverNamePrefix"));
    getLayout().addComponent(prefixField);

    // プラットフォーム
    cloudTable = new SelectCloudTable();
    getLayout().addComponent(cloudTable);

    // サーバ台数
    serverNumber = new ComboBox(ViewProperties.getCaption("field.serverNumber"));
    serverNumber.setWidth("110px");
    serverNumber.setMultiSelect(false);
    for (int i = 1; i <= MAX_ADD_SERVER; i++) {
        serverNumber.addItem(i);
    }
    serverNumber.setNullSelectionAllowed(false);
    serverNumber.setValue(1); // 初期値は1
    getLayout().addComponent(serverNumber);

    initValidation();
}
 
Example 3
private ComboBox createLanguageSelector() {
    ComboBox languageSelector = new ComboBox("com.vaadin.demo.dashboard.DashboardUI.Language");
    languageSelector.setImmediate(true);
    languageSelector.setNullSelectionAllowed(false);
    addLocale(Locale.ENGLISH, languageSelector);
    addLocale(Locale.FRENCH, languageSelector);
    addLocale(new Locale("es"), languageSelector);
    // languageSelector.setValue(I18NStaticService.getI18NServive().getLocale());
    /*-languageSelector.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Locale locale = (Locale) (event.getProperty().getValue());
            I18NStaticService.getI18NServive().setLocale(locale);
            getUI().requestRepaintAll();
        }
    });*/
    return languageSelector;
}
 
Example 4
/**
 * Combo box to pick the time zone offset.
 */
private void createMaintenanceTimeZoneControl() {
    // ComboBoxBuilder cannot be used here, because Builder do
    // 'comboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);'
    // which interferes our code: 'timeZone.addItems(getAllTimeZones());'
    timeZone = new ComboBox();
    timeZone.setId(UIComponentIdProvider.MAINTENANCE_WINDOW_TIME_ZONE_ID);
    timeZone.setCaption(i18n.getMessage("caption.maintenancewindow.timezone"));
    timeZone.addItems(getAllTimeZones());
    timeZone.setValue(getClientTimeZone());
    timeZone.addStyleName(ValoTheme.COMBOBOX_SMALL);
    timeZone.setTextInputAllowed(false);
    timeZone.setNullSelectionAllowed(false);
}
 
Example 5
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(sizeSelect);

    // キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setNullSelectionAllowed(false);
    keySelect.addContainerProperty(KEY_CAPTION_ID, String.class, null);
    keySelect.setItemCaptionPropertyId(KEY_CAPTION_ID);
    keySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    // Windowsの場合はキーペアを無効にする
    if (StringUtils.startsWith(image.getImage().getOs(), PCCConstant.OS_NAME_WIN)) {
        keySelect.setEnabled(false);
    }
    form.getLayout().addComponent(keySelect);

    // クラスタ
    clusterSelect = new ComboBox(ViewProperties.getCaption("field.cluster"));
    clusterSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(clusterSelect);

    // ルートサイズ
    rootSizeField = new TextField(ViewProperties.getCaption("field.rootSize"));
    rootSizeField.setImmediate(true);
    form.getLayout().addComponent(rootSizeField);

    addComponent(form);
}
 
Example 6
Source Project: chipster   File: InputOutputUI.java    License: MIT License 5 votes vote down vote up
protected void initElements() {
	type2 = new ComboBox();
	type2.setImmediate(true);
	type2.setWidth(WIDTH);
	lbMeta = new Label("Meta:");
	cbMeta = new CheckBox();
	cbMeta.setDescription("Is this element Meta data");
	
	optional.setWidth(WIDTH);
	type = new ComboBox();
	type.setWidth(WIDTH);
	type.setNullSelectionAllowed(false);
	type.setImmediate(true);
	type.addItem(SINGLE_FILE);
	type.addItem(MULTI_FILE);
	type.select(SINGLE_FILE);
	type.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = -1134955257251483403L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
				getSingleFileUI();
			} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
				getMultipleFilesUI();
			}
		}
	});
}
 
Example 7
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, true, true);
    setSpacing(false);

    // メインフォーム
    Form mainForm = new Form();
    addComponent(mainForm);

    // 監視プロトコル
    checkProtocolSelect = new ComboBox(ViewProperties.getCaption("field.checkProtocol"));
    checkProtocolSelect.setWidth(TEXT_WIDTH);
    checkProtocolSelect.setImmediate(true);
    checkProtocolSelect.setNullSelectionAllowed(false);
    checkProtocolSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            checkProtocolValueChange(event);
        }
    });
    mainForm.getLayout().addComponent(checkProtocolSelect);

    // 監視ポート
    checkPortField = new TextField(ViewProperties.getCaption("field.checkPort"));
    checkPortField.setWidth(TEXT_WIDTH);
    mainForm.getLayout().addComponent(checkPortField);

    // 監視Path
    checkPathField = new TextField(ViewProperties.getCaption("field.checkPath"));
    checkPathField.setImmediate(true);
    mainForm.getLayout().addComponent(checkPathField);

    // ヘルスチェック詳細設定パネル
    Panel panel = new Panel(ViewProperties.getCaption("field.healthCheckDetail"));
    ((Layout) panel.getContent()).setMargin(false, false, false, true);
    ((Layout) panel.getContent()).setHeight("200px");
    ((Layout) panel.getContent()).setWidth("315px");
    mainForm.getLayout().addComponent(panel);

    // サブフォーム
    Form subForm = new Form();
    subForm.setStyleName("panel-healthcheck-setting");
    subForm.getLayout().setMargin(false, false, false, false);
    panel.addComponent(subForm);

    // タイムアウト時間
    checkTimeoutField = new TextField(ViewProperties.getCaption("field.checkTimeout"));
    checkTimeoutField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(checkTimeoutField);

    // ヘルスチェック間隔
    checkIntervalField = new TextField(ViewProperties.getCaption("field.checkInterval"));
    checkIntervalField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(checkIntervalField);

    // 障害閾値
    unhealthyThresholdField = new TextField(ViewProperties.getCaption("field.checkDownThreshold"));
    unhealthyThresholdField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(unhealthyThresholdField);

    // 復帰閾値
    healthyThresholdField = new TextField(ViewProperties.getCaption("field.checkRecoverThreshold"));
    healthyThresholdField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(healthyThresholdField);

    // UltraMonkeyロードバランサの場合、復帰閾値は設定できない
    if (PCCConstant.LOAD_BALANCER_ULTRAMONKEY.equals(loadBalancerType)) {
        healthyThresholdField.setEnabled(false);
    }

    initValidation();
}
 
Example 8
public VcloudDetailTab(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);

    //ストレージタイプ
    storageTypeSelect = new ComboBox(ViewProperties.getCaption("field.storageType"));
    storageTypeSelect.setWidth(WIDTH_COMBOBOX);
    storageTypeSelect.setNullSelectionAllowed(false);
    storageTypeSelect.setItemCaptionPropertyId(CID_STORAGE_TYPE);
    storageTypeSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);

    //サーバサイズ
    sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
    sizeSelect.setWidth(WIDTH_COMBOBOX);
    sizeSelect.setNullSelectionAllowed(false);

    //キーペア
    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setWidth(KEY_PAIR_WIDTH_COMBOBOX);
    keySelect.setNullSelectionAllowed(false);
    keySelect.setItemCaptionPropertyId(CID_KEY_PAIR);
    keySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    // Windowsの場合はキーペアを無効にする
    if (StringUtils.startsWith(image.getImage().getOs(), PCCConstant.OS_NAME_WIN)) {
        keySelect.setEnabled(false);
    }

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

    //データディスクテーブル
    dataDiskTable = new DataDiskTable();

    //データディスクボタン
    dataDiskTableButtons = new DataDiskTableButtons();

    form.getLayout().addComponent(storageTypeSelect);
    form.getLayout().addComponent(sizeSelect);
    form.getLayout().addComponent(keySelect);
    form.getLayout().addComponent(spacer);
    form.getLayout().addComponent(dataDiskTable);
    form.getLayout().addComponent(dataDiskTableButtons);

    addComponent(form);

    // サーバがStopped以外の場合は、変更不可とする
    InstanceStatus status = InstanceStatus.fromStatus(instance.getInstance().getStatus());
    if (status != InstanceStatus.STOPPED) {
        storageTypeSelect.setEnabled(false);
        sizeSelect.setEnabled(false);
        keySelect.setEnabled(false);
    }
}
 
Example 9
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 10
public OpenStackDetailTab(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);

    zoneSelect = new ComboBox(ViewProperties.getCaption("field.zone"));
    zoneSelect.setWidth(COMBOBOX_WIDTH);
    zoneSelect.setNullSelectionAllowed(false);
    zoneSelect.setItemCaptionPropertyId(ZONE_CAPTION_ID);
    zoneSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);

    grpSelect = new ComboBox(ViewProperties.getCaption("field.securityGroup"));
    grpSelect.setWidth(COMBOBOX_WIDTH);
    grpSelect.setImmediate(true);
    grpSelect.setNullSelectionAllowed(false);

    keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
    keySelect.setWidth(COMBOBOX_WIDTH);
    keySelect.setNullSelectionAllowed(false);

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

    form.getLayout().addComponent(sizeSelect);
    form.getLayout().addComponent(zoneSelect);
    form.getLayout().addComponent(grpSelect);
    form.getLayout().addComponent(keySelect);
    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 {
        // 停止時は、いくつかの項目を変更不可とする
        if (StringUtils.isNotEmpty(instance.getOpenstackInstance().getInstanceId())) {
            // 一度でも起動した場合、項目を変更不可とする
            form.setEnabled(false);
        }
    }
}
 
Example 11
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    // フォーム
    Form form = new Form();
    form.setSizeFull();
    addComponent(form);

    // ロードバランサ名
    loadBalancerNameField = new TextField(ViewProperties.getCaption("field.loadBalancerName"));
    form.getLayout().addComponent(loadBalancerNameField);

    // コメント
    commentField = new TextField(ViewProperties.getCaption("field.comment"));
    commentField.setWidth("95%");
    form.getLayout().addComponent(commentField);

    // プラットフォーム
    cloudLabel = new Label();
    cloudLabel.setCaption(ViewProperties.getCaption("field.cloud"));
    cloudLabel.addStyleName("icon-label");
    form.getLayout().addComponent(cloudLabel);

    // ロードバランサ種別
    typeLabel = new Label();
    typeLabel.setCaption(ViewProperties.getCaption("field.loadBalancerType"));
    typeLabel.addStyleName("icon-label");
    form.getLayout().addComponent(typeLabel);

    // 割り当てサービス
    serviceSelect = new ComboBox();
    serviceSelect.setCaption(ViewProperties.getCaption("field.loadBalancerService"));
    serviceSelect.setNullSelectionAllowed(false);
    serviceSelect.addContainerProperty(SERVICE_CAPTION_ID, String.class, null);
    serviceSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    serviceSelect.setItemCaptionPropertyId(SERVICE_CAPTION_ID);
    form.getLayout().addComponent(serviceSelect);

    // アルゴリズム
    algorithmSelect = new ComboBox();
    algorithmSelect.setCaption(ViewProperties.getCaption("field.algorithm"));
    algorithmSelect.setNullSelectionAllowed(false);
    form.getLayout().addComponent(algorithmSelect);

    // パブリックポート
    publicPortField = new TextField(ViewProperties.getCaption("field.publicport"));
    publicPortField.setWidth("95%");
    form.getLayout().addComponent(publicPortField);

    // プライベートポート
    privatePortField = new TextField(ViewProperties.getCaption("field.privateport"));
    privatePortField.setWidth("95%");
    form.getLayout().addComponent(privatePortField);

    initValidation();
}