Package frost.messaging.frost

Examples of frost.messaging.frost.FileAttachment


        // attach all files and boards the user chosed
        if( filesTableModel.getRowCount() > 0 ) {
            for(int x=0; x < filesTableModel.getRowCount(); x++) {
                final MFAttachedFile af = (MFAttachedFile)filesTableModel.getRow(x);
                final File aChosedFile = af.getFile();
                final FileAttachment fa = new FileAttachment(aChosedFile);
                newMessage.addAttachment(fa);
            }
            newMessage.setHasFileAttachments(true);
        }
        if( boardsTableModel.getRowCount() > 0 ) {
View Full Code Here


            List<FrostDownloadItem> frostDownloadItemList = new LinkedList<FrostDownloadItem>();
            HashMap<String, FrostDownloadItem> frostDownloadItemKeyMap = new HashMap<String, FrostDownloadItem>();
            HashMap<String, FrostDownloadItem> frostDownloadItemNameMap = new HashMap<String, FrostDownloadItem>();
           
            while (it.hasNext()) {
                final FileAttachment fa = it.next();
               
                if( frostDownloadItemKeyMap.containsKey(fa.getKey())) {
                continue;
              }
               
                String filename = fa.getFileName();
                // maybe convert html codes (e.g. %2c -> , )
                if( filename.indexOf("%") > 0 ) {
                    try {
                        filename = java.net.URLDecoder.decode(filename, "UTF-8");
                    } catch (final java.io.UnsupportedEncodingException ex) {
                        logger.log(Level.SEVERE, "Decode of HTML code failed", ex);
                    }
                }
                if( frostDownloadItemNameMap.containsKey(filename)) {
                  continue;
                }
                final FrostDownloadItem frostDwonloadItem = new FrostDownloadItem(
                  filename,
                  fa.getKey(),
                  fa.getFileSize()
                );
               
                frostDwonloadItem.setAssociatedMessageId(selectedMessage.getMessageId());
                frostDwonloadItem.setAssociatedBoardName(selectedMessage.getBoard().getBoardFilename());
                if( Core.frostSettings.getBoolValue(SettingsClass.USE_BOARDNAME_DOWNLOAD_SUBFOLDER_ENABLED) ){
                  frostDwonloadItem.setDownloadDir(frostDwonloadItem.getDownloadDir().concat(frostDwonloadItem.getAssociatedBoardName()));
                }
                frostDownloadItemList.add( frostDwonloadItem );
                frostDownloadItemKeyMap.put(fa.getKey(), frostDwonloadItem);
                frostDownloadItemNameMap.put(filename, frostDwonloadItem);
            }
           
            frostDownloadItemKeyMap.clear();
            frostDownloadItemNameMap.clear();
View Full Code Here

TOP

Related Classes of frost.messaging.frost.FileAttachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.