private boolean updateDataModelAxis(String attributeName, String newAxis) {
if (newAxis == null) {
return false;
}
ScanServerDataModel dataModel = CurrentScanDataModel.getDataModel(scanServerDeviceName,
attributeName);
String label = CurrentScanDataModel.getAttributeLabel(scanServerDeviceName, attributeName);
int axisType = Axis.SPECTRUM_TYPE;
String oldAxis = null;
boolean dataChanged = false;
String[] newY1SensortList = null;
String[] newY2SensortList = null;
String[] newY1DataList = null;
String[] newY2DataList = null;
String[] newZSensorList = null;
String[] newNoneSensortList = null;
if (dataModel != null) {
dataModel.getAttributeLabel();
oldAxis = dataModel.getAxis().getAxis();
if (oldAxis == null || !newAxis.equals(oldAxis)) {
axisType = dataModel.getAxis().getType();
if (newAxis.equals(Axis.NONE)) {
dataChanged = true;
dataModel.setAxis(newAxis);
CurrentScanDataModel.initDefaultAxis(label, newAxis);
if (oldAxis.equals(Axis.X)) {
CurrentScanDataModel.setActuatorName(scanServerDeviceName, "");
String actualActuatorName = CurrentScanDataModel
.getActuatorName(scanServerDeviceName);
setActuatorName(actualActuatorName);
}
}
else {
switch (axisType) {
case Axis.SPECTRUM_TYPE:
if (!newAxis.equals(Axis.Z)) {
dataChanged = true;
if (newAxis.equals(Axis.X)) {
CurrentScanDataModel.setActuatorName(scanServerDeviceName,
attributeName);
String actualActuatorName = CurrentScanDataModel
.getActuatorName(scanServerDeviceName);
setActuatorName(actualActuatorName);
}
else {
dataModel.setAxis(newAxis);
CurrentScanDataModel.initDefaultAxis(label, newAxis);
}
}
break;
case Axis.IMAGE_TYPE:
// if (newAxis.equals(Axis.Z)) {
dataChanged = true;
dataModel.setAxis(newAxis);
CurrentScanDataModel.initDefaultAxis(label, newAxis);
// }
break;
}
}