public boolean saveHTML(java.awt.Component parent) { boolean proceed = false; while (!proceed) { int returnVal = showSaveDialog(parent); if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) { checkExtension(); proceed = checkOverwrite(parent); } else { success = false; return success; } } try { if (param.getWidth() > 0) { it.trim(param); } String nakedFileName = getFilename().substring(0, getFilename().lastIndexOf('.')); String transcriptFileName = nakedFileName + "_t.html"; String segmentListFileName = nakedFileName + "_l.html"; System.out.println("started writing document..."); FileOutputStream fos = new FileOutputStream(getFilename()); fos.write("<html><head></head>".getBytes()); fos.write("<frameset cols=\"80%,20%\">".getBytes()); fos.write("<frame src=\"".getBytes()); fos.write( transcriptFileName .substring(transcriptFileName.lastIndexOf(System.getProperty("file.separator")) + 1) .getBytes()); fos.write("\" name=\"IT\">".getBytes()); fos.write("<frame src=\"".getBytes()); fos.write( segmentListFileName .substring(segmentListFileName.lastIndexOf(System.getProperty("file.separator")) + 1) .getBytes()); fos.write("\" name=\"WL\">".getBytes()); fos.write("<noframes></noframes></frameset></html>".getBytes()); fos.close(); System.out.println("document written."); // write IT HTML it.writeHTMLToFile(transcriptFileName, param); // write segmentlist HTML sl.writeHTMLToFile(segmentListFileName, "IT", transcriptFileName); } catch (IOException ioe) { showIOErrorDialog(ioe, parent); } return success; }
private void exportHIATHTMLWordList() { // convert Basic Transcription to Interlinear Text org.exmaralda.partitureditor.interlinearText.InterlinearText it = ItConverter.BasicTranscriptionToInterlinearText( table.getModel().getTranscription(), table.getModel().getTierFormatTable()); System.out.println("Transcript converted to interlinear text."); if (table.getFrameEndPosition() >= 0) { ((org.exmaralda.partitureditor.interlinearText.ItBundle) it.getItElementAt(0)) .frameEndPosition = table.getFrameEndPosition(); } if (table.htmlParameters.prependAdditionalInformation) { table.htmlParameters.additionalStuff = table.getModel().getTranscription().getHead().toHTML(); } // FSMSaxReader sr = new FSMSaxReader(); try { BasicTranscription bt = table.getModel().getTranscription().makeCopy(); // convert Basic Transcription to Segmented Transcription SegmentedTranscription st = new org.exmaralda.partitureditor.jexmaralda.segment.HIATSegmentation(table.hiatFSM) .BasicToSegmented(bt); // put all the words into a list SegmentList words = st.makeSegmentList("HIAT:w"); // give the word list, the interlinear text and the break parameters to the dialog // which will take care of the rest ExportHTMLWordListFileDialog dialog = new ExportHTMLWordListFileDialog(words, it, table.htmlParameters, table.htmlDirectory); boolean success = dialog.saveHTML(table); table.htmlDirectory = dialog.getFilename(); } catch (SAXException se) { // processSAXException(se); } catch (FSMException fsme) { // processFSMException(fsme); } }