{
var =(String)((Object[])element)[0];
value =(String)((Object[])element)[1];
if(value != null)
{
builder.addField(new XDataField(var,value));
}
}
else
{
JComponent component = (JComponent)element;
var = component.getName();
if(component instanceof JCheckBox)
{
value = String.valueOf(((JCheckBox)component).isSelected()?1:0);
}
else if(component instanceof JTextComponent)
{
value = ((JTextComponent)component).getText();
}
else if(component instanceof JComboBox)
{
value =((LabelValue)((JComboBox)component).getSelectedItem()).value;
}
if(value != null)
{
builder.addField(new XDataField(var,value));
}
if(component instanceof JList)
{
JList list = ((JList)component);
if (!list.isSelectionEmpty())
{
Object[] values = list.getSelectedValues();
for (int i = 0; i < values.length; i++)
{
builder.addField(new XDataField(var,((LabelValue)values[i]).value));
}
}
}
}
}