Skip to content
Snippets Groups Projects
Commit 67833f28 authored by Fabien Tessier's avatar Fabien Tessier
Browse files

Update Loading Network Dialog for project manager merge

parent 0363e097
No related branches found
No related tags found
2 merge requests!30Merge project manager into master,!29Resolve "Implement Project Management in TTool"
...@@ -246,73 +246,79 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac ...@@ -246,73 +246,79 @@ public class JDialogLoadingNetworkModel extends javax.swing.JFrame implements Ac
//connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); //connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
TraceManager.addDev("Connection setup 1");*/ TraceManager.addDev("Connection setup 1");*/
BufferedReader in = URLManager.getBufferedReader(url); BufferedReader in = URLManager.getBufferedReader(url);
jta.append("Connection established...\n"); if (in == null) {
String inputLine; jta.append("Could not establish a connection to the TTool server\n");
NetworkModel nm = null; } else {
while ((inputLine = in.readLine()) != null) { jta.append("Connection established...\n");
if (inputLine.startsWith("#FILE")) { String inputLine = null;
nm = new NetworkModel(inputLine.substring(5, inputLine.length()).trim()); NetworkModel nm = null;
listOfModels.add(nm); while ((inputLine = in.readLine()) != null) {
} if (inputLine.startsWith("#FILE")) {
nm = new NetworkModel(inputLine.substring(5, inputLine.length()).trim());
listOfModels.add(nm);
}
if (inputLine.startsWith("-FEATURES")) { if (inputLine.startsWith("-FEATURES")) {
if (nm != null) { if (nm != null) {
String tmp = inputLine.substring(9, inputLine.length()).trim().toLowerCase(); String tmp = inputLine.substring(9, inputLine.length()).trim().toLowerCase();
for (int i=1; i<FEATURES.length; i++) { for (int i=1; i<FEATURES.length; i++) {
nm.features[i] = tmp.indexOf(FEATURES[i]) != -1; nm.features[i] = tmp.indexOf(FEATURES[i]) != -1;
}
//nm.type = NetworkModel.stringToNetworkModelType(inputLine.substring(5, inputLine.length()).trim());
} }
//nm.type = NetworkModel.stringToNetworkModelType(inputLine.substring(5, inputLine.length()).trim());
} }
} }
if (inputLine.startsWith("-PROPS")) { if (inputLine.startsWith("-PROPS")) {
if (nm != null) { if (nm != null) {
String tmp = inputLine.substring(6, inputLine.length()).trim().toLowerCase(); String tmp = inputLine.substring(6, inputLine.length()).trim().toLowerCase();
for (int i=0; i<PROPS.length; i++) { for (int i=0; i<PROPS.length; i++) {
nm.props[i] = tmp.indexOf(PROPS[i]) != -1; nm.props[i] = tmp.indexOf(PROPS[i]) != -1;
}
//nm.type = NetworkModel.stringToNetworkModelType(inputLine.substring(5, inputLine.length()).trim());
} }
//nm.type = NetworkModel.stringToNetworkModelType(inputLine.substring(5, inputLine.length()).trim());
} }
}
if (inputLine.startsWith("-AUTHOR")) { if (inputLine.startsWith("-AUTHOR")) {
if (nm != null) { if (nm != null) {
nm.author = inputLine.substring(7, inputLine.length()).trim(); nm.author = inputLine.substring(7, inputLine.length()).trim();
}
} }
}
if (inputLine.startsWith("-DESCRIPTION")) { if (inputLine.startsWith("-DESCRIPTION")) {
if (nm != null) { if (nm != null) {
nm.description = inputLine.substring(12, inputLine.length()).trim(); nm.description = inputLine.substring(12, inputLine.length()).trim();
}
} }
}
if (inputLine.startsWith("-IMG")) { if (inputLine.startsWith("-IMG")) {
if (nm != null) { if (nm != null) {
nm.image = inputLine.substring(4, inputLine.length()).trim(); nm.image = inputLine.substring(4, inputLine.length()).trim();
//TraceManager.addDev("Dealing with image:" + nm.image); //TraceManager.addDev("Dealing with image:" + nm.image);
//nm.bi = URLManager.getBufferedImageFromURL(URLManager.getBaseURL(url) + nm.image); //nm.bi = URLManager.getBufferedImageFromURL(URLManager.getBaseURL(url) + nm.image);
}
} }
//System.out.println(inputLine);
} }
//System.out.println(inputLine); jta.append("\n" + listOfModels.size() + " remote models found.\nSelect a model to download it locally and open it.\n\n");
mode = LISTED;
panel.preparePanel(url);
panel.repaint();
in.close();
// Wait 5seconds before refreshing panel
Thread.sleep(5000);
panel.repaint();
} }
jta.append("\n" + listOfModels.size() + " remote models found.\nSelect a model to download it locally and open it.\n\n");
mode = LISTED;
panel.preparePanel(url);
panel.repaint();
in.close();
// Wait 5seconds before refreshing panel
Thread.sleep(5000);
panel.repaint();
} catch (Exception e) { } catch (Exception e) {
jta.append("Error when retreiving file: " + url + "\n No internet connection?\n No right for the Java Virtual Machine to use http connections?\n\n"); jta.append("Error when retreiving file: " + url + "\n No internet connection?\n No right for the Java Virtual Machine to use http connections?\n\n");
TraceManager.addDev("Exception trace in loading network model:"); TraceManager.addDev("Exception trace in loading network model:");
e.printStackTrace(); e.printStackTrace();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment