Normand Briere
2019-02-22 611518a0ff65fd05e517d44adbcec639570b86eb
Yellow theme.
17 files modified
259 ■■■■■ changed files
CameraPane.java 56 ●●●● patch | view | raw | blame | history
Constants.java 23 ●●●●● patch | view | raw | blame | history
GrafreeD.java 5 ●●●● patch | view | raw | blame | history
ObjEditor.java 9 ●●●●● patch | view | raw | blame | history
timeflow/app/ui/AddFieldPanel.java 29 ●●●●● patch | view | raw | blame | history
timeflow/data/db/ArrayDB.java 2 ●●● patch | view | raw | blame | history
timeflow/data/db/BasicDB.java 2 ●●● patch | view | raw | blame | history
timeflow/data/db/Schema.java 7 ●●●●● patch | view | raw | blame | history
timeflow/data/time/TimeUnit.java 4 ●●●● patch | view | raw | blame | history
timeflow/format/field/DateTimeGuesser.java 2 ●●● patch | view | raw | blame | history
timeflow/format/field/FieldFormatCatalog.java 89 ●●●● patch | view | raw | blame | history
timeflow/model/Display.java 2 ●●● patch | view | raw | blame | history
timeflow/views/TimelineView.java 5 ●●●● patch | view | raw | blame | history
timeflow/vis/timeline/AxisRenderer.java 18 ●●●●● patch | view | raw | blame | history
timeflow/vis/timeline/AxisTicMarks.java 3 ●●●● patch | view | raw | blame | history
timeflow/vis/timeline/TimelineTrack.java 1 ●●●● patch | view | raw | blame | history
timeflow/vis/timeline/TimelineVisuals.java 2 ●●● patch | view | raw | blame | history
CameraPane.java
....@@ -173,6 +173,34 @@
173173 theRenderer = this;
174174 }
175175
176
+ CameraPane(Object3D o, Camera cam, boolean withcontext)
177
+ {
178
+ super(defaultcaps, null, withcontext?glcontext:null, null);
179
+
180
+ //System.out.println("AMERICA AREA = " + (9458886 + 9210755 + 8480395 + 2736391 + 1943018 + 1289475 + 1141569 + 1069350 + 911559 + 721229 + 395886 + 377972 + 246700 + 211156 + 173985 + 141133 + 118279 + 112079 + 108523));
181
+ glcontext = getContext();
182
+
183
+ cameras = new Camera[2];
184
+ targetLookAts = new cVector[2];
185
+
186
+ SetCamera(cam);
187
+
188
+ SetLight(new Camera(new cVector(10, 10, -20)));
189
+
190
+ object = o;
191
+
192
+ setBackground(Color.white);
193
+
194
+ addKeyListener(this);
195
+ addMouseListener(this);
196
+ addMouseMotionListener(this);
197
+ addMouseWheelListener(this);
198
+ //System.out.println("addGLEventListener: " + this);
199
+ addGLEventListener(this);
200
+
201
+// pingthread.start(); // may 2013
202
+ }
203
+
176204 static boolean AntialiasingEnabled()
177205 {
178206 return CURRENTANTIALIAS > 0;
....@@ -672,34 +700,6 @@
672700 //assert (cam.hAspect == 0);
673701 cam.hAspect = 0;
674702 lightCamera = cam;
675
- }
676
-
677
- CameraPane(Object3D o, Camera cam, boolean withcontext)
678
- {
679
- super(defaultcaps, null, withcontext?glcontext:null, null);
680
-
681
- //System.out.println("AMERICA AREA = " + (9458886 + 9210755 + 8480395 + 2736391 + 1943018 + 1289475 + 1141569 + 1069350 + 911559 + 721229 + 395886 + 377972 + 246700 + 211156 + 173985 + 141133 + 118279 + 112079 + 108523));
682
- glcontext = getContext();
683
-
684
- cameras = new Camera[2];
685
- targetLookAts = new cVector[2];
686
-
687
- SetCamera(cam);
688
-
689
- SetLight(new Camera(new cVector(10, 10, -20)));
690
-
691
- object = o;
692
-
693
- setBackground(Color.white);
694
-
695
- addKeyListener(this);
696
- addMouseListener(this);
697
- addMouseMotionListener(this);
698
- addMouseWheelListener(this);
699
- //System.out.println("addGLEventListener: " + this);
700
- addGLEventListener(this);
701
-
702
-// pingthread.start(); // may 2013
703703 }
704704
705705 private static void ApplyTransform(GL gl, Mat4f xform)
Constants.java
....@@ -7,7 +7,6 @@
77
88 public interface Constants
99 {
10
-
1110 //public static final double pi = math.PI;
1211 //public static final double radian = 0.01745329;
1312 public static final String EOL = System.getProperty("line.separator");
....@@ -15,6 +14,7 @@
1514 public static final String imageTypes[] = {
1615 "gif", "tga", "iff", "ppm", "pgm", "png", "jpeg", "tiff", "sys", "jpg"
1716 };
17
+
1818 public static final int beigeTheme[][] = {
1919 {
2020 104, 95, 90
....@@ -34,5 +34,24 @@
3434 255, 255, 255
3535 }
3636 };
37
-
37
+ public static final int yellowTheme[][] = {
38
+ {
39
+ 104, 95, 90
40
+ }, {
41
+ 164, 150, 145 //
42
+ }, {
43
+ 204, 190, 185
44
+ }, {
45
+ 111, 111, 111
46
+ }, {
47
+ 163, 159, 159
48
+ }, {
49
+ //240, 226, 200 //
50
+ 240, 226, 200 //
51
+ }, {
52
+ 0, 0, 0
53
+ }, {
54
+ 255, 255, 255
55
+ }
56
+ };
3857 }
GrafreeD.java
....@@ -742,8 +742,11 @@
742742 try
743743 {
744744 MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
745
- //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme));
745
+ MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme));
746746 UIManager.setLookAndFeel(new MetalLookAndFeel());
747
+ //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
748
+ //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
749
+ //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
747750 } catch (Exception e)
748751 {
749752 }
ObjEditor.java
....@@ -31,6 +31,9 @@
3131 boolean timeline;
3232 boolean wasFullScreen;
3333
34
+ GroupEditor callee;
35
+ JFrame frame;
36
+
3437 // SCRIPT
3538
3639 transient JFrame textpanel = null;
....@@ -127,8 +130,7 @@
127130
128131 static GridBagConstraints aConstraints;
129132 static GridBagConstraints aWindowConstraints;
130
- GroupEditor callee;
131
- JFrame frame;
133
+
132134 static int GRIDWIDTH = 100; // 4;
133135
134136 public void closeUI()
....@@ -1369,7 +1371,8 @@
13691371 //worldPane.add(bigPanel);
13701372 //worldPane.add(worldPanel);
13711373 /**/
1372
- frame.getContentPane().add(/*"Center",*/framePanel);
1374
+ //frame.getContentPane().add(/*"Center",*/framePanel);
1375
+ frame.add(/*"Center",*/framePanel);
13731376 //frame.getContentPane().add(/*"Center",*/ worldPane);
13741377
13751378 // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc);
timeflow/app/ui/AddFieldPanel.java
....@@ -7,18 +7,21 @@
77 import java.awt.*;
88 import java.awt.event.*;
99
10
+public class AddFieldPanel extends JPanel
11
+{
12
+ public JTextField name = new JTextField(12);
13
+ public JComboBox typeChoices = new JComboBox();
1014
11
-public class AddFieldPanel extends JPanel {
12
- public JTextField name=new JTextField(12);
13
- public JComboBox typeChoices=new JComboBox();
14
- public AddFieldPanel()
15
- {
16
- for (String choice: FieldFormatCatalog.classNames())
17
- typeChoices.addItem(choice);
18
- setLayout(new GridLayout(2,2));
19
- add(new JLabel("Field Name"));
20
- add(name);
21
- add(new JLabel("Field Type"));
22
- add(typeChoices);
23
- }
15
+ public AddFieldPanel()
16
+ {
17
+ for (String choice : FieldFormatCatalog.classNames())
18
+ {
19
+ typeChoices.addItem(choice);
20
+ }
21
+ setLayout(new GridLayout(2, 2));
22
+ add(new JLabel("Field Name"));
23
+ add(name);
24
+ add(new JLabel("Field Type"));
25
+ add(typeChoices);
26
+ }
2427 }
timeflow/data/db/ArrayDB.java
....@@ -43,7 +43,7 @@
4343
4444 public ArrayDB(String[] fieldNames, Class[] types, String source)
4545 {
46
- this.schema = new Schema();
46
+ this.schema = new Schema(false);
4747 this.source = source;
4848 int n = fieldNames.length;
4949 fields = new Field[n];
timeflow/data/db/BasicDB.java
....@@ -29,7 +29,7 @@
2929
3030 public BasicDB(String source)
3131 {
32
- this(new Schema(), source);
32
+ this(new Schema(true), source);
3333 }
3434
3535 public BasicDB(Schema schema, String source)
timeflow/data/db/Schema.java
....@@ -1,4 +1,5 @@
11 package timeflow.data.db;
2
+import timeflow.data.time.RoughTime;
23
34 import java.util.*;
45
....@@ -6,6 +7,12 @@
67 public class Schema implements Iterable<Field>
78 {
89
10
+ public Schema(boolean withDateField)
11
+ {
12
+ add(new Field("Time", RoughTime.class, 0));
13
+ add(new Field("Name", String.class, 0));
14
+ }
15
+
916 private Map<String, Field> schema = new HashMap<String, Field>();
1017 private List<Field> fieldList = new ArrayList<Field>(); // so we preserve field order.
1118
timeflow/data/time/TimeUnit.java
....@@ -13,7 +13,7 @@
1313 public static final TimeUnit HOUR = new TimeUnit("Hours", Calendar.HOUR_OF_DAY, 60 * 60 * 1000L, "HH:mm", "MMM d yyyy HH:mm");
1414 public static final TimeUnit MINUTE = new TimeUnit("Minutes", Calendar.MINUTE, 60 * 1000L, ":mm", "MMM d yyyy HH:mm");
1515 public static final TimeUnit SECOND = new TimeUnit("Seconds", Calendar.SECOND, 1000L, ":ss", "MMM d yyyy HH:mm:ss");
16
- public static final TimeUnit REALTIME = new TimeUnit("Realtime", Calendar.MILLISECOND, 1L, ":SS", "HH:mm:ss.SS");
16
+ public static final TimeUnit REALTIME = new TimeUnit("Realtime", Calendar.MILLISECOND, 1L, ".SS", "HH:mm:ss.SS");
1717
1818 public static final TimeUnit DECADE = multipleYears(10);
1919 public static final TimeUnit CENTURY = multipleYears(100);
....@@ -238,7 +238,7 @@
238238
239239 public String format(Date date)
240240 {
241
- return format.format(date);
241
+ return format.format(date);
242242 }
243243
244244 public String formatFull(Date date)
timeflow/format/field/DateTimeGuesser.java
....@@ -49,7 +49,7 @@
4949 // parsers.add(new DateTimeParser("MMM/dd/yyyy HH:mm", TimeUnit.SECOND));
5050 // parsers.add(new DateTimeParser("MM/dd/yy HH:mm", TimeUnit.SECOND));
5151 // parsers.add(new DateTimeParser("MMM dd yyyy HH:mm:ss", TimeUnit.SECOND));
52
- parsers.add(new DateTimeParser("HH:mm:ss:SS", TimeUnit.REALTIME));
52
+ parsers.add(new DateTimeParser("HH:mm:ss.SS", TimeUnit.REALTIME));
5353 // parsers.add(new DateTimeParser("MM/dd/yyyy HH:mm:ss", TimeUnit.SECOND));
5454 // parsers.add(new DateTimeParser("MMM dd yyyy HH:mm:ss zzzzzzzz", TimeUnit.SECOND));
5555 // parsers.add(new DateTimeParser("EEE MMM dd HH:mm:ss zzzzzzzz yyyy", TimeUnit.SECOND));
timeflow/format/field/FieldFormatCatalog.java
....@@ -6,49 +6,56 @@
66 import java.net.URL;
77 import java.util.*;
88
9
-public class FieldFormatCatalog {
9
+public class FieldFormatCatalog
10
+{
11
+ private static Map<String, FieldFormat> formatTable = new HashMap<String, FieldFormat>();
12
+ private static Map<Class, FieldFormat> classTable = new HashMap<Class, FieldFormat>();
1013
11
- private static Map<String, FieldFormat> formatTable=new HashMap<String, FieldFormat>();
12
- private static Map<Class, FieldFormat> classTable=new HashMap<Class, FieldFormat>();
14
+ static
15
+ {
16
+ for (FieldFormat f : listFormats())
17
+ {
18
+ formatTable.put(f.getHumanName(), f);
19
+ classTable.put(f.getType(), f);
20
+ }
21
+ }
1322
14
- static
15
- {
16
- for (FieldFormat f: listFormats())
17
- {
18
- formatTable.put(f.getHumanName(), f);
19
- classTable.put(f.getType(), f);
20
- }
21
- }
22
-
23
- static FieldFormat[] listFormats()
24
- {
25
- return new FieldFormat[] {new FormatDateTime(), new FormatString(),
26
- new FormatStringArray(), new FormatDouble(), new FormatURL()};
27
- }
28
-
29
- public static Iterable<String> classNames()
30
- {
31
- return formatTable.keySet();
32
- }
33
-
34
- public static String humanName(Class c){
35
- return getFormat(c).getHumanName();
36
- }
37
-
23
+ static FieldFormat[] listFormats()
24
+ {
25
+ return new FieldFormat[]
26
+ {
27
+ new FormatDateTime(), new FormatString(),
28
+ new FormatStringArray(), new FormatDouble(), new FormatURL()
29
+ };
30
+ }
3831
39
- public static FieldFormat getFormat(Class c) {
40
- FieldFormat f= classTable.get(c);
41
- if (f==null)
42
- System.out.println("Warning: no FieldFormat for "+c);
43
- return f;
44
- }
32
+ public static Iterable<String> classNames()
33
+ {
34
+ return formatTable.keySet();
35
+ }
4536
46
-
47
- public static Class javaClass(String humanName)
48
- {
49
- Class c=formatTable.get(humanName).getType();
50
- if (c==null)
51
- System.out.println("Warning: no class for "+humanName);
52
- return c;
53
- }
37
+ public static String humanName(Class c)
38
+ {
39
+ return getFormat(c).getHumanName();
40
+ }
41
+
42
+ public static FieldFormat getFormat(Class c)
43
+ {
44
+ FieldFormat f = classTable.get(c);
45
+ if (f == null)
46
+ {
47
+ System.out.println("Warning: no FieldFormat for " + c);
48
+ }
49
+ return f;
50
+ }
51
+
52
+ public static Class javaClass(String humanName)
53
+ {
54
+ Class c = formatTable.get(humanName).getType();
55
+ if (c == null)
56
+ {
57
+ System.out.println("Warning: no class for " + humanName);
58
+ }
59
+ return c;
60
+ }
5461 }
timeflow/model/Display.java
....@@ -87,7 +87,7 @@
8787 colors.put("timeline.unspecified.color", new Color(0, 53, 153));
8888 colors.put("highlight.color", new Color(0, 53, 153));
8989
90
- ints.put("timeline.datelabel.height", 20);
90
+ ints.put("timeline.datelabel.height", 10);
9191 ints.put("timeline.item.height.min", 16);
9292 }
9393
timeflow/views/TimelineView.java
....@@ -5,6 +5,7 @@
55 import timeflow.data.db.DBUtils;
66 import timeflow.data.time.*;
77 import timeflow.model.*;
8
+
89 //import timeflow.views.CalendarView.CalendarPanel;
910 //import timeflow.views.CalendarView.ScrollingCalendar;
1011 import timeflow.vis.Mouseover;
....@@ -40,6 +41,7 @@
4041 public TimelineView(TimeflowModel model)
4142 {
4243 super(model);
44
+
4345 visuals = new TimelineVisuals(model);
4446 grid = new AxisRenderer(visuals);
4547 timeline = new TimelineRenderer(visuals);
....@@ -55,13 +57,13 @@
5557
5658 TimelineSlider slider = new TimelineSlider(visuals, 24 * 60 * 60 * 1000L, new Runnable()
5759 {
58
-
5960 @Override
6061 public void run()
6162 {
6263 redraw();
6364 }
6465 });
66
+
6567 bottom.add(slider, BorderLayout.CENTER);
6668
6769 controls = new JPanel();
....@@ -70,6 +72,7 @@
7072
7173 // top part of grid: zoom buttons.
7274 ComponentCluster buttons = new ComponentCluster("Zoom");
75
+
7376 //ImageIcon zoomOutIcon = new ImageIcon("images/zoom_out.gif");
7477 JButton zoomIn = new JButton("In 1/2X");
7578 buttons.addContent(zoomIn);
timeflow/vis/timeline/AxisRenderer.java
....@@ -57,19 +57,23 @@
5757 g.setColor(t.unit.isDayOrLess() && (dayOfWeek == 1 || dayOfWeek == 7)
5858 ? new Color(245, 245, 245) : new Color(240, 240, 240));
5959
60
- g.fillRect(x0, y, x1 - x0 - 1, h);
60
+ g.fillRect(x0, y, x1 - x0, h);
6161 g.setColor(Color.white);
62
- g.drawLine(x1 - 1, y, x1 - 1, y + h);
62
+ g.drawLine(x1, y, x1, y + h);
6363 g.drawLine(x0, y + h, x1, y + h);
64
- objectLocations.add(new Mouseover(new Interval(start, end), x0, y, x1 - x0 - 1, h));
64
+ objectLocations.add(new Mouseover(new Interval(start, end), x0, y, x1 - x0, h));
6565
6666 g.setFont(model.getDisplay().timeLabel());
6767 String label = full ? t.unit.formatFull(start) : t.unit.format(new Date(start));
68
- int tx = x0 + 3;
69
- int ty = y + h - 5;
68
+
69
+ if (!full)
70
+ full = false;
71
+
72
+ int tx = x0;
73
+ int ty = y + h;
7074 g.setColor(full ? Color.darkGray : Color.gray);
7175 int sw = model.getDisplay().timeLabelFontMetrics().stringWidth(label);
72
- if (sw < x1 - tx - 3)
76
+ if (true) // sw < x1 - tx)
7377 {
7478 g.drawString(label, tx, ty);
7579 } else
....@@ -79,7 +83,7 @@
7983 {
8084 label = label.substring(0, c);
8185 sw = model.getDisplay().timeLabelFontMetrics().stringWidth(label);
82
- if (sw < x1 - tx - 3)
86
+ //if (sw < x1 - tx)
8387 {
8488 g.drawString(label, tx, ty);
8589 }
timeflow/vis/timeline/AxisTicMarks.java
....@@ -44,7 +44,7 @@
4444
4545 public static List<AxisTicMarks> allRelevant(long start, long end)
4646 {
47
- return allRelevant(start, end, 40);
47
+ return allRelevant(start, end, 4000);
4848 }
4949
5050 public static AxisTicMarks histoTics(long start, long end)
....@@ -68,7 +68,6 @@
6868 public static List<AxisTicMarks> allRelevant(long start, long end, long maxTics)
6969 {
7070 List<AxisTicMarks> list = new ArrayList<AxisTicMarks>();
71
-
7271
7372 for (int i = 0; i < units.length; i++)
7473 {
timeflow/vis/timeline/TimelineTrack.java
....@@ -8,7 +8,6 @@
88
99 public class TimelineTrack implements Comparable
1010 {
11
-
1211 String label;
1312 List<VisualAct> visualActs = new ArrayList<VisualAct>();
1413 int y0, y1;
timeflow/vis/timeline/TimelineVisuals.java
....@@ -15,9 +15,9 @@
1515 */
1616 public class TimelineVisuals
1717 {
18
-
1918 private Map<String, TimelineTrack> trackTable = new HashMap<String, TimelineTrack>();
2019 ArrayList<TimelineTrack> trackList = new ArrayList<TimelineTrack>();
20
+
2121 private TimeScale timeScale = new TimeScale();
2222 private Rectangle bounds = new Rectangle();
2323 private boolean frameChanged;