Thursday, 1 December 2011

A visibility and juxtaposability problem solved

I've been waiting for the point where my expert knowledge of Cognitive Dimensions will change what I would have done anyway (at least, in a conscious manner, rather than just general motivation). So yesterday, I figured out that there was a serious visibility/juxtaposability problem, resulting from references to layers that might have been "collapsed" out of the stack. It's possible (sometimes) to retrieve a layer by expanding the reference again, but this isn't an ideal option if your problem was simply that you'd forgotten what was on it (a trade-off between viscosity, visibility, or a hard mental operation - the three-way trade-off that Thomas described by analogy to the ideal gas law, back in the 1998 tutorial). In fact, even if the layer is somewhere in the stack, it might not be easy to find it - a fundamental problem with the whole layers idea. References have always had the default behaviour that they will navigate you to the right place in the stack, but this is annoying too - because you lose your previous context, which doesn't allow juxtaposability.

So the outcome today was to implement a function that allows you to hover over any layer reference, and get a preview of that layer's contents, whether or not the layer is currently present in the stack (illustration here - the ink spiral is a layer that has been deleted from the stack, but still has a reference button - I've hovered over that button to see the contents of the original layer).


As so often, the simple concept was harder to implement than I thought. JavaScript apparently supports a 'hover' callback as a standard attribute of UI widgets, but Java components do not. Implementing hover within my mouse interaction model meant that I had to grapple with threads more seriously, to figure out what to do when the mouse isn't moving. On the positive - 'craft' reflection - side, it's an oddly pleasing feeling when you finally have some purpose for the spurious empty implementations of interface methods that Java makes you leave around all over the place. This was the first time that I've had anything I wanted to do with the mouseMoved (as opposed to mouseDragged) method of the MouseMotionListener.

No comments:

Post a Comment