use of com.vaadin.v7.ui.Select in project SORMAS-Project by hzi-braunschweig.
the class SormasFieldGroupFieldFactory method populateWithEnumData.
@SuppressWarnings("unchecked")
@Override
protected void populateWithEnumData(AbstractSelect select, Class<? extends Enum> enumClass) {
select.removeAllItems();
for (Object p : select.getContainerPropertyIds()) {
select.removeContainerProperty(p);
}
select.addContainerProperty(CAPTION_PROPERTY_ID, String.class, "");
select.setItemCaptionPropertyId(CAPTION_PROPERTY_ID);
EnumSet<?> enumSet = EnumSet.allOf(enumClass);
for (Object r : enumSet) {
boolean visible = true;
if (fieldVisibilityCheckers != null) {
visible = fieldVisibilityCheckers.isVisible(enumClass, ((Enum<?>) r).name());
}
if (visible) {
Item newItem = select.addItem(r);
newItem.getItemProperty(CAPTION_PROPERTY_ID).setValue(r.toString());
}
}
}
use of com.vaadin.v7.ui.Select in project opencms-core by alkacon.
the class CmsRestoreDeletedDialog method initDeletedResources.
/**
* Fills the list of resources to select from.<p>
*
* @param cms the cms context
* @param deletedResources the deleted resources
*
* @throws CmsException if something goes wrong
*/
private void initDeletedResources(CmsObject cms, List<I_CmsHistoryResource> deletedResources) throws CmsException {
Collections.sort(deletedResources, new Comparator<I_CmsHistoryResource>() {
public int compare(I_CmsHistoryResource first, I_CmsHistoryResource second) {
return first.getRootPath().compareTo(second.getRootPath());
}
});
m_deletedResourceContainer.removeAllComponents();
m_selectionContainer = new IndexedContainer();
m_selectionContainer.addContainerProperty(PROP_SELECTED, Boolean.class, Boolean.FALSE);
m_okButton.setEnabled(!deletedResources.isEmpty());
if (deletedResources.isEmpty()) {
m_deletedResourceContainer.addComponent(new Label(CmsVaadinUtils.getMessageText(org.opencms.workplace.list.Messages.GUI_LIST_EMPTY_0)));
}
for (I_CmsHistoryResource deleted : deletedResources) {
I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(deleted.getTypeId());
String typeName = resType.getTypeName();
CmsExplorerTypeSettings explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(typeName);
String title = cms.getRequestContext().removeSiteRoot(deleted.getRootPath());
String subtitle = CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_RESTOREDELETED_DATE_VERSION_2, CmsVfsService.formatDateTime(cms, deleted.getDateLastModified()), "" + deleted.getVersion());
if (explorerType == null) {
explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(deleted.isFile() ? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME : CmsResourceTypeUnknownFolder.RESOURCE_TYPE_NAME);
}
CmsResourceInfo info = new CmsResourceInfo(title, subtitle, CmsResourceUtil.getBigIconResource(explorerType, deleted.getName()));
info.setWidth("100%");
HorizontalLayout hl = new HorizontalLayout();
hl.setWidth("100%");
CheckBox checkbox = new CheckBox();
hl.addComponent(checkbox);
hl.addComponent(info);
hl.setExpandRatio(info, 1);
hl.setComponentAlignment(checkbox, Alignment.MIDDLE_LEFT);
m_selectionContainer.addItem(deleted.getStructureId());
checkbox.setPropertyDataSource(m_selectionContainer.getItem(deleted.getStructureId()).getItemProperty(PROP_SELECTED));
m_deletedResourceContainer.addComponent(hl);
}
}
use of com.vaadin.v7.ui.Select in project opencms-core by alkacon.
the class CmsDataViewPanel method updateFilters.
/**
* Changes the displayed filters to a new set.<p>
*
* @param newFilters the new filters
*/
public void updateFilters(List<CmsDataViewFilter> newFilters) {
if (newFilters.isEmpty()) {
m_filterContainer.setVisible(false);
}
if (m_filters.equals(newFilters)) {
return;
}
m_filterContainer.removeAllComponents();
m_filters = newFilters;
m_filterMap.clear();
for (CmsDataViewFilter filter : newFilters) {
m_filterMap.put(filter.getId(), filter);
final CmsDataViewFilter finalFilter = filter;
ComboBox select = new ComboBox(filter.getNiceName());
select.setWidth("175px");
select.setNullSelectionAllowed(false);
select.setPageLength(0);
Map<String, String> options = filter.getOptions();
for (Map.Entry<String, String> entry : options.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
select.addItem(key);
select.setItemCaption(key, value);
}
select.setValue(filter.getValue());
if (filter.getHelpText() != null) {
select.setDescription(filter.getHelpText());
}
select.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String newValue = (String) (event.getProperty().getValue());
updateFilter(finalFilter.getId(), newValue);
}
});
m_filterContainer.addComponent(select);
}
}
use of com.vaadin.v7.ui.Select in project opencms-core by alkacon.
the class CmsCategoryTree method setSelectedCategories.
/**
* Sets the selected categories.<p>
*
* @param categories the categories to select
*/
public void setSelectedCategories(Collection<CmsCategory> categories) {
for (Entry<CmsCategory, CheckBox> entry : m_checkboxes.entrySet()) {
entry.getValue().setValue(Boolean.valueOf(categories.contains(entry.getKey())));
CmsCategory parentCat = (CmsCategory) getParent(entry.getKey());
if (parentCat != null) {
setCollapsed(parentCat, false);
}
}
}
use of com.vaadin.v7.ui.Select in project opencms-core by alkacon.
the class CmsPropertyTable method init.
/**
* Fills table with items.<p>
*/
public void init() {
try {
List<CmsPropertyDefinition> properties = A_CmsUI.getCmsObject().readAllPropertyDefinitions();
m_container = new IndexedContainer();
for (TableColumn col : TableColumn.values()) {
m_container.addContainerProperty(col, col.getType(), col.getDefaultValue());
}
setContainerDataSource(m_container);
setItemIconPropertyId(TableColumn.Icon);
setRowHeaderMode(RowHeaderMode.ICON_ONLY);
setVisibleColumns(TableColumn.Name);
for (CmsPropertyDefinition prop : properties) {
Item item = m_container.addItem(prop);
item.getItemProperty(TableColumn.Name).setValue(prop.getName());
}
addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 4807195510202231174L;
public void itemClick(ItemClickEvent event) {
setValue(null);
select(event.getItemId());
if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
m_menu.setEntries(getMenuEntries(), Collections.singleton(((CmsPropertyDefinition) getValue()).getName()));
m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsPropertyTable.this);
} else if (TableColumn.Name.equals(event.getPropertyId())) {
showResources(((CmsPropertyDefinition) getValue()).getName());
}
}
});
setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Table source, Object itemId, Object propertyId) {
if (TableColumn.Name.equals(propertyId)) {
return " " + OpenCmsTheme.HOVER_COLUMN;
}
return null;
}
});
} catch (CmsException e) {
//
}
}
Aggregations