net.ctdp.rfdynhud.widgets.base.widget
Class WidgetPackage

java.lang.Object
  extended by net.ctdp.rfdynhud.widgets.base.widget.WidgetPackage
All Implemented Interfaces:
java.lang.Comparable<WidgetPackage>

public class WidgetPackage
extends java.lang.Object
implements java.lang.Comparable<WidgetPackage>

The WidgetPackage class encapsulates properties for a Widget's virtual package.

Author:
Marvin Froehlich (CTDP)

Field Summary
static java.net.URL CTDP_ICON
           
static java.net.URL EXTRA_ICON
           
 
Constructor Summary
WidgetPackage(java.lang.String name, int version)
          Creates a new WidgetPackage instance.
WidgetPackage(java.lang.String name, int version, java.io.File... iconFiles)
          Creates a new WidgetPackage instance.
WidgetPackage(java.lang.String name, int version, java.net.URL... iconURLs)
          Creates a new WidgetPackage instance.
 
Method Summary
 int compareTo(WidgetPackage o)
           
static int composeVersion(int major, int minor, int revision)
          Composes one 32 bit integer from major, minor and revision numbers.
 boolean equals(java.lang.Object o)
          
 javax.swing.Icon[] getIcons()
          Gets the package's icons to be displayed in the editor.
 java.lang.String getName()
          Gets the package's name.
 int getVersion()
          Gets a comparable version indicator for this WidgetPackage.
 java.lang.String getVersionString()
           
 int hashCode()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CTDP_ICON

public static final java.net.URL CTDP_ICON

EXTRA_ICON

public static final java.net.URL EXTRA_ICON
Constructor Detail

WidgetPackage

public WidgetPackage(java.lang.String name,
                     int version,
                     java.net.URL... iconURLs)
Creates a new WidgetPackage instance.

Parameters:
name - the package name. This can be null or an empty string to denote the root of the menu or a slash separated path.
version - see composeVersion(int, int, int)
iconURLs - URLs to icons for the editor

WidgetPackage

public WidgetPackage(java.lang.String name,
                     int version,
                     java.io.File... iconFiles)
Creates a new WidgetPackage instance.

Parameters:
name - the package name. This can be null or an empty string to denote the root of the menu or a slash separated path.
version - see composeVersion(int, int, int)
iconFiles - files for icons for the editor

WidgetPackage

public WidgetPackage(java.lang.String name,
                     int version)
Creates a new WidgetPackage instance.

Parameters:
name - the package name. This can be null or an empty string to denote the root of the menu or a slash separated path.
version - see composeVersion(int, int, int)
Method Detail

getName

public final java.lang.String getName()
Gets the package's name.

Returns:
the package's name.

composeVersion

public static final int composeVersion(int major,
                                       int minor,
                                       int revision)
Composes one 32 bit integer from major, minor and revision numbers.

Parameters:
major - major field
minor - minor field
revision - revision field
Returns:
a 32 bit integer for the version.

getVersion

public final int getVersion()
Gets a comparable version indicator for this WidgetPackage.

Returns:
a comparable version indicator for this WidgetPackage.

getVersionString

public final java.lang.String getVersionString()

getIcons

public final javax.swing.Icon[] getIcons()
Gets the package's icons to be displayed in the editor.

Returns:
the package's icon for the editor or null.

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(WidgetPackage o)
Specified by:
compareTo in interface java.lang.Comparable<WidgetPackage>

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object