webforj icon indicating copy to clipboard operation
webforj copied to clipboard

feat: Add OptionDialog to create blocking messages and prompts

Open hyyan opened this issue 1 year ago • 4 comments

The following is a work-in-progress prototype designed to unify the BBj message dialogs and prompts within a single interface. This implementation is divided between BBj and webforJ, and is inspired by the design of JOptionPane.

import com.webforj.App;
import com.webforj.exceptions.WebforjException;
import com.webforj.optiondialog.ConfirmDialog;
import com.webforj.optiondialog.ConfirmDialog.MessageType;
import com.webforj.optiondialog.ConfirmDialog.OptionType;
import com.webforj.optiondialog.OptionDialog;

public class FieldPattern extends App {

  @Override
  public void run() throws WebforjException {
    OptionDialog.showConfirmDialog("A message dialog with default title");
    OptionDialog.showConfirmDialog("A message dialog with custom title", "Custom Title");

    OptionDialog.showConfirmDialog("A message dialog with custom title", "Ok/Cancel Dialog",
    OptionType.OK_CANCEL);

    OptionDialog.showConfirmDialog("Abort/Retry/Ignore Dialog", "Abort/Retry/Ignore Dialog",
    OptionType.ABORT_RETRY_IGNORE);

    OptionDialog.showConfirmDialog("A message dialog with icon", "Message With Icon",
    OptionType.ABORT_RETRY_IGNORE, MessageType.INFORMATION);

    ConfirmDialog dialog =
        new ConfirmDialog("A message dialog with default title", "Custom Title", OptionType.CUSTOM);
    dialog.setButtonText("Button 1");
    dialog.setAlignment(ConfirmDialog.Alignment.BOTTOM);
    dialog.setBlurred(true);
    dialog.setAttribute("key", "value");

    ConfirmDialog.Result result = dialog.show();

    OptionDialog.showConfirmDialog(result);
    dialog.show();
  }
}

hyyan avatar Apr 26 '24 13:04 hyyan

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

github-actions[bot] avatar Apr 26 '24 13:04 github-actions[bot]

Code Coverage

Overall Project 54.84% -1.73% :green_apple:
Files changed 73.82% :green_apple:

Module Coverage
webforj-foundation 48.91% -2.45% :green_apple:
Files
Module File Coverage
webforj-foundation DwcMsgBox.java 100% :green_apple:
DwcFileOpen.java 100% :green_apple:
ThemedDialog.java 96.15% -3.85% :green_apple:
ConfirmDialog.java 94.59% -5.41% :green_apple:
InputDialog.java 94.31% -5.69% :green_apple:
FileChooserDialog.java 91.51% -8.49% :green_apple:
Dialog.java 88.29% -11.71% :green_apple:
DwcPromptMsgBox.java 87.42% -12.58% :green_apple:
FileChooserFilter.java 86.21% -13.79% :green_apple:
FileUploadDialog.java 76.44% -23.56% :green_apple:
UploadedFile.java 74.01% -25.99% :green_apple:
MessageDialog.java 69.06% -30.94% :green_apple:
Page.java 33.38% -3.98% :green_apple:
FileChooserI18n.java 31.21% -68.79% :x:
FileUploadI18n.java 31.09% -68.91% :x:
App.java 23.34% :green_apple:
OptionDialog.java 0% :x:

github-actions[bot] avatar Apr 26 '24 13:04 github-actions[bot]

@MatthewHawkins please go over the java docs and fix any obvious issues.

hyyan avatar May 17 '24 12:05 hyyan