SV: Matisse with XML?
"Christian Hessenbruch" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface,gmane.comp.java.ide.netbeans.user |
|---|---|
| Message-ID | <[email protected]> |
Not exactly! It's true that the exact layout could be serialized and that way could be removed from the code. But it would be difficult for the users to modify the xml-layout (for me to write a GUI designer that resembles Matisse). What I was not aware of, when I wrote the previous mail, is that the .form file contains the layout in xml. So I guess what I'm really requesting is a FormFileParser that will parse the .form file and requests the components from my application - then return a complete panel. -----Oprindelig meddelelse----- Fra: Wade Chandler [mailto:[email protected]] Sendt: 29. oktober 2005 19:35 Til: [email protected] Emne: Re: [nbui] Matisse with XML? --- Christian Hessenbruch <[email protected]> wrote: > > I hope that some of the developers behind Matisse is > on this mailinglist, cause I've got a suggestion, > and im not sure where to send it? > > What I think would be *really* cool, where if > Matisse offered the possiblity to export the > generated layout to XML, and also provided a parser > to turn the XML back into a layout. > > To apply the layout on my application I would have > to use 'GroupLayoutParser' that would parse the XML > and ask my application for the components using some > interface. > > My application would implement something like: > > Interface GroupLayoutComponentSupplier { > public Component getComponent(String name); > } > > And to populate the GUI I would call something like: > > File xmlfile = new File(mylayout.xml); > JPanel panel = > GroupLayoutParser.doLayoutPanel(xmlfile, this); // > this instanceof GroupLayoutComponentSupplier > > That way I would get rid of all the autogenerated > layout code, and be able to reuse a layout. Maybe I > could even allow the users of the application to > rearrange the gui as it no longer affects the code > (as long as components are not added). > > /Christian > I think java.beans.XMLEncoder may already do what you want to do. It will take a panel or frame and write it out to XML in it's format and then you can reinstate it later. It's a way to long term serialize beans and swing objects. Wade ************************************************************************ **** Virus checked by mailFence from Sure Solutions and nothing was found (www.SureSolutions.dk) ************************************************************************ ****