@Test public void testGetValueAt() { Assert.assertNull(this.model.getValueAt(this.root, 0)); Assert.assertNull(this.model.getValueAt(this.root, 1)); Assert.assertNull(this.model.getValueAt(this.root, 2)); Assert.assertNull(this.model.getValueAt(this.root, 3)); final UUID referenceSystemModelB = this.model.getChild(this.root, 1); Assert.assertEquals(MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), "System Model - B"), this.model.getValueAt(referenceSystemModelB, 0)); Assert.assertEquals(MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), 5), this.model.getValueAt(referenceSystemModelB, 1)); Assert.assertEquals(HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(), this.model.getValueAt(referenceSystemModelB, 2)); Assert.assertNull(this.model.getValueAt(referenceSystemModelB, 3)); final UUID referenceUserModelD = this.model.getChild(this.root, 3); Assert.assertEquals("User Model - D", this.model.getValueAt(referenceUserModelD, 0)); Assert.assertEquals(MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), 0), this.model.getValueAt(referenceUserModelD, 1)); Assert.assertEquals(HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(), this.model.getValueAt(referenceUserModelD, 2)); Assert.assertEquals(HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get(), this.model.getValueAt(referenceUserModelD, 3)); }
@Override public Object getValueAt(final Object node, final int columnIndex) { if (node == this.getRoot()) { return null; } switch (columnIndex) { case 0: final String modelName = this.languageModels.get(node).getName(); if (this.isModelAtPathUserDefined(new TreePath(new Object[] { this.getRoot(), node }))) { return modelName; } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), modelName); case 1: final AtomicInteger functionCounter = new AtomicInteger(0); for (final List<AbstractSyntacticalFunctionElement> singleGroup : this.languageModels.get(node).provideFunctions()) { for (final AbstractSyntacticalFunctionElement topLevelElement : singleGroup) { this.addFunctionCount(topLevelElement, functionCounter); } } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), functionCounter.intValue()); case 2: return HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(); case 3: return this.isCellEditable(node, columnIndex) ? HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get() : null; default: throw new IllegalArgumentException(); } }
LanguageTreeModel extends AbstractTreeTableModel { @Override public Object getValueAt(final Object node, final int columnIndex) { if (node == this.getRoot()) { return null; } switch (columnIndex) { case 0: final String modelName = this.languageModels.get(node).getName(); if (this.isModelAtPathUserDefined(new TreePath(new Object[] { this.getRoot(), node }))) { return modelName; } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), modelName); case 1: final AtomicInteger functionCounter = new AtomicInteger(0); for (final List<AbstractSyntacticalFunctionElement> singleGroup : this.languageModels.get(node).provideFunctions()) { for (final AbstractSyntacticalFunctionElement topLevelElement : singleGroup) { this.addFunctionCount(topLevelElement, functionCounter); } } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), functionCounter.intValue()); case 2: return HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(); case 3: return this.isCellEditable(node, columnIndex) ? HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get() : null; default: throw new IllegalArgumentException(); } } }
LanguageTreeModel extends AbstractTreeTableModel { @Override public Object getValueAt(final Object node, final int columnIndex) { if (node == this.getRoot()) { return null; } switch (columnIndex) { case 0: final String modelName = this.languageModels.get(node).getName(); if (this.isModelAtPathUserDefined(new TreePath(new Object[] { this.getRoot(), node }))) { return modelName; } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), modelName); case 1: final AtomicInteger functionCounter = new AtomicInteger(0); for (final List<AbstractSyntacticalFunctionElement> singleGroup : this.languageModels.get(node).provideFunctions()) { for (final AbstractSyntacticalFunctionElement topLevelElement : singleGroup) { this.addFunctionCount(topLevelElement, functionCounter); } } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), functionCounter.intValue()); case 2: return HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(); case 3: return this.isCellEditable(node, columnIndex) ? HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get() : null; default: throw new IllegalArgumentException(); } } LanguageTreeModel(final ILanguageOptionHandler options); }
LanguageTreeModel extends AbstractTreeTableModel { @Override public Object getValueAt(final Object node, final int columnIndex) { if (node == this.getRoot()) { return null; } switch (columnIndex) { case 0: final String modelName = this.languageModels.get(node).getName(); if (this.isModelAtPathUserDefined(new TreePath(new Object[] { this.getRoot(), node }))) { return modelName; } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), modelName); case 1: final AtomicInteger functionCounter = new AtomicInteger(0); for (final List<AbstractSyntacticalFunctionElement> singleGroup : this.languageModels.get(node).provideFunctions()) { for (final AbstractSyntacticalFunctionElement topLevelElement : singleGroup) { this.addFunctionCount(topLevelElement, functionCounter); } } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), functionCounter.intValue()); case 2: return HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(); case 3: return this.isCellEditable(node, columnIndex) ? HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get() : null; default: throw new IllegalArgumentException(); } } LanguageTreeModel(final ILanguageOptionHandler options); @Override int getColumnCount(); @Override UUID getChild(final Object parentNode, final int index); @Override int getChildCount(final Object parentNode); @Override int getIndexOfChild(final Object parentNode, final Object childNode); @Override boolean isCellEditable(final Object node, final int columnIndex); @Override Object getValueAt(final Object node, final int columnIndex); }
LanguageTreeModel extends AbstractTreeTableModel { @Override public Object getValueAt(final Object node, final int columnIndex) { if (node == this.getRoot()) { return null; } switch (columnIndex) { case 0: final String modelName = this.languageModels.get(node).getName(); if (this.isModelAtPathUserDefined(new TreePath(new Object[] { this.getRoot(), node }))) { return modelName; } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_SYSTEMMODEL.get(), modelName); case 1: final AtomicInteger functionCounter = new AtomicInteger(0); for (final List<AbstractSyntacticalFunctionElement> singleGroup : this.languageModels.get(node).provideFunctions()) { for (final AbstractSyntacticalFunctionElement topLevelElement : singleGroup) { this.addFunctionCount(topLevelElement, functionCounter); } } return MessageFormat.format(HmxMessage.PREFERENCES_LANGUAGE_FUNCTION_COUNT.get(), functionCounter.intValue()); case 2: return HmxMessage.PREFERENCES_LANGUAGE_CLONE_LANGUAGE.get(); case 3: return this.isCellEditable(node, columnIndex) ? HmxMessage.PREFERENCES_LANGUAGE_DELETE_LANGUAGE.get() : null; default: throw new IllegalArgumentException(); } } LanguageTreeModel(final ILanguageOptionHandler options); @Override int getColumnCount(); @Override UUID getChild(final Object parentNode, final int index); @Override int getChildCount(final Object parentNode); @Override int getIndexOfChild(final Object parentNode, final Object childNode); @Override boolean isCellEditable(final Object node, final int columnIndex); @Override Object getValueAt(final Object node, final int columnIndex);  }