KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > core > api > multiview > MultiViewPerspective


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.core.api.multiview;
21
22 import java.awt.Image JavaDoc;
23 import org.netbeans.core.spi.multiview.MultiViewDescription;
24 import org.openide.util.HelpCtx;
25
26 /**
27  * Description of multi view element.
28  *
29  * @author Milos Kleint
30  */

31 public final class MultiViewPerspective {
32
33     static {
34         AccessorImpl.createAccesor();
35     }
36
37     private MultiViewDescription description;
38
39     MultiViewPerspective(MultiViewDescription desc) {
40         description = desc;
41     }
42     // package private, access through Accessor
43
MultiViewDescription getDescription() {
44         return description;
45     }
46     
47     
48     /** Gets persistence type of multi view element, the TopComponent will decide
49      * on it's onw persistenceType based on the sum of all it's elements.
50      * {@link org.openide.windows.TopComponent#PERSISTENCE_ALWAYS} has higher priority than {@link org.openide.windows.TopComponent#PERSISTENCE_ONLY_OPENED}
51      * and {@link org.openide.windows.TopComponent#PERSISTENCE_NEVER} has lowest priority.
52      * The {@link org.openide.windows.TopComponent} will be stored only if at least one element requesting persistence
53      * was made visible.
54      */

55     public int getPersistenceType() {
56         return description.getPersistenceType();
57     }
58
59     /**
60      * Gets localized display name of multi view element. Will be placed on the Element's toggle button.
61      * @return the display name for this view element.
62      */

63     public String JavaDoc getDisplayName() {
64         return description.getDisplayName();
65     }
66     
67     /**
68      * Icon for the multi view component. Will be shown as {@link org.openide.windows.TopComponent}'s icon
69      * when this element is selected.
70      * @return The icon of multi view element */

71     public Image JavaDoc getIcon () {
72         return description.getIcon();
73     }
74
75     /** Get the help context of multi view element.
76     */

77     public HelpCtx getHelpCtx () {
78         return description.getHelpCtx();
79     }
80     
81     /**
82      * A Description's contribution
83      * to unique TopComponent's Id returned by getID. Returned value is used as starting
84      * value for creating unique TopComponent ID for whole enclosing multi view
85      * component.
86      */

87     public String JavaDoc preferredID() {
88         return description.preferredID();
89     }
90     
91     
92 }
Popular Tags