[[bookmarked-pages]]
= Bookmarked pages

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



The Wicket viewer supports the automatic bookmarking of domain objects, as per xref:refguide:applib:index/annotation/DomainObjectLayout.adoc#bookmarking[@DomainObjectLayout#bookmarking()].
However, it does _not_ support bookmarking of action prompts (xref:refguide:applib:index/annotation/ActionLayout.adoc#bookmarking[@ActionLayout#bookmarking()]).

Whenever a bookmarkable object/action is visited, then a bookmark is created.
To avoid the number of bookmarks from indefinitely growing, bookmarks that have not been followed after a while are automatically removed (an MRU/LRU algorithm).
The number of bookmarks to preserve can be configured.


== Screenshots

The following screenshot shows how bookmarks are rendered in the Wicket viewer:

image::bookmarked-pages/panel-estatio.png[width="800px"]

This screenshot demonstrates that bookmarks can be nested.
Some - like `Property` and `Lease` - are root nodes.
However, `Unit` is bookmarkable as a child of `Property`.
This parent/child relationship is reflected in the layout.

== Domain Code

To indicate a class is bookmarkable, use the xref:refguide:applib:index/annotation/DomainObjectLayout.adoc[@DomainObjectLayout] annotation:

[source,java]
----
@DomainObjectLayout(
    bookmarking=BookmarkPolicy.AS_ROOT
)
public class Lease { /* ... */ }
----

To indicate a class is bookmarkable but only as a child of some parent bookmark, specify the bookmark policy:

[source,java]
----
@DomainObjectLayout(
    bookmarking=BookmarkPolicy.AS_CHILD
)
public class LeaseItem { /* ... */ }
----


== User Experience

The sliding panel appears whenever the mouse pointer hovers over the thin blue tab (to the left of the top header region).

Alternatively, `alt+[` will toggle open/close the panel; it can also be closed using `Esc` key.


== Configuration

The maximum number of bookmarks that are shown can be overridden using the  xref:refguide:config:sections/causeway.viewer.wicket.adoc#causeway.viewer.wicket.bookmarked-pages.max-size[causeway.viewer.wicket.bookmarked-pages.max-size] configuration property.

