List of usage examples for com.vaadin.ui ComponentContainer addStyleName
public void addStyleName(String style);
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
private ComponentContainer initFilters(Entity entity, UserAction ua, OpenGroupsApplication app, final ActionContext ac) { // VerticalLayout filtersLayoutWithCaption = new VerticalLayout(); // filtersLayoutWithCaption.setWidth("100%"); // Label filterLabel = new Label(getMessage("filter") + ":"); // filtersLayoutWithCaption.addComponent(filterLabel); boolean hasFilters = false; CssLayout filtersLayout = new CssLayout(); filtersLayout.addStyleName(OpenGroupsStyles.LIST_FILTERS_BAR); // filtersLayout.setWidth("100%"); // filtersLayout.setSpacing(true); // filtersLayoutWithCaption.addComponent(filtersLayout); String complexType = ua.getTargetEntityComplexType(); /* add depth filter */ // boolean allowRecursiveList = getAppConfigManager().getComplexEntityBooleanParam( // ua.getTargetEntityComplexType(), ComplexEntityParam.ALLOW_RECURSIVE_LIST); ApplicationConfigManager appConfigManager = app.getAppConfigManager(); boolean allowRecursiveList = appConfigManager.getTypeRelationBooleanConfigParam(ua.getTypeRelationId(), TypeRelationConfigParam.ALLOW_RECURSIVE_LIST); if (allowRecursiveList) { ComponentContainer listByDepthFilter = getListByDepthFilter(entity, ua, app, ac); listByDepthFilter.addStyleName("middle-left right-margin-10"); filtersLayout.addComponent(listByDepthFilter); hasFilters = true;/*from ww w. ja v a2 s. co m*/ } /* add status filter */ if (app.getCurrentUser() != null && appConfigManager.getComplexEntityBooleanParam(complexType, ComplexEntityParam.ALLOW_STATUS)) { ComponentContainer statusFilter = getStatusFilter(entity, ua, app, ac); statusFilter.addStyleName("middle-left right-margin-10"); filtersLayout.addComponent(statusFilter); hasFilters = true; } /* add global status filter */ if (appConfigManager.getComplexEntityBooleanParam(complexType, ComplexEntityParam.ALLOW_STATUS)) { ComponentContainer globalStatusFilter = getGlobalStatusFilter(entity, ua, app, ac); globalStatusFilter.addStyleName("middle-left right-margin-10"); filtersLayout.addComponent(globalStatusFilter); hasFilters = true; } /* add tag filter */ if (appConfigManager.getComplexEntityBooleanParam(complexType, ComplexEntityParam.ALLOW_TAG)) { ComponentContainer tagsFilter = getTagsFilter(entity, ua, app, ac); tagsFilter.addStyleName("middle-left right-margin-10"); filtersLayout.addComponent(tagsFilter); hasFilters = true; } // GridLayout filtersContainer = new GridLayout(1, 1); // if (hasFilters) { // filtersContainer = new GridLayout(2, 1); // } // filtersContainer.setMargin(false); // // filtersContainer.setSizeFull(); // filtersContainer.setWidth("100%"); // filtersContainer.setSpacing(true); // filtersContainer.addStyleName(OpenGroupsStyles.LIST_FILTERS_BAR); // // if (hasFilters) { // filtersContainer.addComponent(filtersLayout, 0, 0); // filtersContainer.setColumnExpandRatio(0, 1f); // filtersContainer.setComponentAlignment(filtersLayout, Alignment.MIDDLE_LEFT); // } /* add search filter */ // Component searchFilter = getSearchFilter(entity, ua, app, ac); // searchFilter.addStyleName("middle-right"); // filtersContainer.addComponent(searchFilter); // filtersContainer.setComponentAlignment(searchFilter, Alignment.MIDDLE_RIGHT); // // return filtersContainer; // filtersLayout.addComponent(searchFilter); return filtersLayout; }