- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/charts/TimeSeries.java
r919 r1102 19 19 package org.expeditee.items.widgets.charts; 20 20 21 import java.awt.Color;22 21 import java.text.DateFormat; 23 22 import java.text.ParseException; … … 27 26 import java.util.Date; 28 27 28 import org.expeditee.Util; 29 import org.expeditee.core.Colour; 30 import org.expeditee.gio.swing.SwingConversions; 29 31 import org.expeditee.gui.AttributeValuePair; 30 32 import org.expeditee.gui.Frame; … … 100 102 String startDateString = dataFrame.getAnnotationValue("start"); 101 103 if (startDateString != null) { 102 _startDate = parseDate(startDateString);104 _startDate = Util.parseDate(startDateString); 103 105 } 104 106 } catch (Exception e) { … … 135 137 136 138 boolean foundData = false; 137 Colo r newColor = null;139 Colour newColor = null; 138 140 for (Text i : items) { 139 141 if (!i.isLineEnd()) { … … 157 159 RegularTimePeriod rtp = null; 158 160 if (attribute == null) { 159 Date date = parseDate(avp.getAttribute());161 Date date = Util.parseDate(avp.getAttribute()); 160 162 rtp = _periodType.getConstructor( 161 163 new Class[] { Date.class }).newInstance( … … 212 214 if (foundData) { 213 215 _data.addSeries(newSeries); 214 _paints.put(categoryName, newColor);216 _paints.put(categoryName, SwingConversions.toSwingColor(newColor)); 215 217 } 216 218 return foundData; 217 219 } 218 219 /**220 * @param avp221 * @return222 * @throws ParseException223 */224 public static Date parseDate(String dateString) throws ParseException {225 // Select the best match for a date or time format226 DateFormat df = null;227 if (dateString.length() > Formatter.DATE_FORMAT228 .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 }238 220 }
Note:
See TracChangeset
for help on using the changeset viewer.