Commit be339d1d authored by Nils Vreman's avatar Nils Vreman
Browse files

Fixed offset error

parent a09e0786
...@@ -59,9 +59,15 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener ...@@ -59,9 +59,15 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener
revalidate(); revalidate();
} }
// Add empty if exists
if (empty.isPresent()) {
add(empty.get());
revalidate();
}
// This section fixes the offset from // This section fixes the offset from
// the lowest priority task to the Southern border. // the lowest priority task to the Southern border.
int taskOffset = priorities.size()*35; int taskOffset = (empty.isPresent()) ? (priorities.size() + 1)*35 : priorities.size()*35;
if (offset - taskOffset > 0) { if (offset - taskOffset > 0) {
setMaximumSize(new Dimension(300, 35 + taskOffset)); setMaximumSize(new Dimension(300, 35 + taskOffset));
add(createVerticalStrut(offset - taskOffset)); add(createVerticalStrut(offset - taskOffset));
...@@ -70,12 +76,6 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener ...@@ -70,12 +76,6 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener
// Mark the previously marked one. // Mark the previously marked one.
marked.ifPresent(taskGrid -> taskGrid.mark()); marked.ifPresent(taskGrid -> taskGrid.mark());
// Add empty if exists
if (empty.isPresent()) {
add(empty.get());
revalidate();
}
} }
/* /*
...@@ -128,8 +128,7 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener ...@@ -128,8 +128,7 @@ public class TasksetDisplay extends BoxPanel implements Observer, UpdateListener
emptyGrid.addEmptyListener(this); emptyGrid.addEmptyListener(this);
empty = Optional.of(emptyGrid); empty = Optional.of(emptyGrid);
add(emptyGrid); update(taskset, null);
revalidate();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment