Package ca.corbett.extras.about
Class AboutInfo
java.lang.Object
ca.corbett.extras.about.AboutInfo
Populate an instance of this class and then hand it to AboutDialog or AboutPanel to very quickly
and easily create an "about this app" type of display for the user. Most fields here are optional.
If present, they will be included in the resulting About view. It's recommended to include a
logo image for your application around 480x90 or so and specify it here. If not supplied,
the About code will try to generate one automatically based on the applicationName specified here.
- Since:
- 2018-02-14
- Author:
- scorbo2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumUsed to determine how to display the application logo image on the AboutPanel. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe user-friendly name of the application, typically taken from Version.NAME.The user-friendly version of the application, typically in "X.Y" format.The copyright notice for this application, if there is one.The license name or url for this application, if there is one.How the application logo image should be displayed on the AboutPanel.The resource url location of the application logo image.The project URL for this project, if there is one.The resource url location of the release notes text file.You can alternatively specify release notes as a String.An optional user-friendly short description of the application.booleanIndicates whether or not to add a link to open the LogConsole window. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomField(String name, String value) Adds a custom field value which will be displayed in the AboutPanel or AboutDialog.voidRemoves all custom fields from this AboutInfo.Returns a list of custom field names.getCustomFieldValue(String name) Returns the current value for the named custom field, if there is one.voidupdateCustomField(String name, String value) Modifies the value of a custom field, identified by "name".
-
Field Details
-
applicationName
The user-friendly name of the application, typically taken from Version.NAME. -
applicationVersion
The user-friendly version of the application, typically in "X.Y" format. -
copyright
The copyright notice for this application, if there is one. -
license
The license name or url for this application, if there is one. If this starts with http:// or https://, the link will be clickable (assuming clickable links are supported and allowed in this JRE). -
projectUrl
The project URL for this project, if there is one. If this starts with http:// or https://, the link will be clickable (assuming clickable links are supported and allowed in this JRE). -
logoImageLocation
The resource url location of the application logo image. Example: "/application_name/images/logo_wide.jpg". If this is null or non-existent, a logo image will automatically be generated using the contents of applicationName. -
releaseNotesLocation
The resource url location of the release notes text file. Example: "/application_name/ReleaseNotes.txt" -
releaseNotesText
You can alternatively specify release notes as a String. If both releaseNotesLocation and releaseNotesText are specified, then releaseNotesText will be used. -
shortDescription
An optional user-friendly short description of the application. If null or empty, this field will not be shown at all. Will be truncated at 60 chars for space reasons, so keep it brief. -
logoDisplayMode
How the application logo image should be displayed on the AboutPanel. See LogoDisplayMode for available options. If not specified, the image will be stretched a bit to fit the width of the form, so horizontally rectangular images work best here. -
showLogConsole
public boolean showLogConsoleIndicates whether or not to add a link to open the LogConsole window. Defaults to false. If true, the application logo will be clickable as a bit of an easter egg thing to open the LogConsole.
-
-
Constructor Details
-
AboutInfo
public AboutInfo()Creates a new, blank AboutInfo instance. -
AboutInfo
public AboutInfo(boolean showLogConsole) Creates a new, blank AboutInfo instance with the given showLogConsole option.- Parameters:
showLogConsole- If true, the logo image on AboutPanel will be clickable.
-
-
Method Details
-
addCustomField
Adds a custom field value which will be displayed in the AboutPanel or AboutDialog. Note that you must invoke this with your custom field data BEFORE the AboutPanel or AboutDialog is rendered. Invoking this with a new field after rendering will do nothing. If the value of a custom field has changed since the AboutPanel or AboutDialog was rendered, use updateCustomField instead.- Parameters:
name- Any String which uniquely identifies this field. Will not be shown.value- The String value to display.
-
updateCustomField
Modifies the value of a custom field, identified by "name". This can be invoked after this AboutInfo has been rendered, and will update the containing AboutPanel accordingly.- Parameters:
name- The String which identifies the field to update.value- The new value for the field.
-
getCustomFieldValue
Returns the current value for the named custom field, if there is one.- Parameters:
name- The String which identifies the field in question.- Returns:
- The String value of the custom field, or null if no such field.
-
clearCustomFields
public void clearCustomFields()Removes all custom fields from this AboutInfo. Note that you must invoke this before the AboutPanel or AboutDialog is rendered, or nothing will happen. -
getCustomFieldNames
Returns a list of custom field names.- Returns:
- A list of custom field names, if any.
-