/* After building up the history we set up the layout that we show the user when the
   * applications starts. */
  private static void setUpFinalLayout(
      CPerspective perspective, Map<String, CDockablePerspective> dockables) {
    /* We minimize the "red" and the "black" dockable */
    CMinimizePerspective west = perspective.getContentArea().getWest();
    west.add(dockables.get("Red"));

    CMinimizePerspective east = perspective.getContentArea().getEast();
    east.add(dockables.get("Black"));
  }
  /* It is possible to access and modify history information directly. In this case
   * modify the history of the "White" dockable such that it thinks it was minimized
   * on the "north" minimize-area. */
  private static void modifyHistoryDirectly(
      CPerspective perspective, Map<String, CDockablePerspective> dockables) {
    CMinimizePerspective north = perspective.getContentArea().getNorth();
    CDockablePerspective white = dockables.get("White");

    /* We first inform the north minimize-area that "white" was a child by
     * inserting a placeholder for "white" */
    north.addPlaceholder(white);

    /* Now we build up location information first by specifying the exact location of "white" */
    DockableProperty property =
        new FlapDockProperty(0, false, 100, white.intern().asDockable().getPlaceholder());
    /* We pack additional information like the mode and the root-station that was the parent of
     * "white" together. */
    Location location =
        new Location(ExtendedMode.MINIMIZED.getModeIdentifier(), north.getUniqueId(), property);
    /* And finally we add the new location information to the history. */
    white.getLocationHistory().add(ExtendedMode.MINIMIZED, location);
  }
  /* This method assigns the minimized location to the dockables */
  private static void setUpMinimized(
      CPerspective perspective, Map<String, CDockablePerspective> dockables) {
    /* In the beginning we access different minimize-perspectives and just drop our dockables
     * onto them. */
    CMinimizePerspective west = perspective.getContentArea().getWest();
    west.add(dockables.get("Red"));
    west.add(dockables.get("Green"));
    west.add(dockables.get("Blue"));

    CMinimizePerspective east = perspective.getContentArea().getEast();
    east.add(dockables.get("Yellow"));
    east.add(dockables.get("White"));
    east.add(dockables.get("Black"));

    CMinimizePerspective south = perspective.getContentArea().getSouth();
    for (int i = 0; i < 5; i++) {
      south.add(dockables.get("m" + i));
    }

    /* And then we instruct the framework that the current location of the dockables should
     * be stored as history information.
     * The dockables remain at their current location, but we can just re-arrange them later. */
    perspective.storeLocations();
  }