001 /* 002 Copyright (C) 2001-2003 Renaud Pawlak <renaud@aopsys.com>, 003 Laurent Martelli <laurent@aopsys.com> 004 005 This program is free software; you can redistribute it and/or modify 006 it under the terms of the GNU Lesser General Public License as 007 published by the Free Software Foundation; either version 2 of the 008 License, or (at your option) any later version. 009 010 This program is distributed in the hope that it will be useful, 011 but WITHOUT ANY WARRANTY; without even the implied warranty of 012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 GNU Lesser General Public License for more details. 014 015 You should have received a copy of the GNU Lesser General Public License 016 along with this program; if not, write to the Free Software 017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 018 019 package org.objectweb.jac.aspects.gui; 020 021 import org.objectweb.jac.core.rtti.ClassItem; 022 import java.util.Iterator; 023 import java.util.Vector; 024 025 026 027 /** 028 * Used to choose a class to instantiate 029 */ 030 public class ClassChooser { 031 public ClassChooser(ClassItem root) { 032 this.root = root; 033 } 034 ClassItem root; 035 public ClassItem getRoot() { 036 return root; 037 } 038 ClassItem choice; 039 public void setChoice(ClassItem cl) { 040 this.choice = cl; 041 } 042 public ClassItem getChoice() { 043 return choice; 044 } 045 046 public Vector getChoices() { 047 Vector result = new Vector(); 048 if (!root.isAbstract()) 049 result.add(root); 050 Iterator it = root.getChildren().iterator(); 051 while (it.hasNext()) { 052 ClassItem cl = (ClassItem)it.next(); 053 if (!cl.isAbstract()) 054 result.add(cl); 055 } 056 return result; 057 } 058 }