Commit 2ac8b11f authored by SAPONE Alann's avatar SAPONE Alann

Preset web browser - Splashscreen - bug correction

parent c7164cb9
<?xml version="1.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/xsd/maven-4.0.0.xsd" xmlns:pom="http://maven.apache.org/POM/4.0.0">
<parent>
<artifactId>ETC</artifactId>
<groupId>org.cnrs.lam.dis</groupId>
<version>0.5.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ETC-Calculator</artifactId>
<name>ETC-Calculator</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<show>private</show>
<taglets>
<taglet>
<tagletClass>latexlet.InlineLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
<taglet>
<tagletClass>latexlet.BlockLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
<taglet>
<tagletClass>latexlet.InlineBlockLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
</taglets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>0.5.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Configuration</artifactId>
<version>0.5.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.cesam</groupId>
<artifactId>CeSAMUtilsJ</artifactId>
<version>0.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>0.5.5-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>org.cnrs.lam.dis</groupId>
<?xml version="1.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/xsd/maven-4.0.0.xsd"
xmlns:pom="http://maven.apache.org/POM/4.0.0">
<parent>
<artifactId>ETC</artifactId>
<groupId>org.cnrs.lam.dis</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ETC-Calculator</artifactId>
<name>ETC-Calculator</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<show>private</show>
<taglets>
<taglet>
<tagletClass>latexlet.InlineLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
<taglet>
<tagletClass>latexlet.BlockLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
<taglet>
<tagletClass>latexlet.InlineBlockLaTeXlet</tagletClass>
<tagletArtifact>
<groupId>latexlet</groupId>
<artifactId>latexlet</artifactId>
<version>1.0</version>
</tagletArtifact>
</taglet>
</taglets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Configuration</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.cesam</groupId>
<artifactId>CeSAMUtilsJ</artifactId>
<version>0.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>org.cnrs.lam.dis</groupId>
</project>
......@@ -5,7 +5,7 @@
<parent>
<artifactId>ETC</artifactId>
<groupId>org.cnrs.lam.dis</groupId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</parent>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Configuration</artifactId>
......
......@@ -3,7 +3,7 @@
<parent>
<artifactId>ETC</artifactId>
<groupId>org.cnrs.lam.dis</groupId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ETC-Controller</artifactId>
......@@ -22,45 +22,55 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Plugins-Implementations</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Configuration</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Persistence</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Calculator</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataImportExport</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-UI</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Plugins</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.astrogrid</groupId>
......@@ -71,35 +81,35 @@
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataModel</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Persistence</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-Calculator</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-UI</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cnrs.lam.dis</groupId>
<artifactId>ETC-DataImportExport</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>1.0.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
......
......@@ -56,6 +56,7 @@ import org.cnrs.lam.dis.etc.dataimportexport.WrongFormatException;
import org.cnrs.lam.dis.etc.datamodel.Dataset;
import org.cnrs.lam.dis.etc.datamodel.DatasetInfo;
import org.cnrs.lam.dis.etc.persistence.DatasetManager;
import org.javatuples.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
......@@ -120,8 +121,8 @@ class DbInstaller {
logger.info("Default database tables created successfully");
}
static void importDatasetList(URL url, DataImporter dataImporter, DatasetManager datasetManager) throws IOException {
InputStream inStream;
static Pair<Scanner, Boolean> getDatasetList(URL url, DataImporter dataImporter, DatasetManager datasetManager) throws IOException {
InputStream inStream;
boolean isDefault;
if (url == null) {
logger.info("Initializing default database with default datasets...");
......@@ -133,7 +134,14 @@ class DbInstaller {
inStream = url.openStream();
isDefault = false;
}
Scanner in = new Scanner(inStream);
Pair<Scanner, Boolean> in = new Pair<Scanner, Boolean>(new Scanner(inStream), isDefault);
return in;
}
static void importDatasetList(URL url, DataImporter dataImporter, DatasetManager datasetManager) throws IOException {
Pair<Scanner, Boolean> inPair = getDatasetList(url, dataImporter, datasetManager);
Scanner in = inPair.getValue0();
boolean isDefault = inPair.getValue1();
in.useDelimiter("}");
while (in.hasNext()) {
String datasetInfo = in.next();
......@@ -223,7 +231,7 @@ class DbInstaller {
logger.info("Default database tables created successfully");
}
private static void importDataset(String datasetInfo, DataImporter dataImporter, DatasetManager datasetManager, boolean isDefault) {
public static void importDataset(String datasetInfo, DataImporter dataImporter, DatasetManager datasetManager, boolean isDefault) {
logger.info("Importing default dataset...");
Map<String, String> datasetInfoMap = new HashMap<String, String>();
for (String pair : datasetInfo.split("\n")) {
......
......@@ -50,11 +50,16 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import javax.swing.JOptionPane;
import org.apache.log4j.Logger;
import org.cnrs.lam.dis.etc.calculator.util.Units;
import org.cnrs.lam.dis.etc.dataimportexport.DataImportExportFactory;
import org.cnrs.lam.dis.etc.dataimportexport.DataImporter;
import org.cnrs.lam.dis.etc.datamodel.FilterBand;
import org.cnrs.lam.dis.etc.persistence.DatasetManager;
import org.cnrs.lam.dis.etc.persistence.PersistenceFactory;
import org.javatuples.Pair;
/**
......@@ -63,7 +68,7 @@ import org.javatuples.Pair;
*/
final class DbUpdater {
private static final int DB_VERSION = 29;
private static final int DB_VERSION = 30;
private static Logger logger = Logger.getLogger(DbUpdater.class);
private DbUpdater() {
......@@ -380,6 +385,29 @@ final class DbUpdater {
statement.executeUpdate("ALTER TABLE SITE ADD ATMOSPHERIC_TRANSMISSION_TYPE VARCHAR(255) NOT NULL DEFAULT 'ABSORPTION_EXTINCTION'");
}
// Adds dataset for zodiacal lights
private static void updateFromVersion29To30(Statement statement) throws SQLException {
DataImporter dataImporter = DataImportExportFactory.getDataImporter();
DatasetManager datasetManager = PersistenceFactory.getDatasetManager();
try {
Pair<Scanner, Boolean> inPair = DbInstaller.getDatasetList(null, dataImporter, datasetManager);
Scanner in = inPair.getValue0();
boolean isDefault = inPair.getValue1();
in.useDelimiter("}");
while (in.hasNext()) {
String datasetInfo = in.next();
datasetInfo = datasetInfo.substring(datasetInfo.indexOf('{')+1).trim();
if (datasetInfo.contains("name=High Ecliptic Zodiacal Light") || datasetInfo.contains("name=Low Ecliptic Zodiacal Light")) {
DbInstaller.importDataset(datasetInfo, dataImporter, datasetManager, isDefault);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
static void updateDatabase() {
Connection connection = null;
try {
......
......@@ -69,6 +69,7 @@ import org.cnrs.lam.dis.etc.ui.SiteListener;
import org.cnrs.lam.dis.etc.ui.SourceListener;
import org.cnrs.lam.dis.etc.ui.UIFactory;
import org.cnrs.lam.dis.etc.ui.UIManager;
import org.cnrs.lam.dis.etc.ui.swing.SplashScreen;
/**
*
......@@ -82,6 +83,8 @@ public class ETC42 {
// Initialize the logging
initializeLogger();
SplashScreen.getInstance().setProgression("Initialization");
// Set the directory where the database is stored
System.setProperty("derby.system.home", ConfigFactory.getConfig().getEtcHome());
......@@ -106,35 +109,68 @@ public class ETC42 {
DatasetManager datasetManager = PersistenceFactory.getDatasetManager();
SessionManager sessionManager = PersistenceFactory.getSessionManager();
SplashScreen.getInstance().setProgression("Loading messenger");
Messenger messenger = UIFactory.getMessenger();
SplashScreen.getInstance().setProgression("Loading plugin manager");
PluginManager pluginManager = PluginFactory.getPluginManager();
SplashScreen.getInstance().setProgression("Loading info provider");
InfoProvider infoProvider = new InfoProviderImpl(datasetManager, sessionManager, messenger, pluginManager);
SplashScreen.getInstance().setProgression("Loading user interface");
UIManager uiManager = UIFactory.getUIManager(infoProvider);
SplashScreen.getInstance().setProgression("Loading calculator");
Calculator calculator = CalculatorFactory.getCalculator();
Validator validator = CalculatorFactory.getValidator();
SplashScreen.getInstance().setProgression("Loading dataset provider");
DatasetProvider datasetProvider = new DatasetProviderImpl(datasetManager);
SplashScreen.getInstance().setProgression("Loading plugin comunicator");
PluginCommunicator pluginCommunicator = new PluginCommunicatorImpl(datasetProvider, infoProvider, datasetManager, uiManager, calculator);
pluginManager.setCommunicator(pluginCommunicator);
SplashScreen.getInstance().setProgression("Loading location component");
pluginManager.setLocationComponent(UIFactory.getLocationComponent());
SplashScreen.getInstance().setProgression("Loading buisness listener");
BuisnessListener buisnessListener = new BuisnessListenerImpl(validator, calculator, messenger, uiManager, datasetProvider, pluginManager);
uiManager.setBuisnessListener(buisnessListener);
SplashScreen.getInstance().setProgression("Loading data importer/exporter");
DataExporter dataExporter = DataImportExportFactory.getDataExporter();
DataImporter dataImporter = DataImportExportFactory.getDataImporter();
SplashScreen.getInstance().setProgression("Loading instrument listener");
InstrumentListener instrumentListener = new InstrumentListenerImpl(sessionManager, datasetManager, messenger, uiManager, dataExporter, dataImporter, datasetProvider);
uiManager.setInstrumentListener(instrumentListener);
SplashScreen.getInstance().setProgression("Loading site listener");
SiteListener siteListener = new SiteListenerImpl(sessionManager, datasetManager, messenger, uiManager, dataExporter, dataImporter, datasetProvider);
uiManager.setSiteListener(siteListener);
SplashScreen.getInstance().setProgression("Loading source listener");
SourceListener sourceListener = new SourceListenerImpl(sessionManager, datasetManager, messenger, uiManager, dataExporter, dataImporter, datasetProvider);
uiManager.setSourceListener(sourceListener);
SplashScreen.getInstance().setProgression("Loading observation parameters listener");
ObsParamListener obsParamListener = new ObsParamListenerImpl(sessionManager, datasetManager, messenger, uiManager, dataExporter, dataImporter, datasetProvider);
uiManager.setObsParamListener(obsParamListener);
SplashScreen.getInstance().setProgression("Loading dataset listener");
DatasetListener datasetListener = new DatasetListenerImpl(datasetManager, messenger, uiManager, dataImporter, dataExporter, datasetProvider);
uiManager.setDatasetListener(datasetListener);
SplashScreen.getInstance().setProgression("Loading SAMP controller");
SampController sampController = DataImportExportFactory.getSampController();
SampImportListener sampImportListener = new SampImportListener(messenger, datasetManager, uiManager);
sampController.setSampListener(sampImportListener);
SampUiListener sampUiListener = new SampUiListener(sampController, messenger);
uiManager.setSampListener(sampUiListener);
SplashScreen.getInstance().setProgression("Loading content");
Session session = new SessionImpl();
if (Installer.isNewDatabase()) {
try {
......@@ -157,6 +193,7 @@ public class ETC42 {
}
}
SplashScreen.getInstance().setProgression("Loading session");
try {
if (sessionManager.getAvailableInstrumentList().contains(new ComponentInfo(System.getProperty("etc.instrument"), null)))
session.setInstrument(sessionManager.loadInstrument(new ComponentInfo(System.getProperty("etc.instrument"), null)));
......@@ -186,6 +223,8 @@ public class ETC42 {
// importing components
if (Installer.isNewDatabase() && System.getProperty("etc.fixtures") == null)
uiManager.handleFirstInstallation();
SplashScreen.getInstance().setProgression("Loading done !");
}
/**
......
......@@ -38,6 +38,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import org.apache.log4j.Logger;
import org.cnrs.lam.dis.etc.ui.swing.SplashScreen;
/**
*/
......@@ -46,7 +47,12 @@ public class Main {
private static final Logger logger = Logger.getLogger(ETC42.class);
private static final long MAX_HEAP_REQUIRED = 1400000000L;
public static void main(String[] args) {
SplashScreen.getInstance().setVisible(true);
SplashScreen.getInstance().setProgression("Initialization");
// First we initialize the logger configuration
ETC42.initializeLogger();
logger.info("Starting ETC-42...");
......@@ -68,6 +74,7 @@ public class Main {
+ Runtime.getRuntime().maxMemory() + "). Trying to relaunch with more memory.");
launchInNewProcess(args);
}
SplashScreen.getInstance().setVisible(false);
}
private static void launchInNewProcess(String[] args) {
......
1000.0 3.952470732691954E-24
1100.0 6.149659522711999E-23
1200.0 1.19040719721548E-22
1300.0 6.752860290661101E-22
1400.0 1.2315313384106722E-21
1500.0 3.9221289835139725E-21
1600.0 6.612726628617273E-21
1700.0 1.4864491205663896E-20
1800.0 2.3116255782710517E-20
1900.0 4.1644940758167755E-20
2000.0 6.017362573362499E-20
2100.0 9.354755649266593E-20
2200.0 1.2692148725170685E-19
2300.0 1.7812801818906527E-19
2400.0 2.293345491264237E-19
2500.0 2.9904422869698023E-19
2600.0 3.6875390826753674E-19
2700.0 4.553764561919726E-19
2800.0 5.419990041164085E-19
2900.0 6.4225483311694115E-19
3000.0 7.425106621174739E-19
3100.0 8.521801300530996E-19
3200.0 9.618495979887254E-19
3300.0 1.0764609923141652E-18
3400.0 1.1910723866396047E-18
3500.0 1.3064151820030154E-18
3600.0 1.4217579773664254E-18
3700.0 1.5342000382789669E-18
3800.0 1.6466420991915084E-18
3900.0 1.7532788127989238E-18
4000.0 1.859915526406339E-18
4100.0 1.9585962432230882E-18
4200.0 2.057276960039838E-18
4300.0 2.146553370319079E-18
4400.0 2.2358297805983196E-18
4500.0 2.3148622767370763E-18
4600.0 2.3938947728758325E-18
4700.0 2.4623425096743806E-18
4800.0 2.5307902464729284E-18
4900.0 2.5887014016087385E-18