View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.trinidad.model;
20  
21  /**
22   * A MenuModel objects represents the menu structure of a page or application.
23   * The menu model should know how to go from the current viewId to a focus rowKey.
24   * <p>
25   * MenuModel extends TreeModel and adds a single method,
26   * getFocusRowKey(), which returns the rowKey of the focus page for the current view id.
27   * <p>
28   * Work on modeling menus continues and it is very possible that this class
29   * will change in a future release.
30   *
31   */
32  public abstract class MenuModel extends TreeModel
33  {
34    /**
35     * Gets the focus rowKey for the current viewId.
36     * If there is no item
37     * in focus, getFocusRowKey should return null.
38     * </p>
39     * <p>The value returned from calling {@link #getRowKey} should remain the
40     * same before and after calling getFocusRowKey().
41     * Meaning initialPath and currPath should
42     * always be equal in the following example
43     * <pre><code>
44     *   Object initialPath = model.getRowKey();
45     *   Object focusPath   = model.getFocusRowKey();
46     *   Object currPath    = model.getRowKey();
47     * </code></pre>
48     * </p>
49     * @return the focus rowKey for the current viewId
50     */
51    public abstract Object getFocusRowKey();
52  }