home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Image;
- import java.net.URL;
- import java.util.Vector;
-
- public class Folder {
- private Vector subFolders;
- private Image iconOpen;
- private Image iconClosed;
- private Folder parent;
- public int level;
- private String text;
- private URL hRef;
- private String target;
- private String warning;
- private boolean open;
-
- public Folder() {
- this((Folder)null);
- }
-
- public Folder(Folder parent) {
- this.subFolders = new Vector();
- this.iconOpen = null;
- this.iconClosed = null;
- this.text = "";
- this.hRef = null;
- this.target = "";
- this.warning = null;
- this.parent = parent;
- if (parent != null) {
- parent.addSubFolder(this);
- this.level = parent.level + 1;
- } else {
- this.level = 0;
- }
-
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public String getText() {
- return this.text;
- }
-
- public void setHRef(URL hRef) {
- this.hRef = hRef;
- }
-
- public URL getHRef() {
- return this.hRef;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getTarget() {
- return this.target;
- }
-
- public void setWarning(String warning) {
- this.warning = warning;
- }
-
- public String getWarning() {
- return this.warning;
- }
-
- public void setOpen(boolean open) {
- this.open = open;
- }
-
- public boolean isOpen() {
- return this.open;
- }
-
- public void toggleOpen() {
- this.open = !this.open;
- }
-
- public void setIconOpen(Image iconOpen) {
- this.iconOpen = iconOpen;
- }
-
- public Image getIconOpen() {
- return this.iconOpen;
- }
-
- public Image getIcon() {
- return this.isOpen() && this.hasChildren() ? this.getIconOpen() : this.getIconClosed();
- }
-
- public void setIconClosed(Image iconClosed) {
- this.iconClosed = iconClosed;
- }
-
- public Image getIconClosed() {
- return this.iconClosed;
- }
-
- public boolean hasChildren() {
- return !this.subFolders.isEmpty();
- }
-
- public void addSubFolder(Folder f1) {
- this.subFolders.addElement(f1);
- }
-
- public Vector getSubFolders() {
- return this.subFolders;
- }
- }
-