public void setAutoHide(Dockable dockable, boolean hide) {
		/*
		 * setAutoHide is called by user applications (or addHidenDockable() )
		 * and from inside the framework : - Tab actions (only when in the
		 * DOCKED state) - DockView (listening to DockViewTitleBar property
		 * change - key events from the desktop - the AutoHideExpandPanel
		 * listening to DockViewTitleBar changes
		 * 
		 * this method is not used when hiding from FLOATING state, the
		 * "floatingToHide" method is used istead to avoid triggering unused
		 * events
		 */
		DockKey k = dockable.getDockKey();

		DockableState currentState = getDockableState(dockable);
		DockableState.Location currentLocation = getLocation(currentState);

		if (hide) {
			// build a relative position based on the compound container or top
			// container.
			RelativeDockablePosition position = new RelativeDockablePosition(
					getRelativeAncestorContainer(dockable), dockable);
			DockableState newState = new DockableState(this, dockable,
					DockableState.Location.HIDDEN, position);
			DockableStateWillChangeEvent dswe = new DockableStateWillChangeEvent(
					currentState, newState);
			DockingActionEvent dae = new DockingActionSimpleStateChangeEvent(
					this, dockable, currentLocation,
					DockableState.Location.HIDDEN);

			if (currentLocation != DockableState.Location.HIDDEN
					&& isDockingActionAccepted(dae, dswe)) {
				AutoHideButton btn = autoHideButtons.get(k);
				if (btn == null) {
					btn = new AutoHideButton();
					autoHideButtons.put(k, btn);

					int zone;
					if (k.getAutoHideBorder() == null) {
						zone = AutoHidePolicy.getPolicy()
								.getDefaultHideBorder().value();
					} else {
						zone = k.getAutoHideBorder().value();
					}
					btn.init(dockable, zone);

					borderPanes[zone].setVisible(true); // border may not be
														// visible
					borderPanes[zone].add(btn);
					borderPanes[zone].revalidate();
				} else { // btn already existing, show it again
					int zone = btn.getZone();
					borderPanes[zone].setVisible(true); // may not be visible
					btn.setVisible(true);
					borderPanes[zone].revalidate();
				}
				// now, remove the view from the splitcontainers
				hide(dockable);
				context.setDockableState(dockable, newState);
				k.setLocation(DockableState.Location.HIDDEN);
				fireDockingAction(dae, new DockableStateChangeEvent(
						currentState, newState));
				if (dockable instanceof CompoundDockable) {
					// V2.1 : also trigger a dockable state change event for
					// compound dockable children
					updateCompoundChildrenState((CompoundDockable) dockable,
							DockableState.Location.HIDDEN);
				}

				DockingUtilities.updateResizeWeights(dockingPanel);
				revalidate();
			}
		} else { // SHOW

			// remove the button, show again the view
			DockableState newState = new DockableState(this, dockable,
					DockableState.Location.DOCKED);
			DockableStateWillChangeEvent dswe = new DockableStateWillChangeEvent(
					currentState, newState);

			RelativeDockablePosition pos = currentState.getPosition();
			Container relativeContainer = pos.getRelativeAncestorContainer();
			if (relativeContainer == null) {
				relativeContainer = dockingPanel; // safety : when a component
													// is loaded from workspace,
				// we currently loose the container information @todo fix this
				// container in xmlBuildAutoHideNode
			}
			DockingActionEvent dae = RelativeDockingUtilities
					.getInsertionDockingAction(relativeContainer, dockable,
							currentState, newState);

			if (!currentState.isDocked() && isDockingActionAccepted(dae, dswe)) {
				AutoHideButton btn = autoHideButtons.get(k);

				assert btn != null;

				int zone = btn.getZone();

				btn.setVisible(false);
				expandPanel.collapse();
				if (borderPanes[zone].getVisibleButtonCount() == 0) {
					// hide button panel if no more buttons (to avoid a
					// remaining visible border)
					borderPanes[zone].setVisible(false);
					revalidate();
				}

				expandPanel.remove(dockable);

				show(dockable, dae);

				context.setDockableState(dockable, newState);

				k.setLocation(DockableState.Location.DOCKED);
				fireDockingAction(dae, new DockableStateChangeEvent(
						currentState, newState));

				if (dockable instanceof CompoundDockable) {
					// V2.1 : also trigger a dockable state change event for
					// compound dockable children
					updateCompoundChildrenState((CompoundDockable) dockable,
							DockableState.Location.DOCKED);
				}

				DockingUtilities.updateResizeWeights(dockingPanel);
				revalidate();
			}

		}
	}