My favorites | Sign in
Project Home Downloads Wiki Issues
Project Information
Members

GUI Creating Language (GCL) is a DSL (Domain Specific Language) for creating Graphical User Interfaces. It utilizes a simple language for creating forms with a set of widgets. Currently the GCL works with the Java Swing library. Basic assumptions of the GCL:

  • works with ordinary Java classes. No specific inheritance or interfaces needed,
  • in the simplest case the library creates the form automatically based on the passed data (Java) instance without specifying any additional parameters,
  • wide customization possibilities using a dedicated syntax,
  • it is also possible to create a form without a data instance (Ad Hoc GUIs),
  • creates the following types of Swing controls:
    • frames,
    • internal frames,
    • dialogs,
    • panels.
  • the controls allow editing and showing instances of the Java classes.
  • all fields could be automatically validated,
Let’s start with some samples (emp, person, company are instances of typical Java classes describing business entities):

  • A default frame showing automatically generated content for the given instance of the Person class:
  • // Both syntaxes are valid and yields to exactly the same result
    JFrame frame1 =	create.
    		frame.
    		usingOnly(person);
    			
    JFrame frame2 =	create.
    		frame.
    		using(person).
    		containing();			

  • A customized frame showing automatically generated content for the given instance of the Person class:
  • JFrame frame =	create.
    		frame.
    		using(person).
    		containing(
    			attribute("firstName").as("First name"), 
    			attribute("lastName").validate(new ValidatorNotEmpty()),
    			attribute("higherEducation"),
    			method("getAge").as("Age"));

  • A default frame showing automatically generated content for the given instance of the Employee class (containing a complex type - Company):
  • frame =	create.
    	frame.
    	using(emp).
    	containing(
    		attribute("firstName").as("First name"), 
    		attribute("lastName").validate(new ValidatorNotEmpty()),
    		attribute("higherEducation"),
    		attribute("company").as("Company").asComplex(	// nested (complex) object description
    						attribute("name").as("Company name"),
    						attribute("income").as("Company income")),									
    		method("getAge").as("Age"));

A default frame showing automatically generated content for the given instance of the Company class (containing a multi-valued type - Employees):

JFrame frame =	create.
		frame.
		using(company).
		containing(
			attribute("name").as("Name"), 
			attribute("income"),
			attribute("employees"));

More samples could be found in the attached source code.

Powered by Google Project Hosting