Package datasoul.serviceitems.song

Examples of datasoul.serviceitems.song.Song


        if(this.droppable){       
            try {
                Object obj = dtde.getTransferable().getTransferData(SerializableObject.serializableObjectFlavor);
                if (obj instanceof Song){
                    Song objclone = ((Song)obj).getClone();
                    ((ListTable)this.getModel()).addItem(objclone);
                }else{
                    ((ListTable)this.getModel()).addItem(obj);
                }
            } catch (UnsupportedFlavorException ex) {
View Full Code Here


       
        NodeList nodeList = nodeIn.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) {
                if (nodeList.item(i).getNodeName().equals("Song")) {
                    Song song = new Song();
                    song.readObject(nodeList.item(i), zip);
                    this.addItem(song);
                } else if (nodeList.item(i).getNodeName().equals("TextServiceItem")) {
                    TextServiceItem tsi = new TextServiceItem();
                    tsi.readObject(nodeList.item(i), zip);
                    this.addItem(tsi);
View Full Code Here

            pbProgress.setMaximum(slt.getRowCount());
            for (int i=0; i<slt.getRowCount(); i++){
                Object o = slt.getServiceItem(i);
                pbProgress.setValue(i);
                if (o instanceof Song){
                    Song s = (Song) o;
                    r.setTemplate(s.getTemplate());
                    r.setTitle(s.getTitle());
                    r.setSongAuthor(s.getSongAuthor());
                    r.setSongSource(s.getSongSource());
                    r.setCopyright(s.getCopyright());
                    for (int k=0; k<s.getRowCount(); k++){
                        slideCount++;
                        r.setSlide(s.getSlideText(k));
                        if (k < s.getRowCount()-1){
                            r.setNextSlide(s.getSlideText(k+1));
                        }else{
                            r.setNextSlide("");
                        }
                        /* start rendering */
                        r.slideChange(-1);
View Full Code Here

            songFile = new File(path + File.separator + name + ".song");
        }


        // Create song object
        Song song = new Song();
        song.setTitle(name);
        song.setFilePath(songFile.getAbsolutePath());
        song.setTemplate(DisplayControlConfig.getInstance().getDefaultTemplateSong());

        // If needed, convert the file to ODP
        File processFile = officeFile;
        if (officeFile.getName().toLowerCase().endsWith("ppt") ||
                officeFile.getName().toLowerCase().endsWith("pptx")){
            OpenofficeHelper helper = new OpenofficeHelper();
            String convFile = helper.convertToODP(officeFile);
            processFile = new File(convFile);
            if (!processFile.exists()){
                throw new IOException(java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("UNABLE TO CONVERT DOCUMENT: ")+officeFile.getName());
            }
            helper.dispose();
        }

        // Extract text from Office file
        StringBuffer sb = new StringBuffer();
        convertPresentationToText(processFile, sb);
        song.setText(sb.toString());

        // If needed, cleanup converted ODP file
        if (processFile != officeFile){
            processFile.delete();
        }

        // Write the file
        try{
            Node node = song.writeObject(null);
            Document doc = node.getOwnerDocument();
            doc.appendChild( node);                        // Add Root to Document
            FileOutputStream fos = new FileOutputStream(song.getFilePath());

            Source source = new DOMSource(doc);

            // Prepare the output file
            Result result = new StreamResult(fos);

            // Write the DOM document to the file
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.transform(source, result);

            fos.close();

        } catch(Exception e){
            ShowDialog.showWriteFileError(song.getFileName(), e);
        }

        // Update table
        AllSongsListTable.getInstance().addItem(song);
View Full Code Here

TOP

Related Classes of datasoul.serviceitems.song.Song

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.