use of com.cas.robot.common.ICleanableControl in project TeachingInSimulation by ScOrPiOzzy.
the class ConnectionController method bindLocal.
@Override
protected void bindLocal(Properties parameter, Attributes controlDefinitionAttributes) {
super.bindLocal(parameter, controlDefinitionAttributes);
if (Util.notEmpty(parameter.getProperty("noMult"))) {
noMult = Boolean.valueOf(parameter.getProperty("noMult"));
}
if (Util.notEmpty(parameter.getProperty("noPipe"))) {
noPipe = Boolean.valueOf(parameter.getProperty("noPipe"));
}
if (Util.notEmpty(parameter.getProperty("noWire"))) {
noWire = Boolean.valueOf(parameter.getProperty("noWire"));
}
if (Util.notEmpty(parameter.getProperty("noCable"))) {
noCable = Boolean.valueOf(parameter.getProperty("noCable"));
}
if (noMult) {
Element multimeterPanel = findById("multimeterPanel");
multimeterPanel.markForRemoval();
}
if (noPipe) {
Element pipePanel = findById("pipePanel");
pipePanel.markForRemoval();
} else {
Element pipeColorsContent = findById("pipeColorsContent");
updateImageMode("currentPipe#colorImage", pipeImageModes[0]);
for (int i = 0; i < pipeLabels.length; i++) {
creatWireAndPipeItem(i, pipeImageModes, pipeLabels, "changePipeColor", pipeColorsContent);
}
}
if (noWire) {
Element wirePanel = findById("wirePanel");
wirePanel.markForRemoval();
} else {
Element wireColorsContent = findById("wireColorsContent");
updateImageMode("currentWire#colorImage", wireImageModes[0]);
for (int j = 0; j < wireLabels.length; j++) {
creatWireAndPipeItem(j, wireImageModes, wireLabels, "changeWireColor", wireColorsContent);
}
}
if (noCable) {
Element xianlanPanel = findById("xianlanPanel");
xianlanPanel.markForRemoval();
}
addCleanningControlOnEnd(new ICleanableControl() {
@Override
public void onClean() {
if (timer != null) {
timer.cancel();
}
}
@Override
public String getName() {
if (timer != null) {
return timer.toString();
}
return "null Timer";
}
});
}
Aggregations