Example usage for org.apache.wicket.extensions.breadcrumb BreadCrumbLink BreadCrumbLink

List of usage examples for org.apache.wicket.extensions.breadcrumb BreadCrumbLink BreadCrumbLink

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.breadcrumb BreadCrumbLink BreadCrumbLink.

Prototype

public BreadCrumbLink(final String id, final IBreadCrumbModel breadCrumbModel) 

Source Link

Document

Construct.

Usage

From source file:gr.abiss.calipso.wicket.asset.AssetsPanel.java

License:Open Source License

public AssetsPanel(String id, final IBreadCrumbModel breadCrumbModel) {
    super(id, breadCrumbModel);

    //Custom Attributes
    add(new BreadCrumbLink("customAttributes", breadCrumbModel) {
        protected IBreadCrumbParticipant getParticipant(String componentId) {
            return new AssetCustomAttributesPanel(componentId, breadCrumbModel);
        }//from w w w  .j  a v a 2s.c o  m
    });

    //Asset Types
    add(new BreadCrumbLink("assetTypes", breadCrumbModel) {
        protected IBreadCrumbParticipant getParticipant(String componentId) {
            return new AssetTypesPanel(componentId, breadCrumbModel);
        }
    });
}

From source file:gr.abiss.calipso.wicket.asset.AssetTypesListPanel.java

License:Open Source License

private void addComponents(IModel assetTypes) {

    ////////////////
    // Pagination //
    ////////////////

    PaginationPanel paginationPanel = new PaginationPanel("paginationPanel", getBreadCrumbModel(),
            this.assetTypeSearch) {
        IBreadCrumbPanelFactory breadCrumbPanelFactory = new IBreadCrumbPanelFactory() {
            public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) {
                //Remove last breadcrumb participant
                if (breadCrumbModel.allBreadCrumbParticipants().size() > 0) {
                    breadCrumbModel.allBreadCrumbParticipants()
                            .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1);
                } //if

                return new AssetTypesPanel(getBreadCrumbModel().getActive().getComponent().getId(),
                        getBreadCrumbModel(), AssetTypesListPanel.this.assetTypeSearch);
            }/*from  www.  j  a va 2s .  co  m*/
        };

        public void onNextPageClick() {
            activate(breadCrumbPanelFactory);
        }

        public void onPreviousPageClick() {
            activate(breadCrumbPanelFactory);
        }

        public void onPageNumberClick() {
            activate(breadCrumbPanelFactory);
        }
    };

    add(paginationPanel);

    /////////////////
    // List header //
    /////////////////

    List<String> columnHeaders = this.assetTypeSearch.getColumnHeaders();

    ListView headings = new ListView("headings", columnHeaders) {
        protected void populateItem(ListItem listItem) {
            final String header = (String) listItem.getModelObject();

            Link headingLink = new Link("heading") {
                public void onClick() {
                    AssetTypesListPanel.this.assetTypeSearch.doSort(header);
                }
            };
            listItem.add(headingLink);
            String label = localize("asset.assetTypes." + header);
            headingLink.add(new Label("heading", label));
            if (header.equals(AssetTypesListPanel.this.assetTypeSearch.getSortFieldName())) {
                String order = AssetTypesListPanel.this.assetTypeSearch.isSortDescending() ? "order-down"
                        : "order-up";
                listItem.add(new SimpleAttributeModifier("class", order));
            }
        }
    };

    add(headings);

    /////////////////////
    // Asset Type List //
    /////////////////////

    final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt");

    ListView listView = new ListView("assetTypeList", assetTypes) {
        protected void populateItem(ListItem listItem) {
            final AssetType assetType = (AssetType) listItem.getModelObject();

            if (selectedAssetTypeId != null && assetType.getId() == selectedAssetTypeId.longValue()) {
                listItem.add(new SimpleAttributeModifier("class", "selected"));
            } else if (listItem.getIndex() % 2 != 0) {
                listItem.add(sam);
            } //if

            // TODO: remove the getName part after ele finishes
            listItem.add(new Label("description", localize(assetType.getNameTranslationResourceKey())));

            listItem.add(new BreadCrumbLink("edit", getBreadCrumbModel()) {
                @Override
                protected IBreadCrumbParticipant getParticipant(String id) {
                    return new AssetTypeFormPagePanel(id, getBreadCrumbModel(),
                            getCalipso().loadAssetType(assetType.getId()));
                }

            });

        }//populateItem
    };//ListView      
    add(listView);
    add(new WebMarkupContainer("noData").setVisible(this.assetTypeSearch.getResultCount() == 0));
}

From source file:gr.abiss.calipso.wicket.BackLinkPanel.java

License:Open Source License

public BackLinkPanel(final String id, final IBreadCrumbModel breadCrumbModel) {
    super(id);/*  w  ww. j  av a  2 s. c o  m*/

    //if page is the root or if breadCrumbModel==null
    if (breadCrumbModel == null || breadCrumbModel.allBreadCrumbParticipants().size() < 1) {
        link = null;
        add(new WebMarkupContainer("link").setVisible(false));
        return;
    }

    //add the back link
    link = new BreadCrumbLink("link", breadCrumbModel) {
        @Override
        protected IBreadCrumbParticipant getParticipant(String componentId) {
            // the previous page
            return (IBreadCrumbParticipant) BreadCrumbUtils.backBreadCrumbPanel(breadCrumbModel);
        }
    };

    icon = new Fragment("icon", "backIcon", this);
    link.add(icon);

    //the label, default is "back"
    label = new Label("label", ComponentUtils.localize(this, "back")).setRenderBodyOnly(true);
    link.add(label);

    add(link);
}

From source file:gr.abiss.calipso.wicket.components.viewLinks.AssetViewLink.java

License:Open Source License

public AssetViewLink(String id, final IBreadCrumbModel breadCrumbModel, final Asset asset) {
    super(id, breadCrumbModel);

    if (asset == null) {
        add(new WebMarkupContainer("inventoryCode").setVisible(false));
        return;//from  w w w. j  av  a2  s . c  o m
    }

    //loggedBy link
    Label loggedByLabel = new Label("inventoryCode", asset.getInventoryCode());

    add(new BreadCrumbLink("inventoryCode", getBreadCrumbModel()) {
        protected IBreadCrumbParticipant getParticipant(String componentId) {
            return new AssetViewPanel(componentId, getBreadCrumbModel(), asset.getId());
        }
    }.add(loggedByLabel));
}

From source file:gr.abiss.calipso.wicket.components.viewLinks.OrganizationViewLink.java

License:Open Source License

public OrganizationViewLink(String id, final IBreadCrumbModel breadCrumbModel,
        final Organization organization) {
    super(id, breadCrumbModel);

    if (organization == null) {
        add(new WebMarkupContainer("organizationName").setVisible(false));
        return;/*from  w ww .j  a va 2s. c  o  m*/
    }

    //organization name label
    Label organizationNameLabel = new Label("organizationName", organization.getName());

    add(new BreadCrumbLink("organizationName", getBreadCrumbModel()) {
        protected IBreadCrumbParticipant getParticipant(String componentId) {
            return new OrganizationViewPanel(componentId, getBreadCrumbModel(), organization.getId());
        }
    }.add(organizationNameLabel));

}

From source file:gr.abiss.calipso.wicket.components.viewLinks.UserViewLink.java

License:Open Source License

public UserViewLink(String id, final IBreadCrumbModel breadCrumbModel, final User user, boolean showFirstname,
        boolean showLastname, boolean showLogin, boolean showOrganization) {
    super(id, breadCrumbModel);
    if (user == null) {
        add(new WebMarkupContainer("loggedBy").setVisible(false));
        return;/*  w ww  .j  ava  2s . com*/
    }
    StringBuffer userLabel = new StringBuffer();
    if (showFirstname) {
        userLabel.append(user.getName());
    }
    if (showLastname) {
        userLabel.append(" ").append(user.getLastname());
    }
    if (showLogin) {
        userLabel.append(" (").append(user.getLoginName()).append(")");
    }
    if (showOrganization && user.getOrganization() != null) {
        userLabel.append(", ").append(user.getOrganization().getName());
    }

    //loggedBy link
    Label loggedByLabel = new Label("loggedBy", userLabel.toString());

    if (breadCrumbModel != null) {
        add(new BreadCrumbLink("loggedBy", getBreadCrumbModel()) {
            protected IBreadCrumbParticipant getParticipant(String componentId) {
                return new UserViewPanel(componentId, getBreadCrumbModel(), user.getId());
            }
        }.add(loggedByLabel));
    } else {
        loggedByLabel.setRenderBodyOnly(true);
        add(new WebMarkupContainer("loggedBy").add(loggedByLabel));
    }
}

From source file:gr.abiss.calipso.wicket.ConfigListPanel.java

License:Open Source License

public ConfigListPanel(String id, final IBreadCrumbModel breadCrumbModel, final String selectedParam) {
    super(id, breadCrumbModel);

    this.selectedParam = selectedParam;

    final Map<String, String> configMap = getCalipso().loadAllConfig();

    List<String> params = new ArrayList(Config.getParams());

    final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt");

    add(new ListView("configs", params) {
        protected void populateItem(ListItem listItem) {
            final String param = (String) listItem.getModelObject();
            final String value = configMap.get(param);
            if (param.equals(ConfigListPanel.this.selectedParam)) {
                listItem.add(new SimpleAttributeModifier("class", "selected"));
            } else if (listItem.getIndex() % 2 == 1) {
                listItem.add(sam);/*  w w  w. ja  v a  2 s  .  c o  m*/
            }
            listItem.add(new Label("param", param));
            listItem.add(new Label("value", value));
            listItem.add(new BreadCrumbLink("link", breadCrumbModel) {
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    return new ConfigFormPanel(componentId, breadCrumbModel, param, value);
                }
            });
            listItem.add(new Label("description", localize("config." + param)));
        }
    });

    final CalipsoPropertiesEditor cpr = new CalipsoPropertiesEditor();

    add(new ListView("configs_", new ArrayList(cpr.getParams())) {
        protected void populateItem(ListItem listItem) {
            final String param = (String) listItem.getModelObject();
            final String value = cpr.getValue(param);
            if (param.equals(ConfigListPanel.this.selectedParam)) {
                listItem.add(new SimpleAttributeModifier("class", "selected"));
            } else if (listItem.getIndex() % 2 == 1) {
                listItem.add(sam);
            }
            listItem.add(new Label("param_", param));
            listItem.add(new Label("value_", value));
            listItem.add(new BreadCrumbLink("link_", breadCrumbModel) {

                private static final long serialVersionUID = 1L;

                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    return new ConfigFormPanel(componentId, breadCrumbModel, param, value, cpr);
                }
            });
            listItem.add(new Label("description_", localize("config." + param)));
        }
    });

}

From source file:gr.abiss.calipso.wicket.DashboardPanel.java

License:Open Source License

/**
 * /*from   w  ww .  j  a  v a  2s. c o m*/
 * @param id
 * @param breadCrumbModel
 * @param isSingleSpace
 */
@SuppressWarnings({ "unchecked", "serial" })
public DashboardPanel(String id, IBreadCrumbModel breadCrumbModel, final boolean isSingleSpace) {
    super(id, breadCrumbModel);
    if (!isSingleSpace) {
        setCurrentSpace(null);
    }

    final User user = getPrincipal();
    // current space???
    List<UserSpaceRole> nonGlobalSpaceRoles = new ArrayList<UserSpaceRole>(user.getSpaceRolesNoGlobal());
    logger.info("nonGlobalSpaceRoles: " + nonGlobalSpaceRoles);
    WebMarkupContainer table = new WebMarkupContainer("table");
    WebMarkupContainer message = new WebMarkupContainer("message");

    // if only one space exist for the user, and user has roles in this space
    if (isSingleSpace && nonGlobalSpaceRoles.size() > 0) {
        UserSpaceRole singleUSR = null;
        // if only one space exist then the first space is the the current space
        final Space singleSpace = getCurrentSpace();//spaceRoles.get(0).getSpaceRole().getSpace();
        //setCurrentSpace(singleSpace);
        // try to obtain a non-Guest role for user
        for (UserSpaceRole u : nonGlobalSpaceRoles) {
            u.getSpaceRole().getSpace();
            if (u.getSpaceRole().getSpace().equals(singleSpace)) {
                singleUSR = u;
                break;
            }
        }
        /* MOVED this to CalipsoServiceImpl for login
        // if no match was found for a non-guest role but space is open to guests, 
        // add the Guest role to the user
        if(singleUSR == null && singleSpace.isGuestAllowed()){
           for(SpaceRole spaceRole: singleSpace.getSpaceRoles()){
         if(spaceRole.getRoleType().getType().equals(Type.GUEST)){
            singleUSR = new UserSpaceRole(user, spaceRole);
            break;
         }
           }
           if(logger.isDebugEnabled()){
         logger.debug("Found no Roles for the user in this space but Guest is allowed, added role: "+singleUSR);
           }
        }
        */
        nonGlobalSpaceRoles = new ArrayList();
        nonGlobalSpaceRoles.add(singleUSR);

        if (singleUSR.isAbleToCreateNewItem()) {
            add(new BreadCrumbLink("new", breadCrumbModel) {
                @Override
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    return new ItemFormPanel(componentId, getBreadCrumbModel());
                }
            });
        } else {
            add(new WebMarkupContainer("new").setVisible(false));
        }

        if (singleSpace.isAssetEnabled()) {
            SpaceAssetAdminLink spaceAssetAdminLink = new SpaceAssetAdminLink("asset", getBreadCrumbModel()) {
                @Override
                public void onLinkActivate() {

                }//onLinkActivate
            };
            spaceAssetAdminLink.setVisible(user.isGlobalAdmin() || user.isSpaceAdmin(singleSpace));
            add(spaceAssetAdminLink);
        } else {
            add(new WebMarkupContainer("asset").setVisible(false));
        }

        add(new BreadCrumbLink("search", breadCrumbModel) {
            @Override
            protected IBreadCrumbParticipant getParticipant(String componentId) {
                return new ItemSearchFormPanel(componentId, getBreadCrumbModel());
            }
        });

        String spaceName = localize(getCurrentSpace().getNameTranslationResourceKey());
        //add overview title for single space           
        add(new Label("dashboardTitle", localize("dashboard.title.overview", spaceName))
                .setRenderBodyOnly(true));
        //remove space name title if single space
        table.add(new WebMarkupContainer("spaceTitle").setVisible(false));
        //add help message
        table.add(new Label("DashboardPanelHelp", localize("DashboardPanel.SingleSpace.help", spaceName))
                .setRenderBodyOnly(true));
    }
    // many spaces
    else {
        setCurrentSpace(null);
        //add overview title for dashboard spaces
        add(new Label("dashboardTitle", localize("dashboard.title.mySpaces")).setRenderBodyOnly(true));
        //add space title for dashboard spaces
        table.add(new Label("spaceTitle", localize("dashboard.space")));
        //add help message
        table.add(new Label("DashboardPanelHelp", localize("DashboardPanel.help")));
        // hide
        add(new WebMarkupContainer("new").setVisible(false));
        add(new WebMarkupContainer("asset").setVisible(false));
        add(new WebMarkupContainer("search").setVisible(false));
    }

    add(table);
    add(message);

    // TODO: this should actually present totals for public spaces.
    if (nonGlobalSpaceRoles.size() > 0) {
        // if many spaces there is no current space
        // check loggedBy,assignedTo,Unassigned counts

        final CountsHolder countsHolder = getCalipso().loadCountsForUser(user);

        WebMarkupContainer hideLogged = new WebMarkupContainer("hideLogged");
        WebMarkupContainer hideAssigned = new WebMarkupContainer("hideAssigned");
        WebMarkupContainer hideUnassigned = new WebMarkupContainer("hideUnassigned");

        if (user.getId() == 0) {
            hideLogged.setVisible(false);
            hideAssigned.setVisible(false);
            hideUnassigned.setVisible(false);
        }
        table.add(hideLogged);
        table.add(hideAssigned);
        table.add(hideUnassigned);

        TreeSet<UserSpaceRole> sortedBySpaceCode = new TreeSet<UserSpaceRole>(new UserSpaceRoleComparator());
        sortedBySpaceCode.addAll(nonGlobalSpaceRoles);
        List<UserSpaceRole> sortedBySpaceCodeList = new ArrayList<UserSpaceRole>(sortedBySpaceCode.size());
        sortedBySpaceCodeList.addAll(sortedBySpaceCode);
        table.add(new ListView<UserSpaceRole>("dashboardRows", sortedBySpaceCodeList) {
            @Override
            protected void populateItem(final ListItem listItem) {
                UserSpaceRole userSpaceRole = (UserSpaceRole) listItem.getModelObject();
                // TODO: this should happen onclick
                //logger.info("populateItem, userSpaceRole.getSpaceRole().getSpace(): "+userSpaceRole.getSpaceRole().getSpace());
                Counts counts = countsHolder.getCounts().get(userSpaceRole.getSpaceRole().getSpace().getId());
                if (counts == null) {
                    counts = new Counts(false); // this can happen if fresh space
                }

                boolean isOddLine;
                if (listItem.getIndex() % 2 == 1) {
                    isOddLine = true;
                } else {
                    isOddLine = false;
                }

                MarkupContainer dashboardRow;

                //if single space, render expanded row
                if ((isSingleSpace && getCurrentSpace() != null) || isRowExpanded(userSpaceRole)) {
                    if (!counts.isDetailed()) {
                        counts = getCalipso().loadCountsForUserSpace(user,
                                userSpaceRole.getSpaceRole().getSpace());
                    }
                    dashboardRow = new DashboardRowExpandedPanel("dashboardRow", getBreadCrumbModel(),
                            userSpaceRole, counts, isSingleSpace).setOddLine(isOddLine);
                } else {
                    dashboardRow = new DashboardRowPanel("dashboardRow", getBreadCrumbModel(), userSpaceRole,
                            counts, isSingleSpace).setOddLine(isOddLine);
                }
                listItem.add(dashboardRow);
            }
        });

        //   SimpleAttributeModifier colSpan = new SimpleAttributeModifier("colspan", user.isAdminForAllSpaces()?"3":"2");

        SimpleAttributeModifier colSpan = new SimpleAttributeModifier("colspan", "3");
        Label hAction = new Label("hAction", localize("dashboard.action"));
        hAction.add(colSpan);
        table.add(hAction);

        // TODO panelize totals row and reduce redundant code
        WebMarkupContainer total = new WebMarkupContainer("total");
        total.add(new Label("allSpaces", localize("item_search_form.allSpaces")).setRenderBodyOnly(true)
                .setVisible(!user.isAnonymous()));

        if (nonGlobalSpaceRoles.size() > 1) {
            Label hTotal = new Label("hTotal");
            hTotal.add(colSpan);
            total.add(hTotal);
            total.add(new BreadCrumbLink("search", getBreadCrumbModel()) {
                @Override
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    return new ItemSearchFormPanel(componentId, getBreadCrumbModel());
                }

            }.setVisible(!user.isAnonymous()));

            if (user.getId() > 0) {
                total.add(new BreadCrumbLink("loggedByMe", breadCrumbModel) {
                    @Override
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        ItemSearch itemSearch = new ItemSearch(user, DashboardPanel.this);
                        itemSearch.setLoggedBy(user);
                        setCurrentItemSearch(itemSearch);

                        return new ItemListPanel(componentId, getBreadCrumbModel());
                    }
                }.add(new Label("loggedByMe", new PropertyModel(countsHolder, "totalLoggedByMe"))));

                total.add(new BreadCrumbLink("assignedToMe", breadCrumbModel) {
                    @Override
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        ItemSearch itemSearch = new ItemSearch(user, DashboardPanel.this);
                        itemSearch.setAssignedTo(user);
                        setCurrentItemSearch(itemSearch);

                        return new ItemListPanel(componentId, getBreadCrumbModel());
                    }
                }.add(new Label("assignedToMe", new PropertyModel(countsHolder, "totalAssignedToMe"))));

                total.add(new BreadCrumbLink("unassigned", breadCrumbModel) {
                    @Override
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        ItemSearch itemSearch = new ItemSearch(user, DashboardPanel.this);
                        itemSearch.setUnassigned();
                        setCurrentItemSearch(itemSearch);

                        return new ItemListPanel(componentId, getBreadCrumbModel());
                    }
                }.add(new Label("unassigned", new PropertyModel(countsHolder, "totalUnassigned"))));

            } else {
                total.add(new WebMarkupContainer("loggedByMe").setVisible(false));
                total.add(new WebMarkupContainer("assignedToMe").setVisible(false));
                total.add(new WebMarkupContainer("unassigned").setVisible(false));
            }

            total.add(new BreadCrumbLink("total", breadCrumbModel) {
                @Override
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    ItemSearch itemSearch = new ItemSearch(user, DashboardPanel.this);
                    setCurrentItemSearch(itemSearch);

                    return new ItemListPanel(componentId, getBreadCrumbModel());
                }
            }.add(new Label("total", new PropertyModel(countsHolder, "totalTotal")))
                    .setVisible(!user.isAnonymous()));

        } else {
            total.setVisible(false);
        }
        table.add(total/*.setVisible(!user.isAnonymous())*/);
        message.setVisible(false);
    } else {
        table.setVisible(false);
    }

}

From source file:gr.abiss.calipso.wicket.DashboardRowExpandedPanel.java

License:Open Source License

public DashboardRowExpandedPanel(String id, IBreadCrumbModel breadCrumbModel, final UserSpaceRole userSpaceRole,
        final Counts counts, final boolean isSingleSpace) {
    super(id, breadCrumbModel);

    setOutputMarkupId(true);// w  w w .  j  ava2  s  .c  om
    setCurrentSpace(userSpaceRole.getSpaceRole().getSpace());
    final Space space = getCurrentSpace();
    refreshParentMenu(breadCrumbModel);

    final User user = userSpaceRole.getUser();

    final Map<Integer, String> states = new TreeMap(space.getMetadata().getStatesMap());
    states.remove(State.NEW);
    int rowspan = states.size() + 1; // add one totals row also

    int totalUnassignedItems = getCalipso().loadCountUnassignedItemsForSpace(space);

    if (totalUnassignedItems > 0) {
        rowspan++; //for unassiged items
    }

    final SimpleAttributeModifier sam = new SimpleAttributeModifier("rowspan", rowspan + "");
    final SimpleAttributeModifier altClass = new SimpleAttributeModifier("class", "alt");
    List<Integer> stateKeys = new ArrayList<Integer>(states.keySet());

    add(new ListView("rows", stateKeys) {

        protected void populateItem(ListItem listItem) {
            if (listItem.getIndex() % 2 == 1) {
                listItem.add(altClass);
            }
            if (listItem.getIndex() == 0) { // rowspan output only for first row                        
                BreadCrumbLink spaceLink = new BreadCrumbLink("spaceName", getBreadCrumbModel()) {
                    @Override
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                DashboardRowExpandedPanel.this.getCalipso());
                        return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                    }
                };

                spaceLink.add(new Label("spaceName", localize(space.getNameTranslationResourceKey())));
                spaceLink.add(sam);

                //if in single space, don't render name
                if (isSingleSpace) {
                    spaceLink.setVisible(false);
                }

                listItem.add(spaceLink);

                WebMarkupContainer newColumn = new WebMarkupContainer("new");
                newColumn.add(sam);
                listItem.add(newColumn);

                if (userSpaceRole.isAbleToCreateNewItem()) {
                    newColumn.add(new BreadCrumbLink("new", getBreadCrumbModel()) {
                        protected IBreadCrumbParticipant getParticipant(String componentId) {
                            return new ItemFormPanel(componentId, getBreadCrumbModel());
                        }
                    });
                } else {
                    newColumn.add(new WebMarkupContainer("new").setVisible(false));
                }

                //TODO: For future use
                WebMarkupContainer slaColumn = new WebMarkupContainer("sla");
                slaColumn.add(sam);

                slaColumn.add(new Link("sla") {
                    public void onClick() {
                        setResponsePage(SLAsPage.class);
                    }
                });

                listItem.add(slaColumn.setVisible(false));

                //Asset
                WebMarkupContainer assetColumn = new WebMarkupContainer("asset");
                assetColumn.add(sam);
                listItem.add(assetColumn);

                if (space.isAssetEnabled() && (user.isGlobalAdmin() || user.isSpaceAdmin(space))) {
                    assetColumn.add(new BreadCrumbLink("asset", getBreadCrumbModel()) {
                        protected IBreadCrumbParticipant getParticipant(String componentId) {
                            return new AssetSpacePanel(componentId, getBreadCrumbModel());
                        }
                    }.setVisible(user.isGlobalAdmin() || user.isSpaceAdmin(space)));

                } else {
                    assetColumn.add(new WebMarkupContainer("asset").setVisible(false));
                }

                listItem.add(new BreadCrumbLink("search", getBreadCrumbModel()) {
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        return new ItemSearchFormPanel(componentId, getBreadCrumbModel());
                    }
                }.add(sam));

                WebMarkupContainer link = new WebMarkupContainer("link");
                link.add(sam);
                listItem.add(link);

                //if in single space, don't render expand/contract link
                if (isSingleSpace) {
                    link.add(new WebMarkupContainer("link").setVisible(false));
                } else {
                    link.add(new IndicatingAjaxLink("link") {
                        public void onClick(AjaxRequestTarget target) {
                            //mark contracted in DashboardPanel
                            IBreadCrumbParticipant activePanel = getBreadCrumbModel().getActive();
                            if (activePanel instanceof DashboardPanel) {
                                ((DashboardPanel) activePanel).unmarkRowExpanded(userSpaceRole);
                            }

                            DashboardRowPanel dashboardRow = new DashboardRowPanel("dashboardRow",
                                    getBreadCrumbModel(), userSpaceRole, counts, isSingleSpace)
                                            .setOddLine(isOddLine);
                            DashboardRowExpandedPanel.this.replaceWith(dashboardRow);
                            target.addComponent(dashboardRow);
                        }
                    });
                }

            } else {
                listItem.add(new WebMarkupContainer("spaceName").add(new WebMarkupContainer("spaceName"))
                        .setVisible(false));
                listItem.add(new WebMarkupContainer("new").setVisible(false));
                listItem.add(new WebMarkupContainer("sla").setVisible(false));
                listItem.add(new WebMarkupContainer("asset").setVisible(false));
                listItem.add(new WebMarkupContainer("search").setVisible(false));
                listItem.add(
                        new WebMarkupContainer("link").add(new WebMarkupContainer("link")).setVisible(false));
            }

            final Integer i = (Integer) listItem.getModelObject();
            listItem.add(new Label("status", states.get(i)));

            if (user.getId() > 0) {
                WebMarkupContainer loggedByMeContainer;
                WebMarkupContainer assignedToMeContainer;
                WebMarkupContainer unassignedContainer;

                if (isSingleSpace) {//if a space is selected
                    loggedByMeContainer = new IndicatingAjaxLink("loggedByMe") {
                        public void onClick(AjaxRequestTarget target) {
                            ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setLoggedBy(user);
                            itemSearch.setStatus(i);
                            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,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setAssignedTo(user);
                            itemSearch.setStatus(i);
                            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,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setUnassigned();
                            itemSearch.setStatus(i);
                            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()) {
                        protected IBreadCrumbParticipant getParticipant(String componentId) {
                            ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setLoggedBy(user);
                            itemSearch.setStatus(i);
                            setCurrentItemSearch(itemSearch);

                            return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                            //return new ItemListPanel(componentId, getBreadCrumbModel());
                        }
                    };

                    assignedToMeContainer = new BreadCrumbLink("assignedToMe", getBreadCrumbModel()) {
                        protected IBreadCrumbParticipant getParticipant(String componentId) {
                            ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setAssignedTo(user);
                            itemSearch.setStatus(i);
                            setCurrentItemSearch(itemSearch);

                            return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                        }
                    };

                    unassignedContainer = new BreadCrumbLink("unassigned", getBreadCrumbModel()) {
                        protected IBreadCrumbParticipant getParticipant(String componentId) {
                            ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                    DashboardRowExpandedPanel.this.getCalipso());
                            itemSearch.setUnassigned();
                            itemSearch.setStatus(i);
                            setCurrentItemSearch(itemSearch);

                            return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                        }
                    };
                }

                //get numbers for loggedByMe and assignedToMe
                Long total = counts.getTotalForState(i);

                //add the numbers
                loggedByMeContainer
                        .add(new DashboardNumbers("loggedByMeNumbers", counts.getLoggedByMeForState(i), total));
                assignedToMeContainer.add(
                        new DashboardNumbers("assignedToMeNumbers", counts.getAssignedToMeForState(i), total));
                unassignedContainer
                        .add(new DashboardNumbers("unassignedNumbers", counts.getUnassignedForState(i), total));

                //add the containers
                listItem.add(loggedByMeContainer);
                listItem.add(assignedToMeContainer);
                listItem.add(unassignedContainer);
            } else {
                listItem.add(new WebMarkupContainer("loggedByMe").setVisible(false));
                listItem.add(new WebMarkupContainer("assignedToMe").setVisible(false));
                listItem.add(new WebMarkupContainer("unassigned").setVisible(false));
            }

            WebMarkupContainer totalContainer;
            if (isSingleSpace) {//if a space is selected
                totalContainer = new IndicatingAjaxLink("total") {
                    public void onClick(AjaxRequestTarget target) {
                        ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                DashboardRowExpandedPanel.this.getCalipso());
                        itemSearch.setStatus(i);
                        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()) {
                    protected IBreadCrumbParticipant getParticipant(String componentId) {
                        ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                                DashboardRowExpandedPanel.this.getCalipso());
                        itemSearch.setStatus(i);
                        setCurrentItemSearch(itemSearch);

                        return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                        //return new ItemListPanel(componentId, getBreadCrumbModel());
                    }
                };
            }

            Long total = counts.getTotalForState(i);
            totalContainer.add(new Label("total", total == null ? "" : total.toString()));
            listItem.add(totalContainer);
        }
    });

    // sub totals ==========================================================        

    if (user.getId() > 0) {
        WebMarkupContainer loggedByMeTotalContainer;
        WebMarkupContainer assignedToMeTotalContainer;
        WebMarkupContainer unassignedTotalContainer;

        if (isSingleSpace) {//if a space is selected
            loggedByMeTotalContainer = new IndicatingAjaxLink("loggedByMeTotal") {
                public void onClick(AjaxRequestTarget target) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setLoggedBy(user);
                    setCurrentItemSearch(itemSearch);

                    SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive();
                    singleSpacePanel.refreshItemListPanel(target);
                }
            };

            assignedToMeTotalContainer = new IndicatingAjaxLink("assignedToMeTotal") {
                public void onClick(AjaxRequestTarget target) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setAssignedTo(user);
                    setCurrentItemSearch(itemSearch);

                    SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive();
                    singleSpacePanel.refreshItemListPanel(target);
                }
            };

            unassignedTotalContainer = new IndicatingAjaxLink("unassignedTotal") {
                public void onClick(AjaxRequestTarget target) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setUnassigned();
                    setCurrentItemSearch(itemSearch);

                    SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive();
                    singleSpacePanel.refreshItemListPanel(target);
                }
            };
        } else {//if no space is selected. i.e. for dashboard
            loggedByMeTotalContainer = new BreadCrumbLink("loggedByMeTotal", getBreadCrumbModel()) {
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setLoggedBy(user);
                    setCurrentItemSearch(itemSearch);

                    return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                    //return new ItemListPanel(componentId, getBreadCrumbModel());
                }
            };

            assignedToMeTotalContainer = new BreadCrumbLink("assignedToMeTotal", getBreadCrumbModel()) {
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setAssignedTo(user);
                    setCurrentItemSearch(itemSearch);

                    return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                    //return new ItemListPanel(componentId, getBreadCrumbModel());
                }
            };

            unassignedTotalContainer = new BreadCrumbLink("unassignedTotal", getBreadCrumbModel()) {
                protected IBreadCrumbParticipant getParticipant(String componentId) {
                    ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                            DashboardRowExpandedPanel.this.getCalipso());
                    itemSearch.setUnassigned();
                    setCurrentItemSearch(itemSearch);

                    return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                }
            };
        }

        //get total
        Long total = new Long(counts.getTotal());

        //add the numbers           
        loggedByMeTotalContainer
                .add(new DashboardNumbers("loggedByMeNumbers", new Long(counts.getLoggedByMe()), total));
        assignedToMeTotalContainer
                .add(new DashboardNumbers("assignedToMeNumbers", new Long(counts.getAssignedToMe()), total));
        unassignedTotalContainer
                .add(new DashboardNumbers("unassignedNumbers", new Long(counts.getUnassigned()), total));

        //add the containers
        add(loggedByMeTotalContainer);
        add(assignedToMeTotalContainer);
        add(unassignedTotalContainer);
    } else {
        add(new WebMarkupContainer("loggedByMeTotal").setVisible(false));
        add(new WebMarkupContainer("assignedToMeTotal").setVisible(false));
        add(new WebMarkupContainer("unassignedTotal").setVisible(false));
    }

    WebMarkupContainer totalTotalContainer;
    if (isSingleSpace) {//if a space is selected
        totalTotalContainer = new IndicatingAjaxLink("totalTotal") {
            public void onClick(AjaxRequestTarget target) {
                ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                        DashboardRowExpandedPanel.this.getCalipso());
                setCurrentItemSearch(itemSearch);

                SingleSpacePanel singleSpacePanel = (SingleSpacePanel) getBreadCrumbModel().getActive();
                singleSpacePanel.refreshItemListPanel(target);
            }
        };
    } else {//if no space is selected. i.e. for dashboard
        totalTotalContainer = new BreadCrumbLink("totalTotal", getBreadCrumbModel()) {
            protected IBreadCrumbParticipant getParticipant(String componentId) {
                ItemSearch itemSearch = new ItemSearch(space, getPrincipal(), this,
                        DashboardRowExpandedPanel.this.getCalipso());
                setCurrentItemSearch(itemSearch);

                return new SingleSpacePanel(componentId, getBreadCrumbModel(), itemSearch);
                //return new ItemListPanel(componentId, getBreadCrumbModel());
            }
        };
    }

    totalTotalContainer.add(new Label("total", new PropertyModel(counts, "total")));
    add(totalTotalContainer);
}

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);/*from w  ww. j  a v a 2s .  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()));
}