• The complexity depends on your use. From the idea that you want partial update, I assume you do not use the display real estate in a scrolling manner. In other words, each information is always displayed in the same space, but sometimes it uses less and sometimes it uses more of that space. After all, you have to manage anyway that not too much is displayed because it would overwrite / reach into something else - when you have things side by side - and 'fall off the cliff' because it is too long to fit. and will get cut off.

    With these assumption you create a function for each information you display. The first thing that this function does is clearing out the space using .fillRect(...).

    This pattern can then be generalized, as you said that you are thinking of pages with fields on it. Create a Renderer that uses the visitor pattern to traverse a PageDefinition, which consists of an array of DisplayItems. Each DisplayItems contains just what you need:

    • for fix text: the x/y position and extend (x2/y2 or w(idth) and h(eight)), the text and - if not default font, font-size and colors - those are added.
    • for variable info: the x/y position and extend (x2/y2 or w(idth) and h(eight)), dotted.path.info from global to your value you want to display. To simplify this, you just put your data items as properties into a single global object when you calculate or read it. The dotted.path.info is then just this property name. I'll follow up w/ an example. I do exactly the same in my ui stuff (check your dm in forum).

Avatar for allObjects @allObjects started