Metawidget

3 min read Original article ↗

Building User Interfaces for domain objects is time-consuming and error-prone.

Metawidget is a smart widget that populates itself, either statically or at runtime, with UI components to match the properties of your domain objects.

Metawidget does this without introducing new technologies. It inspects your existing back-end architecture (such as JSON, REST, existing annotations, existing configuration files) and creates widgets native to your existing front-end framework (such as JavaScript, Java Server Faces, Android).

Metawidget does not replace or restrict your existing UI framework. It does not try to 'own' your UI. Its Open Source license allows the use of Metawidget in open source and commercial projects.

Supported Technologies

1. Front-Ends

Metawidget has a native component
for each of these
  • Android
  • Google Web Toolkit (GWT)
  • HTML 5 (POH5)
    • Freemarker
  • JavaScript
    • AngularJS
    • Bootstrap
    • JQuery Mobile
    • JQuery UI
    • Node.js
    • Web Components
  • Java Server Faces (JSF)
    • Facelets
    • ICEfaces
    • PrimeFaces
    • RichFaces
    • Tomahawk
  • Java Server Pages (JSP)
    • DisplayTag
  • Spring Web MVC
  • Struts
  • Swing
    • Beans Binding (JSR 295)
    • Commons BeanUtils
    • JGoodies Validator
    • MigLayout
    • SwingX
  • SWT
  • Vaadin
  • ...help us add more!

2. Back-Ends

Metawidget can read domain object
information from all of these
  • Annotations
  • Bean Validation (JSR 303)
  • Commons JEXL
  • Commons Validator
  • Groovy
  • Hibernate
  • Hibernate Validator
  • Jackson
  • JavaBeans
  • Java API for XML Binding (JAXB)
  • Java Persistence API (JPA)
  • Javassist
  • JBoss Forge
  • JBoss jBPM
  • JavaScript Object Notation (JSON)
  • JSON Schema
  • OVal
  • Representational State Transfer (REST)
  • Scala
  • Seam
  • Swing AppFramework
  • Web Services Description Language (WSDL)
  • XML Schema (XSD)
  • ...help us add more!

At a high level, the goals of Metawidget are:

  • to create UI widgets by inspecting existing architectures
  • not to try to 'own' the entire UI, but to focus on creating native subcomponents for slotting into existing UIs
  • to perform inspection either statically or at runtime, detecting types and subtypes dynamically

The download includes documentation and examples for all supported front-ends and back-ends. Click here to download it.

Desktop: Metawidget has a native Swing JComponent and a native SWT Composite

Web: Metawidget has a native component/taglib for each popular Web technology

Mobile: Metawidget has a native Android View

Inspect: all Metawidgets, regardless of which front-end they are native to, use a common inspection process to inspect the existing back-end architecture

Properties: Metawidget inspects runtime properties from objects such as JavaBeans, Scala objects and JavaScript objects

Annotations: Metawidget inspects runtime objects for existing annotations, such as JPA and Hibernate Validator annotations

XML: Metawidget inspects existing XML configuration files, such as
struts-config.xml, hibernate.cfg.xml and pageflow.jpdl.xml

Create: the inspection results are used to choose the best UI subcomponents, depending on those available on the native platform. This includes support for third-party component libraries

Web: Metawidget creates native components/taglibs for each popular Web technology, including attaching validators

Desktop: Metawidget creates native Swing JComponents, optionally bound with Beans Binding (JSR 295), and native SWT Controls

Mobile: Metawidget creates native Android Views

Embed: the native UI subcomponents slot into the existing front-end