Commit 4ea4f6e3 authored by firegnom's avatar firegnom
Browse files

small changes - cleanup is still in progress after split in to two libraries

parent ee35b321
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>mvplan</groupId>
<artifactId>mvplan</artifactId>
<packaging>jar</packaging>
<version>1.6-SNAPSHOT</version>
<name>Mvplan GUI</name>
<artifactId>mvplan</artifactId>
<packaging>jar</packaging>
<name>MV-Plan GUI</name>
<parent>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mvplan</groupId>
<artifactId>mvplan_core</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependencies>
<dependency>
<groupId>jgoodies</groupId>
<artifactId>looks</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
<build>
<groupId>mvplan</groupId>
<artifactId>mvplan_core</artifactId>
<version>1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>jgoodies</groupId>
<artifactId>looks</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/mvplan.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>mvplan.main.Mvplan</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/mvplan.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>mvplan.main.Mvplan</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</build>
</project>
\ No newline at end of file
......@@ -681,7 +681,7 @@ public class MainFrame extends JFrame
printButton.setText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.printButton.text"));
printButton.setToolTipText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.printButton.tip"));
aboutButton.setText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.aboutButton.text"));
aboutButton.setToolTipText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.aboutButton.tip")+Mvplan.NAME);
aboutButton.setToolTipText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.aboutButton.tip")+MvplanInstance.NAME);
progress.setToolTipText(MvplanInstance.getMvplan().getResource("mvplan.gui.MainFrame.progress.check.tip"));
progress.setFocusable(false);
......@@ -996,7 +996,7 @@ public class MainFrame extends JFrame
// "MV-Plan GF:20/90 ZHL16B" or dislay altitude instead of model
h=(int)Math.round(Mvplan.prefs.getGfHigh()*100);
l=(int)Math.round(Mvplan.prefs.getGfLow()*100);
String heading=String.format("%1$s GF:%2$02d/%3$02d",Mvplan.NAME,l,h);
String heading=String.format("%1$s GF:%2$02d/%3$02d",MvplanInstance.NAME,l,h);
// Display single dive table, or ...
if(currentModel!=null) {
if(Mvplan.prefs.getAltitude()>0.0)
......@@ -1269,7 +1269,7 @@ public class MainFrame extends JFrame
private void doAbout() {
// Use HTML message for better font control and word wrapping
String s,s2;
s="<html><p>"+Mvplan.appName+" ("+Mvplan.BUILD_DATE+")</p>";
s="<html><p>"+Mvplan.appName+" ("+MvplanInstance.BUILD_DATE+")</p>";
s=s+"<p>\u00A9 2005-2010 Guy Wittig&nbsp</p>";
// Add localisation credit string
try{
......
......@@ -37,32 +37,25 @@ import javax.swing.UIManager;
public class Mvplan implements IMvplan
{
public static final String NAME = "MV-Plan"; // Application name
public static final int MAJOR_VERSION = 1; // Application version codes
public static final int MINOR_VERSION = 6;
public static final int PATCH_VERSION = 0;
public static final String VERSION_STATUS = "RELEASED"; // Application status
public static final String BUILD_DATE = "25-Dec-2010"; // Application release date
private static final float MIN_JVM = 1.5f; // Minimum Java JVM requirement. Checked on startup.
static final String PREF_FILE = "mvplan.xml"; // Preferences file name
public static String prefFile;
public static final int DEBUG = 2; // 0 == no debug, 1 == basic or current debug, 2 == full trace
public static Prefs prefs; // Preferences object. Pseudo Singleton.
private static ResourceBundle stringResource; // String resources for the application
public static Locale preferredLocale=new Locale("pl"); // For language preference
public static Locale preferredLocale=new Locale("en"); // For language preference
public static String appName;
public static Version mvplanVersion; // App version. See Version Class
private JFrame frame;
public void init(){
float vmVersion=0.0f; // For Virtual Machine version
ArrayList<Locale> availableLocales = new ArrayList(); // Stores available locales
ArrayList<Locale> availableLocales = new ArrayList<Locale>(); // Stores available locales
// Construct app name and version
mvplanVersion=new Version(MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,VERSION_STATUS,BUILD_DATE);
appName=NAME+" "+mvplanVersion.toString();
appName=MvplanInstance.NAME+" "+MvplanInstance.getVersion().toString();
// Set patform specifics
if (Mvplan.DEBUG > 0 ) System.out.println("Platform:"+PlatformDetector.detect());
......@@ -146,7 +139,6 @@ public class Mvplan implements IMvplan
* Provide safe access to resources.
* Does not throw exception if a resoure is not found, but displays it's key so it can be debugged.
*/
@Override
public String getResource (String key) {
try {
return stringResource.getString(key);
......@@ -156,13 +148,11 @@ public class Mvplan implements IMvplan
return "<"+key+">";
}
}
public String getAppName() {
return appName;
}
public static void main(String[] args)
{
java.awt.EventQueue.invokeLater(new Runnable() {
......@@ -172,18 +162,12 @@ public class Mvplan implements IMvplan
});
}
@Override
public Prefs getPrefs() {
return Mvplan.prefs;
}
@Override
public int getDebug() {
return Mvplan.DEBUG;
}
@Override
public Version getVersion() {
return Mvplan.mvplanVersion;
}
}
......@@ -80,8 +80,8 @@ public class VersionManager {
// If we get here we were successful. Update last check time
MvplanInstance.getMvplan().getPrefs().setLastUpdateCheck(Calendar.getInstance().getTime());
if(MvplanInstance.getMvplan().getDebug()>0) System.out.println("Current version is "+MvplanInstance.getMvplan().getVersion().toString()+". Latest version is "+latestVersion.toString());
if(MvplanInstance.getMvplan().getVersion().compareTo(latestVersion)>0 ) {
if(MvplanInstance.getMvplan().getDebug()>0) System.out.println("Current version is "+MvplanInstance.getVersion().toString()+". Latest version is "+latestVersion.toString());
if(MvplanInstance.getVersion().compareTo(latestVersion)>0 ) {
if(MvplanInstance.getMvplan().getDebug()>0) System.out.println("Version Manager has determined that a newer version is available.");
resultCode=UPDATE;
return;
......
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>mvplan</groupId>
<artifactId>mvplan_core</artifactId>
<packaging>jar</packaging>
<version>1.6-SNAPSHOT</version>
<name>MV Plan Lib</name>
<artifactId>mvplan_core</artifactId>
<packaging>jar</packaging>
<name>MV-Plan Lib</name>
<parent>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
......
......@@ -49,6 +49,14 @@ public class TextProfilePrinter extends ProfilePrinter <StringBuffer>{
this.knownGases = knownGases;
disclaimer = mvplan.getResource("mvplan.disclaimer.text");
}
/** Creates a new instance of ProfilePrinter */
public TextProfilePrinter(Profile p, StringBuffer text) {
super(p, text, p.getGases());
this.profile=p;
this.textArea=text;
this.knownGases = p.getGases();
disclaimer = mvplan.getResource("mvplan.disclaimer.text");
}
/*
* Prints the dive table
*/
......
......@@ -17,6 +17,5 @@ public interface IMvplan {
public String getAppName();
public Prefs getPrefs();
public int getDebug();
public Version getVersion();
public void init();
}
......@@ -6,27 +6,45 @@
package mvplan.main;
import mvplan.prefs.Prefs;
import mvplan.util.Version;
/**
*
*
* @author Maciej Kaniewski
*/
public class MvplanInstance {
private static IMvplan mvplan;
public static Prefs getPrefs(){
if (mvplan != null){
return mvplan.getPrefs();
}
return null;
}
public static IMvplan getMvplan(){
return mvplan;
}
public static void setMvplan(IMvplan m){
mvplan = m;
mvplan.init();
}
public static final String NAME = "MV-Plan"; // Application name
public static final int MAJOR_VERSION = 1; // Application version codes
public static final int MINOR_VERSION = 6;
public static final int PATCH_VERSION = 0;
public static final String VERSION_STATUS = "BETA"; // Application status
public static final String BUILD_DATE = "10-04-2012"; // Application
// release date
public static Version mvplanVersion; // App version. See Version Class
private static IMvplan mvplan;
static{
mvplanVersion=new Version(MAJOR_VERSION,MINOR_VERSION,PATCH_VERSION,VERSION_STATUS,BUILD_DATE);
}
public static Prefs getPrefs() {
if (mvplan != null) {
return mvplan.getPrefs();
}
return null;
}
public static IMvplan getMvplan() {
return mvplan;
}
public static void setMvplan(IMvplan m) {
mvplan = m;
mvplan.init();
}
public static Version getVersion() {
return mvplanVersion;
}
}
......@@ -83,8 +83,8 @@ public class Prefs implements Serializable
private int frameSizeY;
private int frameSplit;
private boolean gfMultilevelMode; // On multilevel mode the gf does not get set until final ascent.
private ArrayList prefGases; // Stores known gas list
private ArrayList prefSegments; // Stores dive segments
private ArrayList <Gas> prefGases; // Stores known gas list
private ArrayList <SegmentAbstract> prefSegments; // Stores dive segments
private String lastModelFile; // Stores last model filename used
private boolean agreedToTerms;
public static final int BRIEF=0;
......@@ -374,8 +374,8 @@ public class Prefs implements Serializable
public int getFrameSizeY() { return frameSizeY; }
public int getFrameSplit() { return frameSplit; }
public boolean getGfMultilevelMode() { return gfMultilevelMode; }
public ArrayList getPrefGases() { return prefGases; }
public ArrayList getPrefSegments() { return prefSegments; }
public ArrayList <Gas> getPrefGases() { return prefGases; }
public ArrayList <SegmentAbstract>getPrefSegments() { return prefSegments; }
public String getLastModelFile() { return lastModelFile; }
public double getPAmb() { return pAmb; }
public double getPConversion() { return pConversion; }
......
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<packaging>pom</packaging>
<version>1.6-SNAPSHOT</version>
<name>Mvplan parent</name>
<groupId>mvplan</groupId>
<artifactId>mvplan-parent</artifactId>
<packaging>pom</packaging>
<version>1.6-SNAPSHOT</version>
<name>MV-Plan parent</name>
<modules>
<modules>
<module>mvplan_core</module>
<module>mvplan</module>
</modules>
<module>mvplan</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment