Java Code Examples for javax.swing.table.TableColumnModel#getColumnIndex()

The following examples show how to use javax.swing.table.TableColumnModel#getColumnIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeBrowserNavigationTest.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 2
Source File: DesktopTreeTable.java    From cuba with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 3
Source File: AbstractLocationReferencesTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 4
Source File: ExternalCodeBrowserNavigationTest.java    From ghidra with Apache License 2.0 3 votes vote down vote up
@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());
}