下面列出了javax.swing.table.TableColumnModel#getColumnIndex ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Test
public void testMultipleRefs() throws Exception {
cb.goTo(new OperandFieldLocation(program, addr("1004050"), null, null, null, 0, 0));
assertEquals(addr("1004050"), cb.getCurrentAddress());
click(cb, 2);
GTable table = waitForResults();
TableColumnModel columnModel = table.getColumnModel();
int columnIndex = columnModel.getColumnIndex("Location");
TableModel model = table.getModel();
assertEquals("01008010", model.getValueAt(0, columnIndex).toString());
assertEquals("01008020", model.getValueAt(1, columnIndex).toString());
assertEquals("01008030", model.getValueAt(2, columnIndex).toString());
assertEquals("01008040", model.getValueAt(3, columnIndex).toString());
assertEquals("01008050", model.getValueAt(4, columnIndex).toString());
assertEquals("01008060", model.getValueAt(5, columnIndex).toString());
assertEquals("01008070", model.getValueAt(6, columnIndex).toString());
assertEquals("01008080", model.getValueAt(7, columnIndex).toString());
assertEquals("01008090", model.getValueAt(8, columnIndex).toString());
getProviders()[0].closeComponent();
}
@Override
public void addGeneratedColumn(String columnId, ColumnGenerator<? super E> generator,
Class<? extends com.haulmont.cuba.gui.components.Component> componentClass) {
if (columnId == null)
throw new IllegalArgumentException("columnId is null");
if (generator == null)
throw new IllegalArgumentException("generator is null");
Column col = getColumn(columnId);
TableColumnModel columnModel = impl.getColumnModel();
int columnIndex = columnModel.getColumnIndex(col);
if (columnIndex == 0)
throw new UnsupportedOperationException("Unable to add cell renderer for hierarchical column in TreeTable");
addGeneratedColumnInternal(columnId, generator, componentClass);
}
protected String getContextColumnValue(LocationReference rowObject) {
LocationReferencesTableModel model = getTableModel();
GhidraTable table = getTable();
TableColumnModel columnModel = table.getColumnModel();
int col = columnModel.getColumnIndex("Context");
Object value = model.getColumnValueForRow(rowObject, col);
return value.toString();
}
@Test
public void testOperandExternalMultipleLinkageNavigation() throws Exception {
addThunkToExternalFunction("ADVAPI32.dll", "IsTextUnicode", addr("0x1001100"));
cb.goTo(new OperandFieldLocation(program, addr("1001020"), null, null, null, 0, 0));
assertEquals(addr("1001020"), cb.getCurrentAddress());
// verify that we navigate to import address table entry (i.e., linkage)
// at 1001000 associated with external location which is also referenced at 1001020
click(cb, 2);
GTable table = waitForResults();
TableColumnModel columnModel = table.getColumnModel();
int columnIndex = columnModel.getColumnIndex("Location");
TableModel model = table.getModel();
assertEquals("01001000", model.getValueAt(0, columnIndex).toString()); // pointer
assertEquals("01001100", model.getValueAt(1, columnIndex).toString()); // thunk
// selection triggers navigation
changeSelectionToNavigate(table, 1, 0);
runSwing(() -> getProviders()[0].closeComponent());
assertEquals(addr("1001100"), cb.getCurrentAddress());
}