/** * Ensures that all {@link DockRelocatorMode}s are in the state that fits the current set of * modifiers. * * @param modifiers the state of the last {@link MouseEvent}, see {@link * MouseEvent#getModifiersEx()} */ protected void checkModes(int modifiers) { for (DockRelocatorMode mode : modes) { boolean active = mode.shouldBeActive(controller, modifiers); if (active) { if (activeModes.add(mode)) mode.setActive(controller, true); } else { if (activeModes.remove(mode)) mode.setActive(controller, false); } } }
/** Sets all {@link DockRelocatorMode}s to inactive. */ protected void disableAllModes() { for (DockRelocatorMode mode : activeModes) mode.setActive(controller, false); activeModes.clear(); }
/** * Removes a mode that has earlier been added to this relocator. * * @param mode the mode to remove */ public void removeMode(DockRelocatorMode mode) { if (activeModes.remove(mode)) mode.setActive(controller, false); modes.remove(mode); }