Swixml, XML-based domain-specific language for declaring Java Swing GUIs

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Swixml, XML-based domain-specific language for declaring Java Swing GUIs - Presentation Transcript

    1. “GUIs are described in XML documents, parsed at runtime, and rendered into javax.swing components.” [Apache License V.2.0] Wolf Paulus
    2. <html> <head> .. <link rel=\"stylesheet\" type=\"text/css\" href=\"/Styles/main.css\"/> <script type=\"text/javascript\" src=\"/Scripts/global.js\"/> </head> <body> <div id=\"content\"> .. </div> .. </body> </html> Separation of Concerns Copyright (C) 2007 Wolf Paulus
    3. Models Knowledge Requirements Declarative Real World Architecture Imperative Code Copyright (C) 2007 Wolf Paulus
    4. <?xml version=\"1.0\" encoding=\"UTF-8\"?> <frame size=\"440,380\" title=\"Hello SWIXML World\"> <panel constraints=\"BorderLayout.NORTH\"> <label font=\"ARIAL-BOLD-16\" foreground=\"blue\" text=\"Hello World!\"/> </panel> <panel constraints=\"BorderLayout.SOUTH\"> <button text=\"Click Here\" /> </panel> </frame> Copyright (C) 2007 Wolf Paulus
    5. public class Foo { public Foo() throws Exception { new SwingEngine().render( \"xml/gui.xml\" ).setVisible( true ); } public static void main( String[] args ) throws Exception { new Foo(); } } Copyright (C) 2007 Wolf Paulus
    6. <frame size=\"440,380\" title=\"Hello SWIXML World\"> ... ... equivalent to ... JFrame frame = new JFrame(); frame.setSize( new Dimension( 440, 380 ) ); frame.setTitle( “Hello SWIXML World” ); Copyright (C) 2007 Wolf Paulus
    7. ! applet ! label ! slider ! button ! list ! spinner ! buttongroup ! menu ! splitpane ! checkbox ! menubar ! tabbedpane ! checkboxmenuitem ! menuitem ! table Elements ! combobox ! optionpane ! tableheader ! component ! panel ! textarea ! desktoppane ! passwordfield ! textfield ! dialog ! popupmenu ! textpane ! editorpane ! progressbar ! togglebutton ! formattedtextfield ! radiobutton ! toolbar ! frame ! radiobuttonmenuitem ! tree ! hbox ! scrollpane ! vbox ! internalframe ! separator custom tags ! ... Copyright (C) 2007 Wolf Paulus
    8. public class Foo { public Foo() throws Exception { SwingEngine.getTaglib().registerTag( \"Calendar\", JCalendar.class ); new SwingEngine().render( \"xml/jcal.xml\" ).setVisible( true ); } public static void main( String[] args ) throws Exception { new Foo(); } } Copyright (C) 2007 Wolf Paulus
    9. <?xml version=\"1.0\" encoding=\"UTF-8\" ?> <frame title=\"Custom Tags\" size=\"400,260\"> <panel layout=\"BorderLayout\"> <panel background=\"white\" constraints=\"BorderLayout.NORTH\"> <label font=\"Comic Sans MS-BOLD-18\" foreground=\"black\"> Custom Components in Swixml ! ! </label> </panel> <calendar border=\"TitledBorder(JCalendar)\" initclass=\"java.util.Date\"/> </panel> </frame> Copyright (C) 2007 Wolf Paulus
    10. <frame ... plaf=\"org.jvnet.substance.skin.SubstanceRavenLookAndFeel\"> Quaqua Substance Copyright (C) 2007 Wolf Paulus
    11. <panel> <combobox action=”doSelect” initclass=”com.company.MyModel”/> </panel> .. equivalent to .. initclass() initclass( String s ) initclass.getInstance() JPanel pnl = new JPanel(); JComboBox cbx = new JComboBox(); cbx.setModel ( new com.company.MyModel() ); cbx.setAction( client.doSelect ); pnl.add( cbx ); Copyright (C) 2007 Wolf Paulus
    12. <frame ... bundle=\"locale.myBundle\" locale=\"de\"> src ! com.company ! ! MyClass.java ! ... ! xml myGUI.xml \" ... ! locale myBundle_en.properties myBundle_fr.properties myBundle_de.properties ! Copyright (C) 2007 Wolf Paulus
    13. accelerator name disabledicons text Localized displayedmnemonics title icon titleat icons titles Attributes iconimage tooltiptext label tooltiptexts mnemonic ... custom attributes mnemonics org.swixml.Parser.LOCALIZED_ATTRIBUTES.add( \"myAttribute\" ) Copyright (C) 2007 Wolf Paulus
    14. <label text=\"My blue label\" foreground=\"blue\" font=\"Verdana-BOLD-18”/> java.swing.Action java.awt.Insets javax.swing.border.Border javax.swing.KeyStroke java.awt.Color java.awt.LayoutManager java.awt.Dimension java.util.Locale Converters java.awt.Font java.awt.Point java.awt.Image java.awt.Rectangle javax.swing.Icon Primitives javax.swing.IconImage ... custom converters Copyright (C) 2007 Wolf Paulus
    15. public interface Converter { Object convert( Class type, Attribute attr, Localizer localizer ); Class convertsTo(); } ConverterLibrary.getInstance().register( myConverter ); Copyright (C) 2007 Wolf Paulus
    16. Kay Damgaard, Simplicity - 2004 Simplicity Copyright (C) 2007 Wolf Paulus
    17. <?xml version=\"1.0\" encoding=\"UTF-8\" ?> <frame ... > <menubar> <menu text=\"File\"> <menuitem id=\"mi_save\" text=\"Save\" actioncommand=\"AC_SAVE\"/> .. <panel border=\"EtchedBorder\"> <button id=”btn1” . . . /> .. public class Foo implements ActionListener { private JButton btn1; // auto-assigned by Swixml private JMenuItem mi_save; // auto-assigned by Swixml public Foo() throws Exception { Container c = new SwingEngine( this ).render( \"xml/gui.xml\" ); mi_save.addActionListener( this ); .. Copyright (C) 2007 Wolf Paulus
    18. <?xml version=\"1.0\" encoding=\"UTF-8\" ?> <frame ... > <menubar> <menu text=\"File\"> <menuitem text=\"Open File\" action=\"open\"/> <separator/> .. </frame> public class Foo { public Action open = new AbstractAction() { // auto-bound public void actionPerformed( ActionEvent e ) { // by Swixml ... } }; public Foo() throws Exception { new SwingEngine( this ).render( \"xml/gui.xml\" ).setVisible( true ); .. Copyright (C) 2007 Wolf Paulus
    19. Demo Copyright (C) 2007 Wolf Paulus
    20. Copyright (C) 2007 Wolf Paulus
    21. java.net swixml.org Copyright (C) 2007 Wolf Paulus
    22. Thanks Everyone Copyright (C) 2007 Wolf Paulus

    + Wolf PaulusWolf Paulus, 11 months ago

    custom

    832 views, 0 favs, 0 embeds more stats

    SwiXml is a small GUI generating engine for Java ap more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 832
      • 832 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?