From 611518a0ff65fd05e517d44adbcec639570b86eb Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Thu, 21 Feb 2019 23:44:07 -0500 Subject: [PATCH] Yellow theme. --- ObjEditor.java | 9 + timeflow/format/field/FieldFormatCatalog.java | 89 +++++++++-------- timeflow/data/db/BasicDB.java | 2 GrafreeD.java | 5 timeflow/app/ui/AddFieldPanel.java | 29 +++-- Constants.java | 23 ++++ timeflow/data/db/Schema.java | 7 + timeflow/vis/timeline/AxisRenderer.java | 18 ++- timeflow/data/time/TimeUnit.java | 4 timeflow/model/Display.java | 2 CameraPane.java | 56 +++++----- timeflow/data/db/ArrayDB.java | 2 timeflow/vis/timeline/TimelineVisuals.java | 2 timeflow/vis/timeline/TimelineTrack.java | 1 timeflow/vis/timeline/AxisTicMarks.java | 3 timeflow/views/TimelineView.java | 5 timeflow/format/field/DateTimeGuesser.java | 2 17 files changed, 153 insertions(+), 106 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index a5a5ed5..b5fba83 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -173,6 +173,34 @@ theRenderer = this; } + CameraPane(Object3D o, Camera cam, boolean withcontext) + { + super(defaultcaps, null, withcontext?glcontext:null, null); + + //System.out.println("AMERICA AREA = " + (9458886 + 9210755 + 8480395 + 2736391 + 1943018 + 1289475 + 1141569 + 1069350 + 911559 + 721229 + 395886 + 377972 + 246700 + 211156 + 173985 + 141133 + 118279 + 112079 + 108523)); + glcontext = getContext(); + + cameras = new Camera[2]; + targetLookAts = new cVector[2]; + + SetCamera(cam); + + SetLight(new Camera(new cVector(10, 10, -20))); + + object = o; + + setBackground(Color.white); + + addKeyListener(this); + addMouseListener(this); + addMouseMotionListener(this); + addMouseWheelListener(this); + //System.out.println("addGLEventListener: " + this); + addGLEventListener(this); + +// pingthread.start(); // may 2013 + } + static boolean AntialiasingEnabled() { return CURRENTANTIALIAS > 0; @@ -672,34 +700,6 @@ //assert (cam.hAspect == 0); cam.hAspect = 0; lightCamera = cam; - } - - CameraPane(Object3D o, Camera cam, boolean withcontext) - { - super(defaultcaps, null, withcontext?glcontext:null, null); - - //System.out.println("AMERICA AREA = " + (9458886 + 9210755 + 8480395 + 2736391 + 1943018 + 1289475 + 1141569 + 1069350 + 911559 + 721229 + 395886 + 377972 + 246700 + 211156 + 173985 + 141133 + 118279 + 112079 + 108523)); - glcontext = getContext(); - - cameras = new Camera[2]; - targetLookAts = new cVector[2]; - - SetCamera(cam); - - SetLight(new Camera(new cVector(10, 10, -20))); - - object = o; - - setBackground(Color.white); - - addKeyListener(this); - addMouseListener(this); - addMouseMotionListener(this); - addMouseWheelListener(this); - //System.out.println("addGLEventListener: " + this); - addGLEventListener(this); - -// pingthread.start(); // may 2013 } private static void ApplyTransform(GL gl, Mat4f xform) diff --git a/Constants.java b/Constants.java index 105a701..5904c06 100644 --- a/Constants.java +++ b/Constants.java @@ -7,7 +7,6 @@ public interface Constants { - //public static final double pi = math.PI; //public static final double radian = 0.01745329; public static final String EOL = System.getProperty("line.separator"); @@ -15,6 +14,7 @@ public static final String imageTypes[] = { "gif", "tga", "iff", "ppm", "pgm", "png", "jpeg", "tiff", "sys", "jpg" }; + public static final int beigeTheme[][] = { { 104, 95, 90 @@ -34,5 +34,24 @@ 255, 255, 255 } }; - + public static final int yellowTheme[][] = { + { + 104, 95, 90 + }, { + 164, 150, 145 // + }, { + 204, 190, 185 + }, { + 111, 111, 111 + }, { + 163, 159, 159 + }, { + //240, 226, 200 // + 240, 226, 200 // + }, { + 0, 0, 0 + }, { + 255, 255, 255 + } + }; } diff --git a/GrafreeD.java b/GrafreeD.java index ac56d92..ada5f76 100644 --- a/GrafreeD.java +++ b/GrafreeD.java @@ -742,8 +742,11 @@ try { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); - //MetalLookAndFeel.setCurrentTheme(new Theme(Constants.beigeTheme)); + MetalLookAndFeel.setCurrentTheme(new Theme(Constants.yellowTheme)); UIManager.setLookAndFeel(new MetalLookAndFeel()); + //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); + //UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); + //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (Exception e) { } diff --git a/ObjEditor.java b/ObjEditor.java index 751955c..25a20ef 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -31,6 +31,9 @@ boolean timeline; boolean wasFullScreen; + GroupEditor callee; + JFrame frame; + // SCRIPT transient JFrame textpanel = null; @@ -127,8 +130,7 @@ static GridBagConstraints aConstraints; static GridBagConstraints aWindowConstraints; - GroupEditor callee; - JFrame frame; + static int GRIDWIDTH = 100; // 4; public void closeUI() @@ -1369,7 +1371,8 @@ //worldPane.add(bigPanel); //worldPane.add(worldPanel); /**/ - frame.getContentPane().add(/*"Center",*/framePanel); + //frame.getContentPane().add(/*"Center",*/framePanel); + frame.add(/*"Center",*/framePanel); //frame.getContentPane().add(/*"Center",*/ worldPane); // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); diff --git a/timeflow/app/ui/AddFieldPanel.java b/timeflow/app/ui/AddFieldPanel.java index fc0d4df..3cbcd26 100755 --- a/timeflow/app/ui/AddFieldPanel.java +++ b/timeflow/app/ui/AddFieldPanel.java @@ -7,18 +7,21 @@ import java.awt.*; import java.awt.event.*; +public class AddFieldPanel extends JPanel +{ + public JTextField name = new JTextField(12); + public JComboBox typeChoices = new JComboBox(); -public class AddFieldPanel extends JPanel { - public JTextField name=new JTextField(12); - public JComboBox typeChoices=new JComboBox(); - public AddFieldPanel() - { - for (String choice: FieldFormatCatalog.classNames()) - typeChoices.addItem(choice); - setLayout(new GridLayout(2,2)); - add(new JLabel("Field Name")); - add(name); - add(new JLabel("Field Type")); - add(typeChoices); - } + public AddFieldPanel() + { + for (String choice : FieldFormatCatalog.classNames()) + { + typeChoices.addItem(choice); + } + setLayout(new GridLayout(2, 2)); + add(new JLabel("Field Name")); + add(name); + add(new JLabel("Field Type")); + add(typeChoices); + } } diff --git a/timeflow/data/db/ArrayDB.java b/timeflow/data/db/ArrayDB.java index b8b570a..6a52a38 100755 --- a/timeflow/data/db/ArrayDB.java +++ b/timeflow/data/db/ArrayDB.java @@ -43,7 +43,7 @@ public ArrayDB(String[] fieldNames, Class[] types, String source) { - this.schema = new Schema(); + this.schema = new Schema(false); this.source = source; int n = fieldNames.length; fields = new Field[n]; diff --git a/timeflow/data/db/BasicDB.java b/timeflow/data/db/BasicDB.java index bcd3ba2..905c443 100755 --- a/timeflow/data/db/BasicDB.java +++ b/timeflow/data/db/BasicDB.java @@ -29,7 +29,7 @@ public BasicDB(String source) { - this(new Schema(), source); + this(new Schema(true), source); } public BasicDB(Schema schema, String source) diff --git a/timeflow/data/db/Schema.java b/timeflow/data/db/Schema.java index 9fdcc87..386f2ff 100755 --- a/timeflow/data/db/Schema.java +++ b/timeflow/data/db/Schema.java @@ -1,4 +1,5 @@ package timeflow.data.db; +import timeflow.data.time.RoughTime; import java.util.*; @@ -6,6 +7,12 @@ public class Schema implements Iterable<Field> { + public Schema(boolean withDateField) + { + add(new Field("Time", RoughTime.class, 0)); + add(new Field("Name", String.class, 0)); + } + private Map<String, Field> schema = new HashMap<String, Field>(); private List<Field> fieldList = new ArrayList<Field>(); // so we preserve field order. diff --git a/timeflow/data/time/TimeUnit.java b/timeflow/data/time/TimeUnit.java index 0eb149f..070b0fa 100755 --- a/timeflow/data/time/TimeUnit.java +++ b/timeflow/data/time/TimeUnit.java @@ -13,7 +13,7 @@ public static final TimeUnit HOUR = new TimeUnit("Hours", Calendar.HOUR_OF_DAY, 60 * 60 * 1000L, "HH:mm", "MMM d yyyy HH:mm"); public static final TimeUnit MINUTE = new TimeUnit("Minutes", Calendar.MINUTE, 60 * 1000L, ":mm", "MMM d yyyy HH:mm"); public static final TimeUnit SECOND = new TimeUnit("Seconds", Calendar.SECOND, 1000L, ":ss", "MMM d yyyy HH:mm:ss"); - public static final TimeUnit REALTIME = new TimeUnit("Realtime", Calendar.MILLISECOND, 1L, ":SS", "HH:mm:ss.SS"); + public static final TimeUnit REALTIME = new TimeUnit("Realtime", Calendar.MILLISECOND, 1L, ".SS", "HH:mm:ss.SS"); public static final TimeUnit DECADE = multipleYears(10); public static final TimeUnit CENTURY = multipleYears(100); @@ -238,7 +238,7 @@ public String format(Date date) { - return format.format(date); + return format.format(date); } public String formatFull(Date date) diff --git a/timeflow/format/field/DateTimeGuesser.java b/timeflow/format/field/DateTimeGuesser.java index 3ec965c..60886f7 100755 --- a/timeflow/format/field/DateTimeGuesser.java +++ b/timeflow/format/field/DateTimeGuesser.java @@ -49,7 +49,7 @@ // parsers.add(new DateTimeParser("MMM/dd/yyyy HH:mm", TimeUnit.SECOND)); // parsers.add(new DateTimeParser("MM/dd/yy HH:mm", TimeUnit.SECOND)); // parsers.add(new DateTimeParser("MMM dd yyyy HH:mm:ss", TimeUnit.SECOND)); - parsers.add(new DateTimeParser("HH:mm:ss:SS", TimeUnit.REALTIME)); + parsers.add(new DateTimeParser("HH:mm:ss.SS", TimeUnit.REALTIME)); // parsers.add(new DateTimeParser("MM/dd/yyyy HH:mm:ss", TimeUnit.SECOND)); // parsers.add(new DateTimeParser("MMM dd yyyy HH:mm:ss zzzzzzzz", TimeUnit.SECOND)); // parsers.add(new DateTimeParser("EEE MMM dd HH:mm:ss zzzzzzzz yyyy", TimeUnit.SECOND)); diff --git a/timeflow/format/field/FieldFormatCatalog.java b/timeflow/format/field/FieldFormatCatalog.java index d65092c..be5112b 100755 --- a/timeflow/format/field/FieldFormatCatalog.java +++ b/timeflow/format/field/FieldFormatCatalog.java @@ -6,49 +6,56 @@ import java.net.URL; import java.util.*; -public class FieldFormatCatalog { +public class FieldFormatCatalog +{ + private static Map<String, FieldFormat> formatTable = new HashMap<String, FieldFormat>(); + private static Map<Class, FieldFormat> classTable = new HashMap<Class, FieldFormat>(); - private static Map<String, FieldFormat> formatTable=new HashMap<String, FieldFormat>(); - private static Map<Class, FieldFormat> classTable=new HashMap<Class, FieldFormat>(); + static + { + for (FieldFormat f : listFormats()) + { + formatTable.put(f.getHumanName(), f); + classTable.put(f.getType(), f); + } + } - static - { - for (FieldFormat f: listFormats()) - { - formatTable.put(f.getHumanName(), f); - classTable.put(f.getType(), f); - } - } - - static FieldFormat[] listFormats() - { - return new FieldFormat[] {new FormatDateTime(), new FormatString(), - new FormatStringArray(), new FormatDouble(), new FormatURL()}; - } - - public static Iterable<String> classNames() - { - return formatTable.keySet(); - } - - public static String humanName(Class c){ - return getFormat(c).getHumanName(); - } - + static FieldFormat[] listFormats() + { + return new FieldFormat[] + { + new FormatDateTime(), new FormatString(), + new FormatStringArray(), new FormatDouble(), new FormatURL() + }; + } - public static FieldFormat getFormat(Class c) { - FieldFormat f= classTable.get(c); - if (f==null) - System.out.println("Warning: no FieldFormat for "+c); - return f; - } + public static Iterable<String> classNames() + { + return formatTable.keySet(); + } - - public static Class javaClass(String humanName) - { - Class c=formatTable.get(humanName).getType(); - if (c==null) - System.out.println("Warning: no class for "+humanName); - return c; - } + public static String humanName(Class c) + { + return getFormat(c).getHumanName(); + } + + public static FieldFormat getFormat(Class c) + { + FieldFormat f = classTable.get(c); + if (f == null) + { + System.out.println("Warning: no FieldFormat for " + c); + } + return f; + } + + public static Class javaClass(String humanName) + { + Class c = formatTable.get(humanName).getType(); + if (c == null) + { + System.out.println("Warning: no class for " + humanName); + } + return c; + } } diff --git a/timeflow/model/Display.java b/timeflow/model/Display.java index 47c3481..69c0fff 100755 --- a/timeflow/model/Display.java +++ b/timeflow/model/Display.java @@ -87,7 +87,7 @@ colors.put("timeline.unspecified.color", new Color(0, 53, 153)); colors.put("highlight.color", new Color(0, 53, 153)); - ints.put("timeline.datelabel.height", 20); + ints.put("timeline.datelabel.height", 10); ints.put("timeline.item.height.min", 16); } diff --git a/timeflow/views/TimelineView.java b/timeflow/views/TimelineView.java index 2e22fb6..983c2b6 100755 --- a/timeflow/views/TimelineView.java +++ b/timeflow/views/TimelineView.java @@ -5,6 +5,7 @@ import timeflow.data.db.DBUtils; import timeflow.data.time.*; import timeflow.model.*; + //import timeflow.views.CalendarView.CalendarPanel; //import timeflow.views.CalendarView.ScrollingCalendar; import timeflow.vis.Mouseover; @@ -40,6 +41,7 @@ public TimelineView(TimeflowModel model) { super(model); + visuals = new TimelineVisuals(model); grid = new AxisRenderer(visuals); timeline = new TimelineRenderer(visuals); @@ -55,13 +57,13 @@ TimelineSlider slider = new TimelineSlider(visuals, 24 * 60 * 60 * 1000L, new Runnable() { - @Override public void run() { redraw(); } }); + bottom.add(slider, BorderLayout.CENTER); controls = new JPanel(); @@ -70,6 +72,7 @@ // top part of grid: zoom buttons. ComponentCluster buttons = new ComponentCluster("Zoom"); + //ImageIcon zoomOutIcon = new ImageIcon("images/zoom_out.gif"); JButton zoomIn = new JButton("In 1/2X"); buttons.addContent(zoomIn); diff --git a/timeflow/vis/timeline/AxisRenderer.java b/timeflow/vis/timeline/AxisRenderer.java index 68bc5fe..7c16246 100755 --- a/timeflow/vis/timeline/AxisRenderer.java +++ b/timeflow/vis/timeline/AxisRenderer.java @@ -57,19 +57,23 @@ g.setColor(t.unit.isDayOrLess() && (dayOfWeek == 1 || dayOfWeek == 7) ? new Color(245, 245, 245) : new Color(240, 240, 240)); - g.fillRect(x0, y, x1 - x0 - 1, h); + g.fillRect(x0, y, x1 - x0, h); g.setColor(Color.white); - g.drawLine(x1 - 1, y, x1 - 1, y + h); + g.drawLine(x1, y, x1, y + h); g.drawLine(x0, y + h, x1, y + h); - objectLocations.add(new Mouseover(new Interval(start, end), x0, y, x1 - x0 - 1, h)); + objectLocations.add(new Mouseover(new Interval(start, end), x0, y, x1 - x0, h)); g.setFont(model.getDisplay().timeLabel()); String label = full ? t.unit.formatFull(start) : t.unit.format(new Date(start)); - int tx = x0 + 3; - int ty = y + h - 5; + + if (!full) + full = false; + + int tx = x0; + int ty = y + h; g.setColor(full ? Color.darkGray : Color.gray); int sw = model.getDisplay().timeLabelFontMetrics().stringWidth(label); - if (sw < x1 - tx - 3) + if (true) // sw < x1 - tx) { g.drawString(label, tx, ty); } else @@ -79,7 +83,7 @@ { label = label.substring(0, c); sw = model.getDisplay().timeLabelFontMetrics().stringWidth(label); - if (sw < x1 - tx - 3) + //if (sw < x1 - tx) { g.drawString(label, tx, ty); } diff --git a/timeflow/vis/timeline/AxisTicMarks.java b/timeflow/vis/timeline/AxisTicMarks.java index 2a88ab8..8c786e4 100755 --- a/timeflow/vis/timeline/AxisTicMarks.java +++ b/timeflow/vis/timeline/AxisTicMarks.java @@ -44,7 +44,7 @@ public static List<AxisTicMarks> allRelevant(long start, long end) { - return allRelevant(start, end, 40); + return allRelevant(start, end, 4000); } public static AxisTicMarks histoTics(long start, long end) @@ -68,7 +68,6 @@ public static List<AxisTicMarks> allRelevant(long start, long end, long maxTics) { List<AxisTicMarks> list = new ArrayList<AxisTicMarks>(); - for (int i = 0; i < units.length; i++) { diff --git a/timeflow/vis/timeline/TimelineTrack.java b/timeflow/vis/timeline/TimelineTrack.java index e86c2f4..156e8a3 100755 --- a/timeflow/vis/timeline/TimelineTrack.java +++ b/timeflow/vis/timeline/TimelineTrack.java @@ -8,7 +8,6 @@ public class TimelineTrack implements Comparable { - String label; List<VisualAct> visualActs = new ArrayList<VisualAct>(); int y0, y1; diff --git a/timeflow/vis/timeline/TimelineVisuals.java b/timeflow/vis/timeline/TimelineVisuals.java index f19c09d..3aa2dc6 100755 --- a/timeflow/vis/timeline/TimelineVisuals.java +++ b/timeflow/vis/timeline/TimelineVisuals.java @@ -15,9 +15,9 @@ */ public class TimelineVisuals { - private Map<String, TimelineTrack> trackTable = new HashMap<String, TimelineTrack>(); ArrayList<TimelineTrack> trackList = new ArrayList<TimelineTrack>(); + private TimeScale timeScale = new TimeScale(); private Rectangle bounds = new Rectangle(); private boolean frameChanged; -- Gitblit v1.6.2