Minor bug fix. Now allows a config file to be created if it does not exist.
committer: Jonathan Bernard <jdbernard@gmail.com>
This commit is contained in:
parent
cb419c658f
commit
ed5bdce87c
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package jdbernard.timestamper;
|
package jdbernard.timestamper;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -51,19 +52,16 @@ implements Application.ExitListener {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
config = new Properties();
|
config = new Properties();
|
||||||
FileInputStream cfgIn = new FileInputStream("timestamper.config");
|
File cfgFile = new File("timestamper.config");
|
||||||
|
if (!cfgFile.exists()) cfgFile.createNewFile();
|
||||||
|
FileInputStream cfgIn = new FileInputStream(cfgFile);
|
||||||
config.load(cfgIn);
|
config.load(cfgIn);
|
||||||
cfgIn.close();
|
cfgIn.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.warning("Could not load configuration options.");
|
log.warning("Could not load configuration options.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
loadTimeline(config.getProperty("lastUsedTimelineFilename"));
|
||||||
activeTimeline = Timeline.readFromFile(
|
|
||||||
config.getProperty("lastUsedTimelineFilename"));
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
log.warning("Could not load the last used timeline file.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,10 +73,12 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
|
|||||||
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
||||||
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
||||||
|
|
||||||
mostRecentTask = lastMarker.getTimestamp();
|
if (lastMarker != null) {
|
||||||
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
mostRecentTask = lastMarker.getTimestamp();
|
||||||
|
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
||||||
|
|
||||||
taskTextField.setText(lastMarker.getMark());
|
taskTextField.setText(lastMarker.getMark());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
@ -401,9 +403,11 @@ private void optionsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIR
|
|||||||
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
Timeline t = ((TimeStamperApp) getApplication()).getActiveTimeline();
|
||||||
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
Timeline.TimelineMarker lastMarker = t.getLastMarker(new Date());
|
||||||
|
|
||||||
mostRecentTask = lastMarker.getTimestamp();
|
if (lastMarker != null) {
|
||||||
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
mostRecentTask = lastMarker.getTimestamp();
|
||||||
|
startTimeLabel.setText(Timeline.shortFormat.format(lastMarker.getTimestamp()));
|
||||||
|
|
||||||
taskTextField.setText(lastMarker.getMark());
|
taskTextField.setText(lastMarker.getMark());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
#
|
|
||||||
#Fri Aug 29 18:18:08 CDT 2008
|
|
||||||
lastUsedTimelineFilename=default-timeline.txt
|
|
||||||
lastUsedTimelineFile=default-timeline.txt
|
|
Loading…
x
Reference in New Issue
Block a user