Skip to content
Snippets Groups Projects
Commit 1385f9d3 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

better EDT/not EDT work management (SCAN-976, PROBLEM-2582)

parent de06598e
Branches
No related tags found
No related merge requests found
......@@ -42,9 +42,12 @@ import fr.soleil.comete.definition.widget.properties.ChartProperties;
import fr.soleil.comete.definition.widget.properties.ImageProperties;
import fr.soleil.comete.definition.widget.properties.PlotProperties;
import fr.soleil.comete.swing.Label;
import fr.soleil.comete.swing.util.EDTManager;
import fr.soleil.comete.tango.data.service.TangoKey;
import fr.soleil.comete.tango.data.service.helper.TangoDeviceHelper;
import fr.soleil.data.mediator.Mediator;
import fr.soleil.data.service.thread.IDrawingThreadManager;
import fr.soleil.data.target.IDrawableTarget;
import fr.soleil.data.target.scalar.ITextTarget;
import fr.soleil.lib.project.ObjectUtils;
import fr.soleil.lib.project.awt.layout.VerticalFlowLayout;
......@@ -323,44 +326,7 @@ public class CurrentScanResultBean extends AbstractTangoBox
}
private ITextTarget generateNexusFileTarget() {
final ITextTarget result = new ITextTarget() {
@Override
public void setText(String file) {
if (file != null && !file.isEmpty() && !StringScalarBox.DEFAULT_ERROR_STRING.equals(file)) {
String fileName = file;
int index = file.lastIndexOf(TangoDeviceHelper.SLASH);
if (index > -1) {
fileName = file.substring(index + 1);
}
nexusFileName.setText(FILE + fileName);
nexusFileName.setVisible(true);
nexusFileName.setToolTipText(file);
} else {
nexusFileName.setText(ObjectUtils.EMPTY_STRING);
nexusFileName.setVisible(false);
nexusFileName.setToolTipText(ObjectUtils.EMPTY_STRING);
}
}
@Override
public void addMediator(Mediator<?> mediator) {
// not managed
}
@Override
public void removeMediator(Mediator<?> mediator) {
// not managed
}
@Override
public String getText() {
// not managed
return null;
}
};
return result;
return new NexusFileNameChanger();
}
@Override
......@@ -435,4 +401,52 @@ public class CurrentScanResultBean extends AbstractTangoBox
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
// ///////////// //
// Inner classes //
// ///////////// //
// Must implement IDrawableTarget to be changed in EDT (SCAN-976, PROBLEM-2582)
protected class NexusFileNameChanger implements ITextTarget, IDrawableTarget {
@Override
public void addMediator(Mediator<?> mediator) {
// not managed
}
@Override
public void removeMediator(Mediator<?> mediator) {
// not managed
}
@Override
public IDrawingThreadManager getDrawingThreadManager() {
return EDTManager.INSTANCE;
}
@Override
public String getText() {
// not managed
return null;
}
@Override
public void setText(String file) {
if (file != null && !file.isEmpty() && !StringScalarBox.DEFAULT_ERROR_STRING.equals(file)) {
String fileName = file;
int index = file.lastIndexOf(TangoDeviceHelper.SLASH);
if (index > -1) {
fileName = file.substring(index + 1);
}
nexusFileName.setText(FILE + fileName);
nexusFileName.setVisible(true);
nexusFileName.setToolTipText(file);
} else {
nexusFileName.setText(ObjectUtils.EMPTY_STRING);
nexusFileName.setVisible(false);
nexusFileName.setToolTipText(ObjectUtils.EMPTY_STRING);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment