Added several improvements, changes and bug fixes
This commit is contained in:
parent
95b4888ba9
commit
8787ba9551
@ -162,6 +162,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
||||
* L - hide or show progress circle
|
||||
* M - hide or show walking human
|
||||
* Y - hide or show smileys
|
||||
* Z - set forget overtime
|
||||
* LEFT - switch to previous profile
|
||||
* RIGHT - switch to next profile
|
||||
* K - hide or show clock
|
||||
|
@ -10,6 +10,7 @@ import org.nanoboot.utils.timecalc.utils.common.TTime;
|
||||
import org.nanoboot.utils.timecalc.utils.common.Utils;
|
||||
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.FileInputStream;
|
||||
@ -567,6 +568,36 @@ public class TimeCalcKeyAdapter extends KeyAdapter {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KeyEvent.VK_Z: {
|
||||
String newForgetOvertime = (String) JOptionPane.showInputDialog(
|
||||
null,
|
||||
"Set new forget overtime. Current value is: " + mainWindow.getForgetOvertime(),
|
||||
"New forget overtime",
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null,
|
||||
null,
|
||||
mainWindow.getForgetOvertime()
|
||||
);
|
||||
int newForgetOvertimeInt = -1;
|
||||
if(newForgetOvertime != null) {
|
||||
if(newForgetOvertime.contains(":")) {
|
||||
newForgetOvertimeInt = new TTime(newForgetOvertime).toTotalMilliseconds() / 1000 / 60;
|
||||
} else {
|
||||
try {
|
||||
newForgetOvertimeInt =
|
||||
Integer.parseInt(newForgetOvertime);
|
||||
} catch (Exception e) {
|
||||
Utils.showNotification(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(newForgetOvertimeInt >= 0) {
|
||||
mainWindow.setForgetOvertime(newForgetOvertimeInt);
|
||||
} else {
|
||||
Utils.showNotification("Error:Forget overtime must not be less than zero.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (!numberKeyWasPressed) {
|
||||
Utils.showNotification(
|
||||
|
@ -41,6 +41,7 @@ public class WorkingDay {
|
||||
private int pauseTimeInMinutes;
|
||||
private String note;
|
||||
private boolean timeOff;
|
||||
private int forgetOvertime;
|
||||
|
||||
public boolean isThisDayTimeOff() {
|
||||
return timeOff || this.note.equals(NODATA);
|
||||
|
@ -198,28 +198,29 @@ public class WorkingDayForStats extends WorkingDay {
|
||||
return acd;
|
||||
}
|
||||
|
||||
public WorkingDayForStats(WorkingDay workingDay) {
|
||||
this(workingDay.getId(),
|
||||
workingDay.getYear(),
|
||||
workingDay.getMonth(),
|
||||
workingDay.getDay(),
|
||||
workingDay.getArrivalHour(),
|
||||
workingDay.getArrivalMinute(),
|
||||
workingDay.getOvertimeHour(),
|
||||
workingDay.getOvertimeMinute(),
|
||||
workingDay.getWorkingTimeInMinutes(),
|
||||
workingDay.getPauseTimeInMinutes(),
|
||||
workingDay.getNote(),
|
||||
workingDay.isTimeOff());
|
||||
public WorkingDayForStats(WorkingDay wd) {
|
||||
this(wd.getId(),
|
||||
wd.getYear(),
|
||||
wd.getMonth(),
|
||||
wd.getDay(),
|
||||
wd.getArrivalHour(),
|
||||
wd.getArrivalMinute(),
|
||||
wd.getOvertimeHour(),
|
||||
wd.getOvertimeMinute(),
|
||||
wd.getWorkingTimeInMinutes(),
|
||||
wd.getPauseTimeInMinutes(),
|
||||
wd.getNote(),
|
||||
wd.isTimeOff(),
|
||||
wd.getForgetOvertime());
|
||||
}
|
||||
|
||||
public WorkingDayForStats(String id, int year, int month, int day,
|
||||
int arrivalHour, int arrivalMinute, int overtimeHour,
|
||||
int overtimeMinute, int workingTimeInMinutes,
|
||||
int pauseTimeInMinutes, String note, boolean timeOff) {
|
||||
int pauseTimeInMinutes, String note, boolean timeOff, int forgetOvertime) {
|
||||
super(id, year, month, day, arrivalHour, arrivalMinute, overtimeHour,
|
||||
overtimeMinute, workingTimeInMinutes, pauseTimeInMinutes, note,
|
||||
timeOff);
|
||||
timeOff, forgetOvertime);
|
||||
this.arrival = this.isThisDayTimeOff() ? null :
|
||||
new TTime(arrivalHour, arrivalMinute);
|
||||
this.overtime = this.isThisDayTimeOff() ? null :
|
||||
|
@ -35,7 +35,7 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
sb
|
||||
.append("INSERT INTO ")
|
||||
.append(WorkingDayTable.TABLE_NAME)
|
||||
.append(" VALUES (?,?,?,?, ?,?,?,?, ?,?,?,?)");
|
||||
.append(" VALUES (?,?,?,?, ?,?,?,?, ?,?,?,?,?)");
|
||||
|
||||
String sql = sb.toString();
|
||||
|
||||
@ -57,6 +57,7 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
stmt.setInt(++i, workingDay.getPauseTimeInMinutes());
|
||||
stmt.setString(++i, workingDay.getNote());
|
||||
stmt.setInt(++i, workingDay.isTimeOff() ? 1 : 0);
|
||||
stmt.setInt(++i, workingDay.getForgetOvertime());
|
||||
|
||||
//
|
||||
stmt.execute();
|
||||
@ -154,7 +155,8 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
.append(WorkingDayTable.WORKING_TIME_IN_MINUTES).append("=?, ")
|
||||
.append(WorkingDayTable.PAUSE_TIME_IN_MINUTES).append("=?, ")
|
||||
.append(WorkingDayTable.NOTE).append("=?, ")
|
||||
.append(WorkingDayTable.TIME_OFF).append("=? ")
|
||||
.append(WorkingDayTable.TIME_OFF).append("=?, ")
|
||||
.append(WorkingDayTable.FORGET_OVERTIME).append("=? ")
|
||||
.append(" WHERE ").append(
|
||||
WorkingDayTable.ID).append("=?");
|
||||
|
||||
@ -171,6 +173,7 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
stmt.setInt(++i, workingDay.getPauseTimeInMinutes());
|
||||
stmt.setString(++i, workingDay.getNote());
|
||||
stmt.setInt(++i, workingDay.isTimeOff() ? 1 : 0);
|
||||
stmt.setInt(++i, workingDay.getForgetOvertime());
|
||||
|
||||
stmt.setString(++i, workingDay.getId());
|
||||
|
||||
@ -204,7 +207,8 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
rs.getInt(WorkingDayTable.WORKING_TIME_IN_MINUTES),
|
||||
rs.getInt(WorkingDayTable.PAUSE_TIME_IN_MINUTES),
|
||||
rs.getString(WorkingDayTable.NOTE),
|
||||
rs.getInt(WorkingDayTable.TIME_OFF) != 0
|
||||
rs.getInt(WorkingDayTable.TIME_OFF) != 0,
|
||||
rs.getInt(WorkingDayTable.FORGET_OVERTIME)
|
||||
);
|
||||
}
|
||||
|
||||
@ -285,7 +289,7 @@ public class WorkingDayRepositorySQLiteImpl implements WorkingDayRepositoryApi {
|
||||
System.out.println("#"+year+month+day);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb
|
||||
.append("SELECT (sum(OVERTIME_HOUR)*60 + sum(OVERTIME_MINUTE)) as total_overtime FROM ")
|
||||
.append("SELECT (sum(OVERTIME_HOUR)*60 + sum(OVERTIME_MINUTE) - sum(FORGET_OVERTIME)) as total_overtime FROM ")
|
||||
.append(WorkingDayTable.TABLE_NAME)
|
||||
.append(" WHERE ")
|
||||
.append(WorkingDayTable.YEAR).append(" * 10000 + ")
|
||||
|
@ -39,6 +39,7 @@ public class WorkingDayTable {
|
||||
public static final String PAUSE_TIME_IN_MINUTES = "PAUSE_TIME_IN_MINUTES";
|
||||
public static final String NOTE = "NOTE";
|
||||
public static final String TIME_OFF = "TIME_OFF";
|
||||
public static final String FORGET_OVERTIME = "FORGET_OVERTIME";
|
||||
|
||||
private WorkingDayTable() {
|
||||
//Not meant to be instantiated.
|
||||
|
@ -23,7 +23,7 @@ public class ActivitiesWindow extends TWindow {
|
||||
private final Map<String, YearPanel> years;
|
||||
|
||||
public ActivitiesWindow(ActivityRepositoryApi activityRepositoryApiIn, Time time) {
|
||||
setSize(1200, 800);
|
||||
setSize(1600, 800);
|
||||
setTitle("Activities");
|
||||
this.activityRepository = activityRepositoryApiIn;
|
||||
|
||||
@ -51,7 +51,7 @@ public class ActivitiesWindow extends TWindow {
|
||||
add(exitButton);
|
||||
exitButton.addActionListener(e -> activitiesWindow.setVisible(false));
|
||||
|
||||
tp.setBounds(addYearButton.getX(), addYearButton.getY() + addYearButton.getHeight() + SwingUtils.MARGIN, 1180, 600);
|
||||
tp.setBounds(addYearButton.getX(), addYearButton.getY() + addYearButton.getHeight() + SwingUtils.MARGIN, 1500, 750);
|
||||
yearsList.forEach(y -> {
|
||||
final YearPanel yearPanel = new YearPanel(y, activityRepository);
|
||||
tp.add(y, yearPanel);
|
||||
|
@ -0,0 +1,95 @@
|
||||
package org.nanoboot.utils.timecalc.swing.common;
|
||||
|
||||
import org.nanoboot.utils.timecalc.entity.Activity;
|
||||
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
/**
|
||||
* @author Robert
|
||||
* @since 13.03.2024
|
||||
*/
|
||||
public class ActivityHeader extends JPanel {
|
||||
private static final Font FONT = new Font("sans", Font.BOLD, 12);
|
||||
private TTextField name = new TTextField("Name");
|
||||
private TTextField comment = new TTextField("Comment");
|
||||
private TTextField ticket = new TTextField("Ticket");
|
||||
private TTextField spentTime = new TTextField("Spent time");
|
||||
|
||||
private TTextField flags = new TTextField("Flags");
|
||||
private TTextField subject = new TTextField("Subject");
|
||||
private TTextField totalComment = new TTextField("Total comment");
|
||||
private TTextField today = new TTextField("Today");
|
||||
private TTextField remains = new TTextField("Remains");
|
||||
|
||||
public ActivityHeader() {
|
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
|
||||
add(name);
|
||||
add(comment);
|
||||
add(ticket);
|
||||
add(spentTime);
|
||||
|
||||
add(flags);
|
||||
add(subject);
|
||||
add(totalComment);
|
||||
add(today);
|
||||
add(remains);
|
||||
|
||||
name.setPreferredSize(new Dimension(200, 40));
|
||||
comment.setPreferredSize(new Dimension(200, 40));
|
||||
ticket.setPreferredSize(new Dimension(80, 40));
|
||||
spentTime.setPreferredSize(new Dimension(80, 40));
|
||||
|
||||
flags.setPreferredSize(new Dimension(100, 40));
|
||||
subject.setPreferredSize(new Dimension(100, 40));
|
||||
totalComment.setPreferredSize(new Dimension(100, 40));
|
||||
today.setPreferredSize(new Dimension(80, 40));
|
||||
remains.setPreferredSize(new Dimension(80, 40));
|
||||
|
||||
name.setEditable(false);
|
||||
comment.setEditable(false);
|
||||
ticket.setEditable(false);
|
||||
spentTime.setEditable(false);
|
||||
|
||||
flags.setEditable(false);
|
||||
subject.setEditable(false);
|
||||
totalComment.setEditable(false);
|
||||
today.setEditable(false);
|
||||
remains.setEditable(false);
|
||||
|
||||
name.setFont(FONT);
|
||||
comment.setFont(FONT);
|
||||
ticket.setFont(FONT);
|
||||
spentTime.setFont(FONT);
|
||||
|
||||
flags.setFont(FONT);
|
||||
subject.setFont(FONT);
|
||||
totalComment.setFont(FONT);
|
||||
today.setFont(FONT);
|
||||
remains.setFont(FONT);
|
||||
|
||||
name.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
comment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
ticket.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
spentTime.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
flags.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
subject.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
totalComment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
today.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
remains.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
||||
setAlignmentX(LEFT_ALIGNMENT);
|
||||
|
||||
}
|
||||
}
|
@ -17,45 +17,70 @@ import java.awt.event.MouseListener;
|
||||
* @since 13.03.2024
|
||||
*/
|
||||
public class ActivityPanel extends JPanel {
|
||||
|
||||
private final ActivityRepositoryApi activityRepository;
|
||||
private final Activity activity;
|
||||
private TTextField name = new TTextField("");
|
||||
private TTextField comment = new TTextField("");
|
||||
private TTextField ticket = new TTextField("");
|
||||
private TTextField spentHours = new TTextField("");
|
||||
private TTextField spentMinutes = new TTextField("");
|
||||
private TTextField flags = new TTextField("");
|
||||
private String nextActivityId;
|
||||
private TTextField spentTime = new TTextField("00:00");
|
||||
|
||||
public ActivityPanel(ActivityRepositoryApi activityRepository, Activity activity) {
|
||||
private TTextField flags = new TTextField("Flags");
|
||||
private TTextField subject = new TTextField("");
|
||||
private TTextField totalComment = new TTextField("");
|
||||
private TTextField today = new TTextField("00:00");
|
||||
private TTextField remains = new TTextField("00:00");
|
||||
|
||||
public ActivityPanel(ActivityRepositoryApi activityRepository,
|
||||
Activity activity) {
|
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
this.activity = activity;
|
||||
|
||||
add(name);
|
||||
add(comment);
|
||||
add(ticket);
|
||||
add(spentHours);
|
||||
add(spentMinutes);
|
||||
add(spentTime);
|
||||
|
||||
add(flags);
|
||||
name.setPreferredSize(new Dimension(400, 40));
|
||||
comment.setPreferredSize(new Dimension(400, 40));
|
||||
add(subject);
|
||||
add(totalComment);
|
||||
add(today);
|
||||
add(remains);
|
||||
|
||||
name.setPreferredSize(new Dimension(200, 40));
|
||||
comment.setPreferredSize(new Dimension(200, 40));
|
||||
ticket.setPreferredSize(new Dimension(80, 40));
|
||||
spentHours.setPreferredSize(new Dimension(25, 40));
|
||||
spentMinutes.setPreferredSize(new Dimension(25, 40));
|
||||
spentTime.setPreferredSize(new Dimension(80, 40));
|
||||
|
||||
flags.setPreferredSize(new Dimension(100, 40));
|
||||
this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||
subject.setPreferredSize(new Dimension(100, 40));
|
||||
totalComment.setPreferredSize(new Dimension(100, 40));
|
||||
today.setPreferredSize(new Dimension(80, 40));
|
||||
remains.setPreferredSize(new Dimension(80, 40));
|
||||
|
||||
this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||
|
||||
name.setEditable(false);
|
||||
comment.setEditable(false);
|
||||
ticket.setEditable(false);
|
||||
spentHours.setEditable(false);
|
||||
spentMinutes.setEditable(false);
|
||||
spentTime.setEditable(false);
|
||||
|
||||
flags.setEditable(false);
|
||||
subject.setEditable(false);
|
||||
totalComment.setEditable(false);
|
||||
today.setEditable(false);
|
||||
remains.setEditable(false);
|
||||
|
||||
name.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
comment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
ticket.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
spentHours.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
spentMinutes.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
spentTime.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
flags.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
subject.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
totalComment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
today.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
remains.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||
|
||||
name.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
@ -69,7 +94,7 @@ this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||
null,
|
||||
name.getText()
|
||||
);
|
||||
if(result != null) {
|
||||
if (result != null) {
|
||||
activity.setName(result);
|
||||
activityRepository.update(activity);
|
||||
name.setText(result);
|
||||
@ -99,11 +124,12 @@ this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||
name.setText(activity.getName());
|
||||
comment.setText(activity.getComment());
|
||||
ticket.setText(activity.getTicket());
|
||||
spentHours.setText(String.valueOf(activity.getSpentHours()));
|
||||
spentMinutes.setText(String.valueOf(activity.getSpentMinutes()));
|
||||
spentTime.setText((activity.getSpentHours() < 10 ? "0" : "") + activity
|
||||
.getSpentHours() + ":" + (activity.getSpentMinutes() < 10 ? "0" :
|
||||
"") + activity.getSpentMinutes());
|
||||
flags.setText(activity.getFlags());
|
||||
this.activityRepository = activityRepository;
|
||||
this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
||||
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
||||
setAlignmentX(LEFT_ALIGNMENT);
|
||||
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ package org.nanoboot.utils.timecalc.swing.common;
|
||||
import org.nanoboot.utils.timecalc.entity.Activity;
|
||||
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.util.HashMap;
|
||||
@ -35,7 +33,7 @@ public class DayPanel extends JPanel {
|
||||
this.month = monthIn;
|
||||
this.day = dayIn;
|
||||
this.activityRepository = activityRepository;
|
||||
setSize(1050, 600);
|
||||
setSize(1350, 600);
|
||||
|
||||
this.setLayout(null);
|
||||
this.loadButton = new JButton("Load");
|
||||
@ -64,7 +62,7 @@ public class DayPanel extends JPanel {
|
||||
this.setLayout(boxLayout);
|
||||
|
||||
JPanel buttons = new JPanel();
|
||||
buttons.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
|
||||
//buttons.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
|
||||
buttons.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||
buttons.setAlignmentX(LEFT_ALIGNMENT);
|
||||
JButton newButton = new JButton("New");
|
||||
@ -72,15 +70,30 @@ public class DayPanel extends JPanel {
|
||||
buttons.add(newButton);
|
||||
buttons.add(pasteButton);
|
||||
add(buttons);
|
||||
ActivityHeader activityHeader = new ActivityHeader();
|
||||
add(activityHeader);
|
||||
activityHeader.setMaximumSize(new Dimension(1200, 40));
|
||||
buttons.setMaximumSize(new Dimension(1000, 40));
|
||||
for (Activity a : activityRepository.list(
|
||||
Integer.valueOf(year),
|
||||
Integer.valueOf(month),
|
||||
Integer.valueOf(day))) {
|
||||
|
||||
ActivityPanel comp =
|
||||
new ActivityPanel(activityRepository, a);
|
||||
comp.setMaximumSize(new Dimension(1200, 40));
|
||||
add(comp);
|
||||
|
||||
}
|
||||
revalidate();
|
||||
newButton.addActionListener(e-> {
|
||||
Activity newActivity = new Activity(UUID.randomUUID().toString(), Integer.valueOf(year), Integer.valueOf(month), Integer.valueOf(day), "", "", "", 0, 0, "", null);
|
||||
ActivityPanel comp =
|
||||
new ActivityPanel(activityRepository, newActivity);
|
||||
comp.setMaximumSize(new Dimension(1000, 40));
|
||||
comp.setMaximumSize(new Dimension(1200, 40));
|
||||
add(comp);
|
||||
activityRepository.create(newActivity);
|
||||
repaint();
|
||||
revalidate();
|
||||
});
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// add(new ActivityPanel(activityRepository,
|
||||
|
@ -46,6 +46,7 @@ import org.nanoboot.utils.timecalc.entity.WorkingDay;
|
||||
import org.nanoboot.utils.timecalc.persistence.api.ActivityRepositoryApi;
|
||||
import org.nanoboot.utils.timecalc.persistence.impl.sqlite.ActivityRepositorySQLiteImpl;
|
||||
import org.nanoboot.utils.timecalc.persistence.impl.sqlite.WorkingDayRepositorySQLiteImpl;
|
||||
import org.nanoboot.utils.timecalc.utils.property.IntegerProperty;
|
||||
|
||||
/**
|
||||
* @author Robert Vokac
|
||||
@ -87,6 +88,8 @@ public class MainWindow extends TWindow {
|
||||
private boolean stopBeforeEnd = false;
|
||||
private final WorkingDayRepositorySQLiteImpl workingDayRepository;
|
||||
private final ActivityRepositoryApi activityRepository;
|
||||
|
||||
private final IntegerProperty forgetOvertimeProperty = new IntegerProperty("forgetOvertimeProperty", 0);
|
||||
|
||||
|
||||
{
|
||||
@ -660,6 +663,7 @@ public class MainWindow extends TWindow {
|
||||
workingDay.setPauseTimeInMinutes(pause_.toTotalMilliseconds() / 1000 / 60);
|
||||
workingDay.setNote(noteTextField.getText());
|
||||
workingDay.setTimeOff(timeOffCheckBox.isSelected());
|
||||
workingDay.setForgetOvertime(forgetOvertimeProperty.getValue());
|
||||
workingDayRepository.update(workingDay);
|
||||
|
||||
if(workingDaysWindow != null) {
|
||||
@ -674,6 +678,7 @@ public class MainWindow extends TWindow {
|
||||
pauseTimeTextField.valueProperty.setValue(TTime.ofMilliseconds(wd.getPauseTimeInMinutes() * 60 * 1000).toString().substring(0, 5));
|
||||
noteTextField.valueProperty.setValue(wd.getNote());
|
||||
timeOffCheckBox.setSelected(wd.isTimeOff());
|
||||
forgetOvertimeProperty.setValue(wd.getForgetOvertime());
|
||||
} else {
|
||||
Calendar cal = time.asCalendar();
|
||||
int year = cal.get(Calendar.YEAR);
|
||||
@ -1058,4 +1063,6 @@ public class MainWindow extends TWindow {
|
||||
public void doSaveButtonClick(){
|
||||
this.saveButton.doClick();
|
||||
}
|
||||
public int getForgetOvertime() {return this.forgetOvertimeProperty.getValue();}
|
||||
public void setForgetOvertime(int minutes) {this.forgetOvertimeProperty.setValue(minutes);}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class MonthPanel extends JPanel {
|
||||
setLayout(null);
|
||||
this.tp = new TTabbedPane();
|
||||
add(tp);
|
||||
tp.setBounds(0, 0, 1100, 650);
|
||||
tp.setBounds(0, 0, 1350, 650);
|
||||
|
||||
ChangeListener changeListener = new ChangeListener() {
|
||||
private boolean secondOrLaterChange = false;
|
||||
|
@ -334,7 +334,7 @@ public class WorkingDaysWindow extends TWindow {
|
||||
if (wd == null) {
|
||||
wd = new WorkingDay(WorkingDay.createId(year, month, day),
|
||||
year, month, day, -1, -1, -1, -1, -1, -1,
|
||||
"Fictive day", true);
|
||||
"Fictive day", true,0);
|
||||
}
|
||||
workingDaysList.add(wd);
|
||||
|
||||
@ -389,15 +389,17 @@ public class WorkingDaysWindow extends TWindow {
|
||||
.substring(0, overtime.isNegative() ? 6 : 5));
|
||||
list2.add(TTime.ofMinutes(wdfs.getWorkingTimeInMinutes())
|
||||
.toString().substring(0, 5));
|
||||
totalOvertime = totalOvertime + wdfs.getOvertimeHour() * 60 + wdfs.getOvertimeMinute();
|
||||
totalOvertime = totalOvertime + wdfs.getOvertimeHour() * 60 + wdfs.getOvertimeMinute() - wdfs.getForgetOvertime();
|
||||
list2.add(
|
||||
TTime.ofMinutes(wdfs.getPauseTimeInMinutes()).toString()
|
||||
.substring(0, 5));
|
||||
}
|
||||
list2.add(wdfs.getNote());
|
||||
list2.add(wdfs.isTimeOff() ? YES : NO);
|
||||
TTime forgetOvertime = TTime.ofMinutes(wdfs.getForgetOvertime());
|
||||
list2.add(forgetOvertime.toString().substring(0,5));
|
||||
TTime totalOvertimeTTime = TTime.ofMinutes(totalOvertime);
|
||||
list2.add((totalOvertimeTTime.getHour() < 10 ? "0" : "") + totalOvertimeTTime.getHour() + ":" + (totalOvertimeTTime.getMinute() < 10 ? "0" : "") + totalOvertimeTTime.getMinute());
|
||||
list2.add((totalOvertimeTTime.isNegative() ? "-" : "") + (totalOvertimeTTime.getHour() < 10 ? "0" : "") + totalOvertimeTTime.getHour() + ":" + (totalOvertimeTTime.getMinute() < 10 ? "0" : "") + totalOvertimeTTime.getMinute());
|
||||
list2.add(TTime.ofMilliseconds(
|
||||
(int) (wdfs.getArrivalTimeMovingAverage7Days() * 60d * 60d * 1000d)).toString().substring(0, 8));
|
||||
list2.add(TTime.ofMilliseconds(
|
||||
@ -421,7 +423,7 @@ public class WorkingDaysWindow extends TWindow {
|
||||
String[] columns =
|
||||
new String[] {"Day of Week", "Weekend", "Date", "Arrival",
|
||||
"Departure", "Overtime", "Working time", "Pause time",
|
||||
"Note", "Time off", "Total overtime", "Arrival MA7",
|
||||
"Note", "Time off", "Forget overtime", "Total overtime", "Arrival MA7",
|
||||
"Arrival MA14", "Arrival MA28", "Arrival MA56"};
|
||||
|
||||
if (table != null) {
|
||||
|
@ -26,7 +26,7 @@ public class YearPanel extends JPanel {
|
||||
setLayout(null);
|
||||
this.tp = new TTabbedPane();
|
||||
add(tp);
|
||||
tp.setBounds(0, 0, 1150, 700);
|
||||
tp.setBounds(0, 0, 1350, 700);
|
||||
|
||||
ChangeListener changeListener = new ChangeListener() {
|
||||
private boolean secondOrLaterChange = false;
|
||||
|
@ -0,0 +1 @@
|
||||
ALTER TABLE "WORKING_DAY" ADD COLUMN "FORGET_OVERTIME" TEXT DEFAULT 0 NOT NULL;
|
@ -162,6 +162,7 @@ Smileys can be colored or white-black (can be set in configuration)
|
||||
* L - hide or show progress circle
|
||||
* M - hide or show walking human
|
||||
* Y - hide or show smileys
|
||||
* Z - set forget overtime
|
||||
* LEFT - switch to previous profile
|
||||
* RIGHT - switch to next profile
|
||||
* K - hide or show clock
|
||||
|
Loading…
x
Reference in New Issue
Block a user