Examples of IChoiceRenderer


Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

                list.remove(new ColumnHeading(Name.ID));
                list.remove(new ColumnHeading(Name.SPACE));
                return list;
            }
        });                
        columnChoice.setChoiceRenderer(new IChoiceRenderer() {
            public Object getDisplayValue(Object o) {
                ColumnHeading ch = (ColumnHeading) o;
                if(ch.isField()) {
                    return ch.getLabel();
                }
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

                if (options != null) {
                    keys = new ArrayList(options.keySet());
                } else {
                    keys = new ArrayList<Integer>();
                }                                               
                choiceRenderer = new IChoiceRenderer() {
                    public Object getDisplayValue(Object o) {
                        String value = options.get(o);
                        mappedDisplayValues.put(o, value);
                        return value;
                    }                   
                    public String getIdValue(Object o, int i) {
                        return o.toString();
                    }                   
                };
                choicesModel = new AbstractReadOnlyModel() {
                    public Object getObject() {
                        return keys;
                    }
                };                               
            } else { // LOGGED_BY / ASSIGNED_TO            
                choiceRenderer = new IChoiceRenderer() {
                    public Object getDisplayValue(Object o) {
                        String value = ((User) o).getName();
                        mappedDisplayValues.put(o, value);
                        return value;
                    }
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

        map.put(7, "excel_view.editRow");
        map.put(8, "excel_view.import");
       
        DropDownChoice actionChoice = new DropDownChoice("action", new ArrayList(map.keySet()));
        actionChoice.setModel(new PropertyModel(this, "action"));       
        actionChoice.setChoiceRenderer(new IChoiceRenderer() {
            public Object getDisplayValue(Object o) {               
                int i = (Integer) o;
                return localize(map.get(i));
            }
            public String getIdValue(Object o, int i) {
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

                    if (options != null) {
                        keys = new ArrayList(options.keySet());
                    } else {
                        keys = new ArrayList<String>();
                    }
                    DropDownChoice choice = new DropDownChoice("field", keys, new IChoiceRenderer() {
                        public Object getDisplayValue(Object o) {
                            return options.get(o);
                        };
                       
                        public String getIdValue(Object o, int i) {
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

                }
            });
           
            List<User> users = getJtrac().findUsersNotFullyAllocatedToSpace(spaceId);                     
           
            DropDownChoice userChoice = new DropDownChoice("user", users, new IChoiceRenderer() {
                public Object getDisplayValue(Object o) {
                    User u = (User) o;
                    return u.getName() + " (" + u.getLoginName() + ")";
                }
                public String getIdValue(Object o, int i) {
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

        final Form form = new Form("form");
        add(form);
        form.add(new FeedbackPanel("feedback"));
        form.setModel(new CompoundPropertyModel(itemSearch));
        List<Integer> sizes = Arrays.asList(new Integer[] {5, 10, 15, 25, 50, 100, -1});       
        DropDownChoice pageSizeChoice = new DropDownChoice("pageSize", sizes, new IChoiceRenderer() {
            public Object getDisplayValue(Object o) {
                return ((Integer) o) == -1 ? localize("item_search_form.noLimit") : o.toString();
            }
            public String getIdValue(Object o, int i) {
                return o.toString();
            }
        });
        form.add(pageSizeChoice);       
        form.add(new CheckBox("showHistory"));
        form.add(new Button("search") {
            @Override
            public void onSubmit() {
                String refId = itemSearch.getRefId();               
                if(refId != null) {
                    if(getCurrentSpace() != null) {
                        // user can save typing by entering the refId number without the space prefixCode
                        try {
                            long id = Long.parseLong(refId);
                            refId = getCurrentSpace().getPrefixCode() + "-" + id;
                        } catch(Exception e) {
                            // oops that didn't work, continue
                        }
                    }
                    try {
                        new ItemRefId(refId);
                    } catch(InvalidRefIdException e) {
                        form.error(localize("item_search_form.error.refId.invalid"));
                        return;
                    }
                    Item item = getJtrac().loadItemByRefId(refId);
                    if(item == null) {
                        form.error(localize("item_search_form.error.refId.notFound"));
                        return;
                    }                                     
                    JtracSession.get().setItemSearch(itemSearch);
                    setResponsePage(ItemViewPage.class, new PageParameters("0=" + item.getRefId()));
                    return;
                }
                String searchText = itemSearch.getSearchText();
                if(searchText != null) {
                    if(!getJtrac().validateTextSearchQuery(searchText)) {
                        form.error(localize("item_search_form.error.summary.invalid"));
                        return;
                    }
                }               
                setResponsePage(ItemListPage.class, itemSearch.getAsQueryString());
            }
        });
        form.add(new Link("expandAll") {
            public void onClick() {
                expandAll = true;               
            }
            @Override
            public boolean isVisible() {
                return !expandAll;
            }
        });
        form.add(new ListView("columns", itemSearch.getColumnHeadings()) {
            protected void populateItem(final ListItem listItem) {
                final ColumnHeading ch = (ColumnHeading) listItem.getModelObject();
                String label = ch.isField() ? ch.getLabel() : localize("item_list." + ch.getName());
                listItem.add(new Label("columnName", label));
                listItem.add(new CheckBox("visible", new PropertyModel(ch, "visible")));
                List<Expression> validExpressions = ch.getValidFilterExpressions();
                DropDownChoice expressionChoice = new IndicatingDropDownChoice("expression", validExpressions, new IChoiceRenderer() {
                    public Object getDisplayValue(Object o) {
                        String key = ((Expression) o).getKey();
                        return localize("item_filter." + key);
                    }
                    public String getIdValue(Object o, int i) {
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

       
        public SearchForm(String id) {
            super(id);
            setModel(new CompoundPropertyModel(this));
            List<String> searchOnOptions = Arrays.asList(new String[] {"name", "loginName", "email"});
            DropDownChoice searchOnChoice = new DropDownChoice("searchOn", searchOnOptions, new IChoiceRenderer() {
                public Object getDisplayValue(Object o) {
                    String s = (String) o;
                    if(s.equals("name")) {
                        s = "userName"; // to match i18 key
                    }
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

            WebMarkupContainer hide = new WebMarkupContainer("hide");           
            if(space.getId() > 0) {
                hide.setVisible(false);
            } else {
                List<Space> spaces = getJtrac().findAllSpaces();
                DropDownChoice choice = new DropDownChoice("copyFrom", spaces, new IChoiceRenderer() {
                    public Object getDisplayValue(Object o) {
                        return ((Space) o).getName();
                    }
                    public String getIdValue(Object o, int i) {
                        return ((Space) o).getId() + "";
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

            // pre-select the drop down for convenience
            if(typesList.size() > 0) {
                type = typesList.get(0);
            }            
           
            DropDownChoice choice = new DropDownChoice("type", typesList, new IChoiceRenderer() {
                public Object getDisplayValue(Object o) {
                    return localize("space_fields.type_" + o) + " - " + localize("space_fields.typeRemaining", types.get(o));
                }
                public String getIdValue(Object o, int i) {
                    return o.toString();
View Full Code Here

Examples of org.apache.wicket.markup.html.form.IChoiceRenderer

        add(form);       
       
        List<Space> spaces = getJtrac().findAllSpaces();       
        DropDownChoice spaceChoice = new DropDownChoice("space", spaces);
        spaceChoice.setModel(new PropertyModel(this, "space"));
        spaceChoice.setChoiceRenderer(new IChoiceRenderer() {
            public Object getDisplayValue(Object o) {
                Space s = (Space) o;
                return s.getName() + " [" + s.getPrefixCode() + "]";
            }
            public String getIdValue(Object o, int i) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.