KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > ajde > ui > StructureViewProperties


1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3  *
4  * This file is part of the IDE support for the AspectJ(tm)
5  * programming language; see http://aspectj.org
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is AspectJ.
18  *
19  * The Initial Developer of the Original Code is Xerox Corporation. Portions
20  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21  * All Rights Reserved.
22  *
23  * Contributor(s):
24  */

25
26 package org.aspectj.ajde.ui;
27
28 import java.util.*;
29 import java.io.*;
30 import org.aspectj.asm.*;
31
32 /**
33  * Nested properties use the typesafe enum pattern.
34  *
35  * @author Mik Kersten
36  */

37 public class StructureViewProperties {
38     
39     /**
40      * @deprecated
41      */

42     public static final String JavaDoc SORT_DECLARATIONAL = StructureViewProperties.Sorting.DECLARATIONAL.toString();
43     
44     /**
45      * @deprecated
46      */

47     public void setSorting(String JavaDoc sorting) { }
48     
49     private List relations = new ArrayList();
50     private List filteredMemberAccessibility = new ArrayList();
51     private List filteredMemberModifiers = new ArrayList();
52     private List filteredMemberKinds = new ArrayList();
53     private List grouping = new ArrayList();
54     private Sorting sorting = Sorting.DECLARATIONAL;
55     private Granularity granularity = Granularity.MEMBER;
56
57     public List getRelations() {
58         return relations;
59     }
60     
61     public void setRelations(List relations) {
62         this.relations = relations;
63     }
64
65     public void addRelation(Relation relation) {
66         relations.add(relation);
67     }
68
69     public void removeRelation(Relation relation) {
70         relations.remove(relation);
71     }
72
73     public void setFilteredMemberAccessibility(List memberVisibility) {
74         this.filteredMemberAccessibility = memberVisibility;
75     }
76
77     public List getFilteredMemberAccessibility() {
78         return filteredMemberAccessibility;
79     }
80
81     public void addFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
82         this.filteredMemberAccessibility.add(accessibility);
83     }
84     
85     public void removeFilteredMemberAccessibility(ProgramElementNode.Accessibility accessibility) {
86         this.filteredMemberAccessibility.remove(accessibility);
87     }
88
89     public List getFilteredMemberModifiers() {
90         return filteredMemberModifiers;
91     }
92
93     public void setFilteredMemberModifiers(List memberModifiers) {
94         this.filteredMemberModifiers = memberModifiers;
95     }
96     
97     public void addFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
98         this.filteredMemberModifiers.add(modifiers);
99     }
100     
101     public void removeFilteredMemberModifiers(ProgramElementNode.Modifiers modifiers) {
102         this.filteredMemberModifiers.remove(modifiers);
103     }
104     
105     public StructureViewProperties.Sorting getSorting() {
106         return sorting;
107     }
108
109     public void setSorting(StructureViewProperties.Sorting sorting) {
110         this.sorting = sorting;
111     }
112     
113     public List getFilteredMemberKinds() {
114         return filteredMemberKinds;
115     }
116
117     public void setFilteredMemberKinds(List memberKinds) {
118         this.filteredMemberKinds = memberKinds;
119     }
120     
121     public void addFilteredMemberKind(ProgramElementNode.Kind kind) {
122         this.filteredMemberKinds.add(kind);
123     }
124     
125     public void removeFilteredMemberKind(ProgramElementNode.Kind kind) {
126         this.filteredMemberKinds.remove(kind);
127     }
128     
129     public List getGrouping() {
130         return grouping;
131     }
132
133     public void setGrouping(List grouping) {
134         this.grouping = grouping;
135     }
136     
137     
138     public void addGrouping(Grouping grouping) {
139         this.grouping.add(grouping);
140     }
141
142     public void removeGrouping(Grouping grouping) {
143         this.grouping.remove(grouping);
144     }
145
146     public Granularity getGranularity() {
147         return granularity;
148     }
149
150     public void setGranularity(Granularity granularity) {
151         this.granularity = granularity;
152     }
153     
154     public String JavaDoc getName() {
155         return "<unnamed view>";
156     }
157     
158     public String JavaDoc toString() {
159         return "\nView Properties:"
160             + "\n-> sorting: " + sorting
161             + "\n-> grouping: " + grouping
162             + "\n-> filtered member kinds: " + filteredMemberKinds
163             + "\n-> filtered member accessibility: " + filteredMemberAccessibility
164             + "\n-> filtered member modifiers: " + filteredMemberModifiers
165             + "\n-> relations: " + relations;
166     }
167     
168     public static class Hierarchy {
169         
170         public static final Hierarchy DECLARATION = new Hierarchy("package hierarchy");
171         public static final Hierarchy CROSSCUTTING = new Hierarchy("crosscutting structure");
172         public static final Hierarchy INHERITANCE = new Hierarchy("type hierarchy");
173         public static final Hierarchy[] ALL = { DECLARATION, CROSSCUTTING, INHERITANCE };
174           
175         private final String JavaDoc name;
176         
177         private Hierarchy(String JavaDoc name) {
178             this.name = name;
179         }
180         
181         public String JavaDoc toString() {
182             return name;
183         }
184
185         // The 4 declarations below are necessary for serialization
186
private static int nextOrdinal = 0;
187         private final int ordinal = nextOrdinal++;
188         private Object JavaDoc readResolve() throws ObjectStreamException {
189             return ALL[ordinal];
190         }
191     }
192     
193     public static class Grouping {
194         
195         public static final Grouping KIND = new Grouping("group by kind");
196         public static final Grouping VISIBILITY = new Grouping("group by visibility");
197         public static final Grouping[] ALL = { KIND, VISIBILITY };
198         
199         private final String JavaDoc name;
200         
201         private Grouping(String JavaDoc name) {
202             this.name = name;
203         }
204         
205         public String JavaDoc toString() {
206             return name;
207         }
208
209         // The 4 declarations below are necessary for serialization
210
private static int nextOrdinal = 0;
211         private final int ordinal = nextOrdinal++;
212         private Object JavaDoc readResolve() throws ObjectStreamException {
213             return ALL[ordinal];
214         }
215     }
216  
217     public static class Sorting {
218     
219         public static final Sorting ALPHABETICAL = new Sorting("sort alphabetically");
220         public static final Sorting DECLARATIONAL = new Sorting("sort declarationally");
221         public static final Sorting[] ALL = { ALPHABETICAL, DECLARATIONAL };
222         
223         private final String JavaDoc name;
224         
225         private Sorting(String JavaDoc name) {
226             this.name = name;
227         }
228         
229         public String JavaDoc toString() {
230             return name;
231         }
232
233         // The 4 declarations below are necessary for serialization
234
private static int nextOrdinal = 0;
235         private final int ordinal = nextOrdinal++;
236         private Object JavaDoc readResolve() throws ObjectStreamException {
237             return ALL[ordinal];
238         }
239     }
240     
241     public static class Granularity {
242     
243         public static final Granularity PACKAGE = new Granularity("package");
244         public static final Granularity FILE = new Granularity("file");
245         public static final Granularity TYPE = new Granularity("type");
246         public static final Granularity MEMBER = new Granularity("member");
247         public static final Granularity[] ALL = { PACKAGE, FILE, TYPE, MEMBER };
248         
249         private final String JavaDoc name;
250         
251         private Granularity(String JavaDoc name) {
252             this.name = name;
253         }
254         
255         public String JavaDoc toString() {
256             return name;
257         }
258
259         // The 4 declarations below are necessary for serialization
260
private static int nextOrdinal = 0;
261         private final int ordinal = nextOrdinal++;
262         private Object JavaDoc readResolve() throws ObjectStreamException {
263             return ALL[ordinal];
264         }
265     }
266 }
267
Popular Tags