You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Dan Haywood (JIRA)" <ji...@apache.org> on 2014/02/06 15:44:11 UTC

[jira] [Commented] (ISIS-691) In Wicket viewer, improve drop-down list's handling of null entity or values

    [ https://issues.apache.org/jira/browse/ISIS-691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13893391#comment-13893391 ] 

Dan Haywood commented on ISIS-691:
----------------------------------

Looking at the existing implementation, it seems that there is a 'clear' link for entities (EntityLinkSelect2Panel), but nothing similar for values (ValueChoicesSelectPanel).

Experimenting in adding a null to the list of choices (for values), this seems to work (with appropriate null guards added as required).

Experimenting further in "back-porting" this for entities, also works ok.

Can therefore get rid of the "clear" link so is same UI experience.

~~~
In addition, the choices provider (that provides the set of values to the drop-down select2 field) can transparently add in the null value if required (based on the semantics of the underlying ScalarModel).

> In Wicket viewer, improve drop-down list's handling of null entity or values
> ----------------------------------------------------------------------------
>
>                 Key: ISIS-691
>                 URL: https://issues.apache.org/jira/browse/ISIS-691
>             Project: Isis
>          Issue Type: Bug
>          Components: Viewer: Wicket
>    Affects Versions: viewer-wicket-1.3.1
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>             Fix For: viewer-wicket-1.4.0
>
>
> Several issues:
> 1.  for entities, if the reference is null, the drop-down (EntityLinkSelect2Panel) always shows the first object in edit mode
> 2.  for value types (eg enums), it is not possible to set a null value (!)
> ~~~
> To replicate (1) add the following property to the simple archetype's SimpleObject class:
>     // //////////////////////////////////////
>     // other (property)
>     // //////////////////////////////////////
>     private SimpleObject other;
>     @Column(allowsNull="true")
>     @MemberOrder(sequence = "1")
>     // @Mandatory
>     public SimpleObject getOther() {
>         return other;
>     }
>     public void setOther(final SimpleObject other) {
>         this.other = other;
>     }
>     public List<SimpleObject> choicesOther() {
>         List<SimpleObject> list = container.allInstances(SimpleObject.class);
>         return list;
>     }
> ~~~
> To replicate (2), 
> ToDoItem
>     @javax.jdo.annotations.Column(allowsNull="true")
>     public Subcategory getSubcategory() {
> and 
> ToDoItemContributions
>     public ToDoItem updateCategory(
>             final ToDoItem item, 
>             final @Named("Category") Category category,
>             final @Optional @Named("Subcategory") Subcategory subcategory) {
>         ...
>     }
> and
>     public static enum Category {
>         Professional {
>             @Override
>             public List<Subcategory> subcategories() {
>                 return Arrays.asList(null, Subcategory.OpenSource, Subcategory.Consulting, Subcategory.Education);
>             }
>         }, Domestic {
>             @Override
>             public List<Subcategory> subcategories() {
>                 return Arrays.asList(null, Subcategory.Shopping, Subcategory.Housework, Subcategory.Garden, Subcategory.Chores);
>             }
>         }, Other {
>             @Override
>             public List<Subcategory> subcategories() {
>                 return Arrays.asList(null, Subcategory.Other);
>             }
>         };
>         
>         public abstract List<Subcategory> subcategories();
>     }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)