Package com.nomagic.magicdraw.core
Class GUILog
java.lang.Object
com.nomagic.magicdraw.core.GUILog
Utility class for displaying messages, questions, warnings and dialogs. It also used to output some text into Message Window.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefault implementation for URLActionHandlerstatic interfaceAn URL handler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHyperlinkedText(String text, Map<String, Runnable> callbacks) Display text with hyperlinks.Adds callback to open href to the map.voidclearLog()Clear message window.voidClear message window.static StringcreateActionURL(NMAction action) An utility method to create URL to some action.static StringcreateActionURLWithText(NMAction action) An utility method to create URL to some action withstatic StringcreateActionURLWithText(NMAction action, String text) An utility method to create URL to some action withAn 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.)voidlog(Notification notification, boolean openWindow) Logs notificationvoidWrites message to message window.voidWrites message to log window.voidlogNotification(String text, NotificationSeverity severity, Notification.Context context) Logs notificationvoidlogNotification(String title, String text, HRefRunnable[] actions, NotificationSeverity severity, Notification.Context context) Logs notificationvoidlogNotification(String title, String text, NotificationSeverity severity, Notification.Context context) Logs notificationvoidopenLog()Opens message window.voidOpens message window.booleanshowCustomizedQuestion(String msg, String okLabelKey, String cancelLabelKey, String title, String icon) Show customized Cancel/Ok question in a model dialogvoidMethod shows Error dialog.voidMethod shows Error and stack trace dialogvoidMethod shows Error dialog.voidShows error dialogvoidMethod shows Error and stack trace dialog.voidMethod shows Error dialog.voidShows error dialogvoidMethod shows Error and stack trace dialog.voidShows the error dialog with given messagevoidShows the error dialog with given message and titlevoidMethod shows Error and stack trace dialogvoidshowErrorWithHelp(String message, String helpID) Shows the error dialog with given message.intshowErrorWithRetry(String message, String title, Throwable exp) Method shows Error and stack trace dialog with Submit, Export, Cancel and Retry buttons.intshowErrorWithRetryButtonAsTheDefault(String message, String title, Throwable exp) Method shows Error and stack trace dialog with theRetrybutton being the default and the first one in the array of buttons.voidshowHTMLError(Frame parent, String message, Throwable throwable) Method shows Error as html text and stack trace dialogvoidshowHTMLError(Window parent, String message, Throwable throwable) Method shows Error as html text and stack trace dialogvoidshowHTMLError(String message, Throwable throwable) Method shows Error as html text and stack trace dialogvoidshowHTMLMessage(String msg, GUILog.URLActionHandler handler) Shows the message dialog with given message.voidshowHTMLMessage(String msg, String helpID, GUILog.URLActionHandler handler) Shows the message dialog with given message.voidshowHTMLMessage(String msg, String title, String helpID, GUILog.URLActionHandler handler) Shows the message dialog with given message.voidshowHTMLMessage(String msg, String title, String helpID, GUILog.URLActionHandler handler, String icon) Shows the message dialog with given message.intshowHTMLQuestion(String msg, String yesLabel, String noLabel, String cancelLabel, String title, String icon) Shows html dialogs with given button textstatic StringshowInputTextDialog(String title, String message) Show dialog for text input.voidshowMessage(Dialog parent, String msg) Shows the message dialog with the given message.voidshowMessage(Window parent, String msg) Shows the message dialog with the given message.voidshowMessage(String msg) Shows the message dialog with given message.voidshowMessage(String msg, String helpID) Shows the message dialog with the given message.booleanshowMessage(String msg, String checkBoxMsg, boolean checkBoxValue) Shows the message dialog with given message.voidshowMessage(String msg, String title, String helpID) Shows the message dialog with given message.voidshowMessage(String msg, String title, String helpID, String icon) Shows the message dialog with given message.voidshowMessageWithShowNextTime(String msg, String property_id) Shows the message dialog with given message and with label to show next time.voidshowOutOfMemoryError(String message) Display out of memory error.booleanshowQuestion(String msg) Shows the yes-no dialog dialog with given message.intshowQuestion(String msg, boolean cancel) Shows the yes-no dialog dialog with given message.intshowQuestion(String msg, boolean cancel, String dialogTitle) Shows the yes-no dialog with given message.intshowQuestion(String msg, boolean cancel, String dialogTitle, String defaultAction) Shows the yes-no dialog with given message.booleanshowQuestion(String msg, String helpID) Shows the yes-no-help dialog dialog with given message.intShows dialogs with given button textintshowQuestion(String msg, String yesLabel, String noLabel, String cancelLabel, String title, String icon) Shows dialogs with given button textintshowQuestionForAll(String msg) Shows the yes-no-all dialog dialog with given message.intshowQuestionForAll(String msg, boolean cancel) Shows the yes-no-all dialog dialog with given message.intshowQuestionForAll(String msg, boolean yesToAll, boolean cancel) Shows the yes-no-all dialog dialog with given message.booleanShows the ok-cancel dialog dialog with given message.booleanshowQuestionWithHelp(String msg, String okLabelKey, String title, String helpID) Show customized Ok/Cancel/Help question in a modal dialog.booleanshowQuestionWithHelp(String msg, String notificationMsg, String okLabelKey, String title, String helpID) Show customized Ok/Cancel/Help question in a modal dialog.intshowRetryQuestion(String msg) Shows the yes-no dialog dialog with given messagevoidshowWarning(String msg) Shows the warning dialog with given message.voidshowWarning(String msg, String title) Shows the warning dialog with given message and title.booleanshowWarning(String msg, String checkBoxMsg, boolean checkBoxValue) Shows the warning dialog with given message.voidshowWarning(String msg, String title, String okLabelKey) Shows the warning dialog with given message, title and button.booleanshowWarningQuestion(String msg, String okLabelKey, String title) Show customized Cancel/Ok question in a modal dialog.booleanshowWarningQuestion(String msg, String okLabelKey, String cancelLabelKey, String title) Show customized Cancel/Ok question in a model dialogbooleanshowYesNoHelp(String msg, String helpID, String title, String icon) Shows the yes-no-help dialog with given message.static StringwrapForHeyperlinkText(String text) Deprecated.static StringHelper method to wrap given string into string suitable to use for hyperlinked log.voidwriteLogText(String msg, boolean open) Writes message to log window.
-
Constructor Details
-
GUILog
protected GUILog()
-
-
Method Details
-
showError
Method shows Error dialog.- Parameters:
parent- parent of error dialogmsg- Error message
-
showError
Method shows Error dialog.- Parameters:
parent- parent of error dialogmsg- Error message
-
showError
Method shows Error dialog.- Parameters:
parent- parent of error dialogmsg- Error message
-
showError
Shows error dialog- Parameters:
parent- the parent of error dialogmsg- the error messagetitle- the dialog title
-
showError
Shows error dialog- Parameters:
parent- the parent of error dialogmsg- the error messagetitle- the dialog title
-
showError
Method shows Error and stack trace dialog.- Parameters:
parent- parent of error dialogmessage- error messagethrowable- throwable provides stack trace to display
-
showError
Method shows Error and stack trace dialog- Parameters:
parent- parent of error dialogmessage- error messagethrowable- throwable provides stack trace to display
-
showError
Method shows Error and stack trace dialog.- Parameters:
parent- parent of error dialogmessage- error messageexc- throwable provides stack trace to display
-
showError
Shows the error dialog with given message- Parameters:
msg- error message
-
showError
Shows the error dialog with given message and title- Parameters:
msg- error messagetitle- the dialog title
-
showError
Method shows Error and stack trace dialog- Parameters:
message- error message.throwable- throwable provides stack trace to display
-
showHTMLError
Method shows Error as html text and stack trace dialog- Parameters:
message- error messagethrowable- throwable provides stack trace to display
-
showHTMLError
Method shows Error as html text and stack trace dialog- Parameters:
parent- parent of error dialogmessage- error messagethrowable- 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 dialogmessage- error messagethrowable- throwable provides stack trace to display
-
showErrorWithRetry
Method shows Error and stack trace dialog with Submit, Export, Cancel and Retry buttons. If Retry button is pressed then method returnsDialogConstants.OK, if Cancel -DialogConstants.CANCEL.- Parameters:
message- error messagetitle- dialog titleexp- throwable provides stack trace to display- Returns:
- pressed button identifier
-
showErrorWithRetryButtonAsTheDefault
Method shows Error and stack trace dialog with theRetrybutton being the default and the first one in the array of buttons. IfRetrybutton is pressed then method returnsDialogConstants.OK, ifCancel-DialogConstants.CANCEL.- Parameters:
message- error messagetitle- dialog titleexp- stack trace to display- Returns:
- pressed button identifier
-
showMessage
Shows the message dialog with given message.- Parameters:
msg- message text
-
showHTMLMessage
Shows the message dialog with given message.- Parameters:
msg- message texthandler- handler
-
showMessage
Shows the message dialog with the given message.- Parameters:
msg- message texthelpID- 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 systemhandler- handler
-
showMessage
Shows the message dialog with given message.- Parameters:
msg- message texttitle- title of the dialoghelpID- help item ID in help systemicon- path to icon image (for example "/com/company/icon.gif")
-
showMessage
Shows the message dialog with given message.- Parameters:
msg- message texttitle- title of the dialoghelpID- 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 systemhandler- 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 texttitle- title of the dialoghelpID- help item ID in help systemhandler- url action handlericon- path to icon image (for example "/com/company/icon.gif")
-
showMessage
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 messagecheckBoxValue- check box state- Returns:
- check box state
-
showMessage
Shows the message dialog with the given message.- Parameters:
parent- dialog parentmsg- message text
-
showMessage
Shows the message dialog with the given message.- Parameters:
parent- dialog parentmsg- message text
-
showMessageWithShowNextTime
Shows the message dialog with given message and with label to show next time.- Parameters:
msg- message textproperty_id- registered invisible property id in the GeneralOptions with default value true- See Also:
-
GeneralOptionsGroup
-
showQuestion
Shows the yes-no dialog dialog with given message.- Parameters:
msg- message of question.- Returns:
- true if answer was yes.
-
showQuestion
Shows the yes-no dialog dialog with given message.- Parameters:
cancel- true if cancel button neededmsg- message of question.- Returns:
- result constant form DialogConstants.
- See Also:
-
showInputTextDialog
Show dialog for text input.- Parameters:
title- dialog title.message- message to show in dialog.- Returns:
- entered text.
-
showQuestion
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
Shows the ok-cancel dialog dialog with given message.- Parameters:
msg- message of question.- Returns:
- result constant form DialogConstants.
- See Also:
-
showQuestion
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
Shows the yes-no-help dialog with given message.- Parameters:
msg- message of question.helpID- help item ID in help systemtitle- titleicon- path to icon image (for example "/com/company/icon.gif")- Returns:
- true if answer was yes.
-
showQuestionForAll
Shows the yes-no-all dialog dialog with given message.- Parameters:
msg- message text.- Returns:
- result constant form DialogConstants.
- See Also:
-
showQuestionForAll
Shows the yes-no-all dialog dialog with given message.- Parameters:
msg- messagecancel- true if cancel button needed- Returns:
- one of the result constants in DialogConstants.
- See Also:
-
showQuestionForAll
Shows the yes-no-all dialog dialog with given message.- Parameters:
msg- messageyesToAll- true if Yes to ALL button neededcancel- true if cancel button needed- Returns:
- one of the result constants in DialogConstants.
- See Also:
-
showRetryQuestion
Shows the yes-no dialog dialog with given message- Parameters:
msg- Message Text- Returns:
- one of the result constants in DialogConstants.
- See Also:
-
showWarning
Shows the warning dialog with given message.- Parameters:
msg- warning text.
-
showWarning
Shows the warning dialog with given message and title.- Parameters:
msg- warning text.title- warning title
-
showWarning
Shows the warning dialog with given message, title and button.- Parameters:
msg- warning text.title- warning titleokLabelKey- button label
-
showWarning
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 messagecheckBoxValue- check box state- Returns:
- check box state
-
log
Logs notification- Parameters:
notification- notificationopenWindow- flag, if true opens notification window
-
logNotification
public void logNotification(@CheckForNull String text, NotificationSeverity severity, Notification.Context context) Logs notification- Parameters:
text- notification textseverity- notification severitycontext- notification context
-
logNotification
public void logNotification(@CheckForNull String title, @CheckForNull String text, NotificationSeverity severity, Notification.Context context) Logs notification- Parameters:
title- notification titletext- notification textseverity- notification severitycontext- 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 titletext- notification textseverity- notification severityactions- list of actionscontext- 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
Writes message to message window.- Parameters:
msg- message text.
-
log
Writes message to log window.- Parameters:
msg- message text.open- true if closed window should be reopened.
-
writeLogText
Writes message to log window.- Parameters:
msg- message text.open- true if closed window should be reopened.
-
showOutOfMemoryError
Display out of memory error.- Parameters:
message- message
-
showErrorWithHelp
Shows the error dialog with given message.- Parameters:
message- message texthelpID- help item ID in help system
-
addHyperlinkedText
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
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.Misspelled - usewrapForHyperlinkText(String)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 inaddHyperlinkedText(String, Map)- Parameters:
map- map to which callback isstring- text fragment which is hyper linkhref- reference- Returns:
- map with url call backs
-
createActionURL
An utility method to create URL to some action.- Parameters:
action- action- Returns:
- url to this action
-
createActionURLWithText
An utility method to create URL to some action with- Parameters:
action- action- Returns:
- url to this action
-
createActionURLWithText
An utility method to create URL to some action with- Parameters:
action- actiontext- url text- Returns:
- url to this action
-
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 shownotificationMsg- notification message to show if silent mode is onokLabelKey- label key in DialogResource.properties for the Ok buttontitle- dialog titlehelpID- help item ID in help system- Returns:
- true - if Ok was pressed, false - if cancel.
-
showQuestionWithHelp
Show customized Ok/Cancel/Help question in a modal dialog.- Parameters:
msg- message to showokLabelKey- label key in DialogResource.properties for the Ok buttontitle- dialog titlehelpID- help item ID in help system- Returns:
- true - if Ok was pressed, false - if cancel.
-
showWarningQuestion
Show customized Cancel/Ok question in a modal dialog.- Parameters:
msg- message to showokLabelKey- label key in DialogResource.properties for the Ok buttontitle- 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 showokLabelKey- the label key in DialogResource.properties for the Ok buttoncancelLabelKey- the label key in DialogResource.properties for the Cancel buttontitle- the dialog title- Returns:
trueif Ok was pressed,falseotherwise
-
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 showokLabelKey- the label key in DialogResource.properties for the Ok buttoncancelLabelKey- the label key in DialogResource.properties for the Cancel buttontitle- the dialog titleicon- the dialog icon- Returns:
trueif Ok was pressed,falseotherwise
-
wrapForHyperlinkText(String)