Skip to content

GemDialog

GemDialog displays a component as a modal dialog on top of the page at a configurable position, optionally with a backdrop.

Usage Example

/* (c) https://github.com/MontiCore/monticore */
package example_arrange;

import mc.fenix.arrange.GemCard;
import mc.fenix.arrange.GemDialog;
import mc.fenix.basic.GemText;
import mc.fenix.basic.GemButton;
import mc.fenix.basic.GemLink;
import mc.fenix.arrange.GemColumn;
import common.ExamplePage;

page GemDialogExample(?boolean dialogOpen = false) {
  @ExamplePage(
    component = @GemColumn(components = [
      @GemButton(label = "Click Me!", leftClick = openDialog()),
      dialog@GemDialog(isOpen = dialogOpen, component =
        @GemCard(
          title = "Info Text",
          component = @GemText(value = "Some Text")
        )
      )
    ]),
    basePath = "example_arrange",
    componentName = "GemDialogExample"
  );
}
GemDialogExample

TypeScript implementation:

/* (c) https://github.com/MontiCore/monticore */
package example_arrange;

import umlp.jsweet.extension.annotation.Component;

import java.util.function.Consumer;

@Component
public class GemDialogExample extends GemDialogExampleTOP {
  @Override
  public Consumer<Void> openDialog() {
    return $ -> this.setDialogOpen(true);
  }

  @Override
  public Boolean getDialogIsOpen() {
    return this.isDialogOpen();
  }

  @Override
  public void setDialogIsOpen(Boolean conv_val_$) {
    this.setDialogOpen(conv_val_$);
  }
}

GUI Model

component GemDialog(
  boolean enableBackdrop = true,
  String top = "auto",
  String left = "auto",
  ?boolean isOpen = false,
  GUIViewElement component
)
Name Type Description Default value
enableBackdrop boolean Whether a semi-transparent backdrop is shown behind the dialog. true
top String Distance of the dialog from the top of the viewport in px, %, vh, etc. "auto"
left String Distance of the dialog from the left of the viewport in px, %, vw, etc. "auto"
isOpen ?boolean Whether the dialog is currently shown. false
component GUIViewElement Component displayed inside the dialog.