⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filesystem.java

📁 经典Tapestry教程 经典Tapestry教程
💻 JAVA
字号:
//  Copyright 2004 The Apache Software Foundation//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at////     http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.package fsmodel;import java.io.File;import java.util.Collection;import java.util.Date;import java.util.Vector;import org.apache.tapestry.contrib.tree.model.ITreeNode;public class FileSystem implements IFileSystemTreeNode{  private transient AssetsHolder m_objAssetsHolder = null;    /** @associates <{Drive}>     * @supplierCardinality 0..*     * @link aggregation*/      private Vector m_vDrives;  public FileSystem()  {    //initDrives();  }  private void initDrives()  {    m_vDrives = new Vector();    File[] arrFile = File.listRoots();    if (arrFile != null)      for(int i=0; i<arrFile.length; i++)      {        m_vDrives.addElement(new Drive(this, arrFile[i]));      }  }  public Vector getDrives()  {  	if(m_vDrives == null){  		initDrives();  	}    return m_vDrives;  }  public int getChildNumber(Object objChild)  {    for(int i=0;i<m_vDrives.size();i++)    {      Object objChildDrive = m_vDrives.elementAt(i);      if(objChildDrive.equals(objChild))      {        return i;      }    }    return -1;  }	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#containsChild(ITreeNode)	 */	public boolean containsChild(ITreeNode node) {		return true;	}	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#getAllowsChildren()	 */	public boolean getAllowsChildren() {		return true;	}	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#getChildCount()	 */	public int getChildCount() {		return getDrives().size();	}	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#getChildren()	 */	public Collection getChildren() {		return getDrives();	}	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#getParent()	 */	public ITreeNode getParent() {		return null;	}	/**	 * @see org.apache.tapestry.contrib.tree.model.ITreeNode#isLeaf()	 */	public boolean isLeaf() {		return false;	}	/**	 * @see java.lang.Object#toString()	 */	public String toString() {		return getName();	}	public String getName(){		return "FileSystem";	}		/**	 * @see java.lang.Object#equals(Object)	 */	public boolean equals(Object arg0) {		if(!(arg0 instanceof FileSystem))			return false;		FileSystem objFileSystem = (FileSystem)arg0;		if(getName().equals(objFileSystem.getName()))			return true;		return false;	}	/**	 * @see java.lang.Object#hashCode()	 */	public int hashCode() {		return getName().hashCode();	}	/**	 * @see fsmodel.IFileSystemTreeNode#getAbsolutePath()	 */	public String getAbsolutePath() {		return "";	}	/**	 * @see fsmodel.IFileSystemTreeNode#getAssets()	 */	public AssetsHolder getAssets() {		if(m_objAssetsHolder == null){			m_objAssetsHolder = new AssetsHolder("/fsmodel/computer.gif", "/fsmodel/computer.gif");		}		return m_objAssetsHolder;	}	/**	 * @see fsmodel.IFileSystemTreeNode#getObjectDate()	 */	public Date getDate() {		return null;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -