@Test public void testGetIndexOfChild() { final Object root = this.model.getRoot(); final Object groupNode1 = this.model.getChild(root, 0); final Object groupNode2 = this.model.getChild(root, 1); final Object groupNode3 = this.model.getChild(root, 2); Assert.assertSame(0, this.model.getIndexOfChild(root, groupNode1)); Assert.assertSame(1, this.model.getIndexOfChild(root, groupNode2)); Assert.assertSame(2, this.model.getIndexOfChild(root, groupNode3)); final Object childNodeA1 = this.model.getChild(groupNode1, 0); final Object childNodeA2 = this.model.getChild(groupNode1, 1); final Object childNodeC1 = this.model.getChild(groupNode3, 0); final Object childNodeC2 = this.model.getChild(groupNode3, 1); final Object childNodeC3 = this.model.getChild(groupNode3, 2); final Object childNodeC4 = this.model.getChild(groupNode3, 3); Assert.assertSame(0, this.model.getIndexOfChild(groupNode1, childNodeA1)); Assert.assertSame(1, this.model.getIndexOfChild(groupNode1, childNodeA2)); Assert.assertSame(0, this.model.getIndexOfChild(groupNode3, childNodeC1)); Assert.assertSame(1, this.model.getIndexOfChild(groupNode3, childNodeC2)); Assert.assertSame(2, this.model.getIndexOfChild(groupNode3, childNodeC3)); Assert.assertSame(3, this.model.getIndexOfChild(groupNode3, childNodeC4)); }
@Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof UUID) { return this.relationGroups.get(parent).indexOf(child); } return new ArrayList<>(this.relationGroups.keySet()).indexOf(child); }
RelationTreeModel extends AbstractTreeTableModel implements ISemanticalRelationProvider { @Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof UUID) { return this.relationGroups.get(parent).indexOf(child); } return new ArrayList<>(this.relationGroups.keySet()).indexOf(child); } }
RelationTreeModel extends AbstractTreeTableModel implements ISemanticalRelationProvider { @Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof UUID) { return this.relationGroups.get(parent).indexOf(child); } return new ArrayList<>(this.relationGroups.keySet()).indexOf(child); } RelationTreeModel(final ISemanticalRelationProvider relationProvider); }
RelationTreeModel extends AbstractTreeTableModel implements ISemanticalRelationProvider { @Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof UUID) { return this.relationGroups.get(parent).indexOf(child); } return new ArrayList<>(this.relationGroups.keySet()).indexOf(child); } RelationTreeModel(final ISemanticalRelationProvider relationProvider); @Override List<List<RelationTemplate>> provideRelationTemplates(); @Override Object getChild(final Object parent, final int index); @Override int getChildCount(final Object parent); @Override boolean isLeaf(final Object node); @Override int getIndexOfChild(final Object parent, final Object child); @Override int getColumnCount(); @Override String getColumnName(final int columnIndex); @Override Class<?> getColumnClass(final int columnIndex); @Override boolean isCellEditable(final Object node, final int columnIndex); @Override String getValueAt(final Object node, final int columnIndex); @Override void setValueAt(final Object value, final Object node, final int column); TreePath addGroupEntry(); RelationTemplate getTemplateAtPath(final TreePath path); TreePath addTemplateEntryToGroup(final TreePath groupPath); void updateTemplateEntry(final TreePath targetPath, final RelationTemplate newState); void moveEntry(final TreePath targetPath, final boolean moveDown); void removeEntry(final TreePath targetPath); }
RelationTreeModel extends AbstractTreeTableModel implements ISemanticalRelationProvider { @Override public int getIndexOfChild(final Object parent, final Object child) { if (parent instanceof UUID) { return this.relationGroups.get(parent).indexOf(child); } return new ArrayList<>(this.relationGroups.keySet()).indexOf(child); } RelationTreeModel(final ISemanticalRelationProvider relationProvider); @Override List<List<RelationTemplate>> provideRelationTemplates(); @Override Object getChild(final Object parent, final int index); @Override int getChildCount(final Object parent); @Override boolean isLeaf(final Object node); @Override int getIndexOfChild(final Object parent, final Object child); @Override int getColumnCount(); @Override String getColumnName(final int columnIndex); @Override Class<?> getColumnClass(final int columnIndex); @Override boolean isCellEditable(final Object node, final int columnIndex); @Override String getValueAt(final Object node, final int columnIndex); @Override void setValueAt(final Object value, final Object node, final int column); TreePath addGroupEntry(); RelationTemplate getTemplateAtPath(final TreePath path); TreePath addTemplateEntryToGroup(final TreePath groupPath); void updateTemplateEntry(final TreePath targetPath, final RelationTemplate newState); void moveEntry(final TreePath targetPath, final boolean moveDown); void removeEntry(final TreePath targetPath);  }