Ignore:
Timestamp:
2013-01-08T22:19:33+13:00 (11 years ago)
Author:
davidb
Message:

Added back in code for generating a collection space and for generating drop boxes displayed on each frame in a collection space frameset.

File:
1 edited

Legend:

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

    r26605 r26608  
    7676   
    7777    public void generate(){
    78        
     78        try{
     79           
     80            if(_thumbnailsDirectory == null){
     81               
     82                MessageBay.errorMessage("ERROR: No thumbnails directory set up so" +
     83                        " cannot generate CollectionSpace");
     84
     85                return;
     86            }
     87
     88            //generate actual collectionSpace frameset using _name.
     89            createCollectionSpace();
     90           
     91            //Open thumbnails.info file.
     92            BufferedReader br = new BufferedReader(new FileReader(
     93                    _thumbnailsDirectory + File.separator +
     94                    "thumbnails.info"));
     95            String line;
     96           
     97            while((line = br.readLine()) != null){
     98               
     99                String[] split = line.split(",");
     100               
     101                //1st entry in split is filename, 2nd is associated frame name.
     102                Text imageSource = new Text("@i: " + split[0] + " 1.0");
     103                Picture newPic = PictureInformation.getPicture(imageSource);
     104                newPic.setLink(split[1]);
     105                _thumbnails.add(newPic);
     106            }
     107            br.close();
     108           
     109            writeThumbnails();
     110           
     111            MessageBay.displayMessage("Collection Space generated!");
     112           
     113            Navigation.Goto(_name + "1");
     114           
     115            }catch(Exception e){
     116                e.printStackTrace();
     117            }
    79118       
    80119    }
     
    149188   
    150189    private void generateDropBox(int frameIter){
    151        
     190        int maxRowLength = _startX + (_columns * _imageSize) + ((_columns-1)* _gap);
     191       
     192        //the maximum height of the area displaying all the rows.
     193        int maxRowsAreaHeight = _startY + (_rows * _imageSize) + ((_rows-1)*_gap);
     194       
     195        int dropBoxGap = 80;
     196       
     197        int dropBoxStartX = maxRowLength + (dropBoxGap*2);
     198        int dropBoxStartY = _startY;
     199       
     200        int dropBoxWidth = 300;
     201        int dropBoxHeight = maxRowsAreaHeight;
     202       
     203        Frame currFrame = FrameIO.LoadFrame(_name + frameIter);
     204       
     205        String dropBoxSourceText = "@iw: org.honours.widgets.CollectionSpaceDropBox " + dropBoxWidth + " " + dropBoxHeight;
     206        Text newText = currFrame.addText(dropBoxStartX, dropBoxStartY, dropBoxSourceText, null);
     207        newText.onParentStateChanged(new ItemParentStateChangedEvent(currFrame, ItemParentStateChangedEvent.EVENT_TYPE_ADDED));
     208
     209        currFrame.setSaved();
    152210    }
    153211   
Note: See TracChangeset for help on using the changeset viewer.