Discover Table compatibility and declared Row alignment
This commit is contained in:
+16
-10
@@ -133,10 +133,13 @@ final class RepeatDiscovery {
|
||||
}
|
||||
|
||||
RepeatOption component(String name, String path) {
|
||||
return component(name, collection(path));
|
||||
}
|
||||
|
||||
RepeatOption component(String name, RepeatOption source) {
|
||||
ComponentInfo info = components.computeIfAbsent(name, this::readComponent);
|
||||
if (info.error() != null)
|
||||
return new RepeatOption(name, info.declared(), "INCOMPATIBLE", info.error());
|
||||
var source = collection(path);
|
||||
if (source.status().equals("INCOMPATIBLE"))
|
||||
return new RepeatOption(
|
||||
name, info.declared(), "UNVERIFIED", "Choose a collection to compare element types");
|
||||
@@ -215,15 +218,7 @@ final class RepeatDiscovery {
|
||||
|| !ControllerMetadata.accessible(accessor.getDeclaringClass(), true))
|
||||
throw new IllegalArgumentException("Component needs an accessible writable modelProperty");
|
||||
Class<?> property = BindingDiscovery.propertyType(accessor.getGenericReturnType(), Map.of());
|
||||
var resource = type.getResource(type.getSimpleName() + ".fxml");
|
||||
if (resource == null)
|
||||
throw new IllegalArgumentException("Component FXML unavailable: " + name);
|
||||
Document doc;
|
||||
try (var in = resource.openStream()) {
|
||||
byte[] bytes = in.readNBytes(512 * 1024 + 1);
|
||||
if (bytes.length > 512 * 1024) throw new IOException("Component FXML exceeds limit");
|
||||
doc = BindingDiscovery.parse(new String(bytes, StandardCharsets.UTF_8));
|
||||
}
|
||||
Document doc = resource(type);
|
||||
Element root = doc.getDocumentElement();
|
||||
if (!"http://javafx.com/fxml/1".equals(root.getNamespaceURI())
|
||||
|| !"root".equals(root.getLocalName()))
|
||||
@@ -255,6 +250,17 @@ final class RepeatDiscovery {
|
||||
}
|
||||
}
|
||||
|
||||
static Document resource(Class<?> type) throws Exception {
|
||||
var resource = type.getResource(type.getSimpleName() + ".fxml");
|
||||
if (resource == null)
|
||||
throw new IllegalArgumentException("Component FXML unavailable: " + type.getName());
|
||||
try (var in = resource.openStream()) {
|
||||
byte[] bytes = in.readNBytes(512 * 1024 + 1);
|
||||
if (bytes.length > 512 * 1024) throw new IOException("Component FXML exceeds limit");
|
||||
return BindingDiscovery.parse(new String(bytes, StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
private void indexResources() throws IOException {
|
||||
var entries = new LinkedHashSet<String>();
|
||||
for (String key : List.of("java.class.path", "jdk.module.path"))
|
||||
|
||||
Reference in New Issue
Block a user