Ignore:
Timestamp:
05/10/18 16:04:51 (6 years ago)
Author:
davidb
Message:

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java

    r919 r1102  
    1919package org.expeditee.items.widgets.charts;
    2020
    21 import java.awt.Color;
    2221import java.text.DateFormat;
    2322import java.text.ParseException;
     
    2726import java.util.Date;
    2827
     28import org.expeditee.Util;
     29import org.expeditee.core.Colour;
     30import org.expeditee.gio.swing.SwingConversions;
    2931import org.expeditee.gui.AttributeValuePair;
    3032import org.expeditee.gui.Frame;
     
    100102                        String startDateString = dataFrame.getAnnotationValue("start");
    101103                        if (startDateString != null) {
    102                                 _startDate = parseDate(startDateString);
     104                                _startDate = Util.parseDate(startDateString);
    103105                        }
    104106                } catch (Exception e) {
     
    135137
    136138                boolean foundData = false;
    137                 Color newColor = null;
     139                Colour newColor = null;
    138140                for (Text i : items) {
    139141                        if (!i.isLineEnd()) {
     
    157159                                                RegularTimePeriod rtp = null;
    158160                                                if (attribute == null) {
    159                                                         Date date = parseDate(avp.getAttribute());
     161                                                        Date date = Util.parseDate(avp.getAttribute());
    160162                                                        rtp = _periodType.getConstructor(
    161163                                                                        new Class[] { Date.class }).newInstance(
     
    212214                if (foundData) {
    213215                        _data.addSeries(newSeries);
    214                         _paints.put(categoryName, newColor);
     216                        _paints.put(categoryName, SwingConversions.toSwingColor(newColor));
    215217                }
    216218                return foundData;
    217219        }
    218 
    219         /**
    220          * @param avp
    221          * @return
    222          * @throws ParseException
    223          */
    224         public static Date parseDate(String dateString) throws ParseException {
    225                 // Select the best match for a date or time format
    226                 DateFormat df = null;
    227                 if (dateString.length() > Formatter.DATE_FORMAT
    228                                 .length()) {
    229                         df = new SimpleDateFormat(Formatter.DATE_TIME_FORMAT);
    230                 } else if (dateString.length() <= Formatter.TIME_FORMAT.length()) {
    231                         df = new SimpleDateFormat(Formatter.TIME_FORMAT);
    232                 }else {
    233                         df = new SimpleDateFormat(Formatter.DATE_FORMAT);
    234                 }
    235                 Date date = df.parse(dateString);
    236                 return date;
    237         }
    238220}
Note: See TracChangeset for help on using the changeset viewer.