/** Whether the debug mode is activated. */
private static boolean debug = false;
+ /** The version. */
+ private static final Version VERSION = new Version(0, 6, 2);
+
/** The configuration. */
private Configuration configuration;
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent e) {
- JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), Version.getVersion()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
+ JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), getVersion().toString()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
}
};
return SUPPORTED_LOCALES[0];
}
+ /**
+ * Returns the version.
+ *
+ * @return The version
+ */
+ public static final Version getVersion() {
+ return VERSION;
+ }
+
//
// ACTIONS
//
*/
public class Version implements Comparable<Version> {
- /** The version. */
- private static final Version VERSION = new Version(0, 6, 2);
-
/** The components of the version information. */
private final int[] components;
}
/**
- * Returns the version.
+ * Parses a version from the given string.
*
- * @return The version
+ * @param versionString
+ * The version string to parse
+ * @return The parsed version, or <code>null</code> if the string could not
+ * be parsed
*/
- public static final String getVersion() {
- return VERSION.toString();
+ public static Version parse(String versionString) {
+ String[] componentStrings = versionString.split("\\.");
+ int[] components = new int[componentStrings.length];
+ int index = -1;
+ for (String componentString : componentStrings) {
+ try {
+ components[++index] = Integer.parseInt(componentString);
+ } catch (NumberFormatException nfe1) {
+ return null;
+ }
+ }
+ return new Version(components);
}
/**