use of org.jboss.hal.ballroom.dialog.Modal.$ in project console by hal.
the class Dialog method show.
public void show() {
if (Dialog.open) {
throw new IllegalStateException("Another dialog is still open. Only one dialog can be open at a time. Please close the other dialog!");
}
reset();
if (builder.fadeIn) {
Dialog.root.classList.add(fade);
}
Dialog.dialog.classList.add(builder.size.css);
setVisible(Dialog.closeIcon, builder.closeIcon);
setTitle(builder.title);
for (HTMLElement element : builder.elements) {
Dialog.body.appendChild(element);
}
if (!builder.buttons.isEmpty()) {
for (Map.Entry<Integer, Button> entry : builder.buttons.entrySet()) {
int position = entry.getKey();
Button button = entry.getValue();
String css = btn + " " + btnHal + " " + (button.primary ? btnPrimary : btnDefault);
if (position < 0) {
css = css + " " + pullLeft;
}
HTMLButtonElement buttonElement = button(button.label).css(css).on(click, event -> {
if (button.resultCallback != null) {
if (button.resultCallback.eval()) {
close();
}
} else if (button.simpleCallback != null) {
button.simpleCallback.execute();
close();
} else {
close();
}
}).element();
Dialog.footer.appendChild(buttonElement);
buttons.put(position, buttonElement);
}
}
setVisible(Dialog.footer, !buttons.isEmpty());
attachables.forEach(Attachable::attach);
$(SELECTOR_ID).modal(ModalOptions.create(builder.closeOnEsc));
$(SELECTOR_ID).modal("show");
PatternFly.initComponents(SELECTOR_ID);
}
Aggregations