本文整理汇总了Java中com.vaadin.ui.AbstractSelect类的典型用法代码示例。如果您正苦于以下问题:Java AbstractSelect类的具体用法?Java AbstractSelect怎么用?Java AbstractSelect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractSelect类属于com.vaadin.ui包,在下文中一共展示了AbstractSelect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEditFields
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
@Override
protected ComponentContainer createEditFields() {
final ExtaFormLayout form = new ExtaFormLayout();
appTitleField = new EditField("Заголовок приложения");
form.addComponent(appTitleField);
iconPathField = new ComboBox("Иконка приложения");
for (final String icon : lookup(UserSettingsService.class).getFaviconPathList()) {
iconPathField.addItem(icon);
iconPathField.setItemIcon(icon, new ThemeResource(getLast(Splitter.on('/').split(icon))));
}
iconPathField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ICON_ONLY);
iconPathField.setWidth(85, Unit.PIXELS);
iconPathField.setTextInputAllowed(false);
iconPathField.setNullSelectionAllowed(false);
form.addComponent(iconPathField);
isShowSalePointIdsField = new MCheckBox("Показывать раздел \"Идентификация\" в карточке торговой точки");
form.addComponent(isShowSalePointIdsField);
isDevServerField = new MCheckBox("Режим отладки");
form.addComponent(isDevServerField);
return form;
}
示例2: toCaptionMode
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public static CaptionMode toCaptionMode(AbstractSelect.ItemCaptionMode captionMode) {
if (captionMode == null) {
return null;
}
switch (captionMode) {
case ITEM:
return CaptionMode.ITEM;
case PROPERTY:
return CaptionMode.PROPERTY;
case EXPLICIT_DEFAULTS_ID:
return CaptionMode.MAP_ENTRY;
default:
throw new UnsupportedOperationException("Unsupported Vaadin AbstractSelect.ItemCaptionMode");
}
}
示例3: toVaadinCaptionMode
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public static AbstractSelect.ItemCaptionMode toVaadinCaptionMode(CaptionMode captionMode) {
if (captionMode == null) {
return null;
}
switch (captionMode) {
case ITEM:
return AbstractSelect.ItemCaptionMode.ITEM;
case PROPERTY:
return AbstractSelect.ItemCaptionMode.PROPERTY;
case MAP_ENTRY:
return AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID;
default:
throw new UnsupportedOperationException("Unsupported CaptionMode");
}
}
示例4: SystemParameterLayout
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public SystemParameterLayout(Parameter parameterInstance) {
Design.read(this);
this.parameterInstance = parameterInstance;
if (this.parameterInstance == null) {
this.parameterInstance = new Parameter();
}
for (Parameter.PARAM_TYPE type : Parameter.PARAM_TYPE.values()) {
Item item = typeComboBox.addItem(type);
typeComboBox.setItemCaption(type, type.name());
}
typeComboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
binder.setItemDataSource(this.parameterInstance);
binder.bind(typeComboBox, "type");
binder.bind(name, "name");
binder.bind(value, "value");
binder.setBuffered(true);
}
示例5: DocumentPermissionLayout
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public DocumentPermissionLayout(Document document, Permission permission) {
Design.read(this);
comboBoxRole.setCaption(Translate.getMessage("comboBoxRole"));
permissionsField.setCaption(Translate.getMessage("permissionsField"));
this.document = document;
permission = permission == null ? new Permission() : permission;
permissionsField.setPermissionsClass(Document.class);
comboBoxRole.addContainerProperty(NAME, String.class, null);
comboBoxRole.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
comboBoxRole.setItemCaptionPropertyId(NAME);
for (Role instance : HybridbpmUI.getAccessAPI().getAllRoles()) {
Item item = comboBoxRole.addItem(instance);
item.getItemProperty(NAME).setValue(instance.getName());
}
comboBoxRole.setNullSelectionAllowed(false);
binder.setItemDataSource(permission);
binder.bind(permissionsField, "permissions");
binder.bind(comboBoxRole, "out");
binder.setBuffered(true);
}
示例6: populateWIdsSkip
import com.vaadin.ui.AbstractSelect; //导入依赖的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);
}
示例7: drop
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
@Override
public void drop(DragAndDropEvent event) {
final Transferable t = event.getTransferable();
AbstractSelect.AbstractSelectTargetDetails dropData = ((AbstractSelect.AbstractSelectTargetDetails) event.getTargetDetails());
Object sourceItemId = ((DataBoundTransferable) t).getItemId();
Object targetItemId = dropData.getItemIdOver();
VerticalDropLocation location = dropData.getDropLocation();
Item sourceItem = tree.getItem(sourceItemId);
NavNode sourceNode = (NavNode) sourceItem.getItemProperty("object").getValue();
Item targetItem = tree.getItem(targetItemId);
NavNode targetNode = (NavNode) targetItem.getItemProperty("object").getValue();
NavigationView.this.move(sourceNode, targetNode, location);
// Sorting goes as
// - If dropped ON (MIDDLE) a node, we preppend it as a child
// - If dropped on the TOP part of a node, we move/add it before the node
// - If dropped on the BOTTOM part of a node, we move/add it after the node if it has no children, or prepend it as a child if it has children
}
示例8: initView
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
private void initView() {
this.loadingSign = new ProgressBar();
this.loadingSign.setIndeterminate(true);
this.loadingSign.setId("loadingSign");
Label title = new Label("Available models");
title.setId("label_availableModels");
addComponent(title);
this.availableModelsTree = new Tree();
this.availableModelsTree.setId("tree_availableModels");
this.availableModelsTree.setWidth(30, Unit.EM);
Tree tree = availableModelsTree;
tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
tree.setItemCaptionPropertyId(CAPTION_PROPERTY);
this.buttonStartSession = new Button("Start");
this.buttonStartSession.setId("button_start");
this.buttonStartSession.addClickListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
String selectedModelPath = (String) tree.getValue();
if(selectedModelPath.endsWith(".wtspec4m")) {
startSession(selectedModelPath);
}
}
});
addComponent(this.buttonStartSession);
addComponent(this.loadingSign);
Panel treeViewContainer = new Panel();
treeViewContainer.setId("panel_treeViewContainer");
treeViewContainer.setContent(this.availableModelsTree);
addComponent(treeViewContainer);
}
示例9: createFieldComponent
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
@Override
protected AbstractSelect createFieldComponent() {
final AbstractSelect supplierPageSelect = super.createFieldComponent();
supplierPageSelect.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
final AbstractSelect templateSelect = findTemplateSelect();
if (templateSelect == null) {
throw new RuntimeException("Cannot find template ComboBox");
}
Property.ValueChangeListener listener = getValueChangeListener(templateSelect, supplierPageSelect);
templateSelect.addValueChangeListener(listener);
listener.valueChange(new Field.ValueChangeEvent(templateSelect));
supplierPageSelect.setVisible(utils.requiresParentTemplate((String) templateSelect.getValue()));
return supplierPageSelect;
}
示例10: getValueChangeListener
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
private Property.ValueChangeListener getValueChangeListener(final AbstractSelect templateComboBox,
final AbstractSelect supplierPageSelect) {
final Map<String, String> parentTemplates = utils.getParentTemplates();
return new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
String templateId = (String) templateComboBox.getValue();
boolean requiresSupplierPage = parentTemplates.containsKey(templateId);
if (requiresSupplierPage) {
supplierPageSelect.removeAllItems();
String parentTemplateId = parentTemplates.get(templateId);
final Map<String, String> pages = utils.findPagesUsingTemplate(parentTemplateId);
for (Map.Entry<String, String> entry : pages.entrySet()) {
supplierPageSelect.addItem(entry.getValue());
supplierPageSelect.setItemCaption(entry.getValue(), entry.getKey());
}
supplierPageSelect.setRequired(true);
supplierPageSelect.setVisible(true);
} else {
supplierPageSelect.setValue(null);
supplierPageSelect.setRequired(false);
supplierPageSelect.setVisible(false);
}
}
};
}
示例11: TimeZoneSelectionField
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public TimeZoneSelectionField(boolean isVerticalDisplay) {
this.isVerticalDisplay = isVerticalDisplay;
areaSelection = new ValueComboBox(false, TimezoneVal.getAreas());
areaSelection.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
setCboTimeZone((String) areaSelection.getValue());
}
});
timezoneSelection = new ComboBox();
timezoneSelection.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
String area = (String) areaSelection.getItemIds().iterator().next();
areaSelection.setValue(area);
setCboTimeZone(area);
}
示例12: getSelectedPositions
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
private char[] getSelectedPositions(AbstractSelect field) {
@SuppressWarnings("rawtypes")
Set sel = (Set) field.getValue();
if(sel.size() == 0){
return new char[] { '?' };
}else{
char[] ret = new char[sel.size()];
int i=0;
for(Object obj:sel){
ret[i] = ((String) obj).charAt(0);
i++;
}
return ret;
}
}
示例13: buildSelectOptions
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
/**
* A workhorse for {@link RContainer#getOptionGroup} and
* {@link RContainer#getListSelect} to initiate the selection options by
* reading them from an R character vector.
*
* @param selectObj
* Selection object
* @param optionsInName
* The R character vector to read the different options. Repeated
* values are ignored.
*/
public void buildSelectOptions(final AbstractSelect selectObj,
String optionsInName) {
/* Clean the possible old values */
selectObj.removeAllItems();
String[] optionsIn = getStrings(optionsInName);
if (optionsIn == null) {
Notification.show("RVaadin: Cannot find selection element"
+ " values from " + optionsInName,
Notification.Type.ERROR_MESSAGE);
} else {
for (String str : optionsIn) {
selectObj.addItem(str);
}
}
}
示例14: WebTwinColumn
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
public WebTwinColumn() {
component = new CubaTwinColSelect() {
@Override
public void setPropertyDataSource(Property newDataSource) {
super.setPropertyDataSource(new PropertyAdapter(newDataSource) {
@Override
public Object getValue() {
final Object o = itemProperty.getValue();
return getKeyFromValue(o);
}
@Override
public void setValue(Object newValue) throws ReadOnlyException, Converter.ConversionException {
final Object v = getValueFromKey(newValue);
itemProperty.setValue(v);
}
});
}
@Override
public Resource getItemIcon(Object itemId) {
if (styleProvider != null) {
@SuppressWarnings({"unchecked"})
final Entity item = optionsDatasource.getItem(itemId);
final String resURL = styleProvider.getItemIcon(item, isSelected(itemId));
return resURL == null ? null : WebComponentsHelper.getResource(resURL);
} else {
return null;
}
}
};
attachListener(component);
component.setImmediate(true);
component.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ITEM);
component.setMultiSelect(true);
component.setInvalidAllowed(false);
component.setInvalidCommitted(true);
}
示例15: setStyleProvider
import com.vaadin.ui.AbstractSelect; //导入依赖的package包/类
@Override
public void setStyleProvider(final StyleProvider styleProvider) {
this.styleProvider = styleProvider;
if (styleProvider != null) {
component.setStyleGenerator(new CubaTwinColSelect.OptionStyleGenerator() {
@Override
public String generateStyle(AbstractSelect source, Object itemId, boolean selected) {
final Entity item = optionsDatasource.getItem(itemId);
return styleProvider.getStyleName(item, itemId, component.isSelected(itemId));
}
});
} else {
component.setStyleGenerator(null);
}
}