/**
   * Creates a new guard
   *
   * @param controller The controller for which actions are created.
   */
  public ReplaceActionGuard(DockController controller) {
    if (controller == null) throw new IllegalArgumentException("Controller should not be null");

    action = new ReplaceAction(controller);
    source = new DefaultDockActionSource();

    source.setHint(new LocationHint(LocationHint.ACTION_GUARD, LocationHint.LEFT));
    setVisible(true);
  }
 /**
  * Tells whether the action of this guard can be seen or not
  *
  * @return <code>true</code> if the action can be seen
  */
 public boolean isVisible() {
   return source.getDockActionCount() > 0;
 }
 /**
  * Sets the visibility of the action. The visibility can be changed at any time and has effect on
  * all occurrences of the action.
  *
  * @param visible the new state
  */
 public void setVisible(boolean visible) {
   if (visible != isVisible()) {
     if (visible) source.add(action);
     else source.remove(0, source.getDockActionCount());
   }
 }