return comp;
}
private ComponentContainer buildLayout() {
I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
prepareAvailableWidgetsComponent();
stepTree = new Tree(messages.getMessage("stepTree.title"), getCurrentStep());
stepTree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
stepTree.setItemCaptionPropertyId("name");
stepTree.setDragMode(TreeDragMode.NODE);
stepTree.addActionHandler(this);
stepTree.addListener(this);
stepTree.setSelectable(true);
stepTree.setImmediate(true);
stepTree.setItemDescriptionGenerator(new PropertiesDescriptionGenerator());
stepTree.expandItemsRecursively(rootItem);
stepTree.setDropHandler(new TreeDropHandler(stepTree, stepTreeContainer));
paramPanel = new WidgetFormWindow();
permissionEditor = new PermissionEditor();
permissionEditor.setMargin(true);
permissionEditor.setProvider(new PermissionProvider() {
@Override
public Collection<Permission> getPermissions() {
return permissions;
}
@Override
public Collection<PermissionDefinition> getPermissionDefinitions() {
PermissionDefinition perm1 = new PermissionDefinition();
perm1.setKey("SEARCH");
perm1.setDescription("editor.permissions.description.step.SEARCH");
return Arrays.asList(perm1);
}
@Override
public boolean isNewPermissionDefinitionAllowed() {
return false;
}
@Override
public void addPermission(Permission permission) {
permissions.add(permission);
}
@Override
public void removePermission(Permission permission) {
permissions.remove(permission);
}
});
VerticalLayout assignmentLayout = prepareAssignmentLayout();
VerticalLayout stepDefinitionLayout = buildStateDefinitionLayout();
VerticalLayout stepLayout = buildWidgetEditorTabContent();
VerticalLayout vl = new VerticalLayout();
vl.setSizeFull();
vl.setSpacing(true);
vl.addComponent(new Label(messages.getMessage("userstep.editor.instructions"), Label.CONTENT_XHTML));
TabSheet ts = new TabSheet();
ts.setSizeFull();
ts.addTab(stepLayout, messages.getMessage("userstep.editor.widgets.tabcaption"));
ts.addTab(stepDefinitionLayout, messages.getMessage("userstep.state.tabcaption"));
ts.addTab(assignmentLayout, messages.getMessage("userstep.editor.assignment.tabcaption"));
ts.addTab(permissionEditor, messages.getMessage("userstep.editor.permissions.tabcaption"));
ts.setSelectedTab(stepLayout);
vl.addComponent(ts);
vl.setExpandRatio(ts, 1.0f);
return vl;