KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > properties > PropertySheetCategory


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.views.properties;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16 /**
17  * A category in a PropertySheet used to group <code>IPropertySheetEntry</code>
18  * entries so they are displayed together.
19  */

20 /*package*/class PropertySheetCategory {
21     private String JavaDoc categoryName;
22
23     private List JavaDoc entries = new ArrayList JavaDoc();
24
25     private boolean shouldAutoExpand = true;
26
27     /**
28      * Create a PropertySheet category with name.
29      */

30     public PropertySheetCategory(String JavaDoc name) {
31         categoryName = name;
32     }
33
34     /**
35      * Add an <code>IPropertySheetEntry</code> to the list
36      * of entries in this category.
37      */

38     public void addEntry(IPropertySheetEntry entry) {
39         entries.add(entry);
40     }
41
42     /**
43      * Return the category name.
44      */

45     public String JavaDoc getCategoryName() {
46         return categoryName;
47     }
48
49     /**
50      * Returns <code>true</code> if this category should be automatically
51      * expanded. The default value is <code>true</code>.
52      *
53      * @return <code>true</code> if this category should be automatically
54      * expanded, <code>false</code> otherwise
55      */

56     public boolean getAutoExpand() {
57         return shouldAutoExpand;
58     }
59
60     /**
61      * Sets if this category should be automatically
62      * expanded.
63      */

64     public void setAutoExpand(boolean autoExpand) {
65         shouldAutoExpand = autoExpand;
66     }
67
68     /**
69      * Returns the entries in this category.
70      *
71      * @return the entries in this category
72      */

73     public IPropertySheetEntry[] getChildEntries() {
74         return (IPropertySheetEntry[]) entries
75                 .toArray(new IPropertySheetEntry[entries.size()]);
76     }
77
78     /**
79      * Removes all of the entries in this category.
80      * Doing so allows us to reuse this category entry.
81      */

82     public void removeAllEntries() {
83         entries = new ArrayList JavaDoc();
84     }
85 }
86
Popular Tags