@Nonnull protected AggregatePresentationModelBuilder aggregateBuilder() { // FIXME: uses the column header names, should be an internal id instead return AggregatePresentationModelBuilder.newInstance() .with(JOB_EVENT, (Displayable) () -> jobEvent.getName()) .with(NOTES, (Displayable) () -> jobEvent.getDescription()) // FIXME: this is dynamically computed, can be slow - should be also cached .with(AMOUNT, (Displayable) () -> MONEY_FORMATTER.format(jobEvent.getEarnings()), STYLE_RIGHT_ALIGNED); }
/******************************************************************************************************************* * * Factory method for the PresentationModel of SimpleDciEntity instances. * ******************************************************************************************************************/ @Nonnull private PresentationModel pmFor (final @Nonnull SimpleDciEntity entity) { // FIXME: column names final Aggregate aggregate = AggregatePresentationModelBuilder.newInstance() .with("C1", new DefaultDisplayable(entity.getName())) .with("C2", new DefaultDisplayable("" + entity.getAttribute1())) .with("C3", new DefaultDisplayable("" + entity.getAttribute2())) .create(); final Selectable selectable = () -> onSelected(entity); final UserAction action1 = new UserActionSupport8(() -> action1(entity), new DefaultDisplayable("Action 1")); final UserAction action2 = new UserActionSupport8(() -> action2(entity), new DefaultDisplayable("Action 2")); final UserAction action3 = new UserActionSupport8(() -> action3(entity), new DefaultDisplayable("Action 3")); // No explicit Displayable here, as the one inside SimpleDciEntity is used. return new DefaultPresentationModel(entity, aggregate, selectable, UserActionProvider.of(action1, action2, action3)); }
return AggregatePresentationModelBuilder.newInstance() .with("Client", (Displayable) () -> ((CustomerSpi)project.getCustomer()).getName()) .with("Status", (Displayable) () -> project.getStatus().name())