Changeset 21990
- Timestamp:
- 2010-04-29T14:18:48+12:00 (14 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/admin/guiext
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/Callback.java
r21919 r21990 1 1 package org.greenstone.admin.guiext; 2 2 3 import java.lang.reflect.Constructor; 3 4 import java.lang.reflect.Method; 5 4 6 import javax.swing.JTextArea; 5 7 … … 8 10 public class Callback implements Runnable 9 11 { 12 String _class = null; 10 13 String _param = null; 11 14 CommandStep _parent = null; … … 16 19 17 20 if(callbackElement != null){ 18 _param = ExtXMLHelper.getValueFromSingleElement(callbackElement, true); 21 _class = ExtXMLHelper.getValueFromSingleElement(callbackElement, true); 22 _param = callbackElement.getAttribute("type"); 19 23 } 20 24 else{ … … 25 29 public void run() 26 30 { 31 _parent.getParent().getParent().loadGuiExtFile(); 27 32 JTextArea messageArea = _parent.getMessageArea(); 28 33 29 Object extObj = _parent.getParent().getParent().getExtObject(); 34 Class extClass = null; 35 try{ 36 extClass = Class.forName(_class); 37 } 38 catch(Exception ex){ 39 System.err.println("Could not create the extension class used for callback methods, either the class name is incorrect or the class does not exist inside the guiext.jar file"); 40 } 41 Constructor classConstructor = null; 42 Object extObj = null; 43 44 try{ 45 classConstructor = extClass.getConstructor(new Class[0]); 46 extObj = classConstructor.newInstance(new Object[0]); 47 } 48 catch(Exception ex){ 49 ex.printStackTrace(); 50 System.err.println("Could not create the extension class used for callback methods, either the class name is incorrect or the class does not exist inside the guiext.jar file"); 51 return; 52 } 53 30 54 Class[] params = new Class[]{String.class}; 31 55 -
main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/ExtXMLHelper.java
r21989 r21990 9 9 static public final String EXTENSION = "extension"; 10 10 static public final String GROUP = "group"; 11 static public final String BASE_EXT = "base_ext"; 12 static public final String FILE_STEM = "file_stem"; 11 static public final String FILE_STEM = "fileStem"; 13 12 static public final String NAME = "name"; 14 13 static public final String DOWNLOAD = "download"; … … 23 22 static public final String DESCRIPTION = "description"; 24 23 static public final String PROPERTY = "property"; 25 static public final String SEQUENCE_LIST = "sequence _list";24 static public final String SEQUENCE_LIST = "sequenceList"; 26 25 static public final String STEP ="step"; 27 26 static public final String COMMAND ="command"; -
main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/ExtensionInformation.java
r21919 r21990 25 25 protected String _fileStem = null; 26 26 protected String _description = null; 27 protected String _baseExt = null;28 27 protected String _baseURL = null; 29 28 protected SequenceList _sequenceList= null; … … 38 37 _fileStem = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.FILE_STEM, true); 39 38 _description = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.DESCRIPTION, true); 40 _baseExt = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.BASE_EXT, true);41 39 _baseURL = baseURL; 42 40 _sequenceList = new SequenceList(ExtXMLHelper.getSingleChildElement(extensionElement, ExtXMLHelper.SEQUENCE_LIST, true), this); … … 71 69 return _description; 72 70 } 73 74 public String getBaseClassName()75 {76 return _baseExt;77 }78 71 79 72 public SequenceList getSequenceList() 80 73 { 81 74 return _sequenceList; 82 }83 84 public Object getExtObject()85 {86 loadGuiExtFile();87 Class extClass = null;88 try{89 extClass = Class.forName(_baseExt);90 }91 catch(Exception ex){92 System.err.println("Could not create the extension class used for callback methods, either the class name is incorrect or the class does not exist inside the guiext.jar file");93 }94 Constructor classConstructor = null;95 Object classObj = null;96 97 try{98 classConstructor = extClass.getConstructor(new Class[0]);99 classObj = classConstructor.newInstance(new Object[0]);100 }101 catch(Exception ex){102 ex.printStackTrace();103 System.err.println("Could not create the extension class used for callback methods, either the class name is incorrect or the class does not exist inside the guiext.jar file");104 return null;105 }106 107 return classObj;108 75 } 109 76 -
main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/Option.java
r21919 r21990 15 15 16 16 if(optionElement != null){ 17 _name = optionElement.getAttribute("label");18 if(_name == null || _name.equals("")){19 System.err.println("This option element does not have a label");20 }21 22 17 _id = optionElement.getAttribute("id"); 23 18 if(_id == null || _id.equals("")){ 24 19 System.err.println("This option element does not have an id"); 20 } 21 22 _name = optionElement.getAttribute("label"); 23 if(_name == null || _name.equals("")){ 24 _name = id; 25 25 } 26 26
Note:
See TracChangeset
for help on using the changeset viewer.