diff --git a/build.xml b/build.xml
index c6bbd56..aa2ddcd 100755
--- a/build.xml
+++ b/build.xml
@@ -87,7 +87,7 @@
-
+
diff --git a/lib/jcalendar-1.3.2.jar b/lib/jcalendar-1.3.2.jar
new file mode 100755
index 0000000..b5e5a2d
Binary files /dev/null and b/lib/jcalendar-1.3.2.jar differ
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 507c11d..10359c7 100755
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -22,12 +22,14 @@ dist.jar=${dist.dir}/TimeStamper.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.appframework-1.0.3.jar=lib/appframework-1.0.3.jar
+file.reference.jcalendar-1.3.2.jar=C:\\Documents and Settings\\jbernard\\My Documents\\Development\\TimeStamper\\lib\\jcalendar-1.3.2.jar
file.reference.swing-worker-1.1.jar=lib/swing-worker-1.1.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.appframework-1.0.3.jar}:\
- ${file.reference.swing-worker-1.1.jar}
+ ${file.reference.swing-worker-1.1.jar}:\
+ ${file.reference.jcalendar-1.3.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/src/jdbernard/timestamper/PunchcardDisplayDialog.form b/src/jdbernard/timestamper/PunchcardDisplayDialog.form
index e1b8c0f..fb11481 100755
--- a/src/jdbernard/timestamper/PunchcardDisplayDialog.form
+++ b/src/jdbernard/timestamper/PunchcardDisplayDialog.form
@@ -4,6 +4,7 @@
+
@@ -22,44 +23,334 @@
-
-
-
-
-
+
-
-
-
-
-
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/jdbernard/timestamper/PunchcardDisplayDialog.java b/src/jdbernard/timestamper/PunchcardDisplayDialog.java
index 7f7c9e7..f438f45 100755
--- a/src/jdbernard/timestamper/PunchcardDisplayDialog.java
+++ b/src/jdbernard/timestamper/PunchcardDisplayDialog.java
@@ -6,20 +6,39 @@
package jdbernard.timestamper;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
import java.io.File;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
+import javax.swing.JDialog;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import org.jdesktop.application.Action;
/**
*
* @author jbernard
*/
-public class PunchcardDisplayDialog extends javax.swing.JDialog {
+public class PunchcardDisplayDialog extends JDialog
+implements MouseMotionListener, ChangeListener {
/** Creates new form PunchcardDisplayDialog */
- public PunchcardDisplayDialog(java.awt.Frame parent, boolean modal) {
+ public PunchcardDisplayDialog(Frame parent, boolean modal,
+ Timeline timeline, Calendar day) {
super(parent, modal);
+ this.timeline = timeline;
+ this.day = day;
initComponents();
- timelineDayDisplay1.setDay(Calendar.getInstance());
+ markTextField.setFont(dayDisplay.getMarkFont());
+ notesTextArea.setFont(dayDisplay.getNotesFont());
+ dayDisplay.setTimeline(timeline);
+ dayDisplay.setDay(day);
+ dayDisplay.addChangeListener(this);
}
/** This method is called from within the constructor to
@@ -30,58 +49,268 @@ public class PunchcardDisplayDialog extends javax.swing.JDialog {
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
+ java.awt.GridBagConstraints gridBagConstraints;
- timelineDayDisplay1 = new jdbernard.timestamper.TimelineDayDisplay();
+ mainPanel = new javax.swing.JPanel();
+ dayDisplay = new jdbernard.timestamper.TimelineDayDisplay();
+ detailPanel = new javax.swing.JPanel();
+ textPane = new javax.swing.JPanel();
+ markTextField = new javax.swing.JTextField();
+ notesScrollPane = new javax.swing.JScrollPane();
+ notesTextArea = new javax.swing.JTextArea();
+ timestampDateChooser = new com.toedter.calendar.JDateChooser();
+ buttonPanel = new javax.swing.JPanel();
+ datePanel = new javax.swing.JPanel();
+ dateLabel = new javax.swing.JLabel();
+ prevWeekButton = new javax.swing.JButton();
+ prevDayButton = new javax.swing.JButton();
+ currentDayButton = new javax.swing.JButton();
+ nextDayButton = new javax.swing.JButton();
+ nextWeekButton = new javax.swing.JButton();
+ newMarkerButton = new javax.swing.JButton();
+ deleteMarkerButton = new javax.swing.JButton();
+ saveMarkerChanges = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setName("Form"); // NOI18N
+ setUndecorated(true);
- timelineDayDisplay1.setName("timelineDayDisplay1"); // NOI18N
+ mainPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2));
+ mainPanel.setName("mainPanel"); // NOI18N
+ mainPanel.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mousePressed(java.awt.event.MouseEvent evt) {
+ mainPanelMousePressed(evt);
+ }
+ });
+ mainPanel.addMouseMotionListener(this);
- javax.swing.GroupLayout timelineDayDisplay1Layout = new javax.swing.GroupLayout(timelineDayDisplay1);
- timelineDayDisplay1.setLayout(timelineDayDisplay1Layout);
- timelineDayDisplay1Layout.setHorizontalGroup(
- timelineDayDisplay1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 380, Short.MAX_VALUE)
+ dayDisplay.setName("dayDisplay"); // NOI18N
+ dayDisplay.setPreferredSize(new java.awt.Dimension(100, 100));
+
+ javax.swing.GroupLayout dayDisplayLayout = new javax.swing.GroupLayout(dayDisplay);
+ dayDisplay.setLayout(dayDisplayLayout);
+ dayDisplayLayout.setHorizontalGroup(
+ dayDisplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 405, Short.MAX_VALUE)
);
- timelineDayDisplay1Layout.setVerticalGroup(
- timelineDayDisplay1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 278, Short.MAX_VALUE)
+ dayDisplayLayout.setVerticalGroup(
+ dayDisplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 339, Short.MAX_VALUE)
+ );
+
+ detailPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ detailPanel.setName("detailPanel"); // NOI18N
+
+ textPane.setName("textPane"); // NOI18N
+
+ org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(jdbernard.timestamper.TimeStamperApp.class).getContext().getResourceMap(PunchcardDisplayDialog.class);
+ markTextField.setText(resourceMap.getString("markTextField.text")); // NOI18N
+ markTextField.setName("markTextField"); // NOI18N
+
+ notesScrollPane.setName("notesScrollPane"); // NOI18N
+
+ notesTextArea.setColumns(20);
+ notesTextArea.setRows(5);
+ notesTextArea.setName("notesTextArea"); // NOI18N
+ notesScrollPane.setViewportView(notesTextArea);
+
+ timestampDateChooser.setDateFormatString(resourceMap.getString("timestampDateChooser.dateFormatString")); // NOI18N
+ timestampDateChooser.setName("timestampDateChooser"); // NOI18N
+
+ javax.swing.GroupLayout textPaneLayout = new javax.swing.GroupLayout(textPane);
+ textPane.setLayout(textPaneLayout);
+ textPaneLayout.setHorizontalGroup(
+ textPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, textPaneLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(textPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(notesScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
+ .addComponent(timestampDateChooser, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
+ .addComponent(markTextField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ textPaneLayout.setVerticalGroup(
+ textPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(textPaneLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(timestampDateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(markTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(notesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+
+ buttonPanel.setName("buttonPanel"); // NOI18N
+ buttonPanel.setLayout(new java.awt.GridBagLayout());
+
+ datePanel.setName("datePanel"); // NOI18N
+ datePanel.setLayout(new java.awt.GridBagLayout());
+
+ dateLabel.setBackground(resourceMap.getColor("dateLabel.background")); // NOI18N
+ dateLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ dateLabel.setText(resourceMap.getString("dateLabel.text")); // NOI18N
+ dateLabel.setName("dateLabel"); // NOI18N
+ dateLabel.setOpaque(true);
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.gridwidth = 5;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.weightx = 1.0;
+ datePanel.add(dateLabel, gridBagConstraints);
+
+ javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(jdbernard.timestamper.TimeStamperApp.class).getContext().getActionMap(PunchcardDisplayDialog.class, this);
+ prevWeekButton.setAction(actionMap.get("previousWeek")); // NOI18N
+ prevWeekButton.setHideActionText(true);
+ prevWeekButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
+ prevWeekButton.setName("prevWeekButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ datePanel.add(prevWeekButton, gridBagConstraints);
+
+ prevDayButton.setAction(actionMap.get("previousDay")); // NOI18N
+ prevDayButton.setHideActionText(true);
+ prevDayButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
+ prevDayButton.setName("prevDayButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 1;
+ gridBagConstraints.gridy = 1;
+ datePanel.add(prevDayButton, gridBagConstraints);
+
+ currentDayButton.setAction(actionMap.get("currentDay")); // NOI18N
+ currentDayButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
+ currentDayButton.setName("currentDayButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 2;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ datePanel.add(currentDayButton, gridBagConstraints);
+
+ nextDayButton.setAction(actionMap.get("nextDay")); // NOI18N
+ nextDayButton.setHideActionText(true);
+ nextDayButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
+ nextDayButton.setName("nextDayButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 3;
+ gridBagConstraints.gridy = 1;
+ datePanel.add(nextDayButton, gridBagConstraints);
+
+ nextWeekButton.setAction(actionMap.get("nextWeek")); // NOI18N
+ nextWeekButton.setHideActionText(true);
+ nextWeekButton.setMargin(new java.awt.Insets(0, 2, 0, 2));
+ nextWeekButton.setName("nextWeekButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 4;
+ gridBagConstraints.gridy = 1;
+ datePanel.add(nextWeekButton, gridBagConstraints);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ buttonPanel.add(datePanel, gridBagConstraints);
+
+ newMarkerButton.setAction(actionMap.get("newMarker")); // NOI18N
+ newMarkerButton.setName("newMarkerButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ buttonPanel.add(newMarkerButton, gridBagConstraints);
+
+ deleteMarkerButton.setAction(actionMap.get("deleteMarker")); // NOI18N
+ deleteMarkerButton.setName("deleteMarkerButton"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ gridBagConstraints.weightx = 1.0;
+ buttonPanel.add(deleteMarkerButton, gridBagConstraints);
+
+ saveMarkerChanges.setAction(actionMap.get("saveMarkerChanges")); // NOI18N
+ saveMarkerChanges.setName("saveMarkerChanges"); // NOI18N
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
+ buttonPanel.add(saveMarkerChanges, gridBagConstraints);
+
+ javax.swing.GroupLayout detailPanelLayout = new javax.swing.GroupLayout(detailPanel);
+ detailPanel.setLayout(detailPanelLayout);
+ detailPanelLayout.setHorizontalGroup(
+ detailPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, detailPanelLayout.createSequentialGroup()
+ .addComponent(textPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE))
+ );
+ detailPanelLayout.setVerticalGroup(
+ detailPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(textPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+
+ javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(dayDisplay, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
+ .addComponent(detailPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(dayDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, 339, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(detailPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(timelineDayDisplay1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap())
+ .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(timelineDayDisplay1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addContainerGap())
+ .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// //GEN-END:initComponents
+private void mainPanelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mainPanelMousePressed
+ mousePressRelativeToWindow = evt.getPoint();
+}//GEN-LAST:event_mainPanelMousePressed
+
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws Exception {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
- PunchcardDisplayDialog dialog = new PunchcardDisplayDialog(new javax.swing.JFrame(), true);
- try { dialog.timelineDayDisplay1.setTimeline(Timeline.readFromFile("test-timeline.txt")); }
+ Timeline timeline = null;
+ Calendar day = Calendar.getInstance();
+ try { timeline = Timeline.readFromFile("test-timeline.txt"); }
catch (Exception e) {
- System.err.println("Could not open timeline text.");
+ System.err.println("Could not open timeline text:");
+ e.printStackTrace(System.err);
+ timeline = new Timeline();
try { new File("PLACE_HERE").createNewFile(); }
catch (Exception e1) {}
}
+ PunchcardDisplayDialog dialog = new PunchcardDisplayDialog(new javax.swing.JFrame(), true, timeline, day);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
@@ -92,9 +321,108 @@ public class PunchcardDisplayDialog extends javax.swing.JDialog {
});
}
+ @Action
+ public void previousWeek() {
+ day.add(Calendar.WEEK_OF_YEAR, -1);
+ dayDisplay.setDay(day);
+ dateLabel.setText(dateFormatter.format(day.getTime()));
+ repaint();
+ }
+
+ @Action
+ public void previousDay() {
+ day.add(Calendar.DAY_OF_YEAR, -1);
+ dayDisplay.setDay(day);
+ dateLabel.setText(dateFormatter.format(day.getTime()));
+ repaint();
+ }
+
+ @Action
+ public void currentDay() {
+ day = Calendar.getInstance();
+ dayDisplay.setDay(day);
+ dateLabel.setText(dateFormatter.format(day.getTime()));
+ repaint();
+ }
+
+ @Action
+ public void nextDay() {
+ day.add(Calendar.DAY_OF_YEAR, 1);
+ dayDisplay.setDay(day);
+ dateLabel.setText(dateFormatter.format(day.getTime()));
+ repaint();
+ }
+
+ @Action
+ public void nextWeek() {
+ day.add(Calendar.WEEK_OF_YEAR, 1);
+ dayDisplay.setDay(day);
+ dateLabel.setText(dateFormatter.format(day.getTime()));
+ repaint();
+ }
+
+ @Action
+ public void newMarker() {
+ dayDisplay.addMarker(timestampDateChooser.getDate(),
+ markTextField.getText(), notesTextArea.getText());
+ repaint();
+ }
+
+ @Action
+ public void deleteMarker() {
+ dayDisplay.deleteSelectedMarker();
+ repaint();
+ }
+
+ @Action
+ public void saveMarkerChanges() {
+ deleteMarker();
+ newMarker();
+ }
+
// Variables declaration - do not modify//GEN-BEGIN:variables
- private jdbernard.timestamper.TimelineDayDisplay timelineDayDisplay1;
+ private javax.swing.JPanel buttonPanel;
+ private javax.swing.JButton currentDayButton;
+ private javax.swing.JLabel dateLabel;
+ private javax.swing.JPanel datePanel;
+ private jdbernard.timestamper.TimelineDayDisplay dayDisplay;
+ private javax.swing.JButton deleteMarkerButton;
+ private javax.swing.JPanel detailPanel;
+ private javax.swing.JPanel mainPanel;
+ private javax.swing.JTextField markTextField;
+ private javax.swing.JButton newMarkerButton;
+ private javax.swing.JButton nextDayButton;
+ private javax.swing.JButton nextWeekButton;
+ private javax.swing.JScrollPane notesScrollPane;
+ private javax.swing.JTextArea notesTextArea;
+ private javax.swing.JButton prevDayButton;
+ private javax.swing.JButton prevWeekButton;
+ private javax.swing.JButton saveMarkerChanges;
+ private javax.swing.JPanel textPane;
+ private com.toedter.calendar.JDateChooser timestampDateChooser;
// End of variables declaration//GEN-END:variables
+ private Calendar day;
private Timeline timeline;
+ private SimpleDateFormat dateFormatter =
+ new SimpleDateFormat("EEE MMM dd");
+ private Point mousePressRelativeToWindow;
+
+ public void mouseDragged(MouseEvent e) {
+ setLocation(TimeStamperView.calculateWindowMovement(
+ e.getLocationOnScreen(), mousePressRelativeToWindow,
+ getBounds(),
+ new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())));
+ }
+
+ public void mouseMoved(MouseEvent e) {
+ }
+
+ public void stateChanged(ChangeEvent e) {
+ Timeline.TimelineMarker marker = dayDisplay.getSelectedTimelineMarker();
+ timestampDateChooser.setDate(marker.getTimestamp());
+
+ markTextField.setText(marker.getMark());
+ notesTextArea.setText(marker.getNotes());
+ }
}
diff --git a/src/jdbernard/timestamper/TimeStamperView.form b/src/jdbernard/timestamper/TimeStamperView.form
index 313417c..b4d2ebd 100755
--- a/src/jdbernard/timestamper/TimeStamperView.form
+++ b/src/jdbernard/timestamper/TimeStamperView.form
@@ -222,6 +222,27 @@
+
+
+
+
+
+
+
diff --git a/src/jdbernard/timestamper/TimeStamperView.java b/src/jdbernard/timestamper/TimeStamperView.java
index 790fe15..07f18c3 100755
--- a/src/jdbernard/timestamper/TimeStamperView.java
+++ b/src/jdbernard/timestamper/TimeStamperView.java
@@ -11,9 +11,11 @@ import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
+import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
+import javax.swing.ButtonGroup;
import javax.swing.JFileChooser;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
@@ -98,6 +100,9 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
saveTimelineMenuItem = new javax.swing.JMenuItem();
saveTimelineAsMenuItem = new javax.swing.JMenuItem();
loadTimelineMenuItem = new javax.swing.JMenuItem();
+ seperator1 = new javax.swing.JSeparator();
+ showNotesDialogCheckBoxMenuItem = new javax.swing.JCheckBoxMenuItem();
+ showPunchcardCheckBoxMenuItem = new javax.swing.JCheckBoxMenuItem();
mainPanel.setBorder(javax.swing.BorderFactory.createMatteBorder(2, 2, 2, 2, new java.awt.Color(0, 0, 0)));
mainPanel.setName("mainPanel"); // NOI18N
@@ -177,13 +182,13 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(totalTimeNow)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE)
.addComponent(currentTimeLabel))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
.addComponent(currentTaskLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(startTimeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE))
- .addComponent(taskTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE))
+ .addComponent(startTimeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE))
+ .addComponent(taskTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(optionsButton)
@@ -226,6 +231,17 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
loadTimelineMenuItem.setName("loadTimelineMenuItem"); // NOI18N
optionsMenu.add(loadTimelineMenuItem);
+ seperator1.setName("seperator1"); // NOI18N
+ optionsMenu.add(seperator1);
+
+ showNotesDialogCheckBoxMenuItem.setAction(actionMap.get("editNotes")); // NOI18N
+ showNotesDialogCheckBoxMenuItem.setName("showNotesDialogCheckBoxMenuItem"); // NOI18N
+ optionsMenu.add(showNotesDialogCheckBoxMenuItem);
+
+ showPunchcardCheckBoxMenuItem.setAction(actionMap.get("showPunchcard")); // NOI18N
+ showPunchcardCheckBoxMenuItem.setName("showPunchcardCheckBoxMenuItem"); // NOI18N
+ optionsMenu.add(showPunchcardCheckBoxMenuItem);
+
setComponent(mainPanel);
}// //GEN-END:initComponents
@@ -252,7 +268,17 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
@Action
public void editNotes() {
- notesDialog.setVisible(notesButton.isSelected());
+ notesVisible = !notesVisible;
+ notesDialog.setVisible(notesVisible);
+ notesButton.setSelected(notesVisible);
+ showNotesDialogCheckBoxMenuItem.setSelected(notesVisible);
+ }
+
+ @Action
+ public void showPunchcard() {
+ punchcardVisible = !punchcardVisible;
+ showPunchcardCheckBoxMenuItem.setSelected(punchcardVisible);
+ getPunchcardDisplayDialog().setVisible(punchcardVisible);
}
public void setNotesForActiveTask(String notes) {
@@ -273,6 +299,9 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
private javax.swing.JPopupMenu optionsMenu;
private javax.swing.JMenuItem saveTimelineAsMenuItem;
private javax.swing.JMenuItem saveTimelineMenuItem;
+ private javax.swing.JSeparator seperator1;
+ private javax.swing.JCheckBoxMenuItem showNotesDialogCheckBoxMenuItem;
+ private javax.swing.JCheckBoxMenuItem showPunchcardCheckBoxMenuItem;
private javax.swing.JLabel startTimeLabel;
private javax.swing.JTextField taskTextField;
private javax.swing.JLabel totalTimeNow;
@@ -285,6 +314,19 @@ public class TimeStamperView extends FrameView implements MouseMotionListener {
private Font thinTaskFont;
private Date mostRecentTask;
private NotesDialog notesDialog;
+ private PunchcardDisplayDialog punchcardDisplayDialog;
+ private boolean notesVisible = false;
+ private boolean punchcardVisible = false;
+
+ private PunchcardDisplayDialog getPunchcardDisplayDialog() {
+ if (punchcardDisplayDialog == null) {
+ punchcardDisplayDialog = new PunchcardDisplayDialog(this.getFrame(),
+ false,
+ ((TimeStamperApp) getApplication()).getActiveTimeline(),
+ Calendar.getInstance());
+ }
+ return punchcardDisplayDialog;
+ }
public void mouseDragged(MouseEvent e) {
getFrame().setLocation(calculateWindowMovement(e.getLocationOnScreen(),
diff --git a/src/jdbernard/timestamper/TimelineDayDisplay.java b/src/jdbernard/timestamper/TimelineDayDisplay.java
index cf64a7c..58b8621 100755
--- a/src/jdbernard/timestamper/TimelineDayDisplay.java
+++ b/src/jdbernard/timestamper/TimelineDayDisplay.java
@@ -6,43 +6,73 @@ package jdbernard.timestamper;
import java.awt.BasicStroke;
import java.awt.Color;
+import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
+import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Date;
import java.util.Iterator;
import javax.swing.JComponent;
-import javax.swing.JLabel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
*
* @author jbernard
*/
-public class TimelineDayDisplay extends JComponent {
+public class TimelineDayDisplay extends JComponent implements MouseListener {
+
+ private class MarkerDisplayEntry {
+ public Timeline.TimelineMarker marker;
+ public float relY;
+ public float relHeight;
+ public Rectangle2D markBounds;
+ public Rectangle2D notesBounds;
+ public Rectangle bounds;
+ }
private Timeline timeline;
- private Calendar day;
+ private ArrayList markerEntries;
+ private Calendar day = Calendar.getInstance();
+ private Calendar nextDay = Calendar.getInstance();
+ private Timeline.TimelineMarker currentMarker;
+ private ArrayList changeListeners = new ArrayList();
- private final Color evenTrans = new Color(0.75f, 0.75f, 0.75f, 0.4f);
- private final Color evenOpaque = new Color(0.75f, 0.75f, 0.75f, 1f);
- private final Color oddTrans = new Color(0.5f, 0.5f, 0.5f, 0.4f);
- private final Color oddOpaque = new Color(0.5f, 0.5f, 0.5f, 1f);
+ private Font markFont;// = getFont().deriveFont(Font.BOLD);
+ private Font notesFont;// = getFont();
+
+ private Color evenTrans = new Color(0.75f, 0.75f, 0.75f, 0.4f);
+ private Color evenOpaque = new Color(0.75f, 0.75f, 0.75f, 1f);
+ private Color oddTrans = new Color(0.5f, 0.5f, 0.5f, 0.4f);
+ private Color oddOpaque = new Color(0.5f, 0.5f, 0.5f, 1f);
+ private Color selectedTrans = new Color(0.5f, 0.75f, 0.5f, 0.4f);
+ private Color selectedOpaque = new Color(0.5f, 0.75f, 0.5f, 1f);
+ private Color fontColor = new Color(0.1f, 0.1f, 0.1f, 1f);
+
+ private long oneDayInMilli = (24 * 60 * 60 * 1000);
public TimelineDayDisplay() {
super();
+ addMouseListener(this);
}
public TimelineDayDisplay(Timeline timeline, Calendar day) {
- super();
+ this();
this.timeline = timeline;
this.day = day;
+ updateMarkers(getGraphics());
}
public void setTimeline(Timeline t) {
timeline = t;
+ updateMarkers(getGraphics());
}
public Timeline getTimeline() {
@@ -50,44 +80,103 @@ public class TimelineDayDisplay extends JComponent {
}
public void setDay(Calendar d) {
- day = d;
+ day.setTime(d.getTime());
day.set(Calendar.HOUR_OF_DAY, 0);
day.set(Calendar.MINUTE, 0);
day.set(Calendar.SECOND, 0);
+
+ nextDay.setTime(day.getTime());
+ nextDay.add(Calendar.DAY_OF_YEAR, 1);
+ updateMarkers(getGraphics());
}
public Calendar getDay() {
return day;
}
- @Override
- public void paintComponent(Graphics g) {
- Insets insets = this.getInsets();
- Rectangle bounds = this.getBounds();
- Rectangle canvasBounds = new Rectangle(insets.left, insets.top,
- bounds.width - insets.left - insets.right - 1,
- bounds.height - insets.top - insets.bottom - 1);
+ public void setMarkFont(Font f) {
+ markFont = f;
+ }
- Calendar nextDay = Calendar.getInstance();
- nextDay.setTime(day.getTime());
- nextDay.add(Calendar.DAY_OF_YEAR, 1);
+ public Font getMarkFont() {
+ return markFont;
+ }
- Graphics2D g2d = (Graphics2D) g;
- double hourHeight = canvasBounds.getHeight() / 24.0;
- long oneDayInMilli = (24 * 60 * 60 * 1000);
- Rectangle2D stringBounds = getFontMetrics(getFont()).getStringBounds("00:00 ", g);
- for (int i = 1; i < 24; i++) {
- int lineY = (int) Math.round(hourHeight * (double) i);
- g.drawLine(canvasBounds.x + (int) stringBounds.getWidth(), canvasBounds.y + lineY,
- canvasBounds.x + canvasBounds.width,
- canvasBounds.y + lineY);
+ public void setNotesFont(Font f) {
+ notesFont = f;
+ }
- if ((hourHeight > (stringBounds.getHeight()) || ((i % 2) == 0))) {
- g.drawString(String.format("%1$02d:00", i),
- canvasBounds.x + 2, lineY + (int) (stringBounds.getHeight() / 2));
- }
- }
+ public Font getNotesFont() {
+ return notesFont;
+ }
+ public void setFontColor(Color f) {
+ fontColor = new Color(f.getRGB());
+ }
+
+ public Color getFontColor() {
+ return fontColor;
+ }
+ public void setEvenColor(Color c) {
+ evenOpaque = new Color(c.getRGB());
+ evenTrans = new Color((float) c.getRed() / 255f,
+ (float) c.getGreen() / 255f,
+ (float) c.getBlue() / 255f, 0.4f);
+ }
+
+ public Color getEvenColor() {
+ return evenOpaque;
+ }
+
+ public void setOddColor(Color c) {
+ oddOpaque = new Color(c.getRGB());
+ oddTrans = new Color((float) c.getRed() / 255f,
+ (float) c.getGreen() / 255f,
+ (float) c.getBlue() / 255f, 0.4f);
+ }
+
+ public Color getOddColor() {
+ return oddOpaque;
+ }
+
+ public void setSelectedColor(Color c) {
+ selectedOpaque = new Color(c.getRGB());
+ selectedTrans = new Color((float) c.getRed() / 255f,
+ (float) c.getGreen() / 255f,
+ (float) c.getBlue() / 255f, 0.4f);
+ }
+
+ public Color getSelectedColor() {
+ return selectedOpaque;
+ }
+
+ public Timeline.TimelineMarker getSelectedTimelineMarker() {
+ return currentMarker;
+ }
+
+ public void addMarker(Date timestamp, String mark, String notes) {
+ timeline.addMarker(timestamp, mark, notes);
+ updateMarkers(getGraphics());
+ }
+
+ public void deleteSelectedMarker() {
+ timeline.removeMarker(currentMarker);
+ updateMarkers(getGraphics());
+ }
+
+ public void updateSelectedMarker(String notes) {
+ currentMarker.setNotes(notes);
+ updateMarkers(getGraphics());
+ }
+
+ private void updateMarkers(Graphics g) {
+
+ markerEntries = new ArrayList();
+
+ if (markFont == null) markFont = getFont().deriveFont(Font.BOLD);
+ if (notesFont == null) notesFont = getFont();
+
+ // get all relevant markers
Timeline.TimelineMarker tm = timeline.getLastMarker(day.getTime());
Iterator itr = timeline.iterator();
@@ -102,35 +191,180 @@ public class TimelineDayDisplay extends JComponent {
markers.add(tm);
- for (int i = 0; i < markers.size(); i++) {
- int boxY = 0;
- int boxHeight = 1;
- if (i != 0) {
- double relTime = markers.get(i).getTimestamp().getTime() - day.getTimeInMillis();
- boxY = (int) Math.round((relTime / oneDayInMilli)
- * canvasBounds.getHeight()) + canvasBounds.y;
- }
- if (i == markers.size() - 1) {
- double relTime = nextDay.getTime().getTime()
- - markers.get(i).getTimestamp().getTime();
- boxHeight = (int) Math.round(relTime / oneDayInMilli
- * canvasBounds.getHeight());
+ for (int i = 0; i < markers.size() - 1; i++) {
+ MarkerDisplayEntry markerEntry = new MarkerDisplayEntry();
+
+ markerEntry.marker = markers.get(i);
+
+ // set string bounds
+ markerEntry.markBounds = getFontMetrics(markFont)
+ .getStringBounds(markers.get(i).getMark(), g);
+ markerEntry.notesBounds = getFontMetrics(notesFont)
+ .getStringBounds(markers.get(i).getNotes(), g);
+
+ // calculate upper bound
+ if (i == 0) {
+ markerEntry.relY = 0;
} else {
- double relTime = markers.get(i + 1).getTimestamp().getTime()
- - markers.get(i).getTimestamp().getTime();
- boxHeight = (int) Math.round(relTime / oneDayInMilli
- * canvasBounds.getHeight());
+ // calculate time in ms since the beginning of the day
+ markerEntry.relY = markers.get(i).getTimestamp().getTime()
+ - day.getTimeInMillis();
+ // calculate percentage of total time in day
+ markerEntry.relY /= oneDayInMilli;
}
- g.setColor((i % 2 == 0 ? evenTrans : oddTrans));
- g.fillRect(canvasBounds.x + (int) stringBounds.getWidth() + 5, boxY,
- canvasBounds.x + canvasBounds.width, boxHeight);
- g2d.setColor((i % 2 == 0 ? evenOpaque : oddOpaque));
+
+ // calculate lower bound
+ if (i == 0)
+ markerEntry.relHeight =
+ markers.get(i + 1).getTimestamp().getTime()
+ - day.getTimeInMillis();
+ else if (i == markers.size() - 2)
+ markerEntry.relHeight = nextDay.getTimeInMillis()
+ - markers.get(i).getTimestamp().getTime();
+ else
+ markerEntry.relHeight =
+ markers.get(i + 1).getTimestamp().getTime()
+ - markers.get(i).getTimestamp().getTime();
+ markerEntry.relHeight /= oneDayInMilli;
+
+ markerEntries.add(markerEntry);
+ }
+ }
+
+ @Override
+ public void paintComponent(Graphics g) {
+ removeAll();
+
+ if (markerEntries == null) updateMarkers(g);
+
+ Insets insets = this.getInsets();
+ Rectangle bounds = this.getBounds();
+ Rectangle canvasBounds = new Rectangle(insets.left, insets.top,
+ bounds.width - insets.left - insets.right - 1,
+ bounds.height - insets.top - insets.bottom - 1);
+ double hourHeight = canvasBounds.getHeight() / 24.0;
+
+ Graphics2D g2d = (Graphics2D) g;
+ Rectangle2D stringBounds = getFontMetrics(getFont()).getStringBounds("00:00 ", g);
+
+ // draw hour lines
+ for (int i = 1; i < 24; i++) {
+ int lineY = (int) Math.round(hourHeight * (double) i);
+ g.drawLine(canvasBounds.x + (int) stringBounds.getWidth(), canvasBounds.y + lineY,
+ canvasBounds.x + canvasBounds.width,
+ canvasBounds.y + lineY);
+
+ //draw hours labels
+ if ((hourHeight > (stringBounds.getHeight()) || ((i % 2) == 0))) {
+ g.drawString(String.format("%1$02d:00", i),
+ canvasBounds.x + 2, lineY + (int) (stringBounds.getHeight() / 2));
+ }
+ }
+
+ for (int i = 0; i < markerEntries.size(); i++) {
+
+ MarkerDisplayEntry curEntry = markerEntries.get(i);
+
+ Rectangle2D markBounds;
+ Rectangle2D notesBounds;
+
+ boolean selected = curEntry.marker.equals(currentMarker);
+
+ // if i == 0, this is the default
+ curEntry.bounds = new Rectangle();
+ curEntry.bounds.y = 3;
+ curEntry.bounds.x = canvasBounds.x + (int) stringBounds.getWidth() + 5;
+ curEntry.bounds.height = 1;
+ curEntry.bounds.width = canvasBounds.width - (int) stringBounds.getWidth() - 8;
+
+ double relTime;
+
+ // calculate upper bound
+ curEntry.bounds.y = (int) Math.round(curEntry.relY
+ * canvasBounds.getHeight());
+
+ if (i == 0) curEntry.bounds.y += 3;
+
+ // calculate lower bound
+ curEntry.bounds.height = (int) Math.round(curEntry.relHeight
+ * canvasBounds.getHeight());
+
+ if (i ==0) curEntry.bounds.height -= 6;
+ else curEntry.bounds.height -= 3;
+
+ // draw box
+ if (selected) g.setColor(selectedTrans);
+ else g.setColor((i % 2 == 0 ? evenTrans : oddTrans));
+ g.fillRect(curEntry.bounds.x, curEntry.bounds.y, curEntry.bounds.width, curEntry.bounds.height);
+
+ if (selected) g.setColor(selectedOpaque);
+ else g2d.setColor((i % 2 == 0 ? evenOpaque : oddOpaque));
g2d.setStroke(new BasicStroke(3f));
- g2d.drawRect(canvasBounds.x + (int) stringBounds.getWidth() + 5, boxY,
- canvasBounds.x + canvasBounds.width, boxHeight);
+ g2d.drawRect(curEntry.bounds.x, curEntry.bounds.y, curEntry.bounds.width, curEntry.bounds.height);
+
+ // draw timestamp name
+ markBounds = (Rectangle2D) curEntry.markBounds.clone();
+ markBounds.setRect(curEntry.bounds.x + 3,
+ curEntry.bounds.y + stringBounds.getHeight(),
+ markBounds.getWidth(), markBounds.getHeight());
+
+ g.setColor(fontColor);
+ g.setFont(markFont);
+ g.drawString(curEntry.marker.getMark(),
+ (int) markBounds.getX(), (int) markBounds.getY());
+
+ // draw notes
+ notesBounds = (Rectangle2D) curEntry.notesBounds.clone();
+ notesBounds.setRect(curEntry.bounds.x + 6,
+ curEntry.bounds.y + stringBounds.getHeight() + markBounds.getHeight(),
+ notesBounds.getWidth(), notesBounds.getHeight());
+
+ if (curEntry.bounds.contains(notesBounds)) {
+ g.setFont(notesFont);
+ g.drawString(curEntry.marker.getNotes(),
+ (int) notesBounds.getX(), (int) notesBounds.getY());
+ }
}
g.setColor(Color.BLACK);
g.drawRect(canvasBounds.x, canvasBounds.y, canvasBounds.width, canvasBounds.height);
}
+
+ public void addChangeListener(ChangeListener cl) {
+ changeListeners.add(cl);
+ }
+
+ public boolean removeChangeListener(ChangeListener cl) {
+ return changeListeners.remove(cl);
+ }
+
+ private void fireChangeEvent() {
+ for (ChangeListener cl : changeListeners)
+ cl.stateChanged(new ChangeEvent(this));
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ Point topLeft = getLocationOnScreen();
+ for (MarkerDisplayEntry markerEntry : markerEntries) {
+ Rectangle absBounds = new Rectangle(markerEntry.bounds);
+ absBounds.translate(topLeft.x, topLeft.y);
+ if (absBounds.contains(e.getLocationOnScreen())) {
+ currentMarker = markerEntry.marker;
+ repaint();
+ }
+ }
+ fireChangeEvent();
+ }
+
+ public void mousePressed(MouseEvent e) {
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ }
}
diff --git a/src/jdbernard/timestamper/resources/PunchcardDisplayDialog.properties b/src/jdbernard/timestamper/resources/PunchcardDisplayDialog.properties
new file mode 100755
index 0000000..8296e1b
--- /dev/null
+++ b/src/jdbernard/timestamper/resources/PunchcardDisplayDialog.properties
@@ -0,0 +1,42 @@
+markTextField.text=
+previousWeek.Action.text=<<
+previousWeek.Action.shortDescription=Go back one week.
+dateLabel.text=date
+#NOI18N
+dateLabel.background=255, 255, 153
+prevWeekButton.text=jButton1
+previousWeek.Action.icon=/jdbernard/timestamper/resources/icons/media-seek-backward.png
+previousWeek.Action.smallIcon=/jdbernard/timestamper/resources/icons/media-seek-backward.png
+prevDayButton.text=jButton1
+previousDay.Action.smallIcon=/jdbernard/timestamper/resources/icons/media-playback-reverse.png
+previousDay.Action.icon=/jdbernard/timestamper/resources/icons/media-playback-reverse.png
+previousDay.Action.shortDescription=Go back one day.
+previousDay.Action.text=Previous Day
+currentDay.Action.text=Today
+currentDay.Action.shortDescription=Go to today's date.
+jButton2.text=jButton2
+nextDay.Action.smallIcon=/jdbernard/timestamper/resources/icons/media-playback-start.png
+nextDay.Action.icon=/jdbernard/timestamper/resources/icons/media-playback-start.png
+nextDay.Action.shortDescription=Go one day forward.
+nextDay.Action.text=Next Day
+nextWeekButton.text=jButton3
+nextWeek.Action.text=Next Week
+nextWeek.Action.smallIcon=/jdbernard/timestamper/resources/icons/media-seek-forward.png
+nextWeek.Action.icon=/jdbernard/timestamper/resources/icons/media-seek-forward.png
+nextWeek.Action.shortDescription=Go one week forward.
+newMarkerButton.text=jButton1
+newMarker.Action.smallIcon=/jdbernard/timestamper/resources/icons/16-square-green-add.png
+newMarker.Action.icon=/jdbernard/timestamper/resources/icons/16-square-green-add.png
+newMarker.Action.shortDescription=Create a new timestamp mark.
+newMarker.Action.text=New Marker
+deleteMarkerButton.text=jButton1
+deleteMarker.Action.text=Delete Marker
+deleteMarker.Action.shortDescription=Delete a timestamp mark.
+deleteMarker.Action.smallIcon=/jdbernard/timestamper/resources/icons/16-square-red-delete.png
+deleteMarker.Action.icon=/jdbernard/timestamper/resources/icons/16-square-red-delete.png
+saveMarkerChanges.text=jButton1
+saveMarkerChanges.Action.smallIcon=/jdbernard/timestamper/resources/icons/document-save-16x16.png
+saveMarkerChanges.Action.icon=/jdbernard/timestamper/resources/icons/document-save-16x16.png
+saveMarkerChanges.Action.shortDescription=Save timeline marker changes.
+saveMarkerChanges.Action.text=Save Changes
+timestampDateChooser.dateFormatString=MMM d, yyyy HH:mm
diff --git a/src/jdbernard/timestamper/resources/TimeStamperView.properties b/src/jdbernard/timestamper/resources/TimeStamperView.properties
index f85f231..e4829c7 100755
--- a/src/jdbernard/timestamper/resources/TimeStamperView.properties
+++ b/src/jdbernard/timestamper/resources/TimeStamperView.properties
@@ -17,7 +17,7 @@ notesButton.text=jButton1
editNotes.Action.smallIcon=/jdbernard/timestamper/resources/icons/16-em-pencil.png
editNotes.Action.icon=/jdbernard/timestamper/resources/icons/16-em-pencil.png
editNotes.Action.shortDescription=Edit notes for this task
-editNotes.Action.text=Notes
+editNotes.Action.text=Show Notes
jButton1.text=
showOptionsMenu.Action.text=Options menu
showOptionsMenu.Action.shortDescription=Show the application's options menu.
@@ -49,3 +49,9 @@ notesButton2.text=jToggleButton1
optionsButton.rolloverIcon=icons/16-tool-a-hover.png
#NOI18N
exitButton.rolloverIcon=icons/16-em-cross-hover.png
+showNotesDialogCheckBoxMenuItem.text=CheckBox
+showPunchcardCheckBoxMenuItem.text=CheckBox
+showPunchcard.Action.shortDescription=View the timeline
+showPunchcard.Action.text=Show Timeline
+showPunchcard.Action.smallIcon=/jdbernard/timestamper/resources/icons/16-file-archive.png
+showPunchcard.Action.icon=/jdbernard/timestamper/resources/icons/16-file-archive.png
diff --git a/src/jdbernard/timestamper/resources/icons/16-file-archive.png b/src/jdbernard/timestamper/resources/icons/16-file-archive.png
new file mode 100755
index 0000000..e8d07f5
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/16-file-archive.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/16-square-green-add.png b/src/jdbernard/timestamper/resources/icons/16-square-green-add.png
new file mode 100755
index 0000000..f5de8a5
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/16-square-green-add.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/16-square-red-delete.png b/src/jdbernard/timestamper/resources/icons/16-square-red-delete.png
new file mode 100755
index 0000000..237ae2a
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/16-square-red-delete.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-playback-reverse.png b/src/jdbernard/timestamper/resources/icons/media-playback-reverse.png
new file mode 100755
index 0000000..07dcbf1
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-playback-reverse.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-playback-start.png b/src/jdbernard/timestamper/resources/icons/media-playback-start.png
new file mode 100755
index 0000000..a7de0fe
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-playback-start.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-seek-backward.png b/src/jdbernard/timestamper/resources/icons/media-seek-backward.png
new file mode 100755
index 0000000..ffcac31
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-seek-backward.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-seek-forward.png b/src/jdbernard/timestamper/resources/icons/media-seek-forward.png
new file mode 100755
index 0000000..4d7e2cd
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-seek-forward.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-skip-backward.png b/src/jdbernard/timestamper/resources/icons/media-skip-backward.png
new file mode 100755
index 0000000..94381f5
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-skip-backward.png differ
diff --git a/src/jdbernard/timestamper/resources/icons/media-skip-forward.png b/src/jdbernard/timestamper/resources/icons/media-skip-forward.png
new file mode 100755
index 0000000..758ec6f
Binary files /dev/null and b/src/jdbernard/timestamper/resources/icons/media-skip-forward.png differ