Hello everyone!

Summary:

I am trying to use an automatically created drop down in my appache isis project. For this purpose I added the following annotation to the respective class.

@DomainObject(bounded = true)

, according to the fundamentals guide. [1]

The dropdown works fine, but only on the second try of using it.


My Domain:

My domain contains Rooms and Workspaces which are related bidirectional, mandatory and 1:m, i.e. a Room can have many Workspaces and every Workspace must belong to exactly one room. I followed the Apache Isis' DataNucleus-Guide to set up the relation. [2]

At the creation of a new Workspace the user has to define the room that the Workspace belongs to. Here is where the mistake occurs:


The Bug:

When i click on the room field, the dropdown menu is displayed at the upper right corner of the page (instead of right below the field). I can click one of the rooms, but it does not get selected (i.e. the room name is not displayed in the field of the "create"-window). When I click again, everything works fine: the dropdown is displayed right below the field and when I select an entry it is displayed in the field.

I would like to have this behaviour at the first click, of course.

I also noticed that the issue occurs only if the previous field is still active (shown by the tiny blue frame). So it is enought to click next to the fields once and afterwards the correct dropdown is displayed.


Thanks in advance for any advice!

Franziska

-----------------------------------------

Links:

[1] https://isis.apache.org/guides/ugfun/ugfun.html#_ugfun_programming-model_actions (5.5.2. bottom)

[2] https://isis.apache.org/guides/ugodn/ugodn.html#_ugodn_jdo-mappings_1-to-m-bidirectional-relationships (3.1.1.)

------------------------------------------

Code:

Room.java

//other annotations @DomainObject(bounded =true)// objectType inferred from 
@PersistenceCapable#schema public class Roomimplements Comparable<Room> {

    //...constructor, other member variables@Persistent(mappedBy ="room", 
dependentElement ="false")
    @Getter @Setter @Collection()
   private SortedSet<Workspace>workspaces =new TreeSet<Workspace>(); //region > 
transfer public Roomtransfer(final Workspace workspace){
      workspace.setRoom(this); return this; }
   //endregion //...other methods }


Workspace.java

//other annotations
@DomainObject()
public class Workspaceimplements Comparable<Workspace> {

    //...constructor, other member variables
@Column(allowsNull ="false")
    @Property()
    @Getter @Setter private Roomroom;
//...other methods
}


 create() in WorkspaceMenu.java

@DomainService(
        nature = NatureOfService.VIEW_MENU_ONLY, objectType 
="room.WorkspaceMenu", repositoryFor = Workspace.class )
//DomainServiceLayout(...)
public class WorkspaceMenu {

   // listAll, findBy, createDomainEvent...

    @Action(domainEvent = CreateDomainEvent.class)
    @MemberOrder(sequence ="3")
    public Workspacecreate(
            @ParameterLayout(named="WorkspaceId")
            final String workspaceId, final Room roomNo) {
        return workspaceObjectRepository.create(workspaceId, roomNo); }


    @javax.inject.Inject WorkspaceRepositoryworkspaceObjectRepository; }

 create() in WorkspaceRepository.java

@DomainService(
        nature = NatureOfService.DOMAIN, repositoryFor = Workspace.class )
public class WorkspaceRepository {
    // listAll, findBy..

    public Workspacecreate(final String workspaceId, final Room room) {
        final Workspace object =new Workspace(workspaceId); 
object.setRoom(room); serviceRegistry.injectServicesInto(object); 
repositoryService.persist(object); return object; }

    @javax.inject.Inject RepositoryServicerepositoryService; 
@javax.inject.Inject ServiceRegistry2serviceRegistry; }

Reply via email to