implemented IPathElement
replaced DocFunction.getPrototype() with DocFunction.getDocPrototype()
This commit is contained in:
parent
4a373e8a09
commit
b86c3cd693
2 changed files with 57 additions and 5 deletions
|
@ -1,9 +1,11 @@
|
|||
package helma.doc;
|
||||
|
||||
import helma.framework.IPathElement;
|
||||
import helma.main.Server;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class DocApplication extends DocElement {
|
||||
public class DocApplication extends DocElement implements IPathElement {
|
||||
|
||||
private DocPrototype[] prototypes;
|
||||
|
||||
|
@ -26,7 +28,7 @@ public class DocApplication extends DocElement {
|
|||
}
|
||||
|
||||
/** return a single prototype */
|
||||
public DocPrototype getPrototype(String name) {
|
||||
public DocPrototype getDocPrototype(String name) {
|
||||
for ( int i=0; i<prototypes.length; i++ ) {
|
||||
if ( prototypes[i].getName().equalsIgnoreCase(name) )
|
||||
return prototypes[i];
|
||||
|
@ -53,7 +55,7 @@ public class DocApplication extends DocElement {
|
|||
}
|
||||
}
|
||||
DocFunction[] funcArr = (DocFunction[])funcVec.toArray(new DocFunction[funcVec.size()]);
|
||||
Arrays.sort(funcArr,new DocComparator(this));
|
||||
Arrays.sort(funcArr,new DocComparator(DocComparator.BY_NAME,this));
|
||||
return funcArr;
|
||||
}
|
||||
|
||||
|
@ -83,7 +85,36 @@ public class DocApplication extends DocElement {
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
// from helma.framework.IPathElement
|
||||
////////////////////////////////////
|
||||
|
||||
public String getElementName() {
|
||||
return "api";
|
||||
}
|
||||
|
||||
public IPathElement getChildElement(String name) {
|
||||
for( int i=0; i<prototypes.length; i++ ) {
|
||||
if ( prototypes[i].getElementName().equals(name) ) {
|
||||
return prototypes[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPathElement getParentElement() {
|
||||
// FIXME: Server.getServer() throws a NullPointerException from here ?
|
||||
Server s = helma.main.Server.getServer();
|
||||
return s.getChildElement(this.name);
|
||||
}
|
||||
|
||||
public java.lang.String getPrototype() {
|
||||
return "docapplication";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package helma.doc;
|
||||
|
||||
import helma.framework.IPathElement;
|
||||
import java.io.*;
|
||||
|
||||
public class DocFunction extends DocElement {
|
||||
public class DocFunction extends DocElement implements IPathElement {
|
||||
|
||||
public static final String[] typeSuffix = {"_action","_as_string","","_macro",""};
|
||||
|
||||
|
@ -26,7 +27,7 @@ public class DocFunction extends DocElement {
|
|||
return ( "Method " + name );
|
||||
}
|
||||
|
||||
public DocPrototype getPrototype() { return prototype; }
|
||||
public DocPrototype getDocPrototype() { return prototype; }
|
||||
|
||||
public void readSource(String sourceFile, int beginLine, int beginColumn, int endLine, int endColumn ) {
|
||||
StringBuffer buf = new StringBuffer ();
|
||||
|
@ -77,6 +78,26 @@ public class DocFunction extends DocElement {
|
|||
return ( "[DocFunction " + getTypeName() + " " + name + "]" );
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
// from helma.framework.IPathElement
|
||||
////////////////////////////////////
|
||||
|
||||
public String getElementName() {
|
||||
return getTypeName().toLowerCase()+"_"+name;
|
||||
}
|
||||
|
||||
public IPathElement getChildElement(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPathElement getParentElement() {
|
||||
return prototype;
|
||||
}
|
||||
|
||||
public java.lang.String getPrototype() {
|
||||
return "docfunction";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue