Changeset 290


Ignore:
Timestamp:
09/03/08 14:01:24 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/agents/mail/MailSession.java

    r286 r290  
    337337        }
    338338
    339         public synchronized void finalise() {
     339        /**
     340         * Closes the mail folders.
     341         * @return true if the folders needed to be closed.
     342         */
     343        public synchronized boolean finalise() {
     344                boolean result = false;
    340345                try {
    341346                        if (_transport != null && _transport.isConnected()) {
    342347                                _transport.close();
     348                                result = true;
    343349                        }
    344350
    345351                        if (_folder != null && _folder.isOpen()) {
    346352                                _folder.close(false);
     353                                result = true;
    347354                        }
    348355
    349356                        if (_store != null && _store.isConnected()) {
    350357                                _store.close();
     358                                result = true;
    351359                        }
    352360                } catch (Exception e) {
    353361
    354362                }
     363                return result;
    355364        }
    356365
  • trunk/src/org/expeditee/gui/Browser.java

    r282 r290  
    426426
    427427                                        if (MailSession.getInstance() != null) {
    428                                                 MessageBay.displayMessage("Closing ExpMail...");
    429                                                 MailSession.getInstance().finalise();
     428                                                if (MailSession.getInstance().finalise()) {
     429                                                        MessageBay.displayMessage("Closing ExpMail...");
     430                                                }
    430431                                        }
    431432
  • trunk/src/org/expeditee/gui/Frame.java

    r286 r290  
    16461646         */
    16471647        public String getExportFileName() {
    1648                 Text tag = ItemUtils.FindTag(getItems(), "@file:");
    1649                 if (tag != null) {
    1650                         String file = ItemUtils.StripTag(tag.getFirstLine(), "@file");
    1651                         file = file.trim();
    1652                         if (file.length() > 0)
    1653                                 return file;
    1654                 }
    1655 
    1656                 return _frameName.getText();
     1648                return getAnnotationValue("file");
    16571649        }
    16581650
  • trunk/src/org/expeditee/io/AbstractHTMLWriter.java

    r289 r290  
    5252
    5353                writer.write(styleName + " { font-size: " + Math.round(style.getSize())
    54                                 + "pt");
     54                                + "px");
    5555
    5656                Font font = style.getPaintFont();
     
    120120
    121121        protected void indent() throws IOException {
    122                 for (int i = 0; i < _indent; i++)
     122                for (int i = 0; i < getIndent(); i++)
    123123                        _writer.write(INDENT);
    124124        }
    125 
    126         protected int getIndent() {
    127                 return _indent;
    128         }
    129125}
  • trunk/src/org/expeditee/io/DefaultTreeWriter.java

    r289 r290  
    1414                TreeWriter {
    1515
    16         protected int _indent = 0;
     16        private int _indent = 0;
    1717       
    1818        // the list of frames currently being processed
     
    177177                }
    178178        }
     179       
     180        protected int getIndent() {
     181                return _indent;
     182        }
    179183}
  • trunk/src/org/expeditee/io/HTMLBWriter.java

    r226 r290  
    1919        protected void writeTitle(Text toWrite, List<Item> items)
    2020                        throws IOException {
     21                int indent = getIndent();
     22                if(indent == 0)
     23                        return;
     24               
    2125                String heading = toWrite.getText();
    22                 String tag = "h" + (getIndent() + 1);
     26                String tag = "h" + indent;
    2327                // indenting for tag
    2428                indent();
  • trunk/src/org/expeditee/io/PDFWriter.java

    r282 r290  
    1414import com.lowagie.text.Document;
    1515import com.lowagie.text.DocumentException;
     16import com.lowagie.text.Font;
    1617import com.lowagie.text.FontFactory;
    1718import com.lowagie.text.Paragraph;
     
    2021/**
    2122 * Writes out a tree in a linear format.
     23 *
    2224 * @author root
    23  *
     25 * 
    2426 */
    2527public class PDFWriter extends DefaultTreeWriter {
     
    2729        private Document _pdfDocument;
    2830
     31        private Font _bodyFont;
     32
    2933        public PDFWriter() {
     34                if (UserSettings.Style.size() > 0) {
     35                        Text text = UserSettings.Style.get(0);
     36                        _bodyFont = FontFactory.getFont(Conversion.getPdfFont(text
     37                                        .getFamily()), text.getSize(), text.getPaintFont()
     38                                        .getStyle(), text.getColor());
     39                }
    3040                _pdfDocument = new Document();
    3141        }
     
    4252                        _pdfDocument.addAuthor(UserSettings.Username);
    4353                        _pdfDocument.addCreator("Expeditee");
     54                        _pdfDocument.addTitle(start.getTitle());
    4455                } catch (DocumentException e) {
    4556                        e.printStackTrace();
     
    5162        protected void writeTitle(Text toWrite, List<Item> items)
    5263                        throws IOException {
    53                 _pdfDocument.addTitle(toWrite.getText());
    54                 writeText(toWrite);
     64                int indent = getIndent();
     65                if (indent == 0)
     66                        return;
     67
     68                if (indent < UserSettings.Style.size()) {
     69                        String text = toWrite.getText();
     70                        toWrite = UserSettings.Style.get(indent).getTemplateForm();
     71                        toWrite.setText(text);
     72                }
     73
     74                writeText(toWrite, false);
    5575        }
    5676
     
    6282
    6383        @Override
    64         protected void writeStartLink(Item linker) throws IOException {
     84        protected void writeText(Text text) throws IOException {
     85                writeText(text, true);
    6586        }
    6687
    67         @Override
    68         protected void writeEndLink(Item linker) throws IOException {
    69         }
     88        protected void writeText(Text text, boolean bodyText) throws IOException {
     89                try {
     90                        Font font = null;
     91                        if (bodyText) {
     92                                font = _bodyFont;
     93                        }
    7094
    71         @Override
    72         protected void writeText(Text text) throws IOException {
    73                 try {
    74 
    75                         _pdfDocument.add(new Paragraph(text.getText(), FontFactory.getFont(
    76                                         Conversion.getPdfFont(text.getFamily()), text.getSize(),
    77                                         text.getPaintFont().getStyle(), text.getColor())));
     95                        if (font == null) {
     96                                font = FontFactory.getFont(Conversion.getPdfFont(text
     97                                                .getFamily()), text.getSize(), text.getPaintFont()
     98                                                .getStyle(), text.getColor());
     99                        }
     100                       
     101                        _pdfDocument.add(new Paragraph(text.getText(), font));
    78102                } catch (DocumentException e) {
    79103                        // TODO Auto-generated catch block
  • trunk/src/org/expeditee/items/Text.java

    r289 r290  
    12551255                // --- Get the output of the LineBreakMeasurer and store it in a
    12561256                while ((layout = _lineBreaker.nextLayout(width)) != null) {
    1257                         // for some reason lineBreaker will not break on newline
     1257                        // lineBreaker does not break on newline
    12581258                        // characters so they have to be check manually
    12591259                        int start = _lineOffsets.get(_lineOffsets.size() - 1);
Note: See TracChangeset for help on using the changeset viewer.