jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Mod4j: Modeling for Java using Domain Specific Languages
  • Mod4j: Modeling for Java using Domain Specific Languages
  • MODFORJ-165

Generate SortableDataProvider's for presentationlayer

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: x.x
  • Component/s: DSL for Presentation
  • Labels:
    None
  • Number of attachments :
    0

Description

Something like:

public class SortableComestibleDataProvider extends SortableDataProvider<ComestibleDto> {

    private static final Log log = LogFactory.getLog(SortableComestibleDataProvider.class);

    @SpringBean
    private BreakfastLocalService service;

    public SortableComestibleDataProvider(BreakfastLocalService service) {
        this.service = service;

        // set default sort
        setSort("name", true);
    }

    @SuppressWarnings("unchecked")
    public Iterator iterator(int first, int count) {

        SortParam sp = getSort();
        return service.listComestibles(first, count, sp.getProperty()).iterator();
        //return service.listComestibles(first, count).iterator();
    }

    public IModel<ComestibleDto> model(ComestibleDto object) {
        final Long id = (object).getId();
        return new LoadableDetachableModel<ComestibleDto>() {

            @Override
            protected ComestibleDto load() {
                return service.readComestibleAsComestibleDto(id);
            }
        };
    }

    public int size() {
        return (int) service.countComestibles();
    }

    public void detach() {
    }

}

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity

People

  • Assignee:
    Unassigned
    Reporter:
    Johan Vogelzang
Vote (0)
Watch (0)

Dates

  • Created:
    07/Jan/10 1:00 PM
    Updated:
    14/May/10 1:00 PM
    Resolved:
    14/May/10 1:00 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.