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

The following examples show how to use com.vaadin.ui.ComboBox#setItemCaptionMode() . 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: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
@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 2
Source File: ComboBoxFieldBuilder.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public Field<?> build(Class<?> clazz, String name) {
	ComboBox combo = new ComboBox();
	fillComboBox(combo, clazz, name);
	combo.setItemCaptionMode(ItemCaptionMode.ID);
	
	return combo;
}
 
Example 3
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
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 4
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 5
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
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 6
Source File: WinLoadBalancerConfigListener.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    // メインフォーム
    Form mainForm = new Form();
    Layout mainLayout = mainForm.getLayout();
    addComponent(mainForm);

    // ロードバランサ名
    nameField = new TextField(ViewProperties.getCaption("field.loadBalancerName"));
    nameField.setReadOnly(true);
    mainLayout.addComponent(nameField);

    // サービス名
    serviceField = new TextField(ViewProperties.getCaption("field.loadBalancerService"));
    serviceField.setReadOnly(true);
    mainLayout.addComponent(serviceField);

    // ロードバランサ設定パネル
    Panel panel = new Panel(ViewProperties.getCaption("field.loadBalancerConfig"));
    ((Layout) panel.getContent()).setMargin(false, false, false, true);
    mainLayout.addComponent(panel);

    // サブフォーム
    subForm = new Form();
    FormLayout sublayout = (FormLayout) this.subForm.getLayout();
    sublayout.setMargin(false);
    sublayout.setSpacing(false);
    panel.getContent().addComponent(subForm);
    subForm.setHeight("200px");

    // ロードバランサポート
    loadBalancerPortField = new TextField(ViewProperties.getCaption("field.loadBalancerPort"));
    loadBalancerPortField.setWidth(TEXT_WIDTH);
    sublayout.addComponent(loadBalancerPortField);

    // サービスポート
    servicePortField = new TextField(ViewProperties.getCaption("field.loadBalancerServicePort"));
    servicePortField.setWidth(TEXT_WIDTH);
    sublayout.addComponent(servicePortField);

    // プロトコル
    protocolSelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerProtocol"));
    protocolSelect.setWidth(TEXT_WIDTH);
    protocolSelect.setImmediate(true);
    sublayout.addComponent(protocolSelect);
    protocolSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            protocolValueChange(event);
        }
    });

    // SSLキー
    sslKeySelect = new ComboBox(ViewProperties.getCaption("field.loadBalancerSSLKey"));
    sslKeySelect.setWidth(TEXT_WIDTH);
    sslKeySelect.addContainerProperty(SSLKEY_CAPTION_ID, String.class, null);
    sslKeySelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    sslKeySelect.setItemCaptionPropertyId(SSLKEY_CAPTION_ID);
    sublayout.addComponent(sslKeySelect);

    initValidation();
}
 
Example 7
Source File: WinCloudStackLoadBalancerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@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();
}