Changeset 21990 for main


Ignore:
Timestamp:
2010-04-29T14:18:48+12:00 (14 years ago)
Author:
sjm84
Message:

Updated extension_project_list.xml file format so that tags like file_stem are now fileStem. Also when an option label is not defined then the id will be used instead. Finally, base_ext has been removed.

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  
    11package org.greenstone.admin.guiext;
    22
     3import java.lang.reflect.Constructor;
    34import java.lang.reflect.Method;
     5
    46import javax.swing.JTextArea;
    57
     
    810public class Callback implements Runnable
    911{
     12    String _class = null;
    1013    String _param = null;
    1114    CommandStep _parent = null;
     
    1619
    1720    if(callbackElement != null){
    18         _param = ExtXMLHelper.getValueFromSingleElement(callbackElement, true);
     21        _class = ExtXMLHelper.getValueFromSingleElement(callbackElement, true);
     22        _param = callbackElement.getAttribute("type");
    1923    }
    2024    else{
     
    2529    public void run()
    2630    {
     31    _parent.getParent().getParent().loadGuiExtFile();
    2732    JTextArea messageArea = _parent.getMessageArea();
    2833
    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
    3054    Class[] params = new Class[]{String.class};
    3155   
  • main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/ExtXMLHelper.java

    r21989 r21990  
    99    static public final String EXTENSION = "extension";
    1010    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";
    1312    static public final String NAME = "name";
    1413    static public final String DOWNLOAD = "download";
     
    2322    static public final String DESCRIPTION = "description";
    2423    static public final String PROPERTY = "property";
    25     static public final String SEQUENCE_LIST = "sequence_list";
     24    static public final String SEQUENCE_LIST = "sequenceList";
    2625    static public final String STEP ="step";
    2726    static public final String COMMAND ="command";
  • main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/ExtensionInformation.java

    r21919 r21990  
    2525    protected String _fileStem = null;
    2626    protected String _description = null;
    27     protected String _baseExt = null;
    2827    protected String _baseURL = null;
    2928    protected SequenceList _sequenceList= null;
     
    3837        _fileStem = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.FILE_STEM, true);
    3938        _description = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.DESCRIPTION, true);
    40         _baseExt = ExtXMLHelper.getValueFromSingleElement(extensionElement, ExtXMLHelper.BASE_EXT, true);
    4139        _baseURL = baseURL;
    4240        _sequenceList = new SequenceList(ExtXMLHelper.getSingleChildElement(extensionElement, ExtXMLHelper.SEQUENCE_LIST, true), this);
     
    7169    return _description;
    7270    }
    73  
    74     public String getBaseClassName()
    75     {
    76     return _baseExt;
    77     }
    7871
    7972    public SequenceList getSequenceList()
    8073    {
    8174    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;
    10875    }
    10976
  • main/trunk/greenstone3/src/java/org/greenstone/admin/guiext/Option.java

    r21919 r21990  
    1515
    1616    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 
    2217        _id = optionElement.getAttribute("id");
    2318        if(_id == null || _id.equals("")){
    2419        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;
    2525        }
    2626       
Note: See TracChangeset for help on using the changeset viewer.