Tuesday, January 11, 2011

What's this blogging thing anyhow ?

I'm being dragged into the blogosphere by forces beyond my control (i.e. work...;-). It's time that I started adding some content to the web rather than just absorbing what I can...

This initial blog is to 'kick the tires', I'm intending to write a variety of different types of posts but at least some will deal with my favorite subject; GUI design.This means that I've gotta know how to get both code snippets and images to appear correctly so here it goes...

Here's an image of some work that I've done for Eclipse E4. It's a light-weight sash manager that doesn't require multiple layers of SWT widgets to match the tree of sashes. It's other cool feature is that it allows dragging more than one sash at a time.

OK, that's an image test, now for some code. Here's a code snippet showing how the E4 TrimBar layout is implemented...


    private static int getWeight(MUIElement element) {
        String info = element.getContainerData();
        if (info == null || info.length() == 0) {
            element.setContainerData(Integer.toString(100));
            info = element.getContainerData();
        }

        try {
            int value = Integer.parseInt(info);
            return value;
        } catch (NumberFormatException e) {
            return 500;
        }
    }

Ok then, not bad but I'd really like to carry over the code's chroma-coding from my source.