mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Added several improvements, changes and bug fixes
This commit is contained in:
parent
2e338de4d2
commit
97aa529b62
@ -70,7 +70,7 @@ public class ActivitiesWindow extends TWindow {
|
|||||||
try {
|
try {
|
||||||
Integer.parseInt(year_);
|
Integer.parseInt(year_);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
JOptionPane.showMessageDialog(this, "Error: this is not year: " + currentYear);
|
JOptionPane.showMessageDialog(this, "Error: this is not year: " + year_);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < tp.getTabCount(); i++) {
|
for (int i = 0; i < tp.getTabCount(); i++) {
|
||||||
@ -100,6 +100,7 @@ public class ActivitiesWindow extends TWindow {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
tp.addChangeListener(changeListener);
|
tp.addChangeListener(changeListener);
|
||||||
|
tp.switchTo(currentYearS);
|
||||||
getYearPanel(currentYearS).setSelectedMonth(currentMonthS);
|
getYearPanel(currentYearS).setSelectedMonth(currentMonthS);
|
||||||
getYearPanel(currentYearS).getMonthPanel(currentMonthS).setSelectedDay(currentDayS);
|
getYearPanel(currentYearS).getMonthPanel(currentMonthS).setSelectedDay(currentDayS);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.nanoboot.utils.timecalc.swing.common;
|
package org.nanoboot.utils.timecalc.swing.common;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.nanoboot.utils.timecalc.entity.Activity;
|
import org.nanoboot.utils.timecalc.entity.Activity;
|
||||||
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
||||||
@ -13,10 +14,7 @@ import javax.swing.JTextField;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.Toolkit;
|
import java.util.function.BiConsumer;
|
||||||
import java.awt.datatransfer.Clipboard;
|
|
||||||
import java.awt.datatransfer.StringSelection;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert
|
* @author Robert
|
||||||
@ -26,42 +24,56 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final DayPanel dayPanel;
|
private final DayPanel dayPanel;
|
||||||
|
private boolean mouseOver;
|
||||||
class TTextFieldForActivityPanel extends TTextField {
|
class TTextFieldForActivityPanel extends TTextField {
|
||||||
|
|
||||||
public TTextFieldForActivityPanel(String s, String name, Consumer<String> consumer, boolean sort) {
|
public TTextFieldForActivityPanel(String s, String name) {
|
||||||
|
this(s, name, null);
|
||||||
|
}
|
||||||
|
public TTextFieldForActivityPanel(String s, String name, BiConsumer<Activity, String> additionalAction) {
|
||||||
|
this(s, name, additionalAction, false);
|
||||||
|
}
|
||||||
|
public TTextFieldForActivityPanel(String s, String name, BiConsumer<Activity, String> additionalAction, boolean sort) {
|
||||||
super(s);
|
super(s);
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||||
setCaretPosition(0);
|
setCaretPosition(0);
|
||||||
|
//setToolTipText(s);
|
||||||
|
|
||||||
if(consumer != null) {
|
if(additionalAction != null) {
|
||||||
addMouseListener((MouseClickedListener) e -> {
|
addMouseListener((MouseClickedListener) e -> {
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
String result = (String) JOptionPane.showInputDialog(
|
||||||
null,
|
null,
|
||||||
"Select new " + name,
|
"Select new " + name,
|
||||||
"New " + name,
|
"New " + name,
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
name.equals("comment") ? JOptionPane.QUESTION_MESSAGE : JOptionPane.PLAIN_MESSAGE,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
getText()
|
getText()
|
||||||
);
|
);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
consumer.accept(result);
|
additionalAction.accept(activity, result);
|
||||||
activityRepository.update(activity);
|
activityRepository.update(activity);
|
||||||
setText(result);
|
setText(result);
|
||||||
if(sort) {
|
if(sort) {
|
||||||
dayPanel.sortActivityPanels();
|
dayPanel.sortActivityPanels();
|
||||||
}
|
}
|
||||||
setCaretPosition(0);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TTextFieldForActivityPanel(String s, String name) {
|
public void setText(String text) {
|
||||||
this(s, name, null, false);
|
super.setText(text);
|
||||||
|
//if(!text.isEmpty()) {
|
||||||
|
//setToolTipText(text);
|
||||||
|
setCaretPosition(0);
|
||||||
|
//} else {
|
||||||
|
// setToolTipText(null);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public static final Dimension PREFERRED_SIZE = new Dimension(200, 40);
|
public static final Dimension PREFERRED_SIZE = new Dimension(200, 40);
|
||||||
public static final Dimension PREFERRED_SIZE1 = new Dimension(80, 40);
|
public static final Dimension PREFERRED_SIZE1 = new Dimension(80, 40);
|
||||||
@ -72,18 +84,23 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
@Getter
|
@Getter
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
private TTextField sortkey = new TTextFieldForActivityPanel("1", "sortkey", (r)->getActivity().setSortkey(
|
private final TTextField sortkey;
|
||||||
Integer.parseInt(r)), true);
|
private final TTextField name;
|
||||||
private TTextField name = new TTextFieldForActivityPanel("", "name");
|
private final TTextField comment;
|
||||||
private TTextField comment = new TTextFieldForActivityPanel("", "comment");
|
private final TTextField ticket;
|
||||||
private TTextField ticket = new TTextFieldForActivityPanel("", "ticket");
|
|
||||||
private TTextField spentTime = new TTextFieldForActivityPanel("00:00", "spentTime");
|
private final TTextField spentTime;
|
||||||
|
|
||||||
|
private final TTextField flags;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PRIVATE)
|
||||||
|
private final TTextField subject;
|
||||||
|
@Getter(AccessLevel.PRIVATE)
|
||||||
|
private final TTextField totalComment;
|
||||||
|
|
||||||
|
public final TTextField today;
|
||||||
|
public final TTextField remains;
|
||||||
|
|
||||||
private TTextField flags = new TTextFieldForActivityPanel("Flags", "flags");
|
|
||||||
private TTextField subject = new TTextFieldForActivityPanel("", "subject");
|
|
||||||
private TTextField totalComment = new TTextFieldForActivityPanel("", "totalComment");
|
|
||||||
public TTextField today = new TTextFieldForActivityPanel("00:00", "today");
|
|
||||||
public TTextField remains = new TTextFieldForActivityPanel("00:00", "remains");
|
|
||||||
@Getter
|
@Getter
|
||||||
private boolean deleted;
|
private boolean deleted;
|
||||||
|
|
||||||
@ -92,6 +109,30 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
|
|
||||||
|
{
|
||||||
|
this.subject = new TTextFieldForActivityPanel("", "subject");
|
||||||
|
this.totalComment = new TTextFieldForActivityPanel("", "totalComment");
|
||||||
|
this.sortkey = new TTextFieldForActivityPanel("1", "sortkey", (a, r)->a.setSortkey(Integer.parseInt(r)), true);
|
||||||
|
this.name = new TTextFieldForActivityPanel("", "name", (a, r)->{a.setName(r);getSubject().setText(a.createSubject());}, false);
|
||||||
|
this.comment = new TTextFieldForActivityPanel("", "comment", (a, r)->{a.setComment(r);getTotalComment().setText(a.createTotalComment());}, false);
|
||||||
|
this.ticket = new TTextFieldForActivityPanel("", "ticket",
|
||||||
|
(a, r) -> {a.setTicket(r);
|
||||||
|
getSubject().setText(a.createSubject());
|
||||||
|
getTotalComment().setText(a.createTotalComment());}, false);
|
||||||
|
|
||||||
|
this.spentTime =
|
||||||
|
new TTextFieldForActivityPanel("00:00", "spentTime", (a, r) -> {
|
||||||
|
TTime spentTimeTTime = new TTime(r);
|
||||||
|
getActivity().setSpentHours(spentTimeTTime.getHour());
|
||||||
|
getActivity().setSpentMinutes(spentTimeTTime.getMinute());
|
||||||
|
getTotalComment().setText(getActivity().createTotalComment());
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
this.flags = new TTextFieldForActivityPanel("Flags", "flags", (a, r)->a.setFlags(r), false);
|
||||||
|
this.today = new TTextFieldForActivityPanel("00:00", "today");
|
||||||
|
this.remains = new TTextFieldForActivityPanel("00:00", "remains");
|
||||||
|
}
|
||||||
|
|
||||||
this.dayPanel = dayPanel;
|
this.dayPanel = dayPanel;
|
||||||
add(sortkey);
|
add(sortkey);
|
||||||
add(name);
|
add(name);
|
||||||
@ -110,17 +151,15 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
|
|
||||||
JButton copyButton = new SmallTButton("Copy");
|
JButton copyButton = new SmallTButton("Copy");
|
||||||
JButton deleteButton = new SmallTButton("Delete");
|
JButton deleteButton = new SmallTButton("Delete");
|
||||||
JButton subjectButton = new SmallTButton("Sub");
|
JButton moveButton = new SmallTButton("Move");
|
||||||
JButton totalCommentButton = new SmallTButton("TotCom");
|
|
||||||
add(copyButton);
|
add(copyButton);
|
||||||
add(deleteButton);
|
add(deleteButton);
|
||||||
add(subjectButton);
|
add(moveButton);
|
||||||
add(totalCommentButton);
|
|
||||||
|
|
||||||
copyButton.setFont(SwingUtils.SMALL_FONT);
|
copyButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
deleteButton.setFont(SwingUtils.SMALL_FONT);
|
deleteButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
subjectButton.setFont(SwingUtils.SMALL_FONT);
|
moveButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
totalCommentButton.setFont(SwingUtils.SMALL_FONT);
|
|
||||||
|
|
||||||
sortkey.setPreferredSize(PREFERRED_SIZE1);
|
sortkey.setPreferredSize(PREFERRED_SIZE1);
|
||||||
name.setPreferredSize(PREFERRED_SIZE);
|
name.setPreferredSize(PREFERRED_SIZE);
|
||||||
@ -136,100 +175,9 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
|
|
||||||
copyButton.setPreferredSize(PREFERRED_SIZE4);
|
copyButton.setPreferredSize(PREFERRED_SIZE4);
|
||||||
deleteButton.setPreferredSize(PREFERRED_SIZE4);
|
deleteButton.setPreferredSize(PREFERRED_SIZE4);
|
||||||
subjectButton.setPreferredSize(PREFERRED_SIZE4);
|
moveButton.setPreferredSize(PREFERRED_SIZE4);
|
||||||
totalCommentButton.setPreferredSize(PREFERRED_SIZE3);
|
|
||||||
this.setPreferredSize(new Dimension(getWidth(), 40));
|
this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||||
|
|
||||||
name.addMouseListener((MouseClickedListener) e -> {
|
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
|
||||||
null,
|
|
||||||
"Select new name",
|
|
||||||
"New name",
|
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
name.getText()
|
|
||||||
);
|
|
||||||
if (result != null) {
|
|
||||||
activity.setName(result);
|
|
||||||
activityRepository.update(activity);
|
|
||||||
name.setText(result);
|
|
||||||
subject.setText(activity.createSubject());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
comment.addMouseListener((MouseClickedListener) e -> {
|
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
|
||||||
null,
|
|
||||||
"Select new comment",
|
|
||||||
"New comment",
|
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
comment.getText()
|
|
||||||
);
|
|
||||||
if (result != null) {
|
|
||||||
activity.setComment(result);
|
|
||||||
activityRepository.update(activity);
|
|
||||||
comment.setText(result);
|
|
||||||
totalComment.setText(activity.createTotalComment());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ticket.addMouseListener((MouseClickedListener) e -> {
|
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
|
||||||
null,
|
|
||||||
"Select new ticket",
|
|
||||||
"New ticket",
|
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
ticket.getText()
|
|
||||||
);
|
|
||||||
if (result != null) {
|
|
||||||
activity.setTicket(result);
|
|
||||||
activityRepository.update(activity);
|
|
||||||
ticket.setText(result);
|
|
||||||
subject.setText(activity.createSubject());
|
|
||||||
totalComment.setText(activity.createTotalComment());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
spentTime.addMouseListener((MouseClickedListener) e -> {
|
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
|
||||||
null,
|
|
||||||
"Select new spent time",
|
|
||||||
"New spent time",
|
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
spentTime.getText()
|
|
||||||
);
|
|
||||||
if (result != null) {
|
|
||||||
TTime spentTimeTTime = new TTime(result);
|
|
||||||
activity.setSpentHours(spentTimeTTime.getHour());
|
|
||||||
activity.setSpentMinutes(spentTimeTTime.getMinute());
|
|
||||||
activityRepository.update(activity);
|
|
||||||
spentTime.setText(result);
|
|
||||||
totalComment.setText(activity.createTotalComment());
|
|
||||||
dayPanel.sortActivityPanels();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
flags.addMouseListener((MouseClickedListener) e -> {
|
|
||||||
String result = (String) JOptionPane.showInputDialog(
|
|
||||||
null,
|
|
||||||
"Select new flags",
|
|
||||||
"New flags",
|
|
||||||
JOptionPane.PLAIN_MESSAGE,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
flags.getText()
|
|
||||||
);
|
|
||||||
if (result != null) {
|
|
||||||
activity.setFlags(result);
|
|
||||||
activityRepository.update(activity);
|
|
||||||
flags.setText(result);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sortkey.setText(String.valueOf(activity.getSortkey()));
|
sortkey.setText(String.valueOf(activity.getSortkey()));
|
||||||
name.setText(activity.getName());
|
name.setText(activity.getName());
|
||||||
comment.setText(activity.getComment());
|
comment.setText(activity.getComment());
|
||||||
@ -245,14 +193,14 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
this.activityRepository = activityRepository;
|
this.activityRepository = activityRepository;
|
||||||
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
||||||
setAlignmentX(LEFT_ALIGNMENT);
|
setAlignmentX(LEFT_ALIGNMENT);
|
||||||
// moveThisButton.addActionListener(e-> {
|
// moveThisButton.addActionListener(e-> {
|
||||||
// //dayPanel.switchPositionsForThisActivityAndThePreviousActivity(getActivity());
|
// //dayPanel.switchPositionsForThisActivityAndThePreviousActivity(getActivity());
|
||||||
// //dayPanel.markActivityAsToBeMoved(getActivity());
|
// //dayPanel.markActivityAsToBeMoved(getActivity());
|
||||||
// });
|
// });
|
||||||
//
|
//
|
||||||
// moveBeforeButton.addActionListener(e-> {
|
// moveBeforeButton.addActionListener(e-> {
|
||||||
// //dayPanel.moveMarkedActivityBeforeThisActivity(getActivity());
|
// //dayPanel.moveMarkedActivityBeforeThisActivity(getActivity());
|
||||||
// });
|
// });
|
||||||
deleteButton.addActionListener(e -> {
|
deleteButton.addActionListener(e -> {
|
||||||
activityRepository.delete(this.activity.getId());
|
activityRepository.delete(this.activity.getId());
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
@ -261,13 +209,8 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
copyButton.addActionListener(e -> {
|
copyButton.addActionListener(e -> {
|
||||||
activityRepository.putToClipboard(this.activity);
|
activityRepository.putToClipboard(this.activity);
|
||||||
});
|
});
|
||||||
subjectButton.addActionListener(e-> {
|
moveButton.addActionListener(e-> {
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
this.dayPanel.markActivityPanelToBeMoved(this);
|
||||||
clipboard.setContents(new StringSelection(subject.getText()), null);
|
|
||||||
});
|
|
||||||
totalCommentButton.addActionListener(e-> {
|
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
|
||||||
clipboard.setContents(new StringSelection(totalComment.getText()), null);
|
|
||||||
});
|
});
|
||||||
dayPanel.sortActivityPanels();
|
dayPanel.sortActivityPanels();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import org.nanoboot.utils.timecalc.utils.common.Utils;
|
|||||||
|
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
@ -41,6 +42,7 @@ public class DayPanel extends JPanel {
|
|||||||
private JButton loadButton;
|
private JButton loadButton;
|
||||||
private JScrollPane scrollPane;
|
private JScrollPane scrollPane;
|
||||||
private JPanel panelInsideScrollPane;
|
private JPanel panelInsideScrollPane;
|
||||||
|
private ActivityPanel markActivityPanelToBeMoved = null;
|
||||||
|
|
||||||
public DayPanel(String yearIn, String monthIn, String dayIn,
|
public DayPanel(String yearIn, String monthIn, String dayIn,
|
||||||
ActivityRepositoryApi activityRepository) {
|
ActivityRepositoryApi activityRepository) {
|
||||||
@ -85,7 +87,7 @@ public class DayPanel extends JPanel {
|
|||||||
JButton newButton = new JButton("New");
|
JButton newButton = new JButton("New");
|
||||||
JButton pasteButton = new JButton("Paste");
|
JButton pasteButton = new JButton("Paste");
|
||||||
|
|
||||||
JButton reviewButton = new JButton("Review");
|
JButton reviewButton = new JButton("Copy all Total comments to clipboard");
|
||||||
JButton statusButton = new JButton("Status");
|
JButton statusButton = new JButton("Status");
|
||||||
buttons.add(newButton);
|
buttons.add(newButton);
|
||||||
buttons.add(pasteButton);
|
buttons.add(pasteButton);
|
||||||
@ -124,6 +126,7 @@ public class DayPanel extends JPanel {
|
|||||||
|
|
||||||
if(!list.isEmpty()) {
|
if(!list.isEmpty()) {
|
||||||
list.forEach(c->panelInsideScrollPane.remove(c));
|
list.forEach(c->panelInsideScrollPane.remove(c));
|
||||||
|
sortActivityPanels();
|
||||||
}
|
}
|
||||||
revalidate();
|
revalidate();
|
||||||
}).start();
|
}).start();
|
||||||
@ -159,14 +162,18 @@ public class DayPanel extends JPanel {
|
|||||||
revalidate();
|
revalidate();
|
||||||
});
|
});
|
||||||
reviewButton.addActionListener(e->{
|
reviewButton.addActionListener(e->{
|
||||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
String comments = Arrays
|
||||||
clipboard.setContents(new StringSelection(Arrays
|
|
||||||
.stream(panelInsideScrollPane.getComponents())
|
.stream(panelInsideScrollPane.getComponents())
|
||||||
.filter(c-> c instanceof ActivityPanel)
|
.filter(c-> c instanceof ActivityPanel)
|
||||||
.map(ap->((ActivityPanel) ap).getActivity())
|
.map(ap->((ActivityPanel) ap).getActivity())
|
||||||
.map(a->a.createTotalComment())
|
.map(a->a.createTotalComment())
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.joining("\n"))), null);
|
Collectors.joining("\n"));
|
||||||
|
JOptionPane
|
||||||
|
.showMessageDialog(null, comments, "All comments for: " + year + "-" + (month.length() < 2 ? "0" : "") + month + "-" + (day.length() < 2 ? "0" : "") + day , JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
|
||||||
|
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
|
clipboard.setContents(new StringSelection(comments), null);
|
||||||
});
|
});
|
||||||
statusButton.addActionListener(e-> {
|
statusButton.addActionListener(e-> {
|
||||||
List<ActivityPanel> activityPanels = new ArrayList<>();
|
List<ActivityPanel> activityPanels = new ArrayList<>();
|
||||||
@ -238,8 +245,12 @@ public class DayPanel extends JPanel {
|
|||||||
double now = ap.getActivity().getSpentHours() + ap.getActivity().getSpentMinutes() / 60d;
|
double now = ap.getActivity().getSpentHours() + ap.getActivity().getSpentMinutes() / 60d;
|
||||||
done = done + now;
|
done = done + now;
|
||||||
todo = todo - now;
|
todo = todo - now;
|
||||||
ap.today.setText(TTime.ofMilliseconds((int)(done * 60d * 60d * 1000d)).toString().substring(0,5));
|
TTime doneTTime =
|
||||||
ap.remains.setText(TTime.ofMilliseconds((int)(todo * 60d * 60d * 1000d)).toString().substring(0,5));
|
TTime.ofMilliseconds((int) (done * 60d * 60d * 1000d));
|
||||||
|
ap.today.setText(doneTTime.toString().substring(0,5));
|
||||||
|
TTime todoTTime =
|
||||||
|
TTime.ofMilliseconds((int) (todo * 60d * 60d * 1000d));
|
||||||
|
ap.remains.setText(todoTTime.toString().substring(0,todoTTime.isNegative() ? 6 : 5));
|
||||||
panelInsideScrollPane.add(ap);
|
panelInsideScrollPane.add(ap);
|
||||||
ap.setVisible(false);
|
ap.setVisible(false);
|
||||||
ap.setVisible(true);
|
ap.setVisible(true);
|
||||||
@ -249,4 +260,7 @@ public class DayPanel extends JPanel {
|
|||||||
revalidate();
|
revalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void markActivityPanelToBeMoved(ActivityPanel activityPanel) {
|
||||||
|
this.markActivityPanelToBeMoved = activityPanel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,10 @@ import org.nanoboot.utils.timecalc.utils.common.Jokes;
|
|||||||
import org.nanoboot.utils.timecalc.utils.common.TTime;
|
import org.nanoboot.utils.timecalc.utils.common.TTime;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Insets;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -105,6 +103,9 @@ public class MainWindow extends TWindow {
|
|||||||
|
|
||||||
public MainWindow(String startTimeIn, String overTimeIn,
|
public MainWindow(String startTimeIn, String overTimeIn,
|
||||||
TimeCalcApp timeCalcApp) {
|
TimeCalcApp timeCalcApp) {
|
||||||
|
// ToolTipManager ttm = ToolTipManager.sharedInstance();
|
||||||
|
// ttm.setInitialDelay(0);
|
||||||
|
// ttm.setDismissDelay(10000);
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user