Ignore:
Timestamp:
01/11/13 18:39:34 (8 years ago)
Author:
davidb
Message:

Once a collection is imported into GlamED from Greenstone, a linked text item containing the full collection name and a text item with the description extracted from GSDL will be displayed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/GlamED/trunk/src/org/honours/agents/ImportCollections.java

    r26601 r26701  
    11package org.honours.agents;
    22
    3 import java.awt.Color;
    4 import java.awt.Point;
     3import java.awt.*;
    54import java.io.*;
    65import java.util.ArrayList;
     
    98import org.expeditee.actions.Misc;
    109import org.expeditee.agents.DefaultAgent;
     10import org.expeditee.items.*;
     11import org.expeditee.gui.Frame;
    1112import org.expeditee.gui.*;
    12 import org.expeditee.items.Item;
    13 import org.expeditee.items.Text;
    1413
    1514import org.honours.Main;
    1615import org.honours.collection.*;
     16import org.honours.greenstone.CollectionConfigReader;
    1717import org.honours.gui.*;
    1818
     
    6969    }
    7070   
     71    /**
     72     * TODO: Change this method so we only display the full name of the collection and the collection's description (the first 10 words).
     73     * @param children
     74     * @throws Exception
     75     */
    7176    private static void importEachCollection(String[] children) throws Exception{
    7277
     
    120125       
    121126        for(Collection t : tempCollections){
    122            
    123            
    124127            Main._collections.add(t);
    125128        }
     
    199202    private static void displayRowsOfLinks(String collectionName,Frame getFreeFrame, Point getFreePoint, String link) {
    200203       
    201         getFreeFrame.addText(getFreePoint.x, getFreePoint.y, collectionName, null,link);
    202        
    203         //TODO: will need to change it so it runs an action - if a collection space does NOT
    204         //exist it will be generated, otherwise user will just simply navigate to it.
    205         getFreeFrame.addText(getFreePoint.x+250,getFreePoint.y,"View Collection Space",null,"collection-space-"+collectionName+"1");
    206        
    207         getFreeFrame.addText(getFreePoint.x+500,getFreePoint.y,"Export to GSDL","CollectionToGreenstone",link);
    208        
    209         getFreeFrame.addText(getFreePoint.x+750,getFreePoint.y,"Complete Reimport", "OverwriteUpdate " + collectionName + "1");
    210        
    211         getFreeFrame.addText(getFreePoint.x+1000,getFreePoint.y,"Incremental Reimport","AddDeleteItemsOnlyUpdate " + collectionName + "1");
     204        CollectionConfigReader ccr = new CollectionConfigReader(collectionName);
     205       
     206        String description = ccr.retrieveDescription();
     207        String fullCollName = ccr.retrieveFullCollectionName();
     208               
     209        if(fullCollName != null){
     210            getFreeFrame.addText(getFreePoint.x, getFreePoint.y, fullCollName, null, link);
     211        }else{
     212            getFreeFrame.addText(getFreePoint.x, getFreePoint.y, collectionName, null, link);
     213        }
     214       
     215        //Display collection description retrieved from collectionConfig.xml file - only first 25 words if it's a long description.
     216        if(description != null){
     217            description = description.replaceAll("\\<[^>]*>","");
     218           
     219            String[] descriptionWords = description.split(" ");
     220            String outputDescription = "";
     221       
     222            if(descriptionWords.length > 25){
     223           
     224                for(int i = 0; i < 25; i++){
     225                    outputDescription += descriptionWords[i] + " ";
     226                }
     227                outputDescription += "...";
     228           
     229            }else{
     230                outputDescription = description;
     231            }
     232       
     233            getFreeFrame.addText(getFreePoint.x+250, getFreePoint.y, outputDescription, null);
     234        }
    212235    }
    213236   
Note: See TracChangeset for help on using the changeset viewer.