List of usage examples for com.vaadin.ui ComponentContainer addComponent
public void addComponent(Component c);
From source file:ro.zg.netcell.vaadin.action.application.CreateEntityHandler.java
License:Apache License
@Override public void handle(ActionContext actionContext) throws Exception { ComponentContainer targetContainer = actionContext.getTargetContainer(); Entity entity = actionContext.getEntity(); targetContainer.removeAllComponents(); UserAction ua = actionContext.getUserAction(); // List<String> currentUserTypes = getCurrentUserTypes(entity, actionContext.getApp()); // if (!currentUserTypes.contains(ua.getUserType())) { if (!actionContext.isActionAllowed()) { /* current user is not allowed to execute this action */ displayLoginRequired("create." + ua.getTargetEntityComplexType().toLowerCase() + ".login.required", targetContainer);/*w w w . j av a 2s . co m*/ return; } ExtendedForm form = getForm(entity, actionContext.getUserAction(), actionContext.getApp(), targetContainer, actionContext); targetContainer.addComponent(form); }
From source file:ro.zg.netcell.vaadin.action.application.CreateEntityHandler.java
License:Apache License
private void displaySuccessfulMessage(final Entity entity, final UserAction ua, final OpenGroupsApplication app, final ComponentContainer targetComponent, final long entityId, final ActionContext ac) { /* store current target component */ // final ComponentContainer targetComponent = app.getTargetComponent(); String entityTypeLowerCase = ua.getTargetEntityType().toLowerCase(); String createdSuccessfullyMessage = app.getMessage(entityTypeLowerCase + ".created.successfully"); String createNewMessage = app.getMessage("create.new." + entityTypeLowerCase); String openCreatedMessage = app.getMessage("open.created." + entityTypeLowerCase); VerticalLayout container = new VerticalLayout(); container.setSizeFull();/*w ww.j av a 2s .co m*/ Label success = new Label(createdSuccessfullyMessage); container.addComponent(success); HorizontalLayout linksContainer = new HorizontalLayout(); linksContainer.setSpacing(true); Button openCreated = new Button(openCreatedMessage); linksContainer.addComponent(openCreated); openCreated.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> subtypesList = app.getAppConfigManager() .getSubtypesForComplexType(ua.getTargetEntityComplexType()); if (subtypesList != null) { Entity entity = new Entity(entityId); // getActionsManager().executeAction(ActionsManager.REFRESH_SELECTED_ENTITY, entity, app, null, false,ac); // getActionsManager().executeAction(ActionsManager.OPEN_ENTITY_IN_TAB, entity, app, null, false,ac); app.openInActiveWindow(entity); } /* if no subtypes open the parent entity */ else { Entity parentEntity = ac.getMainEntity(); parentEntity.getState().setEntityTypeVisible(true); String complexEntityType = ua.getTargetEntityComplexType(); parentEntity.getState().setDesiredActionsPath( complexEntityType + Defaults.getDefaultActionForEntityType(complexEntityType)); // app.getTemporaryTab(parentEntity).setRefreshOn(true); // getActionsManager().executeAction(ActionsManager.OPEN_ENTITY_IN_TAB, parentEntity, app, null, false,ac); app.openInActiveWindow(parentEntity); } } }); Button createNew = new Button(createNewMessage); linksContainer.addComponent(createNew); createNew.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { /* recall the handle method on this handler */ // app.setTargetComponent(targetComponent); ua.executeHandler(entity, app, targetComponent, ac); } }); container.addComponent(linksContainer); targetComponent.removeAllComponents(); targetComponent.addComponent(container); /* refresh hierarchy tree */ ActionsManager.getInstance().executeAction(ActionsManager.REFRESH_CAUSAL_HIERARCHY, ac); }
From source file:ro.zg.netcell.vaadin.action.application.CreateEntityHandler.java
License:Apache License
private void displayLoginRequired(String messageKey, ComponentContainer targetContainer) { String msg = getMessage(messageKey); Label l = new Label(msg); targetContainer.addComponent(l); }
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
@Override public void handle(final ActionContext actionContext) throws Exception { final UserAction ua = actionContext.getUserAction(); final OpenGroupsApplication app = actionContext.getApp(); ComponentContainer targetContainer = actionContext.getTargetContainer(); targetContainer.removeAllComponents(); targetContainer.addStyleName(OpenGroupsStyles.LIST_ACTIONS_CONTAINER); final Entity entity = actionContext.getEntity(); /* reset filters */ entity.resetFilters();// w ww .ja v a 2 s . c o m // Panel listContainer = new Panel(); // ((VerticalLayout)listContainer.getContent()).setMargin(false); CssLayout refreshButtonContainer = new CssLayout(); // refreshButtonContainer.setSizeFull(); // refreshButtonContainer.setWidth("100%"); refreshButtonContainer.addStyleName(OpenGroupsStyles.LIST_REFRESH_BAR); // final VerticalLayout listContainer = new VerticalLayout(); final CssLayout listAndPageControlsContainer = new CssLayout(); // final VerticalLayout listAndPageControlsContainer = new VerticalLayout(); listAndPageControlsContainer.addStyleName("list-container"); // listAndPageControlsContainer.setSizeFull(); // listAndPageControlsContainer.setWidth("100%"); Button refreshButton = new Button(); refreshButton.setDescription(getMessage("refresh.list")); refreshButton.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.REFRESH, OpenGroupsIconsSet.MEDIUM)); refreshButton.addStyleName(BaseTheme.BUTTON_LINK + " middle-right"); refreshButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { refreshList(entity, ua, app, listAndPageControlsContainer, actionContext); } }); targetContainer.addComponent(refreshButtonContainer); Component searchFilter = getSearchFilter(entity, ua, app, actionContext); searchFilter.addStyleName("middle-left"); refreshButtonContainer.addComponent(searchFilter); refreshButtonContainer.addComponent(refreshButton); ComponentContainer filtersContainer = initFilters(entity, ua, app, actionContext); targetContainer.addComponent(filtersContainer); targetContainer.addComponent(listAndPageControlsContainer); int itemsCount = refreshList(entity, ua, app, listAndPageControlsContainer, actionContext); }
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
private int refreshList(Entity entity, UserAction ua, OpenGroupsApplication app, ComponentContainer displayArea, ActionContext ac) {// w ww . java 2s .co m displayArea.removeAllComponents(); ac.getWindow().setFragmentToEntity(entity); EntityList list = app.getModel().getChildrenListForEntity(entity, ua, app.getCurrentUserId()); int listSize = list.getItemsList().size(); if (listSize == 0) { displayNoItemsMessage(ua.getTargetEntityComplexType(), displayArea); } else { // final Table listContainer = new Table(); // listContainer.setSizeFull(); // listContainer.setPageLength(0); // listContainer.addStyleName("components-inside"); // listContainer.addStyleName("list-table"); // listContainer.addContainerProperty("", CssLayout.class, null); // displayArea.addComponent(listContainer); displayList(ac, app, displayArea, list); /* add page controls */ CssLayout pageControlsContainer = new CssLayout(); pageControlsContainer.addStyleName("middle-right top-margin-5"); // pageControlsContainer.setSpacing(true); refreshPageControls(entity, ua, app, pageControlsContainer, ac); displayArea.addComponent(pageControlsContainer); } /* set current target component as lastUsedContainer on selected entity */ entity.getState().setLastUsedContainer(displayArea); return listSize; }
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
private void refreshPageControls(final Entity entity, final UserAction ua, final OpenGroupsApplication app, final ComponentContainer container, final ActionContext ac) { final int itemsPerPage = entity.getState().getItemsPerPage(); Button prevButton = new Button(); prevButton.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.LEFT_ARROW, OpenGroupsIconsSet.SMALL)); ComboBox currentPageSelect = new ComboBox(); currentPageSelect.setImmediate(true); currentPageSelect.setNullSelectionAllowed(false); currentPageSelect.setNewItemsAllowed(false); double totalItemsCount = entity.getState().getCurrentListTotalItemsCount(); if (totalItemsCount < 0) { /* the type of the listed entities */ String targetEntityComplexType = ua.getTargetEntityComplexType().toLowerCase(); /* let's find out if this list is recursive or not */ boolean isRecursive = false; /* first check if the target type allows a recursive list in the first place */ // if (getAppConfigManager().getComplexEntityBooleanParam(ua.getTargetEntityComplexType(), // ComplexEntityParam.ALLOW_RECURSIVE_LIST)) { if (app.getAppConfigManager().getTypeRelationBooleanConfigParam(ua.getTypeRelationId(), TypeRelationConfigParam.ALLOW_RECURSIVE_LIST)) { /*/*from ww w. j a v a 2s . co m*/ * if it does, check if the filter is actually set to display all items, that means the recursion depth * is undefined or greater than 0 */ isRecursive = (entity.getFilterValue("depth") == null) ? true : false; if (!isRecursive) { long listDepth = (Long) entity.getFilter("depth").getValue(); if (listDepth > 0) { isRecursive = true; } } } /* if the list is recursive get the number of all entities of the specified type under selected entity */ if (isRecursive) { totalItemsCount = entity.getRecursiveSubtypeEntitiesCount().get(targetEntityComplexType); } /* not recursive, get only the number of first level entities of the specified type */ else { totalItemsCount = entity.getSubtypeEntitiesCount().get(targetEntityComplexType); } } /* * now that we know the total possible entities in this list, and the items per page, we can calculate, the * number of pages */ int numberOfPages = (int) Math.ceil(totalItemsCount / itemsPerPage); final int currentPage = entity.getState().getCurrentPageForCurrentAction(); /* populate the currentpage combobox with the number of pages */ for (int i = 1; i <= numberOfPages; i++) { currentPageSelect.addItem(i + "/" + numberOfPages); } String currentPageString = currentPage + "/" + numberOfPages; currentPageSelect.setValue(currentPageString); int width = currentPageString.length() * 20; currentPageSelect.setWidth(width + "px"); Button nextButton = new Button(); nextButton.setIcon(OpenGroupsResources.getIcon(OpenGroupsIconsSet.RIGHT_ARROW, OpenGroupsIconsSet.SMALL)); if (currentPage == 1) { prevButton.setEnabled(false); } if (currentPage == numberOfPages) { nextButton.setEnabled(false); } prevButton.addStyleName("middle-left right-margin-10"); currentPageSelect.addStyleName("middle-left right-margin-10"); nextButton.addStyleName("middle-left"); container.addComponent(prevButton); container.addComponent(currentPageSelect); container.addComponent(nextButton); /* listeners */ prevButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { entity.getState().setCurrentPageForCurrentAction(currentPage - 1); refreshList(entity, ua, app, entity.getState().getLastUsedContainer(), ac); // refreshList(entity, ua, app, entity.getState().getChildrenListContainer()); } }); nextButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { entity.getState().setCurrentPageForCurrentAction(currentPage + 1); refreshList(entity, ua, app, entity.getState().getLastUsedContainer(), ac); // refreshList(entity, ua, app, entity.getState().getChildrenListContainer()); } }); currentPageSelect.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String value = (String) event.getProperty().getValue(); String page = value.substring(0, value.indexOf("/")); entity.getState().setCurrentPageForCurrentAction(Integer.parseInt(page)); refreshList(entity, ua, app, entity.getState().getLastUsedContainer(), ac); // refreshList(entity, ua, app, entity.getState().getChildrenListContainer()); } }); }
From source file:ro.zg.netcell.vaadin.action.application.EntityListHandler.java
License:Apache License
private void displayNoItemsMessage(String entityType, ComponentContainer container) { String message = OpenGroupsResources.getMessage("no.items." + entityType.toLowerCase()); Label l = new Label(message); container.removeAllComponents();//from ww w.j a v a 2 s . c o m container.addComponent(l); }
From source file:ro.zg.netcell.vaadin.action.application.OpenEntityWithActionsHandler.java
License:Apache License
@Override public void handle(ActionContext actionContext) throws Exception { Entity entity = actionContext.getEntity(); OpenGroupsApplication app = actionContext.getApp(); ComponentContainer targetContainer = actionContext.getTargetContainer(); targetContainer.removeAllComponents(); // targetContainer.setSizeFull(); /* show the component */ CssLayout entityContainer = new CssLayout(); // entityContainer.setSizeFull(); // entityContainer.setWidth("100%"); // entityContainer.addStyleName("right-margin-20"); entityContainer.addStyleName("entity-with-header-actions"); targetContainer.addComponent(entityContainer); getActionsManager().executeAction(ActionsManager.OPEN_SELECTED_ENTITY_WITH_HEADER_ACTIONS, entity, app, entityContainer, false, actionContext); if (app.hasErrors()) { return;// w ww. j a va 2s . c o m } /* add the container for the actions to the window */ CssLayout actionsContainer = new CssLayout(); // HorizontalLayout actionsContainer = new HorizontalLayout(); // VerticalLayout actionsContainer = new VerticalLayout(); // actionsContainer.setSizeFull(); actionsContainer.addStyleName(OpenGroupsStyles.USER_ACTIONS_TAB); // actionsContainer.setWidth("100%"); // actionsContainer.addStyleName("right-margin-20"); targetContainer.addComponent(actionsContainer); displayActionsForSelectedEntity(entity, app, actionsContainer, actionContext); }
From source file:ro.zg.netcell.vaadin.action.application.OpenEntityWithUpstreamHierarchy.java
License:Apache License
@Override public void handle(ActionContext actionContext) throws Exception { OpenGroupsApplication app = actionContext.getApp(); Entity selectedEntity = actionContext.getEntity(); UserAction ua = actionContext.getUserAction(); Map<String, Object> params = ua.getActionParams(); params.putAll(selectedEntity.getFilterValues()); params.put("pageNumber", 1); /* we need to bring all the hierarchy and display it on the same page */ params.put("itemsOnPage", 5000); params.put("entityId", selectedEntity.getId()); params.put("withContent", true); params.put("userId", app.getCurrentUserId()); ComponentContainer container = actionContext.getTargetContainer(); container.removeAllComponents();/*from ww w . j ava2 s . co m*/ container.setSizeFull(); // VerticalLayout hierarchyContainer = new VerticalLayout(); CssLayout hierarchyContainer = new CssLayout(); hierarchyContainer.setSizeFull(); container.addComponent(hierarchyContainer); displayHierarchyList(selectedEntity, ua, app, hierarchyContainer, params); // VerticalLayout entityContainer = new VerticalLayout(); CssLayout entityContainer = new CssLayout(); container.addComponent(entityContainer); getActionsManager().executeAction(ActionsManager.OPEN_ENTITY_WITH_ACTIONS, selectedEntity, app, entityContainer, false, actionContext); }
From source file:ro.zg.netcell.vaadin.action.application.OpenSelectedEntityHandler.java
License:Apache License
@Override public void handle(final ActionContext actionContext) throws Exception { final ComponentContainer container = actionContext.getTargetContainer(); container.removeAllComponents();/*from w w w . j a va 2s . co m*/ // container.setSizeFull(); // container.setMargin(false); final OpenGroupsApplication app = actionContext.getApp(); final Entity entity = actionContext.getEntity(); EntityState entityState = entity.getState(); boolean isOpened = entityState.isOpened(); String complexEntityType = entity.getComplexType(); ApplicationConfigManager appConfigManager = app.getAppConfigManager(); List<String> subtyesList = appConfigManager.getSubtypesForComplexType(complexEntityType); // Panel currentContainer = (Panel) container; ComponentContainer currentContainer = container; entity.setEntityContainer(container); CssLayout headerContainer = new CssLayout(); headerContainer.addStyleName("entity-header-container"); currentContainer.addComponent(headerContainer); // CssLayout titleContainer = new CssLayout(); // titleContainer.setWidth("80%"); // titleContainer.addStyleName(OpenGroupsStyles.MIDDLE_LEFT); // headerContainer.addComponent(titleContainer); // titleContainer.setSizeFull(); // /* show level */ // String levelMsg = getMessage("level"); // Label levelLabel = new Label(levelMsg+" "+entity.getDepth()); // titleContainer.addComponent(levelLabel); /* show entity type */ if (entity.getState().isEntityTypeVisible()) { String entityTypeCaption = getMessage(entity.getComplexType()); String size = OpenGroupsIconsSet.MEDIUM; if (entity.getContent() != null) { size = OpenGroupsIconsSet.LARGE; } // Label typeIcon = new Label(); // typeIcon.setDescription(entityTypeCaption); // typeIcon.setIcon(OpenGroupsResources.getIcon(entity.getComplexType().toLowerCase(), // size)); // typeIcon.setSizeUndefined(); // typeIcon.addStyleName("top-left right-margin-20"); // headerContainer.addComponent(typeIcon); Embedded eicon = new Embedded(null, OpenGroupsResources.getIcon(entity.getComplexType().toLowerCase(), size)); eicon.setDescription(entityTypeCaption); eicon.addStyleName("top-left right-margin-20"); headerContainer.addComponent(eicon); // Embedded eicon2 = new Embedded("", // OpenGroupsResources.getIcon(entity.getComplexType().toLowerCase(), // size)); // eicon2.setDescription(entityTypeCaption); // eicon2.addStyleName("top-left right-margin-20"); // headerContainer.addComponent(eicon2); } // Label test = new Label("test"); // test.setSizeUndefined(); // test.addStyleName("top-left"); // headerContainer.addComponent(test); /* add last action for this entity */ if (entity.getLastActionType() != null) { String actionType = entity.getLastActionType(); String msg = getMessage(actionType); // Label actionLabel = new Label(); // actionLabel.setDescription(msg); // actionLabel.setIcon(OpenGroupsResources.getIcon(actionType, // OpenGroupsIconsSet.MEDIUM)); // actionLabel.setSizeUndefined(); // actionLabel.addStyleName(OpenGroupsStyles.MIDDLE_LEFT); // titleContainer.addComponent(actionLabel); Embedded actionIcon = new Embedded(null, OpenGroupsResources.getIcon(actionType, OpenGroupsIconsSet.MEDIUM)); actionIcon.setDescription(msg); actionIcon.addStyleName("top-left right-margin-20"); headerContainer.addComponent(actionIcon); } EntityLink selectedCause = entity.getSelectedCause(); /* display title */ /* if the entity is open */ /* treat leafs like all posts 21.08.2012 */ if (isOpened /* * || (subtyesList == null && entity.getLastActionType() == * null) */) { Label title = new Label(entity.getTitle()); if (isOpened) { title.addStyleName(OpenGroupsStyles.TITLE_LINK); } else { title.addStyleName("list-issue-title"); } // title.addStyleName("top-left"); // title.setSizeFull(); title.setWidth("80%"); // title.setHeight("100%"); headerContainer.addComponent(title); } else { // Button titleLink = new Button(entity.getTitle()); // titleLink.setWidth("100%"); // titleLink.addStyleName(BaseTheme.BUTTON_LINK); // titleLink.addStyleName("issue-title"); // titleLink.setDescription(entity.getContentPreview()); Label titleLink = null; /* treat leafs like all posts 21.08.2012 */ // if (subtyesList != null) { titleLink = OpenGroupsUtil.getLinkForEntity(entity, app); titleLink.setDescription(entity.getContentPreview()); titleLink.addStyleName("list-issue-title"); // } // /* is a leaf entity in the recent activity list */ // else { // String parentTitle = selectedCause.getParentTitle(); // Entity parentEntity = new Entity(selectedCause.getParentId()); // parentEntity.setTitle(parentTitle); // // parentEntity.getState().setDesiredActionsPath( // complexEntityType + // Defaults.getDefaultActionForEntityType(complexEntityType)); // titleLink = OpenGroupsUtil.getLinkForEntity(parentEntity, app, // entity.getTitle()); // titleLink.setDescription(entity.getContentPreview()); // titleLink.addStyleName("list-issue-title"); // // } // titleLink.setWidth("75%"); titleLink.addStyleName("top-left"); headerContainer.addComponent(titleLink); // titleContainer.setExpandRatio(titleLink, 10f); // currentContainer.addStyleName("list-item"); } /* add parent link */ if (selectedCause != null && !isOpened && entity.getContent() == null) { // CssLayout parentInfoContainer = new CssLayout(); // parentInfoContainer.addStyleName(OpenGroupsStyles.TOP_RIGHT); // headerContainer.addComponent(parentInfoContainer); // headerContainer.setColumnExpandRatio(1, 1f); // headerContainer.setComponentAlignment(parentInfoContainer, // Alignment.TOP_RIGHT); /* if parent entity is the current selected entity, say it */ Entity mainEntity = actionContext.getMainEntity(); if (selectedCause.getParentId() == mainEntity.getId()) { // String currentMsg = getMessage(mainEntity.getComplexType() + // ".current"); // Label currentEntityLabel = new Label(currentMsg); // currentEntityLabel.setSizeUndefined(); // currentEntityLabel.addStyleName("top-right"); // headerContainer.addComponent(currentEntityLabel); // titleContainer.setExpandRatio(currentEntityLabel, 2f); } else {/* add link to the parent entity */ String parentTitle = selectedCause.getParentTitle(); final Entity parentEntity = new Entity(selectedCause.getParentId()); parentEntity.setTitle(parentTitle); Label parentLink = OpenGroupsUtil.getLinkForEntityWithImage(parentEntity, app, OpenGroupsResources.getIconPath(OpenGroupsIconsSet.PARENT, OpenGroupsIconsSet.MEDIUM)); parentLink.setDescription(parentTitle); parentLink.setSizeUndefined(); parentLink.addStyleName(OpenGroupsStyles.TOP_RIGHT); // CssLayout imgContainer = new CssLayout(); // imgContainer.setWidth("24px"); // imgContainer.setHeight("24px"); // imgContainer.addStyleName(OpenGroupsStyles.TOP_RIGHT); // imgContainer.addComponent(parentLink); // parentInfoContainer.addComponent(imgContainer); headerContainer.addComponent(parentLink); } } /* display header actions */ if (isOpened) { UserActionList headerActions = getAvailableActions(entity, ActionLocations.HEADER); boolean allowRefresh = appConfigManager.getComplexEntityBooleanParam(entity.getComplexType(), ComplexEntityParam.ALLOW_REFRESH); boolean hasHeaderActions = headerActions != null && headerActions.getActions() != null; if (allowRefresh || hasHeaderActions) { HorizontalLayout actionsContainer = new HorizontalLayout(); actionsContainer.addStyleName(OpenGroupsStyles.TOP_RIGHT); actionsContainer.setSpacing(true); // /* add refresh button */ // if (allowRefresh) { // actionsContainer.addComponent(getRefreshButton(entity, app)); // } // if (hasHeaderActions) { // for (final UserAction ha : // headerActions.getActions().values()) { // Button actButton = getButtonForAction(ha, entity, app); // actionsContainer.addComponent(actButton); // } // } headerContainer.addComponent(actionsContainer); // headerContainer.setColumnExpandRatio(1, 1f); // headerContainer.setComponentAlignment(actionsContainer, // Alignment.TOP_RIGHT); entity.setHeaderActionLinksContainer(actionsContainer); refreshHeaderActionLinks(entity, app, actionContext); } } /* display tags */ List<Tag> tags = entity.getTags(); if (tags != null) { if (tags.size() > 0) { String tagsList = ""; for (int i = 0; i < tags.size(); i++) { Tag tag = tags.get(i); tagsList += tag.getTagName(); if ((tags.size() - i) > 1) { tagsList += ", "; } } String tagsLabelString = app.getMessage("tags.label") + tagsList; currentContainer.addComponent(new Label(tagsLabelString)); } } CssLayout statusPane = new CssLayout(); statusPane.addStyleName("entity-status-pane"); currentContainer.addComponent(statusPane); if (appConfigManager.getComplexEntityBooleanParam(complexEntityType, ComplexEntityParam.SHOW_POST_INFO)) { String insertDateString = entity.getInsertDate().toString(); Label insertDate = new Label(app.getMessage("posted") + DateUtil.removeNanos(insertDateString)); statusPane.addComponent(insertDate); // statusPane.setColumnExpandRatio(0, 1f); } CssLayout statsSummaryPane = new CssLayout(); statsSummaryPane.addStyleName("entity-stats-summary-pane"); // statsSummaryPane.setSizeFull(); // statsSummaryPane.setWidth("100%"); currentContainer.addComponent(statsSummaryPane); /* add votes */ if (appConfigManager.getComplexEntityBooleanParam(complexEntityType, ComplexEntityParam.ALLOW_VOTING)) { // HorizontalLayout votesPane = new HorizontalLayout(); // votesPane.setMargin(false); // votesPane.addStyleName("middle-left"); // votesPane.addStyleName("margin-right"); // statsSummaryPane.addComponent(votesPane); // statsSummaryPane.setExpandRatio(votesPane, 1f); // statsSummaryPane.setComponentAlignment(votesPane, // Alignment.MIDDLE_LEFT); Label votesLabel = new Label(app.getMessage("votes") + ": "); votesLabel.setContentMode(Label.CONTENT_XHTML); votesLabel.setSizeUndefined(); votesLabel.addStyleName("middle-left"); // votesPane.addComponent(votesLabel); Label proVotes = FormatingUtils.coloredLabel(entity.getProVotes(), "336633"); proVotes.addStyleName("middle-left"); proVotes.setSizeUndefined(); // votesPane.addComponent(proVotes); Label dash = new Label("-"); dash.addStyleName("middle-left"); dash.setSizeUndefined(); // votesPane.addComponent(new Label("-")); Label opposedVotes = FormatingUtils.coloredLabel(entity.getOpposedVotes(), "660000"); // votesPane.addComponent(opposedVotes); opposedVotes.addStyleName("middle-left"); opposedVotes.addStyleName("right-margin-10"); opposedVotes.setSizeUndefined(); statsSummaryPane.addComponent(votesLabel); statsSummaryPane.addComponent(proVotes); statsSummaryPane.addComponent(dash); statsSummaryPane.addComponent(opposedVotes); } List<TypeRelationConfig> subtypes = appConfigManager.getSubtypesForType(entity.getComplexTypeId()); // if (subtyesList != null) { if (subtypes != null) { Map<String, Long> firstLevelSubtypesCount = entity.getSubtypeEntitiesCount(); Map<String, Long> allSubtypesCount = entity.getRecursiveSubtypeEntitiesCount(); // for (String s : subtyesList) { // String subtype = s.toLowerCase(); for (TypeRelationConfig trc : subtypes) { String targetComplexType = trc.getTargetComplexType(); String subtype = targetComplexType.toLowerCase(); String displayName = app.getMessage("subtype." + subtype); Entity refEntity = new Entity(entity.getId()); refEntity.getState().setDesiredActionsPath( targetComplexType + Defaults.getDefaultActionForEntityType(targetComplexType)); Label subtypeLink = OpenGroupsUtil.getLinkForEntity(refEntity, app, displayName); String valueString = ": " + firstLevelSubtypesCount.get(subtype); // if (getAppConfigManager().getComplexEntityBooleanParam(s, // ComplexEntityParam.ALLOW_RECURSIVE_LIST)) { if (appConfigManager.getTypeRelationBooleanConfigParam(trc.getId(), TypeRelationConfigParam.ALLOW_RECURSIVE_LIST)) { Long recCount = allSubtypesCount.get(subtype); if (recCount != null) { valueString += " / " + recCount; } } Label sl = new Label(valueString); sl.setWidth(null); sl.addStyleName("middle-left"); sl.addStyleName("right-margin-10"); subtypeLink.setWidth(null); subtypeLink.addStyleName("middle-left"); statsSummaryPane.addComponent(subtypeLink); statsSummaryPane.addComponent(sl); // statsSummaryPane.setExpandRatio(sl, 1f); // statsSummaryPane.setComponentAlignment(sl, // Alignment.MIDDLE_LEFT); } } displaySummaryActions(entity, app, statsSummaryPane, actionContext); // statusPane.addComponent(statsSummaryPane, 1, 0); // statusPane.setColumnExpandRatio(1, 1.8f); // statusPane.setComponentAlignment(statsSummaryPane, // Alignment.MIDDLE_RIGHT); // summaryLayout.setComponentAlignment(statsSummaryPane, // Alignment.MIDDLE_RIGHT); /* add the content */ Object contentObj = entity.getContent(); if (contentObj != null) { // content.setSizeFull(); Panel contentContainer = new Panel(); // CssLayout contentContainer = new CssLayout(); contentContainer.addStyleName("text-content"); currentContainer.addComponent(contentContainer); Label content = new Label(contentObj.toString()); content.setContentMode(Label.CONTENT_XHTML); // content.addStyleName("text-label"); contentContainer.addComponent(content); /* if the content is visible, display footer actions */ displayFooterActions(entity, app, currentContainer, actionContext); } }