Andi Huber created ISIS-1971:
--------------------------------

             Summary: JAXB view model: setting view's properties via 
PostConstruct method not honored
                 Key: ISIS-1971
                 URL: https://issues.apache.org/jira/browse/ISIS-1971
             Project: Isis
          Issue Type: Bug
    Affects Versions: 2.0.0-M1
            Reporter: Andi Huber
             Fix For: 2.0.0-M2



{code:java}
// CALLER

@DomainService(nature=NatureOfService.VIEW_MENU_ONLY)
@DomainObjectLayout(named="Scalar Demo")
public class ScalarMenu {
    
    @Inject private FactoryService factoryService;

    @Action
    @ActionLayout(cssClassFa="fa-font")
    public TextDemo text(){
        val demo = factoryService.instantiate(TextDemo.class);
        return demo;
    }
}

// VIEW MODEL

@XmlRootElement(name = "Demo")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@DomainObject(nature=Nature.VIEW_MODEL)
@Log
public class TextDemo {

    @PostConstruct
    public void initDefaults() {
        
        log.info("TextDemo::initDefaults");
        
        string = "a string (click me)";
    }
    
    @Property(editing=Editing.ENABLED) 
    @XmlElement @Getter @Setter private String string; // string shows up on UI 
as empty, even though initDefaults was called
}
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to