Package info.jtrac.domain

Examples of info.jtrac.domain.ItemSearch


        add(new Link("relate") {
            public void onClick() {
                /*
                 * TODO choose specific space for search
                 */
                ItemSearch itemSearch = new ItemSearch(getPrincipal());
                itemSearch.setRelatingItemRefId(item.getRefId());
                setResponsePage(new ItemSearchFormPage(itemSearch));
            }
        }.setVisible(!hideLinks));
       
        if (item.getRelatedItems() != null) {
View Full Code Here


        return root;
    }       
   
    public static ItemSearch getItemSearch(User user, PageParameters params, Jtrac jtrac) throws JtracSecurityException {
        long spaceId = params.getLong("s", -1);       
        ItemSearch itemSearch = null;
        if(spaceId > 0) {           
            Space space = jtrac.loadSpace(spaceId);
            if(!user.isAllocatedToSpace(space.getId())) {
                throw new JtracSecurityException("User not allocated to space: " + spaceId + " in URL: " + params);
            }
            itemSearch = new ItemSearch(space);           
        } else {
            itemSearch = new ItemSearch(user);
        }
        itemSearch.initFromPageParameters(params, user, jtrac);
        return itemSearch;       
    }
View Full Code Here

                    String line1 = localize("item_delete.line1");
                    ConfirmPage confirm = new ConfirmPage(ItemFormPage.this, heading, warning, new String[] { line1 }) {
                        public void onConfirm() {
                            // avoid lazy init problem
                            getJtrac().removeItem(getJtrac().loadItem(item.getId()));
                            ItemSearch itemSearch = JtracSession.get().getItemSearch();
                            if (itemSearch != null) {
                                setResponsePage(new ItemListPage(itemSearch));
                            } else {
                                setResponsePage(DashboardPage.class);
                            }
View Full Code Here

                    }

                    listItem.add(new Link("search") {
                        public void onClick() {
                            setCurrentSpace(space);
                            ItemSearch itemSearch = new ItemSearch(space);
                            setResponsePage(ItemSearchFormPage.class, itemSearch.getAsQueryString());
                        }
                    }.add(sam));

                    listItem.add(new IndicatingAjaxLink("link") {
                        public void onClick(AjaxRequestTarget target) {
                            DashboardRowPanel dashboardRow = new DashboardRowPanel("dashboardRow", usr, counts);
                            DashboardRowExpandedPanel.this.replaceWith(dashboardRow);
                            target.addComponent(dashboardRow);
                        }
                    }.add(sam));
                   
                } else {
                    listItem.add(new WebMarkupContainer("space").setVisible(false));
                    listItem.add(new WebMarkupContainer("new").setVisible(false));
                    listItem.add(new WebMarkupContainer("search").setVisible(false));
                    listItem.add(new WebMarkupContainer("link").setVisible(false));
                }
               
                final Integer i = (Integer) listItem.getModelObject();
                listItem.add(new Label("status", states.get(i)));
               
                if(user.getId() > 0) {               
                    listItem.add(new Link("loggedByMe") {
                        public void onClick() {
                            setCurrentSpace(space);
                            ItemSearch itemSearch = new ItemSearch(space);
                            itemSearch.setLoggedBy(user);
                            itemSearch.setStatus(i);                           
                            setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
                        }
                    }.add(new Label("loggedByMe", counts.getLoggedByMeForState(i))));

                    listItem.add(new Link("assignedToMe") {
                        public void onClick() {
                            setCurrentSpace(space);
                            ItemSearch itemSearch = new ItemSearch(space);
                            itemSearch.setAssignedTo(user);
                            itemSearch.setStatus(i);                           
                            setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
                        }
                    }.add(new Label("assignedToMe", counts.getAssignedToMeForState(i))));
                } else {
                    listItem.add(new WebMarkupContainer("loggedByMe").setVisible(false));
                    listItem.add(new WebMarkupContainer("assignedToMe").setVisible(false));                   
                }
               
                listItem.add(new Link("total") {
                    public void onClick() {
                        setCurrentSpace(space);
                        ItemSearch itemSearch = new ItemSearch(space);                       
                        itemSearch.setStatus(i);                       
                        setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
                    }
                }.add(new Label("total", counts.getTotalForState(i))));               
            }
           
        });
       
        // sub totals ==========================================================
       
        if(user.getId() > 0) {       
            add(new Link("loggedByMeTotal") {
                public void onClick() {
                    setCurrentSpace(space);
                    ItemSearch itemSearch = new ItemSearch(space);
                    itemSearch.setLoggedBy(user);                   
                    setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());                                       
                }
            }.add(new Label("loggedByMe", new PropertyModel(counts, "loggedByMe"))));

            add(new Link("assignedToMeTotal") {
                public void onClick() {
                    setCurrentSpace(space);
                    ItemSearch itemSearch = new ItemSearch(space);
                    itemSearch.setAssignedTo(user);                   
                    setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
                }
            }.add(new Label("assignedToMe", new PropertyModel(counts, "assignedToMe"))));
        } else {
            add(new WebMarkupContainer("loggedByMeTotal").setVisible(false));
            add(new WebMarkupContainer("assignedToMeTotal").setVisible(false));              
        }
       
        add(new Link("totalTotal") {
            public void onClick() {
                setCurrentSpace(space);
                ItemSearch itemSearch = new ItemSearch(space);               
                setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());               
            }
        }.add(new Label("total", new PropertyModel(counts, "total"))));
       
    }
View Full Code Here

        ValueMap map = new ValueMap();
        RequestUtils.decodeParameters(queryString, map);
        logger.debug("decoded: " + map);
        User user = (User) request.getAttribute("user");
        PageParameters params = new PageParameters(map);
        ItemSearch itemSearch = ItemUtils.getItemSearch(user, params, jtrac);       
        initXmlResponse(response);
        ItemUtils.writeAsXml(itemSearch, jtrac, response.getWriter());
    }
View Full Code Here

* item search form page
*/
public class ItemSearchFormPage extends BasePage {
           
    public ItemSearchFormPage() {
        ItemSearch itemSearch = null;
        Space s = getCurrentSpace();
        if(s == null) {
            itemSearch = new ItemSearch(JtracSession.get().getUser());
        } else {
            itemSearch = new ItemSearch(s);
        }
        addComponents(itemSearch);
    }
View Full Code Here

* item list page
*/
public class ItemListPage extends BasePage {              
       
    public ItemListPage(PageParameters params) throws JtracSecurityException {
        ItemSearch itemSearch = ItemUtils.getItemSearch(getPrincipal(), params, getJtrac());
        JtracSession.get().setItemSearch(itemSearch);
        addComponents(itemSearch);
   
View Full Code Here

    private ItemSearch itemSearch;
    private boolean expandAll;
   
    public ItemSearchFormPanel(String id, User user) {
        super(id);
        this.itemSearch = new ItemSearch(user);
        addComponents();
    }
View Full Code Here

   
    public ItemSearchFormPanel(String id) {
        super(id);
        Space s = getCurrentSpace();
        if(s != null) {
            this.itemSearch = new ItemSearch(s);
        } else {
            this.itemSearch = new ItemSearch(getPrincipal());
        }
        addComponents();
    }
View Full Code Here

        itemId = item.getId(); // required for itemRelatePanel
        addComponents(item);
   
   
    private void addComponents(final Item item) { 
        final ItemSearch itemSearch = JtracSession.get().getItemSearch();
        add(new ItemRelatePanel("relate", true, itemSearch));       
        Link link = new Link("back") {
            public void onClick() {
                itemSearch.setSelectedItemId(item.getId());
                if(itemSearch.getRefId() != null) {
                     // user had entered item id directly, go back to search page
                     setResponsePage(new ItemSearchFormPage(itemSearch));
                } else {
                     setResponsePage(new ItemListPage(itemSearch));
                }
            }
        };
        if(itemSearch == null) {
            link.setVisible(false);
        }
       
        add(link);
       
        boolean isRelate = itemSearch != null && itemSearch.getRelatingItemRefId() != null;
       
        User user = getPrincipal();
       
        if(!user.isAllocatedToSpace(item.getSpace().getId())) {
            logger.debug("user is not allocated to space");
View Full Code Here

TOP

Related Classes of info.jtrac.domain.ItemSearch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.