commit
28dbeadfbd
6 changed files with 140 additions and 134 deletions
|
|
@ -31,6 +31,7 @@ public class TaskRow extends XulElement {
|
||||||
public static <T extends TaskComponent> T wrapInRow(T taskComponent) {
|
public static <T extends TaskComponent> T wrapInRow(T taskComponent) {
|
||||||
TaskRow parent = new TaskRow();
|
TaskRow parent = new TaskRow();
|
||||||
parent.appendChild(taskComponent);
|
parent.appendChild(taskComponent);
|
||||||
|
|
||||||
return taskComponent;
|
return taskComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
<!-- When the version is changed, the browser will reload the
|
<!-- When the version is changed, the browser will reload the
|
||||||
JavaScript modules. -->
|
JavaScript modules. -->
|
||||||
<javascript-module name="ganttz" version="1.4.0" />
|
<javascript-module name="ganttz" version="1.6.0" />
|
||||||
<javascript-module name="ganttz.resourceload" version="1.4.0" />
|
<javascript-module name="ganttz.resourceload" version="1.6.0" />
|
||||||
<javascript-module name="common" version="1.4.0" />
|
<javascript-module name="common" version="1.6.0" />
|
||||||
|
|
||||||
<extension>zul</extension>
|
<extension>zul</extension>
|
||||||
<extension>xul</extension>
|
<extension>xul</extension>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,34 @@
|
||||||
zk.$package("ganttz");
|
zk.$package("ganttz");
|
||||||
|
|
||||||
ganttz.TimeTracker = zk.$extends(zk.Macro,{
|
ganttz.TimeTracker = zk.$extends(
|
||||||
$init : function(){
|
|
||||||
this.$supers('$init', arguments);
|
zk.Macro,{
|
||||||
this.$class.setInstance(this);
|
$init : function(){
|
||||||
|
this.$supers('$init', arguments);
|
||||||
|
this.$class.setInstance(this);
|
||||||
|
},
|
||||||
|
|
||||||
|
bind_ : function (){
|
||||||
|
this.$supers('bind_', arguments);
|
||||||
|
this._timetrackerGap = jq('.timetrackergap');
|
||||||
|
this._timetrackerHeader = jq('#timetrackerheader .z-vbox');
|
||||||
|
},
|
||||||
|
|
||||||
|
realWidth : function(){
|
||||||
|
return this._timetrackerHeader.width();
|
||||||
|
},
|
||||||
|
|
||||||
|
scrollLeft : function(ammount){
|
||||||
|
this._timetrackerGap.css({left : -ammount});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
bind_ : function (){
|
|
||||||
this.$supers('bind_', arguments);
|
{
|
||||||
this._timetrackerGap = jq('.timetrackergap');
|
getInstance : function(){
|
||||||
this._timetrackerHeader = jq('#timetrackerheader .z-vbox');
|
return this._instance;
|
||||||
},
|
},
|
||||||
realWidth : function(){
|
|
||||||
return this._timetrackerHeader.width();
|
setInstance : function(instance){
|
||||||
},
|
this._instance = instance;
|
||||||
scrollLeft : function(ammount){
|
}
|
||||||
this._timetrackerGap.css({left : -ammount});
|
})
|
||||||
}
|
|
||||||
},{
|
|
||||||
getInstance : function(){
|
|
||||||
return this._instance;
|
|
||||||
},
|
|
||||||
setInstance : function(instance){
|
|
||||||
this._instance = instance;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
@ -56,6 +56,7 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void aMutableTreeModelCanBeCreatedPassingType() {
|
public void aMutableTreeModelCanBeCreatedPassingType() {
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
|
|
||||||
assertNotNull(model);
|
assertNotNull(model);
|
||||||
assertNull(model.getRoot());
|
assertNull(model.getRoot());
|
||||||
}
|
}
|
||||||
|
|
@ -63,8 +64,8 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void aMutableTreeModelCanBeCreatedPassingTypeAndRootObject() {
|
public void aMutableTreeModelCanBeCreatedPassingTypeAndRootObject() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
assertNotNull(model);
|
assertNotNull(model);
|
||||||
assertThat(model.getRoot(), equalTo(root));
|
assertThat(model.getRoot(), equalTo(root));
|
||||||
}
|
}
|
||||||
|
|
@ -72,12 +73,12 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void childrenCanBeAdded() {
|
public void childrenCanBeAdded() {
|
||||||
Prueba prueba = new Prueba();
|
Prueba prueba = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, prueba);
|
||||||
prueba);
|
|
||||||
Prueba other = new Prueba();
|
Prueba other = new Prueba();
|
||||||
model.add(model.getRoot(), other);
|
model.add(model.getRoot(), other);
|
||||||
Prueba otherChild = new Prueba();
|
Prueba otherChild = new Prueba();
|
||||||
model.addToRoot(otherChild);
|
model.addToRoot(otherChild);
|
||||||
|
|
||||||
assertThat(model.getChildCount(model.getRoot()), equalTo(2));
|
assertThat(model.getChildCount(model.getRoot()), equalTo(2));
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(other));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(other));
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(otherChild));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(otherChild));
|
||||||
|
|
@ -86,10 +87,10 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void testLeaf() {
|
public void testLeaf() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba other = new Prueba();
|
Prueba other = new Prueba();
|
||||||
model.add(model.getRoot(), other);
|
model.add(model.getRoot(), other);
|
||||||
|
|
||||||
assertTrue(model.isLeaf(other));
|
assertTrue(model.isLeaf(other));
|
||||||
assertFalse(model.isLeaf(root));
|
assertFalse(model.isLeaf(root));
|
||||||
}
|
}
|
||||||
|
|
@ -97,11 +98,11 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void childAddedCanBeFoundUsingGetPath() {
|
public void childAddedCanBeFoundUsingGetPath() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
int[] path = model.getPath(model.getRoot(), child);
|
int[] path = model.getPath(model.getRoot(), child);
|
||||||
|
|
||||||
assertThat(path.length, equalTo(1));
|
assertThat(path.length, equalTo(1));
|
||||||
assertThat(path[0], equalTo(0));
|
assertThat(path[0], equalTo(0));
|
||||||
}
|
}
|
||||||
|
|
@ -109,42 +110,42 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void getPathReturnsEmptyArrayWhenParentNotFound() {
|
public void getPathReturnsEmptyArrayWhenParentNotFound() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
|
|
||||||
assertThat(model.getPath(null, child), equalTo(new int[0]));
|
assertThat(model.getPath(null, child), equalTo(new int[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getPathReturnsEmptyArrayWhenChildNotFound() {
|
public void getPathReturnsEmptyArrayWhenChildNotFound() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
|
|
||||||
assertThat(model.getPath(root, new Prueba()), equalTo(new int[0]));
|
assertThat(model.getPath(root, new Prueba()), equalTo(new int[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ifThereisNotPathReturnEmptyArray() {
|
public void ifThereisNotPathReturnEmptyArray() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
|
|
||||||
assertThat(model.getPath(child, root), equalTo(new int[0]));
|
assertThat(model.getPath(child, root), equalTo(new int[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hasMethodGetParentToMakeNavigationEasier() {
|
public void hasMethodGetParentToMakeNavigationEasier() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
Prueba grandChild = new Prueba();
|
Prueba grandChild = new Prueba();
|
||||||
model.add(child, grandChild);
|
model.add(child, grandChild);
|
||||||
|
|
||||||
assertThat(model.getParent(grandChild), equalTo(child));
|
assertThat(model.getParent(grandChild), equalTo(child));
|
||||||
assertThat(model.getParent(child), equalTo(root));
|
assertThat(model.getParent(child), equalTo(root));
|
||||||
}
|
}
|
||||||
|
|
@ -152,13 +153,13 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void hasMethodGetAllParentsUntilRoot() {
|
public void hasMethodGetAllParentsUntilRoot() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(root, child);
|
model.add(root, child);
|
||||||
Prueba grandChild = new Prueba();
|
Prueba grandChild = new Prueba();
|
||||||
model.add(child, grandChild);
|
model.add(child, grandChild);
|
||||||
List<Prueba> parents = model.getParents(grandChild);
|
List<Prueba> parents = model.getParents(grandChild);
|
||||||
|
|
||||||
assertThat(parents.size(), equalTo(2));
|
assertThat(parents.size(), equalTo(2));
|
||||||
assertThat(parents, equalTo(Arrays.asList(child, root)));
|
assertThat(parents, equalTo(Arrays.asList(child, root)));
|
||||||
}
|
}
|
||||||
|
|
@ -166,16 +167,14 @@ public class MutableTreeModelTest {
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void findObjectAtInvalidPath() {
|
public void findObjectAtInvalidPath() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
model.findObjectAt(0, 1);
|
model.findObjectAt(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void findObjectAtInvalidPathInTheMiddle() {
|
public void findObjectAtInvalidPathInTheMiddle() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
Prueba p1 = new Prueba();
|
Prueba p1 = new Prueba();
|
||||||
model.addToRoot(p1);
|
model.addToRoot(p1);
|
||||||
model.addToRoot(new Prueba());
|
model.addToRoot(new Prueba());
|
||||||
|
|
@ -186,8 +185,7 @@ public class MutableTreeModelTest {
|
||||||
@Test
|
@Test
|
||||||
public void findAtPathCanReceiveGetPathResult() {
|
public void findAtPathCanReceiveGetPathResult() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
assertTrue(canBeRetrievedWithGetPath(model, model.getRoot()));
|
assertTrue(canBeRetrievedWithGetPath(model, model.getRoot()));
|
||||||
model.addToRoot(new Prueba());
|
model.addToRoot(new Prueba());
|
||||||
Prueba p2 = new Prueba();
|
Prueba p2 = new Prueba();
|
||||||
|
|
@ -195,55 +193,54 @@ public class MutableTreeModelTest {
|
||||||
assertTrue(canBeRetrievedWithGetPath(model, p2));
|
assertTrue(canBeRetrievedWithGetPath(model, p2));
|
||||||
Prueba grandChild = new Prueba();
|
Prueba grandChild = new Prueba();
|
||||||
model.add(p2, grandChild);
|
model.add(p2, grandChild);
|
||||||
|
|
||||||
assertTrue(canBeRetrievedWithGetPath(model, grandChild));
|
assertTrue(canBeRetrievedWithGetPath(model, grandChild));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> boolean canBeRetrievedWithGetPath(
|
private static <T> boolean canBeRetrievedWithGetPath(final MutableTreeModel<T> tree, T object) {
|
||||||
final MutableTreeModel<T> tree, T object) {
|
|
||||||
int[] path = tree.getPath(object);
|
int[] path = tree.getPath(object);
|
||||||
|
|
||||||
return tree.findObjectAt(path).equals(object);
|
return tree.findObjectAt(path).equals(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void getParentOfRootThrowsException() {
|
public void getParentOfRootThrowsException() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
model.getParent(root);
|
model.getParent(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addingTriggersEvent() {
|
public void addingTriggersEvent() {
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<TreeDataEvent>();
|
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
eventsFired.add(event);
|
eventsFired.add(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Prueba child1 = new Prueba();
|
Prueba child1 = new Prueba();
|
||||||
Prueba child2 = new Prueba();
|
Prueba child2 = new Prueba();
|
||||||
Prueba granChildren1 = new Prueba();
|
Prueba granChildren1 = new Prueba();
|
||||||
model.add(model.getRoot(), child1);
|
model.add(model.getRoot(), child1);
|
||||||
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model
|
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0);
|
||||||
.getRoot(), 0);
|
|
||||||
model.add(model.getRoot(), child2);
|
model.add(model.getRoot(), child2);
|
||||||
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model
|
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 1);
|
||||||
.getRoot(), 1);
|
|
||||||
model.add(child1, granChildren1);
|
model.add(child1, granChildren1);
|
||||||
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED,
|
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, child1, 0);
|
||||||
child1, 0);
|
|
||||||
assertThat(eventsFired.size(), equalTo(3));
|
assertThat(eventsFired.size(), equalTo(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canAddSeveral() {
|
public void canAddSeveral() {
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<TreeDataEvent>();
|
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
eventsFired.add(event);
|
eventsFired.add(event);
|
||||||
|
|
@ -253,7 +250,9 @@ public class MutableTreeModelTest {
|
||||||
Prueba child1 = new Prueba();
|
Prueba child1 = new Prueba();
|
||||||
Prueba child2 = new Prueba();
|
Prueba child2 = new Prueba();
|
||||||
model.add(model.getRoot(), Arrays.asList(child1, child2));
|
model.add(model.getRoot(), Arrays.asList(child1, child2));
|
||||||
|
|
||||||
assertThat(eventsFired.size(), equalTo(1));
|
assertThat(eventsFired.size(), equalTo(1));
|
||||||
|
|
||||||
TreeDataEvent event = getLast(eventsFired);
|
TreeDataEvent event = getLast(eventsFired);
|
||||||
checkIsValid(event, TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0, 1);
|
checkIsValid(event, TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -266,6 +265,7 @@ public class MutableTreeModelTest {
|
||||||
Prueba p2 = new Prueba();
|
Prueba p2 = new Prueba();
|
||||||
Prueba p3 = new Prueba();
|
Prueba p3 = new Prueba();
|
||||||
model.add(model.getRoot(), 0, Arrays.asList(p2, p3));
|
model.add(model.getRoot(), 0, Arrays.asList(p2, p3));
|
||||||
|
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(p2));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(p2));
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(p3));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(p3));
|
||||||
assertThat(model.getChild(model.getRoot(), 2), equalTo(p1));
|
assertThat(model.getChild(model.getRoot(), 2), equalTo(p1));
|
||||||
|
|
@ -276,17 +276,16 @@ public class MutableTreeModelTest {
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
Prueba p1 = new Prueba();
|
Prueba p1 = new Prueba();
|
||||||
model.add(model.getRoot(), p1);
|
model.add(model.getRoot(), p1);
|
||||||
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<TreeDataEvent>();
|
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
eventsFired.add(event);
|
eventsFired.add(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
model
|
|
||||||
.add(model.getRoot(), 0, Arrays.asList(new Prueba(),
|
model.add(model.getRoot(), 0, Arrays.asList(new Prueba(), new Prueba()));
|
||||||
new Prueba()));
|
|
||||||
TreeDataEvent event = getLast(eventsFired);
|
TreeDataEvent event = getLast(eventsFired);
|
||||||
checkIsValid(event, TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0, 1);
|
checkIsValid(event, TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -297,21 +296,24 @@ public class MutableTreeModelTest {
|
||||||
Prueba child1 = new Prueba();
|
Prueba child1 = new Prueba();
|
||||||
Prueba child2 = new Prueba();
|
Prueba child2 = new Prueba();
|
||||||
model.add(model.getRoot(), Arrays.asList(child1, child2));
|
model.add(model.getRoot(), Arrays.asList(child1, child2));
|
||||||
|
|
||||||
assertThat(model.getChildCount(model.getRoot()), equalTo(2));
|
assertThat(model.getChildCount(model.getRoot()), equalTo(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addingAnEmptyListOfElementsDontDoNothing() {
|
public void addingAnEmptyListOfElementsDontDoNothing() {
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
final List<TreeDataEvent> events = new ArrayList<TreeDataEvent>();
|
final List<TreeDataEvent> events = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
events.add(event);
|
events.add(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
model.add(model.getRoot(), new ArrayList<Prueba>());
|
model.add(model.getRoot(), new ArrayList<Prueba>());
|
||||||
|
|
||||||
assertThat(events.size(), equalTo(0));
|
assertThat(events.size(), equalTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,19 +323,17 @@ public class MutableTreeModelTest {
|
||||||
final Prueba newlyAdded = new Prueba();
|
final Prueba newlyAdded = new Prueba();
|
||||||
final Prueba child1 = new Prueba();
|
final Prueba child1 = new Prueba();
|
||||||
final Prueba child2 = new Prueba();
|
final Prueba child2 = new Prueba();
|
||||||
model.add(model.getRoot(), Collections.singletonList(newlyAdded),
|
model.add(model.getRoot(), Collections.singletonList(newlyAdded), childrenFor(newlyAdded, child1, child2));
|
||||||
childrenFor(newlyAdded, child1, child2));
|
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(newlyAdded));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(newlyAdded));
|
||||||
assertThat(model.getChildCount(newlyAdded), equalTo(2));
|
assertThat(model.getChildCount(newlyAdded), equalTo(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IChildrenExtractor<Prueba> childrenFor(final Prueba parent,
|
private IChildrenExtractor<Prueba> childrenFor(final Prueba parent, final Prueba... children) {
|
||||||
final Prueba... children) {
|
|
||||||
return new IChildrenExtractor<Prueba>() {
|
return new IChildrenExtractor<Prueba>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Prueba> getChildren(Prueba p) {
|
public List<Prueba> getChildren(Prueba p) {
|
||||||
if (parent == p) {
|
if ( parent == p ) {
|
||||||
return Arrays.asList(children);
|
return Arrays.asList(children);
|
||||||
} else {
|
} else {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
@ -348,16 +348,17 @@ public class MutableTreeModelTest {
|
||||||
final Prueba newlyAdded = new Prueba();
|
final Prueba newlyAdded = new Prueba();
|
||||||
final Prueba child1 = new Prueba();
|
final Prueba child1 = new Prueba();
|
||||||
final Prueba child2 = new Prueba();
|
final Prueba child2 = new Prueba();
|
||||||
final List<TreeDataEvent> eventsFired = new ArrayList<TreeDataEvent>();
|
final List<TreeDataEvent> eventsFired = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
eventsFired.add(event);
|
eventsFired.add(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
model.add(model.getRoot(), Collections.singletonList(newlyAdded),
|
|
||||||
childrenFor(newlyAdded, child1, child2));
|
model.add(model.getRoot(), Collections.singletonList(newlyAdded), childrenFor(newlyAdded, child1, child2));
|
||||||
|
|
||||||
assertThat(eventsFired.size(), equalTo(1));
|
assertThat(eventsFired.size(), equalTo(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,14 +368,14 @@ public class MutableTreeModelTest {
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.add(model.getRoot(), prueba1);
|
model.add(model.getRoot(), prueba1);
|
||||||
model.remove(prueba1);
|
model.remove(prueba1);
|
||||||
|
|
||||||
assertThat(model.getChildCount(model.getRoot()), equalTo(0));
|
assertThat(model.getChildCount(model.getRoot()), equalTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void theRootNodeCannotBeRemoved() {
|
public void theRootNodeCannotBeRemoved() {
|
||||||
Prueba root = new Prueba();
|
Prueba root = new Prueba();
|
||||||
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class,
|
MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class, root);
|
||||||
root);
|
|
||||||
model.remove(root);
|
model.remove(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,23 +387,24 @@ public class MutableTreeModelTest {
|
||||||
Prueba grandson = new Prueba();
|
Prueba grandson = new Prueba();
|
||||||
model.add(parent, grandson);
|
model.add(parent, grandson);
|
||||||
model.remove(parent);
|
model.remove(parent);
|
||||||
|
|
||||||
assertThat(model.getPath(parent, grandson).length, equalTo(0));
|
assertThat(model.getPath(parent, grandson).length, equalTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void removingANodeTriggersEvent() {
|
public void removingANodeTriggersEvent() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
final List<TreeDataEvent> removeEventsFired = new ArrayList<>();
|
||||||
final List<TreeDataEvent> removeEventsFired = new ArrayList<TreeDataEvent>();
|
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
if (event.getType() == TreeDataEvent.INTERVAL_REMOVED) {
|
if ( event.getType() == TreeDataEvent.INTERVAL_REMOVED ) {
|
||||||
removeEventsFired.add(event);
|
removeEventsFired.add(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
Prueba grandChild = new Prueba();
|
Prueba grandChild = new Prueba();
|
||||||
|
|
@ -411,26 +413,27 @@ public class MutableTreeModelTest {
|
||||||
model.add(prueba1, grandChild);
|
model.add(prueba1, grandChild);
|
||||||
|
|
||||||
model.remove(grandChild);
|
model.remove(grandChild);
|
||||||
|
|
||||||
assertThat(removeEventsFired.size(), equalTo(1));
|
assertThat(removeEventsFired.size(), equalTo(1));
|
||||||
checkIsValid(getLast(removeEventsFired),
|
|
||||||
TreeDataEvent.INTERVAL_REMOVED, prueba1, 0);
|
checkIsValid(getLast(removeEventsFired), TreeDataEvent.INTERVAL_REMOVED, prueba1, 0);
|
||||||
|
|
||||||
model.remove(prueba2);
|
model.remove(prueba2);
|
||||||
assertThat(getLast(removeEventsFired).getParent(),
|
|
||||||
equalTo((Object) model.getRoot()));
|
assertThat(getLast(removeEventsFired).getParent(), equalTo((Object) model.getRoot()));
|
||||||
checkIsValid(getLast(removeEventsFired),
|
|
||||||
TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 1);
|
checkIsValid(getLast(removeEventsFired), TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 1);
|
||||||
|
|
||||||
model.remove(prueba1);
|
model.remove(prueba1);
|
||||||
|
|
||||||
assertThat(removeEventsFired.size(), equalTo(3));
|
assertThat(removeEventsFired.size(), equalTo(3));
|
||||||
checkIsValid(getLast(removeEventsFired),
|
|
||||||
TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 0);
|
checkIsValid(getLast(removeEventsFired), TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aNodeCanBeReplacedByOther() {
|
public void aNodeCanBeReplacedByOther() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba toRemove = new Prueba();
|
Prueba toRemove = new Prueba();
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
Prueba grandChild = new Prueba();
|
Prueba grandChild = new Prueba();
|
||||||
|
|
@ -446,8 +449,7 @@ public class MutableTreeModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aNodeCanBeMovedDown() {
|
public void aNodeCanBeMovedDown() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
|
|
@ -455,6 +457,7 @@ public class MutableTreeModelTest {
|
||||||
Prueba prueba3 = new Prueba();
|
Prueba prueba3 = new Prueba();
|
||||||
model.addToRoot(prueba3);
|
model.addToRoot(prueba3);
|
||||||
model.down(prueba1);
|
model.down(prueba1);
|
||||||
|
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba2));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba2));
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba1));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba1));
|
||||||
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
||||||
|
|
@ -462,8 +465,7 @@ public class MutableTreeModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aNodeCanBeMovedUp() {
|
public void aNodeCanBeMovedUp() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
|
|
@ -471,6 +473,7 @@ public class MutableTreeModelTest {
|
||||||
Prueba prueba3 = new Prueba();
|
Prueba prueba3 = new Prueba();
|
||||||
model.addToRoot(prueba3);
|
model.addToRoot(prueba3);
|
||||||
model.up(prueba2);
|
model.up(prueba2);
|
||||||
|
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba2));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba2));
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba1));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba1));
|
||||||
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
||||||
|
|
@ -478,8 +481,7 @@ public class MutableTreeModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void IfItIsAtTheTopUpDoesNothing() {
|
public void IfItIsAtTheTopUpDoesNothing() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
|
|
@ -487,6 +489,7 @@ public class MutableTreeModelTest {
|
||||||
Prueba prueba3 = new Prueba();
|
Prueba prueba3 = new Prueba();
|
||||||
model.addToRoot(prueba3);
|
model.addToRoot(prueba3);
|
||||||
model.up(prueba1);
|
model.up(prueba1);
|
||||||
|
|
||||||
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba1));
|
assertThat(model.getChild(model.getRoot(), 0), equalTo(prueba1));
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba2));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba2));
|
||||||
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
assertThat(model.getChild(model.getRoot(), 2), equalTo(prueba3));
|
||||||
|
|
@ -494,50 +497,45 @@ public class MutableTreeModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void movingUpAndDownSendsRemovalAndAddingEventsSoZKReloadsCorrectlyTheData() {
|
public void movingUpAndDownSendsRemovalAndAddingEventsSoZKReloadsCorrectlyTheData() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
model.addToRoot(prueba2);
|
model.addToRoot(prueba2);
|
||||||
Prueba prueba3 = new Prueba();
|
Prueba prueba3 = new Prueba();
|
||||||
model.addToRoot(prueba3);
|
model.addToRoot(prueba3);
|
||||||
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<TreeDataEvent>();
|
final ArrayList<TreeDataEvent> eventsFired = new ArrayList<>();
|
||||||
model.addTreeDataListener(new TreeDataListener() {
|
|
||||||
|
|
||||||
|
model.addTreeDataListener(new TreeDataListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(TreeDataEvent event) {
|
public void onChange(TreeDataEvent event) {
|
||||||
eventsFired.add(event);
|
eventsFired.add(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
model.up(prueba2);
|
model.up(prueba2);
|
||||||
checkIsValid(getPreviousToLast(eventsFired),
|
checkIsValid(getPreviousToLast(eventsFired), TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 0, 1);
|
||||||
TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 0, 1);
|
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 0, 1);
|
||||||
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED,
|
|
||||||
model.getRoot(), 0, 1);
|
|
||||||
model.down(prueba1);
|
model.down(prueba1);
|
||||||
checkIsValid(getPreviousToLast(eventsFired),
|
checkIsValid(getPreviousToLast(eventsFired), TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 1, 2);
|
||||||
TreeDataEvent.INTERVAL_REMOVED, model.getRoot(), 1, 2);
|
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED, model.getRoot(), 1, 2);
|
||||||
checkIsValid(getLast(eventsFired), TreeDataEvent.INTERVAL_ADDED,
|
|
||||||
model.getRoot(), 1, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ifItIsAtTheBottomDownDoesNothing() {
|
public void ifItIsAtTheBottomDownDoesNothing() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
Prueba prueba2 = new Prueba();
|
Prueba prueba2 = new Prueba();
|
||||||
model.addToRoot(prueba2);
|
model.addToRoot(prueba2);
|
||||||
model.down(prueba2);
|
model.down(prueba2);
|
||||||
|
|
||||||
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba2));
|
assertThat(model.getChild(model.getRoot(), 1), equalTo(prueba2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void canBeKnownIfAnEntityIsOnTheTree() {
|
public void canBeKnownIfAnEntityIsOnTheTree() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
Prueba prueba1 = new Prueba();
|
Prueba prueba1 = new Prueba();
|
||||||
model.addToRoot(prueba1);
|
model.addToRoot(prueba1);
|
||||||
|
|
||||||
|
|
@ -548,36 +546,34 @@ public class MutableTreeModelTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void treeParentContainsChild() {
|
public void treeParentContainsChild() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
|
|
||||||
Prueba parent = new Prueba();
|
Prueba parent = new Prueba();
|
||||||
model.addToRoot(parent);
|
model.addToRoot(parent);
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
model.add(parent, child);
|
model.add(parent, child);
|
||||||
|
|
||||||
assertTrue(model.contains(parent, child));
|
assertTrue(model.contains(parent, child));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void treeParentDoesNotContainChild() {
|
public void treeParentDoesNotContainChild() {
|
||||||
final MutableTreeModel<Prueba> model = MutableTreeModel
|
final MutableTreeModel<Prueba> model = MutableTreeModel.create(Prueba.class);
|
||||||
.create(Prueba.class);
|
|
||||||
|
|
||||||
Prueba parent = new Prueba();
|
Prueba parent = new Prueba();
|
||||||
model.addToRoot(parent);
|
model.addToRoot(parent);
|
||||||
Prueba child = new Prueba();
|
Prueba child = new Prueba();
|
||||||
|
|
||||||
assertFalse(model.contains(parent, child));
|
assertFalse(model.contains(parent, child));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsValid(TreeDataEvent event, int type,
|
private void checkIsValid(TreeDataEvent event, int type, Prueba expectedParent, int expectedPosition) {
|
||||||
Prueba expectedParent, int expectedPosition) {
|
checkIsValid(event, type, expectedParent, expectedPosition, expectedPosition);
|
||||||
checkIsValid(event, type, expectedParent, expectedPosition,
|
|
||||||
expectedPosition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsValid(TreeDataEvent event, int type,
|
private void checkIsValid(
|
||||||
Prueba expectedParent, int expectedFromPosition,
|
TreeDataEvent event, int type, Prueba expectedParent, int expectedFromPosition, int expectedToPosition) {
|
||||||
int expectedToPosition) {
|
|
||||||
assertEquals(expectedParent, event.getParent());
|
assertEquals(expectedParent, event.getParent());
|
||||||
assertThat(event.getIndexFrom(), equalTo(expectedFromPosition));
|
assertThat(event.getIndexFrom(), equalTo(expectedFromPosition));
|
||||||
assertThat(event.getIndexTo(), equalTo(expectedToPosition));
|
assertThat(event.getIndexTo(), equalTo(expectedToPosition));
|
||||||
|
|
@ -589,9 +585,10 @@ public class MutableTreeModelTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TreeDataEvent getLast(List<TreeDataEvent> list) {
|
private TreeDataEvent getLast(List<TreeDataEvent> list) {
|
||||||
if (list.isEmpty()) {
|
if ( list.isEmpty() ) {
|
||||||
throw new RuntimeException("no events");
|
throw new RuntimeException("no events");
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.get(list.size() - 1);
|
return list.get(list.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@
|
||||||
<artifactId>commons-math3</artifactId>
|
<artifactId>commons-math3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Log4J -->
|
<!-- Log4j -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -420,7 +420,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.7</version>
|
<version>1.7.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Log4j -->
|
<!-- Log4j -->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue