diff --git a/src/net/apocalypselabs/symat/Debug.java b/src/net/apocalypselabs/symat/Debug.java
index e9dcc15..e83c782 100644
--- a/src/net/apocalypselabs/symat/Debug.java
+++ b/src/net/apocalypselabs/symat/Debug.java
@@ -17,7 +17,7 @@ package net.apocalypselabs.symat;
public class Debug {
// If output should be on or off
- public static boolean debug = false;
+ public static boolean debug = true;
/**
* Turn debug output on and off.
diff --git a/src/net/apocalypselabs/symat/Main.java b/src/net/apocalypselabs/symat/Main.java
index 703485a..d518bb0 100644
--- a/src/net/apocalypselabs/symat/Main.java
+++ b/src/net/apocalypselabs/symat/Main.java
@@ -365,7 +365,7 @@ public class Main extends JRibbonFrame {
new IconRibbonBandResizePolicy(appsband.getControlPanel())));
RibbonTask hometask = new RibbonTask("Home", coreband, appsband);
- RibbonTask webtask = new RibbonTask("Web", webband, collabband);
+ RibbonTask webtask = new RibbonTask("Tools", webband, collabband);
loadRibbonMenu(null);
@@ -529,6 +529,11 @@ public class Main extends JRibbonFrame {
menu.addMenuEntry(blankbtn);
maingui.getRibbon().setApplicationMenu(menu);
+ maingui.getRibbon().setApplicationMenuRichTooltip(
+ new RichTooltip("SyMAT Menu",
+ "Create files, open documents, "
+ + "get help, and change settings")
+ );
}
/**
diff --git a/src/net/apocalypselabs/symat/Tasks.form b/src/net/apocalypselabs/symat/Tasks.form
index d44f13f..bf0ac81 100644
--- a/src/net/apocalypselabs/symat/Tasks.form
+++ b/src/net/apocalypselabs/symat/Tasks.form
@@ -9,6 +9,36 @@
+
+
+
+
@@ -28,6 +84,9 @@
+
+
+
diff --git a/src/net/apocalypselabs/symat/Tasks.java b/src/net/apocalypselabs/symat/Tasks.java
index c5a81b9..1a4de01 100644
--- a/src/net/apocalypselabs/symat/Tasks.java
+++ b/src/net/apocalypselabs/symat/Tasks.java
@@ -2,40 +2,40 @@
* CODE LICENSE =====================
* Copyright (c) 2015, Apocalypse Laboratories
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
* specific prior written permission.
- *
+ *
* 4. You adhere to the Media License detailed below. If you do not, this license
* is automatically revoked and you must purge all copies of the software you
* possess, in source or binary form.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* MEDIA LICENSE ====================
* All images and other graphical files (the "graphics") included with this
* software are copyright (c) 2015 Apocalypse Laboratories. You may not distribute
- * the graphics or any program, source code repository, or other digital storage
+ * the graphics or any program, source code repository, or other digital storage
* media containing them without written permission from Apocalypse Laboratories.
* This ban on distribution only applies to publicly available systems.
* A password-protected network file share, USB drive, or other storage scheme that
@@ -45,7 +45,20 @@
*/
package net.apocalypselabs.symat;
+import java.awt.Component;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
import net.apocalypselabs.symat.components.Task;
+import net.apocalypselabs.symat.components.TaskList;
/**
*
@@ -53,13 +66,60 @@ import net.apocalypselabs.symat.components.Task;
*/
public class Tasks extends javax.swing.JInternalFrame {
+ private String tltitle = "Untitled";
+
+ private final JFileChooser fc = new JFileChooser();
+
/**
* Creates new form Tasks
*/
public Tasks() {
+ FileFilter filter = new FileNameExtensionFilter("Task List (.sytt)", "sytt");
+ fc.setFileFilter(filter);
initComponents();
}
+ public Tasks(File f) {
+ this();
+ try {
+ openTaskFile(f);
+ } catch (Exception ex) {
+ JOptionPane.showInternalMessageDialog(Main.mainPane,
+ "Cannot open task list: " + ex.getMessage(),
+ "Error",
+ JOptionPane.ERROR_MESSAGE);
+ Debug.stacktrace(ex);
+ }
+ }
+
+ private void openTaskFile(File f) throws IOException, ClassNotFoundException {
+ FileInputStream fin = new FileInputStream(f);
+ ObjectInputStream ois = new ObjectInputStream(fin);
+ TaskList tl = (TaskList) ois.readObject();
+ ois.close();
+
+ Task[] list = tl.getTasks();
+ for (Task t : list) {
+ listPanel.add(t);
+ }
+ setTitle(tl.getTitle());
+ tltitle = tl.getTitle();
+ redraw();
+ }
+
+ private void saveTasks(File f) throws FileNotFoundException, IOException {
+ TaskList tl = new TaskList();
+ for (Component c : listPanel.getComponents()) {
+ tl.addTask((Task) c);
+ }
+ tl.setTitle(tltitle);
+ FileOutputStream fout = new FileOutputStream(f);
+ try (ObjectOutputStream oos = new ObjectOutputStream(fout)) {
+ oos.writeObject(tl);
+ oos.close();
+ }
+ }
+
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@@ -73,19 +133,48 @@ public class Tasks extends javax.swing.JInternalFrame {
listPanel = new javax.swing.JPanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
+ openBtn = new javax.swing.JMenuItem();
+ saveBtn = new javax.swing.JMenuItem();
+ jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem1 = new javax.swing.JMenuItem();
+ jMenu2 = new javax.swing.JMenu();
+ insertItem = new javax.swing.JMenuItem();
+ setTitleBtn = new javax.swing.JMenuItem();
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Tasks");
+ setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/tasks.png"))); // NOI18N
listPanel.setLayout(new javax.swing.BoxLayout(listPanel, javax.swing.BoxLayout.Y_AXIS));
taskList.setViewportView(listPanel);
jMenu1.setText("File");
+ openBtn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
+ openBtn.setText("Open...");
+ openBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ openBtnActionPerformed(evt);
+ }
+ });
+ jMenu1.add(openBtn);
+
+ saveBtn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
+ saveBtn.setText("Save...");
+ saveBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ saveBtnActionPerformed(evt);
+ }
+ });
+ jMenu1.add(saveBtn);
+
+ jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
+ jMenuItem4.setText("Save As...");
+ jMenu1.add(jMenuItem4);
+
jMenuItem1.setText("Sample");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -96,6 +185,27 @@ public class Tasks extends javax.swing.JInternalFrame {
jMenuBar1.add(jMenu1);
+ jMenu2.setText("Edit");
+
+ insertItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
+ insertItem.setText("Insert item");
+ insertItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ insertItemActionPerformed(evt);
+ }
+ });
+ jMenu2.add(insertItem);
+
+ setTitleBtn.setText("List title...");
+ setTitleBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ setTitleBtnActionPerformed(evt);
+ }
+ });
+ jMenu2.add(setTitleBtn);
+
+ jMenuBar1.add(jMenu2);
+
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@@ -121,16 +231,84 @@ public class Tasks extends javax.swing.JInternalFrame {
listPanel.add(t);
t.setVisible(true);
}
- setSize(getWidth() + 1, getHeight());
- setSize(getWidth() - 1, getHeight());
+ redraw();
}//GEN-LAST:event_jMenuItem1ActionPerformed
+ private void insertItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertItemActionPerformed
+ Task t = new Task(0, "Untitled Task",
+ "No description");
+ listPanel.add(t);
+ t.setVisible(true);
+ redraw();
+ }//GEN-LAST:event_insertItemActionPerformed
+
+ private void openBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openBtnActionPerformed
+ int result = fc.showOpenDialog(this);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ try {
+ openTaskFile(fc.getSelectedFile());
+ } catch (IOException ex) {
+ JOptionPane.showInternalMessageDialog(Main.mainPane,
+ "Cannot open task list: " + ex.getMessage(),
+ "Error",
+ JOptionPane.ERROR_MESSAGE);
+ Debug.stacktrace(ex);
+ } catch (ClassNotFoundException ex) {
+ JOptionPane.showInternalMessageDialog(Main.mainPane,
+ "Cannot open task list: " + ex.getMessage(),
+ "Error",
+ JOptionPane.ERROR_MESSAGE);
+ Debug.stacktrace(ex);
+ }
+ }
+ }//GEN-LAST:event_openBtnActionPerformed
+
+ private void setTitleBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setTitleBtnActionPerformed
+ String res = JOptionPane.showInternalInputDialog(this,
+ "Task list title:",
+ "Change Title",
+ JOptionPane.QUESTION_MESSAGE);
+ if (res == null) {
+ return;
+ }
+ if (res.equals("")) {
+ return;
+ }
+ setTitle(res);
+ tltitle = res;
+ }//GEN-LAST:event_setTitleBtnActionPerformed
+
+ private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBtnActionPerformed
+ int result = fc.showSaveDialog(this);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ try {
+ saveTasks(fc.getSelectedFile());
+ } catch (IOException ex) {
+ JOptionPane.showInternalMessageDialog(Main.mainPane,
+ "Cannot save task list: " + ex.getMessage(),
+ "Error",
+ JOptionPane.ERROR_MESSAGE);
+ Debug.stacktrace(ex);
+ }
+ }
+ }//GEN-LAST:event_saveBtnActionPerformed
+
+ private void redraw() {
+ setSize(getWidth() + 1, getHeight());
+ setSize(getWidth() - 1, getHeight());
+ }
// Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JMenuItem insertItem;
private javax.swing.JMenu jMenu1;
+ private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
+ private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JPanel listPanel;
+ private javax.swing.JMenuItem openBtn;
+ private javax.swing.JMenuItem saveBtn;
+ private javax.swing.JMenuItem setTitleBtn;
private javax.swing.JScrollPane taskList;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/net/apocalypselabs/symat/components/Task.form b/src/net/apocalypselabs/symat/components/Task.form
index 579a57e..ab3d38d 100644
--- a/src/net/apocalypselabs/symat/components/Task.form
+++ b/src/net/apocalypselabs/symat/components/Task.form
@@ -1,6 +1,13 @@
diff --git a/src/net/apocalypselabs/symat/components/Task.java b/src/net/apocalypselabs/symat/components/Task.java
index 9592d5a..d5d09b7 100644
--- a/src/net/apocalypselabs/symat/components/Task.java
+++ b/src/net/apocalypselabs/symat/components/Task.java
@@ -54,16 +54,32 @@ import javax.swing.JOptionPane;
*/
public class Task extends javax.swing.JPanel {
- private boolean taskDone = false;
+ private int percent = 0;
public Task(boolean complete, String name, String desc) {
+ this((complete ? 100 : 0), name, desc);
+ }
+
+ public Task(int complete, String name, String desc) {
this();
- taskDone = complete;
- setComplete(complete);
+ percent = complete;
+ setComplete(percent);
taskName.setText(name);
- taskDesc.setText(desc);
+ taskDesc.setText(desc);
+ }
+
+ @Override
+ public String toString() {
+ return taskName.getText();
}
+ public String getDesc() {
+ return taskDesc.getText();
+ }
+
+ public int getComplete() {
+ return percent;
+ }
/**
* Creates new form Task
*/
@@ -71,13 +87,16 @@ public class Task extends javax.swing.JPanel {
initComponents();
}
- private void setComplete(boolean b) {
+ private void setComplete(int i) {
+ percent = i;
statusLabel.setIcon(new ImageIcon(
getClass().getResource(
"/net/apocalypselabs/symat/icons/"
- + (b ? "green" : "red") + "light.png"
+ + (i == 100 ? "green" : "red") + "light.png"
)));
- statusLabel.setToolTipText(b ? "Complete" : "Incomplete");
+ statusLabel.setToolTipText(i == 100 ? "Complete" : "Incomplete");
+ percentDone.setValue(i);
+ percentDone.setString(i+"%");
}
/**
@@ -93,6 +112,9 @@ public class Task extends javax.swing.JPanel {
taskDesc = new javax.swing.JLabel();
menuBtn = new javax.swing.JButton();
statusLabel = new javax.swing.JLabel();
+ percentDone = new javax.swing.JProgressBar();
+
+ setBorder(javax.swing.BorderFactory.createEtchedBorder());
taskName.setFont(net.apocalypselabs.symat.Main.ubuntuRegular.deriveFont(20.0F));
taskName.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
@@ -111,40 +133,44 @@ public class Task extends javax.swing.JPanel {
statusLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/redlight.png"))); // NOI18N
+ percentDone.setStringPainted(true);
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(taskName, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(taskName, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(menuBtn))
.addComponent(taskDesc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(percentDone, 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()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(menuBtn)
- .addGap(0, 7, Short.MAX_VALUE))
- .addComponent(taskName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(menuBtn)
+ .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
+ .addComponent(taskName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(taskDesc, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE))
+ .addComponent(percentDone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(taskDesc, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
);
}// //GEN-END:initComponents
private void menuBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuBtnActionPerformed
- TaskMenu tm = new TaskMenu(taskDone,
+ TaskMenu tm = new TaskMenu(percent,
taskName.getText(),
taskDesc.getText());
JOptionPane.showInternalMessageDialog(this, tm,
"Task Options", JOptionPane.PLAIN_MESSAGE);
- taskDone = tm.isComplete();
- setComplete(taskDone);
+ percent = tm.getPercent();
+ setComplete(percent);
taskName.setText(tm.toString());
taskDesc.setText(tm.getDesc());
}//GEN-LAST:event_menuBtnActionPerformed
@@ -152,6 +178,7 @@ public class Task extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton menuBtn;
+ private javax.swing.JProgressBar percentDone;
private javax.swing.JLabel statusLabel;
private javax.swing.JLabel taskDesc;
private javax.swing.JLabel taskName;
diff --git a/src/net/apocalypselabs/symat/components/TaskList.java b/src/net/apocalypselabs/symat/components/TaskList.java
new file mode 100644
index 0000000..2823753
--- /dev/null
+++ b/src/net/apocalypselabs/symat/components/TaskList.java
@@ -0,0 +1,95 @@
+/*
+ * CODE LICENSE =====================
+ * Copyright (c) 2015, Apocalypse Laboratories
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * 4. You adhere to the Media License detailed below. If you do not, this license
+ * is automatically revoked and you must purge all copies of the software you
+ * possess, in source or binary form.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * MEDIA LICENSE ====================
+ * All images and other graphical files (the "graphics") included with this
+ * software are copyright (c) 2015 Apocalypse Laboratories. You may not distribute
+ * the graphics or any program, source code repository, or other digital storage
+ * media containing them without written permission from Apocalypse Laboratories.
+ * This ban on distribution only applies to publicly available systems.
+ * A password-protected network file share, USB drive, or other storage scheme that
+ * cannot be easily accessed by the public is generally allowed. If in doubt,
+ * contact Apocalypse Laboratories. If Apocalypse Laboratories allows or denies
+ * you permission, that decision is considered final and binding.
+ */
+package net.apocalypselabs.symat.components;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ * Container to save tasks.
+ * @author Skylar
+ */
+public class TaskList implements Serializable {
+ private final ArrayList tasks = new ArrayList<>();
+ private String title = "Untitled";
+
+ public void addTask(Task t) {
+ SingleTask st = new SingleTask();
+ st.name = t.toString();
+ st.desc = t.getDesc();
+ st.percent = t.getComplete();
+ tasks.add(st);
+ }
+
+ public Task[] getTasks() {
+ Task[] a = new Task[tasks.size()];
+ for (int i = 0; i < tasks.size(); i++) {
+ a[i] = new Task(
+ tasks.get(i).percent,
+ tasks.get(i).name,
+ tasks.get(i).desc);
+ }
+ return a;
+ }
+
+ public void setTitle(String t) {
+ title = t;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public TaskList() {
+
+ }
+
+ class SingleTask implements Serializable {
+ public String name = "";
+ public String desc = "";
+ public int percent = 0;
+ }
+}
\ No newline at end of file
diff --git a/src/net/apocalypselabs/symat/components/TaskMenu.form b/src/net/apocalypselabs/symat/components/TaskMenu.form
index 4275bec..30cf758 100644
--- a/src/net/apocalypselabs/symat/components/TaskMenu.form
+++ b/src/net/apocalypselabs/symat/components/TaskMenu.form
@@ -17,39 +17,38 @@
+
-
-
+
+
-
+
-
-
+
+
+
+
-
+
-
-
+
+
+
-
-
-
-
-
@@ -77,5 +76,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/net/apocalypselabs/symat/components/TaskMenu.java b/src/net/apocalypselabs/symat/components/TaskMenu.java
index 02f70ec..db03239 100644
--- a/src/net/apocalypselabs/symat/components/TaskMenu.java
+++ b/src/net/apocalypselabs/symat/components/TaskMenu.java
@@ -53,13 +53,13 @@ public class TaskMenu extends javax.swing.JPanel {
/**
* Creates new TaskMenu
- * @param complete If the task is completed.
+ * @param percent Task completion percentage.
* @param name Task name
* @param desc Task description
*/
- public TaskMenu(boolean complete, String name, String desc) {
+ public TaskMenu(int percent, String name, String desc) {
this();
- completeBox.setSelected(complete);
+ percentSlider.setValue(percent);
nameBox.setText(name);
descBox.setText(desc);
}
@@ -71,12 +71,8 @@ public class TaskMenu extends javax.swing.JPanel {
initComponents();
}
- /**
- * Check if the task is marked as done.
- * @return true if it is.
- */
- public boolean isComplete() {
- return completeBox.isSelected();
+ public int getPercent() {
+ return percentSlider.getValue();
}
/**
@@ -105,14 +101,13 @@ public class TaskMenu extends javax.swing.JPanel {
// //GEN-BEGIN:initComponents
private void initComponents() {
- completeBox = new javax.swing.JCheckBox();
nameBox = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
descBox = new javax.swing.JTextArea();
-
- completeBox.setText("Task complete");
+ jLabel3 = new javax.swing.JLabel();
+ percentSlider = new javax.swing.JSlider();
jLabel1.setText("Task Name:");
@@ -122,41 +117,55 @@ public class TaskMenu extends javax.swing.JPanel {
descBox.setRows(5);
jScrollPane1.setViewportView(descBox);
+ jLabel3.setText("Percent complete:");
+
+ percentSlider.setMajorTickSpacing(10);
+ percentSlider.setMinorTickSpacing(5);
+ percentSlider.setPaintLabels(true);
+ percentSlider.setPaintTicks(true);
+ percentSlider.setSnapToTicks(true);
+ percentSlider.setValue(0);
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(nameBox)
+ .addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1)
- .addComponent(completeBox)
- .addComponent(jLabel2))
+ .addComponent(jLabel2)
+ .addComponent(jLabel3)
+ .addComponent(jLabel1))
.addGap(0, 0, Short.MAX_VALUE))
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
+ .addComponent(percentSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
- .addComponent(completeBox)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(percentSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE))
+ .addGap(7, 7, 7)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0))
);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JCheckBox completeBox;
private javax.swing.JTextArea descBox;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField nameBox;
+ private javax.swing.JSlider percentSlider;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/net/apocalypselabs/symat/icons/tasks.png b/src/net/apocalypselabs/symat/icons/tasks.png
new file mode 100644
index 0000000..284c2f9
Binary files /dev/null and b/src/net/apocalypselabs/symat/icons/tasks.png differ