About

ObjectStyles for Java aims to simplify client GUI design through a declarative language based on CSS, but specifically designed to provide display, layout & interaction capabilities to plain Java object graphs, much in the same manner CSS provides this functionality for XML based documents.

To illustrate how it works look at the code below that compares traditional CSS/HTML styling with ObjectStyle.

HTML with CSS Java with ObjectStyles
// CSS code
person {
   display: block;
   background: silver;
}

person .lastname {
   display: inline;
}
person .firstname {
   display: inline;
}
// ObjectStyles code
Person {
   display: block;
   background: silver;
}

Person .LastName {
   display: inline;
}
Person .FirstName {
   display: inline;
}
<person>
   <lastname>
      Doe
   </lastname>
   <firstname>
      John
   </firstname>
</person>
public interface Person {
    String getLastName();
    String getFirstName();
}

The simple examples provided have identical code in CSS and the ObjectSyles language, but this won't always be the case. Object graphs will need additional properties to define things that CSS does not handle as it is.

There is no requirement to adhere to CSS in any way. It was simply chosen because it already provides a lot of useful constructs and an elegant syntax, but the language will be adjusted or enhanced any place we feel it can be improved to be better adapted to the task at hand: displaying data in object graphs and providing a means for editing this data.

For example, selectors may need enhancement to better work with Java class inheritance, possibly providing a way to select a class or any of its descendants, or just that class, without affecting descendants.

Another place where I think we might need to provide some adjustments is with respect to layout, it is possible to provide plugin layout engines for example.

Get Involved

The project is still in its planning phase. There's lots to do and it's a great time to provide some significant contributions. Some minimal proof-of-concept code will be posted real soon in the CVS server.

Please feel free to post any thoughts or suggestions in the forums over at the SourceForge project site, we need all the help we can get.

SourceForge.net Logo