AKarandjeff
14 years agoContributor
Determine Object Type within JTable
I am working on a script where I need to populate values within a customer JTable. I start by pulling data from a table. I find the swP variable in the table, and then need to populate the adjacent cell with a value. At this point, that cell can either be a comboBox or a text field. When I click in the cell where I need to put the value, I need to dynamically figure out what kind of object it is, so I can set the name mapping variable accordingly via the switch {case} statement. The current values in the case statement are based off a recorded example where I just clicked through the fields. The *** section is the one where I'm stuck, in particular, the <Need Help with Getting Object Type> part. The application is a Java application. I am going through and am trying to find the Java method that I can use to set that objType variable, but if anyone knows off hand, would greatly appreciate some assistance. Thanks!
propertyTable = switchPropertySheet.TabbedPane1.Panel.Panel.ScrollPane.Viewport.PropertyTable;
var swPropQry = "select SWITCHID, PROPERTY, PROPERTYVALUE from zqa_switch_properties where switchid = '" + swID + "' ORDER BY controlindex";
var swProp = DDT.ADODriver(ConStr, swPropQry);
while(!swProp.EOF())
{
var swP = swProp.Value(1)
var swPVal = swProp.Value(2)
RowIndex = propertyTable.FindRow(0, swP);
if (RowIndex != -1)
{
propertyTable.ClickCell(RowIndex, 1);
***var objType = <Need Help with Getting Object Type>***
***switch objType
***{
*** case PropTypeComboBox:
*** textField = propertyTable.PropTypeComboBox.TextField;
*** break;
*** case PropTypeTextField:
*** textField = propertyTable.PropTypeTextField;
*** break;
***}
textField.wText = swPVal;
textField.Keys = ("[Enter]");
}
else
Log.Message(swP + "not found in Properties Table");
swProp.Next()
}
//Click OK to save switch
switchPropertySheet.Panel.Panel.Panel.Panel.Button.ClickButton();
swMain.Next()
propertyTable = switchPropertySheet.TabbedPane1.Panel.Panel.ScrollPane.Viewport.PropertyTable;
var swPropQry = "select SWITCHID, PROPERTY, PROPERTYVALUE from zqa_switch_properties where switchid = '" + swID + "' ORDER BY controlindex";
var swProp = DDT.ADODriver(ConStr, swPropQry);
while(!swProp.EOF())
{
var swP = swProp.Value(1)
var swPVal = swProp.Value(2)
RowIndex = propertyTable.FindRow(0, swP);
if (RowIndex != -1)
{
propertyTable.ClickCell(RowIndex, 1);
***var objType = <Need Help with Getting Object Type>***
***switch objType
***{
*** case PropTypeComboBox:
*** textField = propertyTable.PropTypeComboBox.TextField;
*** break;
*** case PropTypeTextField:
*** textField = propertyTable.PropTypeTextField;
*** break;
***}
textField.wText = swPVal;
textField.Keys = ("[Enter]");
}
else
Log.Message(swP + "not found in Properties Table");
swProp.Next()
}
//Click OK to save switch
switchPropertySheet.Panel.Panel.Panel.Panel.Button.ClickButton();
swMain.Next()