public RadNestedForm(final ModuleProvider module, final String formFileName, final String id) throws Exception { super(module, JPanel.class, id); myFormFileName = formFileName; LOG.debug("Loading nested form " + formFileName); VirtualFile formFile = ResourceFileUtil.findResourceFileInDependents(getModule(), formFileName); if (formFile == null) { throw new IllegalArgumentException("Couldn't find virtual file for nested form " + formFileName); } Document doc = FileDocumentManager.getInstance().getDocument(formFile); final ClassLoader classLoader = LoaderFactory.getInstance(getProject()).getLoader(formFile); final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), new CompiledClassPropertiesProvider(classLoader)); myRootContainer = XmlReader.createRoot(module, rootContainer, classLoader, null); if (myRootContainer.getComponentCount() > 0) { getDelegee().setLayout(new BorderLayout()); JComponent nestedFormDelegee = myRootContainer.getComponent(0).getDelegee(); getDelegee().add(nestedFormDelegee, BorderLayout.CENTER); setRadComponentRecursive(nestedFormDelegee); } if (isCustomCreateRequired()) { setCustomCreate(true); } }
private LwRootContainer loadFormData(final String formPath) throws Exception { String formData = FileUtil.loadFile(new File(formPath)); final CompiledClassPropertiesProvider provider = new CompiledClassPropertiesProvider(getClass().getClassLoader()); return Utils.getRootContainer(formData, provider); }