Skip to content

Commit

Permalink
Improve desktop UI
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Sep 19, 2024
1 parent f78e7ab commit eb940cf
Show file tree
Hide file tree
Showing 46 changed files with 1,784 additions and 1,008 deletions.
4 changes: 4 additions & 0 deletions sdmx-dl-desktop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
<artifactId>miglayout-swing</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>com.github.nbbrd.java-io-util</groupId>
<artifactId>java-io-xml-bind</artifactId>
</dependency>

<!-- runtime only -->
<dependency>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package internal.sdmxdl.desktop;

import nbbrd.io.xml.Xml;
import nbbrd.io.xml.bind.Jaxb;
import sdmxdl.Languages;
import sdmxdl.desktop.DataSourceRef;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
import java.util.stream.Collectors;

import static java.util.Collections.emptyList;

public final class XmlDataSourceRef {

private XmlDataSourceRef() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}

public static final Xml.Parser<List<DataSourceRef>> PARSER = Jaxb.Parser.of(DataSourceBeans.class).andThen(DataSourceBeans::to);
public static final Xml.Formatter<List<DataSourceRef>> FORMATTER = Jaxb.Formatter.of(DataSourceBeans.class).compose(DataSourceBeans::from);

@XmlRootElement
@lombok.Data
public static class DataSourceBeans {

List<DataSourceBean> list;

static DataSourceBeans from(List<DataSourceRef> list) {
DataSourceBeans result = new DataSourceBeans();
result.list = list.stream().map(DataSourceBean::from).collect(Collectors.toList());
return result;
}

List<DataSourceRef> to() {
return list != null ? list.stream().map(DataSourceBean::to).collect(Collectors.toList()) : emptyList();
}
}


@XmlRootElement
@lombok.Data
public static class DataSourceBean {

String source;
String catalog;
String flow;
List<String> dimensions;
String languages;

static DataSourceBean from(DataSourceRef ref) {
DataSourceBean result = new DataSourceBean();
result.source = ref.getSource();
result.catalog = ref.getCatalog();
result.flow = ref.getFlow();
result.dimensions = ref.getDimensions();
result.languages = ref.getLanguages().toString();
return result;
}

DataSourceRef to() {
return DataSourceRef
.builder()
.source(source)
.catalog(catalog)
.flow(flow)
.dimensions(dimensions != null ? dimensions : emptyList())
.languages(Languages.parse(languages))
.build();
}
}
}
Loading

0 comments on commit eb940cf

Please sign in to comment.