📄 special.java
字号:
//Title: Curriculum Development Tool
//Copyright: Copyright (c) 2001
//Author: David Bradford - dbrad@medstat.med.utah.edu
//Company: Knowledge Weavers - http://medstat.med.utah.edu/kw/
//File: projects/tree/Special.java
//Description: A type of Node that will contain special data
package cdt.projects.tree.nodes;
import java.io.FileOutputStream;
import java.io.OutputStream;
import cdt.projects.export.additions.ExportModule;
import cdt.projects.export.additions.ImageIndex;
/**
* This is a node in the tree that is neither a hold or an item. Right now it is just used
* for the image index but it can be used for more than that.
*
* @version 1.0
* @author David Bradford<BR>
* Brad Schaefer (<A HREF="mailto:schaefer@medstat.med.utah.edu">schaefer@medstat.med.utah.edu</A>)
*/
public class Special extends Node {
/** export module this node represents. */
private ExportModule module;
/** name of what this node represents. */
private String mod;
/**
* Creates a special.
*
* @param mod What the node should represent.
*/
public Special(String mod) {
this.mod = mod;
setName(mod);
if(mod.equals("Image Index")) {
module = new ImageIndex();
}
}
/**
* Specials do not allow children.
*
* @return false.
*/
public boolean getAllowsChildren() {
return false;
}
/**
* gets the data for this page.
*
* @return data for this page.
*/
public String getData() {
return module.getPage();
}
/**
* doesn't do anything.
*
* @param s not used.
*/
public void setData(String s) {
}
/**
* Gets the export module this node represents.
*
* @return export module represents.
*/
public ExportModule getMod() {
return module;
}
/**
* Does nothing you cannot add nodes into specials.
*
* @param into not used.
*/
public void addNodeInto(Node into) {}
/**
* Makes a copy of this node.
*
* @return copy of this node.
*/
public Node copy() {
Node n = new Special(mod);
return n;
}
/**
* Specials are always visible.
*
* @return true.
*/
public boolean isVisible() {
return true;
}
/**
* Writes the project data to an OutputStream.
*
* @param out OutputStream to send project data to.
* @param dir Indicates the directory of the file this {@link cdt.projects.tree.nodes.Node Node} represents.
*/
public void writeProject(OutputStream out, String dir) {
try {
out.write((new String("<special name=\"" +getName()+ "\" file=\"" +getFile()+ "\">\n")).getBytes());
} catch(Exception e) {
cdt.ErrorD.ErrorDlg.ErrorMsg("Error writing project -> " +dir+getFile());
}
}
/**
* A node has been droped on this one so add it above.
*
* @param n node dropped on this one.
*/
public void dropInto(Node n) {
addNodeAbove(n);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -