Ejemplo n.º 1
0
 public boolean exportToTxtFile() {
   Internal internal =
       BookUtil.get(
           this.mainFrame,
           SbConstants.BookKey.EXPORT_DIRECTORY,
           EnvUtil.getDefaultExportDir(this.mainFrame));
   File file1 = new File(internal.getStringValue());
   JFileChooser chooser = new JFileChooser(file1);
   chooser.setApproveButtonText(I18N.getMsg("msg.common.export"));
   chooser.setSelectedFile(new File(getFileName()));
   chooser.setFileFilter(new TextFileFilter());
   int i = chooser.showOpenDialog(this.mainFrame);
   if (i == 1) {
     return false;
   }
   File outFile = chooser.getSelectedFile();
   if (!outFile.getName().endsWith(".txt")) {
     outFile = new File(outFile.getPath() + ".txt");
   }
   StringBuffer buffer = getContent();
   try {
     try (BufferedWriter outStream = new BufferedWriter(new FileWriter(outFile))) {
       String str = buffer.toString();
       outStream.write(HtmlUtil.htmlToText(str, true));
     }
   } catch (IOException e) {
     return false;
   }
   JOptionPane.showMessageDialog(
       this.mainFrame,
       I18N.getMsg("msg.common.export.success") + "\n" + outFile.getAbsolutePath(),
       I18N.getMsg("msg.common.export"),
       1);
   return true;
 }
Ejemplo n.º 2
0
 @Override
 public void init() {
   try {
     Internal internal =
         BookUtil.get(mainFrame, BookKey.CHRONO_ZOOM, SbConstants.DEFAULT_CHRONO_ZOOM);
     setZoomedSize(internal.getIntegerValue());
   } catch (Exception e) {
     setZoomedSize(SbConstants.DEFAULT_CHRONO_ZOOM);
   }
 }
Ejemplo n.º 3
0
 @Override
 public void init() {
   try {
     Internal internal =
         BookUtil.get(mainFrame, BookKey.MANAGE_COLUMNS, SbConstants.DEFAULT_MANAGE_COLUMNS);
     cols = internal.getIntegerValue();
   } catch (Exception e) {
     e.printStackTrace();
     cols = SbConstants.DEFAULT_MANAGE_COLUMNS;
   }
 }
Ejemplo n.º 4
0
 @SuppressWarnings("unchecked")
 private void initUI() {
   paramExport = new ParamExport(mainFrame);
   paramExport.load();
   Internal internal =
       BookUtil.get(
           mainFrame,
           SbConstants.BookKey.EXPORT_DIRECTORY,
           EnvUtil.getDefaultExportDir(mainFrame));
   txFolder.setText(internal.getStringValue());
   if (txFolder.getText().isEmpty()) txFolder.setText(FileUtils.getUserDirectoryPath());
   cbReport.removeAllItems();
   for (ExportData export : exports) {
     cbReport.addItem(export);
   }
   cbReport.setSelectedIndex(0);
   cbFormat.removeAllItems();
   for (String zformat : formats) {
     cbFormat.addItem(zformat);
   }
   cbFormat.setSelectedItem("html");
 }
Ejemplo n.º 5
0
 protected int getZoomValue() {
   Internal internal =
       BookUtil.get(mainFrame, BookKey.MANAGE_ZOOM, SbConstants.DEFAULT_MANAGE_ZOOM);
   return internal.getIntegerValue();
 }
Ejemplo n.º 6
0
 protected void setZoomValue(int val) {
   BookUtil.store(mainFrame, BookKey.MANAGE_ZOOM, val);
   mainFrame.getBookController().manageSetZoom(val);
 }
Ejemplo n.º 7
0
 private void btCloseActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btCloseActionPerformed
   BookUtil.store(mainFrame, SbConstants.BookKey.EXPORT_DIRECTORY, txFolder.getText());
   dispose();
 } // GEN-LAST:event_btCloseActionPerformed