Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #82

Merged
merged 6 commits into from
Apr 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/main/java/net/atomique/ksar/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@ private static void set_lookandfeel() {
}

public static void make_ui() {
SplashScreen mysplash = new SplashScreen(null, 3000);


SplashScreen mysplash = new SplashScreen(null, 1500);

set_lookandfeel();

while (mysplash.isVisible()) {
try {
Thread.sleep(500);
Thread.sleep(200);
} catch (InterruptedException ie) {
log.error("SplashScreen Exception",ie);
}
}


set_lookandfeel();
log.trace("MainScreen");
//set_lookandfeel();
javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {
Expand All @@ -65,11 +69,11 @@ public void run() {
public static void main(String[] args) {
int i = 0;
String arg;
/// load default

log.trace("main - Start");
log.trace("ksar Version : {}", VersionNumber.getVersionNumber());

/// load default - Mac OS X Application Properties
String mrjVersion = System.getProperty("mrj.version");
if (mrjVersion != null) {
System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/net/atomique/ksar/Parser/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class Linux extends OSParser {

public void parse_header(String s) {

LinuxDateFormat = Config.getLinuxDateFormat();
String[] columns = s.split("\\s+");

String tmpstr;
setOstype(columns[0]);
setKernel(columns[1]);
Expand All @@ -42,8 +42,9 @@ public void parse_header(String s) {

private void checkDateFormat() {

LinuxDateFormat = Config.getLinuxDateFormat();
if ("Always ask".equals(LinuxDateFormat)) {
askDateFormat("Provide date Format");
askDateFormat();
}

// day and year format specifiers must be lower case, month upper case
Expand All @@ -61,10 +62,12 @@ private void checkDateFormat() {

}

private void askDateFormat(String s) {
private void askDateFormat() {

log.debug("askDateFormat - provide date format");
if ( GlobalOptions.hasUI() ) {
LinuxDateFormat tmp = new LinuxDateFormat(GlobalOptions.getUI(),true);
tmp.setTitle(s);
tmp.setTitle("Provide date format");
if ( tmp.isOk()) {
LinuxDateFormat=tmp.getDateFormat();
if ( tmp.hasToRemenber() ) {
Expand Down Expand Up @@ -113,6 +116,7 @@ public int parse(String line, String[] columns) {
endofgraph = nowStat;
}
firstdatacolumn = timeColumn;

} catch (DateTimeParseException|IllegalArgumentException ex) {
log.error("unable to parse time {}" ,columns[0], ex);
return -1;
Expand Down
22 changes: 5 additions & 17 deletions src/main/java/net/atomique/ksar/UI/SplashScreen.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package net.atomique.ksar.UI;

import org.slf4j.Logger;
Expand All @@ -19,10 +15,6 @@
import javax.swing.JWindow;
import javax.swing.SwingUtilities;

/**
*
* @author Max
*/
public class SplashScreen extends JWindow {

private static final Logger log = LoggerFactory.getLogger(SplashScreen.class);
Expand Down Expand Up @@ -51,24 +43,20 @@ public void mousePressed(MouseEvent e) {
}
});
final int pause = waitTime;
final Runnable closerRunner = new Runnable() {

public void run() {
setVisible(false);
dispose();
}
Runnable closerRunner = () -> {
setVisible(false);
dispose();
};
Runnable waitRunner = new Runnable() {

public void run() {
Runnable waitRunner = () -> {
try {
Thread.sleep(pause);
SwingUtilities.invokeAndWait(closerRunner);
} catch (Exception ex) {
log.error("SplashScreen run exception",ex);
}
}
};

setVisible(true);
Thread splashThread = new Thread(waitRunner, "SplashThread");
splashThread.start();
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/atomique/ksar/XMLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down