use of com.vaadin.ui.Table.CellStyleGenerator in project Activiti by Activiti.
the class TabbedSelectionWindow method initSelectionTable.
protected void initSelectionTable() {
selectionTable = new Table();
selectionTable.setSizeUndefined();
selectionTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
selectionTable.setSelectable(true);
selectionTable.setImmediate(true);
selectionTable.setNullSelectionAllowed(false);
selectionTable.setWidth(150, UNITS_PIXELS);
selectionTable.setHeight(100, UNITS_PERCENTAGE);
selectionTable.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Object itemId, Object propertyId) {
if ("name".equals(propertyId)) {
return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN;
}
return null;
}
});
selectionTable.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
selectionTable.addContainerProperty("type", Embedded.class, null);
selectionTable.setColumnWidth("type", 22);
selectionTable.addContainerProperty("name", String.class, null);
// Listener to switch to the selected component
selectionTable.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String name = (String) event.getProperty().getValue();
if (name != null) {
currentSelection = name;
currentComponent = components.get(name);
selectedComponentLayout.removeComponent(selectedComponentLayout.getComponent(0, 0));
if (currentComponent != null) {
currentComponent.setSizeFull();
selectedComponentLayout.addComponent(currentComponent, 0, 0);
okButton.setEnabled(true);
} else {
okButton.setEnabled(false);
}
}
}
});
windowLayout.addComponent(selectionTable);
}
use of com.vaadin.ui.Table.CellStyleGenerator in project Activiti by Activiti.
the class CreateAttachmentPopupWindow method initTable.
protected void initTable() {
attachmentTypes = new Table();
attachmentTypes.setSizeUndefined();
attachmentTypes.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
attachmentTypes.setSelectable(true);
attachmentTypes.setImmediate(true);
attachmentTypes.setNullSelectionAllowed(false);
attachmentTypes.setWidth(200, UNITS_PIXELS);
attachmentTypes.setHeight(100, UNITS_PERCENTAGE);
attachmentTypes.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Object itemId, Object propertyId) {
if ("name".equals(propertyId)) {
return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN;
}
return null;
}
});
attachmentTypes.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
attachmentTypes.addContainerProperty("type", Embedded.class, null);
attachmentTypes.setColumnWidth("type", 16);
attachmentTypes.addContainerProperty("name", String.class, null);
// Add all possible attachment types
for (AttachmentEditor editor : attachmentRendererManager.getAttachmentEditors()) {
String name = editor.getTitle(i18nManager);
Embedded image = null;
Resource resource = editor.getImage();
if (resource != null) {
image = new Embedded(null, resource);
}
Item item = attachmentTypes.addItem(editor.getName());
item.getItemProperty("type").setValue(image);
item.getItemProperty("name").setValue(name);
}
// Add listener to show editor component
attachmentTypes.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String type = (String) event.getProperty().getValue();
selectType(type);
}
});
layout.addComponent(attachmentTypes);
}
Aggregations