• R/O
  • SSH
  • HTTPS

ksar: Commit


Commit MetaInfo

Revision4 (tree)
Zeit2015-06-15 04:10:48
Autorpango853

Log Message

Add SSH Starttime option in SSHCommand dialog

Ändern Zusammenfassung

Diff

--- trunk/src/net/atomique/ksar/Config.java (revision 3)
+++ trunk/src/net/atomique/ksar/Config.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.awt.Font;
@@ -20,221 +16,226 @@
2016 * @author Max
2117 */
2218 public class Config {
19+ private static Preferences myPref;
2320
24- private static Preferences myPref;
25- private static Config instance = new Config();
21+ private static String landf;
22+ private static File lastReadDirectory;
23+ private static File lastExportDirectory;
24+ private static String lastCommand;
25+ private static int number_host_history;
26+ private static int local_configfile;
27+ private static final ArrayList<String> host_history = new ArrayList<>();
28+ public static final Font DEFAULT_FONT = new Font("SansSerif", Font.BOLD, 18);
2629
27- public static Config getInstance() {
28- return instance;
29- }
30+ private static String linuxDateFormat;
31+ private static String linuxTimeFormat;
32+ private static String pdfPageFormat;
33+ private static int imageWidth;
34+ private static int imageHeight;
3035
31- Config() {
32- myPref = Preferences.userNodeForPackage(Config.class);
33- if (myPref.getInt("local_configfile", -1) == -1) {
34- // new
35- try {
36- myPref.clear();
37- myPref.flush();
38- } catch (BackingStoreException e) {
39- }
40- local_configfile = store_configdir();
41- myPref.putInt("local_configfile", local_configfile);
42-
43- }
44- load();
45- }
36+ private static final Config instance = new Config();
37+ public static Config getInstance(){
38+ return instance;
39+ }
4640
47- private static void load() {
48- /*
49- * load default value or stored value
50- */
51- setLandf(myPref.get("landf", UIManager.getLookAndFeel().getName()));
52- setLastReadDirectory(myPref.get("lastReadDirectory", null));
53- setLastExportDirectory(myPref.get("lastExportDirectory", null));
41+ Config(){
42+ myPref = Preferences.userNodeForPackage(Config.class);
43+ if(myPref.getInt("local_configfile", -1) == -1){
44+ // new
45+ try{
46+ myPref.clear();
47+ myPref.flush();
48+ }catch(BackingStoreException e){
49+ }
50+ local_configfile = store_configdir();
51+ myPref.putInt("local_configfile", local_configfile);
52+ }
53+ load();
54+ }
5455
55- setImageHeight(myPref.getInt("ImageHeight", 600));
56- setImageWidth(myPref.getInt("ImageWidth", 800));
57- setPDFPageFormat(myPref.get("PDFPageFormat","A4"));
58- setLinuxDateFormat(myPref.get("LinuxDateFormat","Always ask"));
56+ private static void load(){
57+ /*
58+ * load default value or stored value
59+ */
60+ setLandf(myPref.get("landf", UIManager.getLookAndFeel().getName()));
61+ setLastReadDirectory(myPref.get("lastReadDirectory", null));
62+ setLastExportDirectory(myPref.get("lastExportDirectory", null));
5963
60- setNumber_host_history(myPref.getInt("HostHistory", 0));
61- for (int i = 0; i < getNumber_host_history(); i++) {
62- host_history.add(myPref.get("HostHistory_" + i, null));
63- }
64- setLocal_configfile(myPref.getInt("local_configfile", -1));
65- }
64+ setImageHeight(myPref.getInt("ImageHeight", 600));
65+ setImageWidth(myPref.getInt("ImageWidth", 800));
66+ setPDFPageFormat(myPref.get("PDFPageFormat","A4"));
67+ setLinuxDateTimeFormat(myPref.get("LinuxDateFormat", net.atomique.ksar.UI.Preferences.DEFAULT_DATE_FORMAT), myPref.get("LinuxTimeFormat", net.atomique.ksar.UI.Preferences.DEFAULT_TIME_FORMAT));
6668
67- public static void save() {
68- if (myPref == null) {
69- return;
70- }
71- myPref.put("landf", landf);
72- if (lastReadDirectory != null) {
73- myPref.put("lastReadDirectory", lastReadDirectory.toString());
74- }
75- if (lastExportDirectory != null) {
76- myPref.put("lastExportDirectory", lastExportDirectory.toString());
77- }
69+ setNumber_host_history(myPref.getInt("HostHistory", 0));
70+ for(int i = 0; i < getNumber_host_history(); i++){
71+ host_history.add(myPref.get("HostHistory_" + i, null));
72+ }
73+ setLocal_configfile(myPref.getInt("local_configfile", -1));
74+ }
7875
79- myPref.putInt("ImageHeight", ImageHeight);
80- myPref.putInt("ImageWidth", ImageWidth);
81- myPref.put("PDFPageFormat", PDFPageFormat);
82- myPref.put("LinuxDateFormat", LinuxDateFormat);
76+ public static void save(){
77+ if(myPref == null){
78+ return;
79+ }
80+ myPref.put("landf", landf);
81+ if(lastReadDirectory != null){
82+ myPref.put("lastReadDirectory", lastReadDirectory.toString());
83+ }
84+ if(lastExportDirectory != null){
85+ myPref.put("lastExportDirectory", lastExportDirectory.toString());
86+ }
8387
84- for (int i = 0; i < host_history.size(); i++) {
85- myPref.put("HostHistory_" + i, host_history.get(i));
86- }
87- myPref.putInt("HostHistory", host_history.size());
88+ myPref.putInt("ImageHeight", imageHeight);
89+ myPref.putInt("ImageWidth", imageWidth);
90+ myPref.put("PDFPageFormat", pdfPageFormat);
91+ myPref.put("LinuxDateFormat", linuxDateFormat);
92+ myPref.put("LinuxTimeFormat", linuxTimeFormat);
8893
89- myPref.putInt("local_configfile", local_configfile);
94+ for(int i = 0; i < host_history.size(); i++){
95+ myPref.put("HostHistory_" + i, host_history.get(i));
96+ }
97+ myPref.putInt("HostHistory", host_history.size());
9098
91- }
99+ myPref.putInt("local_configfile", local_configfile);
92100
93- public static String getLandf() {
94- return landf;
95- }
101+ }
96102
97- public static void setLandf(String landf) {
98- Config.landf = landf;
99- }
103+ public static String getLandf(){
104+ return landf;
105+ }
100106
101- public static File getLastReadDirectory() {
102- return lastReadDirectory;
103- }
107+ public static void setLandf(String landf){
108+ Config.landf = landf;
109+ }
104110
105- public static void setLastReadDirectory(String lastReadDirectory) {
106- if (lastReadDirectory != null) {
107- Config.lastReadDirectory = new File(lastReadDirectory);
108- }
109- }
111+ public static File getLastReadDirectory(){
112+ return lastReadDirectory;
113+ }
110114
111- public static void setLastReadDirectory(File lastReadDirectory) {
112- Config.lastReadDirectory = lastReadDirectory;
113- }
115+ public static void setLastReadDirectory(String lastReadDirectory){
116+ if(lastReadDirectory != null){
117+ Config.lastReadDirectory = new File(lastReadDirectory);
118+ }
119+ }
114120
115- public static File getLastExportDirectory() {
116- return lastReadDirectory;
117- }
121+ public static void setLastReadDirectory(File lastReadDirectory){
122+ Config.lastReadDirectory = lastReadDirectory;
123+ }
118124
119- public static void setLastExportDirectory(String lastExportDirectory) {
120- if (lastExportDirectory != null) {
121- Config.lastExportDirectory = new File(lastExportDirectory);
122- }
123- }
125+ public static File getLastExportDirectory(){
126+ return lastReadDirectory;
127+ }
124128
125- public static void setLastExportDirectory(File lastExportDirectory) {
126- Config.lastExportDirectory = lastExportDirectory;
127- }
129+ public static void setLastExportDirectory(String lastExportDirectory){
130+ if(lastExportDirectory != null){
131+ Config.lastExportDirectory = new File(lastExportDirectory);
132+ }
133+ }
128134
129- public static String getLastCommand() {
130- return lastCommand;
131- }
135+ public static void setLastExportDirectory(File lastExportDirectory){
136+ Config.lastExportDirectory = lastExportDirectory;
137+ }
132138
133- public static void setLastCommand(String lastCommand) {
134- Config.lastCommand = lastCommand;
135- }
139+ public static String getLastCommand(){
140+ return lastCommand;
141+ }
136142
137- public static ArrayList<String> getHost_history() {
138- return host_history;
139- }
143+ public static void setLastCommand(String lastCommand){
144+ Config.lastCommand = lastCommand;
145+ }
140146
141- public static void addHost_history(String e) {
142- host_history.add(e);
143- }
147+ public static ArrayList<String> getHost_history(){
148+ return host_history;
149+ }
144150
145- public static int getNumber_host_history() {
146- return number_host_history;
147- }
151+ public static void addHost_history(String e){
152+ host_history.add(e);
153+ }
148154
149- public static void setNumber_host_history(int number_host_history) {
150- Config.number_host_history = number_host_history;
151- }
155+ public static int getNumber_host_history(){
156+ return number_host_history;
157+ }
152158
153- public static Font getDEFAULT_FONT() {
154- return DEFAULT_FONT;
155- }
159+ public static void setNumber_host_history(int number_host_history){
160+ Config.number_host_history = number_host_history;
161+ }
156162
157- public static int getImageHeight() {
158- return ImageHeight;
159- }
163+ public static Font getDEFAULT_FONT(){
164+ return DEFAULT_FONT;
165+ }
160166
161- public static void setImageHeight(int ImageHeight) {
162- Config.ImageHeight = ImageHeight;
163- }
167+ public static int getImageHeight(){
168+ return imageHeight;
169+ }
164170
165- public static int getImageWidth() {
166- return ImageWidth;
167- }
171+ public static void setImageHeight(int ImageHeight){
172+ Config.imageHeight = ImageHeight;
173+ }
168174
169- public static void setImageWidth(int ImageWidth) {
170- Config.ImageWidth = ImageWidth;
171- }
175+ public static int getImageWidth(){
176+ return imageWidth;
177+ }
172178
173- public static String getPDFPageFormat() {
174- return PDFPageFormat;
175- }
179+ public static void setImageWidth(int ImageWidth){
180+ Config.imageWidth = ImageWidth;
181+ }
176182
177- public static void setPDFPageFormat(String PDFPageFormat) {
178- Config.PDFPageFormat = PDFPageFormat;
179- }
183+ public static String getPDFPageFormat(){
184+ return pdfPageFormat;
185+ }
180186
181-
187+ public static void setPDFPageFormat(String PDFPageFormat){
188+ Config.pdfPageFormat = PDFPageFormat;
189+ }
182190
183- public static int store_configdir() {
184- Properties systemprops = System.getProperties();
185- String userhome = (String) systemprops.get("user.home") + systemprops.get("file.separator");
186- String username = (String) systemprops.get("user.name");
187- String fileseparator = (String) systemprops.get("file.separator");
188- // mkdir userhome/.ksar
189- String buffer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n\n<ConfiG>\n</ConfiG>\n";
190- boolean home = new File(userhome + ".ksarcfg").mkdir();
191- if (!home) {
192- return 0;
193- }
191+ public static int store_configdir(){
192+ Properties systemprops = System.getProperties();
193+ String userhome = (String) systemprops.get("user.home") + systemprops.get("file.separator");
194+ String username = (String) systemprops.get("user.name");
195+ String fileseparator = (String) systemprops.get("file.separator");
196+ // mkdir userhome/.ksar
197+ String buffer = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n\n<ConfiG>\n</ConfiG>\n";
198+ boolean home = new File(userhome + ".ksarcfg").mkdir();
199+ if(!home){
200+ return 0;
201+ }
194202
195- BufferedWriter out = null;
196- try {
197- out = new BufferedWriter(new FileWriter(userhome + ".ksarcfg" + fileseparator + "Config.xml"));
198- out.write(buffer);
199- out.flush();
200- out.close();
201- return 1;
202- } catch (IOException e) {
203- return 0;
204- }
203+ BufferedWriter out = null;
204+ try{
205+ out = new BufferedWriter(new FileWriter(userhome + ".ksarcfg" + fileseparator + "Config.xml"));
206+ out.write(buffer);
207+ out.flush();
208+ out.close();
209+ return 1;
210+ }catch(IOException e){
211+ return 0;
212+ }
213+ }
205214
206- }
215+ public static int getLocal_configfile(){
216+ return local_configfile;
217+ }
207218
208- public static int getLocal_configfile() {
209- return local_configfile;
210- }
219+ public static void setLocal_configfile(int local_configfile){
220+ Config.local_configfile = local_configfile;
221+ }
211222
212- public static void setLocal_configfile(int local_configfile) {
213- Config.local_configfile = local_configfile;
214- }
223+ public static String getLinuxDateFormat(){
224+ return linuxDateFormat;
225+ }
215226
216- public static String getLinuxDateFormat() {
217- return LinuxDateFormat;
218- }
227+ public static String getLinuxTimeFormat(){
228+ return linuxTimeFormat;
229+ }
219230
220- public static void setLinuxDateFormat(String LinuxDateFormat) {
221- Config.LinuxDateFormat = LinuxDateFormat;
222- }
231+ public static void setLinuxDateTimeFormat(String dateformat, String timeformat){
232+ if(null != dateformat){
233+ Config.linuxDateFormat = dateformat;
234+ }
223235
224-
225-
226- private static String landf;
227- private static File lastReadDirectory;
228- private static File lastExportDirectory;
229- private static String lastCommand;
230- private static int number_host_history;
231- private static int local_configfile;
232- private static ArrayList<String> host_history = new ArrayList<String>();
233- public static final Font DEFAULT_FONT = new Font("SansSerif", Font.BOLD, 18);
236+ if(null != timeformat){
237+ Config.linuxTimeFormat = timeformat;
238+ }
239+ }
234240
235- private static String LinuxDateFormat;
236- private static String PDFPageFormat;
237- private static int ImageWidth;
238- private static int ImageHeight;
239-
240241 }
--- trunk/src/net/atomique/ksar/FileRead.java (revision 3)
+++ trunk/src/net/atomique/ksar/FileRead.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.io.BufferedReader;
@@ -17,71 +13,71 @@
1713 * @author Max
1814 */
1915 public class FileRead extends Thread implements DataCommandImpl{
20- private KSar mysar = null;
21- private String sarfilename = null;
22- private FileReader tmpfile = null;
23- private BufferedReader myfilereader = null;
16+ private KSar mysar = null;
17+ private String sarfilename = null;
18+ private FileReader tmpfile = null;
19+ private BufferedReader myfilereader = null;
2420
25- public FileRead(KSar hissar) {
26- mysar = hissar;
27- JFileChooser fc = new JFileChooser();
28- if (Config.getLastReadDirectory() != null) {
29- fc.setCurrentDirectory(Config.getLastReadDirectory());
30- }
31- int returnVal = fc.showDialog(null, "Open");
32- if (returnVal == JFileChooser.APPROVE_OPTION) {
33- sarfilename = fc.getSelectedFile().getAbsolutePath();
34- if (fc.getSelectedFile().isDirectory()) {
35- Config.setLastReadDirectory(fc.getSelectedFile());
36- } else {
37- Config.setLastReadDirectory(fc.getSelectedFile().getParentFile());
38- }
39- Config.save();
40- }
41- }
21+ public FileRead(KSar hissar){
22+ mysar = hissar;
23+ JFileChooser fc = new JFileChooser();
24+ if(Config.getLastReadDirectory() != null){
25+ fc.setCurrentDirectory(Config.getLastReadDirectory());
26+ }
27+ int returnVal = fc.showDialog(null, "Open");
28+ if(returnVal == JFileChooser.APPROVE_OPTION){
29+ sarfilename = fc.getSelectedFile().getAbsolutePath();
30+ if(fc.getSelectedFile().isDirectory()){
31+ Config.setLastReadDirectory(fc.getSelectedFile());
32+ }else{
33+ Config.setLastReadDirectory(fc.getSelectedFile().getParentFile());
34+ }
35+ Config.save();
36+ }
37+ }
4238
43- public FileRead(KSar hissar, String filename) {
44- mysar = hissar;
45- sarfilename = filename;
46- }
39+ public FileRead(KSar hissar, String filename){
40+ mysar = hissar;
41+ sarfilename = filename;
42+ }
4743
48- public String get_action() {
49- if ( sarfilename != null ) {
50- return "file://" + sarfilename;
51- } else {
52- return null;
53- }
54- }
44+ public String get_action(){
45+ if( sarfilename != null ){
46+ return "file://" + sarfilename;
47+ }else{
48+ return null;
49+ }
50+ }
5551
56- private void close() {
57- try {
58- if (myfilereader != null) {
59- myfilereader.close();
60- }
61- if (tmpfile != null) {
62- tmpfile.close();
63- }
64- } catch (IOException ex) {
65- Logger.getLogger(FileRead.class.getName()).log(Level.SEVERE, null, ex);
66- }
67- }
52+ private void close(){
53+ try{
54+ if(myfilereader != null){
55+ myfilereader.close();
56+ }
57+ if(tmpfile != null){
58+ tmpfile.close();
59+ }
60+ }catch(IOException ex){
61+ Logger.getLogger(FileRead.class.getName()).log(Level.SEVERE, null, ex);
62+ }
63+ }
6864
6965 @Override
70- public void run() {
71- if (sarfilename == null) {
72- return;
73- }
66+ public void run(){
67+ if(sarfilename == null){
68+ return;
69+ }
7470
75- try {
76- tmpfile = new FileReader(sarfilename);
77- } catch (FileNotFoundException ex) {
78- Logger.getLogger(FileRead.class.getName()).log(Level.SEVERE, null, ex);
79- }
71+ try{
72+ tmpfile = new FileReader(sarfilename);
73+ }catch(FileNotFoundException ex){
74+ Logger.getLogger(FileRead.class.getName()).log(Level.SEVERE, null, ex);
75+ }
8076
81- myfilereader = new BufferedReader(tmpfile);
77+ myfilereader = new BufferedReader(tmpfile);
8278
83- mysar.parse(myfilereader);
79+ mysar.parse(myfilereader);
8480
85- close();
86- }
81+ close();
82+ }
8783 }
--- trunk/src/net/atomique/ksar/GlobalOptions.java (revision 3)
+++ trunk/src/net/atomique/ksar/GlobalOptions.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.awt.Color;
@@ -26,15 +22,27 @@
2622 * @author Max
2723 */
2824 public class GlobalOptions {
25+ public static final String[] OSPARSERS = {"AIX", "HPUX", "Linux", "SunOS"};
2926
27+ private static Desktop ui = null;
28+ private static Properties systemprops;
29+ private static String userhome;
30+ private static String username;
31+ private static String fileseparator;
32+ private static HashMap<String, ColumnConfig> columnlist;
33+ private static HashMap<String, OSConfig> oslist;
34+ private static HashMap<String, CnxHistory> history_list;
35+ private static HashMap<String, HostInfo> hostinfo_list;
36+ private static boolean dodebug = false;
37+ private static String cl_filename = null;
38+ private static HashMap<String, Class> parser_map;
39+
3040 private static final GlobalOptions instance = new GlobalOptions();
31-
3241 public static GlobalOptions getInstance(){
3342 return instance;
3443 }
3544
36- GlobalOptions() {
37- String [] OSParserNames = {"AIX", "HPUX", "Linux", "SunOS"};
45+ GlobalOptions(){
3846 String filename;
3947 InputStream is;
4048 XMLConfig tmp;
@@ -42,187 +50,187 @@
4250 username = (String) systemprops.get("user.name");
4351 userhome = (String) systemprops.get("user.home") + systemprops.get("file.separator");
4452 fileseparator = (String) systemprops.get("file.separator");
45- columnlist = new HashMap<String, ColumnConfig>();
46- OSlist = new HashMap<String, OSConfig>();
47- ParserMap = new HashMap<String, Class>();
48- HistoryList = new HashMap<String, CnxHistory>();
49- HostInfoList = new HashMap<String, HostInfo>();
53+ columnlist = new HashMap<>();
54+ oslist = new HashMap<>();
55+ parser_map = new HashMap<>();
56+ history_list = new HashMap<>();
57+ hostinfo_list = new HashMap<>();
5058 is = this.getClass().getResourceAsStream("/Config.xml");
5159 tmp = new XMLConfig(is);
52- for ( String OSName : OSParserNames ) {
53- try {
54- Class tmpclass = Class.forName("net.atomique.ksar.Parser."+OSName);
55- ParserMap.put(OSName, tmpclass);
56- } catch (ClassNotFoundException ex) {
60+ for(String osname : OSPARSERS){
61+ try{
62+ Class tmpclass = Class.forName("net.atomique.ksar.Parser."+osname);
63+ parser_map.put(osname, tmpclass);
64+ }catch(ClassNotFoundException ex){
5765 ex.printStackTrace(System.err);
5866 }
5967 }
60- for (String parsername : ParserMap.keySet()) {
68+ for(String parsername : parser_map.keySet()){
6169 is = this.getClass().getResourceAsStream("/" + parsername + ".xml");
62- if (is != null) {
70+ if(is != null){
6371 tmp.load_config(is);
6472 }
6573 }
6674
6775 filename = userhome + ".ksarcfg" + fileseparator + "Config.xml";
68- if (new File(filename).canRead()) {
76+ if(new File(filename).canRead()){
6977 tmp.load_config(filename);
7078 }
7179 filename = userhome + ".ksarcfg" + fileseparator + "History.xml";
72- if (new File(filename).canRead()) {
80+ if(new File(filename).canRead()){
7381 tmp.load_config(filename);
7482 }
7583
7684 }
7785
78- public static boolean hasUI() {
79- return UI != null;
86+ public static boolean hasUI(){
87+ return ui != null;
8088 }
8189
82- public static Desktop getUI() {
83- return UI;
90+ public static Desktop getUI(){
91+ return ui;
8492 }
8593
86- public static void setUI(Desktop UI) {
87- GlobalOptions.UI = UI;
94+ public static void setUI(Desktop UI){
95+ GlobalOptions.ui = UI;
8896 }
8997
90- public static String getUserhome() {
98+ public static String getUserhome(){
9199 return userhome;
92100 }
93101
94- public static String getUsername() {
102+ public static String getUsername(){
95103 return username;
96104 }
97105
98- public static void setColumnConfig(String column, ColumnConfig config) {
106+ public static void setColumnConfig(String column, ColumnConfig config){
99107 columnlist.put(column, config);
100108 }
101109
102- public static HashMap<String, OSConfig> getOSlist() {
103- return OSlist;
110+ public static HashMap<String, OSConfig> getOSlist(){
111+ return oslist;
104112 }
105113
106- public static ColumnConfig getColumnConfig(String s) {
107- if ( columnlist.isEmpty()) {
114+ public static ColumnConfig getColumnConfig(String s){
115+ if( columnlist.isEmpty()){
108116 return null;
109117 }
110118 return columnlist.get(s);
111119 }
112- public static Color getDataColor(String s) {
120+ public static Color getDataColor(String s){
113121 ColumnConfig tmp = columnlist.get(s);
114- if (tmp != null) {
122+ if(tmp != null){
115123 return tmp.getData_color();
116- } else {
124+ }else{
117125 System.err.println("WARN: color not found for tag " + s);
118126 }
119127 return null;
120128 }
121129
122- public static OSConfig getOSinfo(String s) {
123- return OSlist.get(s);
130+ public static OSConfig getOSinfo(String s){
131+ return oslist.get(s);
124132 }
125133
126- public static boolean isDodebug() {
134+ public static boolean isDodebug(){
127135 return dodebug;
128136 }
129137
130- public static void setDodebug(boolean do_debug) {
138+ public static void setDodebug(boolean do_debug){
131139 GlobalOptions.dodebug = do_debug;
132140 }
133141
134- public static String getCLfilename() {
135- return CLfilename;
142+ public static String getCLfilename(){
143+ return cl_filename;
136144 }
137145
138- public static void setCLfilename(String CL_filename) {
139- GlobalOptions.CLfilename = CL_filename;
146+ public static void setCLfilename(String CL_filename){
147+ GlobalOptions.cl_filename = CL_filename;
140148 }
141149
142- public static String getFileseparator() {
150+ public static String getFileseparator(){
143151 return fileseparator;
144152 }
145153
146- public static Class getParser(String s) {
154+ public static Class getParser(String s){
147155 String tmp = s.replaceAll("-", "");
148- if (ParserMap.isEmpty()) {
156+ if(parser_map.isEmpty()){
149157 return null;
150158 }
151- return ParserMap.get(tmp);
159+ return parser_map.get(tmp);
152160 }
153161
154- public static HashMap<String, HostInfo> getHostInfoList() {
155- return HostInfoList;
162+ public static HashMap<String, HostInfo> getHostInfoList(){
163+ return hostinfo_list;
156164 }
157165
158- public static HostInfo getHostInfo(String s) {
159- if (HostInfoList.isEmpty()) {
166+ public static HostInfo getHostInfo(String s){
167+ if(hostinfo_list.isEmpty()){
160168 return null;
161169 }
162- return HostInfoList.get(s);
170+ return hostinfo_list.get(s);
163171 }
164172
165- public static void addHostInfo(HostInfo s) {
166- HostInfoList.put(s.getHostname(), s);
173+ public static void addHostInfo(HostInfo s){
174+ hostinfo_list.put(s.getHostname(), s);
167175 saveHistory();
168176 }
169177
170- public static HashMap<String, CnxHistory> getHistoryList() {
171- return HistoryList;
178+ public static HashMap<String, CnxHistory> getHistoryList(){
179+ return history_list;
172180 }
173181
174- public static CnxHistory getHistory(String s) {
175- if (HistoryList.isEmpty()) {
182+ public static CnxHistory getHistory(String s){
183+ if(history_list.isEmpty()){
176184 return null;
177185 }
178- return HistoryList.get(s);
186+ return history_list.get(s);
179187 }
180188
181- public static void addHistory(CnxHistory s) {
182- CnxHistory tmp = HistoryList.get(s.getLink());
183- if ( tmp != null) {
189+ public static void addHistory(CnxHistory s){
190+ CnxHistory tmp = history_list.get(s.getLink());
191+ if( tmp != null){
184192 Iterator<String> ite = s.getCommandList().iterator();
185- while (ite.hasNext()) {
193+ while(ite.hasNext()){
186194 tmp.addCommand(ite.next());
187195 }
188- } else {
189- HistoryList.put(s.getLink(), s);
196+ }else{
197+ history_list.put(s.getLink(), s);
190198 }
191199 saveHistory();
192200 }
193201
194- public static void saveHistory() {
202+ public static void saveHistory(){
195203 File tmpfile;
196204 BufferedWriter tmpfile_out = null;
197205
198- if (HistoryList.isEmpty() && HostInfoList.isEmpty()) {
206+ if(history_list.isEmpty() && hostinfo_list.isEmpty()){
199207 System.out.println("list is null");
200208 return;
201209 }
202210
203- try {
211+ try{
204212 tmpfile = new File(userhome + ".ksarcfg" + fileseparator + "History.xmltemp");
205213
206- if ( tmpfile.exists() ) {
214+ if( tmpfile.exists() ){
207215 tmpfile.delete();
208216 }
209- if (tmpfile.createNewFile() && tmpfile.canWrite()) {
217+ if(tmpfile.createNewFile() && tmpfile.canWrite()){
210218 tmpfile_out = new BufferedWriter(new FileWriter(tmpfile));
211219 }
212220 //xml header
213221 tmpfile_out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ConfiG>\n");
214222 tmpfile_out.write("\t<History>\n");
215- Iterator<String> ite = HistoryList.keySet().iterator();
216- while (ite.hasNext()) {
217- CnxHistory tmp = HistoryList.get(ite.next());
223+ Iterator<String> ite = history_list.keySet().iterator();
224+ while(ite.hasNext()){
225+ CnxHistory tmp = history_list.get(ite.next());
218226 tmpfile_out.write(tmp.save());
219227 }
220228 //xml footer
221229 tmpfile_out.write("\t</History>\n");
222230 tmpfile_out.write("\t<HostInfo>\n");
223- Iterator<String> ite2 = HostInfoList.keySet().iterator();
224- while (ite2.hasNext()) {
225- HostInfo tmp = HostInfoList.get(ite2.next());
231+ Iterator<String> ite2 = hostinfo_list.keySet().iterator();
232+ while(ite2.hasNext()){
233+ HostInfo tmp = hostinfo_list.get(ite2.next());
226234 tmpfile_out.write(tmp.save());
227235 }
228236 //xml footer
@@ -234,22 +242,9 @@
234242 oldfile.delete();
235243 tmpfile.renameTo(oldfile);
236244
237- } catch (IOException ex) {
245+ }catch(IOException ex){
238246 Logger.getLogger(GlobalOptions.class.getName()).log(Level.SEVERE, null, ex);
239247 }
240248
241249 }
242- private static Desktop UI = null;
243- private static Properties systemprops;
244- private static String userhome;
245- private static String username;
246- private static String fileseparator;
247- private static HashMap<String, ColumnConfig> columnlist;
248- private static HashMap<String, OSConfig> OSlist;
249- private static HashMap<String, CnxHistory> HistoryList;
250- private static HashMap<String, HostInfo> HostInfoList;
251- private static boolean dodebug = false;
252- private static String CLfilename = null;
253- private static HashMap<String, Class> ParserMap;
254- private static boolean firstrun = true;
255250 }
--- trunk/src/net/atomique/ksar/Parser/SunOS.java (revision 3)
+++ trunk/src/net/atomique/ksar/Parser/SunOS.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.Parser;
62
73 import java.text.ParseException;
@@ -19,157 +15,157 @@
1915 *
2016 * @author Max
2117 */
22-public class SunOS extends OSParser {
18+public class SunOS extends OSParser{
19+ Second now = null;
20+ boolean under_average = false;
2321
24- public void parse_header(String s) {
25- String[] columns = s.split("\\s+");
26- setOstype(columns[0]);
27- setHostname(columns[1]);
28- setOSversion(columns[2]);
29- setKernel(columns[3]);
30- setCpuType(columns[4]);
31- setDate(columns[5]);
32-
33- if (GlobalOptions.hasUI()) {
34- HostInfo tmphostinfo = GlobalOptions.getHostInfo(this.gethostName());
35- if (tmphostinfo == null) {
36- tmphostinfo = new HostInfo(this.gethostName());
37- }
38- HostInfoView tmpview = new HostInfoView(GlobalOptions.getUI(), tmphostinfo);
39- tmpview.setVisible(true);
40-
41- }
42-
43-
44- }
22+ public void parse_header(String s){
23+ String[] columns = s.split("\\s+");
24+ setOstype(columns[0]);
25+ setHostname(columns[1]);
26+ setOSversion(columns[2]);
27+ setKernel(columns[3]);
28+ setCpuType(columns[4]);
29+ setDate(columns[5]);
30+
31+ if(GlobalOptions.hasUI()){
32+ HostInfo tmphostinfo = GlobalOptions.getHostInfo(this.gethostName());
33+ if(tmphostinfo == null){
34+ tmphostinfo = new HostInfo(this.gethostName());
35+ }
36+ HostInfoView tmpview = new HostInfoView(GlobalOptions.getUI(), tmphostinfo);
37+ tmpview.setVisible(true);
38+
39+ }
40+
41+
42+ }
4543
46- @Override
47- public int parse(String line, String[] columns) {
48- int heure = 0;
49- int minute = 0;
50- int seconde = 0;
44+ @Override
45+ public int parse(String line, String[] columns){
46+ int heure = 0;
47+ int minute = 0;
48+ int seconde = 0;
5149
5250
53- if ("Average".equals(columns[0])) {
54- under_average = true;
55- return 0;
56- }
51+ if("Average".equals(columns[0])){
52+ under_average = true;
53+ return 0;
54+ }
5755
58- if (line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0) {
59- return 0;
60- }
56+ if(line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0){
57+ return 0;
58+ }
6159
62- // match the System [C|c]onfiguration line on AIX
63- if (line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0) {
64- return 0;
65- }
60+ // match the System [C|c]onfiguration line on AIX
61+ if(line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0){
62+ return 0;
63+ }
6664
67- if (line.indexOf("State change") >= 0) {
68- return 0;
69- }
65+ if(line.indexOf("State change") >= 0){
66+ return 0;
67+ }
7068
7169
72- try {
73- parsedate = new SimpleDateFormat(timeFormat).parse(columns[0]);
74- cal.setTime(parsedate);
75- heure = cal.get(cal.HOUR_OF_DAY);
76- minute = cal.get(cal.MINUTE);
77- seconde = cal.get(cal.SECOND);
78- now = new Second(seconde, minute, heure, day, month, year);
79- if (startofstat == null) {
80- startofstat = now;
81- startofgraph = now;
82- }
83- if (endofstat == null) {
84- endofstat = now;
85- endofgraph = now;
86- }
87- if (now.compareTo(endofstat) > 0) {
88- endofstat = now;
89- endofgraph = now;
90- }
91- firstdatacolumn = 1;
92- } catch (ParseException ex) {
93- if (!"DEVICE".equals(currentStat)) {
94- System.out.println("unable to parse time " + columns[0]);
95- return -1;
96- }
97- firstdatacolumn = 0;
98- }
70+ try{
71+ parseTime = new SimpleDateFormat(timeFormat).parse(columns[0]);
72+ cal.setTime(parseTime);
73+ heure = cal.get(cal.HOUR_OF_DAY);
74+ minute = cal.get(cal.MINUTE);
75+ seconde = cal.get(cal.SECOND);
76+ now = new Second(seconde, minute, heure, day, month, year);
77+ if(startofstat == null){
78+ startofstat = now;
79+ startofgraph = now;
80+ }
81+ if(endofstat == null){
82+ endofstat = now;
83+ endofgraph = now;
84+ }
85+ if(now.compareTo(endofstat) > 0){
86+ endofstat = now;
87+ endofgraph = now;
88+ }
89+ firstValueColumnIndex = 1;
90+ }catch(ParseException ex){
91+ if(!"DEVICE".equals(currentStat)){
92+ System.out.println("unable to parse time " + columns[0]);
93+ return -1;
94+ }
95+ firstValueColumnIndex = 0;
96+ }
9997
10098
101- /** XML COLUMN PARSER **/
102- String checkStat = myosconfig.getStat(columns, firstdatacolumn);
99+ /** XML COLUMN PARSER **/
100+ String checkStat = osConfig.getStat(columns, firstValueColumnIndex);
103101
104- if (checkStat != null) {
105- Object obj = ListofGraph.get(checkStat);
106- if (obj == null) {
107- GraphConfig mygraphinfo = myosconfig.getGraphConfig(checkStat);
108- if (mygraphinfo != null) {
109- if ("unique".equals(mygraphinfo.getType())) {
110- obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn, mysar.graphtree);
111- ListofGraph.put(checkStat, obj);
112- currentStat = checkStat;
113- return 0;
114- }
115- if ("multiple".equals(mygraphinfo.getType())) {
116- obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn);
117- ListofGraph.put(checkStat, obj);
118- currentStat = checkStat;
119- return 0;
120- }
121- } else {
122- // no graph associate
123- currentStat = checkStat;
124- return 0;
125- }
126- } else {
127- currentStat = checkStat;
128- return 0;
129- }
130- }
102+ if(checkStat != null){
103+ Object obj = ListofGraph.get(checkStat);
104+ if(obj == null){
105+ GraphConfig mygraphinfo = osConfig.getGraphConfig(checkStat);
106+ if(mygraphinfo != null){
107+ if("unique".equals(mygraphinfo.getType())){
108+ obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex, mysar.getGraphTree());
109+ ListofGraph.put(checkStat, obj);
110+ currentStat = checkStat;
111+ return 0;
112+ }
113+ if("multiple".equals(mygraphinfo.getType())){
114+ obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex);
115+ ListofGraph.put(checkStat, obj);
116+ currentStat = checkStat;
117+ return 0;
118+ }
119+ }else{
120+ // no graph associate
121+ currentStat = checkStat;
122+ return 0;
123+ }
124+ }else{
125+ currentStat = checkStat;
126+ return 0;
127+ }
128+ }
131129
132- //System.out.println("==" + currentStat + " " + line);
130+ //System.out.println("==" + currentStat + " " + line);
133131
134132
135133
136- if (lastStat != null) {
137- if (!lastStat.equals(currentStat)) {
138- if (GlobalOptions.isDodebug()) {
139- System.out.println("Stat change from " + lastStat + " to " + currentStat);
140- }
141- lastStat = currentStat;
142- under_average = false;
143- }
144- } else {
145- lastStat = currentStat;
146- }
147- if ("IGNORE".equals(currentStat)) {
148- return 1;
149- }
150- if ("NONE".equals(currentStat)) {
151- return -1;
152- }
134+ if(lastStat != null){
135+ if(!lastStat.equals(currentStat)){
136+ if(GlobalOptions.isDodebug()){
137+ System.out.println("Stat change from " + lastStat + " to " + currentStat);
138+ }
139+ lastStat = currentStat;
140+ under_average = false;
141+ }
142+ }else{
143+ lastStat = currentStat;
144+ }
145+ if("IGNORE".equals(currentStat)){
146+ return 1;
147+ }
148+ if("NONE".equals(currentStat)){
149+ return -1;
150+ }
153151
154- if (under_average) {
155- return 0;
156- }
157- currentStatObj = ListofGraph.get(currentStat);
158- if (currentStatObj == null) {
159- return -1;
160- } else {
161- DateSamples.add(now);
162- if (currentStatObj instanceof Graph) {
163- Graph ag = (Graph) currentStatObj;
164- return ag.parse_line(now, line);
165- }
166- if (currentStatObj instanceof List) {
167- List ag = (List) currentStatObj;
168- return ag.parse_line(now, line);
169- }
170- }
171- return -1;
172- }
173- Second now = null;
174- boolean under_average = false;
152+ if(under_average){
153+ return 0;
154+ }
155+ currentStatObj = ListofGraph.get(currentStat);
156+ if(currentStatObj == null){
157+ return -1;
158+ }else{
159+ DateSamples.add(now);
160+ if(currentStatObj instanceof Graph){
161+ Graph ag = (Graph) currentStatObj;
162+ return ag.parse_line(now, line);
163+ }
164+ if(currentStatObj instanceof List){
165+ List ag = (List) currentStatObj;
166+ return ag.parse_line(now, line);
167+ }
168+ }
169+ return -1;
170+ }
175171 }
--- trunk/src/net/atomique/ksar/Parser/Linux.java (revision 3)
+++ trunk/src/net/atomique/ksar/Parser/Linux.java (revision 4)
@@ -1,18 +1,14 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.Parser;
62
73 import java.text.ParseException;
84 import java.text.SimpleDateFormat;
95 import java.util.Calendar;
6+import javax.swing.JOptionPane;
107 import net.atomique.ksar.Config;
118 import net.atomique.ksar.OSParser;
129 import net.atomique.ksar.GlobalOptions;
1310 import net.atomique.ksar.Graph.Graph;
1411 import net.atomique.ksar.Graph.List;
15-import net.atomique.ksar.UI.LinuxDateFormat;
1612 import net.atomique.ksar.XML.GraphConfig;
1713 import org.jfree.data.time.Second;
1814
@@ -19,14 +15,12 @@
1915 /**
2016 *
2117 * @author Max
18+ * updated by Pango
2219 */
23-public class Linux extends OSParser {
24- private String dateFormat;
20+public class Linux extends OSParser{
2521
2622 @Override
27- public void parse_header(String s) {
28- boolean retdate = false;
29- dateFormat = Config.getLinuxDateFormat();
23+ public void parse_header(String s){
3024 String[] columns = s.split("\\s+");
3125 String tmpstr;
3226 setOstype(columns[0]);
@@ -33,56 +27,24 @@
3327 setKernel(columns[1]);
3428 tmpstr = columns[2];
3529 setHostname(tmpstr.substring(1, tmpstr.length() - 1));
36- checkDateFormat();
37- retdate=setDate(columns[3]);
38- }
3930
40- private void checkDateFormat() {
41-
42- if ("Always ask".equals(dateFormat)) {
43- askDateFormat("Provide date Format");
31+ dateFormat = Config.getLinuxDateFormat();
32+ if(!setDate(columns[3])){
33+ JOptionPane.showMessageDialog(mysar.getDataView(), String.format("Failed to parse date '%s' (format: '%s') from header.", columns[3], dateFormat), "Incorrect dateFormat", JOptionPane.WARNING_MESSAGE);
4434 }
45-
46- if(null != dateFormat)switch(dateFormat){
47- case "MM/DD/YYYY 23:59:59":
48- dateFormat = "MM/dd/yy";
49- break;
50- case "MM/DD/YYYY 12:59:59 AM|PM":
51- dateFormat = "MM/dd/yy";
52- timeFormat = "hh:mm:ss a";
53- timeColumn=2;
54- break;
55- case "DD/MM/YYYY 23:59:59":
56- dateFormat = "dd/MM/yy";
57- break;
58- case "YYYY-MM-DD 23:59:59":
59- dateFormat = "yy-MM-dd";
60- break;
61- }
35+
36+ timeFormat = Config.getLinuxTimeFormat();
37+ firstValueColumnIndex = timeFormat.split("\\s+").length;
6238 }
6339
64- private void askDateFormat(String s) {
65- if ( GlobalOptions.hasUI() ) {
66- LinuxDateFormat tmp = new LinuxDateFormat(GlobalOptions.getUI(),true);
67- tmp.setTitle(s);
68- if ( tmp.isOk()) {
69- dateFormat=tmp.getDateFormat();
70- if ( tmp.hasToRemenber() ) {
71- Config.setLinuxDateFormat(tmp.getDateFormat());
72- Config.save();
73- }
74- }
75- }
76- }
77-
7840 @Override
79- public int parse(String line, String[] columns) {
41+ public int parse(String line, String[] columns){
8042 int heure;
8143 int minute;
8244 int seconde;
8345 Second now;
8446
85- if ("Average:".equals(columns[0])){
47+ if("Average:".equals(columns[0])){
8648 currentStat = "NONE";
8749 return 0;
8850 }
@@ -100,68 +62,70 @@
10062 return 0;
10163 }
10264
103- try {
104- if ( timeColumn == 2 ) {
105- parsedate = new SimpleDateFormat(timeFormat).parse(columns[0]+" "+columns[1]);
106- } else {
107- parsedate = new SimpleDateFormat(timeFormat).parse(columns[0]);
65+ try{
66+ String timestamp;
67+ if(firstValueColumnIndex == 1){
68+ timestamp = columns[0];
69+ }else{
70+ timestamp = line.substring(0, line.indexOf(columns[firstValueColumnIndex-1]) + columns[firstValueColumnIndex-1].length());
10871 }
109- cal.setTime(parsedate);
72+ parseTime = new SimpleDateFormat(timeFormat).parse(timestamp);
73+
74+ cal.setTime(parseTime);
11075 heure = cal.get(Calendar.HOUR_OF_DAY);
11176 minute = cal.get(Calendar.MINUTE);
11277 seconde = cal.get(Calendar.SECOND);
11378 now = new Second(seconde, minute, heure, day, month, year);
114- if (startofstat == null) {
79+ if(startofstat == null){
11580 startofstat = now;
11681 startofgraph = now;
11782 }
118- if (endofstat == null) {
83+ if(endofstat == null){
11984 endofstat = now;
12085 endofgraph = now;
12186 }
122- if (now.compareTo(endofstat) > 0) {
87+ if(now.compareTo(endofstat) > 0){
12388 endofstat = now;
12489 endofgraph = now;
12590 }
126- firstdatacolumn = timeColumn;
127- } catch (ParseException ex) {
91+ }catch(ParseException ex){
12892 System.out.println("unable to parse time " + columns[0]);
12993 return -1;
13094 }
13195
13296 // 00:20:01 CPU i000/s i001/s i002/s i008/s i009/s i010/s i011/s i012/s i014/s
133- if ("CPU".equals(columns[firstdatacolumn]) && line.matches(".*i([0-9]+)/s.*")) {
97+ if("CPU".equals(columns[firstValueColumnIndex]) && line.matches(".*i([0-9]+)/s.*")){
13498 currentStat = "IGNORE";
13599 return 1;
136100 }
137101
138102 /** XML COLUMN PARSER **/
139- String checkStat = myosconfig.getStat(columns, firstdatacolumn);
140- if (checkStat != null) {
103+ String checkStat = osConfig.getStat(columns, firstValueColumnIndex);
104+ if(checkStat != null){
141105 Object obj = ListofGraph.get(checkStat);
142- if (obj == null) {
143- GraphConfig mygraphinfo = myosconfig.getGraphConfig(checkStat);
144- if (mygraphinfo != null) {
145- if ("unique".equals(mygraphinfo.getType())) {
146- obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn, mysar.graphtree);
106+ if(obj == null){
107+ GraphConfig mygraphinfo = osConfig.getGraphConfig(checkStat);
108+ if(mygraphinfo != null){
109+ if("unique".equals(mygraphinfo.getType())){
110+ obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex, mysar.getGraphTree());
147111
148112 ListofGraph.put(checkStat, obj);
149113 currentStat = checkStat;
150114 return 0;
151115 }
152- if ("multiple".equals(mygraphinfo.getType())) {
153- obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn);
116+ if("multiple".equals(mygraphinfo.getType())){
117+ obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex);
154118
155119 ListofGraph.put(checkStat, obj);
156120 currentStat = checkStat;
157121 return 0;
158122 }
159- } else {
123+ }else{
160124 // no graph associate
161125 currentStat = checkStat;
162126 return 0;
163127 }
164- } else {
128+ }else{
165129 currentStat = checkStat;
166130 return 0;
167131 }
@@ -168,34 +132,34 @@
168132 }
169133 //System.out.println( currentStat +" " + line);
170134
171- if (lastStat != null) {
172- if (!lastStat.equals(currentStat) ) {
173- if ( GlobalOptions.isDodebug()) {
135+ if(lastStat != null){
136+ if(!lastStat.equals(currentStat) ){
137+ if( GlobalOptions.isDodebug()) {
174138 System.out.println("Stat change from " + lastStat + " to " + currentStat);
175139 }
176140 lastStat = currentStat;
177141 }
178- } else {
142+ }else{
179143 lastStat = currentStat;
180144 }
181145
182- if ("IGNORE".equals(currentStat)) {
146+ if("IGNORE".equals(currentStat)){
183147 return 1;
184148 }
185- if ("NONE".equals(currentStat)) {
149+ if("NONE".equals(currentStat)){
186150 return -1;
187151 }
188152
189153 currentStatObj = ListofGraph.get(currentStat);
190- if (currentStatObj == null) {
154+ if(currentStatObj == null){
191155 return -1;
192- } else {
156+ }else{
193157 DateSamples.add(now);
194- if (currentStatObj instanceof Graph) {
158+ if(currentStatObj instanceof Graph){
195159 Graph ag = (Graph) currentStatObj;
196160 return ag.parse_line(now, line);
197161 }
198- if (currentStatObj instanceof List) {
162+ if(currentStatObj instanceof List){
199163 List ag = (List) currentStatObj;
200164 return ag.parse_line(now, line);
201165 }
--- trunk/src/net/atomique/ksar/Parser/AIX.java (revision 3)
+++ trunk/src/net/atomique/ksar/Parser/AIX.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.Parser;
62
73 import java.text.ParseException;
@@ -18,154 +14,152 @@
1814 * @author Max
1915 */
2016 public class AIX extends OSParser {
17+ Second now = null;
18+ boolean under_average = false;
2119
20+ public void parse_header(String s){
21+ String [] columns = s.split("\\s+");
22+ setOstype(columns[0]);
2223
23- public void parse_header(String s) {
24- String [] columns = s.split("\\s+");
25- setOstype(columns[0]);
24+ setHostname(columns[1]);
25+ setOSversion(columns[2]+ "." + columns[3]);
26+ setMacAddress(columns[4]);
27+ setDate(columns[5]);
28+
29+ }
2630
27- setHostname(columns[1]);
28- setOSversion(columns[2]+ "." + columns[3]);
29- setMacAddress(columns[4]);
30- setDate(columns[5]);
31-
32- }
31+ @Override
32+ public int parse(String line, String[] columns){
33+ int heure = 0;
34+ int minute = 0;
35+ int seconde = 0;
3336
34- @Override
35- public int parse(String line, String[] columns) {
36- int heure = 0;
37- int minute = 0;
38- int seconde = 0;
3937
38+ if("Average".equals(columns[0])){
39+ under_average = true;
40+ return 0;
41+ }
4042
41- if ("Average".equals(columns[0])) {
42- under_average = true;
43- return 0;
44- }
43+ if(line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0){
44+ return 0;
45+ }
4546
46- if (line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0) {
47- return 0;
48- }
47+ // match the System [C|c]onfiguration line on AIX
48+ if(line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0){
49+ return 0;
50+ }
4951
50- // match the System [C|c]onfiguration line on AIX
51- if (line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0) {
52- return 0;
53- }
52+ if(line.indexOf("State change") >= 0){
53+ return 0;
54+ }
5455
55- if (line.indexOf("State change") >= 0) {
56- return 0;
57- }
5856
57+ try{
58+ parseTime = new SimpleDateFormat(timeFormat).parse(columns[0]);
59+ cal.setTime(parseTime);
60+ heure = cal.get(cal.HOUR_OF_DAY);
61+ minute = cal.get(cal.MINUTE);
62+ seconde = cal.get(cal.SECOND);
63+ now = new Second(seconde, minute, heure, day, month, year);
64+ if(startofstat == null){
65+ startofstat = now;
66+ startofgraph =now;
67+ }
68+ if( endofstat == null){
69+ endofstat = now;
70+ endofgraph = now;
71+ }
72+ if(now.compareTo(endofstat) > 0){
73+ endofstat = now;
74+ endofgraph = now;
75+ }
76+ firstValueColumnIndex = 1;
77+ }catch(ParseException ex){
78+ if(! "DEVICE".equals(currentStat) || "CPUS".equals(currentStat)){
79+ System.out.println("unable to parse time " + columns[0]);
80+ return -1;
81+ }
82+ firstValueColumnIndex = 0;
83+ }
5984
60- try {
61- parsedate = new SimpleDateFormat(timeFormat).parse(columns[0]);
62- cal.setTime(parsedate);
63- heure = cal.get(cal.HOUR_OF_DAY);
64- minute = cal.get(cal.MINUTE);
65- seconde = cal.get(cal.SECOND);
66- now = new Second(seconde, minute, heure, day, month, year);
67- if (startofstat == null) {
68- startofstat = now;
69- startofgraph =now;
70- }
71- if ( endofstat == null) {
72- endofstat = now;
73- endofgraph = now;
74- }
75- if (now.compareTo(endofstat) > 0) {
76- endofstat = now;
77- endofgraph = now;
78- }
79- firstdatacolumn = 1;
80- } catch (ParseException ex) {
81- if (! "DEVICE".equals(currentStat) || "CPUS".equals(currentStat)) {
82- System.out.println("unable to parse time " + columns[0]);
83- return -1;
84- }
85- firstdatacolumn = 0;
86- }
8785
86+ /** XML COLUMN PARSER **/
87+ String checkStat = osConfig.getStat(columns, firstValueColumnIndex);
8888
89- /** XML COLUMN PARSER **/
90- String checkStat = myosconfig.getStat(columns, firstdatacolumn);
89+ if(checkStat != null){
90+ Object obj = ListofGraph.get(checkStat);
91+ if(obj == null){
92+ GraphConfig mygraphinfo = osConfig.getGraphConfig(checkStat);
93+ if(mygraphinfo != null){
94+ if("unique".equals(mygraphinfo.getType())){
95+ obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex, mysar.getGraphTree());
96+ ListofGraph.put(checkStat, obj);
97+ currentStat = checkStat;
98+ return 0;
99+ }
100+ if("multiple".equals(mygraphinfo.getType())){
101+ obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex);
102+ ListofGraph.put(checkStat, obj);
103+ currentStat = checkStat;
104+ return 0;
105+ }
106+ }else{
107+ // no graph associate
108+ currentStat = checkStat;
109+ return 0;
110+ }
111+ }else{
112+ currentStat = checkStat;
113+ return 0;
114+ }
115+ }
91116
92- if (checkStat != null) {
93- Object obj = ListofGraph.get(checkStat);
94- if (obj == null) {
95- GraphConfig mygraphinfo = myosconfig.getGraphConfig(checkStat);
96- if (mygraphinfo != null) {
97- if ("unique".equals(mygraphinfo.getType())) {
98- obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn, mysar.graphtree);
99- ListofGraph.put(checkStat, obj);
100- currentStat = checkStat;
101- return 0;
102- }
103- if ("multiple".equals(mygraphinfo.getType())) {
104- obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn);
105- ListofGraph.put(checkStat, obj);
106- currentStat = checkStat;
107- return 0;
108- }
109- } else {
110- // no graph associate
111- currentStat = checkStat;
112- return 0;
113- }
114- } else {
115- currentStat = checkStat;
116- return 0;
117- }
118- }
117+ //System.out.println(currentStat + " " + line);
119118
120- //System.out.println(currentStat + " " + line);
121119
122120
121+ if(lastStat != null){
122+ if(!lastStat.equals(currentStat) ){
123+ if( GlobalOptions.isDodebug()) {
124+ System.out.println("Stat change from " + lastStat + " to " + currentStat);
125+ }
126+ lastStat = currentStat;
127+ under_average = false;
128+ }
129+ }else{
130+ lastStat = currentStat;
131+ }
132+
133+ if("IGNORE".equals(currentStat)){
134+ return 1;
135+ }
136+ if("NONE".equals(currentStat)){
137+ return -1;
138+ }
123139
124- if (lastStat != null) {
125- if (!lastStat.equals(currentStat) ) {
126- if ( GlobalOptions.isDodebug()) {
127- System.out.println("Stat change from " + lastStat + " to " + currentStat);
128- }
129- lastStat = currentStat;
130- under_average = false;
131- }
132- } else {
133- lastStat = currentStat;
134- }
135-
136- if ("IGNORE".equals(currentStat)) {
137- return 1;
138- }
139- if ("NONE".equals(currentStat)) {
140- return -1;
141- }
140+ if(under_average){
141+ return 0;
142+ }
143+ currentStatObj = ListofGraph.get(currentStat);
144+ if(currentStatObj == null){
145+ return -1;
146+ }else{
147+ DateSamples.add(now);
148+ if(currentStatObj instanceof Graph){
149+ Graph ag = (Graph) currentStatObj;
150+ return ag.parse_line(now, line);
151+ }
152+ if(currentStatObj instanceof List){
153+ List ag = (List) currentStatObj;
154+ return ag.parse_line(now, line);
155+ }
156+ }
157+ return -1;
158+ }
142159
143- if (under_average) {
144- return 0;
145- }
146- currentStatObj = ListofGraph.get(currentStat);
147- if (currentStatObj == null) {
148- return -1;
149- } else {
150- DateSamples.add(now);
151- if (currentStatObj instanceof Graph) {
152- Graph ag = (Graph) currentStatObj;
153- return ag.parse_line(now, line);
154- }
155- if (currentStatObj instanceof List) {
156- List ag = (List) currentStatObj;
157- return ag.parse_line(now, line);
158- }
159- }
160- return -1;
161- }
162-
163- public void updateUITitle() {
164- if ( mysar.getDataView() != null) {
165- mysar.getDataView().setTitle(Hostname + " from "+ startofgraph + " to " + endofgraph);
166- }
167- }
168-
169- Second now = null;
170- boolean under_average = false;
160+ public void updateUITitle(){
161+ if( mysar.getDataView() != null){
162+ mysar.getDataView().setTitle(hostname + " from "+ startofgraph + " to " + endofgraph);
163+ }
164+ }
171165 }
--- trunk/src/net/atomique/ksar/Parser/HPUX.java (revision 3)
+++ trunk/src/net/atomique/ksar/Parser/HPUX.java (revision 4)
@@ -1,15 +1,7 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.Parser;
62
73 import java.text.ParseException;
84 import java.text.SimpleDateFormat;
9-import java.util.Calendar;
10-import java.util.Date;
11-import java.util.logging.Level;
12-import java.util.logging.Logger;
135 import net.atomique.ksar.OSParser;
146 import net.atomique.ksar.GlobalOptions;
157 import net.atomique.ksar.Graph.Graph;
@@ -22,149 +14,140 @@
2214 * @author Max
2315 */
2416 public class HPUX extends OSParser {
17+ Second now = null;
18+ boolean under_average = false;
2519
26- public void parse_header(String s) {
27- String[] columns = s.split("\\s+");
28- setOstype(columns[0]);
29- setHostname(columns[1]);
30- setOSversion(columns[2]);
31- setKernel(columns[3]);
32- setCpuType(columns[4]);
33- setDate(columns[5]);
20+ @Override
21+ public void parse_header(String s){
22+ String[] columns = s.split("\\s+");
23+ setOstype(columns[0]);
24+ setHostname(columns[1]);
25+ setOSversion(columns[2]);
26+ setKernel(columns[3]);
27+ setCpuType(columns[4]);
28+ setDate(columns[5]);
29+ }
30+
31+ @Override
32+ public int parse(String line, String[] columns){
33+ int heure = 0;
34+ int minute = 0;
35+ int seconde = 0;
3436
35- }
37+ if("Average".equals(columns[0])){
38+ under_average = true;
39+ return 0;
40+ }
3641
37-
38- @Override
39- public int parse(String line, String[] columns) {
40- int heure = 0;
41- int minute = 0;
42- int seconde = 0;
42+ if(line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0){
43+ return 0;
44+ }
4345
46+ // match the System [C|c]onfiguration line on AIX
47+ if(line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0){
48+ return 0;
49+ }
4450
45- if ("Average".equals(columns[0])) {
46- under_average = true;
47- return 0;
48- }
51+ if(line.indexOf("State change") >= 0){
52+ return 0;
53+ }
4954
50- if (line.indexOf("unix restarts") >= 0 || line.indexOf(" unix restarted") >= 0) {
51- return 0;
52- }
55+ try{
56+ parseTime = new SimpleDateFormat("HH:mm:SS").parse(columns[0]);
57+ cal.setTime(parseTime);
58+ heure = cal.get(cal.HOUR_OF_DAY);
59+ minute = cal.get(cal.MINUTE);
60+ seconde = cal.get(cal.SECOND);
61+ now = new Second(seconde, minute, heure, day, month, year);
62+ if(startofstat == null){
63+ startofstat = now;
64+ startofgraph =now;
65+ }
66+ if( endofstat == null){
67+ endofstat = now;
68+ endofgraph = now;
69+ }
70+ if(now.compareTo(endofstat) > 0){
71+ endofstat = now;
72+ endofgraph = now;
73+ }
74+ firstValueColumnIndex = 1;
75+ }catch(ParseException ex){
76+ if( ! "DEVICE".equals(currentStat) && ! "CPU".equals(currentStat)){
77+ System.out.println("unable to parse time " + columns[0]);
78+ return -1;
79+ }
80+ firstValueColumnIndex = 0;
81+ }
5382
54- // match the System [C|c]onfiguration line on AIX
55- if (line.indexOf("System Configuration") >= 0 || line.indexOf("System configuration") >= 0) {
56- return 0;
57- }
5883
59- if (line.indexOf("State change") >= 0) {
60- return 0;
61- }
84+ /** XML COLUMN PARSER **/
85+ String checkStat = osConfig.getStat(columns, firstValueColumnIndex);
6286
87+ if(checkStat != null){
88+ Object obj = ListofGraph.get(checkStat);
89+ if(obj == null){
90+ GraphConfig mygraphinfo = osConfig.getGraphConfig(checkStat);
91+ if(mygraphinfo != null){
92+ if("unique".equals(mygraphinfo.getType())){
93+ obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex, mysar.getGraphTree());
94+ ListofGraph.put(checkStat, obj);
95+ currentStat = checkStat;
96+ return 0;
97+ }
98+ if("multiple".equals(mygraphinfo.getType())){
99+ obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstValueColumnIndex);
100+ ListofGraph.put(checkStat, obj);
101+ currentStat = checkStat;
102+ return 0;
103+ }
104+ }else{
105+ // no graph associate
106+ currentStat = checkStat;
107+ return 0;
108+ }
109+ }else{
110+ currentStat = checkStat;
111+ return 0;
112+ }
113+ }
114+ //System.out.println(currentStat + " " + line);
63115
64- try {
65- parsedate = new SimpleDateFormat("HH:mm:SS").parse(columns[0]);
66- cal.setTime(parsedate);
67- heure = cal.get(cal.HOUR_OF_DAY);
68- minute = cal.get(cal.MINUTE);
69- seconde = cal.get(cal.SECOND);
70- now = new Second(seconde, minute, heure, day, month, year);
71- if (startofstat == null) {
72- startofstat = now;
73- startofgraph =now;
74- }
75- if ( endofstat == null) {
76- endofstat = now;
77- endofgraph = now;
78- }
79- if (now.compareTo(endofstat) > 0) {
80- endofstat = now;
81- endofgraph = now;
82- }
83- firstdatacolumn = 1;
84- } catch (ParseException ex) {
85- if ( ! "DEVICE".equals(currentStat) && ! "CPU".equals(currentStat)) {
86- System.out.println("unable to parse time " + columns[0]);
87- return -1;
88- }
89- firstdatacolumn = 0;
90- }
116+ if(lastStat != null){
117+ if(!lastStat.equals(currentStat) ){
118+ if( GlobalOptions.isDodebug()) {
119+ System.out.println("Stat change from " + lastStat + " to " + currentStat);
120+ }
121+ lastStat = currentStat;
122+ under_average = false;
123+ }
124+ }else{
125+ lastStat = currentStat;
126+ }
127+
128+ if("IGNORE".equals(currentStat)){
129+ return 1;
130+ }
131+ if("NONE".equals(currentStat)){
132+ return -1;
133+ }
91134
92-
93- /** XML COLUMN PARSER **/
94- String checkStat = myosconfig.getStat(columns, firstdatacolumn);
95-
96- if (checkStat != null) {
97- Object obj = ListofGraph.get(checkStat);
98- if (obj == null) {
99- GraphConfig mygraphinfo = myosconfig.getGraphConfig(checkStat);
100- if (mygraphinfo != null) {
101- if ("unique".equals(mygraphinfo.getType())) {
102- obj = new Graph(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn, mysar.graphtree);
103- ListofGraph.put(checkStat, obj);
104- currentStat = checkStat;
105- return 0;
106- }
107- if ("multiple".equals(mygraphinfo.getType())) {
108- obj = new List(mysar, mygraphinfo, mygraphinfo.getTitle(), line, firstdatacolumn);
109- ListofGraph.put(checkStat, obj);
110- currentStat = checkStat;
111- return 0;
112- }
113- } else {
114- // no graph associate
115- currentStat = checkStat;
116- return 0;
117- }
118- } else {
119- currentStat = checkStat;
120- return 0;
121- }
122- }
123-
124- //System.out.println(currentStat + " " + line);
125-
126-
127-
128- if (lastStat != null) {
129- if (!lastStat.equals(currentStat) ) {
130- if ( GlobalOptions.isDodebug()) {
131- System.out.println("Stat change from " + lastStat + " to " + currentStat);
132- }
133- lastStat = currentStat;
134- under_average = false;
135- }
136- } else {
137- lastStat = currentStat;
138- }
139-
140- if ("IGNORE".equals(currentStat)) {
141- return 1;
142- }
143- if ("NONE".equals(currentStat)) {
144- return -1;
145- }
146-
147- if (under_average) {
148- return 0;
149- }
150- currentStatObj = ListofGraph.get(currentStat);
151- if (currentStatObj == null) {
152- return -1;
153- } else {
154- if (currentStatObj instanceof Graph) {
155- Graph ag = (Graph) currentStatObj;
156- return ag.parse_line(now, line);
157- }
158- if (currentStatObj instanceof List) {
159- List ag = (List) currentStatObj;
160- return ag.parse_line(now, line);
161- }
162- }
163- return -1;
164- }
165- Second now = null;
166- boolean under_average = false;
167- Calendar cal = Calendar.getInstance();
168- Date parsedate = null;
169-
135+ if(under_average){
136+ return 0;
137+ }
138+ currentStatObj = ListofGraph.get(currentStat);
139+ if(currentStatObj == null){
140+ return -1;
141+ }else{
142+ if(currentStatObj instanceof Graph){
143+ Graph ag = (Graph) currentStatObj;
144+ return ag.parse_line(now, line);
145+ }
146+ if(currentStatObj instanceof List){
147+ List ag = (List) currentStatObj;
148+ return ag.parse_line(now, line);
149+ }
150+ }
151+ return -1;
152+ }
170153 }
--- trunk/src/net/atomique/ksar/XML/ColumnConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/ColumnConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 import java.awt.Color;
@@ -12,62 +8,62 @@
128 */
139 public class ColumnConfig {
1410
15- public ColumnConfig(String s) {
11+ public ColumnConfig(String s){
1612 data_title=s;
1713 }
18- public String getData_colorstr() {
14+ public String getData_colorstr(){
1915 return data_colorstr;
2016 }
2117
22- public void setData_color(String data_color) {
18+ public void setData_color(String data_color){
2319 String[] color_indices = data_color.split(",");
2420 this.data_colorstr = data_color;
25- if (color_indices.length == 3) {
26- try {
21+ if(color_indices.length == 3){
22+ try{
2723 Integer red = new Integer(color_indices[0]);
2824 Integer green = new Integer(color_indices[1]);
2925 Integer blue = new Integer(color_indices[2]);
3026 this.data_color = new Color(red, green, blue);
31- } catch (NumberFormatException ee) {
27+ }catch(NumberFormatException ee){
3228 }
3329 }
3430 }
3531
36- public Color getData_color() {
32+ public Color getData_color(){
3733 return data_color;
3834 }
3935
40- public String getData_title() {
36+ public String getData_title(){
4137 return data_title;
4238 }
4339
44- public void setData_title(String data_title) {
40+ public void setData_title(String data_title){
4541 this.data_title = data_title;
4642 }
4743
4844 public void setType(String s){
49- if ( "gauge".equals(s)) {
45+ if( "gauge".equals(s)){
5046 type=1;
5147 }
52- if ( "counter".equals(s)) {
48+ if( "counter".equals(s)){
5349 type=2;
5450 }
5551 }
5652
57- public int getType() {
53+ public int getType(){
5854 return type;
5955 }
6056
61- public boolean is_valid() {
62- if (data_title == null) {
57+ public boolean is_valid(){
58+ if(data_title == null){
6359 error_message = "Column header name not found";
6460 return false;
6561 }
66- if (data_colorstr == null) {
62+ if(data_colorstr == null){
6763 error_message = "color info missing for " + data_title;
6864 return false;
6965 }
70- if (data_color == null) {
66+ if(data_color == null){
7167 error_message = "color " + data_colorstr + " is not a valid color";
7268 return false;
7369 }
@@ -74,7 +70,7 @@
7470 return true;
7571 }
7672
77- public String getError_message() {
73+ public String getError_message(){
7874 return error_message;
7975 }
8076
--- trunk/src/net/atomique/ksar/XML/PlotConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/PlotConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 import java.text.NumberFormat;
@@ -15,38 +11,38 @@
1511 */
1612 public class PlotConfig {
1713
18- public PlotConfig(String s) {
14+ public PlotConfig(String s){
1915 Title = s;
2016 }
2117
22- public String[] getHeader() {
18+ public String[] getHeader(){
2319 return Header;
2420 }
2521
26- public String getTitle() {
22+ public String getTitle(){
2723 return Title;
2824 }
2925
30- public void setHeaderStr(String s) {
26+ public void setHeaderStr(String s){
3127 this.Header = s.split("\\s+");
3228 HeaderStr = s;
3329 }
3430
35- public String getHeaderStr() {
31+ public String getHeaderStr(){
3632 return HeaderStr;
3733 }
3834
39- public int getSize() {
35+ public int getSize(){
4036 return size;
4137 }
4238
43- public void setSize(int size) {
39+ public void setSize(int size){
4440 this.size = size;
4541 }
4642
47- public void setSize(String s) {
43+ public void setSize(String s){
4844 Integer tmp = new Integer(s);
49- if (tmp == null) {
45+ if(tmp == null){
5046 return;
5147 }
5248 this.size = size;
@@ -53,33 +49,33 @@
5349 }
5450
5551
56- public NumberAxis getAxis() {
52+ public NumberAxis getAxis(){
5753 NumberAxis tmp = new NumberAxis(Title);
58- if ("1024".equals(base)) {
54+ if("1024".equals(base)){
5955 NumberFormat decimalformat1 = new IEEE1541Number(factor.intValue());
6056 tmp.setNumberFormatOverride(decimalformat1);
6157 }
6258
63- if (range != null) {
59+ if(range != null){
6460 tmp.setRange(range);
6561 }
6662 return tmp;
6763 }
6864
69- public void setBase(String s) {
70- if (s == null) {
65+ public void setBase(String s){
66+ if(s == null){
7167 return;
7268 }
7369 base = s;
7470 }
7571
76- public void setFactor(String s) {
72+ public void setFactor(String s){
7773 factor = Double.parseDouble(s);
7874 }
7975
80- public void setRange(String s) {
76+ public void setRange(String s){
8177 String[] t = s.split(",");
82- if (t.length == 2) {
78+ if(t.length == 2){
8379 Double min = Double.parseDouble(t[0]);
8480 Double max = Double.parseDouble(t[1]);
8581 range = new Range(min, max);
--- trunk/src/net/atomique/ksar/XML/GraphConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/GraphConfig.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.XML;
72
83 import java.util.HashMap;
@@ -13,36 +8,36 @@
138 */
149 public class GraphConfig {
1510
16- public GraphConfig(String s1, String s2, String s3) {
11+ public GraphConfig(String s1, String s2, String s3){
1712 name = s1;
1813 Title = s2;
1914 type= s3;
2015 }
21- public String getTitle() {
16+ public String getTitle(){
2217 return Title;
2318 }
2419
25- public String getName() {
20+ public String getName(){
2621 return name;
2722 }
2823
29- public String getType() {
24+ public String getType(){
3025 return type;
3126 }
3227
33- public void addPlot(PlotConfig s) {
28+ public void addPlot(PlotConfig s){
3429 Plotlist.put(s.getTitle(), s);
3530 }
3631
37- public HashMap<String, PlotConfig> getPlotlist() {
32+ public HashMap<String, PlotConfig> getPlotlist(){
3833 return Plotlist;
3934 }
4035
41- public void addStack(StackConfig s) {
36+ public void addStack(StackConfig s){
4237 Stacklist.put(s.getTitle(), s);
4338 }
4439
45- public HashMap<String, StackConfig> getStacklist() {
40+ public HashMap<String, StackConfig> getStacklist(){
4641 return Stacklist;
4742 }
4843
--- trunk/src/net/atomique/ksar/XML/OSConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/OSConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 import java.util.HashMap;
@@ -12,29 +8,31 @@
128 * @author alex
139 */
1410 public class OSConfig {
11+ private String osname = null;
12+ HashMap<String, StatConfig> statMap = new HashMap<>();
13+ HashMap<String, GraphConfig> graphMap = new HashMap<>();
1514
16- public OSConfig(String s) {
17- OSname = s;
15+ public OSConfig(String s){
16+ osname = s;
1817 }
1918
20- public void addStat(StatConfig s) {
21- StatHash.put(s.getStatName(), s);
19+ public void addStat(StatConfig s){
20+ statMap.put(s.getStatName(), s);
2221 }
2322
24- public void addGraph(GraphConfig s) {
25- GraphHash.put(s.getName(), s);
23+ public void addGraph(GraphConfig s){
24+ graphMap.put(s.getName(), s);
2625 }
2726
28- public String getOSname() {
29- return OSname;
27+ public String getOSname(){
28+ return osname;
3029 }
3130
32- public String getStat(String[] columns, int firstdatacolumn) {
33-
34- StringBuffer tmpbuf = new StringBuffer();
31+ public String getStat(String[] columns, int firstdatacolumn){
32+ StringBuilder tmpbuf = new StringBuilder();
3533 int num = 0;
36- for (int i = firstdatacolumn; i < columns.length; i++) {
37- if (tmpbuf.length() != 0) {
34+ for(int i = firstdatacolumn; i < columns.length; i++){
35+ if(tmpbuf.length() != 0){
3836 tmpbuf.append(" ");
3937 }
4038 tmpbuf.append(columns[i]);
@@ -41,11 +39,11 @@
4139 num++;
4240 }
4341
44- Iterator<String> ite = StatHash.keySet().iterator();
45- while (ite.hasNext()) {
42+ Iterator<String> ite = statMap.keySet().iterator();
43+ while(ite.hasNext()){
4644 String tmptitle = ite.next();
47- StatConfig tmp = (StatConfig) StatHash.get(tmptitle);
48- if (tmp.check_Header(tmpbuf.toString(), num)) {
45+ StatConfig tmp = (StatConfig) statMap.get(tmptitle);
46+ if(tmp.check_Header(tmpbuf.toString(), num)){
4947 return tmp.getGraphName();
5048 }
5149 }
@@ -52,15 +50,15 @@
5250 return null;
5351 }
5452
55- public StatConfig getStat(String statName) {
56- if (StatHash.isEmpty()) {
53+ public StatConfig getStat(String statName){
54+ if(statMap.isEmpty()){
5755 return null;
5856 }
59- Iterator<String> ite = StatHash.keySet().iterator();
60- while (ite.hasNext()) {
57+ Iterator<String> ite = statMap.keySet().iterator();
58+ while(ite.hasNext()){
6159 String tmptitle = ite.next();
62- StatConfig tmp = (StatConfig) StatHash.get(tmptitle);
63- if ( tmp.getGraphName().equals(statName)) {
60+ StatConfig tmp = (StatConfig) statMap.get(tmptitle);
61+ if( tmp.getGraphName().equals(statName)){
6462 return tmp;
6563 }
6664 }
@@ -67,21 +65,18 @@
6765 return null;
6866 }
6967
70- public GraphConfig getGraphConfig(String s) {
71- if (GraphHash.isEmpty()) {
68+ public GraphConfig getGraphConfig(String s){
69+ if(graphMap.isEmpty()){
7270 return null;
7371 }
74- return GraphHash.get(s);
72+ return graphMap.get(s);
7573 }
7674
77- public HashMap<String, StatConfig> getStatHash() {
78- return StatHash;
75+ public HashMap<String, StatConfig> getStatHash(){
76+ return statMap;
7977 }
8078
81- public HashMap<String, GraphConfig> getGraphHash() {
82- return GraphHash;
79+ public HashMap<String, GraphConfig> getGraphHash(){
80+ return graphMap;
8381 }
84- private String OSname = null;
85- HashMap<String, StatConfig> StatHash = new HashMap<String, StatConfig>();
86- HashMap<String, GraphConfig> GraphHash = new HashMap<String, GraphConfig>();
8782 }
--- trunk/src/net/atomique/ksar/XML/HostInfo.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/HostInfo.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.XML;
72
83 /**
@@ -11,50 +6,50 @@
116 */
127 public class HostInfo {
138
14- public HostInfo(String s) {
9+ public HostInfo(String s){
1510 this.setHostname(s);
1611 }
1712
18- public Integer getMemBlockSize() {
13+ public Integer getMemBlockSize(){
1914 return MemBlockSize;
2015 }
2116
22- public void setMemBlockSize(Integer MemBlockSize) {
17+ public void setMemBlockSize(Integer MemBlockSize){
2318 this.MemBlockSize = MemBlockSize;
2419 }
2520
26- public void setMemBlockSize(String MemBlockSizestr) {
27- try {
21+ public void setMemBlockSize(String MemBlockSizestr){
22+ try{
2823 this.MemBlockSize = Integer.parseInt(MemBlockSizestr);
29- } catch ( NumberFormatException nfe) {
24+ } catch ( NumberFormatException nfe){
3025 }
3126 }
3227
33- public String getAlias() {
28+ public String getAlias(){
3429 return aka_hostname;
3530 }
3631
37- public void setAlias(String aka_hostname) {
32+ public void setAlias(String aka_hostname){
3833 this.aka_hostname = aka_hostname;
3934 }
4035
41- public String getDescription() {
36+ public String getDescription(){
4237 return description;
4338 }
4439
45- public void setDescription(String description) {
40+ public void setDescription(String description){
4641 this.description = description;
4742 }
4843
49- public String getHostname() {
44+ public String getHostname(){
5045 return sar_hostname;
5146 }
5247
53- public void setHostname(String sar_hostname) {
48+ public void setHostname(String sar_hostname){
5449 this.sar_hostname = sar_hostname;
5550 }
5651
57- public String save() {
52+ public String save(){
5853 StringBuilder tmp = new StringBuilder();
5954 tmp.append("\t\t<host name=\"" + sar_hostname + "\">\n");
6055 tmp.append("\t\t\t<alias>" + aka_hostname + "</alias>\n");
--- trunk/src/net/atomique/ksar/XML/CnxHistory.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/CnxHistory.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 import java.util.Iterator;
@@ -13,91 +9,91 @@
139 */
1410 public class CnxHistory {
1511
16- public CnxHistory(String link) {
12+ public CnxHistory(String link){
1713 this.link=link;
1814 commandList = new TreeSet<String>();
1915 String[] s = link.split("@", 2);
20- if (s.length != 2) {
16+ if(s.length != 2){
2117 return;
2218 }
2319 this.setUsername(s[0]);
2420 String[] t = s[1].split(":");
25- if (t.length == 2) {
21+ if(t.length == 2){
2622 this.setHostname(t[0]);
2723 this.setPort(t[1]);
28- } else {
24+ }else{
2925 this.setHostname(s[1]);
3026 this.setPort("22");
3127 }
3228 }
3329
34- public void addCommand(String s) {
30+ public void addCommand(String s){
3531 commandList.add(s);
3632 }
3733
38- public TreeSet<String> getCommandList() {
34+ public TreeSet<String> getCommandList(){
3935 return commandList;
4036 }
4137
42- public String getHostname() {
38+ public String getHostname(){
4339 return hostname;
4440 }
4541
46- public void setHostname(String hostname) {
42+ public void setHostname(String hostname){
4743 this.hostname = hostname;
4844 }
4945
50- public String getUsername() {
46+ public String getUsername(){
5147 return username;
5248 }
5349
54- public void setUsername(String username) {
50+ public void setUsername(String username){
5551 this.username = username;
5652 }
5753
58- public String getPort() {
54+ public String getPort(){
5955 return port;
6056 }
6157
62- public int getPortInt() {
58+ public int getPortInt(){
6359 Integer tmp = Integer.parseInt(port);
6460 return tmp.intValue();
6561 }
6662
67- public void setPort(String port) {
63+ public void setPort(String port){
6864 this.port = port;
6965 }
7066
71- public String getLink() {
67+ public String getLink(){
7268 return link;
7369 }
7470
75- public boolean isValid() {
76- if (username == null) {
71+ public boolean isValid(){
72+ if(username == null){
7773 return false;
7874 }
79- if (hostname == null) {
75+ if(hostname == null){
8076 return false;
8177 }
82- if (commandList.isEmpty()) {
78+ if(commandList.isEmpty()){
8379 return false;
8480 }
8581 return true;
8682 }
8783
88- public void dump() {
84+ public void dump(){
8985 System.out.println(username + "@" + hostname + ":" + commandList);
9086 }
9187
92- public String save() {
88+ public String save(){
9389 StringBuilder tmp = new StringBuilder();
94- if ( "22".equals(port)) {
90+ if( "22".equals(port)){
9591 tmp.append("\t\t<cnx link=\"" + username + "@" + hostname + "\">\n");
96- } else {
92+ }else{
9793 tmp.append("\t\t<cnx link=\"" + username + "@" + hostname + ":" + port + "\">\n");
9894 }
9995 Iterator<String> ite = commandList.iterator();
100- while (ite.hasNext()) {
96+ while(ite.hasNext()){
10197 tmp.append("\t\t\t<command>").append(ite.next()).append("</command>\n");
10298 }
10399 tmp.append("\t\t</cnx>\n");
--- trunk/src/net/atomique/ksar/XML/StackConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/StackConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 import java.text.NumberFormat;
@@ -15,28 +11,28 @@
1511 */
1612 public class StackConfig {
1713
18- public StackConfig(String s) {
14+ public StackConfig(String s){
1915 Title = s;
2016 }
2117
22- public String[] getHeader() {
18+ public String[] getHeader(){
2319 return Header;
2420 }
2521
26- public String getTitle() {
22+ public String getTitle(){
2723 return Title;
2824 }
2925
30- public void setHeaderStr(String s) {
26+ public void setHeaderStr(String s){
3127 this.Header = s.split("\\s+");
3228 HeaderStr = s;
3329 }
3430
35- public String getHeaderStr() {
31+ public String getHeaderStr(){
3632 return HeaderStr;
3733 }
3834
39- public void print() {
35+ public void print(){
4036 System.out.println("Title " + Title);
4137 System.out.println("HeaderStr " + HeaderStr);
4238 System.out.println("Header " + Header);
@@ -43,49 +39,49 @@
4339
4440 }
4541
46- public int getSize() {
42+ public int getSize(){
4743 return size;
4844 }
4945
50- public void setSize(int size) {
46+ public void setSize(int size){
5147 this.size = size;
5248 }
5349
54- public void setSize(String s) {
50+ public void setSize(String s){
5551 Integer tmp = new Integer(s);
56- if (tmp == null) {
52+ if(tmp == null){
5753 return;
5854 }
5955 this.size = tmp.intValue();
6056 }
6157
62- public NumberAxis getAxis() {
58+ public NumberAxis getAxis(){
6359 NumberAxis tmp = new NumberAxis(Title);
64- if ("1024".equals(base)) {
60+ if("1024".equals(base)){
6561 NumberFormat decimalformat1 = new IEEE1541Number(factor.intValue());
6662 tmp.setNumberFormatOverride(decimalformat1);
6763 }
6864
69- if (range != null) {
65+ if(range != null){
7066 tmp.setRange(range);
7167 }
7268 return tmp;
7369 }
7470
75- public void setBase(String s) {
76- if (s == null) {
71+ public void setBase(String s){
72+ if(s == null){
7773 return;
7874 }
7975 base = s;
8076 }
8177
82- public void setFactor(String s) {
78+ public void setFactor(String s){
8379 factor = Double.parseDouble(s);
8480 }
8581
86- public void setRange(String s) {
82+ public void setRange(String s){
8783 String[] t = s.split(",");
88- if (t.length == 2) {
84+ if(t.length == 2){
8985 Double min = Double.parseDouble(t[0]);
9086 Double max = Double.parseDouble(t[1]);
9187 range = new Range(min, max);
--- trunk/src/net/atomique/ksar/XML/StatConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XML/StatConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.XML;
62
73 /**
@@ -10,60 +6,60 @@
106 */
117 public class StatConfig {
128
13- public StatConfig(String s) {
9+ public StatConfig(String s){
1410 StatName = s;
1511 }
1612
17- public String getGraphName() {
13+ public String getGraphName(){
1814 return GraphName;
1915 }
2016
21- public void setGraphName(String GraphName) {
17+ public void setGraphName(String GraphName){
2218 this.GraphName = GraphName;
2319 }
2420
25- public String[] getHeader() {
21+ public String[] getHeader(){
2622 return Header;
2723 }
2824
29- public String getHeaderStr() {
25+ public String getHeaderStr(){
3026 return HeaderStr;
3127 }
3228
33- public void setHeaderStr(String s) {
29+ public void setHeaderStr(String s){
3430 HeaderStr = s;
3531 this.Header = HeaderStr.split("\\s+");
3632 HeaderNum = Header.length;
3733 }
3834
39- public String getStatName() {
35+ public String getStatName(){
4036 return StatName;
4137 }
4238
43- public boolean check_Header(String c, int i) {
44- if (!compare_Header(i)) {
39+ public boolean check_Header(String c, int i){
40+ if(!compare_Header(i)){
4541 return false;
4642 }
4743
48- if (HeaderStr.equals(c)) {
44+ if(HeaderStr.equals(c)){
4945 return true;
5046 }
5147 return false;
5248 }
5349
54- public boolean compare_Header(int i) {
55- if (i == HeaderNum) {
50+ public boolean compare_Header(int i){
51+ if(i == HeaderNum){
5652 return true;
5753 }
5854 return false;
5955 }
6056
61- public boolean canDuplicateTime() {
57+ public boolean canDuplicateTime(){
6258 return duplicatetime;
6359 }
6460
65- public void setDuplicateTime(String s) {
66- if ( "yes".equals(s) || "true".equals(s) ){
61+ public void setDuplicateTime(String s){
62+ if( "yes".equals(s) || "true".equals(s) ){
6763 duplicatetime=true;
6864 }
6965 }
--- trunk/src/net/atomique/ksar/Graph/IEEE1541Number.java (revision 3)
+++ trunk/src/net/atomique/ksar/Graph/IEEE1541Number.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.Graph;
72
83 import java.text.DecimalFormat;
@@ -16,45 +11,45 @@
1611 */
1712 public class IEEE1541Number extends NumberFormat {
1813
19- private static final long serialVersionUID = 5L;
14+ private static final long serialVersionUID = 5L;
2015
21- public IEEE1541Number() {
22- }
16+ public IEEE1541Number(){
17+ }
2318
24- public IEEE1541Number(int value) {
25- kilo = value;
26- }
19+ public IEEE1541Number(int value){
20+ kilo = value;
21+ }
2722
28- public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) {
29- if (kilo == 0) {
30- return toAppendTo.append(number);
31- }
32- if ((number * kilo) < 1024) {
33- return toAppendTo.append(number);
34- }
35- if ((number * kilo) < (1024 * 1024)) {
36- DecimalFormat formatter = new DecimalFormat("#,##0.0");
37- toAppendTo.append(formatter.format((double) number / 1024.0)).append(" KB");
38- return toAppendTo;
39- }
40- if ((number * kilo) < (1024 * 1024 * 1024)) {
41- DecimalFormat formatter = new DecimalFormat("#,##0.0");
42- toAppendTo.append(formatter.format((double) (number * kilo) / (1024.0 * 1024.0))).append(" MB");
43- return toAppendTo;
44- }
23+ public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos){
24+ if(kilo == 0){
25+ return toAppendTo.append(number);
26+ }
27+ if((number * kilo) < 1024){
28+ return toAppendTo.append(number);
29+ }
30+ if((number * kilo) < (1024 * 1024)){
31+ DecimalFormat formatter = new DecimalFormat("#,##0.0");
32+ toAppendTo.append(formatter.format((double) number / 1024.0)).append(" KB");
33+ return toAppendTo;
34+ }
35+ if((number * kilo) < (1024 * 1024 * 1024)){
36+ DecimalFormat formatter = new DecimalFormat("#,##0.0");
37+ toAppendTo.append(formatter.format((double) (number * kilo) / (1024.0 * 1024.0))).append(" MB");
38+ return toAppendTo;
39+ }
4540
46- DecimalFormat formatter = new DecimalFormat("#,##0.0");
47- toAppendTo.append(formatter.format((double) (number * kilo) / (1024.0 * 1024.0 * 1024.0))).append(" GB");
48- return toAppendTo;
49- }
41+ DecimalFormat formatter = new DecimalFormat("#,##0.0");
42+ toAppendTo.append(formatter.format((double) (number * kilo) / (1024.0 * 1024.0 * 1024.0))).append(" GB");
43+ return toAppendTo;
44+ }
5045
51- public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) {
52- return format((double) (number * kilo), toAppendTo, pos);
53- }
46+ public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos){
47+ return format((double) (number * kilo), toAppendTo, pos);
48+ }
5449
55- public Number parse(String source, ParsePosition parsePosition) {
56- return null;
57- }
58-
59- int kilo = 0;
50+ public Number parse(String source, ParsePosition parsePosition){
51+ return null;
52+ }
53+
54+ int kilo = 0;
6055 }
--- trunk/src/net/atomique/ksar/Graph/List.java (revision 3)
+++ trunk/src/net/atomique/ksar/Graph/List.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.Graph;
72
83 import java.awt.LayoutManager;
@@ -24,98 +19,95 @@
2419 *
2520 * @author alex
2621 */
27-public class List {
22+public class List{
23+ protected GraphConfig graphconfig = null;
24+ protected SortedTreeNode parentTreeNode = null;
25+ protected KSar mysar = null;
26+ protected String HeaderStr = null;
27+ protected Map<String, Graph> nodeHashList = new HashMap<>();
28+ protected int skipColumn = 0;
29+ protected String Title = null;
2830
29- public List(KSar hissar, GraphConfig g,String stitle, String sheader, int i) {
30- mysar = hissar;
31- HeaderStr = sheader;
32- graphconfig =g ;
33- Title = stitle;
34- skipColumn = i;
35- ParentNodeInfo tmp = new ParentNodeInfo(Title, this);
36- parentTreeNode = new SortedTreeNode(tmp);
37- mysar.add2tree(mysar.graphtree, parentTreeNode);
38- }
31+ public List(KSar hissar, GraphConfig g,String stitle, String sheader, int i){
32+ mysar = hissar;
33+ HeaderStr = sheader;
34+ graphconfig =g ;
35+ Title = stitle;
36+ skipColumn = i;
37+ ParentNodeInfo tmp = new ParentNodeInfo(Title, this);
38+ parentTreeNode = new SortedTreeNode(tmp);
39+ mysar.add2tree(mysar.getGraphTree(), parentTreeNode);
40+ }
3941
40- public int parse_line(Second now,String s) {
41- String cols[] = s.split("\\s+");
42- Graph tmp = null;
43- if ( ! nodeHashList.containsKey(cols[skipColumn])) {
44- tmp= new Graph(mysar, graphconfig,Title + " " + cols[skipColumn], HeaderStr, skipColumn+1, null);
45- nodeHashList.put(cols[skipColumn], tmp);
46- TreeNodeInfo infotmp= new TreeNodeInfo( cols[skipColumn], tmp);
47- SortedTreeNode nodetmp = new SortedTreeNode(infotmp);
48- mysar.add2tree(parentTreeNode, nodetmp);
49- } else {
50- tmp = (Graph)nodeHashList.get(cols[skipColumn]);
51- }
42+ public int parse_line(Second now,String s){
43+ String cols[] = s.split("\\s+");
44+ Graph tmp = null;
45+ if( ! nodeHashList.containsKey(cols[skipColumn])){
46+ tmp= new Graph(mysar, graphconfig,Title + " " + cols[skipColumn], HeaderStr, skipColumn+1, null);
47+ nodeHashList.put(cols[skipColumn], tmp);
48+ TreeNodeInfo infotmp= new TreeNodeInfo( cols[skipColumn], tmp);
49+ SortedTreeNode nodetmp = new SortedTreeNode(infotmp);
50+ mysar.add2tree(parentTreeNode, nodetmp);
51+ }else{
52+ tmp = (Graph)nodeHashList.get(cols[skipColumn]);
53+ }
5254
53- return tmp.parse_line(now,s);
54- }
55+ return tmp.parse_line(now,s);
56+ }
5557
5658
57- public JPanel run() {
58- JPanel tmppanel = new JPanel();
59- LayoutManager tmplayout = null;
60- int graphnumber = nodeHashList.size();
61- int linenum = (int) Math.floor(graphnumber / 2);
62- if (graphnumber % 2 != 0) {
63- linenum++;
64- }
65- tmplayout = new java.awt.GridLayout(linenum, 2);
66- tmppanel.setLayout(tmplayout);
59+ public JPanel run(){
60+ JPanel tmppanel = new JPanel();
61+ LayoutManager tmplayout = null;
62+ int graphnumber = nodeHashList.size();
63+ int linenum = (int) Math.floor(graphnumber / 2);
64+ if(graphnumber % 2 != 0){
65+ linenum++;
66+ }
67+ tmplayout = new java.awt.GridLayout(linenum, 2);
68+ tmppanel.setLayout(tmplayout);
6769
6870
69- SortedSet<String> sortedset = new TreeSet<String>(nodeHashList.keySet());
71+ SortedSet<String> sortedset = new TreeSet<String>(nodeHashList.keySet());
7072
71- Iterator<String> it = sortedset.iterator();
73+ Iterator<String> it = sortedset.iterator();
7274
73- while (it.hasNext()) {
74- Graph tmpgraph = (Graph) nodeHashList.get(it.next());
75- tmppanel.add(tmpgraph.get_ChartPanel());
76- }
75+ while(it.hasNext()){
76+ Graph tmpgraph = (Graph) nodeHashList.get(it.next());
77+ tmppanel.add(tmpgraph.get_ChartPanel());
78+ }
7779
78- return tmppanel;
79- }
80+ return tmppanel;
81+ }
8082
81- public boolean isPrintSelected() {
82- boolean leaftoprint = false;
83- SortedSet<String> sortedset = new TreeSet<String>(nodeHashList.keySet());
83+ public boolean isPrintSelected(){
84+ boolean leaftoprint = false;
85+ SortedSet<String> sortedset = new TreeSet<String>(nodeHashList.keySet());
8486
85- Iterator<String> it = sortedset.iterator();
87+ Iterator<String> it = sortedset.iterator();
8688
87- while (it.hasNext()) {
88- Graph tmpgraph = (Graph) nodeHashList.get(it.next());
89- if (tmpgraph.printSelected) {
90- leaftoprint = true;
91- break;
92- }
93- }
94- if (leaftoprint) {
95- return true;
96- } else {
97- return false;
98- }
99- }
89+ while(it.hasNext()){
90+ Graph tmpgraph = (Graph) nodeHashList.get(it.next());
91+ if(tmpgraph.printSelected){
92+ leaftoprint = true;
93+ break;
94+ }
95+ }
96+ if(leaftoprint){
97+ return true;
98+ }else{
99+ return false;
100+ }
101+ }
100102
101- public String getTitle() {
102- return Title;
103- }
103+ public String getTitle(){
104+ return Title;
105+ }
104106
105- public JPanel getprintform() {
106- JPanel panel = new JPanel();
107- panel.setBorder(new TitledBorder(Title));
108- panel.setLayout(new javax.swing.BoxLayout(panel, javax.swing.BoxLayout.PAGE_AXIS));
109- return panel;
110- }
111-
112-
113- protected GraphConfig graphconfig = null;
114- protected SortedTreeNode parentTreeNode = null;
115- protected KSar mysar = null;
116- protected String HeaderStr = null;
117- protected Map<String, Graph> nodeHashList = new HashMap<String, Graph>();
118- protected int skipColumn = 0;
119- protected String Title = null;
120-
107+ public JPanel getprintform(){
108+ JPanel panel = new JPanel();
109+ panel.setBorder(new TitledBorder(Title));
110+ panel.setLayout(new javax.swing.BoxLayout(panel, javax.swing.BoxLayout.PAGE_AXIS));
111+ return panel;
112+ }
121113 }
--- trunk/src/net/atomique/ksar/Graph/Graph.java (revision 3)
+++ trunk/src/net/atomique/ksar/Graph/Graph.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.Graph;
62
73 import java.awt.BasicStroke;
@@ -52,388 +48,388 @@
5248 */
5349 public class Graph {
5450
55- public Graph(KSar hissar, GraphConfig g, String Title, String hdrs, int skipcol, SortedTreeNode pp) {
56- mysar = hissar;
57- graphtitle = Title;
58- graphconfig = g;
59- printCheckBox = new JCheckBox(graphtitle, printSelected);
60- printCheckBox.addItemListener(new java.awt.event.ItemListener() {
51+ public Graph(KSar hissar, GraphConfig g, String Title, String hdrs, int skipcol, SortedTreeNode pp){
52+ mysar = hissar;
53+ graphtitle = Title;
54+ graphconfig = g;
55+ printCheckBox = new JCheckBox(graphtitle, printSelected);
56+ printCheckBox.addItemListener(new java.awt.event.ItemListener(){
6157
62- public void itemStateChanged(java.awt.event.ItemEvent evt) {
63- if (evt.getSource() == printCheckBox) {
64- printSelected = printCheckBox.isSelected();
65- }
66- }
67- });
68- skipColumn = skipcol;
69- if (pp != null) {
70- TreeNodeInfo infotmp = new TreeNodeInfo(Title, this);
71- SortedTreeNode nodetmp = new SortedTreeNode(infotmp);
72- mysar.add2tree(pp, nodetmp);
73- }
74- HeaderStr = hdrs.split("\\s+");
75- create_DataStore();
76- }
58+ public void itemStateChanged(java.awt.event.ItemEvent evt){
59+ if(evt.getSource() == printCheckBox){
60+ printSelected = printCheckBox.isSelected();
61+ }
62+ }
63+ });
64+ skipColumn = skipcol;
65+ if(pp != null){
66+ TreeNodeInfo infotmp = new TreeNodeInfo(Title, this);
67+ SortedTreeNode nodetmp = new SortedTreeNode(infotmp);
68+ mysar.add2tree(pp, nodetmp);
69+ }
70+ HeaderStr = hdrs.split("\\s+");
71+ create_DataStore();
72+ }
7773
78- private void create_DataStore() {
79- // create timeseries
80- for (int i = skipColumn; i < HeaderStr.length; i++) {
81- Stats.add(new TimeSeries(HeaderStr[i]));
82- }
83- // create stack
84- SortedSet<String> sortedset = new TreeSet<String>(graphconfig.getStacklist().keySet());
85- Iterator<String> it = sortedset.iterator();
86- while (it.hasNext()) {
87- StackConfig tmp = (StackConfig) graphconfig.getStacklist().get(it.next());
88- TimeTableXYDataset tmp2 = new TimeTableXYDataset();
89- String[] s = tmp.getHeaderStr().split("\\s+");
90- for (int i = 0; i < s.length; i++) {
91- StackListbyCol.put(s[i], tmp2);
92- }
93- StackListbyName.put(tmp.getTitle(), tmp2);
94- }
95- }
74+ private void create_DataStore(){
75+ // create timeseries
76+ for(int i = skipColumn; i < HeaderStr.length; i++){
77+ Stats.add(new TimeSeries(HeaderStr[i]));
78+ }
79+ // create stack
80+ SortedSet<String> sortedset = new TreeSet<String>(graphconfig.getStacklist().keySet());
81+ Iterator<String> it = sortedset.iterator();
82+ while(it.hasNext()){
83+ StackConfig tmp = (StackConfig) graphconfig.getStacklist().get(it.next());
84+ TimeTableXYDataset tmp2 = new TimeTableXYDataset();
85+ String[] s = tmp.getHeaderStr().split("\\s+");
86+ for(int i = 0; i < s.length; i++){
87+ StackListbyCol.put(s[i], tmp2);
88+ }
89+ StackListbyName.put(tmp.getTitle(), tmp2);
90+ }
91+ }
9692
97- public int parse_line(Second now, String s) {
98- String[] cols = s.split("\\s+");
99- Double colvalue = null;
100- //System.out.println("graph parsing:" + s);
101- for (int i = skipColumn; i < HeaderStr.length; i++) {
102- try {
103- colvalue = new Double(cols[i]);
104- } catch (NumberFormatException ne) {
105- System.out.println(graphtitle + " " + cols[i] + " is NaN");
106- return 0;
107- } catch (Exception ae) {
108- System.out.println(graphtitle + " " + cols[i] + " is undef " + s);
109- ae.printStackTrace();
110- return 0;
111- }
93+ public int parse_line(Second now, String s){
94+ String[] cols = s.split("\\s+");
95+ Double colvalue = null;
96+ //System.out.println("graph parsing:" + s);
97+ for(int i = skipColumn; i < HeaderStr.length; i++){
98+ try{
99+ colvalue = new Double(cols[i]);
100+ }catch(NumberFormatException ne){
101+ System.out.println(graphtitle + " " + cols[i] + " is NaN");
102+ return 0;
103+ }catch(Exception ae){
104+ System.out.println(graphtitle + " " + cols[i] + " is undef " + s);
105+ ae.printStackTrace();
106+ return 0;
107+ }
112108
113- add_datapoint_plot(now, i-skipColumn , HeaderStr[i-skipColumn], colvalue);
109+ add_datapoint_plot(now, i-skipColumn , HeaderStr[i-skipColumn], colvalue);
114110
115111
116- TimeTableXYDataset tmp = StackListbyCol.get(HeaderStr[i]);
117- if (tmp != null) {
118- add_datapoint_stack(tmp, now, i , HeaderStr[i], colvalue);
119- }
120- }
112+ TimeTableXYDataset tmp = StackListbyCol.get(HeaderStr[i]);
113+ if(tmp != null){
114+ add_datapoint_stack(tmp, now, i , HeaderStr[i], colvalue);
115+ }
116+ }
121117
122- return 0;
123- }
118+ return 0;
119+ }
124120
125- private boolean add_datapoint_stack(TimeTableXYDataset dataset, Second now, int col, String colheader, Double value) {
126- try {
127- dataset.add(now, value, colheader);
121+ private boolean add_datapoint_stack(TimeTableXYDataset dataset, Second now, int col, String colheader, Double value){
122+ try{
123+ dataset.add(now, value, colheader);
128124
129- return true;
130- } catch (SeriesException se) {
131- /*
132- *
133- * not update on stack
134- *
135- int indexcol = -1;
136- // add not working
137- // find timeseries index
138- for (int i = 0; i < dataset.getSeriesCount(); i++) {
139- String name = (String) dataset.getSeriesKey(i);
140- if (colheader.equals(name)) {
141- indexcol = i;
142- break;
143- }
144- System.out.println(dataset.indexOf(name) + ": " + name);
145- }
146- if (indexcol == -1) {
147- return false;
148- }
149- StatConfig statconfig = ((OSParser) mysar.myparser).get_OSConfig().getStat(mysar.myparser.getCurrentStat());
150- if (statconfig != null) {
151- if (statconfig.canDuplicateTime()) {
152- Number oldval = dataset.getXValue(indexcol, col);
153- Double tempval;
154- if (oldval == null) {
155- return false;
156- }
157- ColumnConfig colconfig = GlobalOptions.getColumnConfig(colheader);
158- if (colconfig.getType() == 1) {
159- tempval = new Double((oldval.doubleValue() + value) / 2);
160- } else if (colconfig.getType() == 2) {
161- tempval = new Double(oldval.doubleValue() + value);
162- } else {
163- return false;
164- }
125+ return true;
126+ }catch(SeriesException se){
127+ /*
128+ *
129+ * not update on stack
130+ *
131+ int indexcol = -1;
132+ // add not working
133+ // find timeseries index
134+ for(int i = 0; i < dataset.getSeriesCount(); i++){
135+ String name = (String) dataset.getSeriesKey(i);
136+ if(colheader.equals(name)){
137+ indexcol = i;
138+ break;
139+ }
140+ System.out.println(dataset.indexOf(name) + ": " + name);
141+ }
142+ if(indexcol == -1){
143+ return false;
144+ }
145+ StatConfig statconfig = ((OSParser) mysar.myparser).get_OSConfig().getStat(mysar.myparser.getCurrentStat());
146+ if(statconfig != null){
147+ if(statconfig.canDuplicateTime()){
148+ Number oldval = dataset.getXValue(indexcol, col);
149+ Double tempval;
150+ if(oldval == null){
151+ return false;
152+ }
153+ ColumnConfig colconfig = GlobalOptions.getColumnConfig(colheader);
154+ if(colconfig.getType() == 1){
155+ tempval = new Double((oldval.doubleValue() + value) / 2);
156+ }else if(colconfig.getType() == 2){
157+ tempval = new Double(oldval.doubleValue() + value);
158+ }else{
159+ return false;
160+ }
165161
166- try {
167- ((TimeSeries) (Stats.get(col))).update(now, tempval);
168- return true;
169- } catch (SeriesException se2) {
170- return false;
171- }
172- }
173- }
174- */
175- return false;
176- }
162+ try{
163+ ((TimeSeries) (Stats.get(col))).update(now, tempval);
164+ return true;
165+ }catch(SeriesException se2){
166+ return false;
167+ }
168+ }
169+ }
170+ */
171+ return false;
172+ }
177173
178- }
174+ }
179175
180- private boolean add_datapoint_plot(Second now, int col, String colheader, Double value) {
181- try {
182- ((TimeSeries) (Stats.get(col))).add(now, value);
183- return true;
184- } catch (SeriesException se) {
185- // insert not possible
186- // check if column can be update
187- StatConfig statconfig = ((OSParser) mysar.myparser).get_OSConfig().getStat(mysar.myparser.getCurrentStat());
188- if (statconfig != null) {
189- if (statconfig.canDuplicateTime()) {
190- Number oldval = ((TimeSeries) (Stats.get(col))).getValue(now);
191- Double tempval;
192- if (oldval == null) {
193- return false;
194- }
195- ColumnConfig colconfig = GlobalOptions.getColumnConfig(colheader);
196- if ( colconfig == null ) {
197- return false;
198- }
199- if (colconfig.getType() == 1) {
200- tempval = new Double((oldval.doubleValue() + value) / 2);
201- } else if (colconfig.getType() == 2) {
202- tempval = new Double(oldval.doubleValue() + value);
203- } else {
204- return false;
205- }
176+ private boolean add_datapoint_plot(Second now, int col, String colheader, Double value){
177+ try{
178+ ((TimeSeries) (Stats.get(col))).add(now, value);
179+ return true;
180+ }catch(SeriesException se){
181+ // insert not possible
182+ // check if column can be update
183+ StatConfig statconfig = ((OSParser) mysar.myparser).get_OSConfig().getStat(mysar.myparser.getCurrentStat());
184+ if(statconfig != null){
185+ if(statconfig.canDuplicateTime()){
186+ Number oldval = ((TimeSeries) (Stats.get(col))).getValue(now);
187+ Double tempval;
188+ if(oldval == null){
189+ return false;
190+ }
191+ ColumnConfig colconfig = GlobalOptions.getColumnConfig(colheader);
192+ if( colconfig == null ){
193+ return false;
194+ }
195+ if(colconfig.getType() == 1){
196+ tempval = new Double((oldval.doubleValue() + value) / 2);
197+ }else if(colconfig.getType() == 2){
198+ tempval = new Double(oldval.doubleValue() + value);
199+ }else{
200+ return false;
201+ }
206202
207- try {
208- ((TimeSeries) (Stats.get(col))).update(now, tempval);
209- return true;
210- } catch (SeriesException se2) {
211- return false;
212- }
213- }
214- }
215- return false;
216- }
203+ try{
204+ ((TimeSeries) (Stats.get(col))).update(now, tempval);
205+ return true;
206+ }catch(SeriesException se2){
207+ return false;
208+ }
209+ }
210+ }
211+ return false;
212+ }
217213
218- }
214+ }
219215
220- public String make_csv() {
221- StringBuilder tmp = new StringBuilder();
222- tmp.append("Date;");
223- tmp.append(getCsvHeader());
224- tmp.append("\n");
225- TimeSeries datelist = (TimeSeries) Stats.get(0);
226- Iterator ite = datelist.getTimePeriods().iterator();
227- while (ite.hasNext()) {
228- TimePeriod item = (TimePeriod) ite.next();
229- tmp.append(item.toString());
230- tmp.append(";");
231- tmp.append(getCsvLine((RegularTimePeriod) item));
232- tmp.append("\n");
233- }
216+ public String make_csv(){
217+ StringBuilder tmp = new StringBuilder();
218+ tmp.append("Date;");
219+ tmp.append(getCsvHeader());
220+ tmp.append("\n");
221+ TimeSeries datelist = (TimeSeries) Stats.get(0);
222+ Iterator ite = datelist.getTimePeriods().iterator();
223+ while(ite.hasNext()){
224+ TimePeriod item = (TimePeriod) ite.next();
225+ tmp.append(item.toString());
226+ tmp.append(";");
227+ tmp.append(getCsvLine((RegularTimePeriod) item));
228+ tmp.append("\n");
229+ }
234230
235- return tmp.toString();
236- }
231+ return tmp.toString();
232+ }
237233
238- public String getCsvHeader() {
239- StringBuilder tmp = new StringBuilder();
240- for (int i = 1 + skipColumn; i < HeaderStr.length; i++) {
241- TimeSeries tmpseries = (TimeSeries) Stats.get(i - skipColumn);
242- tmp.append(graphtitle).append(" ").append(tmpseries.getKey());
243- tmp.append(";");
244- }
245- return tmp.toString();
246- }
234+ public String getCsvHeader(){
235+ StringBuilder tmp = new StringBuilder();
236+ for(int i = 1 + skipColumn; i < HeaderStr.length; i++){
237+ TimeSeries tmpseries = (TimeSeries) Stats.get(i - skipColumn);
238+ tmp.append(graphtitle).append(" ").append(tmpseries.getKey());
239+ tmp.append(";");
240+ }
241+ return tmp.toString();
242+ }
247243
248- public String getCsvLine(RegularTimePeriod t) {
249- StringBuilder tmp = new StringBuilder();
250- for (int i = 1 + skipColumn; i < HeaderStr.length; i++) {
251- TimeSeries tmpseries = (TimeSeries) Stats.get(i - skipColumn);
252- tmp.append(tmpseries.getValue(t));
244+ public String getCsvLine(RegularTimePeriod t){
245+ StringBuilder tmp = new StringBuilder();
246+ for(int i = 1 + skipColumn; i < HeaderStr.length; i++){
247+ TimeSeries tmpseries = (TimeSeries) Stats.get(i - skipColumn);
248+ tmp.append(tmpseries.getValue(t));
253249
254- tmp.append(";");
255- }
256- return tmp.toString();
257- }
250+ tmp.append(";");
251+ }
252+ return tmp.toString();
253+ }
258254
259- public int savePNG(final Second g_start, final Second g_end, final String filename, final int width, final int height) {
260- try {
261- ChartUtilities.saveChartAsPNG(new File(filename), this.getgraph(mysar.myparser.get_startofgraph(), mysar.myparser.get_endofgraph()), width, height);
262- } catch (IOException e) {
263- System.err.println("Unable to write to : " + filename);
264- return -1;
265- }
266- return 0;
267- }
255+ public int savePNG(final Second g_start, final Second g_end, final String filename, final int width, final int height){
256+ try{
257+ ChartUtilities.saveChartAsPNG(new File(filename), this.getgraph(mysar.myparser.getStartOfGraph(), mysar.myparser.getEndOfGraph()), width, height);
258+ }catch(IOException e){
259+ System.err.println("Unable to write to : " + filename);
260+ return -1;
261+ }
262+ return 0;
263+ }
268264
269- public int saveJPG(final Second g_start, final Second g_end, final String filename, final int width, final int height) {
270- try {
271- ChartUtilities.saveChartAsJPEG(new File(filename), this.getgraph(mysar.myparser.get_startofgraph(), mysar.myparser.get_endofgraph()), width, height);
272- } catch (IOException e) {
273- System.err.println("Unable to write to : " + filename);
274- return -1;
275- }
276- return 0;
277- }
265+ public int saveJPG(final Second g_start, final Second g_end, final String filename, final int width, final int height){
266+ try{
267+ ChartUtilities.saveChartAsJPEG(new File(filename), this.getgraph(mysar.myparser.getStartOfGraph(), mysar.myparser.getEndOfGraph()), width, height);
268+ }catch(IOException e){
269+ System.err.println("Unable to write to : " + filename);
270+ return -1;
271+ }
272+ return 0;
273+ }
278274
279- public JCheckBox getprintform() {
280- return printCheckBox;
281- }
275+ public JCheckBox getprintform(){
276+ return printCheckBox;
277+ }
282278
283- public boolean doPrint() {
284- return printSelected;
285- }
279+ public boolean doPrint(){
280+ return printSelected;
281+ }
286282
287- public JFreeChart getgraph(Second g_start, Second g_end) {
288- if (mygraph == null) {
289- mygraph = makegraph(g_start, g_end);
290- } else {
291- if (!axisofdate.getMaximumDate().equals(mysar.myparser.get_endofgraph().getEnd())) {
292- axisofdate.setMaximumDate(mysar.myparser.get_endofgraph().getEnd());
293- }
294- if (!axisofdate.getMinimumDate().equals(mysar.myparser.get_startofgraph().getStart())) {
295- axisofdate.setMinimumDate(mysar.myparser.get_startofgraph().getStart());
296- }
297- }
298- return mygraph;
299- }
283+ public JFreeChart getgraph(Second g_start, Second g_end){
284+ if(mygraph == null){
285+ mygraph = makegraph(g_start, g_end);
286+ }else{
287+ if(!axisofdate.getMaximumDate().equals(mysar.myparser.getEndOfGraph().getEnd())){
288+ axisofdate.setMaximumDate(mysar.myparser.getEndOfGraph().getEnd());
289+ }
290+ if(!axisofdate.getMinimumDate().equals(mysar.myparser.getStartOfGraph().getStart())){
291+ axisofdate.setMinimumDate(mysar.myparser.getStartOfGraph().getStart());
292+ }
293+ }
294+ return mygraph;
295+ }
300296
301- public String getTitle() {
302- return graphtitle;
303- }
297+ public String getTitle(){
298+ return graphtitle;
299+ }
304300
305- public boolean isPrintSelected() {
306- return printSelected;
307- }
301+ public boolean isPrintSelected(){
302+ return printSelected;
303+ }
308304
309- private XYDataset create_collection(ArrayList l) {
310- TimeSeriesCollection graphcollection = new TimeSeriesCollection();
311- TimeSeries found = null;
312- boolean hasdata = false;
313- for (int i = 0; i < l.size(); i++) {
314- found = null;
315- for (int j = 0; j < Stats.size(); j++) {
316- found = (TimeSeries) Stats.get(j);
317- if (found.getKey().equals(l.get(i))) {
318- break;
319- } else {
320- found = null;
321- }
322- }
305+ private XYDataset create_collection(ArrayList l){
306+ TimeSeriesCollection graphcollection = new TimeSeriesCollection();
307+ TimeSeries found = null;
308+ boolean hasdata = false;
309+ for(int i = 0; i < l.size(); i++){
310+ found = null;
311+ for(int j = 0; j < Stats.size(); j++){
312+ found = (TimeSeries) Stats.get(j);
313+ if(found.getKey().equals(l.get(i))){
314+ break;
315+ }else{
316+ found = null;
317+ }
318+ }
323319
324- if (found != null) {
325- graphcollection.addSeries(found);
326- hasdata = true;
327- }
328- }
329- if (!hasdata) {
330- return null;
331- }
332- return graphcollection;
333- }
320+ if(found != null){
321+ graphcollection.addSeries(found);
322+ hasdata = true;
323+ }
324+ }
325+ if(!hasdata){
326+ return null;
327+ }
328+ return graphcollection;
329+ }
334330
335- public ChartPanel get_ChartPanel() {
336- if (chartpanel == null) {
337- if (mysar.isParsing()) {
338- chartpanel = new ChartPanel(getgraph(null, null));
339- } else {
340- chartpanel = new ChartPanel(getgraph(mysar.myparser.get_startofgraph(), mysar.myparser.get_endofgraph()));
341- }
342- } else {
343- if (!mysar.isParsing()) {
344- if (!axisofdate.getMaximumDate().equals(mysar.myparser.get_endofgraph().getEnd())) {
345- axisofdate.setMaximumDate(mysar.myparser.get_endofgraph().getEnd());
346- }
347- if (!axisofdate.getMinimumDate().equals(mysar.myparser.get_startofgraph().getStart())) {
348- axisofdate.setMinimumDate(mysar.myparser.get_startofgraph().getStart());
349- }
350- }
351- }
352- return chartpanel;
353- }
331+ public ChartPanel get_ChartPanel(){
332+ if(chartpanel == null){
333+ if(mysar.isParsing()){
334+ chartpanel = new ChartPanel(getgraph(null, null));
335+ }else{
336+ chartpanel = new ChartPanel(getgraph(mysar.myparser.getStartOfGraph(), mysar.myparser.getEndOfGraph()));
337+ }
338+ }else{
339+ if(!mysar.isParsing()){
340+ if(!axisofdate.getMaximumDate().equals(mysar.myparser.getEndOfGraph().getEnd())){
341+ axisofdate.setMaximumDate(mysar.myparser.getEndOfGraph().getEnd());
342+ }
343+ if(!axisofdate.getMinimumDate().equals(mysar.myparser.getStartOfGraph().getStart())){
344+ axisofdate.setMinimumDate(mysar.myparser.getStartOfGraph().getStart());
345+ }
346+ }
347+ }
348+ return chartpanel;
349+ }
354350
355- private JFreeChart makegraph(Second g_start, Second g_end) {
356- long begingenerate = System.currentTimeMillis();
351+ private JFreeChart makegraph(Second g_start, Second g_end){
352+ long begingenerate = System.currentTimeMillis();
357353
358- CombinedDomainXYPlot plot = new CombinedDomainXYPlot(axisofdate);
359- // do the stacked stuff
360- SortedSet<String> sortedset = new TreeSet<String>(graphconfig.getStacklist().keySet());
361- Iterator<String> it = sortedset.iterator();
362- while (it.hasNext()) {
363- StackConfig tmp = (StackConfig) graphconfig.getStacklist().get(it.next());
364- if (tmp == null) {
365- continue;
366- }
367- TimeTableXYDataset tmp2 = StackListbyName.get(tmp.getTitle());
354+ CombinedDomainXYPlot plot = new CombinedDomainXYPlot(axisofdate);
355+ // do the stacked stuff
356+ SortedSet<String> sortedset = new TreeSet<String>(graphconfig.getStacklist().keySet());
357+ Iterator<String> it = sortedset.iterator();
358+ while(it.hasNext()){
359+ StackConfig tmp = (StackConfig) graphconfig.getStacklist().get(it.next());
360+ if(tmp == null){
361+ continue;
362+ }
363+ TimeTableXYDataset tmp2 = StackListbyName.get(tmp.getTitle());
368364
369- if (tmp2 != null) {
370- StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
371- NumberAxis graphaxistitle = tmp.getAxis();
372- XYPlot temp_plot = new XYPlot(tmp2, axisofdate, graphaxistitle, renderer);
373- for (int i = 0; i < tmp2.getSeriesCount(); i++) {
374- Color color = GlobalOptions.getDataColor(tmp2.getSeriesKey(i).toString());
375- if (color != null) {
376- renderer.setSeriesPaint(i, color);
377- renderer.setBaseStroke(new BasicStroke(1.0F));
378- }
379- }
380- plot.add(temp_plot, tmp.getSize());
381- }
382- }
383- // do the line stuff
384- sortedset = new TreeSet<String>(graphconfig.getPlotlist().keySet());
385- it = sortedset.iterator();
386- while (it.hasNext()) {
387- PlotConfig tmp = (PlotConfig) graphconfig.getPlotlist().get(it.next());
388- XYItemRenderer renderer = new StandardXYItemRenderer();
389- ArrayList<String> t = new ArrayList<String>();
390- String[] s = tmp.getHeaderStr().split("\\s+");
391- for (int i = 0; i < s.length; i++) {
392- t.add(s[i]);
393- }
394- XYDataset c = create_collection(t);
395- NumberAxis graphaxistitle = tmp.getAxis();
396- XYPlot tmpplot = new XYPlot(c, axisofdate, graphaxistitle, renderer);
365+ if(tmp2 != null){
366+ StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
367+ NumberAxis graphaxistitle = tmp.getAxis();
368+ XYPlot temp_plot = new XYPlot(tmp2, axisofdate, graphaxistitle, renderer);
369+ for(int i = 0; i < tmp2.getSeriesCount(); i++){
370+ Color color = GlobalOptions.getDataColor(tmp2.getSeriesKey(i).toString());
371+ if(color != null){
372+ renderer.setSeriesPaint(i, color);
373+ renderer.setBaseStroke(new BasicStroke(1.0F));
374+ }
375+ }
376+ plot.add(temp_plot, tmp.getSize());
377+ }
378+ }
379+ // do the line stuff
380+ sortedset = new TreeSet<String>(graphconfig.getPlotlist().keySet());
381+ it = sortedset.iterator();
382+ while(it.hasNext()){
383+ PlotConfig tmp = (PlotConfig) graphconfig.getPlotlist().get(it.next());
384+ XYItemRenderer renderer = new StandardXYItemRenderer();
385+ ArrayList<String> t = new ArrayList<String>();
386+ String[] s = tmp.getHeaderStr().split("\\s+");
387+ for(int i = 0; i < s.length; i++){
388+ t.add(s[i]);
389+ }
390+ XYDataset c = create_collection(t);
391+ NumberAxis graphaxistitle = tmp.getAxis();
392+ XYPlot tmpplot = new XYPlot(c, axisofdate, graphaxistitle, renderer);
397393
398- if (tmpplot == null) {
399- continue;
400- }
401- for (int i = 0; i < s.length; i++) {
402- Color color = GlobalOptions.getDataColor(s[i].toString());
403- if (color != null) {
404- renderer.setSeriesPaint(i, color);
405- renderer.setBaseStroke(new BasicStroke(1.0F));
406- }
407- }
408- plot.add(tmpplot, tmp.getSize());
409- }
410- if (plot.getSubplots().isEmpty()) {
411- return null;
412- }
413- if (g_start != null && g_end != null) {
414- axisofdate.setRange(g_start.getStart(), g_end.getEnd());
415- }
394+ if(tmpplot == null){
395+ continue;
396+ }
397+ for(int i = 0; i < s.length; i++){
398+ Color color = GlobalOptions.getDataColor(s[i].toString());
399+ if(color != null){
400+ renderer.setSeriesPaint(i, color);
401+ renderer.setBaseStroke(new BasicStroke(1.0F));
402+ }
403+ }
404+ plot.add(tmpplot, tmp.getSize());
405+ }
406+ if(plot.getSubplots().isEmpty()){
407+ return null;
408+ }
409+ if(g_start != null && g_end != null){
410+ axisofdate.setRange(g_start.getStart(), g_end.getEnd());
411+ }
416412
417- plot.setOrientation(PlotOrientation.VERTICAL);
418- JFreeChart mychart = new JFreeChart(graphtitle, Config.getDEFAULT_FONT(), plot, true);
419- long endgenerate = System.currentTimeMillis();
420- mychart.setBackgroundPaint(Color.white);
421- if (GlobalOptions.isDodebug()) {
422- System.out.println("graph generation: " + (endgenerate - begingenerate) + " ms");
423- }
424- return mychart;
425- }
426- private DateAxis axisofdate = new DateAxis("");
427- private KSar mysar = null;
428- private JFreeChart mygraph = null;
429- private ChartPanel chartpanel = null;
430- private String graphtitle = null;
431- public boolean printSelected = true;
432- private JCheckBox printCheckBox = null;
433- private GraphConfig graphconfig = null;
434- private int skipColumn = 0;
435- private String[] HeaderStr = null;
436- private ArrayList<TimeSeries> Stats = new ArrayList<TimeSeries>();
437- private Map<String, TimeTableXYDataset> StackListbyName = new HashMap<String, TimeTableXYDataset>();
438- private Map<String, TimeTableXYDataset> StackListbyCol = new HashMap<String, TimeTableXYDataset>();
413+ plot.setOrientation(PlotOrientation.VERTICAL);
414+ JFreeChart mychart = new JFreeChart(graphtitle, Config.getDEFAULT_FONT(), plot, true);
415+ long endgenerate = System.currentTimeMillis();
416+ mychart.setBackgroundPaint(Color.white);
417+ if(GlobalOptions.isDodebug()){
418+ System.out.println("graph generation: " + (endgenerate - begingenerate) + " ms");
419+ }
420+ return mychart;
421+ }
422+ private DateAxis axisofdate = new DateAxis("");
423+ private KSar mysar = null;
424+ private JFreeChart mygraph = null;
425+ private ChartPanel chartpanel = null;
426+ private String graphtitle = null;
427+ public boolean printSelected = true;
428+ private JCheckBox printCheckBox = null;
429+ private GraphConfig graphconfig = null;
430+ private int skipColumn = 0;
431+ private String[] HeaderStr = null;
432+ private ArrayList<TimeSeries> Stats = new ArrayList<TimeSeries>();
433+ private Map<String, TimeTableXYDataset> StackListbyName = new HashMap<String, TimeTableXYDataset>();
434+ private Map<String, TimeTableXYDataset> StackListbyCol = new HashMap<String, TimeTableXYDataset>();
439435 }
--- trunk/src/net/atomique/ksar/Main.java (revision 3)
+++ trunk/src/net/atomique/ksar/Main.java (revision 4)
@@ -1,11 +1,6 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.awt.event.ActionEvent;
8-import java.awt.event.ActionListener;
94 import java.util.ResourceBundle;
105 import java.util.logging.Level;
116 import java.util.logging.Logger;
@@ -26,51 +21,40 @@
2621 static GlobalOptions globaloptions = null;
2722 static ResourceBundle resource = ResourceBundle.getBundle("net/atomique/ksar/Language/Message");
2823
29- ;
30-
31- public static void usage() {
24+ public static void usage(){
3225 show_version();
3326 }
3427
35- public static void show_version() {
28+ public static void show_version(){
3629 System.err.println("ksar Version : " + VersionNumber.getVersionNumber());
3730 }
3831
39- private static void set_lookandfeel() {
40- for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
41- if (Config.getLandf().equals(laf.getName())) {
42- try {
32+ private static void set_lookandfeel(){
33+ for(UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()){
34+ if(Config.getLandf().equals(laf.getName())){
35+ try{
4336 UIManager.setLookAndFeel(laf.getClassName());
44- } catch (ClassNotFoundException ex) {
37+ }catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex){
4538 Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
46- } catch (InstantiationException ex) {
47- Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
48- } catch (IllegalAccessException ex) {
49- Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
50- } catch (UnsupportedLookAndFeelException ex) {
51- Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
5239 }
5340 }
5441 }
5542 }
5643
57- public static void make_ui() {
44+ public static void make_ui(){
5845 final SplashScreen mysplash = new SplashScreen(null, 1000);
5946
60-// while (mysplash.isVisible()) {
61-// try {
47+// while(mysplash.isVisible()){
48+// try{
6249 // Thread.sleep(500); sleep in loop warning. Swing is single threaded. Calling Thread.sleep in the EDT prevents UI updates.
63-// } catch (InterruptedException ie) {
50+// }catch(InterruptedException ie){
6451 // ie.printStackTrace(System.out);
6552 // }
6653 // }
67- Timer timer = new Timer(500, new ActionListener() {
68- @Override
69- public void actionPerformed(ActionEvent e) {
70- if( !mysplash.isVisible() ){
71- Timer timer = (Timer) e.getSource();
72- timer.stop();
73- }
54+ Timer timer = new Timer(500, (ActionEvent e)->{
55+ if(!mysplash.isVisible()){
56+ Timer timer1 = (Timer) e.getSource();
57+ timer1.stop();
7458 }
7559 });
7660 timer.setRepeats(true);
@@ -77,25 +61,21 @@
7761 timer.start();
7862
7963 set_lookandfeel();
80- javax.swing.SwingUtilities.invokeLater(new Runnable() {
81-
82- @Override
83- public void run() {
84- GlobalOptions.setUI(new Desktop());
85- SwingUtilities.updateComponentTreeUI(GlobalOptions.getUI());
86- GlobalOptions.getUI().add_window();
87- GlobalOptions.getUI().maxall();
88- }
64+ javax.swing.SwingUtilities.invokeLater(()->{
65+ GlobalOptions.setUI(new Desktop());
66+ SwingUtilities.updateComponentTreeUI(GlobalOptions.getUI());
67+ GlobalOptions.getUI().add_window();
68+ GlobalOptions.getUI().maxall();
8969 });
9070
9171 }
9272
93- public static void main(String[] args) {
73+ public static void main(String[] args){
9474 int i = 0;
9575 String arg;
9676 /// load default
9777 String mrjVersion = System.getProperty("mrj.version");
98- if (mrjVersion != null) {
78+ if(mrjVersion != null){
9979 System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
10080 System.setProperty("com.apple.mrj.application.apple.menu.about.name", "kSar");
10181 System.setProperty("apple.laf.useScreenMenuBar", "true");
@@ -104,27 +84,25 @@
10484 config = Config.getInstance();
10585 globaloptions = GlobalOptions.getInstance();
10686
107-
108-
109- if (args.length > 0) {
110- while (i < args.length && args[i].startsWith("-")) {
87+ if(args.length > 0){
88+ while(i < args.length && args[i].startsWith("-")){
11189 arg = args[i++];
112- if ("-version".equals(arg)) {
90+ if("-version".equals(arg)){
11391 show_version();
11492 System.exit(0);
11593 }
116- if ("-help".equals(arg)) {
94+ if("-help".equals(arg)){
11795 usage();
11896 continue;
11997 }
120- if ("-test".equals(arg)) {
98+ if("-test".equals(arg)){
12199 GlobalOptions.setDodebug(true);
122100 continue;
123101 }
124- if ("-input".equals(arg)) {
125- if (i < args.length) {
102+ if("-input".equals(arg)){
103+ if(i < args.length){
126104 GlobalOptions.setCLfilename(args[i++]);
127- } else {
105+ }else{
128106 exit_error(resource.getString("INPUT_REQUIRE_ARG"));
129107 }
130108 //continue; //last, unecessary
@@ -137,7 +115,7 @@
137115 System.out.println("exit");
138116 }
139117
140- public static void exit_error(final String message) {
118+ public static void exit_error(final String message){
141119 System.err.println(message);
142120 System.exit(1);
143121 }
--- trunk/src/net/atomique/ksar/AllParser.java (revision 3)
+++ trunk/src/net/atomique/ksar/AllParser.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar;
72
83 import java.text.ParseException;
@@ -18,7 +13,33 @@
1813 * @author alex
1914 */
2015 public abstract class AllParser{
16+ protected Second startofstat = null;
17+ protected Second endofstat = null;
18+ protected String sarStartDate = null;
19+ protected String sarEndDate = null;
2120
21+ protected Second startofgraph = null;
22+ protected Second endofgraph =null;
23+ protected TreeSet<Second> DateSamples = new TreeSet<>();
24+
25+ abstract public String getInfo();
26+ abstract public void parse_header(String s);
27+ abstract public void updateUITitle();
28+
29+ protected KSar mysar = null;
30+ protected OSConfig osConfig = null;
31+ protected String parserName = null;
32+
33+ protected Calendar cal = Calendar.getInstance();
34+ protected Date parseTime = null;
35+ protected int year = 0;
36+ protected int month = 0;
37+ protected int day = 0;
38+ protected String currentStat = "NONE";
39+ protected String dateFormat = "MM/dd/yy";
40+ protected String timeFormat = "HH:mm:ss";
41+ protected int firstValueColumnIndex = 1;
42+
2243 public AllParser(){
2344 }
2445
@@ -25,12 +46,12 @@
2546 public void init(KSar hissar, String header){
2647 String [] s = header.split("\\s+");
2748 mysar = hissar;
28- ParserName = s[0];
49+ parserName = s[0];
2950 parse_header(header);
3051 }
31-
52+ private void _init_(KSar hissar, String header){init(hissar, header);}
3253 public AllParser(KSar hissar, String header){
33- init(hissar, header);
54+ _init_(hissar, header);
3455 }
3556
3657 public int parse(String line, String[] columns){
@@ -38,15 +59,15 @@
3859 return -1;
3960 }
4061
41- public Second get_startofgraph(){
62+ public Second getStartOfGraph(){
4263 return startofgraph;
4364 }
44- public Second get_endofgraph(){
65+ public Second getEndOfGraph(){
4566 return endofgraph;
4667 }
4768
4869 public String getParserName(){
49- return ParserName;
70+ return parserName;
5071 }
5172
5273 public boolean setDate(String s){
@@ -54,28 +75,29 @@
5475 Date dateSimple2;
5576 Date dateSimple3;
5677
57- if (sarStartDate == null){
78+ if(sarStartDate == null){
5879 sarStartDate = s;
5980 }
60- if (sarEndDate == null){
81+ if(sarEndDate == null){
6182 sarEndDate = s;
6283 }
6384
64- try {
65- dateSimple1 = new SimpleDateFormat(dateFormat).parse(s);
85+ try{
86+ dateSimple1 = new SimpleDateFormat(dateFormat).parse(s);
6687 cal.setTime(dateSimple1);
67- day=cal.get(Calendar.DAY_OF_MONTH);
68- month=cal.get(Calendar.MONTH)+1;
69- year=cal.get(Calendar.YEAR);
88+ year = cal.get(Calendar.YEAR);
89+ month = cal.get(Calendar.MONTH)+1;
90+ day = cal.get(Calendar.DAY_OF_MONTH);
7091 dateSimple2 = new SimpleDateFormat(dateFormat).parse(sarStartDate);
7192 dateSimple3 = new SimpleDateFormat(dateFormat).parse(sarEndDate);
72- } catch (ParseException e){
93+ }catch(ParseException e){
7394 return false;
7495 }
75- if (dateSimple1.compareTo(dateSimple2) < 0){
96+
97+ if(dateSimple1.compareTo(dateSimple2) < 0){
7698 sarStartDate = s;
7799 }
78- if (dateSimple1.compareTo(dateSimple3) > 0){
100+ if(dateSimple1.compareTo(dateSimple3) > 0){
79101 sarEndDate = s;
80102 }
81103 return true;
@@ -82,9 +104,9 @@
82104 }
83105
84106 public String getDate(){
85- if (sarStartDate.equals(sarEndDate)){
107+ if(sarStartDate.equals(sarEndDate)){
86108 return sarStartDate;
87- } else {
109+ }else{
88110 return sarStartDate + " to " + sarEndDate;
89111 }
90112 }
@@ -96,33 +118,4 @@
96118 public String getCurrentStat(){
97119 return currentStat;
98120 }
99-
100-
101- protected Second startofstat = null;
102- protected Second endofstat = null;
103- protected String sarStartDate = null;
104- protected String sarEndDate = null;
105-
106- protected Second startofgraph = null;
107- protected Second endofgraph =null;
108- protected TreeSet<Second> DateSamples = new TreeSet<Second>();
109- protected int firstdatacolumn =0;
110-
111- abstract public String getInfo();
112- abstract public void parse_header(String s);
113- abstract public void updateUITitle();
114-
115- protected KSar mysar = null;
116- protected OSConfig myosconfig = null;
117- protected String ParserName = null;
118-
119- protected Calendar cal=Calendar.getInstance();
120- protected Date parsedate = null;
121- protected int day = 0;
122- protected int month = 0;
123- protected int year = 0;
124- protected String currentStat = "NONE";
125- protected String dateFormat = "MM/dd/yy";
126- protected String timeFormat = "HH:mm:ss";
127- protected int timeColumn = 1;
128121 }
--- trunk/src/net/atomique/ksar/XMLConfig.java (revision 3)
+++ trunk/src/net/atomique/ksar/XMLConfig.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.io.IOException;
@@ -35,12 +31,12 @@
3531 */
3632 public class XMLConfig extends DefaultHandler {
3733
38- public XMLConfig(String filename) {
34+ public XMLConfig(String filename){
3935 load_config(filename);
4036
4137 }
4238
43- public XMLConfig(InputStream is) {
39+ public XMLConfig(InputStream is){
4440 load_config(is);
4541 }
4642
@@ -47,11 +43,11 @@
4743 public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
4844
4945 InputSource inputSource = null;
50- try {
46+ try{
5147 String dtdFile = systemId.substring(systemId.lastIndexOf("/"));
5248 InputStream inputStream = EntityResolver.class.getResourceAsStream(dtdFile);
5349 inputSource = new InputSource(inputStream);
54- } catch (Exception e) {
50+ }catch(Exception e){
5551 // No action; just let the null InputSource pass through
5652 }
5753
@@ -59,58 +55,58 @@
5955 return inputSource;
6056 }
6157
62- public void load_config(InputStream is) {
58+ public void load_config(InputStream is){
6359 SAXParserFactory fabric = null;
6460 SAXParser parser = null;
6561 XMLReader reader = null;
66- try {
62+ try{
6763 fabric = SAXParserFactory.newInstance();
6864 parser = fabric.newSAXParser();
6965 parser.parse(is, this);
7066
71- } catch (ParserConfigurationException ex) {
67+ }catch(ParserConfigurationException ex){
7268 ex.printStackTrace();
73- } catch (SAXException ex) {
69+ }catch(SAXException ex){
7470 ex.printStackTrace();
75- } catch (IOException ioe) {
71+ }catch(IOException ioe){
7672 ioe.printStackTrace();
7773 System.exit(1);
7874 }
7975 //dump_XML();
80- try {
76+ try{
8177 is.close();
82- } catch (IOException ex) {
78+ }catch(IOException ex){
8379 Logger.getLogger(XMLConfig.class.getName()).log(Level.SEVERE, null, ex);
8480 }
8581 }
8682
87- public void load_config(String xmlfile) {
83+ public void load_config(String xmlfile){
8884 SAXParserFactory fabric = null;
8985 SAXParser parser = null;
90- try {
86+ try{
9187 fabric = SAXParserFactory.newInstance();
9288 parser = fabric.newSAXParser();
9389 parser.parse(xmlfile, this);
9490
95- } catch (ParserConfigurationException ex) {
91+ }catch(ParserConfigurationException ex){
9692 ex.printStackTrace();
97- } catch (SAXException ex) {
93+ }catch(SAXException ex){
9894 ex.printStackTrace();
99- } catch (IOException ioe) {
95+ }catch(IOException ioe){
10096 ioe.printStackTrace();
10197 }
10298
10399 }
104100
105- public void dump_XML() {
101+ public void dump_XML(){
106102 SortedSet<String> sortedset = new TreeSet<String>(GlobalOptions.getOSlist().keySet());
107103 Iterator<String> it = sortedset.iterator();
108- while (it.hasNext()) {
104+ while(it.hasNext()){
109105 OSConfig tmp = (OSConfig) GlobalOptions.getOSlist().get(it.next());
110106 System.out.println("-OS-" + tmp.getOSname());
111107 SortedSet<String> sortedset2 = new TreeSet<String>(tmp.getStatHash().keySet());
112108 Iterator<String> it2 = sortedset2.iterator();
113- while (it2.hasNext()) {
109+ while(it2.hasNext()){
114110 StatConfig tmp2 = (StatConfig) tmp.getStatHash().get(it2.next());
115111 System.out.println("--STAT-- "
116112 + tmp2.getStatName() + "=> "
@@ -119,7 +115,7 @@
119115 }
120116 SortedSet<String> sortedset3 = new TreeSet<String>(tmp.getGraphHash().keySet());
121117 Iterator<String> it3 = sortedset3.iterator();
122- while (it3.hasNext()) {
118+ while(it3.hasNext()){
123119 GraphConfig tmp3 = (GraphConfig) tmp.getGraphHash().get(it3.next());
124120 System.out.println("---GRAPH--- "
125121 + tmp3.getName() + "=> "
@@ -126,7 +122,7 @@
126122 + tmp3.getTitle());
127123 SortedSet<String> sortedset4 = new TreeSet<String>(tmp3.getPlotlist().keySet());
128124 Iterator<String> it4 = sortedset4.iterator();
129- while (it4.hasNext()) {
125+ while(it4.hasNext()){
130126 PlotConfig tmp4 = (PlotConfig) tmp3.getPlotlist().get(it4.next());
131127 System.out.println("----PLOT---- "
132128 + tmp4.getTitle() + "=> "
@@ -144,27 +140,27 @@
144140
145141 public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
146142
147- if ("ConfiG".equals(qName)) {
143+ if("ConfiG".equals(qName)){
148144 // config found
149145 }
150- if ("colors".equals(qName)) {
146+ if("colors".equals(qName)){
151147 in_colors = true;
152148 }
153- if ("OS".equals(qName)) {
149+ if("OS".equals(qName)){
154150 in_OS = true;
155151 }
156152
157- if ("History".equals(qName)) {
153+ if("History".equals(qName)){
158154 in_history = true;
159155 }
160156
161- if ( "HostInfo".equals(qName)) {
157+ if( "HostInfo".equals(qName)){
162158 in_hostinfo=true;
163159 }
164160
165161 // COLORS
166- if (in_colors) {
167- if ("itemcolor".equals(qName)) {
162+ if(in_colors){
163+ if("itemcolor".equals(qName)){
168164 currentColor = new ColumnConfig(attributes.getValue("name"));
169165 in_color = true;
170166 }
@@ -171,15 +167,15 @@
171167 }
172168
173169 // history
174- if (in_history) {
175- if ("cnx".equals(qName)) {
170+ if(in_history){
171+ if("cnx".equals(qName)){
176172 currentCnx = new CnxHistory(attributes.getValue("link"));
177173 in_cnx = true;
178174 }
179175 }
180176 // hostinfo
181- if (in_hostinfo) {
182- if ("host".equals(qName)) {
177+ if(in_hostinfo){
178+ if("host".equals(qName)){
183179 currentHost = new HostInfo(attributes.getValue("name"));
184180 in_host=true;
185181 }
@@ -186,49 +182,49 @@
186182 }
187183
188184 // OS
189- if (in_OS) {
190- if ("OSType".equals(qName)) {
185+ if(in_OS){
186+ if("OSType".equals(qName)){
191187 currentOS = GlobalOptions.getOSlist().get(attributes.getValue("name"));
192- if (currentOS == null) {
188+ if(currentOS == null){
193189 currentOS = new OSConfig(attributes.getValue("name"));
194190 GlobalOptions.getOSlist().put(currentOS.getOSname(), currentOS);
195191 }
196192 }
197- if (currentOS != null) {
198- if ("Stat".equals(qName)) {
193+ if(currentOS != null){
194+ if("Stat".equals(qName)){
199195 currentStat = new StatConfig(attributes.getValue("name"));
200196 currentOS.addStat(currentStat);
201197 }
202- if ("Graph".equals(qName)) {
198+ if("Graph".equals(qName)){
203199 currentGraph = new GraphConfig(attributes.getValue("name"), attributes.getValue("Title"), attributes.getValue("type"));
204200 currentOS.addGraph(currentGraph);
205201 }
206- if (currentGraph != null) {
207- if ("Plot".equals(qName)) {
202+ if(currentGraph != null){
203+ if("Plot".equals(qName)){
208204 currentPlot = new PlotConfig(attributes.getValue("Title"));
209205 String size_tmp = attributes.getValue("size");
210- if (size_tmp != null) {
206+ if(size_tmp != null){
211207 currentPlot.setSize(size_tmp);
212208 }
213209 currentGraph.addPlot(currentPlot);
214210 }
215- if ("Stack".equals(qName)) {
211+ if("Stack".equals(qName)){
216212 currentStack = new StackConfig(attributes.getValue("Title"));
217213 String size_tmp = attributes.getValue("size");
218- if (size_tmp != null) {
214+ if(size_tmp != null){
219215 currentStack.setSize(size_tmp);
220216 }
221217 currentGraph.addStack(currentStack);
222218 }
223219
224- if (currentPlot != null) {
225- if ("format".equals(qName)) {
220+ if(currentPlot != null){
221+ if("format".equals(qName)){
226222 currentPlot.setBase(attributes.getValue("base"));
227223 currentPlot.setFactor(attributes.getValue("factor"));
228224 }
229225 }
230- if (currentStack != null) {
231- if ("format".equals(qName)) {
226+ if(currentStack != null){
227+ if("format".equals(qName)){
232228 currentStack.setBase(attributes.getValue("base"));
233229 currentStack.setFactor(attributes.getValue("factor"));
234230 }
@@ -243,71 +239,71 @@
243239
244240 // clean up tempval;
245241 tempval = tempval.trim();
246- if ("ConfiG".equals(qName)) {
242+ if("ConfiG".equals(qName)){
247243 beenparse = true;
248244 }
249- if ("colors".equals(qName)) {
245+ if("colors".equals(qName)){
250246 in_colors = false;
251247 }
252- if ("OSType".equals(qName)) {
248+ if("OSType".equals(qName)){
253249 currentOS = null;
254250 }
255- if ("Stat".equals(qName)) {
251+ if("Stat".equals(qName)){
256252 currentStat = null;
257253 }
258- if ("Graph".equals(qName)) {
254+ if("Graph".equals(qName)){
259255 currentGraph = null;
260256 }
261- if ("Cnx".equals(qName)) {
257+ if("Cnx".equals(qName)){
262258 currentCnx = null;
263259 }
264- if ("Plot".equals(qName)) {
260+ if("Plot".equals(qName)){
265261 currentPlot = null;
266262 }
267- if ("Stack".equals(qName)) {
263+ if("Stack".equals(qName)){
268264 currentStack = null;
269265 }
270- if ("HostInfo".equals(qName)) {
266+ if("HostInfo".equals(qName)){
271267 in_hostinfo = false;
272268 }
273269
274270
275271
276- if (currentStat != null) {
277- if ("headerstr".equals(qName)) {
272+ if(currentStat != null){
273+ if("headerstr".equals(qName)){
278274 currentStat.setHeaderStr(tempval);
279275 }
280- if ("graphname".equals(qName)) {
276+ if("graphname".equals(qName)){
281277 currentStat.setGraphName(tempval);
282278 }
283- if ("duplicate".equals(qName)) {
279+ if("duplicate".equals(qName)){
284280 currentStat.setDuplicateTime(tempval);
285281 }
286282 }
287283
288- if ("cols".equals(qName)) {
289- if (currentPlot != null) {
284+ if("cols".equals(qName)){
285+ if(currentPlot != null){
290286 currentPlot.setHeaderStr(tempval);
291287
292288 }
293- if (currentStack != null) {
289+ if(currentStack != null){
294290 currentStack.setHeaderStr(tempval);
295291 }
296292 }
297- if ("range".equals(qName)) {
298- if (currentPlot != null) {
293+ if("range".equals(qName)){
294+ if(currentPlot != null){
299295 currentPlot.setRange(tempval);
300296
301297 }
302- if (currentStack != null) {
298+ if(currentStack != null){
303299 currentStack.setRange(tempval);
304300 }
305301 }
306302
307- if ("itemcolor".equals(qName)) {
308- if (currentColor.is_valid()){
303+ if("itemcolor".equals(qName)){
304+ if(currentColor.is_valid()){
309305 GlobalOptions.setColumnConfig(currentColor.getData_title(), currentColor);
310- } else {
306+ }else{
311307 System.err.println("Err: " + currentColor.getError_message());
312308 currentColor = null;
313309 }
@@ -314,37 +310,37 @@
314310 in_color = false;
315311 }
316312
317- if (in_color) {
318- if ("color".equals(qName) && currentColor != null) {
313+ if(in_color){
314+ if("color".equals(qName) && currentColor != null){
319315 currentColor.setData_color(tempval);
320316 }
321317 }
322318
323- if (in_cnx) {
324- if ("command".equals(qName) && currentCnx != null) {
319+ if(in_cnx){
320+ if("command".equals(qName) && currentCnx != null){
325321 currentCnx.addCommand(tempval);
326322 }
327323 }
328- if ("cnx".equals(qName)) {
329- if (currentCnx.isValid()) {
324+ if("cnx".equals(qName)){
325+ if(currentCnx.isValid()){
330326 GlobalOptions.getHistoryList().put(currentCnx.getLink(), currentCnx);
331- } else {
327+ }else{
332328 System.err.println("Err cnx is not valid");
333329 currentCnx = null;
334330 }
335331 }
336- if ( in_hostinfo ) {
337- if ( "alias".equals(qName)) {
332+ if( in_hostinfo ){
333+ if( "alias".equals(qName)){
338334 currentHost.setAlias(tempval);
339335 }
340- if ( "description".equals(qName)) {
336+ if( "description".equals(qName)){
341337 currentHost.setDescription(tempval);
342338 }
343- if ( "memblocksize".equals(qName)) {
339+ if( "memblocksize".equals(qName)){
344340 currentHost.setMemBlockSize(tempval);
345341 }
346342 }
347- if ( "host".equals(qName)) {
343+ if( "host".equals(qName)){
348344 GlobalOptions.getHostInfoList().put(currentHost.getHostname(), currentHost);
349345 currentHost=null;
350346 }
--- trunk/src/net/atomique/ksar/LocalCommand.java (revision 3)
+++ trunk/src/net/atomique/ksar/LocalCommand.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.io.BufferedReader;
@@ -20,89 +16,89 @@
2016 * @author Max
2117 */
2218 public class LocalCommand extends Thread implements DataCommandImpl{
23- private KSar mysar = null;
24- private InputStream in = null;
25- private String command = null;
26- private BufferedReader myfilereader = null;
27- private Process p = null;
19+ private KSar mysar = null;
20+ private InputStream in = null;
21+ private String command = null;
22+ private BufferedReader myfilereader = null;
23+ private Process p = null;
2824
29- public LocalCommand(KSar hissar) {
30- mysar = hissar;
31- try {
32- command = JOptionPane.showInputDialog("Enter local command ", "sar -A");
33- if (command == null) {
34- return;
35- }
36- String[] cmdArray = command.split(" +");
37- List<String> cmdList = new ArrayList<>();
38- cmdList.addAll(Arrays.asList(cmdArray));
39- ProcessBuilder pb = new ProcessBuilder(cmdList);
40- pb.environment().put("LC_ALL", "C");
41- p = pb.start();
42- in = p.getInputStream();
43- } catch (Exception e) {
44- JOptionPane.showMessageDialog(null, "There was a problem while running the command ", "Local error", JOptionPane.ERROR_MESSAGE);
45- in = null;
46- }
47- }
25+ public LocalCommand(KSar hissar){
26+ mysar = hissar;
27+ try{
28+ command = JOptionPane.showInputDialog("Enter local command ", "sar -A");
29+ if(command == null){
30+ return;
31+ }
32+ String[] cmdArray = command.split(" +");
33+ List<String> cmdList = new ArrayList<>();
34+ cmdList.addAll(Arrays.asList(cmdArray));
35+ ProcessBuilder pb = new ProcessBuilder(cmdList);
36+ pb.environment().put("LC_ALL", "C");
37+ p = pb.start();
38+ in = p.getInputStream();
39+ }catch(Exception e){
40+ JOptionPane.showMessageDialog(null, "There was a problem while running the command ", "Local error", JOptionPane.ERROR_MESSAGE);
41+ in = null;
42+ }
43+ }
4844
49- public LocalCommand(KSar hissar, String hiscommand) {
50- mysar = hissar;
51- command = hiscommand;
52- try {
53- String[] envvar;
54- envvar = new String[1];
55- envvar[0] = "LC_ALL=C";
45+ public LocalCommand(KSar hissar, String hiscommand){
46+ mysar = hissar;
47+ command = hiscommand;
48+ try{
49+ String[] envvar;
50+ envvar = new String[1];
51+ envvar[0] = "LC_ALL=C";
5652
57- p = Runtime.getRuntime().exec(command, envvar);
58- in = p.getInputStream();
59- } catch (Exception e) {
60- if (GlobalOptions.hasUI() ) {
61- JOptionPane.showMessageDialog(GlobalOptions.getUI(), "There was a problem while running the command " + command, "Local error", JOptionPane.ERROR_MESSAGE);
62- } else {
63- System.err.println("There was a problem while running the command " + command);
64- }
65- in = null;
66- }
67- }
53+ p = Runtime.getRuntime().exec(command, envvar);
54+ in = p.getInputStream();
55+ }catch(Exception e){
56+ if(GlobalOptions.hasUI() ){
57+ JOptionPane.showMessageDialog(GlobalOptions.getUI(), "There was a problem while running the command " + command, "Local error", JOptionPane.ERROR_MESSAGE);
58+ }else{
59+ System.err.println("There was a problem while running the command " + command);
60+ }
61+ in = null;
62+ }
63+ }
6864
69- private void close() {
70- if ( p != null ) {
71- p.destroy();
72- }
65+ private void close(){
66+ if( p != null ){
67+ p.destroy();
68+ }
7369
74- try {
75- if (myfilereader != null) {
76- myfilereader.close();
77- }
78- } catch (IOException ex) {
79- Logger.getLogger(LocalCommand.class.getName()).log(Level.SEVERE, null, ex);
80- }
81- }
70+ try{
71+ if(myfilereader != null){
72+ myfilereader.close();
73+ }
74+ }catch(IOException ex){
75+ Logger.getLogger(LocalCommand.class.getName()).log(Level.SEVERE, null, ex);
76+ }
77+ }
8278
8379 @Override
84- public void run() {
85- String current_line;
80+ public void run(){
81+ String current_line;
8682
87- if (in == null) {
88- return;
89- }
90- myfilereader = new BufferedReader(new InputStreamReader(in));
91- if (myfilereader == null) {
92- return;
93- }
83+ if(in == null){
84+ return;
85+ }
86+ myfilereader = new BufferedReader(new InputStreamReader(in));
87+ if(myfilereader == null){
88+ return;
89+ }
9490
95- mysar.parse(myfilereader);
91+ mysar.parse(myfilereader);
9692
97- close();
98- }
93+ close();
94+ }
9995
10096 @Override
101- public String get_action() {
102- if ( command != null ) {
103- return "cmd://" + command;
104- } else {
105- return null;
106- }
107- }
97+ public String get_action(){
98+ if( command != null ){
99+ return "cmd://" + command;
100+ }else{
101+ return null;
102+ }
103+ }
108104 }
--- trunk/src/net/atomique/ksar/DataCommandImpl.java (revision 3)
+++ trunk/src/net/atomique/ksar/DataCommandImpl.java (revision 4)
@@ -5,5 +5,5 @@
55 * @author Pango
66 */
77 public interface DataCommandImpl{
8- public String get_action();
8+ public String get_action();
99 }
--- trunk/src/net/atomique/ksar/SSHCommand.java (revision 3)
+++ trunk/src/net/atomique/ksar/SSHCommand.java (revision 4)
@@ -8,6 +8,7 @@
88 import com.jcraft.jsch.UIKeyboardInteractive;
99 import com.jcraft.jsch.UserInfo;
1010 import java.awt.Container;
11+import java.awt.Dialog;
1112 import java.awt.GridBagConstraints;
1213 import java.awt.GridBagLayout;
1314 import java.awt.HeadlessException;
@@ -18,12 +19,14 @@
1819 import java.io.IOException;
1920 import java.io.InputStream;
2021 import java.io.InputStreamReader;
22+import java.text.SimpleDateFormat;
23+import java.util.Calendar;
24+import java.util.Date;
2125 import java.util.HashMap;
2226 import java.util.Iterator;
2327 import java.util.logging.Level;
2428 import java.util.logging.Logger;
2529 import javax.swing.DefaultComboBoxModel;
26-import javax.swing.JButton;
2730 import javax.swing.JComboBox;
2831 import javax.swing.JDialog;
2932 import javax.swing.JLabel;
@@ -32,6 +35,7 @@
3235 import javax.swing.JPasswordField;
3336 import javax.swing.JTextField;
3437 import net.atomique.ksar.XML.CnxHistory;
38+import org.jfree.data.time.Minute;
3539
3640 /**
3741 *
@@ -67,25 +71,25 @@
6771 private javax.swing.JPanel infoPanel;
6872 private javax.swing.JPanel passwordPanel;
6973 private javax.swing.JLabel titleLabel;
74+ private javax.swing.JPanel optionPanel;
75+ private javax.swing.JLabel optionWithStartTimeLabel;
76+ private javax.swing.JTextField optionStartTimeText;
77+ private javax.swing.JCheckBox optionStartTimeCheckBox;
7078 // End of variables declaration
7179
72- public SSHCommand(KSar hissar, String cmd) {
80+ public SSHCommand(KSar hissar, String cmd){
7381 mysar = hissar;
7482 command = cmd;
7583 }
7684
77- public SSHCommand(KSar hissar) {
85+ public SSHCommand(KSar hissar){
7886 mysar = hissar;
7987 showDialog();
8088 }
8189
8290 @Override
83- public String get_action() {
84- if ( command != null ) {
85- return "ssh://" + command;
86- } else {
87- return null;
88- }
91+ public String get_action(){
92+ return ( command != null ) ? "ssh://" + command : null;
8993 }
9094
9195 private void showDialog(){
@@ -102,11 +106,12 @@
102106 }
103107
104108 dialog.setLocationRelativeTo(GlobalOptions.getUI());
105- dialog.setAlwaysOnTop(true);
109+ dialog.setModal(true);
110+ //dialog.setModalityType(Dialog.ModalityType.);
106111 dialog.setVisible(true);
107112 }
108113
109- private void initComponents(JDialog diag) {
114+ private void initComponents(JDialog diag){
110115 headerPanel = new javax.swing.JPanel();
111116 titleLabel = new javax.swing.JLabel();
112117 infoPanel = new javax.swing.JPanel();
@@ -163,7 +168,6 @@
163168 infoPanel.add(passwordPanel);
164169
165170 commandPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
166-
167171 commandLabel.setLabelFor(cmdComboBox);
168172 commandLabel.setText("Command");
169173 commandLabel.setPreferredSize(new java.awt.Dimension(69, 16));
@@ -176,6 +180,32 @@
176180
177181 infoPanel.add(commandPanel);
178182
183+ optionPanel = new javax.swing.JPanel();
184+ optionWithStartTimeLabel = new javax.swing.JLabel();
185+ optionWithStartTimeLabel.setText("Starttime");
186+ optionPanel.add(optionWithStartTimeLabel);
187+ optionStartTimeText = new javax.swing.JTextField();
188+ optionPanel.add(optionStartTimeText);
189+ optionStartTimeCheckBox = new javax.swing.JCheckBox();
190+ optionPanel.add(optionStartTimeCheckBox);
191+ infoPanel.add(optionPanel);
192+
193+ if(null != mysar.myparser){
194+ Minute graph_endtimestamp = mysar.myparser.getEndOfGraph().getMinute();
195+ optionStartTimeText.setText(String.format("%02d:%02d:00", graph_endtimestamp.getHourValue(), graph_endtimestamp.getMinute()));
196+ optionStartTimeCheckBox.setSelected(true);
197+ }else{
198+ Calendar cal = Calendar.getInstance();
199+ cal.setTime(new Date());
200+ cal.set(Calendar.SECOND, 0);
201+ int min = cal.get(Calendar.MINUTE);
202+ min -= min%30;
203+ cal.set(Calendar.MINUTE, min);
204+
205+ optionStartTimeText.setText((new SimpleDateFormat("HH:mm:ss")).format(cal.getTime()));
206+ optionStartTimeCheckBox.setSelected(false);
207+ }
208+
179209 diag.getContentPane().add(infoPanel, java.awt.BorderLayout.CENTER);
180210
181211 connectButton.setText("Connect");
@@ -209,11 +239,11 @@
209239 }
210240 }
211241 }
212- private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
242+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt){
213243 dialog.dispose();
214244 }
215245
216- private void connectButtonActionPerformed(java.awt.event.ActionEvent e) {
246+ private void connectButtonActionPerformed(java.awt.event.ActionEvent e){
217247 dialog.dispose();
218248
219249 CnxHistory history = new CnxHistory((String) hostComboBox.getSelectedItem());
@@ -223,21 +253,21 @@
223253 GlobalOptions.addHistory(history);
224254
225255 // TODO
226- mysar.getDataView().enableSSHUpdate();
256+ //mysar.getDataView().enableAutoUpdate();
227257 }
228258 }
229259
230- private void hostComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
260+ private void hostComboBoxActionPerformed(java.awt.event.ActionEvent evt){
231261 JComboBox cb = (JComboBox) evt.getSource();
232262 String link = (String) cb.getSelectedItem();
233263 CnxHistory tmp = GlobalOptions.getHistory(link);
234264 commandModel.removeAllElements();
235- if (tmp != null) {
265+ if(tmp != null){
236266 Iterator<String> ite = tmp.getCommandList().iterator();
237- while (ite.hasNext()) {
267+ while(ite.hasNext()){
238268 commandModel.addElement(ite.next());
239269 }
240- } else {
270+ }else{
241271 commandModel.addElement("sar -A");
242272 }
243273 }
@@ -245,9 +275,9 @@
245275 private boolean connect(String user, String host, int port){
246276 jsch = new JSch();
247277 //JSch.setLogger(new MyLogger());
248- try {
278+ try{
249279 session = jsch.getSession(user, host, port);
250- } catch (JSchException ex) {
280+ }catch(JSchException ex){
251281 Logger.getLogger(SSHCommand.class.getName()).log(Level.SEVERE, null, ex);
252282 }
253283 java.util.Properties config = new java.util.Properties();
@@ -256,7 +286,7 @@
256286 char[] response = new char[passwordField.getPassword().length];
257287 StringBuilder t = new StringBuilder();
258288
259- for (int i = 0; i < passwordField.getPassword().length; i++) {
289+ for(int i = 0; i < passwordField.getPassword().length; i++){
260290 response[i] = passwordField.getPassword()[i];
261291 t.append(response[i]);
262292 }
@@ -265,63 +295,67 @@
265295 UserInfo ui = new MyUserInfo();
266296 session.setUserInfo(ui);
267297 //session.setPassword(t.toString());
268- try {
298+ try{
269299 session.connect();
270- } catch (JSchException ex) {
271- if (GlobalOptions.hasUI()) {
300+ }catch(JSchException ex){
301+ if(GlobalOptions.hasUI()){
272302 JOptionPane.showMessageDialog(GlobalOptions.getUI(), "Unable to connect", "SSH error", JOptionPane.ERROR_MESSAGE);
273303 mysar.cleared();
274- } else {
304+ }else{
275305 System.err.println("Err: unable to connect");
276306 }
277307 return false;
278308 }
279- try {
309+ try{
280310 channel = session.openChannel("exec");
281- } catch (JSchException ex) {
282- if (GlobalOptions.hasUI()) {
311+ }catch(JSchException ex){
312+ if(GlobalOptions.hasUI()){
283313 JOptionPane.showMessageDialog(GlobalOptions.getUI(), "Unable to open Channel", "SSH error", JOptionPane.ERROR_MESSAGE);
284314 mysar.cleared();
285- } else {
315+ }else{
286316 System.err.println("Err: unable to open Channel");
287317 }
288318 return false;
289319 }
290- ((ChannelExec) channel).setCommand("LC_ALL=C " + cmdComboBox.getSelectedItem() + "\n");
320+ String cmd = cmdComboBox.getSelectedItem().toString();
321+ if(optionStartTimeCheckBox.isSelected()){
322+ cmd += " -s " + optionStartTimeText.getText();
323+ }
324+ ((ChannelExec) channel).setCommand("LC_ALL=C " + cmd + "\n");
291325 channel.setInputStream(null);
292326 channel.setXForwarding(false);
293327 //((ChannelExec) channel).setErrStream(err);
294328
295- try {
329+ try{
296330 in = channel.getInputStream();
297331 err = ((ChannelExec) channel).getErrStream();
298- } catch (IOException ex) {
299- if (GlobalOptions.hasUI()) {
332+ }catch(IOException ex){
333+ if(GlobalOptions.hasUI()){
300334 JOptionPane.showMessageDialog(GlobalOptions.getUI(), "Unable to open pipe", "SSH error", JOptionPane.ERROR_MESSAGE);
301335 mysar.cleared();
302- } else {
336+ }else{
303337 System.err.println("Err: unable to open pipe");
304338 }
305339 return false;
306340 }
307- try {
341+ try{
308342 channel.connect();
309- } catch (JSchException ex) {
310- if (GlobalOptions.hasUI()) {
343+ }catch(JSchException ex){
344+ if(GlobalOptions.hasUI()){
311345 JOptionPane.showMessageDialog(GlobalOptions.getUI(), "Unable to connect Channel", "SSH error", JOptionPane.ERROR_MESSAGE);
312346 mysar.cleared();
313- } else {
347+ }else{
314348 System.err.println("Err: unable to connect Channel");
315349 }
316350 return false;
317351 }
318- if (channel.isClosed()) {
352+ if(channel.isClosed()){
319353 System.out.println("exit" + channel.getExitStatus() );
320- if (channel.getExitStatus() != 0) {
321- if (GlobalOptions.hasUI()) {
354+ if(channel.getExitStatus() != 0){
355+ if(GlobalOptions.hasUI()){
322356 JOptionPane.showMessageDialog(GlobalOptions.getUI(), "There was a problem while retrieving stat", "SSH error", JOptionPane.ERROR_MESSAGE);
323357 mysar.cleared();
324- } else {
358+ }else{
325359 System.err.println("Err: Problem during ssh connection");
326360 }
327361 return false;
@@ -332,12 +366,12 @@
332366 }
333367
334368 @Override
335- public void run() {
369+ public void run(){
336370 StringBuilder tmpmessage = new StringBuilder();
337371 int max_waitdata = 10;
338372
339- try {
340- if (in == null) {
373+ try{
374+ if(in == null){
341375 return;
342376 }
343377 // old fashion lead to error;
@@ -345,7 +379,7 @@
345379 InputStreamReader tmpin= new InputStreamReader(in);
346380 InputStreamReader tmperr = new InputStreamReader(err);
347381
348- while ( max_waitdata > 0 && ! tmpin.ready() ) {
382+ while(max_waitdata > 0 && ! tmpin.ready() ){
349383 // no data and not in timeout
350384 try { Thread.sleep( 100 ); }catch( Exception ee ) {}
351385 max_waitdata--;
@@ -357,12 +391,12 @@
357391 mysar.parse(myfile);
358392 String current_line;
359393
360- while ( (current_line = myerror.readLine()) != null) {
394+ while((current_line = myerror.readLine()) != null){
361395 tmpmessage.append(current_line);
362396 tmpmessage.append("\n");
363397 }
364- if ( tmpmessage.length() >0 ) {
365- if ( GlobalOptions.hasUI()) {
398+ if( tmpmessage.length() >0 ){
399+ if( GlobalOptions.hasUI()){
366400 JOptionPane.showMessageDialog(GlobalOptions.getUI(), tmpmessage.toString(),"SSH error", JOptionPane.ERROR_MESSAGE);
367401 }
368402 }
@@ -376,7 +410,7 @@
376410 session.disconnect();
377411 channel=null;
378412 session=null;
379- } catch (IOException | HeadlessException e) {
413+ }catch(IOException | HeadlessException e){
380414 e.printStackTrace(System.err);
381415 }
382416 }
@@ -388,33 +422,33 @@
388422 String passphrase;
389423
390424 @Override
391- public boolean promptYesNo(String str) {
425+ public boolean promptYesNo(String str){
392426 String[] options = {"yes", "no"};
393- if (GlobalOptions.hasUI()) {
427+ if(GlobalOptions.hasUI()){
394428 int foo = JOptionPane.showOptionDialog(GlobalOptions.getUI(), str, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
395429 return foo == 0;
396- } else {
430+ }else{
397431 return true;
398432 }
399433 }
400434
401435 @Override
402- public String getPassphrase() {
436+ public String getPassphrase(){
403437 return passphrase;
404438 }
405439
406440 @Override
407- public boolean promptPassphrase(String message) {
408- if (num_try > 0) {
441+ public boolean promptPassphrase(String message){
442+ if(num_try > 0){
409443 Object[] ob = {passphraseField};
410444 int result = JOptionPane.showConfirmDialog(GlobalOptions.getUI(), ob, message, JOptionPane.OK_CANCEL_OPTION);
411- if (result == JOptionPane.OK_OPTION) {
445+ if(result == JOptionPane.OK_OPTION){
412446 passphrase = passphraseField.getText();
413447 return true;
414- } else {
448+ }else{
415449 return false;
416450 }
417- } else {
451+ }else{
418452 num_try++;
419453 return true;
420454 }
@@ -421,8 +455,8 @@
421455 }
422456
423457 @Override
424- public String getPassword() {
425- if ( password != null) {
458+ public String getPassword(){
459+ if( password != null){
426460 return password;
427461 }
428462 return passwd;
@@ -429,21 +463,21 @@
429463 }
430464
431465 @Override
432- public boolean promptPassword(String message) {
433- if ( num_try > 0 || password != null) {
466+ public boolean promptPassword(String message){
467+ if( num_try > 0 || password != null){
434468 Object[] ob = {passwordField};
435- if (GlobalOptions.hasUI()) {
469+ if(GlobalOptions.hasUI()){
436470 int result = JOptionPane.showConfirmDialog(GlobalOptions.getUI(), ob, message, JOptionPane.OK_CANCEL_OPTION);
437- if (result == JOptionPane.OK_OPTION) {
471+ if(result == JOptionPane.OK_OPTION){
438472 passwd = passwordField.getText();
439473 return true;
440- } else {
474+ }else{
441475 return false;
442476 }
443- } else {
477+ }else{
444478 return false;
445479 }
446- } else {
480+ }else{
447481 num_try++;
448482 return true;
449483 }
@@ -452,9 +486,9 @@
452486 private Container panel;
453487
454488 @Override
455- public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) {
489+ public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo){
456490
457- if (password != null) {
491+ if(password != null){
458492 num_try++;
459493 return password.split("[.]");
460494 }
@@ -470,7 +504,7 @@
470504 gbc.gridwidth = GridBagConstraints.RELATIVE;
471505
472506 JTextField[] texts = new JTextField[prompt.length];
473- for (int i = 0; i < prompt.length; i++) {
507+ for(int i = 0; i < prompt.length; i++){
474508 gbc.fill = GridBagConstraints.NONE;
475509 gbc.gridx = 0;
476510 gbc.weightx = 1;
@@ -479,9 +513,9 @@
479513 gbc.gridx = 1;
480514 gbc.fill = GridBagConstraints.HORIZONTAL;
481515 gbc.weighty = 1;
482- if (echo[i]) {
516+ if(echo[i]){
483517 texts[i] = new JTextField(20);
484- } else {
518+ }else{
485519 texts[i] = new JPasswordField(20);
486520 }
487521 panel.add(texts[i], gbc);
@@ -488,23 +522,23 @@
488522 gbc.gridy++;
489523 }
490524
491- if (JOptionPane.showConfirmDialog(GlobalOptions.getUI(), panel, destination + " : " + name, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
525+ if(JOptionPane.showConfirmDialog(GlobalOptions.getUI(), panel, destination + " : " + name, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION){
492526 String[] response = new String[prompt.length];
493527 StringBuilder t = new StringBuilder();
494528
495- for (int i = 0; i < prompt.length; i++) {
529+ for(int i = 0; i < prompt.length; i++){
496530 response[i] = texts[i].getText();
497531 t.append(response[i]);
498532 }
499533 return response;
500- } else {
501- return null; // cancel
534+ }else{
535+ return null; // cancel
502536 }
503537 }
504538
505539 @Override
506- public void showMessage(String message) {
507- if (GlobalOptions.hasUI()) {
540+ public void showMessage(String message){
541+ if(GlobalOptions.hasUI()){
508542 JOptionPane.showMessageDialog(GlobalOptions.getUI(), message);
509543 }
510544 }
@@ -523,12 +557,12 @@
523557 }
524558
525559 @Override
526- public boolean isEnabled(int level) {
560+ public boolean isEnabled(int level){
527561 return true;
528562 }
529563
530564 @Override
531- public void log(int level, String message) {
565+ public void log(int level, String message){
532566 System.err.print(name.get(level));
533567 System.err.println(message);
534568 }
--- trunk/src/net/atomique/ksar/UI/LinuxDateFormat.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/LinuxDateFormat.java (nonexistent)
@@ -1,127 +0,0 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
7- * LinuxDateFormat.java
8- *
9- * Created on 1 sept. 2010, 13:50:29
10- */
11-
12-package net.atomique.ksar.UI;
13-
14-import javax.swing.DefaultComboBoxModel;
15-
16-/**
17- *
18- * @author alex
19- */
20-public class LinuxDateFormat extends javax.swing.JDialog {
21-
22- /** Creates new form LinuxDateFormat */
23- public LinuxDateFormat(java.awt.Frame parent, boolean modal) {
24- super(parent, modal);
25- initComponents();
26- load_linuxformat();
27- pack();
28- setLocationRelativeTo(parent);
29- toFront();
30- setVisible(true);
31-
32- }
33-
34- private void load_linuxformat() {
35- LinuxFormatComboModel.addElement("MM/DD/YYYY 23:59:59");
36- LinuxFormatComboModel.addElement("DD/MM/YYYY 23:59:59");
37- LinuxFormatComboModel.addElement("YYYY-MM-DD 23:59:59");
38- LinuxFormatComboModel.addElement("MM/DD/YYYY 12:59:59 AM|PM");
39- }
40-
41- /** This method is called from within the constructor to
42- * initialize the form.
43- * WARNING: Do NOT modify this code. The content of this method is
44- * always regenerated by the Form Editor.
45- */
46- @SuppressWarnings("unchecked")
47- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
48- private void initComponents() {
49-
50- jPanel1 = new javax.swing.JPanel();
51- jPanel3 = new javax.swing.JPanel();
52- jLabel1 = new javax.swing.JLabel();
53- jComboBox1 = new javax.swing.JComboBox();
54- jPanel4 = new javax.swing.JPanel();
55- jCheckBox1 = new javax.swing.JCheckBox();
56- jPanel2 = new javax.swing.JPanel();
57- OkButton = new javax.swing.JButton();
58-
59- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
60-
61- jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.PAGE_AXIS));
62-
63- jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
64-
65- jLabel1.setLabelFor(jComboBox1);
66- jLabel1.setText("Select date format:");
67- jPanel3.add(jLabel1);
68-
69- jComboBox1.setModel(LinuxFormatComboModel);
70- jComboBox1.setPreferredSize(new java.awt.Dimension(300, 27));
71- jPanel3.add(jComboBox1);
72-
73- jPanel1.add(jPanel3);
74-
75- jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
76-
77- jCheckBox1.setText("Always use this format");
78- jPanel4.add(jCheckBox1);
79-
80- jPanel1.add(jPanel4);
81-
82- getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
83-
84- OkButton.setText("Ok");
85- OkButton.addActionListener(new java.awt.event.ActionListener() {
86- public void actionPerformed(java.awt.event.ActionEvent evt) {
87- OkButtonActionPerformed(evt);
88- }
89- });
90- jPanel2.add(OkButton);
91-
92- getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
93-
94- pack();
95- }// </editor-fold>//GEN-END:initComponents
96-
97- private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
98- this.dispose();
99- ok_to_proceed=true;
100- }//GEN-LAST:event_OkButtonActionPerformed
101-
102- public boolean hasToRemenber() {
103- return jCheckBox1.isSelected();
104- }
105-
106- public String getDateFormat() {
107- return (String)jComboBox1.getSelectedItem();
108- }
109-
110- public boolean isOk() {
111- return ok_to_proceed;
112- }
113-
114- // Variables declaration - do not modify//GEN-BEGIN:variables
115- private javax.swing.JButton OkButton;
116- private javax.swing.JCheckBox jCheckBox1;
117- private javax.swing.JComboBox jComboBox1;
118- private javax.swing.JLabel jLabel1;
119- private javax.swing.JPanel jPanel1;
120- private javax.swing.JPanel jPanel2;
121- private javax.swing.JPanel jPanel3;
122- private javax.swing.JPanel jPanel4;
123- // End of variables declaration//GEN-END:variables
124-
125- DefaultComboBoxModel LinuxFormatComboModel = new DefaultComboBoxModel();
126- boolean ok_to_proceed =false;
127-}
--- trunk/src/net/atomique/ksar/UI/Desktop.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/Desktop.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * Desktop.java
83 *
94 * Created on 29 juil. 2010, 16:54:23
@@ -28,7 +23,7 @@
2823 public class Desktop extends javax.swing.JFrame {
2924
3025 /** Creates new form Desktop */
31- public Desktop() {
26+ public Desktop(){
3227 int wmargins = 90;
3328 int hmargins = 60;
3429 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
@@ -39,9 +34,7 @@
3934 setVisible(true);
4035 }
4136
42-
43-
44- private static JInternalFrame[] filterFrame(JInternalFrame[] frames) {
37+ private static JInternalFrame[] filterFrame(JInternalFrame[] frames){
4538 int n = 0;
4639 for(JInternalFrame frame : frames){
4740 if(frame.isVisible() && !frame.isIcon()){
@@ -59,16 +52,16 @@
5952 return newfs;
6053 }
6154
62- public static void iconify(JDesktopPane desktopPane) {
55+ public static void iconify(JDesktopPane desktopPane){
6356 JInternalFrame[] frames = filterFrame(desktopPane.getAllFrames());
64- if (frames.length == 0) {
57+ if(frames.length == 0){
6558 return;
6659 }
6760 for( JInternalFrame frame : frames ){
68- if (frame.isVisible() && !frame.isIcon()) {
69- try {
61+ if(frame.isVisible() && !frame.isIcon()){
62+ try{
7063 frame.setIcon(true);
71- } catch (PropertyVetoException ex) {
64+ }catch(PropertyVetoException ex){
7265 Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
7366 }
7467 }
@@ -75,20 +68,20 @@
7568 }
7669 }
7770
78- public void maxall() {
71+ public void maxall(){
7972 maximize(DesktopPane);
8073 }
8174
82- private static void maximize(JDesktopPane desktopPane) {
75+ private static void maximize(JDesktopPane desktopPane){
8376 JInternalFrame[] frames = filterFrame(desktopPane.getAllFrames());
84- if (frames.length == 0) {
77+ if(frames.length == 0){
8578 return;
8679 }
8780 for( JInternalFrame frame : frames ){
88- if (frame.isVisible() && !frame.isIcon()) {
89- try {
81+ if(frame.isVisible() && !frame.isIcon()){
82+ try{
9083 frame.setMaximum(true);
91- } catch (PropertyVetoException ex) {
84+ }catch(PropertyVetoException ex){
9285 Logger.getLogger(Desktop.class.getName()).log(Level.SEVERE, null, ex);
9386 }
9487 }
@@ -95,9 +88,9 @@
9588 }
9689 }
9790
98- public static void tile(JDesktopPane desktopPane) {
91+ public static void tile(JDesktopPane desktopPane){
9992 JInternalFrame[] frames = filterFrame(desktopPane.getAllFrames());
100- if (frames.length == 0) {
93+ if(frames.length == 0){
10194 return;
10295 }
10396
@@ -104,21 +97,21 @@
10497 tile(frames, desktopPane.getBounds());
10598 }
10699
107- private static void tile(JInternalFrame[] frames, Rectangle dBounds) {
100+ private static void tile(JInternalFrame[] frames, Rectangle dBounds){
108101 int cols = (int) Math.sqrt(frames.length);
109102 int rows = (int) (Math.ceil(((double) frames.length) / cols));
110103 int lastRow = frames.length - cols * (rows - 1);
111104 int width, height;
112105
113- if (lastRow == 0) {
106+ if(lastRow == 0){
114107 rows--;
115108 height = dBounds.height / rows;
116- } else {
109+ }else{
117110 height = dBounds.height / rows;
118- if (lastRow < cols) {
111+ if(lastRow < cols){
119112 rows--;
120113 width = dBounds.width / lastRow;
121- for (int i = 0; i < lastRow; i++) {
114+ for(int i = 0; i < lastRow; i++){
122115 frames[cols * rows + i].setBounds(i * width, rows * height, width, height);
123116 }
124117 }
@@ -125,8 +118,8 @@
125118 }
126119
127120 width = dBounds.width / cols;
128- for (int j = 0; j < rows; j++) {
129- for (int i = 0; i < cols; i++) {
121+ for(int j = 0; j < rows; j++){
122+ for(int i = 0; i < cols; i++){
130123 frames[i + j * cols].setBounds(i * width, j * height, width, height);
131124 }
132125 }
@@ -138,171 +131,171 @@
138131 * always regenerated by the Form Editor.
139132 */
140133 @SuppressWarnings("unchecked")
141- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
142- private void initComponents() {
134+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
135+ private void initComponents(){
143136
144- DesktopPane = new javax.swing.JDesktopPane();
145- MenuBar = new javax.swing.JMenuBar();
146- FileMenu = new javax.swing.JMenu();
147- NewMenu = new javax.swing.JMenuItem();
148- QuitMenu = new javax.swing.JMenuItem();
149- OptionsMenu = new javax.swing.JMenu();
150- SysprefMenu = new javax.swing.JMenuItem();
151- WindowMenu = new javax.swing.JMenu();
152- TileMenu = new javax.swing.JMenuItem();
153- IconifyMenu = new javax.swing.JMenuItem();
154- MaximizeMenu = new javax.swing.JMenuItem();
155- HelpMenu = new javax.swing.JMenu();
156- AboutMenu = new javax.swing.JMenuItem();
137+ DesktopPane = new javax.swing.JDesktopPane();
138+ MenuBar = new javax.swing.JMenuBar();
139+ FileMenu = new javax.swing.JMenu();
140+ NewMenu = new javax.swing.JMenuItem();
141+ QuitMenu = new javax.swing.JMenuItem();
142+ OptionsMenu = new javax.swing.JMenu();
143+ SysprefMenu = new javax.swing.JMenuItem();
144+ WindowMenu = new javax.swing.JMenu();
145+ TileMenu = new javax.swing.JMenuItem();
146+ IconifyMenu = new javax.swing.JMenuItem();
147+ MaximizeMenu = new javax.swing.JMenuItem();
148+ HelpMenu = new javax.swing.JMenu();
149+ AboutMenu = new javax.swing.JMenuItem();
157150
158- setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
159- setTitle("kSar : a sar grapher");
160- addWindowListener(new java.awt.event.WindowAdapter() {
161- public void windowClosing(java.awt.event.WindowEvent evt) {
162- formWindowClosing(evt);
163- }
164- });
165- getContentPane().add(DesktopPane, java.awt.BorderLayout.CENTER);
151+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
152+ setTitle("kSar : a sar grapher");
153+ addWindowListener(new java.awt.event.WindowAdapter(){
154+ public void windowClosing(java.awt.event.WindowEvent evt){
155+ formWindowClosing(evt);
156+ }
157+ });
158+ getContentPane().add(DesktopPane, java.awt.BorderLayout.CENTER);
166159
167- FileMenu.setText("File"); // NOI18N
160+ FileMenu.setText("File"); // NOI18N
168161
169- NewMenu.setText("New window");
170- NewMenu.addActionListener(new java.awt.event.ActionListener() {
171- public void actionPerformed(java.awt.event.ActionEvent evt) {
172- NewMenuActionPerformed(evt);
173- }
174- });
175- FileMenu.add(NewMenu);
162+ NewMenu.setText("New window");
163+ NewMenu.addActionListener(new java.awt.event.ActionListener(){
164+ public void actionPerformed(java.awt.event.ActionEvent evt){
165+ NewMenuActionPerformed(evt);
166+ }
167+ });
168+ FileMenu.add(NewMenu);
176169
177- QuitMenu.setText("Quit");
178- QuitMenu.addActionListener(new java.awt.event.ActionListener() {
179- public void actionPerformed(java.awt.event.ActionEvent evt) {
180- QuitMenuActionPerformed(evt);
181- }
182- });
183- FileMenu.add(QuitMenu);
170+ QuitMenu.setText("Quit");
171+ QuitMenu.addActionListener(new java.awt.event.ActionListener(){
172+ public void actionPerformed(java.awt.event.ActionEvent evt){
173+ QuitMenuActionPerformed(evt);
174+ }
175+ });
176+ FileMenu.add(QuitMenu);
184177
185- MenuBar.add(FileMenu);
178+ MenuBar.add(FileMenu);
186179
187- OptionsMenu.setText("Options"); // NOI18N
180+ OptionsMenu.setText("Options"); // NOI18N
188181
189- SysprefMenu.setText("System Preferences");
190- SysprefMenu.addActionListener(new java.awt.event.ActionListener() {
191- public void actionPerformed(java.awt.event.ActionEvent evt) {
192- SysprefMenuActionPerformed(evt);
193- }
194- });
195- OptionsMenu.add(SysprefMenu);
182+ SysprefMenu.setText("System Preferences");
183+ SysprefMenu.addActionListener(new java.awt.event.ActionListener(){
184+ public void actionPerformed(java.awt.event.ActionEvent evt){
185+ SysprefMenuActionPerformed(evt);
186+ }
187+ });
188+ OptionsMenu.add(SysprefMenu);
196189
197- MenuBar.add(OptionsMenu);
190+ MenuBar.add(OptionsMenu);
198191
199- WindowMenu.setText("Window");
192+ WindowMenu.setText("Window");
200193
201- TileMenu.setText("Tile");
202- TileMenu.setActionCommand("TileMenu");
203- TileMenu.addActionListener(new java.awt.event.ActionListener() {
204- public void actionPerformed(java.awt.event.ActionEvent evt) {
205- TileMenuActionPerformed(evt);
206- }
207- });
208- WindowMenu.add(TileMenu);
194+ TileMenu.setText("Tile");
195+ TileMenu.setActionCommand("TileMenu");
196+ TileMenu.addActionListener(new java.awt.event.ActionListener(){
197+ public void actionPerformed(java.awt.event.ActionEvent evt){
198+ TileMenuActionPerformed(evt);
199+ }
200+ });
201+ WindowMenu.add(TileMenu);
209202
210- IconifyMenu.setText("Iconify");
211- IconifyMenu.setActionCommand("IconifyMenu");
212- IconifyMenu.addActionListener(new java.awt.event.ActionListener() {
213- public void actionPerformed(java.awt.event.ActionEvent evt) {
214- IconifyMenuActionPerformed(evt);
215- }
216- });
217- WindowMenu.add(IconifyMenu);
203+ IconifyMenu.setText("Iconify");
204+ IconifyMenu.setActionCommand("IconifyMenu");
205+ IconifyMenu.addActionListener(new java.awt.event.ActionListener(){
206+ public void actionPerformed(java.awt.event.ActionEvent evt){
207+ IconifyMenuActionPerformed(evt);
208+ }
209+ });
210+ WindowMenu.add(IconifyMenu);
218211
219- MaximizeMenu.setText("Maximize");
220- MaximizeMenu.addActionListener(new java.awt.event.ActionListener() {
221- public void actionPerformed(java.awt.event.ActionEvent evt) {
222- MaximizeMenuActionPerformed(evt);
223- }
224- });
225- WindowMenu.add(MaximizeMenu);
212+ MaximizeMenu.setText("Maximize");
213+ MaximizeMenu.addActionListener(new java.awt.event.ActionListener(){
214+ public void actionPerformed(java.awt.event.ActionEvent evt){
215+ MaximizeMenuActionPerformed(evt);
216+ }
217+ });
218+ WindowMenu.add(MaximizeMenu);
226219
227- MenuBar.add(WindowMenu);
220+ MenuBar.add(WindowMenu);
228221
229- HelpMenu.setText("?");
222+ HelpMenu.setText("?");
230223
231- AboutMenu.setText("About");
232- AboutMenu.addActionListener(new java.awt.event.ActionListener() {
233- public void actionPerformed(java.awt.event.ActionEvent evt) {
234- AboutMenuActionPerformed(evt);
235- }
236- });
237- HelpMenu.add(AboutMenu);
224+ AboutMenu.setText("About");
225+ AboutMenu.addActionListener(new java.awt.event.ActionListener(){
226+ public void actionPerformed(java.awt.event.ActionEvent evt){
227+ AboutMenuActionPerformed(evt);
228+ }
229+ });
230+ HelpMenu.add(AboutMenu);
238231
239- MenuBar.add(HelpMenu);
232+ MenuBar.add(HelpMenu);
240233
241- setJMenuBar(MenuBar);
234+ setJMenuBar(MenuBar);
242235
243- pack();
244- }// </editor-fold>//GEN-END:initComponents
236+ pack();
237+ }// </editor-fold>//GEN-END:initComponents
245238
246- private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
239+ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
247240 tryToQuit();
248- }//GEN-LAST:event_formWindowClosing
241+ }//GEN-LAST:event_formWindowClosing
249242
250- private void QuitMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuitMenuActionPerformed
243+ private void QuitMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuitMenuActionPerformed
251244 tryToQuit();
252- }//GEN-LAST:event_QuitMenuActionPerformed
245+ }//GEN-LAST:event_QuitMenuActionPerformed
253246
254- private void AboutMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutMenuActionPerformed
247+ private void AboutMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutMenuActionPerformed
255248 AboutBox myAboutBox = new AboutBox(this);
256- }//GEN-LAST:event_AboutMenuActionPerformed
249+ }//GEN-LAST:event_AboutMenuActionPerformed
257250
258- private void SysprefMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SysprefMenuActionPerformed
251+ private void SysprefMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SysprefMenuActionPerformed
259252 Preferences myPreferences = new Preferences(this);
260- }//GEN-LAST:event_SysprefMenuActionPerformed
253+ }//GEN-LAST:event_SysprefMenuActionPerformed
261254
262- private void NewMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewMenuActionPerformed
255+ private void NewMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewMenuActionPerformed
263256 add_window();
264- }//GEN-LAST:event_NewMenuActionPerformed
257+ }//GEN-LAST:event_NewMenuActionPerformed
265258
266- private void TileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TileMenuActionPerformed
259+ private void TileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TileMenuActionPerformed
267260 tile(DesktopPane);
268- }//GEN-LAST:event_TileMenuActionPerformed
261+ }//GEN-LAST:event_TileMenuActionPerformed
269262
270- private void IconifyMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IconifyMenuActionPerformed
263+ private void IconifyMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IconifyMenuActionPerformed
271264 iconify(DesktopPane);
272- }//GEN-LAST:event_IconifyMenuActionPerformed
265+ }//GEN-LAST:event_IconifyMenuActionPerformed
273266
274- private void MaximizeMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MaximizeMenuActionPerformed
267+ private void MaximizeMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MaximizeMenuActionPerformed
275268 maximize(DesktopPane);
276- }//GEN-LAST:event_MaximizeMenuActionPerformed
269+ }//GEN-LAST:event_MaximizeMenuActionPerformed
277270
278- public void add_window() {
271+ public void add_window(){
279272 KSar mysar = new KSar(DesktopPane);
280273 }
281274
282- public JDesktopPane getDesktopPane() {
275+ public JDesktopPane getDesktopPane(){
283276 return DesktopPane;
284277 }
285278
286279
287- private void tryToQuit() {
280+ private void tryToQuit(){
288281 int i = JOptionPane.showConfirmDialog(this, "Are you sure you want to exit kSar ?", "Confirm", JOptionPane.YES_NO_OPTION);
289- if (i == JOptionPane.YES_OPTION) {
282+ if(i == JOptionPane.YES_OPTION){
290283 System.exit(0);
291284 }
292285 }
293- // Variables declaration - do not modify//GEN-BEGIN:variables
294- private javax.swing.JMenuItem AboutMenu;
295- private javax.swing.JDesktopPane DesktopPane;
296- private javax.swing.JMenu FileMenu;
297- private javax.swing.JMenu HelpMenu;
298- private javax.swing.JMenuItem IconifyMenu;
299- private javax.swing.JMenuItem MaximizeMenu;
300- private javax.swing.JMenuBar MenuBar;
301- private javax.swing.JMenuItem NewMenu;
302- private javax.swing.JMenu OptionsMenu;
303- private javax.swing.JMenuItem QuitMenu;
304- private javax.swing.JMenuItem SysprefMenu;
305- private javax.swing.JMenuItem TileMenu;
306- private javax.swing.JMenu WindowMenu;
307- // End of variables declaration//GEN-END:variables
286+ // Variables declaration - do not modify//GEN-BEGIN:variables
287+ private javax.swing.JMenuItem AboutMenu;
288+ private javax.swing.JDesktopPane DesktopPane;
289+ private javax.swing.JMenu FileMenu;
290+ private javax.swing.JMenu HelpMenu;
291+ private javax.swing.JMenuItem IconifyMenu;
292+ private javax.swing.JMenuItem MaximizeMenu;
293+ private javax.swing.JMenuBar MenuBar;
294+ private javax.swing.JMenuItem NewMenu;
295+ private javax.swing.JMenu OptionsMenu;
296+ private javax.swing.JMenuItem QuitMenu;
297+ private javax.swing.JMenuItem SysprefMenu;
298+ private javax.swing.JMenuItem TileMenu;
299+ private javax.swing.JMenu WindowMenu;
300+ // End of variables declaration//GEN-END:variables
308301 }
--- trunk/src/net/atomique/ksar/UI/ParentNodeInfo.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/ParentNodeInfo.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.UI;
72
83 import net.atomique.ksar.Graph.List;
@@ -13,21 +8,21 @@
138 */
149 public class ParentNodeInfo {
1510
16- public ParentNodeInfo(String t, List list) {
11+ public ParentNodeInfo(String t, List list){
1712 node_title = t;
1813 node_object = list;
1914 }
2015
21- public List getNode_object() {
16+ public List getNode_object(){
2217 return node_object;
2318 }
2419
25- public String getNode_title() {
20+ public String getNode_title(){
2621 return node_title;
2722 }
2823
2924 @Override
30- public String toString() {
25+ public String toString(){
3126 return node_title;
3227 }
3328
--- trunk/src/net/atomique/ksar/UI/TreeNodeInfo.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/TreeNodeInfo.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.UI;
72
83 import net.atomique.ksar.Graph.Graph;
@@ -13,20 +8,20 @@
138 */
149 public class TreeNodeInfo {
1510
16- public TreeNodeInfo(String t, Graph graph) {
11+ public TreeNodeInfo(String t, Graph graph){
1712 node_title = t;
1813 node_object = graph;
1914 }
2015
21- public Graph getNode_object() {
16+ public Graph getNode_object(){
2217 return node_object;
2318 }
2419
25- public String getNode_title() {
20+ public String getNode_title(){
2621 return node_title;
2722 }
2823
29- public String toString() {
24+ public String toString(){
3025 return node_title;
3126 }
3227
--- trunk/src/net/atomique/ksar/UI/AboutBox.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/AboutBox.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * AboutBox.java
83 *
94 * Created on 29 juil. 2010, 17:31:33
@@ -20,139 +15,139 @@
2015 */
2116 public class AboutBox extends javax.swing.JDialog {
2217
23- /** Creates new form AboutBox
18+ /** Creates new form AboutBox
2419 * @param parent */
25- public AboutBox(java.awt.Frame parent) {
26- super(parent);
27- initComponents();
28- Dimension d1 = getSize();
29- Dimension d2 = parent.getSize();
30- int x = (d2.width -(d1.width/2) ) / 2 ;
31- int y = (d2.height- (d1.height/2) ) /2 ;
32- setBounds(x, y, d1.width, d1.height);
33- setModal(true);
34- setVisible(true);
35- }
20+ public AboutBox(java.awt.Frame parent){
21+ super(parent);
22+ initComponents();
23+ Dimension d1 = getSize();
24+ Dimension d2 = parent.getSize();
25+ int x = (d2.width -(d1.width/2) ) / 2 ;
26+ int y = (d2.height- (d1.height/2) ) /2 ;
27+ setBounds(x, y, d1.width, d1.height);
28+ setModal(true);
29+ setVisible(true);
30+ }
3631
37- /** This method is called from within the constructor to
38- * initialize the form.
39- * WARNING: Do NOT modify this code. The content of this method is
40- * always regenerated by the Form Editor.
41- */
42- @SuppressWarnings("unchecked")
43- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
44- private void initComponents() {
32+ /** This method is called from within the constructor to
33+ * initialize the form.
34+ * WARNING: Do NOT modify this code. The content of this method is
35+ * always regenerated by the Form Editor.
36+ */
37+ @SuppressWarnings("unchecked")
38+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
39+ private void initComponents(){
4540
46- jPanel3 = new javax.swing.JPanel();
47- versionlabel = new javax.swing.JLabel();
48- jPanel2 = new javax.swing.JPanel();
49- jSeparator2 = new javax.swing.JSeparator();
50- urllabel = new javax.swing.JLabel();
51- authorlabel = new javax.swing.JLabel();
52- licencelabel = new javax.swing.JLabel();
53- tipslabel = new javax.swing.JLabel();
54- jSeparator1 = new javax.swing.JSeparator();
55- jLabel1 = new javax.swing.JLabel();
56- jLabel2 = new javax.swing.JLabel();
57- jPanel1 = new javax.swing.JPanel();
58- OkButton = new javax.swing.JButton();
41+ jPanel3 = new javax.swing.JPanel();
42+ versionlabel = new javax.swing.JLabel();
43+ jPanel2 = new javax.swing.JPanel();
44+ jSeparator2 = new javax.swing.JSeparator();
45+ urllabel = new javax.swing.JLabel();
46+ authorlabel = new javax.swing.JLabel();
47+ licencelabel = new javax.swing.JLabel();
48+ tipslabel = new javax.swing.JLabel();
49+ jSeparator1 = new javax.swing.JSeparator();
50+ jLabel1 = new javax.swing.JLabel();
51+ jLabel2 = new javax.swing.JLabel();
52+ jPanel1 = new javax.swing.JPanel();
53+ OkButton = new javax.swing.JButton();
5954
60- setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
61- getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));
55+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
56+ getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));
6257
63- jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
58+ jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
6459
65- versionlabel.setText("kSar version: " + VersionNumber.getVersionNumber());
60+ versionlabel.setText("kSar version: " + VersionNumber.getVersionNumber());
6661
67- javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
68- jPanel3.setLayout(jPanel3Layout);
69- jPanel3Layout.setHorizontalGroup(
70- jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
71- .addGap(0, 518, Short.MAX_VALUE)
72- .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
73- .addGroup(jPanel3Layout.createSequentialGroup()
74- .addGap(0, 217, Short.MAX_VALUE)
75- .addComponent(versionlabel)
76- .addGap(0, 217, Short.MAX_VALUE)))
77- );
78- jPanel3Layout.setVerticalGroup(
79- jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
80- .addGap(0, 16, Short.MAX_VALUE)
81- .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
82- .addGroup(jPanel3Layout.createSequentialGroup()
83- .addGap(0, 0, Short.MAX_VALUE)
84- .addComponent(versionlabel)
85- .addGap(0, 0, Short.MAX_VALUE)))
86- );
62+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
63+ jPanel3.setLayout(jPanel3Layout);
64+ jPanel3Layout.setHorizontalGroup(
65+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
66+ .addGap(0, 518, Short.MAX_VALUE)
67+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
68+ .addGroup(jPanel3Layout.createSequentialGroup()
69+ .addGap(0, 217, Short.MAX_VALUE)
70+ .addComponent(versionlabel)
71+ .addGap(0, 217, Short.MAX_VALUE)))
72+ );
73+ jPanel3Layout.setVerticalGroup(
74+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
75+ .addGap(0, 16, Short.MAX_VALUE)
76+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
77+ .addGroup(jPanel3Layout.createSequentialGroup()
78+ .addGap(0, 0, Short.MAX_VALUE)
79+ .addComponent(versionlabel)
80+ .addGap(0, 0, Short.MAX_VALUE)))
81+ );
8782
88- getContentPane().add(jPanel3);
83+ getContentPane().add(jPanel3);
8984
90- jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.PAGE_AXIS));
85+ jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.PAGE_AXIS));
9186
92- jSeparator2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
93- jSeparator2.setMaximumSize(new java.awt.Dimension(800, 1));
94- jSeparator2.setMinimumSize(new java.awt.Dimension(0, 1));
95- jPanel2.add(jSeparator2);
87+ jSeparator2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
88+ jSeparator2.setMaximumSize(new java.awt.Dimension(800, 1));
89+ jSeparator2.setMinimumSize(new java.awt.Dimension(0, 1));
90+ jPanel2.add(jSeparator2);
9691
97- urllabel.setText("Website(original project): http://sourceforge.net/projects/ksar/");
98- jPanel2.add(urllabel);
92+ urllabel.setText("Website(original project): http://sourceforge.net/projects/ksar/");
93+ jPanel2.add(urllabel);
9994
100- authorlabel.setText("Author: xavier cherif");
101- jPanel2.add(authorlabel);
95+ authorlabel.setText("Author: xavier cherif");
96+ jPanel2.add(authorlabel);
10297
103- licencelabel.setText("License: BSD (see LICENCE file)");
104- jPanel2.add(licencelabel);
98+ licencelabel.setText("License: BSD (see LICENCE file)");
99+ jPanel2.add(licencelabel);
105100
106- tipslabel.setText("ARS LONGA, VITA BREVIS");
107- jPanel2.add(tipslabel);
101+ tipslabel.setText("ARS LONGA, VITA BREVIS");
102+ jPanel2.add(tipslabel);
108103
109- jSeparator1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
110- jSeparator1.setMaximumSize(new java.awt.Dimension(800, 1));
111- jSeparator1.setMinimumSize(new java.awt.Dimension(0, 1));
112- jPanel2.add(jSeparator1);
104+ jSeparator1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
105+ jSeparator1.setMaximumSize(new java.awt.Dimension(800, 1));
106+ jSeparator1.setMinimumSize(new java.awt.Dimension(0, 1));
107+ jPanel2.add(jSeparator1);
113108
114- jLabel1.setText("Last update by Pango Chan, 2015/06/09.");
115- jPanel2.add(jLabel1);
109+ jLabel1.setText("Last update by Pango Chan, 2015/06/09.");
110+ jPanel2.add(jLabel1);
116111
117- jLabel2.setText("Website(current, temporary): https://osdn.jp/projects/hinemoshelper/");
118- jPanel2.add(jLabel2);
112+ jLabel2.setText("Website(current, temporary): https://osdn.jp/projects/hinemoshelper/");
113+ jPanel2.add(jLabel2);
119114
120- getContentPane().add(jPanel2);
115+ getContentPane().add(jPanel2);
121116
122- OkButton.setText("Close");
123- OkButton.addActionListener(new java.awt.event.ActionListener() {
124- public void actionPerformed(java.awt.event.ActionEvent evt) {
125- OkButtonActionPerformed(evt);
126- }
127- });
128- jPanel1.add(OkButton);
117+ OkButton.setText("Close");
118+ OkButton.addActionListener(new java.awt.event.ActionListener(){
119+ public void actionPerformed(java.awt.event.ActionEvent evt){
120+ OkButtonActionPerformed(evt);
121+ }
122+ });
123+ jPanel1.add(OkButton);
129124
130- getContentPane().add(jPanel1);
125+ getContentPane().add(jPanel1);
131126
132- pack();
133- }// </editor-fold>//GEN-END:initComponents
127+ pack();
128+ }// </editor-fold>//GEN-END:initComponents
134129
135- private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
136- setVisible(false);
137- dispose();
138- }//GEN-LAST:event_OkButtonActionPerformed
130+ private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
131+ setVisible(false);
132+ dispose();
133+ }//GEN-LAST:event_OkButtonActionPerformed
139134
140135
141136
142- // Variables declaration - do not modify//GEN-BEGIN:variables
143- private javax.swing.JButton OkButton;
144- private javax.swing.JLabel authorlabel;
145- private javax.swing.JLabel jLabel1;
146- private javax.swing.JLabel jLabel2;
147- private javax.swing.JPanel jPanel1;
148- private javax.swing.JPanel jPanel2;
149- private javax.swing.JPanel jPanel3;
150- private javax.swing.JSeparator jSeparator1;
151- private javax.swing.JSeparator jSeparator2;
152- private javax.swing.JLabel licencelabel;
153- private javax.swing.JLabel tipslabel;
154- private javax.swing.JLabel urllabel;
155- private javax.swing.JLabel versionlabel;
156- // End of variables declaration//GEN-END:variables
137+ // Variables declaration - do not modify//GEN-BEGIN:variables
138+ private javax.swing.JButton OkButton;
139+ private javax.swing.JLabel authorlabel;
140+ private javax.swing.JLabel jLabel1;
141+ private javax.swing.JLabel jLabel2;
142+ private javax.swing.JPanel jPanel1;
143+ private javax.swing.JPanel jPanel2;
144+ private javax.swing.JPanel jPanel3;
145+ private javax.swing.JSeparator jSeparator1;
146+ private javax.swing.JSeparator jSeparator2;
147+ private javax.swing.JLabel licencelabel;
148+ private javax.swing.JLabel tipslabel;
149+ private javax.swing.JLabel urllabel;
150+ private javax.swing.JLabel versionlabel;
151+ // End of variables declaration//GEN-END:variables
157152
158153 }
--- trunk/src/net/atomique/ksar/UI/HostInfoView.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/HostInfoView.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * HostInfoView.java
83 *
94 * Created on 25 oct. 2010, 16:08:27
@@ -20,145 +15,145 @@
2015 */
2116 public class HostInfoView extends javax.swing.JDialog {
2217
23- /** Creates new form HostInfoView */
24- public HostInfoView(java.awt.Frame parent, HostInfo tmphostinfo) {
25-
26- super(parent, true);
27- hostinfo = tmphostinfo;
28- initComponents();
29- Hostname.setText(hostinfo.getHostname());
30- AliasField.setText(hostinfo.getAlias());
31- jTextArea1.setText(hostinfo.getDescription());
32- memboxcombo.setSelectedItem(hostinfo.getMemBlockSize().toString());
33- setLocationRelativeTo(GlobalOptions.getUI());
34- }
18+ /** Creates new form HostInfoView */
19+ public HostInfoView(java.awt.Frame parent, HostInfo tmphostinfo){
20+
21+ super(parent, true);
22+ hostinfo = tmphostinfo;
23+ initComponents();
24+ Hostname.setText(hostinfo.getHostname());
25+ AliasField.setText(hostinfo.getAlias());
26+ jTextArea1.setText(hostinfo.getDescription());
27+ memboxcombo.setSelectedItem(hostinfo.getMemBlockSize().toString());
28+ setLocationRelativeTo(GlobalOptions.getUI());
29+ }
3530
36- /** This method is called from within the constructor to
37- * initialize the form.
38- * WARNING: Do NOT modify this code. The content of this method is
39- * always regenerated by the Form Editor.
40- */
41- @SuppressWarnings("unchecked")
42- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
43- private void initComponents() {
31+ /** This method is called from within the constructor to
32+ * initialize the form.
33+ * WARNING: Do NOT modify this code. The content of this method is
34+ * always regenerated by the Form Editor.
35+ */
36+ @SuppressWarnings("unchecked")
37+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
38+ private void initComponents(){
4439
45- jPanel1 = new javax.swing.JPanel();
46- hostnamePanel = new javax.swing.JPanel();
47- HostNameLabel = new javax.swing.JLabel();
48- Hostname = new javax.swing.JLabel();
49- AliasPanel = new javax.swing.JPanel();
50- AliasLabel = new javax.swing.JLabel();
51- AliasField = new javax.swing.JTextField();
52- DescriptionPanel = new javax.swing.JPanel();
53- descriptionLabel = new javax.swing.JLabel();
54- jScrollPane1 = new javax.swing.JScrollPane();
55- jTextArea1 = new javax.swing.JTextArea();
56- MemoryPanel = new javax.swing.JPanel();
57- memBlockSizeLabel = new javax.swing.JLabel();
58- memboxcombo = new javax.swing.JComboBox();
59- jPanel2 = new javax.swing.JPanel();
60- OkButton = new javax.swing.JButton();
40+ jPanel1 = new javax.swing.JPanel();
41+ hostnamePanel = new javax.swing.JPanel();
42+ HostNameLabel = new javax.swing.JLabel();
43+ Hostname = new javax.swing.JLabel();
44+ AliasPanel = new javax.swing.JPanel();
45+ AliasLabel = new javax.swing.JLabel();
46+ AliasField = new javax.swing.JTextField();
47+ DescriptionPanel = new javax.swing.JPanel();
48+ descriptionLabel = new javax.swing.JLabel();
49+ jScrollPane1 = new javax.swing.JScrollPane();
50+ jTextArea1 = new javax.swing.JTextArea();
51+ MemoryPanel = new javax.swing.JPanel();
52+ memBlockSizeLabel = new javax.swing.JLabel();
53+ memboxcombo = new javax.swing.JComboBox();
54+ jPanel2 = new javax.swing.JPanel();
55+ OkButton = new javax.swing.JButton();
6156
62- setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
63- setTitle("Host Information");
57+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
58+ setTitle("Host Information");
6459
65- jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
66- jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.PAGE_AXIS));
60+ jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
61+ jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.PAGE_AXIS));
6762
68- hostnamePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
63+ hostnamePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
6964
70- HostNameLabel.setLabelFor(Hostname);
71- HostNameLabel.setText("Hostname:");
72- hostnamePanel.add(HostNameLabel);
65+ HostNameLabel.setLabelFor(Hostname);
66+ HostNameLabel.setText("Hostname:");
67+ hostnamePanel.add(HostNameLabel);
7368
74- Hostname.setText("hostname");
75- hostnamePanel.add(Hostname);
69+ Hostname.setText("hostname");
70+ hostnamePanel.add(Hostname);
7671
77- jPanel1.add(hostnamePanel);
72+ jPanel1.add(hostnamePanel);
7873
79- AliasPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
74+ AliasPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
8075
81- AliasLabel.setText("Alias");
82- AliasLabel.setPreferredSize(new java.awt.Dimension(52, 14));
83- AliasPanel.add(AliasLabel);
76+ AliasLabel.setText("Alias");
77+ AliasLabel.setPreferredSize(new java.awt.Dimension(52, 14));
78+ AliasPanel.add(AliasLabel);
8479
85- AliasField.setMinimumSize(new java.awt.Dimension(120, 20));
86- AliasField.setPreferredSize(new java.awt.Dimension(120, 20));
87- AliasPanel.add(AliasField);
80+ AliasField.setMinimumSize(new java.awt.Dimension(120, 20));
81+ AliasField.setPreferredSize(new java.awt.Dimension(120, 20));
82+ AliasPanel.add(AliasField);
8883
89- jPanel1.add(AliasPanel);
84+ jPanel1.add(AliasPanel);
9085
91- DescriptionPanel.setLayout(new javax.swing.BoxLayout(DescriptionPanel, javax.swing.BoxLayout.PAGE_AXIS));
86+ DescriptionPanel.setLayout(new javax.swing.BoxLayout(DescriptionPanel, javax.swing.BoxLayout.PAGE_AXIS));
9287
93- descriptionLabel.setText("Description");
94- descriptionLabel.setPreferredSize(new java.awt.Dimension(52, 14));
95- DescriptionPanel.add(descriptionLabel);
88+ descriptionLabel.setText("Description");
89+ descriptionLabel.setPreferredSize(new java.awt.Dimension(52, 14));
90+ DescriptionPanel.add(descriptionLabel);
9691
97- jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 200));
92+ jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 200));
9893
99- jTextArea1.setColumns(20);
100- jTextArea1.setRows(5);
101- jTextArea1.setPreferredSize(new java.awt.Dimension(300, 200));
102- jScrollPane1.setViewportView(jTextArea1);
94+ jTextArea1.setColumns(20);
95+ jTextArea1.setRows(5);
96+ jTextArea1.setPreferredSize(new java.awt.Dimension(300, 200));
97+ jScrollPane1.setViewportView(jTextArea1);
10398
104- DescriptionPanel.add(jScrollPane1);
99+ DescriptionPanel.add(jScrollPane1);
105100
106- jPanel1.add(DescriptionPanel);
101+ jPanel1.add(DescriptionPanel);
107102
108- MemoryPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
103+ MemoryPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
109104
110- memBlockSizeLabel.setText("Memory Block Size:");
111- MemoryPanel.add(memBlockSizeLabel);
105+ memBlockSizeLabel.setText("Memory Block Size:");
106+ MemoryPanel.add(memBlockSizeLabel);
112107
113- memboxcombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1024", "2048", "4096", "8192", "16384" }));
114- MemoryPanel.add(memboxcombo);
108+ memboxcombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1024", "2048", "4096", "8192", "16384" }));
109+ MemoryPanel.add(memboxcombo);
115110
116- jPanel1.add(MemoryPanel);
111+ jPanel1.add(MemoryPanel);
117112
118- getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
113+ getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
119114
120- jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 15, 5));
115+ jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 15, 5));
121116
122- OkButton.setText("Ok");
123- OkButton.addActionListener(new java.awt.event.ActionListener() {
124- public void actionPerformed(java.awt.event.ActionEvent evt) {
125- OkButtonActionPerformed(evt);
126- }
127- });
128- jPanel2.add(OkButton);
117+ OkButton.setText("Ok");
118+ OkButton.addActionListener(new java.awt.event.ActionListener(){
119+ public void actionPerformed(java.awt.event.ActionEvent evt){
120+ OkButtonActionPerformed(evt);
121+ }
122+ });
123+ jPanel2.add(OkButton);
129124
130- getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
125+ getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
131126
132- pack();
133- }// </editor-fold>//GEN-END:initComponents
127+ pack();
128+ }// </editor-fold>//GEN-END:initComponents
134129
135- private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
136- this.dispose();
137- hostinfo.setAlias(AliasField.getText());
138- hostinfo.setDescription(jTextArea1.getText());
139- hostinfo.setMemBlockSize(memboxcombo.getSelectedItem().toString());
140- GlobalOptions.addHostInfo(hostinfo);
141- }//GEN-LAST:event_OkButtonActionPerformed
130+ private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
131+ this.dispose();
132+ hostinfo.setAlias(AliasField.getText());
133+ hostinfo.setDescription(jTextArea1.getText());
134+ hostinfo.setMemBlockSize(memboxcombo.getSelectedItem().toString());
135+ GlobalOptions.addHostInfo(hostinfo);
136+ }//GEN-LAST:event_OkButtonActionPerformed
142137
143138
144139
145- // Variables declaration - do not modify//GEN-BEGIN:variables
146- private javax.swing.JTextField AliasField;
147- private javax.swing.JLabel AliasLabel;
148- private javax.swing.JPanel AliasPanel;
149- private javax.swing.JPanel DescriptionPanel;
150- private javax.swing.JLabel HostNameLabel;
151- private javax.swing.JLabel Hostname;
152- private javax.swing.JPanel MemoryPanel;
153- private javax.swing.JButton OkButton;
154- private javax.swing.JLabel descriptionLabel;
155- private javax.swing.JPanel hostnamePanel;
156- private javax.swing.JPanel jPanel1;
157- private javax.swing.JPanel jPanel2;
158- private javax.swing.JScrollPane jScrollPane1;
159- private javax.swing.JTextArea jTextArea1;
160- private javax.swing.JLabel memBlockSizeLabel;
161- private javax.swing.JComboBox memboxcombo;
162- // End of variables declaration//GEN-END:variables
163- HostInfo hostinfo = null;
140+ // Variables declaration - do not modify//GEN-BEGIN:variables
141+ private javax.swing.JTextField AliasField;
142+ private javax.swing.JLabel AliasLabel;
143+ private javax.swing.JPanel AliasPanel;
144+ private javax.swing.JPanel DescriptionPanel;
145+ private javax.swing.JLabel HostNameLabel;
146+ private javax.swing.JLabel Hostname;
147+ private javax.swing.JPanel MemoryPanel;
148+ private javax.swing.JButton OkButton;
149+ private javax.swing.JLabel descriptionLabel;
150+ private javax.swing.JPanel hostnamePanel;
151+ private javax.swing.JPanel jPanel1;
152+ private javax.swing.JPanel jPanel2;
153+ private javax.swing.JScrollPane jScrollPane1;
154+ private javax.swing.JTextArea jTextArea1;
155+ private javax.swing.JLabel memBlockSizeLabel;
156+ private javax.swing.JComboBox memboxcombo;
157+ // End of variables declaration//GEN-END:variables
158+ HostInfo hostinfo = null;
164159 }
--- trunk/src/net/atomique/ksar/UI/SplashPicture.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/SplashPicture.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.UI;
62
73 import java.awt.Graphics;
@@ -18,15 +14,16 @@
1814 public static final long serialVersionUID = 501L;
1915 Image img = null;
2016
21- public SplashPicture() {
17+ public SplashPicture(){
2218 img = new ImageIcon(this.getClass().getResource("/logo.jpg")).getImage();
2319 repaint();
2420 }
2521
26- public void paintComponent(Graphics g) {
22+ @Override
23+ public void paintComponent(Graphics g){
2724 super.paintComponent(g);
2825
29- if (img == null) {
26+ if(img == null){
3027 return;
3128 }
3229
@@ -34,9 +31,9 @@
3431 int h = img.getHeight(this);
3532 boolean zoom = ((w > getWidth()) || (h > getHeight()));
3633
37- if (zoom) {
34+ if(zoom){
3835 g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
39- } else {
36+ }else{
4037 g.drawImage(img, (getWidth() - w) / 2, (getHeight() - h) / 2, this);
4138 }
4239 }
--- trunk/src/net/atomique/ksar/UI/SortedTreeNode.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/SortedTreeNode.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar.UI;
72
83 import java.util.Collections;
@@ -17,40 +12,42 @@
1712
1813 public static final long serialVersionUID = 15071L;
1914
20- public SortedTreeNode(String name) {
15+ private int leaf_num=0;
16+
17+ public SortedTreeNode(String name){
2118 super(name);
2219 }
2320
24- public SortedTreeNode(TreeNodeInfo tmp) {
21+ public SortedTreeNode(TreeNodeInfo tmp){
2522 super(tmp);
2623 }
2724
28- public SortedTreeNode(ParentNodeInfo tmp) {
25+ public SortedTreeNode(ParentNodeInfo tmp){
2926 super(tmp);
3027 }
3128 /*
32- public SortedTreeNode (GraphDescription graphdesc) {
29+ public SortedTreeNode (GraphDescription graphdesc){
3330 super(graphdesc);
3431 }
3532 */
3633
37- public void count_graph(SortedTreeNode node) {
34+ public void count_graph(SortedTreeNode node){
3835 int num = node.getChildCount();
3936
40- if (num > 0) {
41- for (int i = 0; i < num; i++) {
37+ if(num > 0){
38+ for(int i = 0; i < num; i++){
4239 SortedTreeNode l = (SortedTreeNode) node.getChildAt(i);
4340 count_graph(l);
4441 }
45- } else {
42+ }else{
4643 Object obj1 = node.getUserObject();
47- if (obj1 instanceof TreeNodeInfo) {
44+ if(obj1 instanceof TreeNodeInfo){
4845 leaf_num++;
4946 }
5047 }
5148 }
5249
53- public int LeafCount() {
50+ public int LeafCount(){
5451 leaf_num=0;
5552 count_graph(this);
5653 return leaf_num;
@@ -57,15 +54,13 @@
5754 }
5855
5956 @Override
60- public void insert(final MutableTreeNode newChild, final int childIndex) {
57+ public void insert(final MutableTreeNode newChild, final int childIndex){
6158 super.insert(newChild, childIndex);
6259 Collections.sort(this.children);
6360 }
6461
6562 @Override
66- public int compareTo(final Object o) {
63+ public int compareTo(final Object o){
6764 return this.toString().compareToIgnoreCase(o.toString());
6865 }
69-
70- private int leaf_num=0;
7166 }
--- trunk/src/net/atomique/ksar/UI/SplashScreen.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/SplashScreen.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar.UI;
62
73 import java.awt.BorderLayout;
@@ -24,7 +20,7 @@
2420
2521 private static final long serialVersionUID = 8L;
2622
27- public SplashScreen( Frame f, int waitTime) {
23+ public SplashScreen( Frame f, int waitTime){
2824 super(f);
2925 JPanel p = new JPanel();
3026 p.setLayout(new BorderLayout());
@@ -36,27 +32,27 @@
3632 setVisible(true);
3733 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
3834 setLocation(screenSize.width / 2 - (450 / 2), screenSize.height / 2 - (300 / 2));
39- addMouseListener(new MouseAdapter() {
40- public void mousePressed(MouseEvent e) {
35+ addMouseListener(new MouseAdapter(){
36+ public void mousePressed(MouseEvent e){
4137 setVisible(false);
4238 dispose();
4339 }
4440 });
4541 final int pause = waitTime;
46- final Runnable closerRunner = new Runnable() {
42+ final Runnable closerRunner = new Runnable(){
4743
48- public void run() {
44+ public void run(){
4945 setVisible(false);
5046 dispose();
5147 }
5248 };
53- Runnable waitRunner = new Runnable() {
49+ Runnable waitRunner = new Runnable(){
5450
55- public void run() {
56- try {
51+ public void run(){
52+ try{
5753 Thread.sleep(pause);
5854 SwingUtilities.invokeAndWait(closerRunner);
59- } catch (Exception e) {
55+ }catch(Exception e){
6056 e.printStackTrace();
6157 }
6258 }
--- trunk/src/net/atomique/ksar/UI/GraphView.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/GraphView.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * GraphView.java
83 *
94 * Created on 12 août 2010, 11:26:02
@@ -27,188 +22,188 @@
2722 */
2823 public class GraphView extends javax.swing.JPanel {
2924
30- /** Creates new form GraphView */
31- public GraphView() {
32- initComponents();
33- }
25+ /** Creates new form GraphView */
26+ public GraphView(){
27+ initComponents();
28+ }
3429
3530
36- public void setGraph(Graph graph) {
37- this.thegraph = graph;
38- if ( mychartpanel != null) {
39- graphPanel.remove(mychartpanel);
40- }
41- mychartpanel = graph.get_ChartPanel();
42- graphPanel.add(mychartpanel);
43- this.validate();
44- }
31+ public void setGraph(Graph graph){
32+ this.thegraph = graph;
33+ if( mychartpanel != null){
34+ graphPanel.remove(mychartpanel);
35+ }
36+ mychartpanel = graph.get_ChartPanel();
37+ graphPanel.add(mychartpanel);
38+ this.validate();
39+ }
4540
46- /** This method is called from within the constructor to
47- * initialize the form.
48- * WARNING: Do NOT modify this code. The content of this method is
49- * always regenerated by the Form Editor.
50- */
51- @SuppressWarnings("unchecked")
52- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
53- private void initComponents() {
41+ /** This method is called from within the constructor to
42+ * initialize the form.
43+ * WARNING: Do NOT modify this code. The content of this method is
44+ * always regenerated by the Form Editor.
45+ */
46+ @SuppressWarnings("unchecked")
47+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
48+ private void initComponents(){
5449
55- graphPanel = new javax.swing.JPanel();
56- buttonPanel = new javax.swing.JPanel();
57- csvButton = new javax.swing.JButton();
58- jpgBuitton = new javax.swing.JButton();
59- pngButton = new javax.swing.JButton();
60- ctrlcButton = new javax.swing.JButton();
61- printButton = new javax.swing.JButton();
50+ graphPanel = new javax.swing.JPanel();
51+ buttonPanel = new javax.swing.JPanel();
52+ csvButton = new javax.swing.JButton();
53+ jpgBuitton = new javax.swing.JButton();
54+ pngButton = new javax.swing.JButton();
55+ ctrlcButton = new javax.swing.JButton();
56+ printButton = new javax.swing.JButton();
6257
63- setLayout(new java.awt.BorderLayout());
58+ setLayout(new java.awt.BorderLayout());
6459
65- graphPanel.setLayout(new java.awt.BorderLayout());
66- add(graphPanel, java.awt.BorderLayout.CENTER);
60+ graphPanel.setLayout(new java.awt.BorderLayout());
61+ add(graphPanel, java.awt.BorderLayout.CENTER);
6762
68- csvButton.setText("export CSV");
69- csvButton.addActionListener(new java.awt.event.ActionListener() {
70- public void actionPerformed(java.awt.event.ActionEvent evt) {
71- csvButtonActionPerformed(evt);
72- }
73- });
74- buttonPanel.add(csvButton);
63+ csvButton.setText("export CSV");
64+ csvButton.addActionListener(new java.awt.event.ActionListener(){
65+ public void actionPerformed(java.awt.event.ActionEvent evt){
66+ csvButtonActionPerformed(evt);
67+ }
68+ });
69+ buttonPanel.add(csvButton);
7570
76- jpgBuitton.setText("export JPG");
77- jpgBuitton.addActionListener(new java.awt.event.ActionListener() {
78- public void actionPerformed(java.awt.event.ActionEvent evt) {
79- jpgBuittonActionPerformed(evt);
80- }
81- });
82- buttonPanel.add(jpgBuitton);
71+ jpgBuitton.setText("export JPG");
72+ jpgBuitton.addActionListener(new java.awt.event.ActionListener(){
73+ public void actionPerformed(java.awt.event.ActionEvent evt){
74+ jpgBuittonActionPerformed(evt);
75+ }
76+ });
77+ buttonPanel.add(jpgBuitton);
8378
84- pngButton.setText("Export PNG");
85- pngButton.addActionListener(new java.awt.event.ActionListener() {
86- public void actionPerformed(java.awt.event.ActionEvent evt) {
87- pngButtonActionPerformed(evt);
88- }
89- });
90- buttonPanel.add(pngButton);
79+ pngButton.setText("Export PNG");
80+ pngButton.addActionListener(new java.awt.event.ActionListener(){
81+ public void actionPerformed(java.awt.event.ActionEvent evt){
82+ pngButtonActionPerformed(evt);
83+ }
84+ });
85+ buttonPanel.add(pngButton);
9186
92- ctrlcButton.setText("Copy");
93- ctrlcButton.addActionListener(new java.awt.event.ActionListener() {
94- public void actionPerformed(java.awt.event.ActionEvent evt) {
95- ctrlcButtonActionPerformed(evt);
96- }
97- });
98- buttonPanel.add(ctrlcButton);
87+ ctrlcButton.setText("Copy");
88+ ctrlcButton.addActionListener(new java.awt.event.ActionListener(){
89+ public void actionPerformed(java.awt.event.ActionEvent evt){
90+ ctrlcButtonActionPerformed(evt);
91+ }
92+ });
93+ buttonPanel.add(ctrlcButton);
9994
100- printButton.setText("Print");
101- printButton.addActionListener(new java.awt.event.ActionListener() {
102- public void actionPerformed(java.awt.event.ActionEvent evt) {
103- printButtonActionPerformed(evt);
104- }
105- });
106- buttonPanel.add(printButton);
95+ printButton.setText("Print");
96+ printButton.addActionListener(new java.awt.event.ActionListener(){
97+ public void actionPerformed(java.awt.event.ActionEvent evt){
98+ printButtonActionPerformed(evt);
99+ }
100+ });
101+ buttonPanel.add(printButton);
107102
108- add(buttonPanel, java.awt.BorderLayout.SOUTH);
109- }// </editor-fold>//GEN-END:initComponents
103+ add(buttonPanel, java.awt.BorderLayout.SOUTH);
104+ }// </editor-fold>//GEN-END:initComponents
110105
111- private void csvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_csvButtonActionPerformed
112- String filename = null;
113- String buffer = null;
114-
115- filename = askSaveFilename("Export CSV", Config.getLastExportDirectory());
106+ private void csvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_csvButtonActionPerformed
107+ String filename = null;
108+ String buffer = null;
109+
110+ filename = askSaveFilename("Export CSV", Config.getLastExportDirectory());
116111
117- if (filename == null) {
118- return;
119- }
120- Config.setLastExportDirectory(filename);
121- if (!Config.getLastExportDirectory().isDirectory()) {
122- Config.setLastExportDirectory(Config.getLastExportDirectory().getParentFile());
123- Config.save();
124- }
112+ if(filename == null){
113+ return;
114+ }
115+ Config.setLastExportDirectory(filename);
116+ if(!Config.getLastExportDirectory().isDirectory()){
117+ Config.setLastExportDirectory(Config.getLastExportDirectory().getParentFile());
118+ Config.save();
119+ }
125120
126- buffer = thegraph.make_csv();
121+ buffer = thegraph.make_csv();
127122
128- if ( GlobalOptions.isDodebug() ) {
129- System.out.println(buffer);
130- }
131- BufferedWriter out = null;
132- try {
133- out = new BufferedWriter(new FileWriter(filename));
134- } catch (IOException e) {
135- out = null;
136- }
137- if ( out == null ) {
138- return;
139- }
140- try {
141- out.write(buffer);
142- out.flush();
143- out.close();
144- } catch (IOException e) {
145-
146- }
147-
123+ if( GlobalOptions.isDodebug() ){
124+ System.out.println(buffer);
125+ }
126+ BufferedWriter out = null;
127+ try{
128+ out = new BufferedWriter(new FileWriter(filename));
129+ }catch(IOException e){
130+ out = null;
131+ }
132+ if( out == null ){
133+ return;
134+ }
135+ try{
136+ out.write(buffer);
137+ out.flush();
138+ out.close();
139+ }catch(IOException e){
140+
141+ }
142+
148143
149- }//GEN-LAST:event_csvButtonActionPerformed
144+ }//GEN-LAST:event_csvButtonActionPerformed
150145
151- private void jpgBuittonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpgBuittonActionPerformed
152- String filename = askSaveFilename("Export JPG", Config.getLastExportDirectory());
153- if ( filename == null ) {
154- return;
155- }
156- thegraph.saveJPG(null, null, filename, Config.getImageWidth(), Config.getImageHeight());
157- }//GEN-LAST:event_jpgBuittonActionPerformed
146+ private void jpgBuittonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpgBuittonActionPerformed
147+ String filename = askSaveFilename("Export JPG", Config.getLastExportDirectory());
148+ if( filename == null ){
149+ return;
150+ }
151+ thegraph.saveJPG(null, null, filename, Config.getImageWidth(), Config.getImageHeight());
152+ }//GEN-LAST:event_jpgBuittonActionPerformed
158153
159- private void ctrlcButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ctrlcButtonActionPerformed
160- mychartpanel.doCopy();
161- }//GEN-LAST:event_ctrlcButtonActionPerformed
154+ private void ctrlcButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ctrlcButtonActionPerformed
155+ mychartpanel.doCopy();
156+ }//GEN-LAST:event_ctrlcButtonActionPerformed
162157
163- private void printButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printButtonActionPerformed
164- mychartpanel.createChartPrintJob();
165- }//GEN-LAST:event_printButtonActionPerformed
158+ private void printButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printButtonActionPerformed
159+ mychartpanel.createChartPrintJob();
160+ }//GEN-LAST:event_printButtonActionPerformed
166161
167- private void pngButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pngButtonActionPerformed
168- String filename = askSaveFilename("Export PNG", Config.getLastExportDirectory());
169- if ( filename == null ) {
170- return;
171- }
172- thegraph.savePNG(null, null, filename, Config.getImageWidth(), Config.getImageHeight());
173- }//GEN-LAST:event_pngButtonActionPerformed
162+ private void pngButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pngButtonActionPerformed
163+ String filename = askSaveFilename("Export PNG", Config.getLastExportDirectory());
164+ if( filename == null ){
165+ return;
166+ }
167+ thegraph.savePNG(null, null, filename, Config.getImageWidth(), Config.getImageHeight());
168+ }//GEN-LAST:event_pngButtonActionPerformed
174169
175170
176-
177- private String askSaveFilename(String title, File chdirto) {
178- String filename = null;
179- JFileChooser chooser = new JFileChooser();
180- chooser.setDialogTitle(title);
181- if (chdirto != null) {
182- chooser.setCurrentDirectory(chdirto);
183- }
184- int returnVal = chooser.showSaveDialog(GlobalOptions.getUI());
185- if (returnVal == JFileChooser.APPROVE_OPTION) {
186- filename = chooser.getSelectedFile().getAbsolutePath();
187- }
171+
172+ private String askSaveFilename(String title, File chdirto){
173+ String filename = null;
174+ JFileChooser chooser = new JFileChooser();
175+ chooser.setDialogTitle(title);
176+ if(chdirto != null){
177+ chooser.setCurrentDirectory(chdirto);
178+ }
179+ int returnVal = chooser.showSaveDialog(GlobalOptions.getUI());
180+ if(returnVal == JFileChooser.APPROVE_OPTION){
181+ filename = chooser.getSelectedFile().getAbsolutePath();
182+ }
188183
189- if (filename == null) {
190- return null;
191- }
184+ if(filename == null){
185+ return null;
186+ }
192187
193- if (new File(filename).exists()) {
194- String[] choix = {"Yes", "No"};
195- int resultat = JOptionPane.showOptionDialog(null, "Overwrite " + filename + " ?", "File Exist", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, choix, choix[1]);
196- if (resultat != 0) {
197- return null;
198- }
199- }
200- return filename;
201- }
202-
203- // Variables declaration - do not modify//GEN-BEGIN:variables
204- private javax.swing.JPanel buttonPanel;
205- private javax.swing.JButton csvButton;
206- private javax.swing.JButton ctrlcButton;
207- private javax.swing.JPanel graphPanel;
208- private javax.swing.JButton jpgBuitton;
209- private javax.swing.JButton pngButton;
210- private javax.swing.JButton printButton;
211- // End of variables declaration//GEN-END:variables
212- private Graph thegraph = null;
213- private ChartPanel mychartpanel = null;
188+ if(new File(filename).exists()){
189+ String[] choix = {"Yes", "No"};
190+ int resultat = JOptionPane.showOptionDialog(null, "Overwrite " + filename + " ?", "File Exist", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, choix, choix[1]);
191+ if(resultat != 0){
192+ return null;
193+ }
194+ }
195+ return filename;
196+ }
197+
198+ // Variables declaration - do not modify//GEN-BEGIN:variables
199+ private javax.swing.JPanel buttonPanel;
200+ private javax.swing.JButton csvButton;
201+ private javax.swing.JButton ctrlcButton;
202+ private javax.swing.JPanel graphPanel;
203+ private javax.swing.JButton jpgBuitton;
204+ private javax.swing.JButton pngButton;
205+ private javax.swing.JButton printButton;
206+ // End of variables declaration//GEN-END:variables
207+ private Graph thegraph = null;
208+ private ChartPanel mychartpanel = null;
214209 }
--- trunk/src/net/atomique/ksar/UI/Preferences.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/Preferences.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * Preferences.java
83 *
94 * Created on 30 juil. 2010, 13:55:43
@@ -25,8 +20,54 @@
2520 */
2621 public class Preferences extends javax.swing.JDialog {
2722
28- /** Creates new form Preferences */
29- public Preferences(java.awt.Frame parent) {
23+ // Variables declaration - do not modify//GEN-BEGIN:variables
24+ private javax.swing.JButton CancelButton;
25+ private javax.swing.JButton OkButton;
26+ private javax.swing.JComboBox jComboBox1;
27+ private javax.swing.JComboBox jComboBox2;
28+ private javax.swing.JLabel jLabel1;
29+ private javax.swing.JLabel jLabel3;
30+ private javax.swing.JLabel jLabel4;
31+ private javax.swing.JLabel jLabel5;
32+ private javax.swing.JLabel jLabel6;
33+ private javax.swing.JLabel jLabel7;
34+ private javax.swing.JLabel jLabel8;
35+ private javax.swing.JPanel jPanel1;
36+ private javax.swing.JPanel jPanel10;
37+ private javax.swing.JPanel jPanel11;
38+ private javax.swing.JPanel jPanel2;
39+ private javax.swing.JPanel jPanel3;
40+ private javax.swing.JPanel jPanel4;
41+ private javax.swing.JPanel jPanel5;
42+ private javax.swing.JPanel jPanel7;
43+ private javax.swing.JPanel jPanel8;
44+ private javax.swing.JPanel jPanel9;
45+ private javax.swing.JScrollPane jScrollPane1;
46+ private javax.swing.JSpinner jSpinner1;
47+ private javax.swing.JSpinner jSpinner2;
48+ private javax.swing.JComboBox linuxDateFormatComboBox;
49+ private javax.swing.JComboBox linuxTimeFormatComboBox;
50+ // End of variables declaration//GEN-END:variables
51+
52+ public static final String DEFAULT_DATE_FORMAT = "MM/dd/yy";
53+ public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
54+
55+ DefaultComboBoxModel ui_lanf_model = new DefaultComboBoxModel();
56+ DefaultComboBoxModel pageFormatComboBox = new DefaultComboBoxModel();
57+ DefaultComboBoxModel linuxDateFormatComboModel = new DefaultComboBoxModel();
58+ DefaultComboBoxModel linuxTimeFormatComboModel = new DefaultComboBoxModel();
59+ SpinnerNumberModel imageWidthSpinner = new javax.swing.SpinnerNumberModel(Config.getImageWidth(), Integer.valueOf(1), null, Integer.valueOf(1));
60+ SpinnerNumberModel imageHeightSpinner = new javax.swing.SpinnerNumberModel(Config.getImageHeight(), Integer.valueOf(1), null, Integer.valueOf(1));
61+
62+ public Preferences(){
63+
64+ }
65+
66+ /**
67+ * Creates new form Preferences
68+ * @param parent
69+ */
70+ public Preferences(java.awt.Frame parent){
3071 super(parent);
3172 initComponents();
3273 load_landf();
@@ -41,34 +82,37 @@
4182 setVisible(true);
4283 }
4384
44- private void load_landf() {
85+ private void load_landf(){
4586 UIManager.LookAndFeelInfo looks[] = UIManager.getInstalledLookAndFeels();
46- for (int i = 0, n = looks.length; i < n; i++) {
87+ for(int i = 0, n = looks.length; i < n; i++){
4788 String tmp = looks[i].getName();
48- UI_lanf_model.addElement(tmp);
49- if (Config.getLandf().equals(tmp)) {
89+ ui_lanf_model.addElement(tmp);
90+ if(Config.getLandf().equals(tmp)){
5091 jComboBox1.setSelectedItem(tmp);
5192 }
5293 }
5394 }
5495
55- private void load_linuxformat() {
56- LinuxFormatComboModel.addElement("Always ask");
57- LinuxFormatComboModel.addElement("MM/DD/YYYY 12:59:59 AM|PM");
58- LinuxFormatComboModel.addElement("MM/DD/YYYY 23:59:59");
59- LinuxFormatComboModel.addElement("DD/MM/YYYY 23:59:59");
60- LinuxFormatComboModel.addElement("YYYY-MM-DD 23:59:59");
61- jComboBox3.setSelectedItem(Config.getLinuxDateFormat());
96+ private void load_linuxformat(){
97+ linuxDateFormatComboModel.addElement(DEFAULT_DATE_FORMAT);
98+ linuxDateFormatComboModel.addElement("MM/dd/yyyy");
99+ linuxDateFormatComboModel.addElement("dd/MM/yyyy");
100+ linuxDateFormatComboModel.addElement("yyyy-MM-dd");
101+ linuxDateFormatComboBox.setSelectedItem(Config.getLinuxDateFormat());
102+
103+ linuxTimeFormatComboModel.addElement(DEFAULT_TIME_FORMAT);
104+ linuxTimeFormatComboModel.addElement("hh:mm:ss a");
105+ linuxTimeFormatComboBox.setSelectedItem(Config.getLinuxTimeFormat());
62106 }
63-
64- private void load_pageformat() {
65- PageFormatComboBox.addElement("A4");
66- PageFormatComboBox.addElement("LETTER");
67- PageFormatComboBox.addElement("LEGAL");
107+
108+ private void load_pageformat(){
109+ pageFormatComboBox.addElement("A4");
110+ pageFormatComboBox.addElement("LETTER");
111+ pageFormatComboBox.addElement("LEGAL");
68112 jComboBox2.setSelectedItem(Config.getPDFPageFormat());
69-
70113 }
71- /** This method is called from within the constructor to
114+
115+ /** This method is called from within the constructor to
72116 * initialize the form.
73117 * WARNING: Do NOT modify this code. The content of this method is
74118 * always regenerated by the Form Editor.
@@ -85,9 +129,10 @@
85129 jComboBox1 = new javax.swing.JComboBox();
86130 jPanel10 = new javax.swing.JPanel();
87131 jLabel7 = new javax.swing.JLabel();
88- jComboBox3 = new javax.swing.JComboBox();
89- jPanel6 = new javax.swing.JPanel();
90- jLabel2 = new javax.swing.JLabel();
132+ linuxDateFormatComboBox = new javax.swing.JComboBox();
133+ jPanel11 = new javax.swing.JPanel();
134+ jLabel8 = new javax.swing.JLabel();
135+ linuxTimeFormatComboBox = new javax.swing.JComboBox();
91136 jPanel8 = new javax.swing.JPanel();
92137 jLabel5 = new javax.swing.JLabel();
93138 jPanel7 = new javax.swing.JPanel();
@@ -105,7 +150,8 @@
105150
106151 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
107152
108- jPanel1.setPreferredSize(new java.awt.Dimension(430, 430));
153+ jPanel1.setMinimumSize(new java.awt.Dimension(200, 100));
154+ jPanel1.setPreferredSize(new java.awt.Dimension(500, 200));
109155 jPanel1.setLayout(new java.awt.BorderLayout());
110156
111157 jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.PAGE_AXIS));
@@ -115,7 +161,7 @@
115161 jLabel1.setText("Look and Feel: ");
116162 jPanel5.add(jLabel1);
117163
118- jComboBox1.setModel(UI_lanf_model);
164+ jComboBox1.setModel(ui_lanf_model);
119165 jComboBox1.addActionListener(new java.awt.event.ActionListener() {
120166 public void actionPerformed(java.awt.event.ActionEvent evt) {
121167 jComboBox1ActionPerformed(evt);
@@ -127,22 +173,39 @@
127173
128174 jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
129175
130- jLabel7.setLabelFor(jComboBox3);
131- jLabel7.setText("Linux Format:");
176+ jLabel7.setLabelFor(linuxDateFormatComboBox);
177+ jLabel7.setText("Linux Date Format:");
132178 jPanel10.add(jLabel7);
133179
134- jComboBox3.setModel(LinuxFormatComboModel);
135- jPanel10.add(jComboBox3);
180+ linuxDateFormatComboBox.setEditable(true);
181+ linuxDateFormatComboBox.setModel(linuxDateFormatComboModel);
182+ linuxDateFormatComboBox.addActionListener(new java.awt.event.ActionListener() {
183+ public void actionPerformed(java.awt.event.ActionEvent evt) {
184+ linuxDateFormatComboBoxActionPerformed(evt);
185+ }
186+ });
187+ jPanel10.add(linuxDateFormatComboBox);
188+ linuxDateFormatComboBox.getAccessibleContext().setAccessibleName("Linux Date Format:");
136189
137- jPanel4.add(jPanel10);
190+ jPanel11.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
138191
139- jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 2, 2));
192+ jLabel8.setLabelFor(linuxDateFormatComboBox);
193+ jLabel8.setText("Linux Time Format:");
194+ jPanel11.add(jLabel8);
140195
141- jLabel2.setText("Language: ");
142- jPanel6.add(jLabel2);
196+ linuxTimeFormatComboBox.setEditable(true);
197+ linuxTimeFormatComboBox.setModel(linuxTimeFormatComboModel);
198+ linuxTimeFormatComboBox.addActionListener(new java.awt.event.ActionListener() {
199+ public void actionPerformed(java.awt.event.ActionEvent evt) {
200+ linuxTimeFormatComboBoxActionPerformed(evt);
201+ }
202+ });
203+ jPanel11.add(linuxTimeFormatComboBox);
143204
144- jPanel4.add(jPanel6);
205+ jPanel10.add(jPanel11);
145206
207+ jPanel4.add(jPanel10);
208+
146209 jPanel8.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
147210
148211 jLabel5.setText("JPG/PNG");
@@ -176,7 +239,7 @@
176239 jLabel6.setText("PDF Page Format:");
177240 jPanel9.add(jLabel6);
178241
179- jComboBox2.setModel(PageFormatComboBox);
242+ jComboBox2.setModel(pageFormatComboBox);
180243 jComboBox2.setMinimumSize(new java.awt.Dimension(100, 27));
181244 jComboBox2.setPreferredSize(new java.awt.Dimension(100, 27));
182245 jPanel9.add(jComboBox2);
@@ -216,25 +279,21 @@
216279
217280 private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
218281 Object source = evt.getSource();
219- String lafClassName = null;
220- if (source == jComboBox1) {
282+ if(source == jComboBox1){
221283 JComboBox comboBox = (JComboBox) source;
222- lafClassName = (String) comboBox.getSelectedItem();
223- if (lafClassName != null) {
224- String finalLafClassName = lafClassName;
225- for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
226- if (lafClassName.equals(laf.getName())) {
227- try {
284+ String lafClassName = (String) comboBox.getSelectedItem();
285+ if(lafClassName != null){
286+ for(UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()){
287+ if(lafClassName.equals(laf.getName())){
288+ try{
228289 UIManager.setLookAndFeel(laf.getClassName());
229290 SwingUtilities.updateComponentTreeUI(GlobalOptions.getUI());
230- } catch (Exception e) {
291+ }catch(Exception e){
231292 }
232-
233293 }
234294 }
235295 }
236296 }
237-
238297 }//GEN-LAST:event_jComboBox1ActionPerformed
239298
240299 private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkButtonActionPerformed
@@ -242,7 +301,7 @@
242301 Config.setPDFPageFormat(jComboBox2.getSelectedItem().toString());
243302 Config.setImageHeight((Integer)jSpinner2.getModel().getValue());
244303 Config.setImageWidth((Integer)jSpinner1.getModel().getValue());
245- Config.setLinuxDateFormat(jComboBox3.getSelectedItem().toString());
304+ Config.setLinuxDateTimeFormat(linuxDateFormatComboBox.getSelectedItem().toString(), linuxTimeFormatComboBox.getSelectedItem().toString());
246305 Config.save();
247306 dispose();
248307 }//GEN-LAST:event_OkButtonActionPerformed
@@ -251,36 +310,7 @@
251310 dispose();
252311 }//GEN-LAST:event_CancelButtonActionPerformed
253312
254- // Variables declaration - do not modify//GEN-BEGIN:variables
255- private javax.swing.JButton CancelButton;
256- private javax.swing.JButton OkButton;
257- private javax.swing.JComboBox jComboBox1;
258- private javax.swing.JComboBox jComboBox2;
259- private javax.swing.JComboBox jComboBox3;
260- private javax.swing.JLabel jLabel1;
261- private javax.swing.JLabel jLabel2;
262- private javax.swing.JLabel jLabel3;
263- private javax.swing.JLabel jLabel4;
264- private javax.swing.JLabel jLabel5;
265- private javax.swing.JLabel jLabel6;
266- private javax.swing.JLabel jLabel7;
267- private javax.swing.JPanel jPanel1;
268- private javax.swing.JPanel jPanel10;
269- private javax.swing.JPanel jPanel2;
270- private javax.swing.JPanel jPanel3;
271- private javax.swing.JPanel jPanel4;
272- private javax.swing.JPanel jPanel5;
273- private javax.swing.JPanel jPanel6;
274- private javax.swing.JPanel jPanel7;
275- private javax.swing.JPanel jPanel8;
276- private javax.swing.JPanel jPanel9;
277- private javax.swing.JScrollPane jScrollPane1;
278- private javax.swing.JSpinner jSpinner1;
279- private javax.swing.JSpinner jSpinner2;
280- // End of variables declaration//GEN-END:variables
281- DefaultComboBoxModel UI_lanf_model = new DefaultComboBoxModel();
282- DefaultComboBoxModel PageFormatComboBox = new DefaultComboBoxModel();
283- DefaultComboBoxModel LinuxFormatComboModel = new DefaultComboBoxModel();
284- SpinnerNumberModel imageWidthSpinner = new javax.swing.SpinnerNumberModel(Config.getImageWidth(), Integer.valueOf(1), null, Integer.valueOf(1));
285- SpinnerNumberModel imageHeightSpinner = new javax.swing.SpinnerNumberModel(Config.getImageHeight(), Integer.valueOf(1), null, Integer.valueOf(1));
313+ private void linuxDateFormatComboBoxActionPerformed(java.awt.event.ActionEvent evt){}
314+ private void linuxTimeFormatComboBoxActionPerformed(java.awt.event.ActionEvent evt){}
315+
286316 }
--- trunk/src/net/atomique/ksar/UI/DataView.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/DataView.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * DataView.java
83 *
94 * Created on 30 juil. 2010, 15:38:01
@@ -37,15 +32,18 @@
3732 private boolean has_fresh_data = false;
3833 private KSar mysar = null;
3934 private JPanel current_panel = null;
40- private GraphView mygraphview = new GraphView();
35+ private final GraphView mygraphview = new GraphView();
4136 private JPanel askparentPanel = null;
42- private int total_graph=0;
37+ private final int total_graph=0;
4338
44- /** Creates new form DataView */
45- public DataView(KSar sar) {
39+ /**
40+ * Creates new form DataView
41+ * @param sar
42+ */
43+ public DataView(KSar sar){
4644 initComponents();
4745 mysar = sar;
48- jTree1.setModel(new DefaultTreeModel(mysar.graphtree));
46+ sarTree.setModel(new DefaultTreeModel(mysar.getGraphTree()));
4947 }
5048
5149 /** This method is called from within the constructor to
@@ -54,171 +52,169 @@
5452 * always regenerated by the Form Editor.
5553 */
5654 @SuppressWarnings("unchecked")
57- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
58- private void initComponents() {
55+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
56+ private void initComponents() {
5957
60- jSeparator1 = new javax.swing.JSeparator();
61- jPanel1 = new javax.swing.JPanel();
62- jSplitPane1 = new javax.swing.JSplitPane();
63- jPanel2 = new javax.swing.JPanel();
64- jScrollPane1 = new javax.swing.JScrollPane();
65- jTree1 = new javax.swing.JTree();
66- jButton1 = new javax.swing.JButton();
67- displayPanel = new javax.swing.JPanel();
68- jMenuBar1 = new javax.swing.JMenuBar();
69- dataMenu = new javax.swing.JMenu();
70- LoadFile = new javax.swing.JMenuItem();
71- jSeparator3 = new javax.swing.JPopupMenu.Separator();
72- LoadCommand = new javax.swing.JMenuItem();
73- jSeparator2 = new javax.swing.JPopupMenu.Separator();
74- LoadSSH = new javax.swing.JMenuItem();
75- updateSSHMenuItem = new javax.swing.JMenuItem();
76- GraphMenu = new javax.swing.JMenu();
77- addgraphMenu = new javax.swing.JMenuItem();
78- exportMenu = new javax.swing.JMenu();
79- PDFMenu = new javax.swing.JMenuItem();
80- CSVMenu = new javax.swing.JMenuItem();
58+ jSeparator1 = new javax.swing.JSeparator();
59+ jPanel1 = new javax.swing.JPanel();
60+ jSplitPane1 = new javax.swing.JSplitPane();
61+ jPanel2 = new javax.swing.JPanel();
62+ jScrollPane1 = new javax.swing.JScrollPane();
63+ sarTree = new javax.swing.JTree();
64+ jButton1 = new javax.swing.JButton();
65+ displayPanel = new javax.swing.JPanel();
66+ jMenuBar1 = new javax.swing.JMenuBar();
67+ dataMenu = new javax.swing.JMenu();
68+ LoadFile = new javax.swing.JMenuItem();
69+ LoadCommand = new javax.swing.JMenuItem();
70+ LoadSSH = new javax.swing.JMenuItem();
71+ jSeparator2 = new javax.swing.JPopupMenu.Separator();
72+ updateSSHMenuItem = new javax.swing.JMenuItem();
73+ GraphMenu = new javax.swing.JMenu();
74+ addgraphMenu = new javax.swing.JMenuItem();
75+ exportMenu = new javax.swing.JMenu();
76+ PDFMenu = new javax.swing.JMenuItem();
77+ CSVMenu = new javax.swing.JMenuItem();
8178
82- setClosable(true);
83- setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
84- setIconifiable(true);
85- setMaximizable(true);
86- setResizable(true);
87- try {
88- setSelected(true);
89- } catch (java.beans.PropertyVetoException e1) {
90- e1.printStackTrace(System.err);
91- }
92- setVisible(true);
93- addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
94- public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
95- }
96- public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
97- formInternalFrameClosing(evt);
98- }
99- public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
100- }
101- public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
102- }
103- public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
104- }
105- public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
106- }
107- public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
108- }
109- });
79+ setClosable(true);
80+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
81+ setIconifiable(true);
82+ setMaximizable(true);
83+ setResizable(true);
84+ try {
85+ setSelected(true);
86+ } catch (java.beans.PropertyVetoException e1) {
87+ e1.printStackTrace();
88+ }
89+ setVisible(true);
90+ addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
91+ public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
92+ }
93+ public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
94+ formInternalFrameClosing(evt);
95+ }
96+ public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
97+ }
98+ public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
99+ }
100+ public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
101+ }
102+ public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
103+ }
104+ public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
105+ }
106+ });
110107
111- jPanel1.setLayout(new java.awt.BorderLayout());
108+ jPanel1.setLayout(new java.awt.BorderLayout());
112109
113- jPanel2.setMinimumSize(new java.awt.Dimension(150, 46));
114- jPanel2.setLayout(new java.awt.BorderLayout());
110+ jPanel2.setMinimumSize(new java.awt.Dimension(150, 46));
111+ jPanel2.setLayout(new java.awt.BorderLayout());
115112
116- jTree1.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
117- public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
118- jTree1ValueChanged(evt);
119- }
120- });
121- jScrollPane1.setViewportView(jTree1);
113+ sarTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
114+ public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
115+ sarTreeValueChanged(evt);
116+ }
117+ });
118+ jScrollPane1.setViewportView(sarTree);
122119
123- jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
120+ jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
124121
125- jButton1.setEnabled(false);
126- jButton1.addActionListener(new java.awt.event.ActionListener() {
127- public void actionPerformed(java.awt.event.ActionEvent evt) {
128- jButton1ActionPerformed(evt);
129- }
130- });
131- jPanel2.add(jButton1, java.awt.BorderLayout.SOUTH);
122+ jButton1.setEnabled(false);
123+ jButton1.addActionListener(new java.awt.event.ActionListener() {
124+ public void actionPerformed(java.awt.event.ActionEvent evt) {
125+ jButton1ActionPerformed(evt);
126+ }
127+ });
128+ jPanel2.add(jButton1, java.awt.BorderLayout.SOUTH);
132129
133- jSplitPane1.setLeftComponent(jPanel2);
130+ jSplitPane1.setLeftComponent(jPanel2);
134131
135- displayPanel.setLayout(new java.awt.BorderLayout());
136- jSplitPane1.setRightComponent(displayPanel);
132+ displayPanel.setLayout(new java.awt.BorderLayout());
133+ jSplitPane1.setRightComponent(displayPanel);
137134
138- jPanel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);
135+ jPanel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);
139136
140- getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
137+ getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
141138
142- dataMenu.setText("Data");
139+ dataMenu.setText("Data");
143140
144- LoadFile.setText("Load from a file...");
145- LoadFile.addActionListener(new java.awt.event.ActionListener() {
146- public void actionPerformed(java.awt.event.ActionEvent evt) {
147- LoadFileActionPerformed(evt);
148- }
149- });
150- dataMenu.add(LoadFile);
151- dataMenu.add(jSeparator3);
141+ LoadFile.setText("Load from a file...");
142+ LoadFile.addActionListener(new java.awt.event.ActionListener() {
143+ public void actionPerformed(java.awt.event.ActionEvent evt) {
144+ LoadFileActionPerformed(evt);
145+ }
146+ });
147+ dataMenu.add(LoadFile);
152148
153- LoadCommand.setText("Load from a local Command...");
154- LoadCommand.addActionListener(new java.awt.event.ActionListener() {
155- public void actionPerformed(java.awt.event.ActionEvent evt) {
156- LoadCommandActionPerformed(evt);
157- }
158- });
159- dataMenu.add(LoadCommand);
160- dataMenu.add(jSeparator2);
149+ LoadCommand.setText("Load from a local Command...");
150+ LoadCommand.addActionListener(new java.awt.event.ActionListener() {
151+ public void actionPerformed(java.awt.event.ActionEvent evt) {
152+ LoadCommandActionPerformed(evt);
153+ }
154+ });
155+ dataMenu.add(LoadCommand);
161156
162- LoadSSH.setText("Load from a SSH Command...");
163- LoadSSH.addActionListener(new java.awt.event.ActionListener() {
164- public void actionPerformed(java.awt.event.ActionEvent evt) {
165- LoadSSHActionPerformed(evt);
166- }
167- });
168- dataMenu.add(LoadSSH);
157+ LoadSSH.setText("Load from a SSH Command...");
158+ LoadSSH.addActionListener(new java.awt.event.ActionListener() {
159+ public void actionPerformed(java.awt.event.ActionEvent evt) {
160+ LoadSSHActionPerformed(evt);
161+ }
162+ });
163+ dataMenu.add(LoadSSH);
164+ dataMenu.add(jSeparator2);
169165
170- updateSSHMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
171- updateSSHMenuItem.setText("Auto-update through SSH ...");
172- updateSSHMenuItem.setEnabled(false);
173- updateSSHMenuItem.setName(""); // NOI18N
174- updateSSHMenuItem.addActionListener(new java.awt.event.ActionListener() {
175- public void actionPerformed(java.awt.event.ActionEvent evt) {
176- updateSSHMenuItemActionPerformed(evt);
177- }
178- });
179- dataMenu.add(updateSSHMenuItem);
180- updateSSHMenuItem.getAccessibleContext().setAccessibleName("testMenuItem");
166+ updateSSHMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
167+ updateSSHMenuItem.setText("Auto-update ...");
168+ updateSSHMenuItem.setEnabled(false);
169+ updateSSHMenuItem.setName(""); // NOI18N
170+ updateSSHMenuItem.addActionListener(new java.awt.event.ActionListener() {
171+ public void actionPerformed(java.awt.event.ActionEvent evt) {
172+ updateSSHMenuItemActionPerformed(evt);
173+ }
174+ });
175+ dataMenu.add(updateSSHMenuItem);
176+ updateSSHMenuItem.getAccessibleContext().setAccessibleName("testMenuItem");
181177
182- jMenuBar1.add(dataMenu);
178+ jMenuBar1.add(dataMenu);
183179
184- GraphMenu.setText("Graph");
185- GraphMenu.setEnabled(false);
180+ GraphMenu.setText("Graph");
181+ GraphMenu.setEnabled(false);
186182
187- addgraphMenu.setText("Add a Graph");
188- addgraphMenu.addActionListener(new java.awt.event.ActionListener() {
189- public void actionPerformed(java.awt.event.ActionEvent evt) {
190- addgraphMenuActionPerformed(evt);
191- }
192- });
193- GraphMenu.add(addgraphMenu);
183+ addgraphMenu.setText("Add a Graph");
184+ addgraphMenu.addActionListener(new java.awt.event.ActionListener() {
185+ public void actionPerformed(java.awt.event.ActionEvent evt) {
186+ addgraphMenuActionPerformed(evt);
187+ }
188+ });
189+ GraphMenu.add(addgraphMenu);
194190
195- jMenuBar1.add(GraphMenu);
191+ jMenuBar1.add(GraphMenu);
196192
197- exportMenu.setText("Export");
198- exportMenu.setEnabled(false);
193+ exportMenu.setText("Export");
194+ exportMenu.setEnabled(false);
199195
200- PDFMenu.setText("Export to PDF...");
201- PDFMenu.addActionListener(new java.awt.event.ActionListener() {
202- public void actionPerformed(java.awt.event.ActionEvent evt) {
203- PDFMenuActionPerformed(evt);
204- }
205- });
206- exportMenu.add(PDFMenu);
196+ PDFMenu.setText("Export to PDF...");
197+ PDFMenu.addActionListener(new java.awt.event.ActionListener() {
198+ public void actionPerformed(java.awt.event.ActionEvent evt) {
199+ PDFMenuActionPerformed(evt);
200+ }
201+ });
202+ exportMenu.add(PDFMenu);
207203
208- CSVMenu.setText("Export to CSV...");
209- CSVMenu.addActionListener(new java.awt.event.ActionListener() {
210- public void actionPerformed(java.awt.event.ActionEvent evt) {
211- CSVMenuActionPerformed(evt);
212- }
213- });
214- exportMenu.add(CSVMenu);
204+ CSVMenu.setText("Export to CSV...");
205+ CSVMenu.addActionListener(new java.awt.event.ActionListener() {
206+ public void actionPerformed(java.awt.event.ActionEvent evt) {
207+ CSVMenuActionPerformed(evt);
208+ }
209+ });
210+ exportMenu.add(CSVMenu);
215211
216- jMenuBar1.add(exportMenu);
212+ jMenuBar1.add(exportMenu);
217213
218- setJMenuBar(jMenuBar1);
214+ setJMenuBar(jMenuBar1);
219215
220- pack();
221- }// </editor-fold>//GEN-END:initComponents
216+ pack();
217+ }// </editor-fold>//GEN-END:initComponents
222218
223219 private void formInternalFrameClosing(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosing
224220 save_data();
@@ -225,18 +221,18 @@
225221 dispose();
226222 }//GEN-LAST:event_formInternalFrameClosing
227223
228- private void jTree1ValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTree1ValueChanged
224+ private void sarTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_sarTreeValueChanged
229225 TreePath treepath = evt.getPath();
230226 Object obj = treepath.getLastPathComponent();
231- if (obj != null) {
232- if ( GlobalOptions.isDodebug()) {
227+ if(obj != null){
228+ if( GlobalOptions.isDodebug()){
233229 System.out.print("mem:" + Runtime.getRuntime().totalMemory());
234230 System.out.println("free:" + Runtime.getRuntime().freeMemory());
235231 }
236232
237233 SortedTreeNode treenode = (SortedTreeNode) obj;
238- if ( treenode.getRoot() == treenode) {
239- if (current_panel != null) {
234+ if( treenode.getRoot() == treenode){
235+ if(current_panel != null){
240236 displayPanel.removeAll();
241237 current_panel=null;
242238 }
@@ -243,10 +239,10 @@
243239 displayPanel.repaint();
244240 }
245241 Object obj1 = treenode.getUserObject();
246- if (obj1 instanceof TreeNodeInfo) {
242+ if(obj1 instanceof TreeNodeInfo){
247243 TreeNodeInfo tmpnode = (TreeNodeInfo) obj1;
248244 Graph nodeobj = tmpnode.getNode_object();
249- if (current_panel != null) {
245+ if(current_panel != null){
250246 displayPanel.removeAll();
251247 current_panel=null;
252248 }
@@ -256,10 +252,10 @@
256252 displayPanel.validate();
257253 displayPanel.repaint();
258254 }
259- if (obj1 instanceof ParentNodeInfo) {
255+ if(obj1 instanceof ParentNodeInfo){
260256 ParentNodeInfo tmpnode = (ParentNodeInfo) obj1;
261257 List nodeobj = tmpnode.getNode_object();
262- if (current_panel != null) {
258+ if(current_panel != null){
263259 displayPanel.removeAll();
264260 current_panel=null;
265261 }
@@ -270,7 +266,7 @@
270266 }
271267 }
272268
273- }//GEN-LAST:event_jTree1ValueChanged
269+ }//GEN-LAST:event_sarTreeValueChanged
274270
275271 private void LoadCommandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoadCommandActionPerformed
276272 mysar.do_localcommand(null);
@@ -286,19 +282,19 @@
286282
287283 private void PDFMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PDFMenuActionPerformed
288284 GraphSelection tmp = new GraphSelection( GlobalOptions.getUI() ,true,this);
289- ask_treenode(mysar.graphtree,tmp);
285+ ask_treenode(mysar.getGraphTree(), tmp);
290286 tmp.setVisible(true);
291- if ( ! tmp.OkforExport ) {
287+ if( ! tmp.OkforExport ){
292288 tmp=null;
293289 return ;
294290 }
295291 tmp=null;
296292 String filename = askSaveFilename("Export PDF", Config.getLastExportDirectory());
297- if (filename == null) {
293+ if(filename == null){
298294 return;
299295 }
300296 Config.setLastExportDirectory(filename);
301- if (!Config.getLastExportDirectory().isDirectory()) {
297+ if(!Config.getLastExportDirectory().isDirectory()){
302298 Config.setLastExportDirectory(Config.getLastExportDirectory().getParentFile());
303299 Config.save();
304300 }
@@ -307,18 +303,18 @@
307303
308304 private void CSVMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CSVMenuActionPerformed
309305 GraphSelection tmp = new GraphSelection( GlobalOptions.getUI() ,true,this);
310- ask_treenode(mysar.graphtree,tmp);
306+ ask_treenode(mysar.getGraphTree(), tmp);
311307 tmp.setVisible(true);
312- if ( ! tmp.OkforExport ) {
308+ if( ! tmp.OkforExport ){
313309 return ;
314310
315311 }
316312 String filename = askSaveFilename("Export CSV", Config.getLastExportDirectory());
317- if (filename == null) {
313+ if(filename == null){
318314 return;
319315 }
320316 Config.setLastExportDirectory(filename);
321- if (!Config.getLastExportDirectory().isDirectory()) {
317+ if(!Config.getLastExportDirectory().isDirectory()){
322318 Config.setLastExportDirectory(Config.getLastExportDirectory().getParentFile());
323319 Config.save();
324320 }
@@ -338,26 +334,26 @@
338334 mysar.do_sshupdate();
339335 }//GEN-LAST:event_updateSSHMenuItemActionPerformed
340336
341- private String askSaveFilename(String title, File chdirto) {
337+ private String askSaveFilename(String title, File chdirto){
342338 String filename = null;
343339 JFileChooser chooser = new JFileChooser();
344340 chooser.setDialogTitle(title);
345- if (chdirto != null) {
341+ if(chdirto != null){
346342 chooser.setCurrentDirectory(chdirto);
347343 }
348344 int returnVal = chooser.showSaveDialog(GlobalOptions.getUI());
349- if (returnVal == JFileChooser.APPROVE_OPTION) {
345+ if(returnVal == JFileChooser.APPROVE_OPTION){
350346 filename = chooser.getSelectedFile().getAbsolutePath();
351347 }
352348
353- if (filename == null) {
349+ if(filename == null){
354350 return null;
355351 }
356352
357- if (new File(filename).exists()) {
353+ if(new File(filename).exists()){
358354 String[] choix = {"Yes", "No"};
359355 int resultat = JOptionPane.showOptionDialog(null, "Overwrite " + filename + " ?", "File Exist", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, choix, choix[1]);
360- if (resultat != 0) {
356+ if(resultat != 0){
361357 return null;
362358 }
363359 }
@@ -364,15 +360,13 @@
364360 return filename;
365361 }
366362
367- public void doExportPDF(String filename) {
368- int pages = 0;
369- pages= mysar.get_page_to_print();
363+ public void doExportPDF(String filename){
370364 JPanel panel0 = new JPanel();
371365 JPanel panel1 = new JPanel();
372366 JPanel panel2 = new JPanel();
373367 JProgressBar pbar = new JProgressBar();
374368 pbar.setMinimum(0);
375- pbar.setMaximum(pages);
369+ pbar.setMaximum(mysar.get_page_to_print());
376370 pbar.setStringPainted(true);
377371 JLabel mytitre = new JLabel("Exporting: ");
378372 panel1.add(mytitre);
@@ -393,7 +387,7 @@
393387
394388 }
395389
396- public void doExportCSV(String filename) {
390+ public void doExportCSV(String filename){
397391 int pages = 0;
398392 pages= mysar.myparser.getDateSamples().size();
399393 JPanel panel0 = new JPanel();
@@ -423,31 +417,31 @@
423417 }
424418
425419
426- public void ask_treenode(SortedTreeNode node,GraphSelection graphselection) {
420+ public void ask_treenode(SortedTreeNode node,GraphSelection graphselection){
427421 int num = node.getChildCount();
428422
429- if (num > 0) {
423+ if(num > 0){
430424 Object obj1 = node.getUserObject();
431- if (obj1 instanceof ParentNodeInfo) {
425+ if(obj1 instanceof ParentNodeInfo) {
432426 ParentNodeInfo tmpnode = (ParentNodeInfo) obj1;
433427 List nodeobj = tmpnode.getNode_object();
434428 askparentPanel= nodeobj.getprintform();
435429 graphselection.addPrintCheckBox(askparentPanel);
436430 }
437- for (int i = 0; i < num; i++) {
431+ for(int i = 0; i < num; i++){
438432 SortedTreeNode l = (SortedTreeNode) node.getChildAt(i);
439433 ask_treenode(l, graphselection);
440434 }
441435 askparentPanel=null;
442- } else {
436+ }else{
443437 Object obj1 = node.getUserObject();
444- if (obj1 instanceof TreeNodeInfo) {
438+ if(obj1 instanceof TreeNodeInfo){
445439 TreeNodeInfo tmpnode = (TreeNodeInfo) obj1;
446440 Graph nodeobj = tmpnode.getNode_object();
447441 JCheckBox tmp = nodeobj.getprintform();
448- if ( askparentPanel == null) {
442+ if( askparentPanel == null){
449443 graphselection.addPrintCheckBox(tmp);
450- } else {
444+ }else{
451445 askparentPanel.add(tmp);
452446 }
453447 }
@@ -454,77 +448,78 @@
454448 }
455449 }
456450
457- public void add2tree(SortedTreeNode parent, SortedTreeNode newNode) {
458- DefaultTreeModel model = (DefaultTreeModel) jTree1.getModel();
451+ public void add2tree(SortedTreeNode parent, SortedTreeNode newNode){
452+ DefaultTreeModel model = (DefaultTreeModel) sarTree.getModel();
459453 model.insertNodeInto(newNode, parent, parent.getChildCount());
460- /*if( newNode.getUserObject() instanceof TreeNodeInfo ) {
454+ /*if( newNode.getUserObject() instanceof TreeNodeInfo ){
461455 model.reload();
462456 }*/
463457 }
464458
465- public void treehome() {
466- jTree1.setSelectionRow(0);
467- jTree1.expandRow(0);
468- jTree1.repaint();
459+ public void treehome(){
460+ sarTree.setSelectionRow(0);
461+ for(int i=0; i<sarTree.getRowCount(); i++){
462+ sarTree.expandRow(i);
463+ }
464+ sarTree.repaint();
469465 }
470466
471- public void notifyrun(boolean t) {
467+ public void notifyrun(boolean t){
472468 exportMenu.setEnabled(!t);
473469 dataMenu.setEnabled(!t);
474- if ( t ) {
470+ if( t ){
475471 jButton1.setText("Stop");
476472 jButton1.setEnabled(true);
477- } else {
473+ }else{
478474 jButton1.setText("");
479475 jButton1.setEnabled(false);
480476 }
481477 }
482478
483- public void setHasData(boolean actif) {
484- has_fresh_data=actif;
479+ public void setHasData(boolean actif){
480+ has_fresh_data = actif;
485481 exportMenu.setEnabled(actif);
486- if (actif) {
487- LoadFile.setText("Append from a file...");
488- LoadCommand.setText("Append from a local Command...");
489- LoadSSH.setText("Append from a SSH Command...");
490- } else {
491- LoadFile.setText("Load from a file...");
492- LoadCommand.setText("Load from a local Command...");
493- LoadSSH.setText("Load from a SSH Command...");
482+ if(actif){
483+ LoadFile.setText("Append from a file ...");
484+ LoadCommand.setText("Append from a local command ...");
485+ LoadSSH.setText("Append from a SSH command ...");
486+ }else{
487+ LoadFile.setText("Load from a file ...");
488+ LoadCommand.setText("Load from a local command ...");
489+ LoadSSH.setText("Load from a SSH command ...");
494490 }
495491 }
496492
497- private void save_data() {
498- if (has_fresh_data) {
493+ private void save_data(){
494+ if(has_fresh_data){
499495 System.out.println("need backup");
500496 }
501497 }
502498
503- public void enableSSHUpdate(){
499+ public void enableAutoUpdate(){
504500 updateSSHMenuItem.setEnabled(true);
505501 }
506502
507- // Variables declaration - do not modify//GEN-BEGIN:variables
508- private javax.swing.JMenuItem CSVMenu;
509- private javax.swing.JMenu GraphMenu;
510- private javax.swing.JMenuItem LoadCommand;
511- private javax.swing.JMenuItem LoadFile;
512- private javax.swing.JMenuItem LoadSSH;
513- private javax.swing.JMenuItem PDFMenu;
514- private javax.swing.JMenuItem addgraphMenu;
515- private javax.swing.JMenu dataMenu;
516- private javax.swing.JPanel displayPanel;
517- private javax.swing.JMenu exportMenu;
518- private javax.swing.JButton jButton1;
519- private javax.swing.JMenuBar jMenuBar1;
520- private javax.swing.JPanel jPanel1;
521- private javax.swing.JPanel jPanel2;
522- private javax.swing.JScrollPane jScrollPane1;
523- private javax.swing.JSeparator jSeparator1;
524- private javax.swing.JPopupMenu.Separator jSeparator2;
525- private javax.swing.JPopupMenu.Separator jSeparator3;
526- private javax.swing.JSplitPane jSplitPane1;
527- private javax.swing.JTree jTree1;
528- private javax.swing.JMenuItem updateSSHMenuItem;
529- // End of variables declaration//GEN-END:variables
503+ // Variables declaration - do not modify//GEN-BEGIN:variables
504+ private javax.swing.JMenuItem CSVMenu;
505+ private javax.swing.JMenu GraphMenu;
506+ private javax.swing.JMenuItem LoadCommand;
507+ private javax.swing.JMenuItem LoadFile;
508+ private javax.swing.JMenuItem LoadSSH;
509+ private javax.swing.JMenuItem PDFMenu;
510+ private javax.swing.JMenuItem addgraphMenu;
511+ private javax.swing.JMenu dataMenu;
512+ private javax.swing.JPanel displayPanel;
513+ private javax.swing.JMenu exportMenu;
514+ private javax.swing.JButton jButton1;
515+ private javax.swing.JMenuBar jMenuBar1;
516+ private javax.swing.JPanel jPanel1;
517+ private javax.swing.JPanel jPanel2;
518+ private javax.swing.JScrollPane jScrollPane1;
519+ private javax.swing.JSeparator jSeparator1;
520+ private javax.swing.JPopupMenu.Separator jSeparator2;
521+ private javax.swing.JSplitPane jSplitPane1;
522+ private javax.swing.JTree sarTree;
523+ private javax.swing.JMenuItem updateSSHMenuItem;
524+ // End of variables declaration//GEN-END:variables
530525 }
--- trunk/src/net/atomique/ksar/UI/GraphSelection.java (revision 3)
+++ trunk/src/net/atomique/ksar/UI/GraphSelection.java (revision 4)
@@ -1,9 +1,4 @@
11 /*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
6-/*
72 * GraphSelection.java
83 *
94 * Created on 16 août 2010, 18:48:32
@@ -22,140 +17,140 @@
2217 */
2318 public class GraphSelection extends javax.swing.JDialog {
2419
25- /** Creates new form GraphSelection */
26- public GraphSelection(java.awt.Frame parent, boolean modal, DataView myview) {
27- super(parent, modal);
28- this.myview = myview;
29- initComponents();
30- setLocationRelativeTo(parent);
31- toFront();
32- }
20+ /** Creates new form GraphSelection */
21+ public GraphSelection(java.awt.Frame parent, boolean modal, DataView myview){
22+ super(parent, modal);
23+ this.myview = myview;
24+ initComponents();
25+ setLocationRelativeTo(parent);
26+ toFront();
27+ }
3328
34- /** This method is called from within the constructor to
35- * initialize the form.
36- * WARNING: Do NOT modify this code. The content of this method is
37- * always regenerated by the Form Editor.
38- */
39- @SuppressWarnings("unchecked")
40- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
41- private void initComponents() {
29+ /** This method is called from within the constructor to
30+ * initialize the form.
31+ * WARNING: Do NOT modify this code. The content of this method is
32+ * always regenerated by the Form Editor.
33+ */
34+ @SuppressWarnings("unchecked")
35+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
36+ private void initComponents(){
4237
43- jPanel1 = new javax.swing.JPanel();
44- jScrollPane1 = new javax.swing.JScrollPane();
45- jPanel3 = new javax.swing.JPanel();
46- jPanel2 = new javax.swing.JPanel();
47- selectallButton = new javax.swing.JButton();
48- unselectallButton = new javax.swing.JButton();
49- jSeparator2 = new javax.swing.JSeparator();
50- cancelButton = new javax.swing.JButton();
51- okButton = new javax.swing.JButton();
38+ jPanel1 = new javax.swing.JPanel();
39+ jScrollPane1 = new javax.swing.JScrollPane();
40+ jPanel3 = new javax.swing.JPanel();
41+ jPanel2 = new javax.swing.JPanel();
42+ selectallButton = new javax.swing.JButton();
43+ unselectallButton = new javax.swing.JButton();
44+ jSeparator2 = new javax.swing.JSeparator();
45+ cancelButton = new javax.swing.JButton();
46+ okButton = new javax.swing.JButton();
5247
53- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
48+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
5449
55- jPanel1.setLayout(new java.awt.BorderLayout());
50+ jPanel1.setLayout(new java.awt.BorderLayout());
5651
57- jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 400));
58- jScrollPane1.setRequestFocusEnabled(false);
52+ jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 400));
53+ jScrollPane1.setRequestFocusEnabled(false);
5954
60- jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.PAGE_AXIS));
61- jScrollPane1.setViewportView(jPanel3);
55+ jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.PAGE_AXIS));
56+ jScrollPane1.setViewportView(jPanel3);
6257
63- jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
58+ jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
6459
65- getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
60+ getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
6661
67- selectallButton.setText("Select All");
68- selectallButton.addActionListener(new java.awt.event.ActionListener() {
69- public void actionPerformed(java.awt.event.ActionEvent evt) {
70- selectallButtonActionPerformed(evt);
71- }
72- });
73- jPanel2.add(selectallButton);
62+ selectallButton.setText("Select All");
63+ selectallButton.addActionListener(new java.awt.event.ActionListener(){
64+ public void actionPerformed(java.awt.event.ActionEvent evt){
65+ selectallButtonActionPerformed(evt);
66+ }
67+ });
68+ jPanel2.add(selectallButton);
7469
75- unselectallButton.setText("Unselect All");
76- unselectallButton.addActionListener(new java.awt.event.ActionListener() {
77- public void actionPerformed(java.awt.event.ActionEvent evt) {
78- unselectallButtonActionPerformed(evt);
79- }
80- });
81- jPanel2.add(unselectallButton);
70+ unselectallButton.setText("Unselect All");
71+ unselectallButton.addActionListener(new java.awt.event.ActionListener(){
72+ public void actionPerformed(java.awt.event.ActionEvent evt){
73+ unselectallButtonActionPerformed(evt);
74+ }
75+ });
76+ jPanel2.add(unselectallButton);
8277
83- jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
84- jPanel2.add(jSeparator2);
78+ jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
79+ jPanel2.add(jSeparator2);
8580
86- cancelButton.setText("Cancel");
87- cancelButton.addActionListener(new java.awt.event.ActionListener() {
88- public void actionPerformed(java.awt.event.ActionEvent evt) {
89- cancelButtonActionPerformed(evt);
90- }
91- });
92- jPanel2.add(cancelButton);
81+ cancelButton.setText("Cancel");
82+ cancelButton.addActionListener(new java.awt.event.ActionListener(){
83+ public void actionPerformed(java.awt.event.ActionEvent evt){
84+ cancelButtonActionPerformed(evt);
85+ }
86+ });
87+ jPanel2.add(cancelButton);
9388
94- okButton.setText("Ok");
95- okButton.addActionListener(new java.awt.event.ActionListener() {
96- public void actionPerformed(java.awt.event.ActionEvent evt) {
97- okButtonActionPerformed(evt);
98- }
99- });
100- jPanel2.add(okButton);
89+ okButton.setText("Ok");
90+ okButton.addActionListener(new java.awt.event.ActionListener(){
91+ public void actionPerformed(java.awt.event.ActionEvent evt){
92+ okButtonActionPerformed(evt);
93+ }
94+ });
95+ jPanel2.add(okButton);
10196
102- getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
97+ getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
10398
104- pack();
105- }// </editor-fold>//GEN-END:initComponents
99+ pack();
100+ }// </editor-fold>//GEN-END:initComponents
106101
107- private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
108- this.dispose();
109- }//GEN-LAST:event_cancelButtonActionPerformed
102+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
103+ this.dispose();
104+ }//GEN-LAST:event_cancelButtonActionPerformed
110105
111- private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
112- this.dispose();
113- OkforExport=true;
114- }//GEN-LAST:event_okButtonActionPerformed
106+ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
107+ this.dispose();
108+ OkforExport=true;
109+ }//GEN-LAST:event_okButtonActionPerformed
115110
116- private void selectallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectallButtonActionPerformed
117- toggle_checkbox(jPanel3,true);
118- }//GEN-LAST:event_selectallButtonActionPerformed
111+ private void selectallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectallButtonActionPerformed
112+ toggle_checkbox(jPanel3,true);
113+ }//GEN-LAST:event_selectallButtonActionPerformed
119114
120- private void unselectallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unselectallButtonActionPerformed
121- toggle_checkbox(jPanel3,false);
122- }//GEN-LAST:event_unselectallButtonActionPerformed
115+ private void unselectallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unselectallButtonActionPerformed
116+ toggle_checkbox(jPanel3,false);
117+ }//GEN-LAST:event_unselectallButtonActionPerformed
123118
124- public void toggle_checkbox(JPanel panel, boolean checked) {
125- Component [] list = panel.getComponents();
126- for (int i= 0; i < list.length ; i++) {
127- Component tmp = (Component)list[i];
128- if ( tmp instanceof JPanel) {
129- JPanel obj = (JPanel) tmp;
130- toggle_checkbox(obj, checked);
131- }
132- if ( tmp instanceof JCheckBox) {
133- JCheckBox obj = (JCheckBox) tmp;
134- obj.setSelected(checked);
135- }
136- }
137- }
138-
139- public void addPrintCheckBox(JCheckBox tmp) {
140- jPanel3.add(tmp);
141- jPanel1.validate();
142- }
143- public void addPrintCheckBox(JPanel tmp) {
144- jPanel3.add(tmp);
145- jPanel1.validate();
146- }
119+ public void toggle_checkbox(JPanel panel, boolean checked){
120+ Component [] list = panel.getComponents();
121+ for(int i= 0; i < list.length ; i++){
122+ Component tmp = (Component)list[i];
123+ if( tmp instanceof JPanel){
124+ JPanel obj = (JPanel) tmp;
125+ toggle_checkbox(obj, checked);
126+ }
127+ if( tmp instanceof JCheckBox){
128+ JCheckBox obj = (JCheckBox) tmp;
129+ obj.setSelected(checked);
130+ }
131+ }
132+ }
133+
134+ public void addPrintCheckBox(JCheckBox tmp){
135+ jPanel3.add(tmp);
136+ jPanel1.validate();
137+ }
138+ public void addPrintCheckBox(JPanel tmp){
139+ jPanel3.add(tmp);
140+ jPanel1.validate();
141+ }
147142
148- // Variables declaration - do not modify//GEN-BEGIN:variables
149- private javax.swing.JButton cancelButton;
150- private javax.swing.JPanel jPanel1;
151- private javax.swing.JPanel jPanel2;
152- private javax.swing.JPanel jPanel3;
153- private javax.swing.JScrollPane jScrollPane1;
154- private javax.swing.JSeparator jSeparator2;
155- private javax.swing.JButton okButton;
156- private javax.swing.JButton selectallButton;
157- private javax.swing.JButton unselectallButton;
158- // End of variables declaration//GEN-END:variables
159- private DataView myview =null;
160- public boolean OkforExport = false;
143+ // Variables declaration - do not modify//GEN-BEGIN:variables
144+ private javax.swing.JButton cancelButton;
145+ private javax.swing.JPanel jPanel1;
146+ private javax.swing.JPanel jPanel2;
147+ private javax.swing.JPanel jPanel3;
148+ private javax.swing.JScrollPane jScrollPane1;
149+ private javax.swing.JSeparator jSeparator2;
150+ private javax.swing.JButton okButton;
151+ private javax.swing.JButton selectallButton;
152+ private javax.swing.JButton unselectallButton;
153+ // End of variables declaration//GEN-END:variables
154+ private DataView myview =null;
155+ public boolean OkforExport = false;
161156 }
--- trunk/src/net/atomique/ksar/OSParser.java (revision 3)
+++ trunk/src/net/atomique/ksar/OSParser.java (revision 4)
@@ -1,7 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
51 package net.atomique.ksar;
62
73 import java.util.HashMap;
@@ -12,153 +8,152 @@
128 *
139 * @author Max
1410 */
15-public abstract class OSParser extends AllParser {
11+public abstract class OSParser extends AllParser{
1612
17- public OSParser(){
18- }
13+ protected Map<String,Object> ListofGraph = new HashMap<>();
1914
20- public void init(KSar hissar, String header){
21- String [] s = header.split("\\s+");
22- mysar = hissar;
23- ParserName = s[0];
24- myosconfig = GlobalOptions.getOSinfo(s[0]);
25- parse_header(header);
26- }
27-
28- public OSParser(KSar hissar,String header) {
29- init(hissar, header);
30- }
15+ protected String lastStat = null;
16+ protected Object currentStatObj = null;
17+ //List graphlist = new ArrayList();
3118
32- public OSConfig get_OSConfig() {
33- return myosconfig;
34- }
19+ protected String ostype = null;
20+ protected String hostname = null;
21+ protected String osversion = null;
22+ protected String kernel = null;
23+ protected String cputype = null;
24+ protected String macaddress = null;
25+ protected String memory = null;
26+ protected String nbdisk = null;
27+ protected String nbcpu = null;
28+ protected String ent = null;
29+ protected String detect = null;
30+ protected String original_line = null;
31+ // for graph
3532
33+ public OSParser(){
34+ }
3635
37- public void setHostname(String s) {
38- Hostname = s;
39- }
36+ @Override
37+ public void init(KSar hissar, String header){
38+ String [] s = header.split("\\s+");
39+ mysar = hissar;
40+ parserName = s[0];
41+ osConfig = GlobalOptions.getOSinfo(s[0]);
42+ parse_header(header);
43+ }
44+ private void _init_(KSar hissar, String header){init(hissar, header);}
45+ public OSParser(KSar hissar,String header){
46+ _init_(hissar, header);
47+ }
4048
41- public void setOSversion(String s) {
42- OSversion = s;
43- }
49+ public OSConfig get_OSConfig(){
50+ return osConfig;
51+ }
4452
45- public void setKernel(String s) {
46- Kernel = s;
47- }
53+ public void setHostname(String s){
54+ hostname = s;
55+ }
4856
49- public void setCpuType(String s) {
50- CpuType = s;
51- }
57+ public void setOSversion(String s){
58+ osversion = s;
59+ }
5260
53-
61+ public void setKernel(String s){
62+ kernel = s;
63+ }
5464
55- public void setMacAddress(String s) {
56- MacAddress = s;
57- }
65+ public void setCpuType(String s){
66+ cputype = s;
67+ }
5868
59- public void setMemory(String s) {
60- Memory = s;
61- }
69+ public void setMacAddress(String s){
70+ macaddress = s;
71+ }
6272
63- public void setNBDisk(String s) {
64- NBDisk = s;
65- }
73+ public void setMemory(String s){
74+ memory = s;
75+ }
6676
67- public void setNBCpu(String s) {
68- NBCpu = s;
69- }
77+ public void setNBDisk(String s){
78+ nbdisk = s;
79+ }
7080
71- public void setENT(String s) {
72- ENT = s;
73- }
81+ public void setNBCpu(String s){
82+ nbcpu = s;
83+ }
7484
85+ public void setENT(String s){
86+ ent = s;
87+ }
88+
7589 @Override
76- public String getInfo() {
77- StringBuilder tmpstr = new StringBuilder();
78- tmpstr.append("OS Type: ").append(ostype);
79- if (OSversion != null) {
80- tmpstr.append("OS Version: ").append(OSversion).append("\n");
81- }
82- if (Kernel != null) {
83- tmpstr.append("Kernel Release: ").append(Kernel).append("\n");
84- }
85- if (CpuType != null) {
86- tmpstr.append("CPU Type: ").append(CpuType).append("\n");
87- }
88- if (Hostname != null) {
89- tmpstr.append("Hostname: ").append(Hostname).append("\n");
90- }
91- if (MacAddress != null) {
92- tmpstr.append("Mac Address: ").append(MacAddress).append("\n");
93- }
94- if (Memory != null) {
95- tmpstr.append("Memory: ").append(Memory).append("\n");
96- }
97- if (NBDisk != null) {
98- tmpstr.append("Number of disks: ").append(NBDisk).append("\n");
99- }
100- if (NBCpu != null) {
101- tmpstr.append("Number of CPU: ").append(NBCpu).append("\n");
102- }
103- if (ENT != null) {
104- tmpstr.append("Ent: ").append(ENT).append("\n");
105- }
106- if (sarStartDate != null) {
107- tmpstr.append("Start of SAR: ").append(sarStartDate).append("\n");
108- }
109- if (sarEndDate != null) {
110- tmpstr.append("End of SAR: ").append(sarEndDate).append("\n");
111- }
90+ public String getInfo(){
91+ StringBuilder tmpstr = new StringBuilder();
92+ tmpstr.append("OS Type: ").append(ostype);
93+ if(osversion != null){
94+ tmpstr.append("OS Version: ").append(osversion).append("\n");
95+ }
96+ if(kernel != null){
97+ tmpstr.append("Kernel Release: ").append(kernel).append("\n");
98+ }
99+ if(cputype != null){
100+ tmpstr.append("CPU Type: ").append(cputype).append("\n");
101+ }
102+ if(hostname != null){
103+ tmpstr.append("Hostname: ").append(hostname).append("\n");
104+ }
105+ if(macaddress != null){
106+ tmpstr.append("Mac Address: ").append(macaddress).append("\n");
107+ }
108+ if(memory != null){
109+ tmpstr.append("Memory: ").append(memory).append("\n");
110+ }
111+ if(nbdisk != null){
112+ tmpstr.append("Number of disks: ").append(nbdisk).append("\n");
113+ }
114+ if(nbcpu != null){
115+ tmpstr.append("Number of CPU: ").append(nbcpu).append("\n");
116+ }
117+ if(ent != null){
118+ tmpstr.append("Ent: ").append(ent).append("\n");
119+ }
120+ if(sarStartDate != null){
121+ tmpstr.append("Start of SAR: ").append(sarStartDate).append("\n");
122+ }
123+ if(sarEndDate != null){
124+ tmpstr.append("End of SAR: ").append(sarEndDate).append("\n");
125+ }
112126
113- tmpstr.append("\n");
127+ tmpstr.append("\n");
114128
115- return tmpstr.toString();
116- }
129+ return tmpstr.toString();
130+ }
117131
118- public String getOriginal_line() {
119- return original_line;
120- }
132+ public String getOriginal_line(){
133+ return original_line;
134+ }
121135
122- public void setOriginal_line(String original_line) {
123- this.original_line = original_line;
124- }
136+ public void setOriginal_line(String original_line){
137+ this.original_line = original_line;
138+ }
125139
126- public String gethostName() {
127- return Hostname;
128- }
140+ public String gethostName(){
141+ return hostname;
142+ }
129143
130- public String getOstype() {
131- return ostype;
132- }
144+ public String getOstype(){
145+ return ostype;
146+ }
133147
134- public void setOstype(String ostype) {
135- this.ostype = ostype;
136- }
148+ public void setOstype(String ostype){
149+ this.ostype = ostype;
150+ }
137151
138152 @Override
139- public void updateUITitle() {
140- if ( mysar.getDataView() != null) {
141- mysar.getDataView().setTitle(Hostname + " from "+ startofgraph + " to " + endofgraph);
142- }
143- }
153+ public void updateUITitle(){
154+ if( mysar.getDataView() != null){
155+ mysar.getDataView().setTitle(hostname + " from "+ startofgraph + " to " + endofgraph);
156+ }
157+ }
144158
145- protected Map<String,Object> ListofGraph = new HashMap<String, Object>();
146-
147- protected String lastStat = null;
148- protected Object currentStatObj = null;
149- //List graphlist = new ArrayList();
150-
151- protected String ostype = null;
152- protected String Hostname = null;
153- protected String OSversion = null;
154- protected String Kernel = null;
155- protected String CpuType = null;
156- protected String MacAddress = null;
157- protected String Memory = null;
158- protected String NBDisk = null;
159- protected String NBCpu = null;
160- protected String ENT = null;
161- protected String Detect = null;
162- protected String original_line=null;
163- // for graph
164159 }
--- trunk/src/net/atomique/ksar/VersionNumber.java (revision 3)
+++ trunk/src/net/atomique/ksar/VersionNumber.java (revision 4)
@@ -1,8 +1,3 @@
1-/*
2- * To change this template, choose Tools | Templates
3- * and open the template in the editor.
4- */
5-
61 package net.atomique.ksar;
72
83 import java.io.BufferedReader;
@@ -18,23 +13,23 @@
1813
1914 private static VersionNumber instance = new VersionNumber();
2015
21- public static VersionNumber getInstance() {
16+ public static VersionNumber getInstance(){
2217 return instance;
2318 }
2419
25- VersionNumber() {
20+ VersionNumber(){
2621 StringBuilder tmpstr =