image provider

Smart Layouts


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

I am continually horrified at how reactionary computer programmers are. The techniques for constructing programs have barely changed since the days of the tube computer. We still carefully manually layout every screen, dialog box and printed page. Designing and maintaining these layouts consumes thousands of person-years. It is time to start thinking about how to automate the process.

There has been a tiny bit of progress. Back in 1979 I invented the scaffold for the text mode screen and introduced it in the Abundance computer language. Abundance has keywords for aligning automatically scrolling fields in rows or columns (or any other shape), automatically labelled. The language never caught on. There have been various report generators. A common problem with them is that the reports look klunky and use huge amounts of screen or paper real estate unless you hand tune the reports. In the late 1990s, Java introduced the Layout for the GUI (Graphic User Interface). It allows fields to automatically grow and shrink depending on how much screen real estate is available. In this project I would like to combine some of the features of Abundance smart objects and scaffolds with features from Java Layouts to create smart Layouts for Java.

The idea is this. Instead of carefully specifying how to lay out a dialog box, the programmer just specifies which fields are to be included. The smart layout completely handles laying out, labelling and displaying the fields. Its job is to produce beautiful layouts given the constraint of how much screen real estate is available.

How could this possibly work? First you need smart objects. They must be able to tell the layout manager such facts as:

You need some sort of metric of what beautiful means. You have to look at a great many layouts both ugly and good and figure out what it is that makes a layout beautiful. If you can mechanically compute the beauty of any given layout, you can in a pinch use brute force to generate all possible layouts for the given group of fields and keep the most beautiful.

What sort of tricks can you use if real estate is very tight?

  1. Shrink/expand each field box to fit the current data rather than trying to use a uniform layout optimised for average or worst case data.
  2. Use a smaller font.
  3. Use a condensed font.
  4. Set up ScrollPanes.
  5. Hide low priority information, replacing with an icon you click to see the details.
  6. Use a times square display.
  7. Suppress labelling fields.

Even if your smart Layout does not generate layouts as beautiful as could be hand crafted, it will generate them accurately and quickly, at a fraction of the cost of having humans meticulously lay them out and tweak them with GridBags. It becomes possible to write applications that generate new reports and layouts dynamically, trusting your layout manager to come up with something reasonable. Internationalisation becomes much cheaper since layouts don’t have to be hand-tweaked for each language.

An initial version may run prior to compilation and generate Java code. It does not matter if it is slow to execute. As computers get faster it may become feasible to write a version that runs as a standard layout manager. Eventually you could conceivably run it every time any value in a display changes.

I have already done some work with smart, self-labelling Java objects. My objects are primarily concerned with data entry, automatically generating data entry prompts and error messages and fetching and storing data from JDBC (Java Data Base Connectivity), rather than automatically laying themselves out, but it is a start. See CMP Business Classes.


This page is posted
on the web at:

http://mindprod.com/project/smartlayout.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\smartlayout.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.205.8.87]
You are visitor number