core
Class Version

java.lang.Object
  extended by javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
      extended by core.Version
All Implemented Interfaces:
java.lang.Runnable, java.util.concurrent.Future<java.lang.Void>, java.util.concurrent.RunnableFuture<java.lang.Void>

public class Version
extends javax.swing.SwingWorker<java.lang.Void,java.lang.Void>

The Version class handles version checking for iTunesDSM. The class polls a webserver for the most up to date version of iTunesDSM.


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.SwingWorker
javax.swing.SwingWorker.StateValue
 
Field Summary
static Version ITUNESDSM_VERSION
          Returns the current Version object of the iTunesDSM program.
 
Constructor Summary
Version()
          Creates a new Version object where showUpToDataDialog is set to true, i.e.
Version(boolean showUpToDateDialog)
          Creates a new Version object with the option of showing the dialog that confirms the newest version of iTunesDSM.
Version(int major, int minor, int bugfix)
          Creates a new Version object given the major, minor, and bug fix integers.
 
Method Summary
 java.lang.Void doInBackground()
          The SwingWorker doInBackground method downloads information on the latest release and compares that with the current release.
 void done()
           
 boolean equals(Version testVersion)
          Tests whether or not to the version object is equal to another version object.
 int getBugFixVersion()
          Returns the bug fix version.
 Version getLatestITDSMVersion()
          Reads the newest version information from a file on a webserver.
 int getMajorVersion()
          Returns the version's major version integer.
 int getMinorVersion()
          Returns the version's minor version integer.
 java.lang.String getVersionDetails()
          Returns version details.
 boolean isUpToDate(Version onlineVersion)
          Determines whether this Version object is an newer version than the given olderVersion object.
static void main(java.lang.String[] args)
           
static Version parseVersion(java.lang.String versionString)
          Parses a version string.
 void setBugFixVersion(int bugFixVersion)
          Sets the bug fix version integer.
 void setMajorVersion(int majorVersion)
          Sets the verion's major version integer.
 void setMinorVersion(int minorVersion)
          Sets the version's minor version number.
 java.lang.String toString()
          Returns a formatted String object of the version object.
 
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ITUNESDSM_VERSION

public static final Version ITUNESDSM_VERSION
Returns the current Version object of the iTunesDSM program.

Constructor Detail

Version

public Version()
Creates a new Version object where showUpToDataDialog is set to true, i.e. a dialog box will confirm the user is using the most up to date version of iTunesDSM.


Version

public Version(boolean showUpToDateDialog)
Creates a new Version object with the option of showing the dialog that confirms the newest version of iTunesDSM.

Parameters:
showUpToDateDialog -

Version

public Version(int major,
               int minor,
               int bugfix)
Creates a new Version object given the major, minor, and bug fix integers.

Parameters:
major - The major version number.
minor - The minor version number.
bugfix - The bugfix version number.
Method Detail

doInBackground

public java.lang.Void doInBackground()
The SwingWorker doInBackground method downloads information on the latest release and compares that with the current release. If a new version is available the user is able to open the iTunesDSM blog homepage.

Specified by:
doInBackground in class javax.swing.SwingWorker<java.lang.Void,java.lang.Void>
Returns:
Boolean Whether or not there is an update to iTunesDSM.

done

public void done()
Overrides:
done in class javax.swing.SwingWorker<java.lang.Void,java.lang.Void>

getVersionDetails

public java.lang.String getVersionDetails()
Returns version details.

Returns:
The version details.

isUpToDate

public boolean isUpToDate(Version onlineVersion)
Determines whether this Version object is an newer version than the given olderVersion object.

Parameters:
onlineVersion - The proposed Version object.
Returns:
If true, this version is an old version compared to the given version. Otherwise, this version is the same or newer than the given Version.

getLatestITDSMVersion

public Version getLatestITDSMVersion()
Reads the newest version information from a file on a webserver.

Returns:
The latest version information from a webserver.

getBugFixVersion

public int getBugFixVersion()
Returns the bug fix version. For example in the X.Y.Z version string, the Z is returned.

Returns:
The bug fix integer of a version. For example, in the version X.Y.Z, Z is returned.

setBugFixVersion

public void setBugFixVersion(int bugFixVersion)
Sets the bug fix version integer.

Parameters:
bugFixVersion - The bug fix integer to set the version's bug fix integer to.

getMajorVersion

public int getMajorVersion()
Returns the version's major version integer. In a version string X.Y.Z, X is returned.

Returns:
The version's major version integer. In a version string X.Y.Z, X is returned.

setMajorVersion

public void setMajorVersion(int majorVersion)
Sets the verion's major version integer.

Parameters:
majorVersion - The major versions integer to set the version to. In the version string X.Y.Z, X will be set to majorVersion.

getMinorVersion

public int getMinorVersion()
Returns the version's minor version integer. In the version string X.Y.Z, Y is returned.

Returns:
The version's minor version integer. In the version string X.Y.Z, Y is returned.

setMinorVersion

public void setMinorVersion(int minorVersion)
Sets the version's minor version number. In the version string X.Y.Z, Y is set to the given integer.

Parameters:
minorVersion - The integer to set the version's minor version integer to.

equals

public boolean equals(Version testVersion)
Tests whether or not to the version object is equal to another version object.

Parameters:
testVersion - The version object to test against.
Returns:
Whether or not the two version objects are equal.

parseVersion

public static Version parseVersion(java.lang.String versionString)
Parses a version string. A valid version String is of the form X.Y.Z where X,Y, and Z are positive integers seperated by a '.'.

Parameters:
versionString - The string to parse the version numbers from.
Returns:
The Version object parsed by the given string.

toString

public java.lang.String toString()
Returns a formatted String object of the version object.

Overrides:
toString in class java.lang.Object
Returns:
A formatted String object of the version object.

main

public static void main(java.lang.String[] args)