本文整理汇总了Java中com.vaadin.ui.AbstractSelect.ItemCaptionMode类的典型用法代码示例。如果您正苦于以下问题:Java ItemCaptionMode类的具体用法?Java ItemCaptionMode怎么用?Java ItemCaptionMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemCaptionMode类属于com.vaadin.ui.AbstractSelect包,在下文中一共展示了ItemCaptionMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCaptionMode
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
@Override
public void setCaptionMode(CaptionMode captionMode) {
if (this.captionMode != captionMode) {
this.captionMode = captionMode;
switch (captionMode) {
case ITEM:
component.setItemCaptionMode(ItemCaptionMode.ITEM);
break;
case PROPERTY:
component.setItemCaptionMode(ItemCaptionMode.PROPERTY);
break;
default:
throw new UnsupportedOperationException();
}
}
}
示例2: populateWIdsSkip
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
public static void populateWIdsSkip(AbstractSelect as, String[] s,
Integer[] skip) {
Set<Integer> se = new HashSet<Integer>(Arrays.asList(skip));
as.removeAllItems();
int i = 0;
for (String sp : s) {
if (!se.contains(i)) {
as.addItem(i);
as.setItemCaption(i, sp);
}
i++;
}
as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
}
示例3: buildPossibleTargetVersions
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected Panel buildPossibleTargetVersions(ProjectVersion targetProjectVersion) {
Panel possibleTargetVersionsPanel = new Panel("Available Target Versions");
possibleTargetVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
possibleTargetVersionsPanel.setSizeFull();
IndexedContainer container = new IndexedContainer();
optionGroup = new OptionGroup("Project Version", container);
optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optionGroup.setItemCaptionMode(ItemCaptionMode.PROPERTY);
optionGroup.setItemCaptionPropertyId("versionLabel");
optionGroup.addStyleName("indent");
List<ProjectVersion> projectVersions = configService.findProjectVersionsByProject(targetProjectVersion.getProject());
container.addContainerProperty("versionLabel", String.class, null);
for (ProjectVersion version : projectVersions) {
Item item = container.addItem(version.getId());
item.getItemProperty("versionLabel").setValue(version.getVersionLabel());
if (targetProjectVersion.getId().equalsIgnoreCase(version.getId())) {
optionGroup.setItemEnabled(version.getId(), false);
}
}
possibleTargetVersionsPanel.setContent(optionGroup);
return possibleTargetVersionsPanel;
}
示例4: initializeSelect
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
private void initializeSelect(Set<PDPGroup> groups) {
//
// Initialize GUI properties
//
this.listSelectPDPGroup.setImmediate(true);
this.listSelectPDPGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
this.listSelectPDPGroup.setNullSelectionAllowed(false);
this.listSelectPDPGroup.setNewItemsAllowed(false);
this.listSelectPDPGroup.setMultiSelect(false);
//
// Add items
//
for (PDPGroup group : groups) {
this.listSelectPDPGroup.addItem(group);
this.listSelectPDPGroup.setItemCaption(group, group.getName());
}
//
// Listen to events
//
this.listSelectPDPGroup.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
self.setupButtons();
}
});
}
示例5: initializeSelect
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
protected void initializeSelect() {
this.listSelectAlgorithm.setContainerDataSource(this.algorithms);
this.listSelectAlgorithm.setItemCaptionMode(ItemCaptionMode.PROPERTY);
this.listSelectAlgorithm.setItemCaptionPropertyId("xacmlId");
this.listSelectAlgorithm.setNullSelectionAllowed(false);
if (this.policy.getRuleCombiningAlgId() == null) {
this.policy.setRuleCombiningAlgId(XACML3.ID_RULE_FIRST_APPLICABLE.stringValue());
}
this.listSelectAlgorithm.setValue(JPAUtils.findRuleAlgorithm(this.policy.getRuleCombiningAlgId()).getId());
}
示例6: initializeSelect
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
protected void initializeSelect() {
this.listSelectAlgorithm.setContainerDataSource(this.algorithms);
this.listSelectAlgorithm.setItemCaptionMode(ItemCaptionMode.PROPERTY);
this.listSelectAlgorithm.setItemCaptionPropertyId("xacmlId");
this.listSelectAlgorithm.setNullSelectionAllowed(false);
if (this.policySet.getPolicyCombiningAlgId() == null) {
this.policySet.setPolicyCombiningAlgId(XACML3.ID_POLICY_FIRST_APPLICABLE.stringValue());
}
this.listSelectAlgorithm.setValue(JPAUtils.findPolicyAlgorithm(this.policySet.getPolicyCombiningAlgId()).getId());
}
示例7: initializeCategories
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
private void initializeCategories() {
//
// Remove any filters
//
AttributeStandardSelectorComponent.categories.removeAllContainerFilters();
//
// Initialize data source & GUI properties
//
this.comboBoxCategories.setContainerDataSource(AttributeStandardSelectorComponent.categories);
this.comboBoxCategories.setItemCaptionMode(ItemCaptionMode.PROPERTY);
this.comboBoxCategories.setItemCaptionPropertyId("xacmlId");
this.comboBoxCategories.setImmediate(true);
this.comboBoxCategories.setNullSelectionAllowed(false);
//
// Set default selection
//
Category defaultCategory;
if (this.attribute == null || this.attribute.getCategoryBean() == null) {
defaultCategory = JPAUtils.findCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT);
} else {
defaultCategory = this.attribute.getCategoryBean();
}
if (defaultCategory != null) {
this.comboBoxCategories.select(defaultCategory.getId());
}
//
// Respond to events
//
this.comboBoxCategories.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
self.setupAttributeIDs();
self.fireAttributeChanged(self.getAttribute());
}
});
}
示例8: initializeCategoryFilter
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
protected void initializeCategoryFilter() {
//
// Remove any filters
//
AttributeDictionarySelectorComponent.categories.removeAllContainerFilters();
//
// Initialize data source and GUI properties
//
this.comboBoxCategoryFilter.setContainerDataSource(AttributeDictionarySelectorComponent.categories);
this.comboBoxCategoryFilter.setItemCaptionMode(ItemCaptionMode.PROPERTY);
this.comboBoxCategoryFilter.setItemCaptionPropertyId("xacmlId");
this.comboBoxCategoryFilter.setImmediate(true);
//
// Respond to events
//
this.comboBoxCategoryFilter.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
//
// Clear any existing filters
//
AttributeDictionarySelectorComponent.attributes.removeAllContainerFilters();
//
// Get the current selection
//
Object id = self.comboBoxCategoryFilter.getValue();
//
// Is anything currently selected?
//
if (id != null) {
//
// Yes - add the new filter into the container
//
AttributeDictionarySelectorComponent.attributes.addContainerFilter(new Compare.Equal("categoryBean", AttributeDictionarySelectorComponent.categories.getItem(id).getEntity()));
}
}
});
}
示例9: initializeAttributes
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
protected void initializeAttributes() {
//
// Remove any filters
//
AttributeDictionarySelectorComponent.attributes.removeAllContainerFilters();
//
// Initialize data source and GUI properties
//
this.listSelectAttribute.setContainerDataSource(AttributeDictionarySelectorComponent.attributes);
this.listSelectAttribute.setItemCaptionMode(ItemCaptionMode.PROPERTY);
this.listSelectAttribute.setItemCaptionPropertyId("xacmlId");
this.listSelectAttribute.setImmediate(true);
this.listSelectAttribute.setHeight(7, Unit.EM);
//
// Filter by datatype
//
if (this.datatype != null) {
AttributeDictionarySelectorComponent.attributes.addContainerFilter(new Compare.Equal("datatypeBean", this.datatype));
}
//
// Is there a default selection? Is there an id?
//
if (this.initialAttribute != null && this.initialAttribute.getId() != 0) {
this.listSelectAttribute.select(this.initialAttribute.getId());
}
//
// Respond to events
//
this.listSelectAttribute.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
self.fireAttributeChanged(self.getAttribute());
}
});
}
示例10: populateWIds
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
/**
* Populate the AbstractSelect component with strings.<br>
* The Itemid is an integer = the index of the string in the sequence ,
* starting from 0
*
* @param as
* component
* @param s
* comma separated string list or array of strings
*/
static public void populateWIds(AbstractSelect as, String... s) {
int i = 0;
as.removeAllItems();
for (String sp : s) {
as.addItem(i);
as.setItemCaption(i, sp);
i++;
}
as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
}
示例11: SelectFlowsPanel
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
public SelectFlowsPanel(ApplicationContext context, String introText,
boolean includeTestFlows) {
this.context = context;
tree.setMultiSelect(true);
tree.addContainerProperty("name", String.class, "");
tree.setItemCaptionPropertyId("name");
tree.setItemCaptionMode(ItemCaptionMode.PROPERTY);
tree.addExpandListener(event -> {
Object itemId = event.getItemId();
if (itemId instanceof ProjectVersion) {
addFlowsToVersion((ProjectVersion) itemId, includeTestFlows);
}
});
addProjects();
setSpacing(true);
setSizeFull();
addComponent(new Label(introText));
Panel scrollable = new Panel();
scrollable.addStyleName(ValoTheme.PANEL_BORDERLESS);
scrollable.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
scrollable.setSizeFull();
scrollable.setContent(tree);
addComponent(scrollable);
setExpandRatio(scrollable, 1.0f);
Set<Object> selected = new HashSet<>();
if (firstProject != null) {
selected.add(firstProject);
}
tree.setValue(selected);
tree.focus();
}
示例12: displayVersions
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
void displayVersions(String path) {
List<PageVersion> pageVersions = pageService.getPageVersions(path);
if (pageVersions.size() > 0) {
final ComboBox pageSelection = new ComboBox();
content.addComponent(pageSelection);
pageSelection.setNullSelectionAllowed(false);
pageSelection.setTextInputAllowed(false);
pageSelection.addValueChangeListener(valueChangeEvent -> {
selectedVersion = (PageVersion) pageSelection.getValue();
if (selectedVersion != null) {
Page page = pageService.getPageByVersion(beanItem.getPath(), selectedVersion.getName());
page.setPath(beanItem.getPath());
previewForm.setBean(page);
((PagePreviewFormLayout) previewLayout).displayPageInfo(page);
}
});
pageSelection.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
pageSelection.setNullSelectionAllowed(false);
for (int i = 0; i < pageVersions.size(); i++) {
PageVersion version = pageVersions.get(i);
pageSelection.addItem(version);
pageSelection.setItemCaption(version, getVersionDisplay(version, i));
}
if (pageVersions.size() > 0) {
pageSelection.setValue(pageVersions.get(pageVersions.size() - 1));
}
}
}
示例13: build
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Field<?> build(Class<?> clazz, String name) {
ComboBox combo = new ComboBox();
fillComboBox(combo, clazz, name);
combo.setItemCaptionMode(ItemCaptionMode.ID);
return combo;
}
示例14: CtrCandOdfCandidatureWindow
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
/**
* Crée une fenêtre de choix pour le gestionnaire : proposition ou candidature simple
* @param message
*/
public CtrCandOdfCandidatureWindow(String message) {
/* Style */
setWidth(630, Unit.PIXELS);
setModal(true);
setResizable(false);
setClosable(false);
/* Layout */
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
/* Titre */
setCaption(applicationContext.getMessage("candidature.gest.window", null, UI.getCurrent().getLocale()));
/* Texte */
layout.addComponent(new Label(message));
layout.addComponent(new Label(applicationContext.getMessage("candidature.gest.window.choice", null, UI.getCurrent().getLocale())));
/*Le container d'options*/
BeanItemContainer<SimpleTablePresentation> optContainer = new BeanItemContainer<SimpleTablePresentation>(SimpleTablePresentation.class);
SimpleTablePresentation optionClassique = new SimpleTablePresentation(ConstanteUtils.OPTION_CLASSIQUE,applicationContext.getMessage("candidature.gest.window.choice.classique", null, UI.getCurrent().getLocale()),null);
SimpleTablePresentation optionProposition = new SimpleTablePresentation(ConstanteUtils.OPTION_PROP,applicationContext.getMessage("candidature.gest.window.choice.proposition", null, UI.getCurrent().getLocale()),null);
optContainer.addItem(optionClassique);
optContainer.addItem(optionProposition);
optionGroupAction.setContainerDataSource(optContainer);
optionGroupAction.addStyleName(StyleConstants.OPTION_GROUP_HORIZONTAL);
optionGroupAction.setItemCaptionPropertyId(SimpleTablePresentation.CHAMPS_TITLE);
optionGroupAction.setItemCaptionMode(ItemCaptionMode.PROPERTY);
optionGroupAction.setValue(optionClassique);
layout.addComponent(optionGroupAction);
layout.setComponentAlignment(optionGroupAction, Alignment.MIDDLE_CENTER);
/* Boutons */
HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setWidth(100, Unit.PERCENTAGE);
buttonsLayout.setSpacing(true);
layout.addComponent(buttonsLayout);
OneClickButton btnNon = new OneClickButton(applicationContext.getMessage("confirmWindow.btnNon", null, UI.getCurrent().getLocale()),FontAwesome.TIMES);
btnNon.addClickListener(e -> close());
buttonsLayout.addComponent(btnNon);
buttonsLayout.setComponentAlignment(btnNon, Alignment.MIDDLE_LEFT);
OneClickButton btnOui = new OneClickButton(applicationContext.getMessage("confirmWindow.btnOui", null, UI.getCurrent().getLocale()),FontAwesome.CHECK);
btnOui.setIcon(FontAwesome.CHECK);
btnOui.addStyleName(ValoTheme.BUTTON_PRIMARY);
btnOui.addClickListener(e -> {
SimpleTablePresentation option = (SimpleTablePresentation)optionGroupAction.getValue();
odfCandidatureListener.btnOkClick(option.getCode());
close();
});
buttonsLayout.addComponent(btnOui);
buttonsLayout.setComponentAlignment(btnOui, Alignment.MIDDLE_RIGHT);
/* Centre la fenêtre */
center();
}
示例15: addBooleanFilter
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; //导入依赖的package包/类
/**
* Ajoute un filtre de Boolean sur une liste de colonnes
*
* @param filterRow
* @param container
* @param property
* @param labelTrue
* @param labelFalse
* @param labelNull
*/
private void addBooleanFilter(String property, String labelTrue, String labelFalse, String labelNull) {
HeaderCell cell = getFilterCell(property);
ComboBox cbOuiNon = new ComboBox();
cbOuiNon.setTextInputAllowed(false);
List<BooleanPresentation> liste = new ArrayList<BooleanPresentation>();
BooleanPresentation nullObject = new BooleanPresentation(BooleanValue.ALL,
applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()), null);
liste.add(nullObject);
if (labelTrue != null) {
liste.add(new BooleanPresentation(BooleanValue.TRUE, labelTrue, FontAwesome.CHECK_SQUARE_O));
}
if (labelFalse != null) {
liste.add(new BooleanPresentation(BooleanValue.FALSE, labelFalse, FontAwesome.SQUARE_O));
}
if (labelNull != null) {
liste.add(new BooleanPresentation(BooleanValue.NULL, labelNull, FontAwesome.HOURGLASS_HALF));
}
BeanItemContainer<BooleanPresentation> containerOuiNon = new BeanItemContainer<BooleanPresentation>(
BooleanPresentation.class, liste);
cbOuiNon.setNullSelectionItemId(nullObject);
cbOuiNon.setImmediate(true);
cbOuiNon.setContainerDataSource(containerOuiNon);
cbOuiNon.setItemCaptionPropertyId("libelle");
cbOuiNon.setItemCaptionMode(ItemCaptionMode.PROPERTY);
cbOuiNon.setItemIconPropertyId("icone");
cbOuiNon.setWidth(100, Unit.PERCENTAGE);
cbOuiNon.addStyleName(ValoTheme.COMBOBOX_TINY);
cbOuiNon.addValueChangeListener(change -> {
container.removeContainerFilters(property);
if (cbOuiNon.getValue() != null) {
BooleanPresentation value = (BooleanPresentation) cbOuiNon.getValue();
if (value != null) {
BooleanValue booleanValue = value.getValeur();
switch (booleanValue) {
case TRUE:
container.addContainerFilter(new Equal(property, true));
break;
case FALSE:
container.addContainerFilter(new Equal(property, false));
break;
case NULL:
container.addContainerFilter(new Equal(property, null));
break;
default:
break;
}
}
fireFilterListener();
}
});
cell.setComponent(cbOuiNon);
}