}
}
public void attributeListIsConnected(Vector<IAttribute> aattributeList) {
//System.out.println("notifyAttributeListIsConnected =" + aattributeList.size());
IAttribute tmpAttribute = null;
String tmpAttributeName = null;
Hashtable<String,IAttribute> tmpXY1AttributeList = new Hashtable<String,IAttribute>();
Hashtable<String,IAttribute> tmpXY2AttributeList = new Hashtable<String,IAttribute>();
Hashtable<String,IAttribute> tmpY1AttributeList = new Hashtable<String,IAttribute>();
Hashtable<String,IAttribute> tmpY2AttributeList = new Hashtable<String,IAttribute>();
Enumeration<IAttribute> tmpIAttributeEnumeration =aattributeList.elements();
while (tmpIAttributeEnumeration.hasMoreElements()){
tmpAttribute = tmpIAttributeEnumeration.nextElement();
tmpAttributeName = tmpAttribute.getName();
if(!(tmpAttribute instanceof INumberSpectrum)){
ConnectionErrorDialog.showMessageDialog(this, new Exception("Attribute type error"), "\n" + tmpAttributeName + "is not a Spectrum !" );
return;
}
if(isXY1Attribute(tmpAttributeName)){
tmpXY1AttributeList.put(tmpAttributeName.toLowerCase(),tmpAttribute);
}
if(isXY2Attribute(tmpAttributeName)){
tmpXY2AttributeList.put(tmpAttributeName.toLowerCase(),tmpAttribute);
}
if(isY1Attribute(tmpAttributeName)){
tmpY1AttributeList.put(tmpAttributeName.toLowerCase(),tmpAttribute);
}
if(isY2Attribute(tmpAttributeName)){
tmpY2AttributeList.put(tmpAttributeName.toLowerCase(),tmpAttribute);
}
}
if(!tmpY1AttributeList.isEmpty() && !tmpXY1AttributeList.isEmpty()) {
BindingTango.removeConnectionListener(this);
}
else {
return;
}
IAttribute tmpXAttribute = null;
IAttribute tmpYAttribute = null;
String tmpXAttributeName = null;
AttrDualSpectrum tmpAttributeDualSpectrum = null;
//For Y1
Enumeration<String> keys = tmpY1AttributeList.keys();
while (keys.hasMoreElements()) {
tmpAttributeName = keys.nextElement();
tmpYAttribute = tmpY1AttributeList.get(tmpAttributeName);
tmpXAttributeName = getXY1AttributeNameForY1(tmpAttributeName);
if(tmpXAttributeName != null &&
tmpXY1AttributeList.containsKey(tmpXAttributeName.toLowerCase())){
tmpXAttribute = tmpXY1AttributeList.get(tmpXAttributeName.toLowerCase());
}
if(tmpYAttribute != null && tmpXAttribute != null){
tmpAttributeDualSpectrum = new AttrDualSpectrum(tmpXAttribute.getDevice(),tmpXAttribute.getNameSansDevice(),tmpYAttribute.getDevice(),tmpYAttribute.getNameSansDevice());
tmpAttributeDualSpectrum.setYUnit(getUnitY1ForY1(tmpAttributeName));
tmpAttributeDualSpectrum.setYName(getAxisNameY1ForY1(tmpAttributeName));
tmpAttributeDualSpectrum.setRefreshInterval(refreshingPeriod);
m_DualList.add(tmpAttributeDualSpectrum);
addModel(tmpAttributeDualSpectrum,NonAttrNumberSpectrumViewer.Y1_AXIS);
}
}
//For Y2
keys = tmpY2AttributeList.keys();
while (keys.hasMoreElements()) {
tmpAttributeName = keys.nextElement();
tmpYAttribute = tmpY2AttributeList.get(tmpAttributeName);
tmpXAttributeName = getXY2AttributeNameForY2(tmpAttributeName);
if(tmpXAttributeName != null &&
tmpXY2AttributeList.containsKey(tmpXAttributeName.toLowerCase())){
tmpXAttribute = tmpXY2AttributeList.get(tmpXAttributeName.toLowerCase());
}
if(tmpYAttribute != null && tmpXAttribute != null){
tmpAttributeDualSpectrum = new AttrDualSpectrum(tmpXAttribute.getDevice(),tmpXAttribute.getNameSansDevice(),tmpYAttribute.getDevice(),tmpYAttribute.getNameSansDevice());
tmpAttributeDualSpectrum.setYUnit(getUnitY2ForY2(tmpAttributeName));
tmpAttributeDualSpectrum.setYName(getAxisNameY2ForY2(tmpAttributeName));
tmpAttributeDualSpectrum.setRefreshInterval(refreshingPeriod);
m_DualList.add(tmpAttributeDualSpectrum);
addModel(tmpAttributeDualSpectrum,NonAttrNumberSpectrumViewer.Y2_AXIS);