Add delete option to tasks, ensure compatability with 1.6 sytt files
This commit is contained in:
parent
6616556053
commit
c63044652b
@ -178,6 +178,9 @@ public class Task extends javax.swing.JPanel {
|
||||
setComplete(percent);
|
||||
taskName.setText(tm.toString());
|
||||
taskDesc.setText(tm.getDesc());
|
||||
if (tm.deleteMe()) {
|
||||
getParent().remove(this);
|
||||
}
|
||||
}//GEN-LAST:event_menuBtnActionPerformed
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class TaskList implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 13370L;
|
||||
private static final long serialVersionUID = 6754527404697894562L;
|
||||
|
||||
private final ArrayList<SingleTask> tasks = new ArrayList<>();
|
||||
private String title = "Untitled";
|
||||
|
@ -18,32 +18,39 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="nameBox" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="percentSlider" alignment="0" pref="375" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="percentSlider" alignment="0" pref="375" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="delCheck" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="percentSlider" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="nameBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="115" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="percentSlider" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="delCheck" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="16" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -91,5 +98,10 @@
|
||||
<Property name="value" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="delCheck">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete this task"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -75,6 +75,10 @@ public class TaskMenu extends javax.swing.JPanel {
|
||||
return percentSlider.getValue();
|
||||
}
|
||||
|
||||
public boolean deleteMe() {
|
||||
return delCheck.isSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the task.
|
||||
* @return Task name.
|
||||
@ -108,6 +112,7 @@ public class TaskMenu extends javax.swing.JPanel {
|
||||
descBox = new javax.swing.JTextArea();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
percentSlider = new javax.swing.JSlider();
|
||||
delCheck = new javax.swing.JCheckBox();
|
||||
|
||||
jLabel1.setText("Task Name:");
|
||||
|
||||
@ -126,40 +131,49 @@ public class TaskMenu extends javax.swing.JPanel {
|
||||
percentSlider.setSnapToTicks(true);
|
||||
percentSlider.setValue(0);
|
||||
|
||||
delCheck.setText("Delete this task");
|
||||
|
||||
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)
|
||||
.addComponent(percentSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(jLabel1))
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel3))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(percentSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(delCheck)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.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.UNRELATED)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel2)
|
||||
.addGap(7, 7, 7)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.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)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(delCheck)
|
||||
.addContainerGap(16, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JCheckBox delCheck;
|
||||
private javax.swing.JTextArea descBox;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user