@Test public void isNotItemChanged() { mockOldItem(); when(parentItem.getUuid()).thenReturn(PARENT_UUID); when(parentItem.getChildCount()).thenReturn(1); when(parentItem.getChild(eq(0))).thenReturn(item); assertFalse(testedTreeExplorerView.isItemChanged(ITEM_UUID, PARENT_UUID, NAME, ITEM_CHILDREN_COUNT, OptionalInt.of(0))); }
public boolean isItemChanged(final String uuid, final String parentUuid, final String name, final int childCount, final OptionalInt indexIntoParent) { final TreeItem oldItem = tree.getItemByUuid(uuid); if (oldItem != null) { if (isNameChanged().test(oldItem, name)) { return true; } final TreeItem oldItemParent = oldItem.getParentItem(); final String oldParentUuid = null != oldItemParent ? oldItemParent.getUuid() : null; final boolean isChildrenCountChanged = oldItem.getChildCount() != childCount; if (isChildrenCountChanged) { return true; } return (((oldParentUuid == null && parentUuid == null) || (null != parentUuid && !parentUuid.equals(oldParentUuid)))) || isIndexChanged().test(oldItem, indexIntoParent); } return false; }
TreeExplorerView extends Composite implements TreeExplorer.View { public boolean isItemChanged(final String uuid, final String parentUuid, final String name, final int childCount, final OptionalInt indexIntoParent) { final TreeItem oldItem = tree.getItemByUuid(uuid); if (oldItem != null) { if (isNameChanged().test(oldItem, name)) { return true; } final TreeItem oldItemParent = oldItem.getParentItem(); final String oldParentUuid = null != oldItemParent ? oldItemParent.getUuid() : null; final boolean isChildrenCountChanged = oldItem.getChildCount() != childCount; if (isChildrenCountChanged) { return true; } return (((oldParentUuid == null && parentUuid == null) || (null != parentUuid && !parentUuid.equals(oldParentUuid)))) || isIndexChanged().test(oldItem, indexIntoParent); } return false; } }
TreeExplorerView extends Composite implements TreeExplorer.View { public boolean isItemChanged(final String uuid, final String parentUuid, final String name, final int childCount, final OptionalInt indexIntoParent) { final TreeItem oldItem = tree.getItemByUuid(uuid); if (oldItem != null) { if (isNameChanged().test(oldItem, name)) { return true; } final TreeItem oldItemParent = oldItem.getParentItem(); final String oldParentUuid = null != oldItemParent ? oldItemParent.getUuid() : null; final boolean isChildrenCountChanged = oldItem.getChildCount() != childCount; if (isChildrenCountChanged) { return true; } return (((oldParentUuid == null && parentUuid == null) || (null != parentUuid && !parentUuid.equals(oldParentUuid)))) || isIndexChanged().test(oldItem, indexIntoParent); } return false; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); }
TreeExplorerView extends Composite implements TreeExplorer.View { public boolean isItemChanged(final String uuid, final String parentUuid, final String name, final int childCount, final OptionalInt indexIntoParent) { final TreeItem oldItem = tree.getItemByUuid(uuid); if (oldItem != null) { if (isNameChanged().test(oldItem, name)) { return true; } final TreeItem oldItemParent = oldItem.getParentItem(); final String oldParentUuid = null != oldItemParent ? oldItemParent.getUuid() : null; final boolean isChildrenCountChanged = oldItem.getChildCount() != childCount; if (isChildrenCountChanged) { return true; } return (((oldParentUuid == null && parentUuid == null) || (null != parentUuid && !parentUuid.equals(oldParentUuid)))) || isIndexChanged().test(oldItem, indexIntoParent); } return false; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); @Override void init(final TreeExplorer presenter); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String parentsUuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state,
                                     final OptionalInt index); boolean isItemChanged(final String uuid,
                                 final String parentUuid,
                                 final String name,
                                 final int childCount,
                                 final OptionalInt indexIntoParent); @Override TreeExplorer.View clear(); TreeExplorer.View destroy(); @Override boolean isContainer(final String uuid); TreeExplorer.View setSelectedItem(final String uuid); TreeExplorer.View removeItem(String uuid); }
TreeExplorerView extends Composite implements TreeExplorer.View { public boolean isItemChanged(final String uuid, final String parentUuid, final String name, final int childCount, final OptionalInt indexIntoParent) { final TreeItem oldItem = tree.getItemByUuid(uuid); if (oldItem != null) { if (isNameChanged().test(oldItem, name)) { return true; } final TreeItem oldItemParent = oldItem.getParentItem(); final String oldParentUuid = null != oldItemParent ? oldItemParent.getUuid() : null; final boolean isChildrenCountChanged = oldItem.getChildCount() != childCount; if (isChildrenCountChanged) { return true; } return (((oldParentUuid == null && parentUuid == null) || (null != parentUuid && !parentUuid.equals(oldParentUuid)))) || isIndexChanged().test(oldItem, indexIntoParent); } return false; } @Inject  TreeExplorerView(final Tree<TreeItem> tree);   TreeExplorerView(final TreeExplorer presenter,
                     final Tree<TreeItem> tree,
                     final HandlerRegistration handlerRegistration
    ); @Override void init(final TreeExplorer presenter); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state); @SuppressWarnings("unchecked") TreeExplorer.View addItem(final String uuid,
                                     final String parentsUuid,
                                     final String name,
                                     final IsWidget icon,
                                     final boolean isContainer,
                                     final boolean state,
                                     final OptionalInt index); boolean isItemChanged(final String uuid,
                                 final String parentUuid,
                                 final String name,
                                 final int childCount,
                                 final OptionalInt indexIntoParent); @Override TreeExplorer.View clear(); TreeExplorer.View destroy(); @Override boolean isContainer(final String uuid); TreeExplorer.View setSelectedItem(final String uuid); TreeExplorer.View removeItem(String uuid);  }