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
f42c6333a6
commit
df75aeb966
@ -20,7 +20,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
public static final Dimension PREFERRED_SIZE4 = new Dimension(40, 40);
|
public static final Dimension PREFERRED_SIZE4 = new Dimension(40, 40);
|
||||||
public static final Dimension PREFERRED_SIZE2 = new Dimension(100, 40);
|
public static final Dimension PREFERRED_SIZE2 = new Dimension(100, 40);
|
||||||
|
|
||||||
private TTextField sortkey = new TTextField("Sortkey");
|
//private TTextField sortkey = new TTextField("Sortkey");
|
||||||
private TTextField name = new TTextField("Name");
|
private TTextField name = new TTextField("Name");
|
||||||
private TTextField comment = new TTextField("Comment");
|
private TTextField comment = new TTextField("Comment");
|
||||||
private TTextField ticket = new TTextField("Ticket");
|
private TTextField ticket = new TTextField("Ticket");
|
||||||
@ -35,7 +35,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
public ActivityHeader() {
|
public ActivityHeader() {
|
||||||
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||||
|
|
||||||
add(sortkey);
|
//add(sortkey);
|
||||||
add(name);
|
add(name);
|
||||||
add(comment);
|
add(comment);
|
||||||
add(ticket);
|
add(ticket);
|
||||||
@ -47,7 +47,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
add(done);
|
add(done);
|
||||||
add(todo);
|
add(todo);
|
||||||
|
|
||||||
sortkey.setPreferredSize(PREFERRED_SIZE1);
|
//sortkey.setPreferredSize(PREFERRED_SIZE1);
|
||||||
name.setPreferredSize(PREFERRED_SIZE);
|
name.setPreferredSize(PREFERRED_SIZE);
|
||||||
comment.setPreferredSize(PREFERRED_SIZE);
|
comment.setPreferredSize(PREFERRED_SIZE);
|
||||||
ticket.setPreferredSize(PREFERRED_SIZE1);
|
ticket.setPreferredSize(PREFERRED_SIZE1);
|
||||||
@ -59,7 +59,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
done.setPreferredSize(PREFERRED_SIZE3);
|
done.setPreferredSize(PREFERRED_SIZE3);
|
||||||
todo.setPreferredSize(PREFERRED_SIZE3);
|
todo.setPreferredSize(PREFERRED_SIZE3);
|
||||||
|
|
||||||
sortkey.setEditable(false);
|
//sortkey.setEditable(false);
|
||||||
name.setEditable(false);
|
name.setEditable(false);
|
||||||
comment.setEditable(false);
|
comment.setEditable(false);
|
||||||
ticket.setEditable(false);
|
ticket.setEditable(false);
|
||||||
@ -71,7 +71,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
done.setEditable(false);
|
done.setEditable(false);
|
||||||
todo.setEditable(false);
|
todo.setEditable(false);
|
||||||
|
|
||||||
sortkey.setFont(FONT);
|
//sortkey.setFont(FONT);
|
||||||
name.setFont(FONT);
|
name.setFont(FONT);
|
||||||
comment.setFont(FONT);
|
comment.setFont(FONT);
|
||||||
ticket.setFont(FONT);
|
ticket.setFont(FONT);
|
||||||
@ -83,7 +83,7 @@ public class ActivityHeader extends JPanel {
|
|||||||
done.setFont(FONT);
|
done.setFont(FONT);
|
||||||
todo.setFont(FONT);
|
todo.setFont(FONT);
|
||||||
|
|
||||||
sortkey.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
//sortkey.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||||
name.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
name.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||||
comment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
comment.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||||
ticket.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
ticket.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
||||||
@ -98,5 +98,6 @@ public class ActivityHeader extends JPanel {
|
|||||||
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
//this.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 1));
|
||||||
setAlignmentX(LEFT_ALIGNMENT);
|
setAlignmentX(LEFT_ALIGNMENT);
|
||||||
|
|
||||||
|
//sortkey.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import java.awt.FlowLayout;
|
|||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,7 +94,7 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
@Getter
|
@Getter
|
||||||
private final Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
private final TTextField sortkey;
|
//private final TTextField sortkey;
|
||||||
private final TTextField name;
|
private final TTextField name;
|
||||||
private final TTextField comment;
|
private final TTextField comment;
|
||||||
private final TTextField ticket;
|
private final TTextField ticket;
|
||||||
@ -121,7 +122,7 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
{
|
{
|
||||||
this.subject = new TTextFieldForActivityPanel("", "subject");
|
this.subject = new TTextFieldForActivityPanel("", "subject");
|
||||||
this.totalComment = new TTextFieldForActivityPanel("", "totalComment");
|
this.totalComment = new TTextFieldForActivityPanel("", "totalComment");
|
||||||
this.sortkey = new TTextFieldForActivityPanel("1", "sortkey", (a, r)->a.setSortkey(Integer.parseInt(r)), true);
|
//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.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.comment = new TTextFieldForActivityPanel("", "comment", (a, r)->{a.setComment(r);getTotalComment().setText(a.createTotalComment());}, false);
|
||||||
this.ticket = new TTextFieldForActivityPanel("", "ticket",
|
this.ticket = new TTextFieldForActivityPanel("", "ticket",
|
||||||
@ -143,7 +144,7 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.dayPanel = dayPanel;
|
this.dayPanel = dayPanel;
|
||||||
add(sortkey);
|
//add(sortkey);
|
||||||
add(name);
|
add(name);
|
||||||
add(comment);
|
add(comment);
|
||||||
add(ticket);
|
add(ticket);
|
||||||
@ -154,23 +155,27 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
add(totalComment);
|
add(totalComment);
|
||||||
add(today);
|
add(today);
|
||||||
add(remains);
|
add(remains);
|
||||||
|
//sortkey.setVisible(false);
|
||||||
name.setHorizontalAlignment(JTextField.LEFT);
|
name.setHorizontalAlignment(JTextField.LEFT);
|
||||||
comment.setHorizontalAlignment(JTextField.LEFT);
|
comment.setHorizontalAlignment(JTextField.LEFT);
|
||||||
ticket.setHorizontalAlignment(JTextField.LEFT);
|
ticket.setHorizontalAlignment(JTextField.LEFT);
|
||||||
|
|
||||||
JButton copyButton = new SmallTButton("Copy");
|
JButton copyButton = new SmallTButton("Copy");
|
||||||
JButton deleteButton = new SmallTButton("Delete");
|
JButton deleteButton = new SmallTButton("Delete");
|
||||||
JButton moveButton = new SmallTButton("Move");
|
JButton moveThisButton = new SmallTButton("Move this");
|
||||||
|
JButton moveBeforeButton = new SmallTButton("Move before");
|
||||||
|
|
||||||
add(copyButton);
|
add(copyButton);
|
||||||
add(deleteButton);
|
add(deleteButton);
|
||||||
add(moveButton);
|
add(moveThisButton);
|
||||||
|
add(moveBeforeButton);
|
||||||
|
|
||||||
copyButton.setFont(SwingUtils.SMALL_FONT);
|
copyButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
deleteButton.setFont(SwingUtils.SMALL_FONT);
|
deleteButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
moveButton.setFont(SwingUtils.SMALL_FONT);
|
moveThisButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
|
moveBeforeButton.setFont(SwingUtils.SMALL_FONT);
|
||||||
|
|
||||||
sortkey.setPreferredSize(PREFERRED_SIZE1);
|
//sortkey.setPreferredSize(PREFERRED_SIZE1);
|
||||||
name.setPreferredSize(PREFERRED_SIZE);
|
name.setPreferredSize(PREFERRED_SIZE);
|
||||||
comment.setPreferredSize(PREFERRED_SIZE);
|
comment.setPreferredSize(PREFERRED_SIZE);
|
||||||
ticket.setPreferredSize(PREFERRED_SIZE1);
|
ticket.setPreferredSize(PREFERRED_SIZE1);
|
||||||
@ -184,10 +189,11 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
|
|
||||||
copyButton.setPreferredSize(PREFERRED_SIZE4);
|
copyButton.setPreferredSize(PREFERRED_SIZE4);
|
||||||
deleteButton.setPreferredSize(PREFERRED_SIZE4);
|
deleteButton.setPreferredSize(PREFERRED_SIZE4);
|
||||||
moveButton.setPreferredSize(PREFERRED_SIZE4);
|
moveThisButton.setPreferredSize(PREFERRED_SIZE1);
|
||||||
|
moveBeforeButton.setPreferredSize(PREFERRED_SIZE1);
|
||||||
this.setPreferredSize(new Dimension(getWidth(), 40));
|
this.setPreferredSize(new Dimension(getWidth(), 40));
|
||||||
|
|
||||||
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());
|
||||||
ticket.setText(activity.getTicket());
|
ticket.setText(activity.getTicket());
|
||||||
@ -218,16 +224,74 @@ public class ActivityPanel extends JPanel implements Comparable<ActivityPanel> {
|
|||||||
copyButton.addActionListener(e -> {
|
copyButton.addActionListener(e -> {
|
||||||
activityRepository.putToClipboard(this.activity);
|
activityRepository.putToClipboard(this.activity);
|
||||||
});
|
});
|
||||||
moveButton.addActionListener(e-> {
|
moveThisButton.addActionListener(e-> {
|
||||||
this.dayPanel.markActivityPanelToBeMoved(this);
|
this.dayPanel.markActivityPanelToBeMoved(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
moveBeforeButton.addActionListener(e-> {
|
||||||
|
if(dayPanel.getMarkActivityPanelToBeMoved() == null) {
|
||||||
|
//nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Activity> list = dayPanel.getActivities();
|
||||||
|
Activity activityToBeMoved = activityRepository.read(dayPanel.getMarkActivityPanelToBeMoved().getActivity().getId());
|
||||||
|
Activity activityTarget = activityRepository.read(activity.getId());
|
||||||
|
int activityTargetSortkey = activityTarget.getSortkey();
|
||||||
|
int newSortKey = activityToBeMoved.getSortkey();
|
||||||
|
for(int i = 0; i < list.size(); i++) {
|
||||||
|
if(activityToBeMoved.getSortkey() == activityTarget.getSortkey()) {
|
||||||
|
//nothing to do
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(i >= 1 && activityToBeMoved.getSortkey() == activityTarget.getSortkey()) {
|
||||||
|
//nothing to do
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(list.get(i).getId().equals(activityTarget.getId())) {
|
||||||
|
Activity activityBefore = i == 0 ? null : list.get(i - 1);
|
||||||
|
if(activityBefore != null && activityBefore.getId().equals(activityToBeMoved.getId())) {
|
||||||
|
//nothing to do
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int activityBeforeSortkey = activityBefore == null ? activityTargetSortkey : activityBefore.getSortkey();
|
||||||
|
int start = activityBeforeSortkey + 1;
|
||||||
|
int end = activityTargetSortkey - 1;
|
||||||
|
if(start > end) {
|
||||||
|
start = end;
|
||||||
|
}
|
||||||
|
if(start == end) {
|
||||||
|
newSortKey = end;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newSortKey = start + (end - start) / 2;
|
||||||
|
if(newSortKey > activityTargetSortkey) {
|
||||||
|
newSortKey = activityTargetSortkey;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
int oldSortkey = activityToBeMoved.getSortkey();
|
||||||
|
if(oldSortkey != newSortKey) {
|
||||||
|
activityToBeMoved.setSortkey(newSortKey);
|
||||||
|
}
|
||||||
|
ActivityPanel activityPanelForActivity =
|
||||||
|
dayPanel.getActivityPanelForActivity(activityToBeMoved);
|
||||||
|
activityPanelForActivity.getActivity().setSortkey(newSortKey);
|
||||||
|
// activityPanelForActivity.getSortkeyTTextField().setText(
|
||||||
|
// String.valueOf(newSortKey));
|
||||||
|
activityRepository.update(activityToBeMoved);
|
||||||
|
dayPanel.sortActivityPanels();
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ActivityPanel o) {
|
public int compareTo(ActivityPanel o) {
|
||||||
return this.getActivity().compareTo(o.getActivity());
|
return this.getActivity().compareTo(o.getActivity());
|
||||||
}
|
}
|
||||||
public TTextField getSortkeyTTextField() {
|
// public TTextField getSortkeyTTextField() {
|
||||||
return sortkey;
|
// return sortkey;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.nanoboot.utils.timecalc.swing.common;
|
package org.nanoboot.utils.timecalc.swing.common;
|
||||||
|
|
||||||
|
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;
|
||||||
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
|
import org.nanoboot.utils.timecalc.utils.common.NumberFormats;
|
||||||
@ -44,66 +45,9 @@ public class DayPanel extends JPanel {
|
|||||||
private JButton loadButton;
|
private JButton loadButton;
|
||||||
private JScrollPane scrollPane;
|
private JScrollPane scrollPane;
|
||||||
private JPanel panelInsideScrollPane;
|
private JPanel panelInsideScrollPane;
|
||||||
|
@Getter
|
||||||
private ActivityPanel markActivityPanelToBeMoved = null;
|
private ActivityPanel markActivityPanelToBeMoved = null;
|
||||||
|
|
||||||
class MoveHereButton extends JButton {
|
|
||||||
public MoveHereButton(String activityId) {
|
|
||||||
setText("Move here");
|
|
||||||
setMaximumSize(MAXIMUM_SIZE_2);
|
|
||||||
putClientProperty(FOR_ACTIVITY_ID, activityId);
|
|
||||||
setVisible(true);
|
|
||||||
addActionListener(e-> {
|
|
||||||
List<Activity> list = getActivities();
|
|
||||||
Activity activityToBeMoved = activityRepository.read(markActivityPanelToBeMoved.getActivity().getId());
|
|
||||||
Activity activityTarget = activityRepository.read(activityId);
|
|
||||||
int activityTargetSortkey = activityTarget.getSortkey();
|
|
||||||
int newSortKey = activityToBeMoved.getSortkey();
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
|
||||||
if(activityToBeMoved.getSortkey() == activityTarget.getSortkey()) {
|
|
||||||
//nothing to do
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(i >= 1 && activityToBeMoved.getSortkey() == activityTarget.getSortkey()) {
|
|
||||||
//nothing to do
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(list.get(i).getId().equals(activityTarget.getId())) {
|
|
||||||
Activity activityBefore = i == 0 ? null : list.get(i - 1);
|
|
||||||
int activityBeforeSortkey = activityBefore == null ? activityTargetSortkey : activityBefore.getSortkey();
|
|
||||||
int start = activityBeforeSortkey + 1;
|
|
||||||
int end = activityTargetSortkey - 1;
|
|
||||||
if(start > end) {
|
|
||||||
start = end;
|
|
||||||
}
|
|
||||||
if(start == end) {
|
|
||||||
newSortKey = end;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
newSortKey = start + (end - start) / 2;
|
|
||||||
if(newSortKey > activityTargetSortkey) {
|
|
||||||
newSortKey = activityTargetSortkey;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
activityToBeMoved.setSortkey(newSortKey);
|
|
||||||
ActivityPanel activityPanelForActivity =
|
|
||||||
getActivityPanelForActivity(activityToBeMoved);
|
|
||||||
activityPanelForActivity.getActivity().setSortkey(newSortKey);
|
|
||||||
activityPanelForActivity.getSortkeyTTextField().setText(
|
|
||||||
String.valueOf(newSortKey));
|
|
||||||
activityRepository.update(activityToBeMoved);
|
|
||||||
sortActivityPanels();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public String getActivityId() {
|
|
||||||
return (String) getClientProperty(FOR_ACTIVITY_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DayPanel(String yearIn, String monthIn, String dayIn,
|
public DayPanel(String yearIn, String monthIn, String dayIn,
|
||||||
ActivityRepositoryApi activityRepository) {
|
ActivityRepositoryApi activityRepository) {
|
||||||
super();
|
super();
|
||||||
@ -190,11 +134,6 @@ public class DayPanel extends JPanel {
|
|||||||
comp.setMaximumSize(new Dimension(1300, 40));
|
comp.setMaximumSize(new Dimension(1300, 40));
|
||||||
add(comp);
|
add(comp);
|
||||||
activityRepository.create(newActivity);
|
activityRepository.create(newActivity);
|
||||||
if(this.markActivityPanelToBeMoved != null) {
|
|
||||||
panelInsideScrollPane.add(new MoveHereButton(newActivity.getId()));
|
|
||||||
} else {
|
|
||||||
//comp.setBorder(BorderFactory.createEmptyBorder(0, 0, 20, 0));
|
|
||||||
}
|
|
||||||
panelInsideScrollPane.add(comp);
|
panelInsideScrollPane.add(comp);
|
||||||
|
|
||||||
revalidate();
|
revalidate();
|
||||||
@ -212,11 +151,7 @@ public class DayPanel extends JPanel {
|
|||||||
comp.setMaximumSize(new Dimension(1200, 40));
|
comp.setMaximumSize(new Dimension(1200, 40));
|
||||||
add(comp);
|
add(comp);
|
||||||
activityRepository.create(newActivity);
|
activityRepository.create(newActivity);
|
||||||
if(this.markActivityPanelToBeMoved != null) {
|
|
||||||
panelInsideScrollPane.add(new MoveHereButton(newActivity.getId()));
|
|
||||||
} else {
|
|
||||||
//comp.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
|
|
||||||
}
|
|
||||||
panelInsideScrollPane.add(comp);
|
panelInsideScrollPane.add(comp);
|
||||||
|
|
||||||
revalidate();
|
revalidate();
|
||||||
@ -296,11 +231,7 @@ public class DayPanel extends JPanel {
|
|||||||
.stream(panelInsideScrollPane.getComponents())
|
.stream(panelInsideScrollPane.getComponents())
|
||||||
.filter(c-> c instanceof ActivityPanel).filter(c-> !((ActivityPanel)c).isDeleted()).forEach(e-> list.add((ActivityPanel) e));
|
.filter(c-> c instanceof ActivityPanel).filter(c-> !((ActivityPanel)c).isDeleted()).forEach(e-> list.add((ActivityPanel) e));
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
Arrays
|
|
||||||
.stream(panelInsideScrollPane.getComponents())
|
|
||||||
.filter(c-> {return (c instanceof MoveHereButton);}).forEach(c-> panelInsideScrollPane.remove(c));
|
|
||||||
|
|
||||||
//.filter(c -> getClientProperty( FOR_ACTIVITY_ID) != null)
|
|
||||||
for(ActivityPanel ap:list) {
|
for(ActivityPanel ap:list) {
|
||||||
panelInsideScrollPane.remove(ap);
|
panelInsideScrollPane.remove(ap);
|
||||||
}
|
}
|
||||||
@ -324,7 +255,7 @@ public class DayPanel extends JPanel {
|
|||||||
sortkey = sortkey + sortkeySpace;
|
sortkey = sortkey + sortkeySpace;
|
||||||
ap.getActivity().setSortkey(sortkey);
|
ap.getActivity().setSortkey(sortkey);
|
||||||
activityRepository.update(ap.getActivity());
|
activityRepository.update(ap.getActivity());
|
||||||
ap.getSortkeyTTextField().setText(String.valueOf(sortkey));
|
// ap.getSortkeyTTextField().setText(String.valueOf(sortkey));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,16 +271,7 @@ public class DayPanel extends JPanel {
|
|||||||
TTime todoTTime =
|
TTime todoTTime =
|
||||||
TTime.ofMilliseconds((int) (todo * 60d * 60d * 1000d));
|
TTime.ofMilliseconds((int) (todo * 60d * 60d * 1000d));
|
||||||
ap.remains.setText(todoTTime.toString().substring(0,todoTTime.isNegative() ? 6 : 5));
|
ap.remains.setText(todoTTime.toString().substring(0,todoTTime.isNegative() ? 6 : 5));
|
||||||
{
|
|
||||||
if(this.markActivityPanelToBeMoved != null) {
|
|
||||||
MoveHereButton mhb =
|
|
||||||
new MoveHereButton(ap.getActivity().getId());
|
|
||||||
panelInsideScrollPane.add(mhb);
|
|
||||||
} else {
|
|
||||||
// Component mhb = new MoveHereButton(ap.getActivity().getId());
|
|
||||||
// panelInsideScrollPane.add(mhb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
panelInsideScrollPane.add(ap);
|
panelInsideScrollPane.add(ap);
|
||||||
ap.setVisible(false);
|
ap.setVisible(false);
|
||||||
ap.setVisible(true);
|
ap.setVisible(true);
|
||||||
@ -361,19 +283,9 @@ public class DayPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void markActivityPanelToBeMoved(ActivityPanel activityPanel) {
|
public void markActivityPanelToBeMoved(ActivityPanel activityPanel) {
|
||||||
boolean moveHereButtonsExist = Arrays
|
|
||||||
.stream(panelInsideScrollPane.getComponents())
|
|
||||||
.filter(c-> {return (c instanceof MoveHereButton);}).findFirst().isPresent();
|
|
||||||
boolean deletion = this.markActivityPanelToBeMoved == activityPanel;
|
boolean deletion = this.markActivityPanelToBeMoved == activityPanel;
|
||||||
boolean enabling = this.markActivityPanelToBeMoved == null && activityPanel != null;
|
|
||||||
this.markActivityPanelToBeMoved = deletion ? null : activityPanel;
|
this.markActivityPanelToBeMoved = deletion ? null : activityPanel;
|
||||||
if(moveHereButtonsExist && deletion) {
|
this.markActivityPanelToBeMoved = activityPanel;
|
||||||
sortActivityPanels();
|
|
||||||
}
|
|
||||||
if(!moveHereButtonsExist && enabling) {
|
|
||||||
sortActivityPanels();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user