// such as in-place editors around the workspace.
setLayout(null);
// Set the background color
Color workspaceColor = ModelerColors.WORKSPACE;
Option o = OptionMgr.getInstance().getOption("editor.color.workspace");
if (o != null)
{
workspaceColor = (Color) o.getValue();
}
setBackground(workspaceColor);
// setDisplayUpdate (new BufferedUpdateStrategy ());
setDisplayUpdate(new SimpleUpdateStrategy());
ToolTipManager.sharedInstance().registerComponent(this);
// Decorator handles its own adding to the decomgr.
selectionDecorator = new SelectionDecorator(this, editor);
selection = new LinkedList();
// Mouse and mouse wheel handling
addMouseListener(new MouseAdapter()
{
public void mouseEntered(final MouseEvent e)
{
mouseInView = true;
}
public void mouseExited(final MouseEvent e)
{
mouseInView = false;
}
});
addMouseWheelListener(new MouseWheelListener()
{
public void mouseWheelMoved(MouseWheelEvent e)
{
int notches = e.getWheelRotation();
if (InputState.isCtrlDown())
{
invalidate();
// Scale according to mouse movement using heuristic values
double scaleFactor = getScaleFactor();
scaleFactor *= (100d + (notches * 2)) / 100;
setScaleFactor(scaleFactor);
redraw();
}
else
{
int mult = e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL ? 25 : 100;
((Trackable) editor()).moveTrackerBy(0, notches * mult);
}
}
});
// Add support for selection and workspace movement by cursor keys
addCursorKeySupport();
// Breakout menu support for standard and user toolbox breakout
addBreakoutSupport("breakout", KeyEvent.VK_SPACE);
addBreakoutSupport("userbreakout", KeyEvent.VK_1);
// Load user options
gridType = OptionMgr.getInstance().getIntegerOption("editor.grid.type", gridType);
gridDisplayed = OptionMgr.getInstance().getBooleanOption("editor.grid.display", gridDisplayed);
o = OptionMgr.getInstance().getOption("editor.shadow");
if (o != null)
{
shadowLayouter = (ShadowLayouter) o.getValue();
}
}