Discussions

News: Swing Browser - HTTP client for Swing components

  1. Swing Browser - HTTP client for Swing components (12 messages)

    https://swingbrowser.dev.java.net/ is an open source project initiated to develop a simple browser for swing components. Swing is mature UI toolkit from Sun for developing GUI.
    It is, however, limited only to java developers who know how to write java programs. Even these developers would agree that you need to write lot of code to create swing programs – plus modifications or changes on UI also require code changes.
    There have some attempts made to put UI definition in XML form and then write a program which converts this definition into Swing components. This however suffers one major problem – you end up mixing UI and business logic together in same XML document. This also means that your client becomes heavy-weight.
    The main idea behind this project is to learn from these mistakes and follow the tradition web client/server model – where client is dumb (imagine internet explorer minus JavaScript) and all processing is done on server side. Server generates documents and sends them to client for rendering/display and client sends back filled form or just requests for new document.
    Swing browser is a java application designed to render swing components by downloading/uploading (GET/POST) swing markup language (SML) documents from a web server.
    The SML document looks like html; however instead of html tags it has tags for JPanel, JLabel, JTree, JTable and other components. It also supports layout managers available in awt/swing.
    It is designed keeping page authors and developers in mind; thus the complexities of swing development are eliminated / minimized wherever possible. For example - you can populate data for table just like you do in html using tags for rows / columns. You do not have to provide listeners if you wish to process everything on server side.
    In short it works just like any web browser, except that user and developers work with swing components.

    Threaded Messages (12)

  2. Neat idea[ Go to top ]

    You might need to add scripting support I think as well for client side stuff. It would be neat as well if you could support basic CSS (only decorations). You might be able to use the built-in Rhino engine for the scripting.
  3. Re: Neat idea[ Go to top ]

    Are you saying that we should CSS to control styles for swing components ? This application does'nt render html documents ...it renders SML (swing markup language) documents. Though I do like the idea of using CSS instead of swing properties ...
  4. css[ Go to top ]

    Yes. One of the difficulties of desktop apps in general is that they are not easy to re-style like web apps. If you could support basic CSS styling with external CSS files it would be real time saver. Especially for organization which build both types of applications and want a consistent look and feel.
  5. Re: css[ Go to top ]

    Ok. In traditional destkop apps, styles are coded in UI application - it's part of the code. Here style is part of SML document ... In the example below, you cna see the alignment, colors specified as part of document .. I will still think about keeping sytle in CSS ..
  6. close to Sage browser[ Go to top ]

    (1) It looks like, in spirit, close to Sage browser from Don DeCoteau. Here is the Sage project.
    Sage has a special markup language (SDF) and associated MIME type (text/x-sdf) that lets it render Swing-based applications, the same way a web browser uses HTML to render documents.
    Sage supports also scripting:
    Instead of HTML, Sage uses a special CSS-like markup language to describe the application, actions, and interactions. It supports JavaScript, Ruby, Python and a number of other scripting languages for controlling the application and enabling complex interactions. JavaScript is the default scripting language and comes embedded with the engine (via Rhino and BSF 3). Additionally, Sage’s functionality can be augmented via dynamically downloaded java libraries or OS specific shared libraries (the same way you can download browser plug-ins and ActiveX components).
    It sounds to me as an interesting project. (2) Instead of XML coding, may be a DSL would be neat (easier to read ?) (3) it might be a good idea to revivid Swing as people are more familiar with a declaration style for UI definition, like (X)HTML. Dominique http://www.jroller.com/dmdevito
  7. Re: close to Sage browser[ Go to top ]

    DSL is good for developers ...what about non developers? I know JavaFX uses DSL model ...but currently people are more used to HTML ...
  8. Re: close to Sage browser[ Go to top ]

    DSL is good for developers ...what about non developers?

    I know JavaFX uses DSL model ...but currently people are more used to HTML ...
    Well, I am sick of XML as a language, I rather prefer a DSL. And, when I see how complicated JS programming could be, I think developers could learn DSL. This being said, you are right, people are more keen on HTML-like programming.
  9. Re: close to Sage browser[ Go to top ]

    DSL should be easy to write in JavaCC or ANTLR. However currently I use XML for data/schema. Schema is specified in RELAX-NG form - I just RELAX-NG validator over incoming input XML. You don't need to compile schema ...
  10. Re: close to Sage browser[ Go to top ]

    Also, the idea is to stick closer to curent web model of client (html/javascript) server (jsp/servlet/any other) I'm not sure if page authors (not developers) like the idea of writing UI code in a DSL than xml/html form ...it may require more effort on their part.
  11. related projects[ Go to top ]

    Other than Sage project, there are other related projects. JAXX (BSD license) : JAXX is an open-source XML User Interface framework for Java. JAXX enables you to write simple XML files describing components and their interactions, and then compile those XML files into ordinary Java classes. This projects has been created by Ethan Nicholas. Ethan has also written about another project of his own : Java CSS (GPL license). How Swing Browser is related to JAXX ? Thanks.
  12. Re: related projects[ Go to top ]

    Swing Browser does not compile xml into .java or .class. Instead, the renderer component of swing browser parses and renders the components on the fly. When you visit another url, it downloads SML document and renders it again - just like a web browser.
  13. Interesting project.
    There have some attempts made to put UI definition in XML form and then write a program which converts this definition into Swing components. This however suffers one major problem – you end up mixing UI and business logic together in same XML document.
    Minor gripe: SwiXML has UI definition in XML with events bound to logic in regular java classes. Anyway, good luck! Kit