use of com.gempukku.libgdx.graph.pipeline.producer.node.GraphNodeOutputImpl in project gdx-graph by MarcinSc.
the class UIPipelineConfigurer method processBoxProducer.
private static void processBoxProducer(JsonValue boxProducer) {
String producerType = boxProducer.name();
String producerName = boxProducer.getString("name");
String menuLocation = boxProducer.getString("menuLocation");
NodeConfigurationImpl nodeConfiguration = new NodeConfigurationImpl(producerType, producerName, menuLocation);
JsonValue inputs = boxProducer.get("inputs");
if (inputs != null) {
for (JsonValue input : inputs) {
String id = input.getString("id");
String name = input.getString("name");
boolean required = input.getBoolean("required", false);
boolean mainConnection = input.getBoolean("mainConnection", false);
boolean acceptMultiple = input.getBoolean("acceptMultiple", false);
JsonValue type = input.get("type");
String[] types = convertToArrayOfStrings(type);
GraphNodeInputImpl nodeInput = new GraphNodeInputImpl(id, name, required, mainConnection, acceptMultiple, types);
nodeConfiguration.addNodeInput(nodeInput);
}
}
JsonValue outputs = boxProducer.get("outputs");
if (outputs != null) {
for (JsonValue output : outputs) {
String id = output.getString("id");
String name = output.getString("name");
boolean mainConnection = output.getBoolean("mainConnection", false);
JsonValue validation = output.get("validation");
Function<ObjectMap<String, Array<String>>, String> validationFunction = convertToValidationFunction(validation);
JsonValue type = output.get("type");
String[] types = convertToArrayOfStrings(type);
GraphNodeOutputImpl nodeOutput = new GraphNodeOutputImpl(id, name, mainConnection, validationFunction, types);
nodeConfiguration.addNodeOutput(nodeOutput);
}
}
final JsonValue fields = boxProducer.get("fields");
GraphBoxProducerImpl producer = new GraphBoxProducerImpl(nodeConfiguration) {
@Override
public GraphBox createPipelineGraphBox(Skin skin, String id, JsonValue data) {
GraphBoxImpl result = createGraphBox(id);
if (fields != null) {
for (JsonValue field : fields) {
String fieldType = field.getString("type");
GraphBoxPart fieldGraphBoxPart = createFieldGraphBoxPart(fieldType, field);
fieldGraphBoxPart.initialize(data);
result.addGraphBoxPart(fieldGraphBoxPart);
}
}
addConfigurationInputsAndOutputs(result);
return result;
}
};
UIPipelineConfiguration.register(producer);
}
Aggregations