001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.model;
042:
043: /**
044: *
045: * @author deep
046: */
047: public interface ResourceModel {
048:
049: /**
050: * Returns the root value of the file system in question.
051: * For example, in the default implementation of this interface for local
052: * filesystems the root value would be "/" in Unix and "C:\" on Windows.
053: *
054: * @return returns the absolute root (directory for files and folders).
055: */
056: public String getAbsoluteRoot();
057:
058: /**
059: * Sets the root value of the resource system in question.
060: * For example, in the default implementation of this interface for local
061: * filesystems the root value could be set to "/" in Unix and "C:\" on Windows.
062: *
063: * @param absRoot - the value to be used as the root of this resource system
064: */
065: public void setAbsoluteRoot(String absRoot);
066:
067: /**
068: * Return the separator String for this resource system. For a
069: * file system chooser this would be File.separator.
070: *
071: * @return returns the separator String.
072: */
073: public String getSeparatorString();
074:
075: /**
076: * Get the Server namefrom where the resources are being loaded.
077: *
078: * @returns the server name
079: *
080: */
081: public String getServerName();
082:
083: /**
084: * Set the server name from where the resources are being loaded.
085: *
086: * @param serverName - the server name to be set
087: *
088: */
089: public void setServerName(String serverName);
090:
091: /**
092: * Return the filter String currently in use.
093: *
094: * @return returns the filter String.
095: */
096: public String getFilterValue();
097:
098: /**
099: * Set the filter String entered by the user in the Filter text field.
100: *
101: * @param filterString - the filter string to be used subsequently.
102: *
103: */
104: public void setFilterValue(String filterString);
105:
106: /**
107: * Return the sort field that is currently active.
108: *
109: * @return returns the sort field in use.
110: */
111: public String getSortValue();
112:
113: /**
114: * Set the sort field chosen by the user from the drop down menu.
115: *
116: * @param sortField - string representing sortField selected by the user.
117: *
118: */
119: public void setSortValue(String sortField);
120:
121: /**
122: * This method is called to get the current directory of
123: * the resuource list being displayed in the filechooser's listbox
124: *
125: * @return returns the current root (directory for files and folders).
126: */
127: public String getCurrentDir();
128:
129: /**
130: * This method is called to set the current directory of
131: * the resuource list that would be displayed in the next
132: * display cycle.
133: *
134: * @param dir - the value to be set the new current root node.
135: *
136: */
137: public void setCurrentDir(String dir);
138:
139: /**
140: * Returns the list of objects in the container represented by the
141: * current directory. This method returns an Array of ResourecItem objects
142: */
143: public ResourceItem[] getFolderContent(String folder,
144: boolean disableFiles, boolean disableFolders);
145:
146: /**
147: * Given a ResourceItem key return the ResourceItem.
148: *
149: * @param - the resource item key which is the same as the value of the
150: * Option element in the listbox.
151: * @return - the ResourceItem object
152: */
153: public ResourceItem getResourceItem(String itemKey);
154:
155: /**
156: * Returns true if the supplied absolute path is a folder type.
157: *
158: * @param path - the absolute path to the resource
159: * @return returns the current root (directory for files and folders).
160: */
161: public boolean isFolderType(String path);
162:
163: /**
164: * This methods checks if the resource path in question can be accessed
165: * by the user trying to select or view it.
166: *
167: * @param resourceName - the resource name to check for read access
168: * @return true if the user can select the resource specified
169: * by the resource name.
170: */
171: public boolean canRead(String resourceName);
172:
173: /**
174: * This methods checks if the resource path in question can be accessed
175: * for writes by the user.
176: *
177: * @param resourceName - the resource name to check for write access
178: * @return true if the user can select the resource specified
179: * by the resource name for write.
180: *
181: */
182: public boolean canWrite(String resourceName);
183:
184: /* *
185: * Create a resource of the given name in the node specified.
186: * In the context of the filechooser this would mean creating a file
187: * or folder in the directory specified. The default filechooser does
188: * not have this feature yet.
189: *
190: * @param resourceName the resourceName to be created.
191: * @param rootDir the node where this resource shoul dbe created.
192: * @return boolen value indicating success or failure.
193: *
194: public boolean createResource(String resourceName, String rootDir);
195: */
196:
197: /* *
198: * Returns true if the user has set if component is to function as
199: * a file or directory chooser.
200: *
201: * @return boolen value indicating if chooser type has been set
202: *
203: public boolean isChooserTypeSet();
204: */
205:
206: /* *
207: * Set the component to function as a folder chooser. This will
208: * cause all files or non container items to be disabled in the
209: * listbox.
210: *
211: * @param flag - set to true if component should function as a
212: * folder chooser.
213: *
214: public void setFolderChooser(boolean flag);
215: */
216:
217: /* *
218: * This method returns true if the component is a folder chooser. This will
219: * cause all files or non container items to be disabled in the
220: * listbox.
221: *
222: * @returns true if the component is a folder chooser, false otherwise.
223: *
224: public boolean isFolderChooser();
225: */
226:
227: public String getParentFolder();
228:
229: public String getEscapeChar();
230:
231: public String getDelimiterChar();
232:
233: public Object[] getSelectedContent(String[] content,
234: boolean selectFolders) throws ResourceModelException;
235:
236: public String[] getRoots();
237: }
|