- GUIComponent[] components = new GUIComponent[params.subComps.length];
- for (int i = 0; i < components.length; i++)
- {
- InnerComponentParams cParams = params.subComps[i];
- String path = cParams.type;
- if (path.startsWith("class:"))
- {
- path = path.substring(6);
- components[i] = createInnerComponentFromClass(comp, path, cParams.logicWidth);
- components[i].moveTo(cParams.pos.x, cParams.pos.y);
- } else if (path.startsWith("file:"))
- {
- path = path.substring(5);
- components[i] = create(comp.submodelModifiable, path);
- components[i].moveTo(cParams.pos.x, cParams.pos.y);
- } else
- throw new IllegalArgumentException("Invalid submodel type! Type was neither prefixed by 'class:' nor by 'file:'");
- }
-
- for (int i = 0; i < params.innerWires.length; i++)
- {
- InnerWireParams innerWire = params.innerWires[i];
- new GUIWire(comp.submodelModifiable,
- comp.submodelModifiable.getComponents().get(innerWire.pin1.compId).getPins().get(innerWire.pin1.pinIndex),
- comp.submodelModifiable.getComponents().get(innerWire.pin2.compId).getPins().get(innerWire.pin2.pinIndex),
- innerWire.path);
- }
+ InnerComponentParams cParams = params.subComps[i];
+ String path = cParams.name;
+ components[i] = GUIComponentCreator.create(comp.submodelModifiable, cParams.name, cParams.params);
+ components[i].moveTo(cParams.pos.x, cParams.pos.y);