Ignore:
Timestamp:
05/01/08 12:26:53 (16 years ago)
Author:
ra33
Message:

New expeditee version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Misc.java

    r4 r7  
    66import java.awt.image.BufferedImage;
    77import java.io.File;
    8 import java.io.FileInputStream;
    98import java.io.FileNotFoundException;
    10 import java.io.FileOutputStream;
    119import java.io.IOException;
    1210import java.util.List;
     
    113111                Frame toDelete = DisplayIO.getCurrentFrame();
    114112                DisplayIO.Back();
     113                String deletedFrame = toDelete.getFrameName();
     114                String deletedFrameNameLowercase = deletedFrame.toLowerCase();
    115115                try {
    116                         String deletedFrame = toDelete.getFrameName();
    117116                        boolean del = FrameIO.DeleteFrame(toDelete);
    118117                        if (!del) {
     
    123122                                for (Item i : current.getItems())
    124123                                        if (i.getLink() != null
    125                                                         && i.getLink().toLowerCase().equals(
    126                                                                         toDelete.getFrameName().toLowerCase())) {
     124                                                        && i.getAbsoluteLink().toLowerCase().equals(
     125                                                                        deletedFrameNameLowercase)) {
    127126                                                i.setLink(null);
    128127                                        }
    129128
    130129                                FrameGraphics.Repaint();
    131                                 FrameGraphics.DisplayMessage(deletedFrame
    132                                                 + " Deleted.");
     130                                FrameGraphics.DisplayMessage(deletedFrame + " Deleted.");
    133131                        }
    134132                } catch (IOException ioe) {
    135                         FrameGraphics.ErrorMessage("Error trying to delete "
    136                                         + toDelete.getFrameName() + ":\n" + ioe.getMessage());
     133                        FrameGraphics.ErrorMessage("Error trying to delete " + deletedFrame
     134                                        + ":\n" + ioe.getMessage());
    137135                }
    138136        }
     
    240238                FrameGraphics.Repaint();
    241239        }
    242        
     240
    243241        /**
    244242         * Creates a new Text Object containing the available fonts.
     
    246244        public static void GetAvailableFontFamilyNames() {
    247245
    248                 String[] availableFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
     246                String[] availableFonts = GraphicsEnvironment
     247                                .getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
    249248                StringBuilder fontsList = new StringBuilder();
    250                 for (String s: availableFonts) {
     249                for (String s : availableFonts) {
    251250                        fontsList.append(s).append('\n');
    252251                }
    253                
     252
    254253                Text text = DisplayIO.getCurrentFrame().createNewText();
    255254                // We dont want the stats to wrap at all
     
    364363        public static void CopyFile(String existingFile, String newFileName) {
    365364                try {
    366                         //TODO is there a built in method which will do this faster?
    367                        
    368                         FrameGraphics.DisplayMessage("Copying file " + existingFile + " to " + newFileName + "...");
    369                         FileInputStream is = new FileInputStream(existingFile);
    370                         FileOutputStream os = new FileOutputStream(
    371                                         newFileName, false);
    372                         int data;
    373                         while ( (data = is.read()) != -1 ) {
    374                                 os.write(data);
    375                         }
    376                         os.flush();
    377                         os.close();
    378                         is.close();
     365                        // TODO is there a built in method which will do this faster?
     366
     367                        FrameGraphics.DisplayMessage("Copying file " + existingFile
     368                                        + " to " + newFileName + "...");
     369                        FrameIO.copyFile(existingFile, newFileName);
    379370                        FrameGraphics.DisplayMessage("File copied successfully");
    380371                } catch (FileNotFoundException e) {
    381372                        FrameGraphics.DisplayMessage("Error opening file: " + existingFile);
    382                 } catch (Exception e){
     373                } catch (Exception e) {
    383374                        FrameGraphics.DisplayMessage("File could not be copied");
    384375                }
     
    446437
    447438                for (Item i : body)
    448                         if (i != child.getTitle() && i != child.getName()
     439                        if (i != child.getTitle() && i != child.getFrameNameItem()
    449440                                        && !i.isAnnotation()) {
    450441                                item = i;
Note: See TracChangeset for help on using the changeset viewer.