}
}
public void attributeListIsConnected(Vector<IAttribute> aattributeList) {
//System.out.println("attributeListIsConnected="+aattributeList.size());
AttributePolledList tmpAttributePolledList = new AttributePolledList();
tmpAttributePolledList.setRefreshInterval(refreshingPeriod);
tmpAttributePolledList.setFilter(new IEntityFilter(){
private static final long serialVersionUID = 1L;
public boolean keep(IEntity ientity)
{
if(ientity instanceof INumberScalar)
return true;
if(ientity instanceof IStringScalar)
return true;
if(ientity instanceof IBooleanScalar)
return true;
else
return false;
}
});
IAttribute tmpIAttribute = null;
int tmpInvalidAttribute = 0;
Enumeration<IAttribute> tmpEnumeration = aattributeList.elements();
while (tmpEnumeration.hasMoreElements())
{
tmpIAttribute = (IAttribute) tmpEnumeration.nextElement();
for (int i = 0; i < attributeNameList.length; i++)
{
if(tmpIAttribute.getName().equalsIgnoreCase(attributeNameList[i].trim()))
{
tmpAttributePolledList.add(tmpIAttribute);
if(!(tmpIAttribute instanceof INumberScalar)
&& !(tmpIAttribute instanceof IStringScalar)
&& !(tmpIAttribute instanceof IBooleanScalar))
{
tmpInvalidAttribute++;
if(displayErrorOnFormat)
ConnectionErrorDialog.showMessageDialog(this, null, "\n" + tmpIAttribute.getName() + "is not a scalar");
}
break;
}
}
}
if(tmpAttributePolledList.size() + tmpInvalidAttribute + m_attributeKOList.size() == attributeNameList.length)
{
BindingTango.removeConnectionListener(this);
boolean isPossValue = attributePossibleValueList.length == attributeNameList.length;
Enumeration<IAttribute> enumeration = aattributeList.elements();
while(enumeration.hasMoreElements() && isPossValue)
{
IAttribute attribute = (IAttribute)enumeration.nextElement();
int tmpIndex = getIndex(attribute.getName());
if(tmpIndex != -1)
{
if(attribute instanceof INumberScalar || attribute instanceof IStringScalar)
{
if(isPossValue)
{
String possValues = attributePossibleValueList[tmpIndex];
StringTokenizer possValueList = new StringTokenizer(possValues, ",");
if(possValueList.countTokens() > 0)
{
String[] stringValues = null;
double[] doubleValues = null;
if(attribute instanceof INumberScalar)
doubleValues = new double[possValueList.countTokens()];
if(attribute instanceof IStringScalar)
stringValues = new String[possValueList.countTokens()];
int count = 0;
while (possValueList.hasMoreTokens())
{
if(attribute instanceof INumberScalar)
doubleValues[count++] = Double.parseDouble(possValueList.nextToken().trim());
if(attribute instanceof IStringScalar)
stringValues[count++] = possValueList.nextToken().trim();
}
if(attribute instanceof INumberScalar)
((INumberScalar)attribute).setPossibleValues(doubleValues);
if(attribute instanceof IStringScalar)
((IStringScalar)attribute).setPossibleValues(stringValues);
}// End if
}//End if
}//End if
}//End If index
}//End while
try
{
scalarListViewer.setModel(tmpAttributePolledList);
}
catch (Exception e) {
//Null Pointer exception in SimpleScalarViewer.java:411
}
setSetterEnabled(setterEnabled) ;
setSetterVisible(setterVisible) ;
}//End if
if(!tmpAttributePolledList.isEmpty())
tmpAttributePolledList.startRefresher();
}