Lightweight Dialogs in e4 & JavaFX

I’ve just checked in the initial bits to use lightweight dialogs in your e4 + JavaFX applications. You can see it in action in the short video from below

Useage is fairly simple. First you need to have dialog implementation like this:

static class OpenProjectDialogImpl extends TitleAreaDialog {
  private ListView<Project> list;
  private final CommandService cmdService;

  public OpenProjectDialogImpl(Workbench workbench, 
    CommandService cmdService, @Service List<ProjectService> projectServiceList) {

    super("Open project", 
      "Open project", "Open an existing project");
    this.cmdService = cmdService;
    list = new ListView<>();
    list.setCellFactory(v -> 
      new SimpleListCell<Project>( 
        p -> labelExtractor(p, projectServiceList), 
        p -> cssProvider(p,projectServiceList)));
  protected void handleOk() {
    if( list.getSelectionModel().getSelectedItem() != null ) {
      cmdService.execute("", Collections.singletonMap("projectId", list.getSelectionModel().getSelectedItem().getProjectId()));

and displaying it is nothing more than:

public class OpenProjectDialog {
  public void open(LightWeightDialogService dialogService) {
    dialogService.openDialog(OpenProjectDialogImpl.class, ModalityScope.WINDOW);

As you can see in the video you can choose how the dialog is opened & closed. This is done through an OSGi-Service of type LightweightDialogTransitionService:

public class FadeDialogTranstionServiceImpl extends FadeDialogTranstionService implements LightweightDialogTransitionService {
  protected void configureFadeIn(FadeTransition transition) {
  protected void configureFadeOut(FadeTransition transition) {

4 thoughts on “Lightweight Dialogs in e4 & JavaFX

    • Tom Schindl June 24, 2015 / 8:11 am

      Great any slides, … available?

  1. Konstantin August 12, 2015 / 11:55 am

    “This is done through an OSGi-Service of type LightweightDialogTransitionService”
    that means you need to have your own implementation of LightweightDialogTransitionService as an OSGi-Service, where you can also adjust transition (easy out/in, duration, etc)

    P.S. It wasn’t clear for me for a while, could be a bit difficult for somebody else.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s