Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce an Vaadin portlet API proposal from a draft #25

Closed
ujoni opened this issue Sep 23, 2019 · 1 comment
Closed

Produce an Vaadin portlet API proposal from a draft #25

ujoni opened this issue Sep 23, 2019 · 1 comment

Comments

@ujoni
Copy link
Contributor

ujoni commented Sep 23, 2019

During the meeting on 23.9.2019, Leif created a loose API draft based on the comments presented in the meeting.

The demonstrating code is as follows:

// Simplest possible - maybe not feasible because the portlet API is a mess
@VaadinPortletView("myPortlet")
public class MaximizedViewOrEditView extends MyComponent implements VaadinPortletView {
  @Override
  public void init(PortalComponentContext context) {
    this.addFooBarListener(event -> {
      context.sendEvent(some, parameters, here);
    });
    context.onPortletModeChange(mode -> this.setEdit(mode.equals(PortletMode.EDIT));
    context.onEvent((EventRequest request, EventResponse response) -> {
      this.setEventReceived(request.getEvent().getName));
    });
    boolean isAdmin = context.hasRole("admin");
    this.setAdminControlsAvailable(isAdmin);
  }
}
// Intermediate level with annotations
@PortletApplication(
    @EventDefinition(xyz)  
)
public class MyOtherPortlet {
  @RenderMethod("myPortlet")
  public String doThings(request) {
    if (maximised) {
      return VaadinPortlet.doThings(request, MaximizedViewOrEditView.class);
    } else {
      return "<img>";
    }
  }
  @EventMethod("someEvent")
  public void something(EventRequest req, EventResponse resp) {
    VaadinPortlet.dispatchToTheRightComponentInstance(req, resp, MaximizedViewOrEditView.class);
  }
}
// Intermediate level with xml
public class MyPortlet extends VaadinPortlet<MaximizedViewOrEditView> {
}
// Advanced case for using different components with separate @PreserveOnRefresh scopes for different render modes, but still using xml
public class MyPortlet extends VaadinPortlet {
  @Override
  protected Class<? extends Component> getRenderDefinition(PortletRequest request) {
    if (request.getPortletMode().equals(PortletMode.HELP)) {
      return HelpComponent.class;
    } else if (request.getWindowState().equals(WindowState.MAXIMIZED)) {
      return MaximizedViewOrEditView.class;
    }
  }
  doEdit(RenderRequest req, RenderRespones resp) {
    if (maximised) {
      super.doEdit(req, resp);
    } else {
      renderImg(resp);
    }
  }
}

This code should be formalized and a API draft should be produced in this repository. This API should then be used in the various demonstration projects to validate the design and find problems therein.

@joheriks joheriks moved this from In progress to Inbox - needs triage in OLD Vaadin Flow ongoing work (Vaadin 10+) Sep 23, 2019
@pleku pleku moved this from Inbox - needs triage to Product backlog in OLD Vaadin Flow ongoing work (Vaadin 10+) Sep 30, 2019
@pleku pleku moved this from Product backlog to Iteration Backlog in OLD Vaadin Flow ongoing work (Vaadin 10+) Oct 2, 2019
@pleku
Copy link

pleku commented Oct 2, 2019

This should combine the results of the:

This issue can be closed when:

  • The API exists either in a feature branch or PR
  • There are tickets created for the next things to do to make the API happen

@pleku pleku closed this as completed Oct 9, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Iteration Backlog to Done - pending release Oct 9, 2019
@caalador caalador added this to the 1.0.0.alpha1 milestone Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
OLD Vaadin Flow ongoing work (Vaadin ...
  
Done - pending release
Development

No branches or pull requests

3 participants