List of usage examples for org.apache.wicket.markup.html WebMarkupContainer setRenderBodyOnly
public final Component setRenderBodyOnly(final boolean renderTag)
From source file:com.eltiland.ui.course.components.tree.ELTDefaultAbstractTree.java
License:Apache License
/** * Creates the indentation element. This element should be placed as first element in the tree * item markup to ensure proper indentation of the tree item. This implementation also takes * care of lines that connect nodes.//w ww . jav a 2s.c o m * * @param parent The component parent * @param id The component id * @param node The tree node for which to create the indentation element * @param level The current level * @return The indentation component */ protected Component newIndentation(final MarkupContainer parent, final String id, final ELTTreeNode node, final int level) { WebMarkupContainer result = new WebMarkupContainer(id) { private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { Response response = RequestCycle.get().getResponse(); ELTTreeNode parent = node.getParent(); CharSequence urls[] = new CharSequence[level]; for (int i = 0; i < level; ++i) { if (isNodeLast(parent)) { urls[i] = "indent-blank"; } else { urls[i] = "indent-line"; } if (parent != null) { parent = parent.getParent(); } } for (int i = level - 1; i >= 0; --i) { response.write("<span class=\"" + urls[i] + "\"></span>"); } } }; result.setRenderBodyOnly(true); return result; }
From source file:com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel.java
License:Apache License
private void initMenuItem(ListItem<InlineMenuItem> menuItem) { final InlineMenuItem item = menuItem.getModelObject(); WebMarkupContainer menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, menuItem.getModel()); menuItemBody.setRenderBodyOnly(true); menuItem.add(menuItemBody);/*from www . j a va 2s.c om*/ }
From source file:com.evolveum.midpoint.web.component.search.SearchPanel.java
License:Apache License
private void initLayout() { moreDialogModel = new LoadableModel<MoreDialogDto>(false) { @Override//www . j a va 2 s . c o m protected MoreDialogDto load() { MoreDialogDto dto = new MoreDialogDto(); dto.setProperties(createPropertiesList()); return dto; } }; Form form = new Form(ID_FORM); add(form); ListView items = new ListView<SearchItem>(ID_ITEMS, new PropertyModel<List<SearchItem>>(getModel(), Search.F_ITEMS)) { @Override protected void populateItem(ListItem<SearchItem> item) { SearchItemPanel searchItem = new SearchItemPanel(ID_ITEM, item.getModel()); item.add(searchItem); } }; items.add(createAdvancedVisibleBehaviour(false)); form.add(items); WebMarkupContainer moreGroup = new WebMarkupContainer(ID_MORE_GROUP); moreGroup.add(createAdvancedVisibleBehaviour(false)); form.add(moreGroup); AjaxLink more = new AjaxLink(ID_MORE) { @Override public void onClick(AjaxRequestTarget target) { Component button = SearchPanel.this.get(createComponentPath(ID_FORM, ID_MORE_GROUP, ID_MORE)); Component popover = SearchPanel.this.get(createComponentPath(ID_POPOVER)); togglePopover(target, button, popover, 14); } }; more.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { Search search = getModelObject(); return !search.getAvailableDefinitions().isEmpty(); } }); more.setOutputMarkupId(true); moreGroup.add(more); WebMarkupContainer searchContainer = new WebMarkupContainer(ID_SEARCH_CONTAINER); searchContainer.setOutputMarkupId(true); form.add(searchContainer); AjaxSubmitButton searchSimple = new AjaxSubmitButton(ID_SEARCH_SIMPLE) { @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(form); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { searchPerformed(target); } }; searchSimple.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { Search search = getModelObject(); if (!search.isShowAdvanced()) { return true; } PrismContext ctx = getPageBase().getPrismContext(); return search.isAdvancedQueryValid(ctx); } @Override public boolean isVisible() { return !getModelObject().isShowAdvanced() || !queryPlagroundAccessible; } }); searchSimple.setOutputMarkupId(true); searchContainer.add(searchSimple); WebMarkupContainer searchDropdown = new WebMarkupContainer(ID_SEARCH_DROPDOWN); searchDropdown.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return getModelObject().isShowAdvanced() && queryPlagroundAccessible; } }); searchContainer.add(searchDropdown); AjaxSubmitButton searchButtonBeforeDropdown = new AjaxSubmitButton(ID_SEARCH_BUTTON_BEFORE_DROPDOWN) { @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(form); } @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { searchPerformed(target); } }; searchButtonBeforeDropdown.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { Search search = getModelObject(); if (!search.isShowAdvanced()) { return true; } PrismContext ctx = getPageBase().getPrismContext(); return search.isAdvancedQueryValid(ctx); } }); searchDropdown.add(searchButtonBeforeDropdown); List<InlineMenuItem> searchItems = new ArrayList<>(); InlineMenuItem searchItem = new InlineMenuItem(createStringResource("SearchPanel.search"), new InlineMenuItemAction() { @Override public void onClick(AjaxRequestTarget target) { PrismContext ctx = getPageBase().getPrismContext(); if (getModelObject().isAdvancedQueryValid(ctx)) { searchPerformed(target); } } }); searchItems.add(searchItem); searchItem = new InlineMenuItem(createStringResource("SearchPanel.debug"), new InlineMenuItemAction() { @Override public void onClick(AjaxRequestTarget target) { debugPerformed(); } }); searchItems.add(searchItem); ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, Model.ofList(searchItems)) { @Override protected void populateItem(ListItem<InlineMenuItem> item) { WebMarkupContainer menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, item.getModel()); menuItemBody.setRenderBodyOnly(true); item.add(menuItemBody); } }; searchDropdown.add(li); AjaxButton advanced = new AjaxButton(ID_ADVANCED, createAdvancedModel()) { @Override public void onClick(AjaxRequestTarget target) { advancedPerformed(target); } }; advanced.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return advancedSearch; } }); form.add(advanced); initPopover(); WebMarkupContainer advancedGroup = new WebMarkupContainer(ID_ADVANCED_GROUP); advancedGroup.add(createAdvancedVisibleBehaviour(true)); advancedGroup.add(AttributeAppender.append("class", createAdvancedGroupStyle())); advancedGroup.setOutputMarkupId(true); form.add(advancedGroup); Label advancedCheck = new Label(ID_ADVANCED_CHECK); advancedCheck.add(AttributeAppender.append("class", createAdvancedGroupLabelStyle())); advancedGroup.add(advancedCheck); final TextArea advancedArea = new TextArea(ID_ADVANCED_AREA, new PropertyModel(getModel(), Search.F_ADVANCED_QUERY)); advancedArea.add(new AjaxFormComponentUpdatingBehavior("keyup") { @Override protected void onUpdate(AjaxRequestTarget target) { updateAdvancedArea(advancedArea, target); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setThrottlingSettings( new ThrottlingSettings(ID_ADVANCED_AREA, Duration.milliseconds(500), true)); } }); advancedGroup.add(advancedArea); Label advancedError = new Label(ID_ADVANCED_ERROR, new PropertyModel<String>(getModel(), Search.F_ADVANCED_ERROR)); advancedError.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { Search search = getModelObject(); if (!search.isShowAdvanced()) { return false; } return StringUtils.isNotEmpty(search.getAdvancedError()); } }); advancedGroup.add(advancedError); }
From source file:com.evolveum.midpoint.web.security.SecurityUtils.java
License:Apache License
public static WebMarkupContainer createHiddenInputForCsrf(String id) { WebMarkupContainer field = new WebMarkupContainer(id) { @Override/*w w w. j ava2 s .com*/ public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { super.onComponentTagBody(markupStream, openTag); appendHiddenInputForCsrf(getResponse()); } }; field.setRenderBodyOnly(true); return field; }
From source file:com.swordlord.gozer.components.wicket.action.button.list.GWListFilterToolbar.java
License:Open Source License
/** * Constructor//from ww w . j a v a 2 s .c om * * @param table * data table this toolbar will be added to * @param form * the filter form * @param stateLocator * locator responsible for finding object used to store filter's state */ public GWListFilterToolbar(final DataTable<?, String> table, final FilterForm form, final IFilterStateLocator stateLocator) { super(table); add(form); if (table == null) { throw new IllegalArgumentException("argument [table] cannot be null"); } if (stateLocator == null) { throw new IllegalArgumentException("argument [stateLocator] cannot be null"); } // populate the toolbar with components provided by filtered columns RepeatingView filters = new RepeatingView("filters"); filters.setRenderBodyOnly(true); form.add(filters); Iterator<?> it = table.getColumns().iterator(); while (it.hasNext()) { WebMarkupContainer item = new WebMarkupContainer(filters.newChildId()); item.setRenderBodyOnly(true); IColumn<?, String> col = (IColumn<?, String>) it.next(); Component filter = null; if (col instanceof IFilteredColumn) { IFilteredColumn<?, String> filteredCol = (IFilteredColumn<?, String>) col; filter = filteredCol.getFilter(FILTER_COMPONENT_ID, form); } if (filter == null) { filter = new NoFilter(FILTER_COMPONENT_ID); } else { if (!filter.getId().equals(FILTER_COMPONENT_ID)) { throw new IllegalStateException( "filter component returned with an invalid component id. invalid component id [" + filter.getId() + "] required component id [" + FILTER_COMPONENT_ID + "] generating column [" + col.toString() + "] "); } } item.add(filter); filters.add(item); } }
From source file:dk.teachus.frontend.components.form.FormPanel.java
License:Apache License
public MarkupContainer addElement(FormElement element) { WebMarkupContainer elementContainer = new WebMarkupContainer(elements.newChildId()); elementContainer.setRenderBodyOnly(true); elements.add(elementContainer);//from w ww .ja va 2s . co m elementContainer.add(element); return elementContainer; }
From source file:gr.abiss.calipso.wicket.BasePanel.java
License:Open Source License
/** * <div wicket:id="velocityPanelContainer"> * <div wicket:id="velocityPanel"></div> * </div>//www. j a v a 2 s . c o m * @param tmpl * @param context * @param parseGeneratedMarkup */ protected void addVelocityTemplatePanel(WebMarkupContainer container, String containerId, String panelId, final String tmpl, HashMap<String, Object> context, final boolean parseGeneratedMarkup) { WebMarkupContainer velocityPanelContainer = new WebMarkupContainer(containerId); Panel velocityPanel; if (StringUtils.isNotBlank(tmpl)) { if (context == null) { context = new HashMap<String, Object>(); } context.put("DateUtils", DateUtils.class); //context.put("dateTool", new new org.apache.velocity.tools.generic.DateTool()); velocityPanel = new VelocityPanel(panelId, new Model(context)) { @Override protected IStringResourceStream getTemplateResource() { return new StringResourceStream(tmpl); } @Override protected boolean parseGeneratedMarkup() { return parseGeneratedMarkup; } }; } else { velocityPanel = new EmptyPanel(panelId); } velocityPanelContainer.add(velocityPanel); container.add(velocityPanelContainer.setRenderBodyOnly(true)); }
From source file:gr.abiss.calipso.wicket.DashboardNumbers.java
License:Open Source License
private void addComponents() { WebMarkupContainer dashboardNumbers = new WebMarkupContainer("DashboardNumbers"); if (number != null) { //calculate percent, if total == 0 use 0% for percent to avoid ugly NaN double dPercent = (total == null || total == 0) ? 0.0 : (double) number / total; String percent = WebUtils.formatPercentage(dPercent); //percent graph, use style="width:XXXpx;" where xxx=0...100 WebMarkupContainer loggedByMePercentImage = new WebMarkupContainer("percentImage"); loggedByMePercentImage.add(new SimpleAttributeModifier("style", "width:" + (dPercent * 100) + "px;")); //add the graph dashboardNumbers.add(loggedByMePercentImage); //add the plain number loggedByMe label dashboardNumbers.add(new Label("Number", String.valueOf(number)).setRenderBodyOnly(true)); //add the percent of loggedByMe dashboardNumbers//from ww w. j a va 2s . c o m .add(new Label("PercentNumber", new StringBuffer(" (").append(percent).append(")").toString()) .setRenderBodyOnly(true)); } else { dashboardNumbers.setVisible(false); } add(dashboardNumbers.setRenderBodyOnly(true)); }
From source file:gr.abiss.calipso.wicket.DashboardRowPanel.java
License:Open Source License
public DashboardRowPanel(String id, IBreadCrumbModel breadCrumbModel, final UserSpaceRole userSpaceRole, final Counts counts, final boolean useCurrentSpace) { super(id, breadCrumbModel); setOutputMarkupId(true);/* w w w . ja v a 2 s .c o m*/ CalipsoService calipso = getCalipso(); // needed for links like (space, assets) // TODO: holds last space final Space space = userSpaceRole.getSpaceRole().getSpace(); final User user = userSpaceRole.getUser(); //setCurrentSpace(space); boolean canViewItems = UserUtils.canViewItems(user, space); // no need to set manually the space, because it has reference MarkupContainer spaceLink = canViewItems ? new BreadCrumbLink("spaceName", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; @Override protected IBreadCrumbParticipant getParticipant(String componentId) { return new SingleSpacePanel(componentId, getBreadCrumbModel(), new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso())); } } : (MarkupContainer) new WebMarkupContainer("spaceName").setRenderBodyOnly(true); Label spaceNameLabel = new Label("spaceNameLabel", localize(space.getNameTranslationResourceKey()));//space name if (space.getDescription() != null) { spaceNameLabel.add(new SimpleAttributeModifier("title", space.getDescription()));//space description } spaceLink.add(spaceNameLabel); //if in single space, don't render name if (useCurrentSpace) { spaceLink.setVisible(false); } add(spaceLink); if (userSpaceRole.isAbleToCreateNewItem()) { add(new BreadCrumbLink("new", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { // need to added manually because the item doesn't have space reference setCurrentSpace(space); return new ItemFormPanel(componentId, getBreadCrumbModel()); } }); } else { add(new Label("new").setVisible(false)); } //TODO: For future use add(new Link("sla") { private static final long serialVersionUID = 1L; public void onClick() { setCurrentSpace(space); setResponsePage(SLAsPage.class); } }.setVisible(false)); if (UserUtils.canViewSpaceAssets(user, space, calipso)) { add(new BreadCrumbLink("asset", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { // on click current space is the this panel space setCurrentSpace(space); return new AssetSpacePanel(componentId, getBreadCrumbModel()); } }.setVisible(user.isGlobalAdmin() || user.isSpaceAdmin(space))); } else { add(new Label("asset").setVisible(false)); } if (canViewItems) { add(new BreadCrumbLink("search", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { setCurrentSpace(space); return new ItemSearchFormPanel(componentId, getBreadCrumbModel()); } }); } else { add(new Label("search").setVisible(false)); } add(new IndicatingAjaxLink("link") { public void onClick(AjaxRequestTarget target) { //mark expanded in DashboardPanel IBreadCrumbParticipant activePanel = getBreadCrumbModel().getActive(); if (activePanel instanceof DashboardPanel) { ((DashboardPanel) activePanel).markRowExpanded(userSpaceRole); } Counts tempCounts = counts; // avoid hitting the database again if re-expanding if (!tempCounts.isDetailed()) { tempCounts = getCalipso().loadCountsForUserSpace(user, space); } DashboardRowExpandedPanel dashboardRow = new DashboardRowExpandedPanel("dashboardRow", getBreadCrumbModel(), userSpaceRole, tempCounts, useCurrentSpace); dashboardRow.setOddLine(isOddLine); DashboardRowPanel.this.replaceWith(dashboardRow); target.addComponent(dashboardRow); } }.setVisible(canViewItems)); if (canViewItems) { WebMarkupContainer loggedByMeContainer; WebMarkupContainer assignedToMeContainer; WebMarkupContainer unassignedContainer; if (useCurrentSpace) {//if a space is selected loggedByMeContainer = new IndicatingAjaxLink("loggedByMe") { public void onClick(AjaxRequestTarget target) { setCurrentSpace(space); ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setLoggedBy(user); setCurrentItemSearch(itemSearch); SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive(); singleSpacePanel.refreshItemListPanel(target); } }; assignedToMeContainer = new IndicatingAjaxLink("assignedToMe") { public void onClick(AjaxRequestTarget target) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setAssignedTo(user); setCurrentItemSearch(itemSearch); SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive(); singleSpacePanel.refreshItemListPanel(target); } }; unassignedContainer = new IndicatingAjaxLink("unassigned") { public void onClick(AjaxRequestTarget target) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setUnassigned(); setCurrentItemSearch(itemSearch); SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive(); singleSpacePanel.refreshItemListPanel(target); } }; } else {//if no space is selected. i.e. for dashboard loggedByMeContainer = new BreadCrumbLink("loggedByMe", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setLoggedBy(user); setCurrentItemSearch(itemSearch); return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch); //return new ItemListPanel(componentId, getBreadCrumbModel()); } }; assignedToMeContainer = new BreadCrumbLink("assignedToMe", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setAssignedTo(user); setCurrentItemSearch(itemSearch); return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch); //return new ItemListPanel(componentId, getBreadCrumbModel()); } }; unassignedContainer = new BreadCrumbLink("unassigned", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); itemSearch.setUnassigned(); setCurrentItemSearch(itemSearch); return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch); } }; } //get Total Long total = new Long(counts.getTotal()); //add the numbers loggedByMeContainer .add(new DashboardNumbers("loggedByMeNumbers", new Long(counts.getLoggedByMe()), total)); assignedToMeContainer .add(new DashboardNumbers("assignedToMeNumbers", new Long(counts.getAssignedToMe()), total)); unassignedContainer .add(new DashboardNumbers("unassignedNumbers", new Long(counts.getUnassigned()), total)); //add the containers add(loggedByMeContainer); add(assignedToMeContainer); add(unassignedContainer); } else { add(new WebMarkupContainer("loggedByMe").setVisible(false)); add(new WebMarkupContainer("assignedToMe").setVisible(false)); add(new WebMarkupContainer("unassigned").setVisible(false)); } WebMarkupContainer totalContainer; if (useCurrentSpace) {//if a space is selected totalContainer = new IndicatingAjaxLink("total") { public void onClick(AjaxRequestTarget target) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); setCurrentItemSearch(itemSearch); SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive(); singleSpacePanel.refreshItemListPanel(target); } }; } else {//if no space is selected. i.e. for dashboard totalContainer = new BreadCrumbLink("total", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this, DashboardRowPanel.this.getCalipso()); setCurrentItemSearch(itemSearch); return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch); //return new ItemListPanel(componentId, getBreadCrumbModel()); } }; } totalContainer.add(new Label("total", new PropertyModel(counts, "total"))); add(totalContainer.setRenderBodyOnly(user.isAnonymous())); }
From source file:gr.abiss.calipso.wicket.helpMenu.HelpMenuPanel.java
License:Open Source License
private void init() { final Space space = getCurrentSpace(); final boolean hasBreadCrumbModel = getBreadCrumbModel() != null; if (space == null) { WebMarkupContainer empty = new WebMarkupContainer("availableAssetTypesListMenu"); add(new EmptyPanel("assetTypesHeadingLabel").setRenderBodyOnly(true).setVisible(false)); empty.setVisible(false);//from ww w .ja v a2 s . co m add(empty.setRenderBodyOnly(true)); add(new Label("spaceCreateLink").setVisible(false)); WebMarkupContainer spaceLink = new WebMarkupContainer("spaceLink"); spaceLink.setVisible(true); add(spaceLink); } else { if (getCalipso().isAllowedToCreateNewItem(getPrincipal(), space)) { // link to create current space if (hasBreadCrumbModel) { BreadCrumbLink spaceCreateLink = new BreadCrumbLink("spaceCreateLink", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; @Override protected IBreadCrumbParticipant getParticipant(String id) { List<IBreadCrumbParticipant> breadCrumbList = getBreadCrumbModel() .allBreadCrumbParticipants(); int siz = breadCrumbList.size(); if (breadCrumbList.get(siz - 1).equals(getBreadCrumbModel().getActive())) { breadCrumbList.remove(siz - 1); } return new ItemFormPanel(id, getBreadCrumbModel()); } }; add(spaceCreateLink); } else { Link spaceCreateLink = new Link("spaceCreateLink") { private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(ItemFormPage.class); } }; add(spaceCreateLink); } } else { add(new Label("spaceCreateLink").setVisible(false)); } if (hasBreadCrumbModel) { BreadCrumbLink spaceLink = new BreadCrumbLink("spaceLink", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; @Override protected IBreadCrumbParticipant getParticipant(String id) { List<IBreadCrumbParticipant> breadCrumbList = getBreadCrumbModel() .allBreadCrumbParticipants(); int siz = breadCrumbList.size(); if (breadCrumbList.get(siz - 1).equals(getBreadCrumbModel().getActive())) { breadCrumbList.remove(siz - 1); } ItemSearch itemSearch = new ItemSearch(getCurrentSpace(), getPrincipal(), this, HelpMenuPanel.this.getCalipso()); SingleSpacePanel singleSpacePanel = new SingleSpacePanel(id, getBreadCrumbModel(), itemSearch); return singleSpacePanel; } }; add(spaceLink.setRenderBodyOnly(getPrincipal().isAnonymous())); spaceLink.add(new Label("spaceNameLabel", localize(space.getNameTranslationResourceKey()))); } else { Link spaceLink = new Link("spaceLink") { private static final long serialVersionUID = 1L; @Override public void onClick() { setResponsePage(SpacePage.class); } }; add(spaceLink.setRenderBodyOnly(getPrincipal().isAnonymous())); spaceLink.add(new Label("spaceNameLabel", localize(space.getNameTranslationResourceKey()))); } List<AssetType> visibleAssetTypes = getCalipso().findAllAssetTypesForSpace(space); boolean showAssets = CollectionUtils.isNotEmpty(visibleAssetTypes) && !getPrincipal().isAnonymous(); RenderedClazzListView availableAssetTypesListMenu = new RenderedClazzListView( "availableAssetTypesListMenu", visibleAssetTypes); availableAssetTypesListMenu.setRenderBodyOnly(false); add(new Label("assetTypesHeadingLabel", localize("asset.assetTypes")).setVisible(showAssets)); add(availableAssetTypesListMenu.setVisible(showAssets)); // render message if no asset types exist // if(CollectionUtils.isEmpty(visibleAssetTypes) || getPrincipal().isAnonymous()){ // availableAssetTypesListMenu.setVisible(false); // add(new Label("noAssetTypes", localize("asset.no.assetTypes.exist")).setVisible(!getPrincipal().isAnonymous())); // } // else{ // add(new Label("noAssetTypes", "").setVisible(false)); // } } // searches don't depend on spaces List<SavedSearch> visibleReports = new ArrayList<SavedSearch>( getCalipso().findVisibleSearches(getPrincipal())); add(new Label("reports", localize("reports"))); if (CollectionUtils.isNotEmpty(visibleReports)) { add(new ListView("visibleSearchListView", visibleReports) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem listItem) { final SavedSearch savedSearch = (SavedSearch) listItem.getModelObject(); if (getBreadCrumbModel() != null && space != null) { BreadCrumbLink savedSearchBreadCrumbLink = new BreadCrumbLink("visbleSearchItem", getBreadCrumbModel()) { private static final long serialVersionUID = 1L; @Override protected IBreadCrumbParticipant getParticipant(String id) { //create PageParameters and ItemSearch classes PageParameters params = new PageParameters(savedSearch.getQueryString(), ","); ItemSearch itemSearch = null; try { itemSearch = ItemUtils.getItemSearch(getPrincipal(), params, this, HelpMenuPanel.this.getCalipso()); } catch (CalipsoSecurityException e) { e.printStackTrace(); } setCurrentItemSearch(itemSearch); BreadCrumbUtils.removePreviousBreadCrumbPanel(getBreadCrumbModel()); return new ItemListPanel(id, getBreadCrumbModel(), savedSearch.getName()); } }; listItem.add(savedSearchBreadCrumbLink); savedSearchBreadCrumbLink.add(new Label("visbleSearchItemLabel", savedSearch.getName())); } else { listItem.add(new EmptyPanel("visbleSearchItem").setVisible(false)); } } }); add(new Label("noReports", "").setVisible(false)); } // if there are no visible reports else { add(new EmptyPanel("visibleSearchListView").setVisible(false)); add(new Label("noReports", localize("reports.none.available"))); } }