KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > api > AllFileSelector


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.api;
7
8 import java.sql.SQLException JavaDoc;
9 import java.util.Vector JavaDoc;
10
11 import com.raptus.owxv3.LoggingManager;
12
13 /**
14  *
15  * <hr>
16  * <table width="100%" border="0">
17  * <tr>
18  * <td width="24%"><b>Filename</b></td><td width="76%">FileSelector.java</td>
19  * </tr>
20  * <tr>
21  * <td width="24%"><b>Author</b></td><td width="76%">REEA</td>
22  * </tr>
23  * <tr>
24  * <td width="24%"><b>Date</b></td><td width="76%">25th of September 2001</td>
25  * </tr>
26  * </table>
27  * <hr>
28  * <table width="100%" border="0">
29  * <tr>
30  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
31  * </tr>
32  * </table>
33  * <hr>
34  * <table width="100%" border="0">
35  * <tr>
36  * <td>This class provides method for accesing the all category names and to accessing<br>
37  * all the file ids and names</td>
38  * </tr>
39  * </table>
40  * <hr>
41  */

42 public class AllFileSelector extends Object JavaDoc
43 {
44
45
46     /**
47      * The list of all available categories
48      */

49     protected String JavaDoc[] allCategories = null;
50
51
52     /**
53      * The list of all available files
54      */

55     protected Vector JavaDoc allFiles = null;
56
57
58     /**
59      *The costructor, a GlobalResources object should be provided
60      */

61     public AllFileSelector(GlobalResources gres)
62                 throws SQLException JavaDoc
63     {
64         reset();
65         allCategories = gres.loadAllCategories();
66         allFiles=gres.loadFiles();
67
68     }
69
70     /**
71      *The reste method
72      */

73     public void reset()
74     {
75
76     }
77
78     /**
79      *Method for getting the default category
80      */

81     protected String JavaDoc getDefaultCategory()
82     {
83         if(allCategories != null && allCategories.length > 0)
84             return allCategories[0];
85
86         LoggingManager.log("Unable to determine the default file category!");
87         return null;
88     }
89
90
91     /**
92      *Method for getting the name of all categories
93      */

94     public String JavaDoc[] getAllCategories() { return allCategories; }
95
96     /**
97      *
98      *Method for getting the id of all files
99      */

100
101
102     public String JavaDoc[] getAllFileIds(){
103         GResFile grfile;
104         String JavaDoc ret[]=new String JavaDoc[allFiles.size()];
105         for (int i=0;i<allFiles.size();i++){
106             grfile=(GResFile)allFiles.elementAt(i);
107             ret[i]=Integer.toString( grfile.getRowID() );
108
109         }
110         return ret;
111     }
112
113     /**
114      *Method for getting the name of all files
115      */

116
117     public String JavaDoc[] getAllFileNames(){
118         GResFile grfile;
119         String JavaDoc ret[]=new String JavaDoc[allFiles.size()];
120         for (int i=0;i<allFiles.size();i++){
121             grfile=(GResFile)allFiles.elementAt(i);
122             ret[i]=grfile.getFileName();
123
124         }
125         return ret;
126     }
127
128
129
130
131 }
132
133 // eof
134
Popular Tags