You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by da...@pinan.co.uk on 2013/12/20 15:28:34 UTC

masthead/common component

hi Dan,

thanks for answering my question,  I am trying to write a prototype to see
if ISIS will do what I want it to do.

One the problems I would like to resolve is the issue of common components.

Assuming I am writing a system that is going to go allow students to book
courses against their name,  I have want to have a pull down box that
describes the type off courses available.  I would like to code this as a
separate control, because I may wish to add it to several different pages.

I want to do this in an OO way because I have no desire to have to copy
the same code twice or I may wish to subclass it for any number of
different reasons.

Can ISIS support this meathodology?  I have assumed that ISIS requires
page has a sort of one to one relationship with a single controller,
formed from sub times and that ISIS uses reflection to decide what type of
interface to select on the client page, e.g. a date picker in the case of
a date field?

Dave.

> > On 20 December 2013 09:38, <da...@pinan.co.uk> wrote:
> >
> >>
> >> I am thinking about using Isis to implement a web site, My website has a
> >> masthead and other common component such as a widget for taking two date
> >> fields, which I like to share across several screens.
>

My instinct is that you might find this a bit tricky (at least, if just
starting out with Isis).

As you've probably figured out, Isis is a framework that automatically
renders domain objects to the UI.  Each of the screens renders either a
single domain object, or a standalone collection returned by invoking an
action.

What I'm not sure about is what these two dates fields you want to show fit
into this?



>  >>
> >> I known that Isis supports what appears to be single style widgets, such
> >> as the gmap/excel integration, does it support multiple common
> >> components?
> >>
>

Isis Wicket viewer is quite extensible, and - by using the ComponentFactory
interface - we can change the rendering of any part of any view.  So, the
answer to your question is "probably"... but it needs to be cast in terms
of the domain objects that are being rendered.

Give us some more details, we'll see if we can work out whether Isis is a
fit for your requirements

Cheers
Dan




>  >>
> >> regards
> >>
> >>
> >> Dave.
> >>
> >>
> >
>
>
>


Re: masthead/common component

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 20 December 2013 14:28, <da...@pinan.co.uk> wrote:

>
>
> Assuming I am writing a system that is going to go allow students to book
> courses against their name,


OK, this sounds like the right sort of system for Isis.



> I have want to have a pull down box that
> describes the type off courses available.  I would like to code this as a
> separate control, because I may wish to add it to several different pages.
>
>
In general, Isis takes care of the UI widgetry/controls, so we can
certainly cater for this.

A pull-down (drop-down) list box is supported automatically for a number of
constructs.  In this case, if the available Courses are entities, and there
aren't too many of them, then simply annotate the class with @Bounded [1]:

@Bounded
public class Course { ... }

Then, whenever there is an entity with a property of type "Course", or an
action with a parameter of type "Course", then you'll get a drop-down.


Or, if there are too many Courses to list, you'll probably want to setup an
autoComplete (whereby the user enters a few characters that then filter).
 This can be done generally for the type by defining an @AutoComplete
annotation [2]:

@AutoComplete(repository=CourseRepository.class)
public class Course {... }

and then define CourseRepository as a domain service in isis.properties:

public class CourseRepository {

    public List<Course> autoComplete(String searchArg) { ... return
appropriate Courses, eg by running a JDO query ... }
}



Or, if you want more fine-grained control, you can use either the choices
or the autoComplete supporting method [3,4].  The former is when no
filtering is required:

public class Whatever {


    public Enrollment enrol(Course c) { ... }

    public List<Course> choicesEnrol() { ... return appropriate Courses... }

}


The latter is for when you some filtering is required:

public class Whatever {


    public Enrollment enrol(Course c) { ... }

    public List<Course> autoCompleteEnrol(String searchArg) { ... return
appropriate Courses... }

}



All the above is for if the drop-down is for an entity.  If the drop-down
is for a value type, then you can use the @Bounded or choices or
autoComplete; if it's an enum, then you'll get the drop-down for free.





>
>
Can ISIS support this meathodology?


Yup.  As you can see, there's no mention in any of the above of UI
controls; we just focus on the domain.



> I have assumed that ISIS requires
> page has a sort of one to one relationship with a single controller,
>

Yes, internally there is just one controller, but that is actually part of
Wicket.  From Isis' viewpoint, it's more like the MVVM pattern, where each
Isis Component is the view for an underlying view-model representing an
element of the metamodel (eg property, parameter, collection, action,
property set, collection set, entity icon, entity title etc etc)

formed from sub times and that ISIS uses reflection to decide what type of
> interface to select on the client page, e.g. a date picker in the case of
> a date field?
>
> Yes.  We pick up metadata from more than just the domain types - a notable
new addition is the ability to pick up layout hints from a JSON file [5] -
but that's the general idea.  You'll find that all LocalDates have a date
picker, for example.

Do check out the documentation, too [6]; it's a bit of a jumble, but
there's lots of goodies in there.  Studying the example todo app [7,8] and
the RRRADDD!!! tutorial app [9] referenced from [6] are probably both
worthwhile.


HTH
Dan


Dave.
>
>
[1]
http://isis.apache.org/applib-guide/reference/recognized-annotations/Bounded.html
[2]
http://isis.apache.org/applib-guide/reference/recognized-annotations/AutoComplete.html
[3]
http://isis.apache.org/applib-guide/how-tos/how-to-03-015-How-to-specify-an-autocomplete-for-a-property.html
[4]
http://isis.apache.org/applib-guide/how-tos/how-to-03-025-How-to-specify-an-autocomplete-for-an-action-parameter.html
[5] http://isis.apache.org/core/dynamic-layouts.html
[6] http://isis.apache.org/documentation.html
[7] http://isis.apache.org/getting-started/quickstart-archetype.html
[8]
https://github.com/apache/isis/blob/master/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
[9] https://github.com/danhaywood/rrraddd-isis-131


> > On 20 December 2013 09:38, <da...@pinan.co.uk> wrote:
> > >
> > >>
> > >> I am thinking about using Isis to implement a web site, My website
> has a
> > >> masthead and other common component such as a widget for taking two
> date
> > >> fields, which I like to share across several screens.
> >
>
> My instinct is that you might find this a bit tricky (at least, if just
> starting out with Isis).
>
> As you've probably figured out, Isis is a framework that automatically
> renders domain objects to the UI.  Each of the screens renders either a
> single domain object, or a standalone collection returned by invoking an
> action.
>
> What I'm not sure about is what these two dates fields you want to show fit
> into this?
>
>
>
> >  >>
> > >> I known that Isis supports what appears to be single style widgets,
> such
> > >> as the gmap/excel integration, does it support multiple common
> > >> components?
> > >>
> >
>
> Isis Wicket viewer is quite extensible, and - by using the ComponentFactory
> interface - we can change the rendering of any part of any view.  So, the
> answer to your question is "probably"... but it needs to be cast in terms
> of the domain objects that are being rendered.
>
> Give us some more details, we'll see if we can work out whether Isis is a
> fit for your requirements
>
> Cheers
> Dan
>
>
>
>
> >  >>
> > >> regards
> > >>
> > >>
> > >> Dave.
> > >>
> > >>
> > >
> >
> >
> >
>
>