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

- code readapted to changed in CometeTrend

- restored the possibility to open atktrend files in databrowser
parent a306d90b
Branches
Tags
No related merge requests found
...@@ -53,12 +53,6 @@ ...@@ -53,12 +53,6 @@
<dependency> <dependency>
<groupId>fr.soleil.lib.comete</groupId> <groupId>fr.soleil.lib.comete</groupId>
<artifactId>TangoDataSource</artifactId> <artifactId>TangoDataSource</artifactId>
<!-- <exclusions>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions> -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>fr.soleil.comete.bean</groupId> <groupId>fr.soleil.comete.bean</groupId>
......
...@@ -46,6 +46,7 @@ import fr.soleil.comete.tango.data.service.helper.TangoAttributeHelper; ...@@ -46,6 +46,7 @@ import fr.soleil.comete.tango.data.service.helper.TangoAttributeHelper;
import fr.soleil.comete.tango.data.service.helper.TangoConstHelper; import fr.soleil.comete.tango.data.service.helper.TangoConstHelper;
import fr.soleil.comete.tango.data.service.helper.TangoDeviceHelper; import fr.soleil.comete.tango.data.service.helper.TangoDeviceHelper;
import fr.soleil.comete.tango.data.service.helper.TangoExceptionHelper; import fr.soleil.comete.tango.data.service.helper.TangoExceptionHelper;
import fr.soleil.data.service.BasicKey;
import fr.soleil.data.service.DataSourceProducerProvider; import fr.soleil.data.service.DataSourceProducerProvider;
import fr.soleil.data.service.HistoryKey; import fr.soleil.data.service.HistoryKey;
import fr.soleil.data.service.IKey; import fr.soleil.data.service.IKey;
...@@ -130,12 +131,18 @@ public class TangoDataSourceBrowser extends AbstractDataSourceProducerBrowser { ...@@ -130,12 +131,18 @@ public class TangoDataSourceBrowser extends AbstractDataSourceProducerBrowser {
@Override @Override
public boolean canRead(final IKey key) { public boolean canRead(final IKey key) {
boolean canRead = false; boolean canRead;
IKey currentKey = getAdaptedKey(key); IKey currentKey = getAdaptedKey(key);
canRead = currentKey instanceof TangoKey; canRead = currentKey instanceof TangoKey;
if ((!canRead) && (currentKey instanceof HistoryKey) && (currentKey.getInformationKey() != null)) { if ((!canRead) && (currentKey instanceof HistoryKey) && (currentKey.getInformationKey() != null)) {
canRead = canRead(currentKey.getInformationKey()); canRead = canRead(currentKey.getInformationKey());
// System.err.println("canRead key=" + currentKey.getInformationKey() + canRead); } else if (key instanceof BasicKey) {
try {
File tmp = new File(key.getInformationKey());
canRead = tmp.canRead() && !tmp.isDirectory();
} catch (Exception e) {
canRead = false;
}
} }
return canRead; return canRead;
} }
......
...@@ -4,10 +4,11 @@ import java.io.BufferedReader; ...@@ -4,10 +4,11 @@ import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Map.Entry;
import org.cdma.gui.databrowser.interfaces.AxisType; import org.cdma.gui.databrowser.interfaces.AxisType;
...@@ -24,11 +25,11 @@ import fr.soleil.data.service.IKey; ...@@ -24,11 +25,11 @@ import fr.soleil.data.service.IKey;
public class TangoFile { public class TangoFile {
private final List<IKey> simpleKeyList = new ArrayList<IKey>(); private final List<IKey> simpleKeyList = new ArrayList<>();
private final List<HistoryKey> trendKeyList = new ArrayList<HistoryKey>(); private final List<HistoryKey> trendKeyList = new ArrayList<>();
private BufferedReader br = null; private BufferedReader br = null;
private final Map<IKey, PlotProperties> plotPropertiesMap = new HashMap<IKey, PlotProperties>(); private final Map<IKey, PlotProperties> plotPropertiesMap = new HashMap<>();
private final ChartProperties chartProperties; private final ChartProperties chartProperties;
...@@ -38,17 +39,16 @@ public class TangoFile { ...@@ -38,17 +39,16 @@ public class TangoFile {
// First test with ATKTrend // First test with ATKTrend
TrendFile trendFile = new TrendFile(fileName); TrendFile trendFile = new TrendFile(fileName);
Map<IKey, PlotProperties> tmpPlotPropertiesMap = trendFile.getPlotPropertiesMap();
chartProperties = trendFile.getChartProperties(); chartProperties = trendFile.getChartProperties();
Collection<Entry<IKey, PlotProperties>> knownPlotProperties = trendFile.getKnownPlotProperties();
Set<IKey> keySet = tmpPlotPropertiesMap.keySet(); if ((knownPlotProperties != null) && !knownPlotProperties.isEmpty()) {
if ((tmpPlotPropertiesMap != null) && !tmpPlotPropertiesMap.isEmpty()) {
PlotProperties plotProperties = null; PlotProperties plotProperties = null;
// AxisPrefix axisPrefix = null; // AxisPrefix axisPrefix = null;
for (IKey key : keySet) { for (Entry<IKey, PlotProperties> entry : knownPlotProperties) {
plotProperties = tmpPlotPropertiesMap.get(key); IKey key = entry.getKey();
plotProperties = entry.getValue();
if (plotProperties.getAxisChoice() != TrendFile.AXIS_NONE) { if (plotProperties.getAxisChoice() != TrendFile.AXIS_NONE) {
if (key instanceof HistoryKey) { if (key instanceof HistoryKey) {
trendKeyList.add((HistoryKey) key); trendKeyList.add((HistoryKey) key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment