Changeset 284


Ignore:
Timestamp:
08/27/08 15:10:31 (16 years ago)
Author:
ra33
Message:

Added additional mail functionality...
Also added REMINDER feature

Location:
trunk/src/org/expeditee
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Actions.java

    r282 r284  
    410410                        Object[] params = null;
    411411
     412                        parameters = parameters.trim();
    412413                        // determine correct parameters for constructor
    413414                        for (Constructor c : constructors) {
    414415                                Class[] paramTypes = c.getParameterTypes();
    415416                                int paramCount = paramTypes.length;
    416                                 if (paramCount > 0) {
     417                                if (paramCount > 0 && parameters.length() > 0) {
    417418                                        params = new Object[paramCount];
    418419                                        String[] paramStrings = parameters.split("\\s+");
  • trunk/src/org/expeditee/actions/MailActions.java

    r282 r284  
    11package org.expeditee.actions;
     2
     3import java.util.Collection;
    24
    35import javax.mail.Flags.Flag;
     
    4648                return mail;
    4749        }
    48 
    49         public static void getUnreadMail() {
    50                 MailSession.getInstance().getMail(Flag.SEEN, false,
    51                                 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition());
     50       
     51        public static Collection<Text> getRecentMail(int number) {
     52                return getMail(null, null, number);
     53        }
     54       
     55        public static Collection<Text> getUnreadMail() {
     56                return getMail(Flag.SEEN, false, Integer.MAX_VALUE);
    5257        }
    5358
    54         public static void getAllMail() {
    55                 MailSession.getInstance().getMail(null, null,
    56                                 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition());
     59        public static Collection<Text> getAllMail() {
     60                return getMail(null, null, Integer.MAX_VALUE);
     61        }
     62       
     63        public static Collection<Text> getMail() {
     64                return getAllMail();
    5765        }
    5866
    59         public static void getNewMail() {
    60                 MailSession.getInstance().getMail(Flag.RECENT, true,
    61                                 DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition());
     67        public static Collection<Text> getNewMail() {
     68                return getMail(Flag.RECENT, true, Integer.MAX_VALUE);
     69        }
     70       
     71        private static Collection<Text> getMail(Flag flag, Boolean isPresent, int noOfMessages){
     72                Collection<Text> mailItems = MailSession.getInstance().getMail(flag, isPresent,
     73                                DisplayIO.getCurrentFrame(), FrameMouseActions.getPosition(), noOfMessages);
     74                //MessageBay.displayMessage(mailItems.size() + " messages read", Color.green);
     75               
     76                return mailItems;
    6277        }
    6378
     
    8095                }
    8196        }
     97       
     98        public static String getMailCount() {
     99                return getAllMailCount();
     100        }
    82101
    83102        public static String getNewMailCount() {
     
    96115                        return;
    97116                }
    98                 String fromName = frame.getAnnotationValue("fromName");
    99                
     117
    100118                reply.setActions(null);
    101119                FrameMouseActions.tdfc(reply);
     120
     121                Frame replyFrame = DisplayIO.getCurrentFrame();
     122                String titleText = frame.getTitle();
     123                //Add Re on the end if it is not already there
     124                if (titleText.length() >= 3
     125                                && !"re:".equals(titleText.substring(0, 3).toLowerCase())) {
     126                        titleText = "Re: " + titleText;
     127                }
     128                replyFrame.setTitle(titleText);
     129                FrameKeyboardActions.Drop(null, false);
    102130               
    103                 Frame replyFrame = DisplayIO.getCurrentFrame();
    104                 replyFrame.setTitle("RE: " + frame.getTitle());
    105                 FrameKeyboardActions.Drop(null, false);
     131                //Add a link to the original message
    106132                Text original = replyFrame.createNewText("@original");
    107133                original.setPosition(FrameMouseActions.getPosition());
    108134                original.setLink(frame.getName());
    109135                FrameKeyboardActions.Drop(original, false);
    110                
     136
    111137                Text to = replyFrame.createNewText("@to: " + fromAddress);
    112138                to.setPosition(FrameMouseActions.getPosition());
    113                 to.addAction("MailFrame");
     139                to.addAction("MailTree");
    114140                FrameKeyboardActions.Drop(to, false);
    115                 if (fromName != null) {
    116                         Text toName = replyFrame.createNewText("@toName: " + fromName);
    117                         toName.setPosition(FrameMouseActions.getPosition());
    118                         FrameKeyboardActions.Drop(toName, false);
    119                 }
     141                DisplayIO.setCursorPosition(FrameMouseActions.MouseX, FrameMouseActions.MouseY + 15);
    120142        }
    121143
  • trunk/src/org/expeditee/actions/Misc.java

    r282 r284  
    2222import org.expeditee.gui.FrameMouseActions;
    2323import org.expeditee.gui.MessageBay;
     24import org.expeditee.gui.Reminders;
    2425import org.expeditee.gui.TimeKeeper;
    2526import org.expeditee.importer.FrameDNDTransferHandler;
    26 import org.expeditee.items.Dot;
    2727import org.expeditee.items.Item;
    2828import org.expeditee.items.ItemUtils;
     
    860860                return d[0];
    861861        }
     862       
     863        public static void StopReminder() {
     864                Reminders.stop();
     865        }
    862866}
  • trunk/src/org/expeditee/agents/MailTree.java

    r282 r284  
    3030
    3131                                String frameTitle = linkedFrame.getTitle();
    32                                 sb.append(prefix).append(frameTitle).append('\n')
     32                                sb.append('\n').append(prefix).append(frameTitle).append('\n')
    3333                                                .append(prefix);
    34                                 for (int i = 0; i < frameTitle.length(); i++) {
    35                                         sb.append('-');
    36                                 }
    37                                 sb.append("\n\n");
     34                                // for (int i = 0; i < frameTitle.length(); i++) {
     35                                // sb.append('-');
     36                                // }
     37                                sb.append("----------------");
     38
     39                                sb.append("\n");
    3840                                sb.append(getFrameText(linkedFrame, prefix));
    3941                        } else {
     
    4648                        Frame linkedFrame = FrameIO.LoadFrame(original.getAbsoluteLink());
    4749                        if (linkedFrame != null) {
    48                                 sb.append("\n\n").append("Original Message").append(
    49                                                 "----------------").append("\n\n");
     50                                sb.append("\n\n");
     51                                String date = linkedFrame.getAnnotationValue("date");
     52                                if (date != null) {
     53                                        sb.append("On ").append(date);
     54                                }
     55                                String from = linkedFrame.getAnnotationValue("from");
     56                                if (from != null) {
     57                                        if (sb.length() > 0)
     58                                                sb.append(", ");
     59                                        //else
     60                                        //      sb.append("> ");
     61                                        sb.append(from);
     62                                        sb.append(" wrote:");
     63                                }
     64                                sb.append("\n\n");
    5065                                sb.append(getFrameText(linkedFrame, ">"));
    5166                        }
  • trunk/src/org/expeditee/agents/mail/MailSession.java

    r282 r284  
    1111import java.util.Properties;
    1212
     13import javax.mail.Address;
    1314import javax.mail.Authenticator;
    1415import javax.mail.Folder;
     
    2223import javax.mail.Transport;
    2324import javax.mail.Flags.Flag;
     25import javax.mail.Message.RecipientType;
    2426import javax.mail.event.MessageCountAdapter;
    2527import javax.mail.event.MessageCountEvent;
     
    2729import javax.mail.internet.MimeMessage;
    2830
    29 import org.expeditee.importer.FrameDNDTransferHandler;
    3031import org.expeditee.gui.AttributeValuePair;
    3132import org.expeditee.gui.Frame;
    3233import org.expeditee.gui.FrameCreator;
    3334import org.expeditee.gui.MessageBay;
     35import org.expeditee.importer.FrameDNDTransferHandler;
    3436import org.expeditee.items.Item;
    3537import org.expeditee.items.Text;
     
    151153                try {
    152154                        if (!_transport.isConnected()) {
    153                                 MessageBay.displayMessage("Connecting to SMTP server...");
     155                                Text message = MessageBay.displayMessage("Connecting to SMTP server...");
    154156                                _bConnecting = true;
    155157                                _transport.connect();
    156                                 MessageBay.overwriteMessage("SMTP server connected",
    157                                                 Color.green);
     158                                message.setText("SMTP server connected");
     159                                message.setColor(Color.green);
    158160                        } else {
    159161                                MessageBay.warningMessage("SMTP server already connected");
     
    165167                if (_mailServer != null && !_store.isConnected()) {
    166168                        try {
    167                                 MessageBay.displayMessage("Connecting to " + _mailServer
     169                                Text message = MessageBay.displayMessage("Connecting to " + _mailServer
    168170                                                + "...");
    169171                                _store.connect(_mailServer, _username, _password);
     
    192194                                                for (;;) {
    193195                                                        try {
    194                                                                 Thread.sleep(1000); // sleep for freq
    195                                                                 // milliseconds
    196                                                                 // This is to force the IMAP server to send us
    197                                                                 // EXISTS notifications
     196                                                                Thread.sleep(1000);
     197                                                                /*
     198                                                                 * sleep for freq milliseconds. This is to force
     199                                                                 * the IMAP server to send us EXISTS
     200                                                                 * notifications
     201                                                                 */
    198202                                                                // TODO: Is synchronisation needed?
    199203                                                                _folder.getMessageCount();
     204                                                                _folder.exists();
     205                                                                //_folder.getUnreadMessageCount();
    200206                                                        } catch (Exception e) {
     207                                                                e.printStackTrace();
    201208                                                        }
    202209                                                }
     
    204211                                }.start();
    205212
    206                                 MessageBay.overwriteMessage("Connection complete", Color.GREEN);
     213                                message.setText("Connection complete");
     214                                message.setColor(Color.GREEN);
    207215
    208216                                displayUnreadMailCount();
     
    217225
    218226        private void displayUnreadMailCount() {
    219                 Text text = new Text(-1, getUnreadCount() + " unread message"
    220                                 + (getUnreadCount() == 1 ? "" : "s"), Color.BLUE, null);
    221                 text.addAction("getUnreadMail");
     227                int unreadCount = getUnreadCount();
     228                Text text = new Text(-1, unreadCount + " unread message"
     229                                + (unreadCount == 1 ? "" : "s"), Color.BLUE, null);
     230                text.addAction("getRecentMail " + unreadCount);
    222231                MessageBay.displayMessage(text);
    223232        }
     
    236245                }
    237246
    238                 return _theMailSession.sendText(to, cc, bcc, subject, body, attachments);
     247                return _theMailSession
     248                                .sendText(to, cc, bcc, subject, body, attachments);
    239249        }
    240250
     
    263273                        // -- Create a new message --
    264274                        Message msg = new MimeMessage(_session);
    265                        
     275
    266276                        // -- Set the FROM and TO fields --
    267277                        msg.setFrom(new InternetAddress(_address));
     
    399409         * @return
    400410         */
    401         public Collection<Item> getMail(Flag flag, Boolean isPresent, Frame frame,
    402                         Point point) {
    403                 Collection<Item> mailItems = new LinkedList<Item>();
     411        public Collection<Text> getMail(Flag flag, Boolean isPresent, Frame frame,
     412                        Point point, int numberOfMessages) {
     413                if (_folder == null)
     414                        return null;
     415
     416                Collection<Text> mailItems = new LinkedList<Text>();
    404417                // -- Get the message wrappers and process them --
    405418                Message[] msgs;
    406419                try {
    407420                        msgs = _folder.getMessages();
    408                         for (int msgNum = 0; msgNum < msgs.length; msgNum++) {
     421
     422                        int start = Math.max(msgs.length - numberOfMessages, 0);
     423
     424                        for (int msgNum = start; msgNum < msgs.length; msgNum++) {
    409425                                if (flag == null
    410426                                                || msgs[msgNum].getFlags().contains(flag) == isPresent) {
    411                                         Item newItem = readMessage(msgs[msgNum], msgNum, frame,
     427                                        Text newItem = readMessage(msgs[msgNum], msgNum + 1, frame,
    412428                                                        point);
    413429                                        if (newItem != null) {
     
    421437                        e.printStackTrace();
    422438                }
     439               
    423440                return mailItems;
    424441        }
    425442
    426         private Item readMessage(final Message message, final int messageNo,
     443        private Text readMessage(final Message message, final int messageNo,
    427444                        final Frame frame, final Point point) {
    428445
    429446                final Text source = FrameDNDTransferHandler.importString(
    430                                 "Loading message " + messageNo, point);
     447                                "Reading message " + messageNo + "...", point);
    431448
    432449                new Thread() {
     
    439456                                                        .getFramesetName(), frame.path, subject, false);
    440457
     458                                        frames.addText("@date: " + message.getSentDate(), null,
     459                                                        null, null, false);
     460
    441461                                        // Get the header information
    442462                                        String from = ((InternetAddress) message.getFrom()[0])
    443                                                         .getPersonal();
    444                                         if (from != null) {
    445                                                 frames.addText("@fromName: " + from, null, null, null,
    446                                                                 false);
    447                                         }
    448                                         from = ((InternetAddress) message.getFrom()[0])
    449                                                         .getAddress();
     463                                                        .toString();
    450464                                        Text fromAddressItem = frames.addText("@from: " + from,
    451465                                                        null, null, null, false);
    452466
    453                                         Text reply = frames.addText("@reply" + from, null, null,
    454                                                         null, false);
    455                                         reply.setPosition(10 + fromAddressItem.getX()
    456                                                         + fromAddressItem.getBoundsWidth(), fromAddressItem
    457                                                         .getY());
     467                                        addRecipients(message, frames, _address, RecipientType.TO,
     468                                                        "@to: ");
     469                                        addRecipients(message, frames, null, RecipientType.CC,
     470                                                        "@cc: ");
     471
     472                                        // Read reply to addresses
     473                                        Text reply = addAddresses(message, frames, from, message
     474                                                        .getReplyTo(), "@replyTo: ");
     475                                        /*
     476                                         * If the only person to reply to is the person who sent the
     477                                         * mail add a tag that just says reply
     478                                         */
     479                                        if (reply == null) {
     480                                                reply = frames.addText("@reply", null, null, null,
     481                                                                false);
     482                                                reply.setPosition(10 + fromAddressItem.getX()
     483                                                                + fromAddressItem.getBoundsWidth(),
     484                                                                fromAddressItem.getY());
     485                                        }
     486                                        reply.addAction("reply");
     487                                        // frames.addSpace(15);
    458488
    459489                                        // -- Get the message part (i.e. the message itself) --
     
    491521                                        MessageBay.errorMessage("Error reading mail: "
    492522                                                        + e.getMessage());
     523                                        e.printStackTrace();
    493524                                }
    494525                        }
     
    546577                return _folder;
    547578        }
     579
     580        /**
     581         * @param message
     582         * @param frames
     583         * @param type
     584         * @throws MessagingException
     585         */
     586        private Text addAddresses(final Message message, final FrameCreator frames,
     587                        final String excludeAddress, final Address[] addresses,
     588                        String typeTag) throws MessagingException {
     589                if (addresses == null)
     590                        return null;
     591
     592                StringBuffer sb = new StringBuffer();
     593                boolean foundOtherRecipients = false;
     594                for (Address addy : addresses) {
     595                        // Only show the to flag if this message was sent to
     596                        // other people
     597                        if (excludeAddress == null
     598                                        || !addy.toString().toLowerCase().contains(
     599                                                        excludeAddress.toLowerCase())) {
     600                                foundOtherRecipients = true;
     601                        }
     602                        if (sb.length() > 0) {
     603                                sb.append(", ");
     604                        }
     605                        sb.append(addy.toString());
     606                }
     607                Text reply = null;
     608                if (foundOtherRecipients) {
     609                        reply = frames.addText(typeTag + sb.toString(), null, null, null,
     610                                        false);
     611                }
     612                return reply;
     613        }
     614
     615        private Text addRecipients(final Message message,
     616                        final FrameCreator frames, String excludeAddress,
     617                        RecipientType type, String typeTag) throws MessagingException {
     618                // Read and display all the recipients of the message
     619                Address[] toRecipients = message.getRecipients(type);
     620                return addAddresses(message, frames, excludeAddress, toRecipients,
     621                                typeTag);
     622        }
    548623}
  • trunk/src/org/expeditee/gui/FrameCreator.java

    r282 r284  
    77
    88public class FrameCreator {
    9         private int START_Y = 40;
    10 
    11         private final static int START_X = 20;
     9        public static final int INDENT_FROM_TITLE = 20;
     10
     11        private int START_Y;
     12
     13        private int START_X;
    1214
    1315        private Frame _current = null;
    1416
    15         private int _lastX = START_X;
     17        private int _lastX;
    1618
    1719        private int _maxX = 0;
    1820
    19         private int _lastY = START_Y;
     21        private int _lastY;
    2022
    2123        // Master copy of next & previous links
     
    2325
    2426        private Item _Mprev;
    25        
     27
    2628        private Item _Mfirst;
    2729
     
    6062                        Float bottom) {
    6163                Text button = new Text(text);
     64
    6265                button.setBackgroundColor(Color.LIGHT_GRAY);
    6366                button.setBorderColor(Color.DARK_GRAY);
     
    7376
    7477                button.updatePolygon();
    75                
     78
    7679                return button;
    7780        }
     
    8285                _Mnext = createButton("@Next", null, null, 10F, 15F);
    8386
    84                 _Mprev = createButton("@Previous", null, null, _Mnext.getBoundsWidth() + _Mnext.getAnchorRight() + 20F, 15F);
    85                
    86                 _Mfirst = createButton("@First", null, null, _Mprev.getBoundsWidth() + _Mprev.getAnchorRight() + 20F, 15F);
    87                
     87                _Mprev = createButton("@Previous", null, null, _Mnext.getBoundsWidth()
     88                                + _Mnext.getAnchorRight() + 20F, 15F);
     89
     90                _Mfirst = createButton("@First", null, null, _Mprev.getBoundsWidth()
     91                                + _Mprev.getAnchorRight() + 20F, 15F);
     92
    8893                Frame toUse = null;
    8994                try {
     
    97102                resetGlobals(toUse);
    98103                _firstFrame = toUse;
     104
    99105                // set positions of next\prev frame links
    100106                // _Mnext.setPosition(FrameGraphics.getMaxSize().width - 100,
     
    118124
    119125                        // add link to previous frame
    120                         _prev = addPreviousButton(newFrame, _current.getName()); 
     126                        _prev = addPreviousButton(newFrame, _current.getName());
    121127
    122128                        // add link to new frame
    123                         _next = addNextButton(_current,newFrame.getName());
    124                        
    125 //                      add link to new frame
    126                         addFirstButton(newFrame,_firstFrame.getName());
    127                        
     129                        _next = addNextButton(_current, newFrame.getName());
     130
     131                        // add link to new frame
     132                        addFirstButton(newFrame, _firstFrame.getName());
     133
    128134                        FrameIO.SaveFrame(_current, false);
    129135
     
    138144        private void resetGlobals(Frame toUse) {
    139145                Text title = toUse.getTitleItem();
    140                 START_Y = title.getY() + title.getBoundsHeight();
     146                START_X = INDENT_FROM_TITLE + title.getX();
     147                START_Y = getYStart(title);
    141148                _lastY = START_Y;
    142149                _lastX = START_X;
     
    201208        public Text addText(String toAdd, Color c, String link, String action,
    202209                        boolean bSave) {
    203                 Text text = _current.createNewText();
    204                 text.setText(toAdd);
    205                 text.setColor(c);
     210                Text text = _current.createNewText(toAdd);
     211                if (c != null)
     212                        text.setColor(c);
    206213                text.setLink(link);
    207214                text.setAction(action);
    208215
    209216                addItem(text, bSave);
    210                
     217
    211218                return text;
    212219        }
     
    235242                return addButton(_Mnext, current, link);
    236243        }
    237        
     244
    238245        public Item addPreviousButton(Frame current, String link) {
    239246                return addButton(_Mprev, current, link);
    240247        }
    241        
     248
    242249        public Item addFirstButton(Frame current, String link) {
    243250                return addButton(_Mfirst, current, link);
    244251        }
    245        
     252
    246253        public Item addButton(Item template, Frame current, String link) {
    247254                // add link to new frame
     
    250257                previousButton.setLink(link);
    251258                current.addItem(previousButton);
    252                
     259
    253260                return previousButton;
    254261        }
     262
     263        public void addSpace(int space) {
     264                _lastY += space;
     265        }
     266
     267        public static int getYStart(Item title) {
     268                return title.getY() + title.getBoundsHeight();
     269        }
    255270}
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r282 r284  
    11271127         *            indicate the cursor is in free space.
    11281128         */
    1129         public static void Drop(Item toDropFrom, boolean bPasting) {
     1129        public static boolean Drop(Item toDropFrom, boolean bPasting) {
    11301130                try {
    11311131                        FrameUtils.setLastEdited(null);
     
    11351135                        // if a line is being rubber-banded, this is a no-op
    11361136                        if (Frame.rubberbandingLine())
    1137                                 return; // No-op
     1137                                return false; // No-op
    11381138
    11391139                        // if the cursor is in free space then the drop will happen from the
     
    11471147                        if (toDropFrom == null) {
    11481148                                MessageBay.errorMessage("No item could be found to drop from");
    1149                                 return;
     1149                                return false;
    11501150                        }
    11511151
     
    11531153                                MessageBay
    11541154                                                .displayMessage("Only text items can be dropped from");
    1155                                 return;
     1155                                return false;
    11561156                        }
    11571157
     
    11621162                        if (column == null) {
    11631163                                MessageBay.errorMessage("No column found to align items to");
    1164                                 return;
     1164                                return false;
    11651165                        }
    11661166
     
    11731173
    11741174                        Text dummyItem = null;
    1175 
    11761175                        if (!bPasting && FreeItems.textOnlyAttachedToCursor()) {
    11771176                                dummyItem = (Text) FreeItems.getItemAttachedToCursor();
     
    11821181                                dummyItem.setText(newItemText + dummyItem.getText());
    11831182                        }
     1183                       
    11841184                        dummyItem = createText();
    11851185                        if (FreeItems.textOnlyAttachedToCursor()) {
     
    11991199                        if (column.size() == 0) {
    12001200                                Frame current = DisplayIO.getCurrentFrame();
    1201                                 Item itemTemplate = current.getItemTemplate();
    1202                                 int xPos = title.getX() + 25;
    1203                                 int yPos = title.getY() + title.getBoundsHeight()
    1204                                                 + itemTemplate.getBoundsHeight();
     1201                                //Item itemTemplate = current.getItemTemplate();
     1202                                int xPos = title.getX() + FrameCreator.INDENT_FROM_TITLE;
     1203                                int yPos = FrameCreator.getYStart(title);
    12051204                                // Check for @start on the zero frame
    12061205                                Frame zero = FrameIO.LoadFrame(current.getFramesetName() + '0');
     
    12811280                                                DisplayIO.setCursorPosition(DisplayIO.getMouseX(),
    12821281                                                                FrameMouseActions.getY());
    1283                                                 return;
     1282                                                return false;
    12841283                                        }
    12851284                                }
     
    13171316                        // MessageBay.errorMessage(e.getMessage());
    13181317                        e.printStackTrace();
    1319                 }
     1318                        return false;
     1319                }
     1320                return true;
    13201321        }
    13211322
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r282 r284  
    25592559
    25602560        public static void pickup(Collection<Item> toGrab) {
     2561                if(toGrab == null || toGrab.size() == 0)
     2562                        return;
     2563               
    25612564                boolean bReparse = false;
    25622565                Frame frame = DisplayIO.getCurrentFrame();
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r282 r284  
    580580                        else if (attribute.equals("mailsettings"))
    581581                                MailSession.init(item.getChild());
     582                        else if (attribute.equals("reminders"))
     583                                Reminders.init(item.getChild());
    582584                        else if (attribute.equals("antialias"))
    583585                                UserSettings.AntiAlias = avp.getBooleanValue();
  • trunk/src/org/expeditee/gui/MessageBay.java

    r247 r284  
    250250        }
    251251
    252         private static void displayMessage(String message, String link,
     252        private static Text displayMessage(String message, String link,
    253253                        List<String> actions, Color color) {
    254                 displayMessage(message, link, actions, color, true);
    255         }
    256 
    257         private static void displayMessage(String message, String link,
     254                return displayMessage(message, link, actions, color, true);
     255        }
     256       
     257        public static Text displayMessage(String message, String link,
     258                 Color color, boolean displayAlways, String action) {
     259                List<String> actions = new LinkedList<String>();
     260                actions.add(action);
     261                return displayMessage(message, link, actions, color, displayAlways);
     262        }
     263
     264        public static Text displayMessage(String message, String link,
    258265                        List<String> actions, Color color, boolean displayAlways) {
    259266
     
    265272
    266273                if (_supressMessages)
    267                         return;
     274                        return null;
    268275
    269276                if (!displayAlways && message.equals(_lastMessage)) {
    270277                        Misc.beep();
    271                         return;
     278                        return null;
    272279                }
    273280                _lastMessage = message;
     
    301308                                        if (g != null)
    302309                                                refresh(false, g, Item.DEFAULT_BACKGROUND);
    303                                         return;
     310                                        return _messages[i];
    304311                                }
    305312
     
    329336
    330337                refresh(false, FrameGraphics.createGraphics(), Item.DEFAULT_BACKGROUND);
     338               
     339                return last;
    331340        }
    332341
     
    363372         *            the message to be displayed
    364373         */
    365         public static void linkedErrorMessage(String message) {
     374        public static Text linkedErrorMessage(String message) {
    366375                if (_supressMessages)
    367                         return;
     376                        return null;
    368377                Misc.beep();
    369378                String[] tokens = message.split(Text.FRAME_NAME_SEPARATOR);
     
    371380                if (tokens.length > 1)
    372381                        link = tokens[tokens.length - 1];
    373                 displayMessage(message, link, null, ERROR_COLOR);
    374         }
    375 
    376         public static void errorMessage(String message) {
     382                return displayMessage(message, link, null, ERROR_COLOR);
     383        }
     384
     385        public static Text errorMessage(String message) {
    377386                if (_supressMessages)
    378                         return;
     387                        return null;
    379388                Misc.beep();
    380                 displayMessage(message, null, null, ERROR_COLOR, false);
     389                return displayMessage(message, null, null, ERROR_COLOR, false);
    381390        }
    382391
     
    388397         *            The message to display to the user in the message area
    389398         */
    390         public static void displayMessage(String message) {
    391                 displayMessageAlways(message);
    392         }
    393 
    394         public static void displayMessageOnce(String message) {
    395                 displayMessage(message, null, null, Color.BLACK, false);
    396         }
    397 
    398         public static void displayMessage(String message, Color textColor) {
    399                 displayMessage(message, null, null, textColor);
     399        public static Text displayMessage(String message) {
     400                return displayMessageAlways(message);
     401        }
     402
     403        public static Text displayMessageOnce(String message) {
     404                return displayMessage(message, null, null, Color.BLACK, false);
     405        }
     406
     407        public static Text displayMessage(String message, Color textColor) {
     408                return displayMessage(message, null, null, textColor);
    400409                // Misc.Beep();
    401410        }
    402411
    403         public static void displayMessage(Text message) {
    404                 displayMessage(message.getFirstLine(), message.getLink(), message
     412        public static Text displayMessage(Text message) {
     413                return displayMessage(message.getFirstLine(), message.getLink(), message
    405414                                .getAction(), message.getColor());
    406415                // Misc.Beep();
    407416        }
    408417
    409         public static void displayMessageAlways(String message) {
    410                 displayMessage(message, null, null, Color.BLACK);
     418        public static Text displayMessageAlways(String message) {
     419                return displayMessage(message, null, null, Color.BLACK);
    411420                // Misc.Beep();
    412421        }
    413422
    414         public static void warningMessage(String message) {
    415                 displayMessage(message, null, null, Color.MAGENTA);
     423        public static Text warningMessage(String message) {
     424                return displayMessage(message, null, null, Color.MAGENTA);
    416425                // Misc.Beep();
    417426        }
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r226 r284  
    213213
    214214                for (Item i : getItemsToWrite(toWrite)) {
    215                         if (_stop)
     215                        if (_stop){
    216216                                return;
     217                        }
    217218                        writeItem(i);
    218219                }
  • trunk/src/org/expeditee/io/DefaultFramesetWriter.java

    r282 r284  
    3333                }
    3434        }
     35       
     36        @Override
     37        protected String finaliseFrame() throws IOException {
     38                return "Frameset" + finalise();
     39        }
    3540}
  • trunk/src/org/expeditee/items/Item.java

    r282 r284  
    11001100                                if (returnValue instanceof Item) {
    11011101                                        Misc.attachToCursor(((Item) returnValue).getAllConnected());
     1102                                } else if (returnValue instanceof Collection) {
     1103                                        try {
     1104                                                Misc.attachToCursor((Collection) returnValue);
     1105                                        } catch (Exception e) {
     1106                                                e.printStackTrace();
     1107                                        }
    11021108                                } else {
    11031109                                        Misc.attachStatsToCursor(returnValue.toString());
     
    15461552                                for (Item i : getAllConnected()) {
    15471553                                        if (i instanceof Line) {
    1548                                                 ((Line)i).invalidateCommonTrait(trait);
     1554                                                ((Line) i).invalidateCommonTrait(trait);
    15491555                                        }
    15501556                                }
     
    16701676                        line.updatePolygon();
    16711677                }
    1672                
    1673 //              for (Item item : getAllConnected()) {
    1674 //                      item.updatePolygon();
    1675 //              }
     1678
     1679                // for (Item item : getAllConnected()) {
     1680                // item.updatePolygon();
     1681                // }
    16761682
    16771683                invalidateCommonTraitForAll(ItemAppearence.PostMoved);
  • trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java

    r247 r284  
    205205         * @throws ParseException
    206206         */
    207         private Date parseDate(String dateString) throws ParseException {
     207        public static Date parseDate(String dateString) throws ParseException {
    208208                // Convert the attribute into a date
    209209                DateFormat df = null;
Note: See TracChangeset for help on using the changeset viewer.