HiRISE

HiRISE.HiPlan.Utilities
Class Alerts

java.lang.Object
  extended by HiRISE.HiPlan.Utilities.Alerts

public class Alerts
extends Object

An alert manager. The manager features numerous methods for displaying alerts of various types: plain, informational, warning, and error. These alerts are invoked via the JOptionPane's showMessageDialog methods; the manager reduces the input parameters to a simplified set and wraps message elements in GuiUtilities.makeTextComponent(java.lang.String)-generated components.

Alert Messages

Most of the methods that show the manager's alerts take an Object as the alert's message. This object is treated in much the same way as the JOptionPane's message, with the following exceptions:

  1. If the object is a String, it is converted to a Component.
  2. If the object is a Throwable, its message is extracted and converted to a Component.

Version:
1.18
Author:
Christian Schaller - UA/PIRL

Field Summary
static String ID
          Class identification name with source code version and date.
 
Constructor Summary
Alerts()
          Creates a new alert manager with a generic title prefix for the alert titles.
Alerts(Component location_component)
          Creates a new alert manager with the given location component.
Alerts(Component location_component, String title_prefix)
          Creates a new alert manager with the given location component and title prefix.
Alerts(String title_prefix)
          Creates a new alert manager with the given title prefix.
 
Method Summary
 String error_title()
          Gets the default title used for error alerts.
 void error_title(String error_title)
          Sets the default title used for error alerts.
 String info_title()
          Gets the default title used for informational alerts.
 void info_title(String info_title)
          Sets the default title used for informational alerts.
 Component location_component()
          Gets the alert manager's location component.
 void location_component(Component location_component)
          Sets the alert manager's location component.
 String plain_title()
          Gets the default title used for plain alerts.
 void plain_title(String plain_title)
          Sets the default title used for plain alerts.
 void show_error(Object message)
          Displays an error dialog with the given message.
 void show_error(Object message, String title)
          Displays an error dialog with the given message and title.
 void show_error(String message, Throwable throwable)
          Displays an error dialog designed for exceptions.
 void show_error(String message, Throwable throwable, String title)
          Displays an error dialog designed for exceptions.
 void show_info(Object message)
          Displays an informational dialog with the given message.
 void show_info(Object message, String title)
          Displays an informational dialog with the given message and title.
 void show_plain(Object message)
          Displays a plain dialog with the given message.
 void show_plain(Object message, String title)
          Displays a plain dialog with the given message and title.
 void show_warning(Object message)
          Displays a warning dialog with the given messsage.
 void show_warning(Object message, String title)
          Displays a warning dialog with the given message and title.
 String warning_title()
          Gets the default title used for warning alerts.
 void warning_title(String warning_title)
          Sets the default title used for warning alerts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values
Constructor Detail

Alerts

public Alerts(Component location_component,
              String title_prefix)
Creates a new alert manager with the given location component and title prefix. The alerts manager uses the location_component to determine the placement of the alerts on the screen. If it is null, a hidden, shared frame is used, centering the dialog on the primary monitor.

The title_prefix is used as the prefix for all alert titles. If the prefix is null, a generic prefix is used. Plain alerts use the title prefix alone. Informational alerts use the prefix plus "Info." Warning alerts use the prefix plus "Warning." Error alerts use the prefix plus "Error." The plain_title(String), info_title(String), warning_title(String), and error_title(String) can modify the alert titles. Furthermore, each alert can be invoked with its own, arbitrary title as well.

Parameters:
location_component - the location component; may be null.
title_prefix - the prefix for the alert titles; may be null.

Alerts

public Alerts(Component location_component)
Creates a new alert manager with the given location component. A generic title prefix is used for the alert titles.

Parameters:
location_component - the location component; may be null.
See Also:
Alerts(Component,String)

Alerts

public Alerts(String title_prefix)
Creates a new alert manager with the given title prefix. A shared, hidden frame is used for the location component, centering the alerts on the primary monitor.

Parameters:
title_prefix - the prefix for the alert titles; may be null.
See Also:
Alerts(Component,String)

Alerts

public Alerts()
Creates a new alert manager with a generic title prefix for the alert titles. A shared, hidden frame is used for the location component, centering the alerts on the primary monitor.

See Also:
Alerts(Component,String)
Method Detail

location_component

public Component location_component()
Gets the alert manager's location component. Dialogs use this component for their placement on the screen. If null, a shared, hidden frame is used, centering the dialog on the primary monitor.

Returns:
the manager's location component.

location_component

public void location_component(Component location_component)
Sets the alert manager's location component. Dialogs use this component for their placement on the screen. If null, a shared, hidden frame is used, centering the dialog on the primary monitor.

Parameters:
location_component - the new location component; may be null.

plain_title

public String plain_title()
Gets the default title used for plain alerts.

Returns:
the plain alert default title.
See Also:
show_plain(java.lang.Object, java.lang.String)

plain_title

public void plain_title(String plain_title)
Sets the default title used for plain alerts.

Parameters:
plain_title - the new title for plain alerts.
See Also:
show_plain(java.lang.Object, java.lang.String)

info_title

public String info_title()
Gets the default title used for informational alerts.

Returns:
the informational alert default title.
See Also:
show_info(java.lang.Object, java.lang.String)

info_title

public void info_title(String info_title)
Sets the default title used for informational alerts.

Parameters:
info_title - the new title for informational alerts.
See Also:
show_info(java.lang.Object, java.lang.String)

warning_title

public String warning_title()
Gets the default title used for warning alerts.

Returns:
the warning alert default title.
See Also:
show_warning(java.lang.Object, java.lang.String)

warning_title

public void warning_title(String warning_title)
Sets the default title used for warning alerts.

Parameters:
warning_title - the new title for warning alerts.
See Also:
show_warning(java.lang.Object, java.lang.String)

error_title

public String error_title()
Gets the default title used for error alerts.

Returns:
the error alert default title.
See Also:
show_error(java.lang.Object, java.lang.String)

error_title

public void error_title(String error_title)
Sets the default title used for error alerts.

Parameters:
error_title - the new title for error alerts.
See Also:
show_error(java.lang.Object, java.lang.String)

show_plain

public void show_plain(Object message,
                       String title)
Displays a plain dialog with the given message and title.

Parameters:
message - the alert message.
title - the alert title.

show_plain

public void show_plain(Object message)
Displays a plain dialog with the given message. The manager's plain_title is used for the dialog's title.

Parameters:
message - the alert message.

show_info

public void show_info(Object message,
                      String title)
Displays an informational dialog with the given message and title.

Parameters:
message - the alert message.
title - the alert title.

show_info

public void show_info(Object message)
Displays an informational dialog with the given message. The manager's info_title is used for the dialog's title.

Parameters:
message - the alert message.

show_warning

public void show_warning(Object message,
                         String title)
Displays a warning dialog with the given message and title.

Parameters:
message - the alert message.
title - the alert title.

show_warning

public void show_warning(Object message)
Displays a warning dialog with the given messsage. The manager's warning_title is used for the dialog's title.

Parameters:
message - the alert message.

show_error

public void show_error(Object message,
                       String title)
Displays an error dialog with the given message and title.

Parameters:
message - the alert message.
title - the alert title.

show_error

public void show_error(Object message)
Displays an error dialog with the given message. The manager's error_title is used for the dialog's title.

Parameters:
message - the alert message.

show_error

public void show_error(String message,
                       Throwable throwable,
                       String title)
Displays an error dialog designed for exceptions. The message string is displayed at the top of the dialog, followed by the message extracted from the throwable.

Note that, unlike the other dialog display methods of the alert manager, the message of this method is a String, not a general Object.

Parameters:
message - the error dialog's message.
throwable - the source of the full error message details.
title - the error dialog's title.

show_error

public void show_error(String message,
                       Throwable throwable)
Displays an error dialog designed for exceptions. The manager's error_title is used for the dialog's title.

Parameters:
message - the error dialog's message.
throwable - the source of the full error message details.
See Also:
show_error(String,Throwable,String)

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona