import org.simantics.Simantics;
import org.simantics.db.Resource;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.district.network.ui.techtype.requests.WriteTechTypeTableRequest;
+import org.simantics.district.network.techtype.requests.WriteTechTypeTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public void setTechTypePath(String path) {
String data;
try {
- data = Files.lines(Paths.get(path)).collect(Collectors.joining("\n"));
+ data = Files.lines(Paths.get(path), Charset.defaultCharset()).collect(Collectors.joining("\n"));
} catch (IOException e) {
LOGGER.error("Failed to read contents of file '{}' as {}", path, Charset.defaultCharset(), e);
return;
}
try {
- Simantics.getSession().syncRequest(new WriteTechTypeTableRequest(componentType, data));
+ Simantics.getSession().syncRequest(new WriteTechTypeTable(componentType, data));
} catch (DatabaseException e) {
LOGGER.error("Failed to write tech type table data to model", e);
}
+ setTechTypeData(data);
+ }
+
+ public void setTechTypeData(String data) {
bodyDataProvider.setData(data);
table.refresh(true);
}
+ public void setComponentType(Resource componentType) {
+ this.componentType = componentType;
+ }
+
}
+