Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-1971

[WON'T FIX] JAXB view model: setting view's properties via PostConstruct method not honored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.0.0-M1
    • 2.0.0-M3
    • None
    • None

    Description

      // 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
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            hobrom Andi Huber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: