KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > swing > ObjectView


1 /*
2   Copyright (C) 2002 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,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.gui.swing;
19
20 import org.objectweb.jac.aspects.gui.Constants;
21 import org.objectweb.jac.aspects.gui.FieldEditor;
22 import org.objectweb.jac.aspects.gui.GuiAC;
23 import org.objectweb.jac.aspects.gui.TabsView;
24 import org.objectweb.jac.aspects.gui.View;
25 import org.objectweb.jac.core.rtti.FieldItem;
26 import java.util.Iterator JavaDoc;
27 import java.util.List JavaDoc;
28 import java.util.Vector JavaDoc;
29
30 public class ObjectView extends SwingContainerView
31 {
32    Vector JavaDoc editors = new Vector JavaDoc();
33    boolean showButtons = true;
34
35    public ObjectView() {
36       super(Constants.VERTICAL);
37    }
38
39    public void addEditor(FieldEditor editor) {
40       editors.add(editor);
41    }
42    
43    public List getEditors() {
44       return editors;
45    }
46
47    public void setShowButtons(boolean value) {
48       this.showButtons = value;
49    }
50
51    public void setFocus(FieldItem field, Object JavaDoc option) {
52       String JavaDoc[] categories = GuiAC.getCategories(field);
53       if (categories!=null && categories.length>0) {
54          Iterator JavaDoc it = getViews().iterator();
55          while(it.hasNext()) {
56             View view = (View)it.next();
57             if (view instanceof TabsView) {
58                ((TabsView)view).select(categories[0]);
59             }
60          }
61       }
62    }
63
64 }
65
Popular Tags