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

The following are Jave code examples for showing how to use setNullSelectionAllowed() of the com.vaadin.ui.ComboBox class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: osc-core   File: BindSecurityGroupWindow.java   Source Code and License Vote up 6 votes
private ComboBox getPolicyComboBox(List<PolicyDto> policyDtoList) {
	ComboBox policy = new ComboBox("Select Policy");
	policy.setTextInputAllowed(false);
	policy.setNullSelectionAllowed(false);
	policy.setImmediate(true);
	policy.setRequired(true);
	policy.setRequiredError("Policy cannot be empty");

	BeanItemContainer<PolicyDto> policyListContainer = new BeanItemContainer<>(PolicyDto.class,
			policyDtoList);
	policy.setContainerDataSource(policyListContainer);
	policy.setItemCaptionPropertyId("policyName");

	if (policyListContainer.size() > 0) {
		policy.select(policyListContainer.getIdByIndex(0));
	}

	policy.setEnabled(false);

	return policy;
}
 
Example 2
Project: osc-core   File: BaseDAWindow.java   Source Code and License Vote up 6 votes
private ComboBox createDomainComboBox(List<DomainDto> dl) {
    ComboBox domainComboBox = new ComboBox();
    BeanItemContainer<DomainDto> domainContainer = new BeanItemContainer<DomainDto>(DomainDto.class, dl);
    ApplianceManagerConnectorDto mc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();

    domainComboBox.setContainerDataSource(domainContainer);
    domainComboBox.setTextInputAllowed(false);
    domainComboBox.setNullSelectionAllowed(false);
    domainComboBox.setItemCaptionPropertyId("name");
    domainComboBox.setEnabled(mc.isPolicyMappingSupported());

    if (domainComboBox.getItemIds().size() > 0) {
        domainComboBox.select(domainContainer.getIdByIndex(0));
    }
    return domainComboBox;
}
 
Example 3
Project: osc-core   File: BaseDAWindow.java   Source Code and License Vote up 6 votes
private ComboBox createEncapsulationTypeComboBox(VirtualizationType virtualizationType,
        List<TagEncapsulationType> types) {
    ComboBox encapsulationType = new ComboBox();
    encapsulationType.setTextInputAllowed(false);
    encapsulationType.setNullSelectionAllowed(true);

    BeanItemContainer<TagEncapsulationType> encapsulationTypeContainer = new BeanItemContainer<TagEncapsulationType>(
            TagEncapsulationType.class, types);
    encapsulationType.setContainerDataSource(encapsulationTypeContainer);
    ApplianceManagerConnectorDto currentMc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();

    if (!virtualizationType.isOpenstack() || (currentMc != null && !currentMc.isPolicyMappingSupported())) {
        encapsulationType.setEnabled(false);
    }
    return encapsulationType;
}
 
Example 4
Project: cuba   File: WebSearchPickerField.java   Source Code and License Vote up 6 votes
public WebSearchPickerField() {
    final ComboBox selectComponent = component;
    WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
        @Override
        public void setRequired(boolean required) {
            super.setRequired(required);
            selectComponent.setNullSelectionAllowed(!required);
        }
    };
    pickerField = new WebPickerField(picker);

    Messages messages = AppBeans.get(Messages.class);
    setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));

    // Required for custom components in fieldgroup
    initValueSync(selectComponent, picker);
}
 
Example 5
Project: metl   File: EditAgentDeploymentPanel.java   Source Code and License Vote up 6 votes
protected ComboBox getLogLevelComponent() {
    final ComboBox combo = new ComboBox("Log Level");
    combo.setNullSelectionAllowed(false);
    combo.setWidth(200, Unit.PIXELS);
    LogLevel[] levels = LogLevel.values();
    for (LogLevel logLevel : levels) {
        combo.addItem(logLevel.name());
    }
    combo.setValue(agentDeployment.getLogLevel());
    combo.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            agentDeployment.setLogLevel((String) combo.getValue());
            saveAgentDeployment(agentDeployment);
        }
    });
    return combo;
}
 
Example 6
Project: metl   File: EditAgentDeploymentPanel.java   Source Code and License Vote up 6 votes
protected ComboBox getStartTypeComponent() {
    startTypeCombo = new ComboBox("Start Type");
    startTypeCombo.setWidth(200, Unit.PIXELS);
    startTypeCombo.setNullSelectionAllowed(false);
    StartType[] values = StartType.values();
    for (StartType value : values) {
        startTypeCombo.addItem(value.name());
    }
    startTypeCombo.setValue(agentDeployment.getStartType());
    startTypeCombo.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            agentDeployment.setStartType((String) startTypeCombo.getValue());
            updateScheduleEnable();
            for (int i = 0; i < 7; i++) {
                ListSelect listSelect = ((ListSelect) cronLayout.getComponent(i));
                for (Object itemId : listSelect.getItemIds()) {
                    listSelect.unselect(itemId);
                }
                listSelect.select(listSelect.getItemIds().iterator().next());
            }
            String startExpression = null;
            if (agentDeployment.getStartType().equals(StartType.SCHEDULED_CRON.name())) {
                startExpression = "0 0 0 * * ?";
            }
            startExpressionTextField.setValue(startExpression);
            agentDeployment.setStartExpression(startExpression);
            updateScheduleFields();
            saveAgentDeployment(agentDeployment);
        }
    });
    return startTypeCombo;
}
 
Example 7
Project: primecloud-controller   File: WinServerEdit.java   Source Code and License Vote up 6 votes
@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 8
Project: primecloud-controller   File: WinServerAddSimple.java   Source Code and License Vote up 6 votes
@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 9
Project: dhconvalidator   File: UserSwitchPanel.java   Source Code and License Vote up 6 votes
/**
 * Setup UI.
 */
private void initComponents() {
	List<User> users = UserList.INSTANCE.getUsers();
	userSwitchBox = new ComboBox(Messages.getString("UserSwitchPanel.boxCaption")); //$NON-NLS-1$
	setUsers(users);
	User current = (User) VaadinSession.getCurrent().getAttribute(SessionStorageKey.USER.name());
	userSwitchBox.setValue(current);
	
	userSwitchBox.setDescription(
		Messages.getString("UserSwitchPanel.boxDescription")); //$NON-NLS-1$
	userSwitchBox.setNewItemsAllowed(false);
	userSwitchBox.setNullSelectionAllowed(false);
	
	addComponent(userSwitchBox);
	btReload = new Button(Messages.getString("UserSwitchPanel.reloadCaption")); //$NON-NLS-1$
	btReload.setStyleName(BaseTheme.BUTTON_LINK);
	btReload.addStyleName("plain-link"); //$NON-NLS-1$
	
	addComponent(btReload);
}
 
Example 10
Project: mycollab   File: DateSelectionField.java   Source Code and License Vote up 6 votes
public DateSelectionField() {
    cboMonth = new ComboBox();
    cboMonth.setNullSelectionAllowed(true);
    cboMonth.setPageLength(12);
    cboMonth.setImmediate(true);

    addMonthItems();
    cboMonth.setWidth("117px");

    cboDate = new ComboBox();
    cboDate.setNullSelectionAllowed(true);
    cboDate.setImmediate(true);

    addDayItems();
    cboDate.setWidth("80px");

    cboYear = new ComboBox();
    cboYear.setNullSelectionAllowed(true);
    cboYear.setImmediate(true);

    addYearItems();
    cboYear.setWidth("80px");
}
 
Example 11
Project: gazpachoquest   File: OldLoginView.java   Source Code and License Vote up 6 votes
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 12
Project: hypothesis   File: ExportScorePresenterImpl.java   Source Code and License Vote up 6 votes
private void buildSelection() {
	exportSelectionType = new ComboBox();
	exportSelectionType.setTextInputAllowed(false);
	exportSelectionType.setNullSelectionAllowed(false);
	exportSelectionType.setEnabled(false);

	exportSelectionType.addItem(Messages.getString("Caption.Item.Selected"));
	exportSelectionType.addItem(Messages.getString("Caption.Item.All"));
	exportSelectionType.select(Messages.getString("Caption.Item.Selected"));

	exportSelectionType.addValueChangeListener(new Property.ValueChangeListener() {
		public void valueChange(ValueChangeEvent event) {
			allTestsSelected = exportSelectionType.getValue().equals(Messages.getString("Caption.Item.All"));
			mainEvent.fire(new MainUIEvent.PackSelectionChangedEvent());
		}
	});
}
 
Example 13
Project: hypothesis   File: UserManagementPresenterImpl.java   Source Code and License Vote up 6 votes
@Override
protected ComboBox buildSelection() {
	final ComboBox selectionType = new ComboBox();
	selectionType.setTextInputAllowed(false);
	selectionType.setNullSelectionAllowed(false);

	selectionType.addItem(Messages.getString("Caption.Item.Selected"));
	selectionType.addItem(Messages.getString("Caption.Item.All"));
	selectionType.select(Messages.getString("Caption.Item.Selected"));

	selectionType.addValueChangeListener(e -> {
		allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
		mainEvent.fire(new MainUIEvent.UserSelectionChangedEvent());
	});

	return selectionType;
}
 
Example 14
Project: VaadinUtils   File: FormHelper.java   Source Code and License Vote up 6 votes
public ComboBox bindEnumField(ComboBox comboBox, AbstractLayout form, ValidatingFieldGroup<E> group,
		String fieldLabel, String fieldName, Class<?> clazz)
{
	ComboBox field = comboBox;
	field.setCaption(fieldLabel);
	field.setContainerDataSource(createContainerFromEnumClass(fieldName, clazz));
	field.setItemCaptionPropertyId(fieldName);
	// field.setCaption(fieldLabel);
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(true);
	field.setWidth(STANDARD_COMBO_WIDTH);
	field.setPopupWidth("100%");

	field.setImmediate(true);
	field.setId(fieldLabel.replace(" ", ""));
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);

	form.addComponent(field);
	return field;
}
 
Example 15
Project: osc-core   File: BindSecurityGroupWindow.java   Source Code and License Vote up 5 votes
private ComboBox getFailurePolicyComboBox() {
	ComboBox failurePolicy = new ComboBox("Select Failure Policy");
	failurePolicy.setTextInputAllowed(false);
	failurePolicy.setNullSelectionAllowed(false);
	failurePolicy.setImmediate(true);
	failurePolicy.setRequired(true);
	failurePolicy.setRequiredError("Failure Policy cannot be empty");

	failurePolicy.addItems(FailurePolicyType.FAIL_OPEN, FailurePolicyType.FAIL_CLOSE);
	failurePolicy.select(FailurePolicyType.FAIL_OPEN);
	failurePolicy.setEnabled(false);

	return failurePolicy;
}
 
Example 16
Project: cuba   File: WebLookupPickerField.java   Source Code and License Vote up 5 votes
@Override
protected void createComponent() {
    super.createComponent();

    // delegate error indication
    this.componentErrorHandler = message -> {
        if (message instanceof UserError) {
            return false;
        }

        pickerField.component.setComponentError(message);
        return true;
    };

    component.setCustomValueEquals(InstanceUtils::propertyValueEquals);

    final ComboBox selectComponent = component;
    final WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
        @Override
        public void setRequired(boolean required) {
            super.setRequired(required);
            selectComponent.setNullSelectionAllowed(!required);
        }
    };
    pickerField = new WebPickerField(picker);

    // Required for custom components in fieldgroup
    initValueSync(selectComponent, picker);
}
 
Example 17
Project: KrishnasSpace   File: BasicFormImpl.java   Source Code and License Vote up 5 votes
/**
 * @param caption
 * @param bindName
 * @param container
 *            TODO
 * @return
 */
private ComboBox getComboBox(String caption, String bindName,
		Container container) {
	ComboBox comboBox = new ComboBox(caption);
	comboBox.setImmediate(true);
	comboBox.setValidationVisible(false);
	comboBox.setNewItemsAllowed(false);
	comboBox.setFilteringMode(FilteringMode.CONTAINS);
	comboBox.setNullSelectionAllowed(false);
	fieldGroup.bind(comboBox, bindName);
	comboBox.setContainerDataSource(container);
	return comboBox;
}
 
Example 18
Project: KrishnasSpace   File: EditableGrid.java   Source Code and License Vote up 5 votes
/**
 * @return
 */
private Field<?> getComboBox(String requiredErrorMsg, Collection<?> items) {
	ComboBox comboBox = new ComboBox();
	comboBox.setNullSelectionAllowed(true);
	IndexedContainer container = new IndexedContainer(items);
	comboBox.setContainerDataSource(container);
	comboBox.setRequired(true);
	comboBox.setRequiredError(requiredErrorMsg);
	return comboBox;
}
 
Example 19
Project: SecureBPMN   File: GroupDetailPanel.java   Source Code and License Vote up 5 votes
protected void initGroupProperties() {
  detailsGrid = new GridLayout(2, 3);
  detailsGrid.setSpacing(true);
  detailLayout.setMargin(true, true, true, false);
  detailLayout.addComponent(detailsGrid);
  
  // id
  Label idLabel = new Label(i18nManager.getMessage(Messages.GROUP_ID) + ": ");
  idLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(idLabel);
  Label idValueLabel = new Label(group.getId());
  detailsGrid.addComponent(idValueLabel);
  
  // name
  Label nameLabel = new Label(i18nManager.getMessage(Messages.GROUP_NAME) + ": ");
  nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(nameLabel);
  if (!editingDetails) {
    Label nameValueLabel = new Label(group.getName());
    detailsGrid.addComponent(nameValueLabel);
  } else {
    nameTextField = new TextField(null, group.getName());
    detailsGrid.addComponent(nameTextField);
  }
  
  // Type
  Label typeLabel = new Label(i18nManager.getMessage(Messages.GROUP_TYPE) + ": ");
  typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(typeLabel);
  if (!editingDetails) {
    Label typeValueLabel = new Label(group.getType());
    detailsGrid.addComponent(typeValueLabel);
  } else {
    typeCombobox = new ComboBox(null, Arrays.asList("assignment", "security-role"));
    typeCombobox.setNullSelectionAllowed(false);
    typeCombobox.setInvalidAllowed(false);
    typeCombobox.select(group.getType());
    detailsGrid.addComponent(typeCombobox);
  }
}
 
Example 20
Project: trader   File: TradingAreaView.java   Source Code and License Vote up 5 votes
private Component buildQuoteSelector() {
		quoteSelector = new ComboBox();
		
//		quoteSelector.setInputPrompt("Select Stock/Index...");
		
//		quoteSelector.setItemCaptionPropertyId(Quote.PROPERTY_NAME);
//		quoteSelector.setItemCaptionMode(ItemCaptionMode.PROPERTY);

		
        // Set full width
//		quoteSelector.setWidth(100.0f, Unit.PERCENTAGE);
		quoteSelector.addStyleName("borderless");
		
        // Set the appropriate filtering mode for this example
		quoteSelector.setFilteringMode(FilteringMode.CONTAINS);
		quoteSelector.setImmediate(true);
 
        // Disallow null selections
		quoteSelector.setNullSelectionAllowed(false);
		
		quoteSelector.addValueChangeListener(e -> {
                chart.setChartSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getChartSrc());
                ticker.setSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getTickerSrc());
                chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.LINE.ordinal()*2).setChecked(false);
                chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.CANDLE.ordinal()*2).setChecked(true);
		});
		
		return quoteSelector;
	}
 
Example 21
Project: primecloud-controller   File: WinServerEdit.java   Source Code and License Vote up 5 votes
@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 22
Project: mycollab   File: TicketComponentFactoryImpl.java   Source Code and License Vote up 5 votes
NewTicketWindow(Date date, final Integer prjId, final Integer milestoneId, boolean isIncludeMilestone) {
    super(UserUIContext.getMessage(TicketI18nEnum.NEW));
    MVerticalLayout content = new MVerticalLayout();
    withModal(true).withResizable(false).withCenter().withWidth("1200px").withContent(content);

    typeSelection = new ComboBox();
    typeSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        typeSelection.addItem(UserUIContext.getMessage(TaskI18nEnum.SINGLE));
        typeSelection.setItemIcon(UserUIContext.getMessage(TaskI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK));
    }

    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        typeSelection.addItem(UserUIContext.getMessage(BugI18nEnum.SINGLE));
        typeSelection.setItemIcon(UserUIContext.getMessage(BugI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG));
    }

    if (isIncludeMilestone && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        typeSelection.addItem(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
        typeSelection.setItemIcon(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE), ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
    }

    typeSelection.setNullSelectionAllowed(false);
    if (CollectionUtils.isNotEmpty(typeSelection.getItemIds())) {
        typeSelection.select(typeSelection.getItemIds().iterator().next());
    } else {
        throw new SecureAccessException();
    }

    typeSelection.setNullSelectionAllowed(false);
    typeSelection.addValueChangeListener(valueChangeEvent -> doChange(date, prjId, milestoneId));

    GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 1);
    formLayoutHelper.addComponent(typeSelection, UserUIContext.getMessage(GenericI18Enum.FORM_TYPE), 0, 0);
    formLayout = new CssLayout();
    formLayout.setWidth("100%");
    content.with(formLayoutHelper.getLayout(), formLayout);
    doChange(date, prjId, milestoneId);
}
 
Example 23
Project: FiWare-Template-Handler   File: GroupDetailPanel.java   Source Code and License Vote up 5 votes
protected void initGroupProperties() {
  detailsGrid = new GridLayout(2, 3);
  detailsGrid.setSpacing(true);
  detailLayout.setMargin(true, true, true, false);
  detailLayout.addComponent(detailsGrid);
  
  // id
  Label idLabel = new Label(i18nManager.getMessage(Messages.GROUP_ID) + ": ");
  idLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(idLabel);
  Label idValueLabel = new Label(group.getId());
  detailsGrid.addComponent(idValueLabel);
  
  // name
  Label nameLabel = new Label(i18nManager.getMessage(Messages.GROUP_NAME) + ": ");
  nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(nameLabel);
  if (!editingDetails) {
    Label nameValueLabel = new Label(group.getName());
    detailsGrid.addComponent(nameValueLabel);
  } else {
    nameTextField = new TextField(null, group.getName());
    detailsGrid.addComponent(nameTextField);
  }
  
  // Type
  Label typeLabel = new Label(i18nManager.getMessage(Messages.GROUP_TYPE) + ": ");
  typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
  detailsGrid.addComponent(typeLabel);
  if (!editingDetails) {
    Label typeValueLabel = new Label(group.getType());
    detailsGrid.addComponent(typeValueLabel);
  } else {
    typeCombobox = new ComboBox(null, Arrays.asList("assignment", "security-role"));
    typeCombobox.setNullSelectionAllowed(false);
    typeCombobox.setInvalidAllowed(false);
    typeCombobox.select(group.getType());
    detailsGrid.addComponent(typeCombobox);
  }
}
 
Example 24
Project: academ   File: ListadoCalificacionesEvaluacion.java   Source Code and License Vote up 5 votes
public void cargarCalificacionesEvaluacion(EvaluacionBO evaluacion, UsuarioBO evaluador, List<TemaBO> temas, List<NivelDeConocimientoBO> nivelesDeConocimiento, List<CalificacionBO> calificacionesPrevias) {
	tablaCalificacionesEvaluacion.removeAllItems();
	
	for (TemaBO tema : temas) {
		CalificacionBO calificacion = new CalificacionBO();
		calificacion.setEvaluacion(evaluacion);
		calificacion.setEvaluador(evaluador.getNombre());
		calificacion.setTema(tema);
		
		ComboBox comboBox = new ComboBox();
		for (NivelDeConocimientoBO nivelDeConocimientoBO : nivelesDeConocimiento) {
			comboBox.addItem(nivelDeConocimientoBO);
		}
		comboBox.setNullSelectionAllowed(false);
		boolean noTieneCalificacion = true;
		for (Iterator<CalificacionBO> iterator = calificacionesPrevias.iterator(); noTieneCalificacion && iterator.hasNext();) {
			CalificacionBO calificacionBO = (CalificacionBO) iterator.next();
			if (tema.equals(calificacionBO.getTema())) {
				noTieneCalificacion = false;
				comboBox.select(calificacionBO.getNivelDeConocimiento());
				calificacion.setNivelDeConocimiento(calificacionBO.getNivelDeConocimiento());
			} 
		} 
		if (noTieneCalificacion) {
			comboBox.select(nivelesDeConocimiento.get(0));
			calificacion.setNivelDeConocimiento(nivelesDeConocimiento.get(0));
		}
		
		String descripcion = "";
		for (SubtemaBO subtema : tema.getSubtemas()) {
			descripcion += subtema.getNombre() +  ". ";
		}
		
		tablaCalificacionesEvaluacion.addItem(new Object[] {tema.getId(), comboBox, tema.getNombre(), descripcion}, calificacion);
	}
}
 
Example 25
Project: extacrm   File: LoanCalculatorForm.java   Source Code and License Vote up 5 votes
public LoanCalculatorForm() {
    super("Рассчет кредита и подбор кредитного продукта");

    final VerticalLayout mainLayout = new VerticalLayout();

    final ExtaFormLayout paramForm = new ExtaFormLayout();
    paramForm.addComponent(new FormGroupHeader("Параметры кредита"));
    priceField = new EditField("Стоимость техники", "Введите стоимость техники");
    priceField.setRequired(true);
    downpaymentField = new PercentOfField("Первоначальный взнос", "Введите сумму первоначального взноса по кредиту");
    downpaymentField.setRequired(true);
    paramForm.addComponent(downpaymentField);

    periodField = new ComboBox("Срок кредитования");
    periodField.setDescription("Введите период кредитования (срок кредита)");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками кредита
    fillPeriodFieldItems();
    paramForm.addComponent(periodField);

    summField = new EditField("Сумма кредита", "Введите сумму кредита (Также может рассчитываться автоматически)");
    summField.setRequired(true);
    paramForm.addComponent(summField);


    mainLayout.addComponent(paramForm);

    setContent(mainLayout);
}
 
Example 26
Project: VaadinUtils   File: FormHelper.java   Source Code and License Vote up 5 votes
public <L> ComboBox bindComboBox(AbstractLayout form, ValidatingFieldGroup<E> fieldGroup, String fieldName,
		String fieldLabel, Collection<?> options)
{
	ComboBox field = new SplitComboBox(fieldLabel, options);
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(true);
	field.setWidth(STANDARD_COMBO_WIDTH);
	field.setPopupWidth("100%");
	field.setImmediate(true);
	form.addComponent(field);
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);
	return field;
}
 
Example 27
Project: VaadinUtils   File: FormHelper.java   Source Code and License Vote up 5 votes
public <L> ComboBox bindComboBox(AbstractLayout form, ValidatingFieldGroup<E> fieldGroup, String fieldName,
		String fieldLabel, Container options)
{
	ComboBox field = new SplitComboBox(fieldLabel, options);
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(true);
	field.setWidth(STANDARD_COMBO_WIDTH);
	field.setPopupWidth("100%");
	field.setImmediate(true);
	form.addComponent(field);
	addValueChangeListeners(field);
	doBinding(group, fieldName, field);
	return field;
}
 
Example 28
Project: VaadinUtils   File: ReportParameterReportChooser.java   Source Code and License Vote up 5 votes
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterReportChooser(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
Example 29
Project: VaadinUtils   File: ReportParameterEnum.java   Source Code and License Vote up 5 votes
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterEnum(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
Example 30
Project: academ   File: ListadoCalificacionesEvaluacion.java   Source Code and License Vote up 5 votes
public void cargarCalificacionesEvaluacion(EvaluacionBO evaluacion, UsuarioBO evaluador, List<TemaBO> temas, List<NivelDeConocimientoBO> nivelesDeConocimiento, List<CalificacionBO> calificacionesPrevias) {
	tablaCalificacionesEvaluacion.removeAllItems();
	
	for (TemaBO tema : temas) {
		CalificacionBO calificacion = new CalificacionBO();
		calificacion.setEvaluacion(evaluacion);
		calificacion.setEvaluador(evaluador.getNombre());
		calificacion.setTema(tema);
		
		ComboBox comboBox = new ComboBox();
		for (NivelDeConocimientoBO nivelDeConocimientoBO : nivelesDeConocimiento) {
			comboBox.addItem(nivelDeConocimientoBO);
		}
		comboBox.setNullSelectionAllowed(false);
		boolean noTieneCalificacion = true;
		for (Iterator<CalificacionBO> iterator = calificacionesPrevias.iterator(); noTieneCalificacion && iterator.hasNext();) {
			CalificacionBO calificacionBO = (CalificacionBO) iterator.next();
			if (tema.equals(calificacionBO.getTema())) {
				noTieneCalificacion = false;
				comboBox.select(calificacionBO.getNivelDeConocimiento());
				calificacion.setNivelDeConocimiento(calificacionBO.getNivelDeConocimiento());
			} 
		} 
		if (noTieneCalificacion) {
			comboBox.select(nivelesDeConocimiento.get(0));
			calificacion.setNivelDeConocimiento(nivelesDeConocimiento.get(0));
		}
		
		tablaCalificacionesEvaluacion.addItem(new Object[] {tema.getId(), comboBox, tema.getNombre(), tema.getDescripcion()}, calificacion);
	}
}
 
Example 31
Project: scoutmaster   File: RaffleAllocationChildView.java   Source Code and License Vote up 5 votes
@Override
protected Component buildEditor(final ValidatingFieldGroup<RaffleAllocation> fieldGroup2)
{
	final MultiColumnFormLayout<RaffleAllocation> overviewForm = new MultiColumnFormLayout<RaffleAllocation>(1,
			this.fieldGroup);
	overviewForm.setColumnFieldWidth(0, 240);
	overviewForm.setColumnLabelWidth(0, 110);
	// overviewForm.setColumnExpandRatio(0, 1.0f);
	overviewForm.setSizeFull();

	final FormHelper<RaffleAllocation> formHelper = overviewForm.getFormHelper();

	final ComboBox allocatedTo = formHelper.new EntityFieldBuilder<Contact>().setLabel("Allocated To")
			.setField(RaffleAllocation_.allocatedTo).setListFieldName(Contact_.fullname).build();
	allocatedTo.setFilteringMode(FilteringMode.CONTAINS);
	allocatedTo.setTextInputAllowed(true);
	allocatedTo.setNullSelectionAllowed(true);
	allocatedTo.setDescription("The person the book has been allocated to.");

	overviewForm.bindDateField("Date Allocated", RaffleAllocation_.dateAllocated, "yyyy-MM-dd", Resolution.DAY);

	final ComboBox issuedBy = formHelper.new EntityFieldBuilder<Contact>().setLabel("Issued By")
			.setField(RaffleAllocation_.issuedBy).setListFieldName(Contact_.fullname).build();
	issuedBy.setFilteringMode(FilteringMode.CONTAINS);
	issuedBy.setTextInputAllowed(true);
	issuedBy.setDescription("The leader that issued the book to the member.");
	issuedBy.setNullSelectionAllowed(true);

	overviewForm.bindDateField("Date Issued", RaffleAllocation_.dateIssued, "yyyy-MM-dd", Resolution.DAY);

	final TextField bookCountField = overviewForm.bindTextField("Book Count", "bookCount");
	bookCountField.setReadOnly(true);

	overviewForm.bindTextAreaField("Notes", RaffleAllocation_.notes, 6);

	return overviewForm;
}
 
Example 32
Project: cuba   File: WebComponentsUtils.java   Source Code and License Vote up 4 votes
@Deprecated
public static void allowNullSelection(LookupField lookupField) {
    ComboBox vCombobox = (ComboBox) WebComponentsHelper.unwrap(lookupField);
    vCombobox.setNullSelectionAllowed(true);
}
 
Example 33
Project: cuba   File: WebComponentsUtils.java   Source Code and License Vote up 4 votes
@Deprecated
public static void disallowNullSelection(LookupField lookupField) {
    ComboBox vCombobox = (ComboBox) WebComponentsHelper.unwrap(lookupField);
    vCombobox.setNullSelectionAllowed(false);
}
 
Example 34
Project: tree-grid   File: DemoUI.java   Source Code and License Vote up 4 votes
@Override
protected void init(VaadinRequest request) {

    final VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    final ComboBox combo = new ComboBox(null, Arrays.asList(DEMO_SIMPLE, DEMO_IMAGE));
    combo.setNullSelectionAllowed(false);
    combo.setSizeUndefined();
    layout.addComponent(combo);

    final TreeGrid grid = new TreeGrid();
    grid.setWidth(800, Unit.PIXELS);

    DemoContainer container = new DemoContainer();
    grid.setContainerDataSource(container);

    grid.getColumn(DemoContainer.PROPERTY_ICON).setRenderer(new ImageRenderer());
    grid.getColumn(DemoContainer.PROPERTY_ICON).setEditable(false);

    grid.setSelectionMode(Grid.SelectionMode.SINGLE);
    grid.setColumnReorderingAllowed(true);
    grid.setEditorEnabled(true);

    layout.addComponent(grid);

    combo.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            switch ((String) event.getProperty().getValue()) {
            case DEMO_IMAGE:
                grid.getColumn(DemoContainer.PROPERTY_ICON).setHidden(false);
                grid.setHierarchyColumn(DemoContainer.PROPERTY_ICON);
                grid.setColumnOrder(
                        DemoContainer.PROPERTY_ICON,
                        DemoContainer.PROPERTY_NAME,
                        DemoContainer.PROPERTY_HOURS,
                        DemoContainer.PROPERTY_MODIFIED);
                setTheme("demo2");
                break;
            case DEMO_SIMPLE:
            default:
                grid.getColumn(DemoContainer.PROPERTY_ICON).setHidden(true);
                grid.setHierarchyColumn(DemoContainer.PROPERTY_NAME);
                grid.setColumnOrder(
                        DemoContainer.PROPERTY_NAME,
                        DemoContainer.PROPERTY_HOURS,
                        DemoContainer.PROPERTY_MODIFIED);
                setTheme("demo");
                break;
            }
        }
    });

    combo.select(DEMO_SIMPLE);

    setContent(layout);
}
 
Example 35
Project: metl   File: EditContentRouterPanel.java   Source Code and License Vote up 4 votes
public Field<?> createField(final Container dataContainer, final Object itemId, final Object propertyId,
        com.vaadin.ui.Component uiContext) {
    final Route route = (Route) itemId;
    Field<?> field = null;
    if (propertyId.equals("matchExpression")) {
        final TextField textField = new ImmediateUpdateTextField(null) {
            @Override
            protected void save(String text) {
                route.setMatchExpression(text);
                EditContentRouterPanel.this.save();
            }
        };
        textField.setWidth(100, Unit.PERCENTAGE);
        textField.setValue(route.getMatchExpression());
        field = textField;
    } else if (propertyId.equals("targetStepId")) {
        final ComboBox combo = new ComboBox();
        combo.setWidth(100, Unit.PERCENTAGE);
        flow = context.getConfigurationService().findFlow(flow.getId());
        List<FlowStepLink> stepLinks = flow.findFlowStepLinksWithSource(flowStep.getId());
        for (FlowStepLink flowStepLink : stepLinks) {
            FlowStep comboStep = flow.findFlowStepWithId(flowStepLink.getTargetStepId());
            combo.addItem(comboStep.getId());
            combo.setItemCaption(comboStep.getId(), comboStep.getName());

            if (flowStepLink.getTargetStepId().equals(route.getTargetStepId()) || combo.getValue() == null) {
                combo.setValue(comboStep.getId());
            }
        }

        combo.setImmediate(true);
        combo.setNewItemsAllowed(false);
        combo.setNullSelectionAllowed(false);
        combo.addValueChangeListener(new ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                String stepId = (String) event.getProperty().getValue();
                if (stepId != null) {
                    route.setTargetStepId(stepId);
                    EditContentRouterPanel.this.save();
                }
            }
        });
        field = combo;
    }
    if (field != null) {
        field.setReadOnly(readOnly);
    }
    return field;
}
 
Example 36
Project: primecloud-controller   File: WinLoadBalancerEdit.java   Source Code and License Vote up 4 votes
@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 37
Project: primecloud-controller   File: WinServerEdit.java   Source Code and License Vote up 4 votes
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 38
Project: primecloud-controller   File: WinServerEdit.java   Source Code and License Vote up 4 votes
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 39
Project: primecloud-controller   File: WinServerEdit.java   Source Code and License Vote up 4 votes
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 40
Project: primecloud-controller   File: WinCloudStackLoadBalancerEdit.java   Source Code and License Vote up 4 votes
@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();
}
 
Example 41
Project: dhconvalidator   File: PaperSelectionPanel.java   Source Code and License Vote up 4 votes
/**
 * Setup UI.
 */
private void initComponents() {
	Label info = new Label(
		Messages.getString("PaperSelectionPanel.hintMsg"), //$NON-NLS-1$
		ContentMode.HTML); 
	
	languages = 
			new ComboBox(Messages.getString("PaperSelectionPanel.language"), //$NON-NLS-1$
					Arrays.asList(SubmissionLanguage.values()));
	languages.setNullSelectionAllowed(false);
	languages.setValue(SubmissionLanguage.valueOf(PropertyKey.defaultSubmissionLanguage.getValue(SubmissionLanguage.ENGLISH.name())));
	
	paperTable = new Table(Messages.getString("PaperSelectionPanel.tableTitle")); //$NON-NLS-1$
	paperTable.setSelectable(true);
	paperTable.setMultiSelect(true);
	paperTable.setPageLength(4);
	paperTable.addContainerProperty("title", String.class, null); //$NON-NLS-1$
	paperTable.setColumnHeader(
		"title", 
		Messages.getString("PaperSelectionPanel.titleColumnTitle")); //$NON-NLS-1$ //$NON-NLS-2$
	paperTable.setWidth("100%"); //$NON-NLS-1$
	paperTable.setImmediate(true);
	
	btGenerate = new Button(
		Messages.getString(
			"PaperSelectionPanel.generateButtonCaption")); //$NON-NLS-1$
	StreamResource templateStreamResource = 
			new StreamResource(
					new StreamSource() {
						@Override
						public InputStream getStream() {
							return createTemplates();
						}
					}, "your_personal_dh_templates.zip" ); //$NON-NLS-1$
	
	templateStreamResource.setCacheTime(0);
	new FileDownloader(templateStreamResource).extend(btGenerate);
	
	addCenteredComponent(info);
	addCenteredComponent(languages);
	addCenteredComponent(paperTable);
	addCenteredComponent(btGenerate);
	
	postDownloadLabel = 
			new Label(
				Messages.getString("PaperSelectionPanel.postDownloadInfo",
					inputConverter.getTextEditorDescription(),
					PropertyKey.base_url.getValue()+"popup/DHConvalidatorServices#!converter"),
				ContentMode.HTML);
	postDownloadLabel.addStyleName("postDownloadInfoRedAndBold");
	postDownloadLabel.setVisible(false);
	
	addCenteredComponent(postDownloadLabel);
	
}
 
Example 42
Project: ExpressZip   File: FindLayersViewComponent.java   Source Code and License Vote up 4 votes
private void setupAddFilterWindow(Window window) {
	// General variables

	// Layouts
	GridLayout mainLayout = new GridLayout(1, 3);
	HorizontalLayout axisLayout = new HorizontalLayout();
	HorizontalLayout criteriaLayout = new HorizontalLayout();
	HorizontalLayout buttonLayout = new HorizontalLayout();
	hznCriteria = criteriaLayout;

	// Buttons
	ExpressZipButton btnAdd = new ExpressZipButton("Add", Style.ACTION);
	btnAdd.setClickShortcut(KeyCode.ENTER);
	btnAdd.addStyleName("primary");
	ExpressZipButton btnCancel = new ExpressZipButton("Cancel", Style.ACTION);

	// Fields
	ComboBox cmbAxis = new ComboBox();
	cmbAxis.setTextInputAllowed(false);
	cmbAxis.setNullSelectionAllowed(false);

	// Labels
	Label lblAxis = new Label("Axis");

	btnAdd.addListener(filterButtonListener);
	btnCancel.addListener(filterButtonListener);

	for (Filter.AxisFilters f : Filter.axisArray) {
		cmbAxis.addItem(filter.getNameOfFilter(f));
	}
	cmbAxis.setImmediate(true);
	cmbAxis.addListener(axisSelectedListener);
	cmbAxis.setValue(filter.getNameOfFilter(Filter.axisArray[0]));

	mainLayout.addComponent(axisLayout, 0, 0);
	mainLayout.addComponent(criteriaLayout, 0, 1);
	mainLayout.addComponent(buttonLayout, 0, 2);
	mainLayout.setSpacing(true);

	axisLayout.setSpacing(true);

	axisLayout.addComponent(lblAxis);
	axisLayout.addComponent(cmbAxis);
	axisLayout.setExpandRatio(lblAxis, .2f);
	axisLayout.setExpandRatio(cmbAxis, .8f);
	axisLayout.setComponentAlignment(lblAxis, Alignment.MIDDLE_LEFT);
	axisLayout.setComponentAlignment(cmbAxis, Alignment.MIDDLE_LEFT);
	axisLayout.setSizeFull();

	criteriaLayout.setSizeFull();

	buttonLayout.setSpacing(true);
	buttonLayout.addComponent(btnAdd);
	buttonLayout.addComponent(btnCancel);
	buttonLayout.setComponentAlignment(btnAdd, Alignment.BOTTOM_RIGHT);
	buttonLayout.setComponentAlignment(btnCancel, Alignment.BOTTOM_RIGHT);
	buttonLayout.setExpandRatio(btnAdd, 1f);
	buttonLayout.setExpandRatio(btnCancel, 0f);
	buttonLayout.setSizeFull();

	mainLayout.setRowExpandRatio(0, 1f);
	mainLayout.setRowExpandRatio(1, 1f);
	mainLayout.setRowExpandRatio(2, 1f);
	mainLayout.setSizeFull();

	window.addComponent(mainLayout);
	window.getContent().setSizeFull();
}
 
Example 43
Project: extacrm   File: ProductField.java   Source Code and License Vote up 4 votes
@Override
    protected Component initContent() {
        // A vertical layout with undefined width
        final VerticalLayout box = new VerticalLayout();
        box.setSizeUndefined();

        final ComboBox productSelect = new ComboBox();
        productSelect.setInputPrompt("Выберите продукт...");
        productSelect.setImmediate(true);
        productSelect.setNullSelectionAllowed(false);

        // Инициализация контейнера
        final ExtaDbContainer<TProduct> clientsCont = new ExtaDbContainer<>(productCls);
        clientsCont.addContainerFilter(new Compare.Equal("active", true));
        clientsCont.sort(new Object[]{"name"}, new boolean[]{true});

        // Устанавливаем контент выбора
        productSelect.setFilteringMode(FilteringMode.CONTAINS);
        productSelect.setContainerDataSource(clientsCont);
        productSelect.setItemCaptionMode(ItemCaptionMode.PROPERTY);
        productSelect.setItemCaptionPropertyId("name");
        productSelect.addStyleName(ExtaTheme.COMBOBOX_BORDERLESS);

        productSelect.setPropertyDataSource(getPropertyDataSource());
        productSelect.addValueChangeListener(e -> setValue((TProduct) productSelect.getConvertedValue()));
//        productSelect.setValue(getValue());
        clientsCont.setSingleSelectConverter(productSelect);

        productSelect.setWidth(100, Unit.PERCENTAGE);
        box.addComponent(productSelect);
        // The layout shrinks to fit this label
        final Label label = new Label(getFieldTextLabel());
        label.addStyleName("ea-widthfittin-label");
        label.setWidthUndefined();
        label.setHeight("0px"); // Hide: Could be 0px
        box.addComponent(label);

        addValueChangeListener(e -> label.setValue(getFieldTextLabel()));

        return box;
    }
 
Example 44
Project: extacrm   File: InstallmentInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link com.vaadin.ui.ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

    form.addComponent(new FormGroupHeader("Продукт"));
    productField = new ProdInstallmentsField("Продукт", "Введите название продукта");
    productField.setRequired(true);
    productField.addValueChangeListener(e -> refreshProductFields());
    form.addComponent(productField);

    stateField = new ProdInstanceStateSelect("Статус рассмотрения", "Укажите статус рассмотрения заявки на продукт");
    form.addComponent(stateField);

    form.addComponent(new FormGroupHeader("Характеристики продукта"));
    vendorLabel = new Label();
    vendorLabel.setCaption("Эммитент");
    form.addComponent(vendorLabel);

    downpaymentLabel = new Label();
    downpaymentLabel.setCaption("Первоначальный взнос");
    form.addComponent(downpaymentLabel);

    periodLabel = new Label();
    periodLabel.setCaption("Период рассрочки");
    form.addComponent(periodLabel);

    form.addComponent(new FormGroupHeader("Параметры рассрочки"));
    downpaymentField = new PercentOfField("Первоначальный взнос", "Введите сумму первоначального взноса по рассрочке");
    downpaymentField.setRequired(true);
    form.addComponent(downpaymentField);

    periodField = new ComboBox("Срок рассрочки");
    periodField.setDescription("Введите период рассрочки (длительность рассрочки)");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками кредита
    fillPeriodFieldItems();
    form.addComponent(periodField);

    summField = new EditField("Сумма рассрочки", "Введите сумму рассрочки (Также может рассчитываться автоматически)");
    summField.setRequired(true);
    form.addComponent(summField);

    // Размер ежемесячного платежа
    monthlyPayLabel = new Label();
    monthlyPayLabel.setCaption("Ежемесячный платеж");
    form.addComponent(monthlyPayLabel);

    // Ответственный со стороны банка
    responsibleField = new EmployeeField("Ответственный сотрудник", "Укажите ответственного со стороны эммитента рассрочки");
    responsibleField.setCompanySupplier(() -> {
        final ProdInstallments product = productField.getValue();
        if (product != null) {
            return product.getVendor();
        } else
            return null;
    });
    form.addComponent(responsibleField);

    // Инициализация валидаторов
    initValidators();
    // Обновление рассчетных полей
    refreshProductFields();
    refreshInstCosts();
    // Инициализация взаимосвязей
    initRelations();

    return form;
}
 
Example 45
Project: extacrm   File: InsuranceInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link com.vaadin.ui.ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

    form.addComponent(new FormGroupHeader("Продукт"));
    productField = new ProdInsuranceField("Продукт", "Введите название продукта");
    productField.setRequired(true);
    productField.addValueChangeListener(e -> refreshProductFields());
    form.addComponent(productField);

    form.addComponent(new FormGroupHeader("Характеристики продукта"));
    vendorLabel = new Label();
    vendorLabel.setCaption("Страховщик");
    form.addComponent(vendorLabel);

    tariffLabel = new Label();
    tariffLabel.setCaption("Тариф");
    tariffLabel.setConverter(lookup(StringToPercentConverter.class));
    form.addComponent(tariffLabel);

    form.addComponent(new FormGroupHeader("Параметры страховки"));
    periodField = new ComboBox("Период страхования");
    periodField.setDescription("Введите период страхования");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками страховки
    fillPeriodFieldItems();
    form.addComponent(periodField);

    // Ответственный за оформление страховки
    responsibleField = new EmployeeField("Ответственный", "Укажите ответственного за оформление страховки");
    responsibleField.setCompanySupplier(() -> {
        final ProdInsurance product = productField.getValue();
        if (product != null) {
            return product.getVendor();
        } else
            return null;
    });
    form.addComponent(responsibleField);

    form.addComponent(new FormGroupHeader("Стоимость страховки"));
    // Размер страховой премии
    premiumLabel = new Label();
    premiumLabel.setCaption("Страховая премия");
    form.addComponent(premiumLabel);

    // Обновление рассчетных полей
    refreshProductFields();
    refreshInsCosts();
    // Инициализация взаимосвязей
    initRelations();

    return form;
}
 
Example 46
Project: extacrm   File: HirePurchaseInSaleEditForm.java   Source Code and License Vote up 4 votes
/**
 * <p>createEditFields.</p>
 *
 * @return a {@link ComponentContainer} object.
 */
@Override
protected ComponentContainer createEditFields() {
    final ExtaFormLayout form = new ExtaFormLayout();

    form.addComponent(new FormGroupHeader("Продукт"));
    productField = new ProdHirePurchaseField("Продукт", "Введите название продукта");
    productField.setRequired(true);
    productField.addValueChangeListener(e -> refreshProductFields());
    form.addComponent(productField);

    stateField = new ProdInstanceStateSelect("Статус рассмотрения", "Укажите статус рассмотрения заявки на продукт");
    form.addComponent(stateField);

    form.addComponent(new FormGroupHeader("Сопутствующие расходы"));
    expendituresField = new ProductExpendituresField("Статьи расходов",
            "Список дополнительных расходов сопровождающих продукт", (ProductInstance) getEntity());
    form.addComponent(expendituresField);

    form.addComponent(new FormGroupHeader("Характеристики продукта"));
    vendorLabel = new Label();
    vendorLabel.setCaption("Эммитент");
    form.addComponent(vendorLabel);

    downpaymentLabel = new Label();
    downpaymentLabel.setCaption("Первоначальный взнос");
    form.addComponent(downpaymentLabel);

    periodLabel = new Label();
    periodLabel.setCaption("Период рассрочки");
    form.addComponent(periodLabel);

    form.addComponent(new FormGroupHeader("Параметры рассрочки"));
    downpaymentField = new PercentOfField("Первоначальный взнос", "Введите сумму первоначального взноса по рассрочке");
    downpaymentField.setRequired(true);
    form.addComponent(downpaymentField);

    periodField = new ComboBox("Срок рассрочки");
    periodField.setDescription("Введите период рассрочки (длительность рассрочки)");
    periodField.setImmediate(true);
    periodField.setNullSelectionAllowed(false);
    periodField.setRequired(true);
    periodField.setWidth(6, Unit.EM);
    // Наполняем возможными сроками кредита
    fillPeriodFieldItems();
    form.addComponent(periodField);

    summField = new EditField("Сумма рассрочки", "Введите сумму рассрочки (Также может рассчитываться автоматически)");
    summField.setRequired(true);
    form.addComponent(summField);

    // Ответственный со стороны банка
    responsibleField = new EmployeeField("Ответственный сотрудник", "Укажите ответственного со стороны эммитента рассрочки");
    responsibleField.setCompanySupplier(() -> {
        final ProdHirePurchase product = productField.getValue();
        if (product != null) {
            return product.getVendor();
        } else
            return null;
    });
    form.addComponent(responsibleField);

    // Инициализация валидаторов
    initValidators();
    // Обновление рассчетных полей
    refreshProductFields();
    refreshInstCosts();
    // Инициализация взаимосвязей
    initRelations();

    return form;
}
 
Example 47
Project: konekti   File: ProtocolToolbar.java   Source Code and License Vote up 4 votes
@AutoGenerated
private HorizontalLayout buildToolbarLayout() {		
	toolbarLayout = new HorizontalLayout();
	toolbarLayout.setImmediate(false);
	toolbarLayout.setSpacing(true);
	
	ButtonGroup editionButtonGroup = new ButtonGroup();
	toolbarLayout.addComponent(editionButtonGroup);
	
	// btnOpenProtocol
	btnOpenProtocol = new Button();
	btnOpenProtocol.setCaption("Iniciar Job");
	btnOpenProtocol.setImmediate(true);
	btnOpenProtocol.setWidth("-1px");
	btnOpenProtocol.setHeight("-1px");
	btnOpenProtocol.setIcon(new ThemeResource("../konekti/images/icons/job-toolbar/bell--arrow.png"));
	
	editionButtonGroup.addButton(btnOpenProtocol);
	
	// btnRecoverProtocol
	btnRecoverProtocol = new Button();
	btnRecoverProtocol.setCaption("Iniciar Job");
	btnRecoverProtocol.setImmediate(true);
	btnRecoverProtocol.setWidth("-1px");
	btnRecoverProtocol.setHeight("-1px");
	btnRecoverProtocol.setIcon(new ThemeResource("../konekti/images/icons/job-toolbar/bell--arrow.png"));
	
	editionButtonGroup.addButton(btnRecoverProtocol);
	
	lblBoxProtocol = new Label("Buzón Protocolo:");
	lblBoxProtocol.setVisible(false);
	lblBoxProtocol.setWidth("-1px");
	lblBoxProtocol.setHeight("-1px");
	
	toolbarLayout.addComponent(lblBoxProtocol);
	
	cmbBoxProtocol = new ComboBox();
	cmbBoxProtocol.setVisible(false);
	cmbBoxProtocol.setImmediate(true);
	cmbBoxProtocol.setWidth("-1px");
	cmbBoxProtocol.setHeight("-1px");
	cmbBoxProtocol.setNullSelectionAllowed(false);
	cmbBoxProtocol.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
	cmbBoxProtocol.setItemCaptionPropertyId("box");
	
	toolbarLayout.addComponent(cmbBoxProtocol);
	
	lblTypeProtocol = new Label("Tipo Protocolo:");
	lblTypeProtocol.setWidth("-1px");
	lblTypeProtocol.setHeight("-1px");
	
	toolbarLayout.addComponent(lblTypeProtocol);
	
	cmbTypeProtocol = new ComboBox();
	cmbTypeProtocol.setImmediate(true);
	cmbTypeProtocol.setWidth("-1px");
	cmbTypeProtocol.setHeight("-1px");
	cmbTypeProtocol.setNullSelectionAllowed(true);
	cmbTypeProtocol.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
	cmbTypeProtocol.setItemCaptionPropertyId("direction");
	
	toolbarLayout.addComponent(cmbTypeProtocol);
	
	return toolbarLayout;
}
 
Example 48
Project: academ   File: ConsolidadoEvaluacion.java   Source Code and License Vote up 4 votes
public void cargarTemas(List<TemaBO> temas, List<List<CalificacionRolBO>> calificaciones, List<Integer> promediosG) {

		tablaConsolidado.removeAllItems();

		for(int i =0;i< temas.size();i++)
		{
			TemaBO tema = temas.get(i);
			boolean calificado = false;
			ArrayList<Object>info = new ArrayList<Object>();
			info.add(tema.getId());
			info.add(tema.getNombre());
			for(int j=0;j<calificaciones.size();j++)
			{
				List<CalificacionRolBO> calificacionesRol = calificaciones.get(j);
				if( i < calificacionesRol.size() )
				{
					int nivel = calificacionesRol.get(i).getNivelDeConocimiento().getId();
					info.add( nivel + "");
					calificado = true;
				}
				else
				{
					calificado = false;
					info.add("NC");
				}
			}
			ComboBox caja = new ComboBox();
			caja.setNullSelectionAllowed(false);
			caja.setTextInputAllowed(false);
			for(int j=0;j<5;j++)
			{
				caja.addItem(j);
			}
			if( calificado )
				caja.select( promediosG.get(i));
		
			info.add(caja);
			info.add( new CheckBox() );
			tablaConsolidado.addItem(info.toArray(), tema);
		}
	}
 
Example 49
Project: VaadinUtils   File: BaseCrudView.java   Source Code and License Vote up 4 votes
private void buildActionLayout()
{
	actionLayout = new HorizontalLayout();
	actionLayout.setWidth("100%");
	actionLayout.setMargin(new MarginInfo(false, true, false, false));

	actionLabel = new Label("&nbsp;Action");
	actionLabel.setContentMode(ContentMode.HTML);
	actionLabel.setWidth("50");

	actionGroupLayout.addStyleName("v-component-group");
	actionLayout.addComponent(actionGroupLayout);
	actionGroupLayout.addComponent(actionLabel);

	actionCombo = new ComboBox(null);
	actionCombo.setWidth("160");
	actionCombo.setNullSelectionAllowed(false);
	actionCombo.setTextInputAllowed(false);
	actionGroupLayout.addComponent(actionCombo);

	addCrudActions();
	actionGroupLayout.addComponent(actionApplyButton);
	actionApplyButton.setId("applyButton");

	actionMessage = new Label("", ContentMode.HTML);
	actionGroupLayout.addComponent(actionMessage);

	String newButtonLabel = getNewButtonLabel();
	if (newButtonLabel == null)
	{
		newButtonLabel = "";
	}
	actionNewButton.setCaption(newButtonLabel);
	actionNewButton.setId("CrudNewButton-" + newButtonLabel.replace(" ", ""));
	actionLayout.addComponent(actionNewButton);

	actionLayout.setComponentAlignment(actionGroupLayout, Alignment.MIDDLE_LEFT);
	actionLayout.setComponentAlignment(actionNewButton, Alignment.MIDDLE_RIGHT);
	actionLayout.setExpandRatio(actionGroupLayout, 1.0f);
	actionLayout.setHeight("35");
}
 
Example 50
Project: scoutmaster   File: ImportMatchFields.java   Source Code and License Vote up 4 votes
@Override
public Component getContent()
{
	try
	{
		if (this.reset)
		{
			this.reset = false;
			this.layout = new GridLayout(3, 1);
			this.layout.setMargin(true);
			this.layout.setSpacing(true);
			// layout.setSizeFull();

			final String[] headers = getHeaders();

			final Class<? extends Importable> importable = this.importView.getType().getEntityClass();
			final EntityAdaptor<?> adaptor = EntityAdaptor.create(importable);

			final ArrayList<FormFieldImpl> fields = adaptor.getFields();
			for (final String header : headers)
			{
				final Label headerLabel = new Label(header);
				this.layout.addComponent(headerLabel);
				headerLabel.setWidth("" + 160);

				final Label mapToLabel = new Label("--Maps to-->");
				this.layout.addComponent(mapToLabel);
				mapToLabel.setWidth("" + 100);

				final ComboBox box = new ComboBox(null, fields);
				box.setNullSelectionAllowed(true);
				box.setInputPrompt("--Please Select--");
				box.setNullSelectionItemId("--Please Select--");
				box.setTextInputAllowed(false);
				// ComboBox box = layout.addComponent("", fields);
				this.layout.addComponent(box);
				this.mappings.add(box);
				this.layout.newLine();
			}
		}
	}
	catch (final IOException e)
	{
		Notification.show("An error occured trying to read the CSV file: " + e.getMessage(), Type.ERROR_MESSAGE);
	}

	return this.layout;
}