Class GUILog

java.lang.Object
com.nomagic.magicdraw.core.GUILog

@OpenApiAll public class GUILog extends Object
Utility class for displaying messages, questions, warnings and dialogs. It also used to output some text into Message Window.
  • Constructor Details

    • GUILog

      protected GUILog()
  • Method Details

    • showError

      public void showError(@CheckForNull Dialog parent, String msg)
      Method shows Error dialog.
      Parameters:
      parent - parent of error dialog
      msg - Error message
    • showError

      public void showError(@CheckForNull Frame parent, String msg)
      Method shows Error dialog.
      Parameters:
      parent - parent of error dialog
      msg - Error message
    • showError

      public void showError(@CheckForNull Window parent, String msg)
      Method shows Error dialog.
      Parameters:
      parent - parent of error dialog
      msg - Error message
    • showError

      public void showError(@CheckForNull Frame parent, String msg, String title)
      Shows error dialog
      Parameters:
      parent - the parent of error dialog
      msg - the error message
      title - the dialog title
    • showError

      public void showError(@CheckForNull Window parent, String msg, String title)
      Shows error dialog
      Parameters:
      parent - the parent of error dialog
      msg - the error message
      title - the dialog title
    • showError

      public void showError(@CheckForNull Frame parent, String message, Throwable throwable)
      Method shows Error and stack trace dialog.
      Parameters:
      parent - parent of error dialog
      message - error message
      throwable - throwable provides stack trace to display
    • showError

      public void showError(Dialog parent, String message, @CheckForNull Throwable throwable)
      Method shows Error and stack trace dialog
      Parameters:
      parent - parent of error dialog
      message - error message
      throwable - throwable provides stack trace to display
    • showError

      public void showError(@CheckForNull Window parent, String message, @CheckForNull Throwable exc)
      Method shows Error and stack trace dialog.
      Parameters:
      parent - parent of error dialog
      message - error message
      exc - throwable provides stack trace to display
    • showError

      public void showError(String msg)
      Shows the error dialog with given message
      Parameters:
      msg - error message
    • showError

      public void showError(String msg, String title)
      Shows the error dialog with given message and title
      Parameters:
      msg - error message
      title - the dialog title
    • showError

      public void showError(String message, @CheckForNull Throwable throwable)
      Method shows Error and stack trace dialog
      Parameters:
      message - error message.
      throwable - throwable provides stack trace to display
    • showHTMLError

      public void showHTMLError(String message, @CheckForNull Throwable throwable)
      Method shows Error as html text and stack trace dialog
      Parameters:
      message - error message
      throwable - throwable provides stack trace to display
    • showHTMLError

      public void showHTMLError(@CheckForNull Frame parent, String message, Throwable throwable)
      Method shows Error as html text and stack trace dialog
      Parameters:
      parent - parent of error dialog
      message - error message
      throwable - throwable provides stack trace to display
    • showHTMLError

      public void showHTMLError(@CheckForNull Window parent, String message, @CheckForNull Throwable throwable)
      Method shows Error as html text and stack trace dialog
      Parameters:
      parent - parent of error dialog
      message - error message
      throwable - throwable provides stack trace to display
    • showErrorWithRetry

      public int showErrorWithRetry(String message, String title, Throwable exp)
      Method shows Error and stack trace dialog with Submit, Export, Cancel and Retry buttons. If Retry button is pressed then method returns DialogConstants.OK, if Cancel - DialogConstants.CANCEL.
      Parameters:
      message - error message
      title - dialog title
      exp - throwable provides stack trace to display
      Returns:
      pressed button identifier
    • showErrorWithRetryButtonAsTheDefault

      public int showErrorWithRetryButtonAsTheDefault(String message, String title, Throwable exp)
      Method shows Error and stack trace dialog with the Retry button being the default and the first one in the array of buttons. If Retry button is pressed then method returns DialogConstants.OK, if Cancel - DialogConstants.CANCEL.
      Parameters:
      message - error message
      title - dialog title
      exp - stack trace to display
      Returns:
      pressed button identifier
    • showMessage

      public void showMessage(String msg)
      Shows the message dialog with given message.
      Parameters:
      msg - message text
    • showHTMLMessage

      public void showHTMLMessage(String msg, @CheckForNull GUILog.URLActionHandler handler)
      Shows the message dialog with given message.
      Parameters:
      msg - message text
      handler - handler
    • showMessage

      public void showMessage(String msg, @CheckForNull String helpID)
      Shows the message dialog with the given message.
      Parameters:
      msg - message text
      helpID - help item ID in help system
    • showHTMLMessage

      public void showHTMLMessage(String msg, @CheckForNull String helpID, @CheckForNull GUILog.URLActionHandler handler)
      Shows the message dialog with given message.
      Parameters:
      msg - message text.
      helpID - help item ID in help system
      handler - handler
    • showMessage

      public void showMessage(String msg, String title, @CheckForNull String helpID, String icon)
      Shows the message dialog with given message.
      Parameters:
      msg - message text
      title - title of the dialog
      helpID - help item ID in help system
      icon - path to icon image (for example "/com/company/icon.gif")
    • showMessage

      public void showMessage(String msg, String title, @CheckForNull String helpID)
      Shows the message dialog with given message.
      Parameters:
      msg - message text
      title - title of the dialog
      helpID - help item ID in help system
    • showHTMLMessage

      public void showHTMLMessage(String msg, String title, @CheckForNull String helpID, @CheckForNull GUILog.URLActionHandler handler)
      Shows the message dialog with given message.
      Parameters:
      msg - message text.
      title - title of the dialog.
      helpID - help item ID in help system
      handler - url action handler
    • showHTMLMessage

      public void showHTMLMessage(String msg, String title, @CheckForNull String helpID, @CheckForNull GUILog.URLActionHandler handler, String icon)
      Shows the message dialog with given message.
      Parameters:
      msg - message text
      title - title of the dialog
      helpID - help item ID in help system
      handler - url action handler
      icon - path to icon image (for example "/com/company/icon.gif")
    • showMessage

      public boolean showMessage(String msg, String checkBoxMsg, boolean checkBoxValue)
      Shows the message dialog with given message. Shows another message with a checkbox before like "Show next time" option.
      Parameters:
      msg - message text.
      checkBoxMsg - check box message
      checkBoxValue - check box state
      Returns:
      check box state
    • showMessage

      public void showMessage(Dialog parent, String msg)
      Shows the message dialog with the given message.
      Parameters:
      parent - dialog parent
      msg - message text
    • showMessage

      public void showMessage(Window parent, String msg)
      Shows the message dialog with the given message.
      Parameters:
      parent - dialog parent
      msg - message text
    • showMessageWithShowNextTime

      public void showMessageWithShowNextTime(String msg, String property_id)
      Shows the message dialog with given message and with label to show next time.
      Parameters:
      msg - message text
      property_id - registered invisible property id in the GeneralOptions with default value true
      See Also:
      • GeneralOptionsGroup
    • showQuestion

      public boolean showQuestion(String msg)
      Shows the yes-no dialog dialog with given message.
      Parameters:
      msg - message of question.
      Returns:
      true if answer was yes.
    • showQuestion

      public int showQuestion(String msg, boolean cancel)
      Shows the yes-no dialog dialog with given message.
      Parameters:
      cancel - true if cancel button needed
      msg - message of question.
      Returns:
      result constant form DialogConstants.
      See Also:
    • showInputTextDialog

      public static String showInputTextDialog(String title, String message)
      Show dialog for text input.
      Parameters:
      title - dialog title.
      message - message to show in dialog.
      Returns:
      entered text.
    • showQuestion

      public int showQuestion(String msg, boolean cancel, String dialogTitle)
      Shows the yes-no dialog with given message.
      Parameters:
      cancel - true if cancel button needed.
      msg - message of question.
      dialogTitle - title of the dialog.
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestion

      public int showQuestion(String msg, boolean cancel, String dialogTitle, @CheckForNull String defaultAction)
      Shows the yes-no dialog with given message.
      Parameters:
      cancel - true if cancel button needed.
      msg - message of question.
      dialogTitle - title of the dialog.
      defaultAction - default selected action (button) in the question dialog.
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestion

      public int showQuestion(String msg, String yesLabel, String noLabel, @CheckForNull String cancelLabel, String icon)
      Shows dialogs with given button text
      Parameters:
      msg - message of question.
      yesLabel - label key in dialog resources used instead of "Yes" text.
      noLabel - label key in dialog resources used instead of "No" text.
      cancelLabel - label key in dialog resources used instead of "Cancel" text, can be null.
      icon - path to icon image (for example "/com/company/icon.gif")
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestion

      public int showQuestion(String msg, String yesLabel, String noLabel, @CheckForNull String cancelLabel, String title, String icon)
      Shows dialogs with given button text
      Parameters:
      msg - message of question.
      yesLabel - label key in dialog resources used instead of "Yes" text.
      noLabel - label key in dialog resources used instead of "No" text.
      cancelLabel - label key in dialog resources used instead of "Cancel" text, can be null.
      title - title of the dialog.
      icon - path to icon image (for example "/com/company/icon.gif")
      Returns:
      result constant form DialogConstants.
      See Also:
    • showHTMLQuestion

      public int showHTMLQuestion(String msg, String yesLabel, String noLabel, @CheckForNull String cancelLabel, String title, String icon)
      Shows html dialogs with given button text
      Parameters:
      msg - message of question.
      yesLabel - label key in dialog resources used instead of "Yes" text.
      noLabel - label key in dialog resources used instead of "No" text.
      cancelLabel - label key in dialog resources used instead of "Cancel" text, can be null.
      title - title of the dialog.
      icon - path to icon image (for example "/com/company/icon.gif")
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestionOkCancel

      public boolean showQuestionOkCancel(String msg)
      Shows the ok-cancel dialog dialog with given message.
      Parameters:
      msg - message of question.
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestion

      public boolean showQuestion(String msg, String helpID)
      Shows the yes-no-help dialog dialog with given message.
      Parameters:
      msg - message of question.
      helpID - help item ID in help system
      Returns:
      true if answer was yes.
    • showYesNoHelp

      public boolean showYesNoHelp(String msg, String helpID, String title, String icon)
      Shows the yes-no-help dialog with given message.
      Parameters:
      msg - message of question.
      helpID - help item ID in help system
      title - title
      icon - path to icon image (for example "/com/company/icon.gif")
      Returns:
      true if answer was yes.
    • showQuestionForAll

      public int showQuestionForAll(String msg)
      Shows the yes-no-all dialog dialog with given message.
      Parameters:
      msg - message text.
      Returns:
      result constant form DialogConstants.
      See Also:
    • showQuestionForAll

      public int showQuestionForAll(String msg, boolean cancel)
      Shows the yes-no-all dialog dialog with given message.
      Parameters:
      msg - message
      cancel - true if cancel button needed
      Returns:
      one of the result constants in DialogConstants.
      See Also:
    • showQuestionForAll

      public int showQuestionForAll(String msg, boolean yesToAll, boolean cancel)
      Shows the yes-no-all dialog dialog with given message.
      Parameters:
      msg - message
      yesToAll - true if Yes to ALL button needed
      cancel - true if cancel button needed
      Returns:
      one of the result constants in DialogConstants.
      See Also:
    • showRetryQuestion

      public int showRetryQuestion(String msg)
      Shows the yes-no dialog dialog with given message
      Parameters:
      msg - Message Text
      Returns:
      one of the result constants in DialogConstants.
      See Also:
    • showWarning

      public void showWarning(String msg)
      Shows the warning dialog with given message.
      Parameters:
      msg - warning text.
    • showWarning

      public void showWarning(String msg, String title)
      Shows the warning dialog with given message and title.
      Parameters:
      msg - warning text.
      title - warning title
    • showWarning

      public void showWarning(String msg, String title, String okLabelKey)
      Shows the warning dialog with given message, title and button.
      Parameters:
      msg - warning text.
      title - warning title
      okLabelKey - button label
    • showWarning

      public boolean showWarning(String msg, String checkBoxMsg, boolean checkBoxValue)
      Shows the warning dialog with given message. Shows another message with a checkbox before like "Show next time" option.
      Parameters:
      msg - message text.
      checkBoxMsg - check box message
      checkBoxValue - check box state
      Returns:
      check box state
    • log

      public void log(Notification notification, boolean openWindow)
      Logs notification
      Parameters:
      notification - notification
      openWindow - flag, if true opens notification window
    • logNotification

      public void logNotification(@CheckForNull String text, NotificationSeverity severity, Notification.Context context)
      Logs notification
      Parameters:
      text - notification text
      severity - notification severity
      context - notification context
    • logNotification

      public void logNotification(@CheckForNull String title, @CheckForNull String text, NotificationSeverity severity, Notification.Context context)
      Logs notification
      Parameters:
      title - notification title
      text - notification text
      severity - notification severity
      context - notification context
    • logNotification

      public void logNotification(@CheckForNull String title, @CheckForNull String text, @CheckForNull HRefRunnable[] actions, NotificationSeverity severity, Notification.Context context)
      Logs notification
      Parameters:
      title - notification title
      text - notification text
      severity - notification severity
      actions - list of actions
      context - notification context
    • openMessageWindow

      public void openMessageWindow()
      Opens message window.
    • openLog

      public void openLog()
      Opens message window.
    • clearLog

      public void clearLog()
      Clear message window.
    • clearMessageWindow

      public void clearMessageWindow()
      Clear message window.
    • log

      public void log(String msg)
      Writes message to message window.
      Parameters:
      msg - message text.
    • log

      public void log(String msg, boolean open)
      Writes message to log window.
      Parameters:
      msg - message text.
      open - true if closed window should be reopened.
    • writeLogText

      public void writeLogText(String msg, boolean open)
      Writes message to log window.
      Parameters:
      msg - message text.
      open - true if closed window should be reopened.
    • showOutOfMemoryError

      public void showOutOfMemoryError(String message)
      Display out of memory error.
      Parameters:
      message - message
    • showErrorWithHelp

      public void showErrorWithHelp(String message, String helpID)
      Shows the error dialog with given message.
      Parameters:
      message - message text
      helpID - help item ID in help system
    • addHyperlinkedText

      public void addHyperlinkedText(String text, Map<String,Runnable> callbacks)
      Display text with hyperlinks. Each hyperlink must have entry in callback. Hyperlink in the text must be surrounded by <A> </A> tags. Callback is taken from the parameter callbacks using hyperlink text as key.
      Parameters:
      text - text with hyperlinks for example "Best modeling <A>hyperlink text to display</A> tool." text can contain any number of href.
      callbacks - map where is mapped hyperlinked text to the callback runnable. Map must contain String key and Runnable value.
      See Also:
    • wrapForHyperlinkText

      public static String wrapForHyperlinkText(String str)
      Helper method to wrap given string into string suitable to use for hyperlinked log. Simply wrap with <A></A> tags
      Parameters:
      str - target string for hyperlink
      Returns:
      string wrapped into <A></A>
      See Also:
    • wrapForHeyperlinkText

      @Deprecated public static String wrapForHeyperlinkText(String text)
      Deprecated.
      Wrap text for hyperlink
      Parameters:
      text - text to wrap
      Returns:
      wrapped text
    • addURLCallBack

      public static Map<String,Runnable> addURLCallBack(@CheckForNull Map<String,Runnable> map, String string, String href)
      Adds callback to open href to the map. call back is used in addHyperlinkedText(String, Map)
      Parameters:
      map - map to which callback is
      string - text fragment which is hyper link
      href - reference
      Returns:
      map with url call backs
    • createActionURL

      public static String createActionURL(@Nonnull NMAction action)
      An utility method to create URL to some action.
      Parameters:
      action - action
      Returns:
      url to this action
    • createActionURLWithText

      public static String createActionURLWithText(NMAction action)
      An utility method to create URL to some action with
      Parameters:
      action - action
      Returns:
      url to this action
    • createActionURLWithText

      public static String createActionURLWithText(NMAction action, String text)
      An utility method to create URL to some action with
      Parameters:
      action - action
      text - url text
      Returns:
      url to this action
    • getLoggedMessages

      public String getLoggedMessages()
      An utility method get all logged messages (This GUILog class provides a method to get the LogDialog, but the LogDialog is not part of the OpenAPI and therefore not accessible by code that will want to use it.)
      Returns:
      the messages visible in the LogDialog
    • showQuestionWithHelp

      public boolean showQuestionWithHelp(String msg, @CheckForNull String notificationMsg, String okLabelKey, String title, String helpID)
      Show customized Ok/Cancel/Help question in a modal dialog.
      Parameters:
      msg - message to show
      notificationMsg - notification message to show if silent mode is on
      okLabelKey - label key in DialogResource.properties for the Ok button
      title - dialog title
      helpID - help item ID in help system
      Returns:
      true - if Ok was pressed, false - if cancel.
    • showQuestionWithHelp

      public boolean showQuestionWithHelp(String msg, String okLabelKey, String title, String helpID)
      Show customized Ok/Cancel/Help question in a modal dialog.
      Parameters:
      msg - message to show
      okLabelKey - label key in DialogResource.properties for the Ok button
      title - dialog title
      helpID - help item ID in help system
      Returns:
      true - if Ok was pressed, false - if cancel.
    • showWarningQuestion

      public boolean showWarningQuestion(String msg, String okLabelKey, String title)
      Show customized Cancel/Ok question in a modal dialog.
      Parameters:
      msg - message to show
      okLabelKey - label key in DialogResource.properties for the Ok button
      title - dialog title
      Returns:
      true - if Ok was pressed, false - if cancel.
    • showWarningQuestion

      public boolean showWarningQuestion(String msg, String okLabelKey, String cancelLabelKey, String title)
      Show customized Cancel/Ok question in a model dialog
      Parameters:
      msg - the message to show
      okLabelKey - the label key in DialogResource.properties for the Ok button
      cancelLabelKey - the label key in DialogResource.properties for the Cancel button
      title - the dialog title
      Returns:
      true if Ok was pressed, false otherwise
    • showCustomizedQuestion

      public boolean showCustomizedQuestion(String msg, String okLabelKey, String cancelLabelKey, String title, String icon)
      Show customized Cancel/Ok question in a model dialog
      Parameters:
      msg - the message to show
      okLabelKey - the label key in DialogResource.properties for the Ok button
      cancelLabelKey - the label key in DialogResource.properties for the Cancel button
      title - the dialog title
      icon - the dialog icon
      Returns:
      true if Ok was pressed, false otherwise