KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > CollectionItemView


1 /*
2   Copyright (C) 2003 Laurent Martelli <laurent@aopsys.com>
3   
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17   USA */

18
19 package org.objectweb.jac.aspects.gui;
20
21 import java.util.HashSet JavaDoc;
22 import java.util.Hashtable JavaDoc;
23 import org.objectweb.jac.core.rtti.CollectionItem;
24 import org.objectweb.jac.core.rtti.FieldItem;
25 import org.objectweb.jac.core.rtti.MemberItem;
26 import org.objectweb.jac.core.rtti.RttiAC;
27
28 /**
29  * Defines a table collection view
30  */

31 public class CollectionItemView extends MemberItemView {
32     public CollectionItemView(CollectionItem collection, String JavaDoc viewName) {
33         super(collection,viewName);
34         this.collection = collection;
35     }
36
37     CollectionItem collection;
38     CollectionItem getCollection() {
39         return collection;
40     }
41
42     MemberItem[] membersOrder;
43     public MemberItem[] getMembersOrder() {
44         return membersOrder;
45     }
46     public void setMembersOrder(MemberItem[] newMembersOrder) {
47         this.membersOrder = newMembersOrder;
48     }
49
50     CollectionItem multiLineCollection;
51     public CollectionItem getMultiLineCollection() {
52         return multiLineCollection;
53     }
54     public void setMultiLineCollection(CollectionItem newMultiLineCollection) {
55         this.multiLineCollection = newMultiLineCollection;
56     }
57
58     FieldItem groupBy;
59     public FieldItem getGroupBy() {
60         return groupBy;
61     }
62     public void setGroupBy(FieldItem newGroupBy) {
63         this.groupBy = newGroupBy;
64     }
65
66     boolean embeddedAdded;
67     public void setEmbeddedAdded(boolean embedded) {
68         this.embeddedAdded = embedded;
69     }
70     public boolean isEmbeddedAdded() {
71         return embeddedAdded;
72     }
73
74     HashSet JavaDoc embeddedEditorColumns = new HashSet JavaDoc();
75     boolean embeddedEditors = false;
76     public void setEmbeddedEditors(boolean embeddedEditors) {
77         this.embeddedEditors = embeddedEditors;
78     }
79     public void addEmbeddedEditorColumn(MemberItem field) {
80         embeddedEditorColumns.add(field);
81     }
82     public boolean isEmbeddedEditors(MemberItem field) {
83         return embeddedEditors || embeddedEditorColumns.contains(field);
84     }
85     public boolean isEmbeddedEditors() {
86         return embeddedEditors;
87     }
88
89     boolean viewableItems = true;
90     public boolean isViewableItems() {
91         if (collection.isMap())
92             return RttiAC.isIndex(collection) && viewableItems;
93         else
94             return viewableItems;
95     }
96     public void setViewableItems(boolean newViewableItems) {
97         this.viewableItems = newViewableItems;
98     }
99
100     boolean enableLinks = true;
101     public void setEnableLinks(boolean enable) {
102         this.enableLinks = enable;
103     }
104     public boolean areLinksEnabled() {
105         return enableLinks;
106     }
107
108     /** MemberItem -> viewType */
109     Hashtable JavaDoc viewTypes = new Hashtable JavaDoc();
110     public void setViewType(MemberItem member, String JavaDoc viewType) {
111         viewTypes.put(member,viewType);
112     }
113     public String JavaDoc getViewType(MemberItem member) {
114         return (String JavaDoc)viewTypes.get(member);
115     }
116
117     FieldItem additionalRow;
118     public FieldItem getAdditionalRow() {
119         return additionalRow;
120     }
121     public void setAdditionalRow(FieldItem newAdditionalRow) {
122         this.additionalRow = newAdditionalRow;
123     }
124 }
125
126
Popular Tags