I think for this you need to map all properties into layout.xml, but then
use the hideXxx method to selectively hide methods based on the lifecycle
of the domain object.
eg:
public class Project {
public enum State {PROPOSED, APPROVED}
@lombokGetter @lombok.Setter
private State state;
@lombokGetter @lombok.Setter
private LocalDate approvedOn;
public boolean hideApprovedOn() { return getState() == PROPOSED; } //
field only visible once approved
public Project approve() {
setApprovedOn(clockService.now);
setState(State.PROPOSED);
return this;
}
public String disableApprove() { return getState() != PROPOSED ? "only
proposed projects can be approved": null; } // action greyed out after
approved
@Inject ClockService clockService;
}
HTH
Dan
On Wed, 8 Feb 2017 at 17:30 Bharanidharan Srinivasan <[email protected]>
wrote:
> Hi Dan,
>
> Thanks for the quick response - will check out this option.
> Just curious - why is this restriction?
>
> Thinking of a scenario - I can have 1 entity, having its properties
> populated at different stages of application process.
>
> For instance metrics for a project management software, will get filled,
> as the project passes from one phase to another, in a water fall model.So
> would it not be good, to have only one set of properties populated and the
> remaining properties be hidden...
>
> Leads to one more question - is it possible to multiple layout files for
> an entity
>
> Thanks & Regards
> Bharani
>
>
> On 2017-02-08 14:49 (+0530), Dan Haywood <[email protected]>
> wrote:
> > No, IIRC a layout.xml is not valid unless there is exactly one region
> > indicated for all of unreferencedproperties/collections/actions. By
> design
> > to avoid confusion.
> >
> > One trick though is to create a column with span="0" and put those
> regions
> > (eg fieldsets) there. I just discovered this trick myself a week or so
> ago.
> >
> > HTH,
> > Dan
> >
> > On Wed, 8 Feb 2017, 10:04 Bharanidharan Srinivasan, <[email protected]
> >
> > wrote:
> >
> > > Hi,
> > >
> > > Is there a way to have only the required properties of a domain object
> > > mentioned in layout.xml - is there a way to avoid inclusion of
> > > unreferencedcollection or unreferencedproperties
> > >
> > > Thanks & Regards
> > > Bharani
> > >
> >
>