From 86f4e9c75951153ae9825f4772633e45698cb602 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 16 Dec 2018 21:21:43 -0500 Subject: [PATCH] Timeflow clean-up. --- ObjEditor.java | 13 timeflow/app/ui/ColorLegendPanel.java | 2 timeflow/app/ui/EditValuePanel.java | 1 timeflow/vis/VisualActFactory.java | 4 timeflow/app/ui/MassDeletePanel.java | 4 timeflow/model/TFListener.java | 5 timeflow/views/AbstractVisualizationView.java | 6 timeflow/app/TimeflowApp.java | 8 timeflow/views/TableView.java | 2 timeflow/app/actions/TimeflowAction.java | 2 timeflow/model/TimeflowModel.java | 3 timeflow/app/ui/filter/FilterCategoryPanel.java | 314 +++++---- timeflow/app/ui/ComponentCluster.java | 6 timeflow/app/ui/StatusPanel.java | 2 timeflow/views/ListView.java | 2 timeflow/views/SummaryView.java | 2 timeflow/app/actions/DeleteFieldAction.java | 2 timeflow/app/actions/DeleteSelectedAction.java | 77 +- timeflow/format/file/HtmlFormat.java | 8 timeflow/format/file/Export.java | 2 timeflow/app/ui/filter/SearchPanel.java | 2 timeflow/data/db/ActDB.java | 9 timeflow/data/time/TimeUnit.java | 9 timeflow/format/file/TimeflowFormat.java | 301 +++++---- timeflow/data/time/RoughTime.java | 250 ++++---- timeflow/app/ui/SizeLegendPanel.java | 4 timeflow/views/TimelineView.java | 10 timeflow/app/ui/ReorderFieldsPanel.java | 4 timeflow/app/ui/DateFieldPanel.java | 6 timeflow/model/ModelPanel.java | 6 timeflow/views/BarGraphView.java | 6 timeflow/app/ui/filter/FilterDatePanel.java | 310 +++++----- timeflow/vis/calendar/CalendarVisuals.java | 4 timeflow/app/actions/NewDataAction.java | 26 timeflow/vis/timeline/AxisRenderer.java | 4 timeflow/data/db/Field.java | 89 +- timeflow/app/actions/AddRecordAction.java | 23 timeflow/vis/timeline/TimelineVisuals.java | 8 timeflow/views/CalendarView.java | 4 timeflow/vis/timeline/TimelineRenderer.java | 2 timeflow/views/AbstractView.java | 4 timeflow/app/actions/AddFieldAction.java | 2 timeflow/app/ui/GlobalDisplayPanel.java | 11 timeflow/views/IntroView.java | 2 timeflow/vis/VisualEncoder.java | 4 timeflow/model/Display.java | 2 timeflow/views/DescriptionView.java | 2 timeflow/app/ui/ImportDelimitedPanel.java | 6 timeflow/app/ui/EditRecordPanel.java | 14 timeflow/app/ui/filter/FilterControlPanel.java | 2 timeflow/app/actions/QuitAction.java | 2 timeflow/app/actions/EditSourceAction.java | 2 timeflow/format/field/FieldFormat.java | 112 ++- 53 files changed, 902 insertions(+), 805 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index f7c8293..751955c 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -1189,6 +1189,13 @@ timelinePanel = new JPanel(new BorderLayout()); timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); + cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); + cameraPanel.setContinuousLayout(true); + cameraPanel.setOneTouchExpandable(true); +// cameraPanel.setDividerLocation(0.9); +// cameraPanel.setDividerSize(9); + cameraPanel.setResizeWeight(1.0); + centralPanel.add(cameraView); //frame.setJMenuBar(timelineMenubar); //centralPanel.add(timelinePanel); @@ -2996,7 +3003,8 @@ if (timeline) { centralPanel.remove(cameraView); - centralPanel.add(timelinePanel); + cameraPanel.add(cameraView); + centralPanel.add(cameraPanel); frame.setJMenuBar(timelineMenubar); wasFullScreen = CameraPane.FULLSCREEN; if (!CameraPane.FULLSCREEN) @@ -3005,7 +3013,7 @@ } else { - centralPanel.remove(timelinePanel); + centralPanel.remove(cameraPanel); centralPanel.add(cameraView); frame.setJMenuBar(null); if (!wasFullScreen) @@ -4533,6 +4541,7 @@ JPanel bigThree; JTabbedPane scenePanel; JPanel centralPanel; + JSplitPane cameraPanel; JPanel timelinePanel; JMenuBar timelineMenubar; JSplitPane framePanel; diff --git a/timeflow/app/TimeflowApp.java b/timeflow/app/TimeflowApp.java index c579393..a057ddb 100755 --- a/timeflow/app/TimeflowApp.java +++ b/timeflow/app/TimeflowApp.java @@ -25,7 +25,7 @@ public class TimeflowApp extends JFrame { - public TFModel model = new TFModel(); + public TimeflowModel model = new TimeflowModel(); public JFileChooser fileChooser; AboutWindow splash; String[][] examples; @@ -84,6 +84,7 @@ examples[i][0] = s; examples[i][1] = "settings/examples/" + ex[i]; } + templates = getVisibleFiles("settings/templates"); fileChooser = new JFileChooser(state.getCurrentFile()); @@ -180,7 +181,9 @@ JMenu fileMenu = new JMenu("File"); menubar.add(fileMenu); - fileMenu.add(new NewDataAction(this)); + TimeflowAction tlAction = new NewDataAction(this); + fileMenu.add(tlAction); + tlAction.actionPerformed(null); fileMenu.add(new CopySchemaAction(this)); JMenu templateMenu = new JMenu("New From Template"); @@ -202,7 +205,6 @@ } fileMenu.addSeparator(); - JMenuItem open = new JMenuItem("Open..."); fileMenu.add(open); diff --git a/timeflow/app/actions/AddFieldAction.java b/timeflow/app/actions/AddFieldAction.java index 5af658e..2469434 100755 --- a/timeflow/app/actions/AddFieldAction.java +++ b/timeflow/app/actions/AddFieldAction.java @@ -32,7 +32,7 @@ if (n==1) { String fieldName=p.name.getText(); - TFModel model=getModel(); + TimeflowModel model=getModel(); if (fieldName.trim().length()==0) app.showUserError("Field names can't be all spaces!"); else if (model.getDB().getField(fieldName)!=null) diff --git a/timeflow/app/actions/AddRecordAction.java b/timeflow/app/actions/AddRecordAction.java index c295e6b..b5251e7 100755 --- a/timeflow/app/actions/AddRecordAction.java +++ b/timeflow/app/actions/AddRecordAction.java @@ -11,16 +11,17 @@ import javax.swing.*; import java.util.*; -public class AddRecordAction extends TimeflowAction { +public class AddRecordAction extends TimeflowAction +{ + public AddRecordAction(TimeflowApp app) + { + super(app, "Add Record...", null, "Add a record to this database"); + accelerate('A'); + } - public AddRecordAction(TimeflowApp app) - { - super(app, "Add Record...", null, "Add a record to this database"); - accelerate('A'); - } - - @Override - public void actionPerformed(ActionEvent e) { - EditRecordPanel.add(getModel()); - } + @Override + public void actionPerformed(ActionEvent e) + { + EditRecordPanel.add(getModel()); + } } diff --git a/timeflow/app/actions/DeleteFieldAction.java b/timeflow/app/actions/DeleteFieldAction.java index c7e60cc..604f66b 100755 --- a/timeflow/app/actions/DeleteFieldAction.java +++ b/timeflow/app/actions/DeleteFieldAction.java @@ -33,7 +33,7 @@ if (fieldToDelete!=null) { - TFModel model=getModel(); + TimeflowModel model=getModel(); Field f=model.getDB().getField(fieldToDelete); model.getDB().deleteField(f); model.noteSchemaChange(this); diff --git a/timeflow/app/actions/DeleteSelectedAction.java b/timeflow/app/actions/DeleteSelectedAction.java index 824ac9b..bec172f 100755 --- a/timeflow/app/actions/DeleteSelectedAction.java +++ b/timeflow/app/actions/DeleteSelectedAction.java @@ -9,43 +9,48 @@ import javax.swing.*; import java.util.*; +public class DeleteSelectedAction extends TimeflowAction +{ -public class DeleteSelectedAction extends TimeflowAction { + public DeleteSelectedAction(TimeflowApp app) + { + super(app, "Delete Selected Items...", null, "Delete the currently visible events"); + } - public DeleteSelectedAction(TimeflowApp app) - { - super(app, "Delete Selected Items...", null, "Delete the currently visible events"); - } - - @Override - public void actionPerformed(ActionEvent e) { - - HashSet<Act> keepers=new HashSet<Act>(); // switching between sets and lists - keepers.addAll(getModel().getDB().all()); // for efficiency. maybe silly? - ActList selected=getModel().getActs(); - for (Act a: selected) - keepers.remove(a); - ActList keepList=new ActList(getModel().getDB()); - keepList.addAll(keepers); - - MassDeletePanel panel=new MassDeletePanel(getModel(), keepList, - "Delete all selected items."); - Object[] options = {"Cancel", "Proceed"}; - int n = JOptionPane.showOptionDialog(app, - panel, - "Delete Selected", - JOptionPane.YES_NO_CANCEL_OPTION, - JOptionPane.PLAIN_MESSAGE, - null, - options, - "Proceed"); - panel.detachFromModel(); - if (n==1) - { - panel.applyAction(); - app.clearFilters(); - getModel().noteSchemaChange(this); - } - } + @Override + public void actionPerformed(ActionEvent e) + { + HashSet<Act> keepers = new HashSet<Act>(); // switching between sets and lists + keepers.addAll(getModel().getDB().all()); // for efficiency. maybe silly? + ActList selected = getModel().getActs(); + for (Act a : selected) + { + keepers.remove(a); + } + ActList keepList = new ActList(getModel().getDB()); + keepList.addAll(keepers); + + MassDeletePanel panel = new MassDeletePanel(getModel(), keepList, + "Delete all selected items."); + Object[] options = + { + "Cancel", "Proceed" + }; + int n = JOptionPane.showOptionDialog(app, + panel, + "Delete Selected", + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.PLAIN_MESSAGE, + null, + options, + "Proceed"); + panel.detachFromModel(); + if (n == 1) + { + panel.applyAction(); + app.clearFilters(); + getModel().noteSchemaChange(this); + } + } } diff --git a/timeflow/app/actions/EditSourceAction.java b/timeflow/app/actions/EditSourceAction.java index eec0280..655c3fe 100755 --- a/timeflow/app/actions/EditSourceAction.java +++ b/timeflow/app/actions/EditSourceAction.java @@ -17,7 +17,7 @@ @Override public void actionPerformed(ActionEvent e) { - TFModel model=getModel(); + TimeflowModel model=getModel(); String source = (String)JOptionPane.showInputDialog( app, null, diff --git a/timeflow/app/actions/NewDataAction.java b/timeflow/app/actions/NewDataAction.java index 357fb60..71fa9ec 100755 --- a/timeflow/app/actions/NewDataAction.java +++ b/timeflow/app/actions/NewDataAction.java @@ -10,18 +10,20 @@ import javax.swing.*; import java.util.*; -public class NewDataAction extends TimeflowAction { +public class NewDataAction extends TimeflowAction +{ + public NewDataAction(TimeflowApp app) + { + super(app, "New", null, "Create a new, blank database"); + accelerate('N'); - public NewDataAction(TimeflowApp app) - { - super(app, "New", null, "Create a new, blank database"); - accelerate('N'); + } - } - - public void actionPerformed(ActionEvent e) - { - if (app.checkSaveStatus()) - getModel().setDB(new BasicDB("Unspecified"), "[new data]", true, this); - } + public void actionPerformed(ActionEvent e) + { + if (app.checkSaveStatus()) + { + getModel().setDB(new BasicDB("Unspecified"), "[new data]", true, this); + } + } } diff --git a/timeflow/app/actions/QuitAction.java b/timeflow/app/actions/QuitAction.java index bdd6726..7264bd1 100755 --- a/timeflow/app/actions/QuitAction.java +++ b/timeflow/app/actions/QuitAction.java @@ -12,7 +12,7 @@ public class QuitAction extends TimeflowAction { - public QuitAction(TimeflowApp app, TFModel model) + public QuitAction(TimeflowApp app, TimeflowModel model) { super(app, "Quit", null, "Quit the program"); } diff --git a/timeflow/app/actions/TimeflowAction.java b/timeflow/app/actions/TimeflowAction.java index aae5d23..217afbd 100755 --- a/timeflow/app/actions/TimeflowAction.java +++ b/timeflow/app/actions/TimeflowAction.java @@ -27,7 +27,7 @@ } - protected TFModel getModel() + protected TimeflowModel getModel() { return app.model; } diff --git a/timeflow/app/ui/ColorLegendPanel.java b/timeflow/app/ui/ColorLegendPanel.java index e8552a0..2ce67de 100755 --- a/timeflow/app/ui/ColorLegendPanel.java +++ b/timeflow/app/ui/ColorLegendPanel.java @@ -20,7 +20,7 @@ Field oldColor; - public ColorLegendPanel(TFModel model) + public ColorLegendPanel(TimeflowModel model) { super(model); setBackground(Color.white); diff --git a/timeflow/app/ui/ComponentCluster.java b/timeflow/app/ui/ComponentCluster.java index d32b3b6..057f2dd 100755 --- a/timeflow/app/ui/ComponentCluster.java +++ b/timeflow/app/ui/ComponentCluster.java @@ -8,7 +8,7 @@ int numComps=0; int x1=80; int width=200; - int compH=30; + int compH=20; DottedLine line=new DottedLine(); public ComponentCluster(String name) @@ -25,9 +25,9 @@ { add(c); c.setBorder(null); - c.setBounds(x1,10+numComps*compH, c.getPreferredSize().width, c.getPreferredSize().height); + c.setBounds(x1,numComps*compH, c.getPreferredSize().width, c.getPreferredSize().height); numComps++; - line.setBounds(x1-10,10,1,numComps*compH-5); + line.setBounds(x1-10,10,0,numComps*compH); } public Dimension getPreferredSize() diff --git a/timeflow/app/ui/DateFieldPanel.java b/timeflow/app/ui/DateFieldPanel.java index f36e1f3..4480b1c 100755 --- a/timeflow/app/ui/DateFieldPanel.java +++ b/timeflow/app/ui/DateFieldPanel.java @@ -15,7 +15,7 @@ public class DateFieldPanel extends JPanel { - TFModel model; + TimeflowModel model; int numRows; HashMap<String, Integer> numBad=new HashMap<String, Integer>(); private static String[] mappable={VirtualField.START, VirtualField.END}; @@ -23,7 +23,7 @@ FieldMap[] panels=new FieldMap[mappable.length]; JButton submit, cancel; - public DateFieldPanel(TFModel model, boolean hasButtons) + public DateFieldPanel(TimeflowModel model, boolean hasButtons) { this.model=model; @@ -154,7 +154,7 @@ return new Dimension(400,80+mappable.length*25); } - public static void popWindow(TFModel model) + public static void popWindow(TimeflowModel model) { final JFrame window=new JFrame("Date Fields"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/timeflow/app/ui/EditRecordPanel.java b/timeflow/app/ui/EditRecordPanel.java index 08d7aec..bdde65b 100755 --- a/timeflow/app/ui/EditRecordPanel.java +++ b/timeflow/app/ui/EditRecordPanel.java @@ -20,12 +20,12 @@ HashMap<Field, EditValuePanel> fieldUI = new HashMap<Field, EditValuePanel>(); JButton submit, cancel; Dimension idealSize = new Dimension(); - TFModel model; + TimeflowModel model; - private static void edit(final TFModel model, final Act act, final boolean isAdd) + private static void edit(final TimeflowModel model, final Act act, final boolean isAdd) { final JFrame window = new JFrame(isAdd ? "Add Record" : "Edit Record"); - window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + //window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); final EditRecordPanel editor = new EditRecordPanel(model, act); window.getContentPane().setLayout(new GridLayout(1, 1)); window.getContentPane().add(editor); @@ -58,25 +58,25 @@ window.setVisible(true); } - public static void edit(TFModel model, Act act) + public static void edit(TimeflowModel model, Act act) { edit(model, act, false); } - public static void add(TFModel model) + public static void add(TimeflowModel model) { Act act = model.getDB().createAct(); edit(model, act, true); } - public static void add(TFModel model, RoughTime r) + public static void add(TimeflowModel model, RoughTime r) { Act act = model.getDB().createAct(); act.set(act.getDB().getField(VirtualField.START), r); edit(model, act, true); } - public EditRecordPanel(TFModel model, Act act) + public EditRecordPanel(TimeflowModel model, Act act) { this.model = model; this.act = act; diff --git a/timeflow/app/ui/EditValuePanel.java b/timeflow/app/ui/EditValuePanel.java index 2f148d8..a6798f3 100755 --- a/timeflow/app/ui/EditValuePanel.java +++ b/timeflow/app/ui/EditValuePanel.java @@ -10,7 +10,6 @@ public class EditValuePanel extends JPanel { - FieldFormat parser; boolean longField; JLabel feedback = new JLabel() diff --git a/timeflow/app/ui/GlobalDisplayPanel.java b/timeflow/app/ui/GlobalDisplayPanel.java index 59f4c8a..8f4e6c5 100755 --- a/timeflow/app/ui/GlobalDisplayPanel.java +++ b/timeflow/app/ui/GlobalDisplayPanel.java @@ -21,7 +21,7 @@ JPanel globalControls = new JPanel(); CardLayout localCards = new CardLayout(); - public GlobalDisplayPanel(TFModel model, FilterControlPanel filterControls) + public GlobalDisplayPanel(TimeflowModel model, FilterControlPanel filterControls) { super(model); setBackground(Color.white); @@ -56,12 +56,12 @@ }; label.setBackground(Color.lightGray); label.setForeground(Color.darkGray); - globalLabel.add(label, BorderLayout.CENTER); + //globalLabel.add(label, BorderLayout.CENTER); p.add(globalLabel, BorderLayout.NORTH); JPanel global = new JPanel(); global.setLayout(new BorderLayout()); - global.add(new StatusPanel(model, filterControls), BorderLayout.NORTH); + //global.add(new StatusPanel(model, filterControls), BorderLayout.NORTH); encodings.setLayout(new GridLayout(4, 1)); encodings.setBackground(Color.white); @@ -74,12 +74,13 @@ public void showLocalControl(String name) { - localCards.show(localControls, name); + //localCards.show(localControls, name); } public void addLocalControl(String name, JComponent control) { - localControls.add(control, name); + if (name.equals("Timeline")) + localControls.add(control, name); } void makeEncodingPanel() diff --git a/timeflow/app/ui/ImportDelimitedPanel.java b/timeflow/app/ui/ImportDelimitedPanel.java index c626219..b05eb0f 100755 --- a/timeflow/app/ui/ImportDelimitedPanel.java +++ b/timeflow/app/ui/ImportDelimitedPanel.java @@ -24,7 +24,7 @@ SchemaPanel schemaPanel; boolean exitOnClose=false; // for testing! JScrollPane scroller; - TFModel model; + TimeflowModel model; JLabel numLinesLabel=new JLabel(); // for testing: @@ -33,7 +33,7 @@ System.out.println("Starting test of ImportEditor"); String file="data/probate.tsv"; String[][] data=DelimitedFormat.readArrayGuessDelim(file, System.out); - ImportDelimitedPanel editor=new ImportDelimitedPanel(new TFModel()); + ImportDelimitedPanel editor=new ImportDelimitedPanel(new TimeflowModel()); editor.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); editor.setFileName(file); editor.setData(data); @@ -42,7 +42,7 @@ editor.exitOnClose=true; } - public ImportDelimitedPanel(final TFModel model) + public ImportDelimitedPanel(final TimeflowModel model) { super("Import File"); this.model=model; diff --git a/timeflow/app/ui/MassDeletePanel.java b/timeflow/app/ui/MassDeletePanel.java index 10acc13..b4cedd4 100755 --- a/timeflow/app/ui/MassDeletePanel.java +++ b/timeflow/app/ui/MassDeletePanel.java @@ -15,7 +15,7 @@ TableView table; ActList keepers; - public MassDeletePanel(TFModel model, ActList keepers, String title) + public MassDeletePanel(TimeflowModel model, ActList keepers, String title) { super(model); this.keepers=keepers; @@ -61,7 +61,7 @@ public void detachFromModel() { - TFModel model=getModel(); + TimeflowModel model=getModel(); model.removeListener(table); model.removeListener(this); } diff --git a/timeflow/app/ui/ReorderFieldsPanel.java b/timeflow/app/ui/ReorderFieldsPanel.java index 1db474d..3aebe64 100755 --- a/timeflow/app/ui/ReorderFieldsPanel.java +++ b/timeflow/app/ui/ReorderFieldsPanel.java @@ -14,7 +14,7 @@ { TableView table; - public ReorderFieldsPanel(TFModel model) + public ReorderFieldsPanel(TimeflowModel model) { super(model); setLayout(new BorderLayout()); @@ -49,7 +49,7 @@ public void detachFromModel() { - TFModel model=getModel(); + TimeflowModel model=getModel(); model.removeListener(table); model.removeListener(this); } diff --git a/timeflow/app/ui/SizeLegendPanel.java b/timeflow/app/ui/SizeLegendPanel.java index a689d4a..d5ffde7 100755 --- a/timeflow/app/ui/SizeLegendPanel.java +++ b/timeflow/app/ui/SizeLegendPanel.java @@ -13,7 +13,7 @@ Field sizeField; double min, max; - public SizeLegendPanel(TFModel model) + public SizeLegendPanel(TimeflowModel model) { super(model); setBackground(Color.white); @@ -44,7 +44,7 @@ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int w=getSize().width; int h=getSize().height; - TFModel model=getModel(); + TimeflowModel model=getModel(); Display display=model.getDisplay(); g.setColor(getBackground()); g.setFont(display.plain()); diff --git a/timeflow/app/ui/StatusPanel.java b/timeflow/app/ui/StatusPanel.java index 0cdf2fb..ae41848 100755 --- a/timeflow/app/ui/StatusPanel.java +++ b/timeflow/app/ui/StatusPanel.java @@ -30,7 +30,7 @@ static final DecimalFormat niceFormat=new DecimalFormat("###,###"); - public StatusPanel(TFModel model, final FilterControlPanel filterControls) { + public StatusPanel(TimeflowModel model, final FilterControlPanel filterControls) { super(model); setLayout(new BorderLayout()); setBackground(new Color(245, 245, 245)); diff --git a/timeflow/app/ui/filter/FilterCategoryPanel.java b/timeflow/app/ui/filter/FilterCategoryPanel.java index 9207469..6728292 100755 --- a/timeflow/app/ui/filter/FilterCategoryPanel.java +++ b/timeflow/app/ui/filter/FilterCategoryPanel.java @@ -11,154 +11,180 @@ import java.awt.*; import java.awt.event.*; -public class FilterCategoryPanel extends FilterDefinitionPanel +public class FilterCategoryPanel extends FilterDefinitionPanel { - public JList dataList=new JList(); - Field field; - - public FilterCategoryPanel(final Field field, final ModelPanel parent) - { - this(field.getName(), field, parent); - } - - public FilterCategoryPanel(String title, final Field field, final ModelPanel parent) - { - this.field=field; - setLayout(new BorderLayout()); - setBackground(Color.white); - setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); - add(new FilterTitle(title, field, parent, true), BorderLayout.NORTH); - - - JScrollPane scroller=new JScrollPane(dataList); - scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scroller.setBorder(null); - add(scroller, BorderLayout.CENTER); - dataList.setForeground(Color.darkGray); - dataList.setSelectionForeground(Color.black); - dataList.setSelectionBackground(new Color(220,235,255)); - dataList.setFont(parent.getModel().getDisplay().small()); - scroller.getVerticalScrollBar().setBackground(Color.white); - - - // ok, the following is ugly code to insert a new mouselistener - // that lets the user deselect items when they are clicked. - // i tried a bunch of stuff but this is all that would work-- - // and searching the web yielded only solutions similar to this. - // also, there's a weird dance with consuming/not consuming events - // that is designed to allow a certain kind of multi-selection behavior - // with the mouse, while letting you scroll through items one at a time - // with the keyboard. this was the product of a long series of - // conversations with target users. - MouseListener[] old = dataList.getMouseListeners(); - for (MouseListener m: old) - dataList.removeMouseListener(m); - - dataList.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - if (e.isControlDown() || e.isMetaDown() || e.isShiftDown()) - return; - final int index = dataList.locationToIndex(e.getPoint()); - if (dataList.isSelectedIndex(index)) - { - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - dataList.removeSelectionInterval(index, index); - - } - }); - e.consume(); - } - else - { - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - dataList.addSelectionInterval(index, index); - - } - }); - e.consume(); - } - } - }); + public JList dataList = new JList(); + Field field; - for (MouseListener m: old) - dataList.addMouseListener(m); - - dataList.setCellRenderer(new DefaultListCellRenderer() { - @Override - public Component getListCellRendererComponent(JList list, - Object value, int index, boolean isSelected, - boolean cellHasFocus) { - Component c=super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (field==parent.getModel().getColorField()) - { - String text=value.toString(); - int n=text.lastIndexOf('-'); - if (n>1) - text=text.substring(0,n-1); - c.setForeground(parent.getModel().getDisplay().makeColor(text)); - } - return c; - }}); - - } + public FilterCategoryPanel(final Field field, final ModelPanel parent) + { + this(field.getName(), field, parent); + } - public void setData(Bag<String> data) - { - dataList.removeAll(); - java.util.List<String> items=data.list(); - String[] s=(String[])items.toArray(new String[0]); - for (int i=0; i<s.length; i++) - { - int num=data.num(s[i]); - if (s[i]==null || s[i].length()==0) - s[i]="(missing)"; - s[i]+=" - "+num; - } - dataList.setListData(s); - } - - public Dimension getPreferredSize() - { - return new Dimension(200,200); - } + public FilterCategoryPanel(String title, final Field field, final ModelPanel parent) + { + this.field = field; + setLayout(new BorderLayout()); + setBackground(Color.white); + setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); - @Override - public ActFilter defineFilter() { - Object[] o=dataList.getSelectedValues(); - if (o==null || o.length==0) - return null; - - int n=o.length; - String[] s=new String[n]; - for (int i=0; i<n; i++) - { - String w=(String)o[i]; - int m=w.lastIndexOf('-'); - s[i]=w.substring(0, m-1); - if ("(missing)".equals(s[i])) - s[i]=""; - } - - if (s.length==1) - return new FieldValueFilter(field, s[0]); - FieldValueSetFilter f=new FieldValueSetFilter(field); - for (int i=0; i<s.length; i++) - f.addValue(s[i]); - return f; - } + add(new FilterTitle(title, field, parent, true), BorderLayout.NORTH); - @Override - public void clearFilter() { - dataList.clearSelection(); - } - + + JScrollPane scroller = new JScrollPane(dataList); + scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scroller.setBorder(null); + add(scroller, BorderLayout.CENTER); + dataList.setForeground(Color.darkGray); + dataList.setSelectionForeground(Color.black); + dataList.setSelectionBackground(new Color(220, 235, 255)); + dataList.setFont(parent.getModel().getDisplay().small()); + scroller.getVerticalScrollBar().setBackground(Color.white); + + + // ok, the following is ugly code to insert a new mouselistener + // that lets the user deselect items when they are clicked. + // i tried a bunch of stuff but this is all that would work-- + // and searching the web yielded only solutions similar to this. + // also, there's a weird dance with consuming/not consuming events + // that is designed to allow a certain kind of multi-selection behavior + // with the mouse, while letting you scroll through items one at a time + // with the keyboard. this was the product of a long series of + // conversations with target users. + MouseListener[] old = dataList.getMouseListeners(); + for (MouseListener m : old) + { + dataList.removeMouseListener(m); + } + + dataList.addMouseListener(new MouseAdapter() + { + + public void mousePressed(MouseEvent e) + { + if (e.isControlDown() || e.isMetaDown() || e.isShiftDown()) + { + return; + } + final int index = dataList.locationToIndex(e.getPoint()); + if (dataList.isSelectedIndex(index)) + { + SwingUtilities.invokeLater(new Runnable() + { + + public void run() + { + dataList.removeSelectionInterval(index, index); + + } + }); + e.consume(); + } else + { + SwingUtilities.invokeLater(new Runnable() + { + + public void run() + { + dataList.addSelectionInterval(index, index); + + } + }); + e.consume(); + } + } + }); + + for (MouseListener m : old) + { + dataList.addMouseListener(m); + } + + dataList.setCellRenderer(new DefaultListCellRenderer() + { + + @Override + public Component getListCellRendererComponent(JList list, + Object value, int index, boolean isSelected, + boolean cellHasFocus) + { + Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (field == parent.getModel().getColorField()) + { + String text = value.toString(); + int n = text.lastIndexOf('-'); + if (n > 1) + { + text = text.substring(0, n - 1); + } + c.setForeground(parent.getModel().getDisplay().makeColor(text)); + } + return c; + } + }); + + } + + public void setData(Bag<String> data) + { + dataList.removeAll(); + java.util.List<String> items = data.list(); + String[] s = (String[]) items.toArray(new String[0]); + for (int i = 0; i < s.length; i++) + { + int num = data.num(s[i]); + if (s[i] == null || s[i].length() == 0) + { + s[i] = "(missing)"; + } + s[i] += " - " + num; + } + dataList.setListData(s); + } + + public Dimension getPreferredSize() + { + return new Dimension(200, 200); + } + + @Override + public ActFilter defineFilter() + { + Object[] o = dataList.getSelectedValues(); + if (o == null || o.length == 0) + { + return null; + } + + int n = o.length; + String[] s = new String[n]; + for (int i = 0; i < n; i++) + { + String w = (String) o[i]; + int m = w.lastIndexOf('-'); + s[i] = w.substring(0, m - 1); + if ("(missing)".equals(s[i])) + { + s[i] = ""; + } + } + + if (s.length == 1) + { + return new FieldValueFilter(field, s[0]); + } + FieldValueSetFilter f = new FieldValueSetFilter(field); + for (int i = 0; i < s.length; i++) + { + f.addValue(s[i]); + } + return f; + } + + @Override + public void clearFilter() + { + dataList.clearSelection(); + } } diff --git a/timeflow/app/ui/filter/FilterControlPanel.java b/timeflow/app/ui/filter/FilterControlPanel.java index fafdb7e..24b8095 100755 --- a/timeflow/app/ui/filter/FilterControlPanel.java +++ b/timeflow/app/ui/filter/FilterControlPanel.java @@ -23,7 +23,7 @@ JMenu menuToSyncWith; - public FilterControlPanel(TFModel model, JMenu menuToSyncWith) + public FilterControlPanel(TimeflowModel model, JMenu menuToSyncWith) { super(model); this.menuToSyncWith=menuToSyncWith; diff --git a/timeflow/app/ui/filter/FilterDatePanel.java b/timeflow/app/ui/filter/FilterDatePanel.java index 17c1801..a07615b 100755 --- a/timeflow/app/ui/filter/FilterDatePanel.java +++ b/timeflow/app/ui/filter/FilterDatePanel.java @@ -16,158 +16,168 @@ // NumberFilterPanel. // but, i'm not sure how to do it in a way that doesn't make the code // seem too complicated. - -public class FilterDatePanel extends FilterDefinitionPanel +public class FilterDatePanel extends FilterDefinitionPanel { - BabyHistogram histogram; - Field field; - JTextField startEntry; - JTextField endEntry; - JCheckBox nullBox; - Runnable action; - SimpleDateFormat df=new SimpleDateFormat("MMM dd yyyy"); - - public FilterDatePanel(final Field field, final Runnable action, final FilterControlPanel parent) - { - this.field=field; - this.action=action; - setLayout(new BorderLayout()); - setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); - setBackground(Color.white); - add(new FilterTitle(field, parent, false), BorderLayout.NORTH); - - Runnable fullAction=new Runnable() - { - public void run() - { - startEntry.setText(format(histogram.getLow())); - endEntry.setText(format(histogram.getHigh())); - action.run(); - } - }; - - histogram=new BabyHistogram(fullAction); - - add(histogram, BorderLayout.CENTER); - - JPanel bottomStuff=new JPanel(); - bottomStuff.setLayout(new GridLayout(2,1)); - add(bottomStuff, BorderLayout.SOUTH); - - JPanel lowHighPanel=new JPanel(); - bottomStuff.add(lowHighPanel); - lowHighPanel.setBackground(Color.white); - lowHighPanel.setLayout(new BorderLayout()); - Font small=parent.getModel().getDisplay().small(); - - startEntry=new JTextField(7); - startEntry.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setLowFromText(); - action.run(); - }}); - lowHighPanel.add(startEntry, BorderLayout.WEST); - startEntry.setFont(small); - - JLabel rangeLabel=new JLabel("to", JLabel.CENTER); - rangeLabel.setForeground(Color.gray); - rangeLabel.setFont(small); - lowHighPanel.add(rangeLabel, BorderLayout.CENTER); - endEntry=new JTextField(7); - lowHighPanel.add(endEntry, BorderLayout.EAST); - endEntry.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setHighFromText(); - action.run(); - }}); - endEntry.setFont(small); - - nullBox=new JCheckBox("Include Missing Values"); - nullBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - action.run(); - }}); - bottomStuff.add(nullBox); - bottomStuff.setBackground(Color.white); - nullBox.setBackground(Color.white); - nullBox.setForeground(Color.gray); - nullBox.setFont(small); - - } - - String format(double x) - { - Date date=new Date((long)x); - return df.format(date); - } - - void setLowFromText() - { - try - { - long low=df.parse(startEntry.getText()).getTime(); - long high=(long)histogram.getHigh(); - if (low>high) - { - high=low; - endEntry.setText(startEntry.getText()); - } - histogram.setTrueRange(low,high); - - } - catch (Exception e) - { - - } - } - - - void setHighFromText() - { - try - { - long high=df.parse(endEntry.getText()).getTime(); - double low=(long)histogram.getLow(); - if (low>high) - { - low=high; - startEntry.setText(endEntry.getText()); - } - histogram.setTrueRange(low,high); - - } - catch (Exception e) - { - - } - } - public void setData(double[] data) - { - histogram.setData(data); - startEntry.setText(format(histogram.getLow())); - endEntry.setText(format(histogram.getHigh())); - repaint(); - } - - public Dimension getPreferredSize() - { - return new Dimension(200,160); - } + BabyHistogram histogram; + Field field; + JTextField startEntry; + JTextField endEntry; + JCheckBox nullBox; + Runnable action; + SimpleDateFormat df = new SimpleDateFormat("MMM dd yyyy"); - @Override - public ActFilter defineFilter() { - long low=(long)histogram.getLow(); - long high=(long)histogram.getHigh(); - boolean acceptNull=nullBox.isSelected(); - return new TimeIntervalFilter(low, high, acceptNull, field); - } + public FilterDatePanel(final Field field, final Runnable action, final FilterControlPanel parent) + { + this.field = field; + this.action = action; + setLayout(new BorderLayout()); + setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); + setBackground(Color.white); + add(new FilterTitle(field, parent, false), BorderLayout.NORTH); - @Override - public void clearFilter() { - histogram.setRelRange(0, 1); - } + Runnable fullAction = new Runnable() + { + + public void run() + { + startEntry.setText(format(histogram.getLow())); + endEntry.setText(format(histogram.getHigh())); + action.run(); + } + }; + + histogram = new BabyHistogram(fullAction); + + add(histogram, BorderLayout.CENTER); + + JPanel bottomStuff = new JPanel(); + bottomStuff.setLayout(new GridLayout(2, 1)); + add(bottomStuff, BorderLayout.SOUTH); + + JPanel lowHighPanel = new JPanel(); + bottomStuff.add(lowHighPanel); + lowHighPanel.setBackground(Color.white); + lowHighPanel.setLayout(new BorderLayout()); + Font small = parent.getModel().getDisplay().small(); + + startEntry = new JTextField(7); + startEntry.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + setLowFromText(); + action.run(); + } + }); + lowHighPanel.add(startEntry, BorderLayout.WEST); + startEntry.setFont(small); + + JLabel rangeLabel = new JLabel("to", JLabel.CENTER); + rangeLabel.setForeground(Color.gray); + rangeLabel.setFont(small); + lowHighPanel.add(rangeLabel, BorderLayout.CENTER); + endEntry = new JTextField(7); + lowHighPanel.add(endEntry, BorderLayout.EAST); + endEntry.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + setHighFromText(); + action.run(); + } + }); + endEntry.setFont(small); + + nullBox = new JCheckBox("Include Missing Values"); + nullBox.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + action.run(); + } + }); + bottomStuff.add(nullBox); + bottomStuff.setBackground(Color.white); + nullBox.setBackground(Color.white); + nullBox.setForeground(Color.gray); + nullBox.setFont(small); + + } + + String format(double x) + { + Date date = new Date((long) x); + return df.format(date); + } + + void setLowFromText() + { + try + { + long low = df.parse(startEntry.getText()).getTime(); + long high = (long) histogram.getHigh(); + if (low > high) + { + high = low; + endEntry.setText(startEntry.getText()); + } + histogram.setTrueRange(low, high); + + } catch (Exception e) + { + } + } + + void setHighFromText() + { + try + { + long high = df.parse(endEntry.getText()).getTime(); + double low = (long) histogram.getLow(); + if (low > high) + { + low = high; + startEntry.setText(endEntry.getText()); + } + histogram.setTrueRange(low, high); + + } catch (Exception e) + { + } + } + + public void setData(double[] data) + { + histogram.setData(data); + startEntry.setText(format(histogram.getLow())); + endEntry.setText(format(histogram.getHigh())); + repaint(); + } + + public Dimension getPreferredSize() + { + return new Dimension(200, 160); + } + + @Override + public ActFilter defineFilter() + { + long low = (long) histogram.getLow(); + long high = (long) histogram.getHigh(); + boolean acceptNull = nullBox.isSelected(); + return new TimeIntervalFilter(low, high, acceptNull, field); + } + + @Override + public void clearFilter() + { + histogram.setRelRange(0, 1); + } } \ No newline at end of file diff --git a/timeflow/app/ui/filter/SearchPanel.java b/timeflow/app/ui/filter/SearchPanel.java index eca2702..6ce0bbe 100755 --- a/timeflow/app/ui/filter/SearchPanel.java +++ b/timeflow/app/ui/filter/SearchPanel.java @@ -14,7 +14,7 @@ JTextField entry; JCheckBox invert; - public SearchPanel(TFModel model, final FilterControlPanel f) { + public SearchPanel(TimeflowModel model, final FilterControlPanel f) { super(model); setBackground(Color.white); setBorder(BorderFactory.createEmptyBorder(15, 5,0,0)); diff --git a/timeflow/data/db/ActDB.java b/timeflow/data/db/ActDB.java index 46e4bb1..dc1f552 100755 --- a/timeflow/data/db/ActDB.java +++ b/timeflow/data/db/ActDB.java @@ -4,13 +4,15 @@ import timeflow.data.db.filter.ActFilter; -public interface ActDB extends Iterable<Act> { - +public interface ActDB extends Iterable<Act> +{ + // Source public String getSource(); public String getDescription(); public void setSource(String source); public void setDescription(String description); - + + // Fields public List<String> getFieldKeys(); public List<Field> getFields(); public List<Field> getFields(Class type); @@ -21,6 +23,7 @@ public void setNewFieldOrder(List<Field> newOrder); public void renameField(Field field, String name); + // Acts public void delete(Act act); public Act createAct(); public ActList select(ActFilter filter); diff --git a/timeflow/data/db/Field.java b/timeflow/data/db/Field.java index 9fac035..eaad409 100755 --- a/timeflow/data/db/Field.java +++ b/timeflow/data/db/Field.java @@ -1,50 +1,53 @@ package timeflow.data.db; +public class Field +{ -public class Field { - private String name; - private Class type; - int index; - private int recommendedSize=-1; - - public Field(String name, Class type) - { - this.name=name; - this.type=type; - } - - public Field(String name, Class type, int recommendedSize) - { - this.name=name; - this.type=type; - this.recommendedSize=recommendedSize; - } - - public int getRecommendedSize() { - return recommendedSize; - } + private String name; + private Class type; + int index; + private int recommendedSize = -1; - public void setRecommendedSize(int recommendedSize) { - this.recommendedSize = recommendedSize; - } - - void setName(String name) - { - this.name=name; - } + public Field(String name, Class type) + { + this.name = name; + this.type = type; + } - public String getName() - { - return name; - } - - public Class getType() - { - return type; - } + public Field(String name, Class type, int recommendedSize) + { + this.name = name; + this.type = type; + this.recommendedSize = recommendedSize; + } - public String toString() - { - return "[Field: name='"+name+"', type="+type+", index="+index+"]"; - } + public int getRecommendedSize() + { + return recommendedSize; + } + + public void setRecommendedSize(int recommendedSize) + { + this.recommendedSize = recommendedSize; + } + + void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public Class getType() + { + return type; + } + + public String toString() + { + return "[Field: name='" + name + "', type=" + type + ", index=" + index + "]"; + } } diff --git a/timeflow/data/time/RoughTime.java b/timeflow/data/time/RoughTime.java index 55b4bbb..85403f3 100755 --- a/timeflow/data/time/RoughTime.java +++ b/timeflow/data/time/RoughTime.java @@ -3,127 +3,141 @@ import java.util.Calendar; import java.util.Date; -public class RoughTime implements Comparable { +public class RoughTime implements Comparable +{ - public static final long UNKNOWN=Long.MIN_VALUE; - private TimeUnit units; - private long time; - - public RoughTime(TimeUnit units) - { - time=UNKNOWN; - this.units=units; - } - - public RoughTime(long time, TimeUnit units) - { - this.time=time; - this.units=units; - } - - public boolean isDefined() - { - return time!=UNKNOWN; - } - - public long getTime() - { - return time; - } - - public void setTime(long time) - { - this.time=time; - } - - public Date toDate() - { - return new Date(time); - } - - public boolean after(RoughTime t) - { - return t.time<time; - } - - public boolean before(RoughTime t) - { - return t.time>time; - } - - public RoughTime plus(int numUnits) - { - return plus(units, numUnits); - } - - public RoughTime plus(TimeUnit unit, int times) - { - RoughTime r=copy(); - unit.addTo(r,times); - return r; - } - - public String toString() - { - if (isKnown()) - return new Date(time).toString(); - return "unknown"; - } - - public boolean isKnown() - { - return time!=UNKNOWN; - } - - public boolean equals(Object o) - { - if (!(o instanceof RoughTime)) - return false; - RoughTime t=(RoughTime)o; - return t.units==units && t.time==time; - } - - public RoughTime copy() - { - RoughTime t=new RoughTime(time, units); - return t; - } - - public void setUnits(TimeUnit units) - { - this.units=units; - } + public static final long UNKNOWN = Long.MIN_VALUE; + private TimeUnit units; + private long time; - public TimeUnit getUnits() { - return units; - } - - public String format() - { - //return units.formatFull(time); - return TimeUnit.SECOND.formatFull(time); - } - - public static int compare(RoughTime t1, RoughTime t2) - { - if (t1==t2) - return 0; - if (t1==null) - return -1; - if (t2==null) - return 1; - long dt= t1.time-t2.time; - if (dt==0) - return 0; - if (dt>0) - return 1; - return -1; - } +// public RoughTime(TimeUnit units) +// { +// time=UNKNOWN; +// this.units=units; +// } + public RoughTime(long time, TimeUnit units) + { + this.time = time; + this.units = units; + } - @Override - public int compareTo(Object o) { - return compare(this, (RoughTime)o); - } + public boolean isDefined() + { + return time != UNKNOWN; + } + public long getTime() + { + return time; + } + public void setTime(long time) + { + this.time = time; + } + + public Date toDate() + { + return new Date(time); + } + + public boolean after(RoughTime t) + { + return t.time < time; + } + + public boolean before(RoughTime t) + { + return t.time > time; + } + + public RoughTime plus(int numUnits) + { + return plus(units, numUnits); + } + + public RoughTime plus(TimeUnit unit, int times) + { + RoughTime r = copy(); + unit.addTo(r, times); + return r; + } + + public String toString() + { + if (isKnown()) + { + return new Date(time).toString(); + } + return "unknown"; + } + + public boolean isKnown() + { + return time != UNKNOWN; + } + + public boolean equals(Object o) + { + if (!(o instanceof RoughTime)) + { + return false; + } + RoughTime t = (RoughTime) o; + return t.units == units && t.time == time; + } + + public RoughTime copy() + { + RoughTime t = new RoughTime(time, units); + return t; + } + + public void setUnits(TimeUnit units) + { + this.units = units; + } + + public TimeUnit getUnits() + { + return units; + } + + public String format() + { + //return units.formatFull(time); + return TimeUnit.SECOND.formatFull(time); + } + + public static int compare(RoughTime t1, RoughTime t2) + { + if (t1 == t2) + { + return 0; + } + if (t1 == null) + { + return -1; + } + if (t2 == null) + { + return 1; + } + long dt = t1.time - t2.time; + if (dt == 0) + { + return 0; + } + if (dt > 0) + { + return 1; + } + return -1; + } + + @Override + public int compareTo(Object o) + { + return compare(this, (RoughTime) o); + } } diff --git a/timeflow/data/time/TimeUnit.java b/timeflow/data/time/TimeUnit.java index 4032258..bbba6e1 100755 --- a/timeflow/data/time/TimeUnit.java +++ b/timeflow/data/time/TimeUnit.java @@ -5,15 +5,16 @@ public class TimeUnit { - public static final TimeUnit YEAR = new TimeUnit("Years", Calendar.YEAR, 365 * 24 * 60 * 60 * 1000L, "yyyy", "yyyy"); public static final TimeUnit MONTH = new TimeUnit("Months", Calendar.MONTH, 30 * 24 * 60 * 60 * 1000L, "MMM", "MMM yyyy"); public static final TimeUnit WEEK = new TimeUnit("Weeks", Calendar.WEEK_OF_YEAR, 7 * 24 * 60 * 60 * 1000L, "d", "MMM d yyyy"); public static final TimeUnit DAY = new TimeUnit("Days", Calendar.DAY_OF_MONTH, 24 * 60 * 60 * 1000L, "d", "MMM d yyyy"); public static final TimeUnit DAY_OF_WEEK = new TimeUnit("Days", Calendar.DAY_OF_WEEK, 24 * 60 * 60 * 1000L, "d", "MMM d yyyy"); - public static final TimeUnit HOUR = new TimeUnit("Hours", Calendar.HOUR_OF_DAY, 60 * 60 * 1000L, "kk:mm", "MMM d yyyy kk:mm"); - public static final TimeUnit MINUTE = new TimeUnit("Minutes", Calendar.MINUTE, 60 * 1000L, ":mm", "MMM d yyyy kk:mm"); - public static final TimeUnit SECOND = new TimeUnit("Seconds", Calendar.SECOND, 1000L, ":ss", "MMM d yyyy kk:mm:ss"); + 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, 8L, ":SSS", "MMM d yyyy HH:mm:ss:SSS"); + public static final TimeUnit DECADE = multipleYears(10); public static final TimeUnit CENTURY = multipleYears(100); private static final double DAY_SIZE = 24 * 60 * 60 * 1000L; diff --git a/timeflow/format/field/FieldFormat.java b/timeflow/format/field/FieldFormat.java index a8c7223..a899ab0 100755 --- a/timeflow/format/field/FieldFormat.java +++ b/timeflow/format/field/FieldFormat.java @@ -4,61 +4,65 @@ import timeflow.data.time.*; -public abstract class FieldFormat { - protected String lastInput; - protected Object lastValue; - protected boolean understood=true; - - double value; - - void add(double x) - { - value+=x; - } - - void note(String s) - { - add(scoreFormatMatch(s)); - } +public abstract class FieldFormat +{ + protected String lastInput; + protected Object lastValue; + protected boolean understood = true; + double value; - - protected abstract Object _parse(String s) throws Exception; - public abstract String format(Object o); - public abstract Class getType(); - public abstract double scoreFormatMatch(String s); - public abstract String getHumanName(); + void add(double x) + { + value += x; + } + void note(String s) + { + add(scoreFormatMatch(s)); + } - public void setValue(Object o) - { - lastValue=o; - lastInput=o==null ? "" : format(o); - } - - public Object parse(String s) throws Exception - { - lastInput=s; - lastValue=null; - understood=false; - lastValue=_parse(s); - understood=true; - return lastValue; - } - - public Object getLastValue() - { - return lastValue; - } - - public String feedback() - { - if (!understood) - return "Couldn't understand"; - return lastValue==null ? "(missing)" : "Read: "+format(lastValue); - } - - public boolean isUnderstood() - { - return understood; - } + protected abstract Object _parse(String s) throws Exception; + + public abstract String format(Object o); + + public abstract Class getType(); + + public abstract double scoreFormatMatch(String s); + + public abstract String getHumanName(); + + public void setValue(Object o) + { + lastValue = o; + lastInput = o == null ? "" : format(o); + } + + public Object parse(String s) throws Exception + { + lastInput = s; + lastValue = null; + understood = false; + lastValue = _parse(s); + understood = true; + return lastValue; + } + + public Object getLastValue() + { + return lastValue; + } + + public String feedback() + { + if (!understood) + { + return "Couldn't understand"; + } + return lastValue == null ? "(missing)" : "Read: " + format(lastValue); + } + + public boolean isUnderstood() + { + return understood; + } } diff --git a/timeflow/format/file/Export.java b/timeflow/format/file/Export.java index 24361e8..f0a6e86 100755 --- a/timeflow/format/file/Export.java +++ b/timeflow/format/file/Export.java @@ -6,5 +6,5 @@ public interface Export { public String getName(); - public void export(TFModel model, BufferedWriter out) throws Exception; + public void export(TimeflowModel model, BufferedWriter out) throws Exception; } diff --git a/timeflow/format/file/HtmlFormat.java b/timeflow/format/file/HtmlFormat.java index 3792f28..b431001 100755 --- a/timeflow/format/file/HtmlFormat.java +++ b/timeflow/format/file/HtmlFormat.java @@ -9,7 +9,7 @@ public class HtmlFormat implements Export { - TFModel model; + TimeflowModel model; java.util.List<Field> fields; Field title; @@ -17,12 +17,12 @@ { } - public HtmlFormat(TFModel model) + public HtmlFormat(TimeflowModel model) { setModel(model); } - public void setModel(TFModel model) + public void setModel(TimeflowModel model) { this.model = model; fields = model.getDB().getFields(); @@ -30,7 +30,7 @@ } @Override - public void export(TFModel model, BufferedWriter out) throws Exception + public void export(TimeflowModel model, BufferedWriter out) throws Exception { setModel(model); out.write(makeHeader()); diff --git a/timeflow/format/file/TimeflowFormat.java b/timeflow/format/file/TimeflowFormat.java index 3778235..50310d0 100755 --- a/timeflow/format/file/TimeflowFormat.java +++ b/timeflow/format/file/TimeflowFormat.java @@ -13,151 +13,168 @@ public class TimeflowFormat implements Import, Export { - private static final String END_OF_SCHEMA="#TIMEFLOW\tend-metadata"; - private static final String END_OF_METADATA="#TIMEFLOW\t====== End of Header. Data below is in tab-delimited format. ====="; - public ActDB readFile(String fileName, PrintStream messages) throws Exception - { - return read(new File(fileName), messages); - } - - public static ActDB read(File file, PrintStream out) throws Exception - { - String text=IO.read(file.getAbsolutePath()); - DelimitedText quote=new DelimitedText('\t'); - Iterator<String[]> lines=quote.read(text).iterator(); - - ActDB db=null; - List<String> fieldNames=new ArrayList<String>(); - List<Class> fieldTypes=new ArrayList<Class>(); - List<Integer> fieldSizes=new ArrayList<Integer>(); - String source="[unknown]", description=""; - for (;;) - { - String[] t=lines.next(); + private static final String END_OF_SCHEMA = "#TIMEFLOW\tend-metadata"; + private static final String END_OF_METADATA = "#TIMEFLOW\t====== End of Header. Data below is in tab-delimited format. ====="; - if (t[1].equals("field")) - { - fieldNames.add(t[2]); - fieldTypes.add(FieldFormatCatalog.javaClass(t[3])); - if (t.length>4) - { - fieldSizes.add(Integer.parseInt(t[4])); - } - else - fieldSizes.add(-1); - } - else if (t[1].equals("source")) - { - source=t[2]; - } - else if (t[1].equals("description")) - { - description=t[2]; - - } - else if (t[1].equals("end-metadata")) - break; - } - db=new ArrayDB((String[])fieldNames.toArray(new String[0]), - (Class[])fieldTypes.toArray(new Class[0]), source); - db.setDescription(description); - for (int i=0; i<fieldNames.size(); i++) - if (fieldSizes.get(i)>0) - db.getField(fieldNames.get(i)).setRecommendedSize(fieldSizes.get(i)); - for (;;) - { - String[] t=lines.next(); - if (t[1].startsWith("===")) - break; - if (t[1].equals("alias")) - db.setAlias(db.getField(t[3]), t[2]); - } - - // note: in some cases headers may be in a different order than in - // metadata section, so we will read these. - String[] headers=lines.next(); - if (headers.length!=fieldNames.size()) - throw new IllegalArgumentException("Different number of headers than fields!"); - - - while (lines.hasNext()) - { - String[] t=lines.next(); - Act a=db.createAct(); - for (int i=0; i<t.length; i++) - { - Field f=db.getField(headers[i]); - FieldFormat format=FieldFormatCatalog.getFormat(f.getType()); - a.set(f, format.parse(t[i])); - } - } - - return db; - } - - public static void write(ActList acts, BufferedWriter bw) throws IOException - { - ActDB db=acts.getDB(); - - PrintWriter out=new PrintWriter(bw); - - DelimitedText tab=new DelimitedText('\t'); - - // Write version - out.println("#TIMEFLOW\tformat version\t1"); - - // Write source of data. - out.println("#TIMEFLOW\tsource\t"+tab.write(db.getSource())); - - // Write description of data. - out.println("#TIMEFLOW\tdescription\t"+tab.write(db.getDescription())); - - // Write schema. - List<Field> fields=db.getFields(); - for (Field f: fields) - { - String recSize=f.getRecommendedSize()<=0 ? "" : "\t"+f.getRecommendedSize(); - out.println("#TIMEFLOW\tfield\t"+tab.write(f.getName())+ - "\t"+FieldFormatCatalog.humanName(f.getType())+recSize); - } - - out.println(END_OF_SCHEMA); - - // Write column mappings. - List<String> aliases=DBUtils.getFieldAliases(db); - for (String a:aliases) - out.println("#TIMEFLOW\talias\t"+a+"\t"+tab.write(db.getField(a).getName())); - - // Write end of header indicator - out.println(END_OF_METADATA); - - // Write data! - new DelimitedFormat('\t').writeDelimited(db, acts, out); - - out.flush(); - out.close(); - } - - public static void main(String[] args) throws Exception - { - System.out.println("Reading"); - ActDB db=read(new File("test/monet.txt"), System.out); - System.out.println("# lines: "+db.size()); - } + public ActDB readFile(String fileName, PrintStream messages) throws Exception + { + return read(new File(fileName), messages); + } - @Override - public String getName() { - return "TimeFlow Format"; - } + public static ActDB read(File file, PrintStream out) throws Exception + { + String text = IO.read(file.getAbsolutePath()); + DelimitedText quote = new DelimitedText('\t'); + Iterator<String[]> lines = quote.read(text).iterator(); - @Override - public ActDB importFile(File file) throws Exception { - return read(file, System.out); - } - @Override - public void export(TFModel model, BufferedWriter out) throws Exception { - write(model.getDB().all(), out); - } + ActDB db = null; + List<String> fieldNames = new ArrayList<String>(); + List<Class> fieldTypes = new ArrayList<Class>(); + List<Integer> fieldSizes = new ArrayList<Integer>(); + String source = "[unknown]", description = ""; + for (;;) + { + String[] t = lines.next(); + + if (t[1].equals("field")) + { + fieldNames.add(t[2]); + fieldTypes.add(FieldFormatCatalog.javaClass(t[3])); + if (t.length > 4) + { + fieldSizes.add(Integer.parseInt(t[4])); + } else + { + fieldSizes.add(-1); + } + } else if (t[1].equals("source")) + { + source = t[2]; + } else if (t[1].equals("description")) + { + description = t[2]; + + } else if (t[1].equals("end-metadata")) + { + break; + } + } + db = new ArrayDB((String[]) fieldNames.toArray(new String[0]), + (Class[]) fieldTypes.toArray(new Class[0]), source); + db.setDescription(description); + for (int i = 0; i < fieldNames.size(); i++) + { + if (fieldSizes.get(i) > 0) + { + db.getField(fieldNames.get(i)).setRecommendedSize(fieldSizes.get(i)); + } + } + for (;;) + { + String[] t = lines.next(); + if (t[1].startsWith("===")) + { + break; + } + if (t[1].equals("alias")) + { + db.setAlias(db.getField(t[3]), t[2]); + } + } + + // note: in some cases headers may be in a different order than in + // metadata section, so we will read these. + String[] headers = lines.next(); + if (headers.length != fieldNames.size()) + { + throw new IllegalArgumentException("Different number of headers than fields!"); + } + + + while (lines.hasNext()) + { + String[] t = lines.next(); + Act a = db.createAct(); + for (int i = 0; i < t.length; i++) + { + Field f = db.getField(headers[i]); + FieldFormat format = FieldFormatCatalog.getFormat(f.getType()); + a.set(f, format.parse(t[i])); + } + } + + return db; + } + + public static void write(ActList acts, BufferedWriter bw) throws IOException + { + ActDB db = acts.getDB(); + + PrintWriter out = new PrintWriter(bw); + + DelimitedText tab = new DelimitedText('\t'); + + // Write version + out.println("#TIMEFLOW\tformat version\t1"); + + // Write source of data. + out.println("#TIMEFLOW\tsource\t" + tab.write(db.getSource())); + + // Write description of data. + out.println("#TIMEFLOW\tdescription\t" + tab.write(db.getDescription())); + + // Write schema. + List<Field> fields = db.getFields(); + for (Field f : fields) + { + String recSize = f.getRecommendedSize() <= 0 ? "" : "\t" + f.getRecommendedSize(); + out.println("#TIMEFLOW\tfield\t" + tab.write(f.getName()) + + "\t" + FieldFormatCatalog.humanName(f.getType()) + recSize); + } + + out.println(END_OF_SCHEMA); + + // Write column mappings. + List<String> aliases = DBUtils.getFieldAliases(db); + for (String a : aliases) + { + out.println("#TIMEFLOW\talias\t" + a + "\t" + tab.write(db.getField(a).getName())); + } + + // Write end of header indicator + out.println(END_OF_METADATA); + + // Write data! + new DelimitedFormat('\t').writeDelimited(db, acts, out); + + out.flush(); + out.close(); + } + + public static void main(String[] args) throws Exception + { + System.out.println("Reading"); + ActDB db = read(new File("test/monet.txt"), System.out); + System.out.println("# lines: " + db.size()); + } + + @Override + public String getName() + { + return "TimeFlow Format"; + } + + @Override + public ActDB importFile(File file) throws Exception + { + return read(file, System.out); + } + + @Override + public void export(TimeflowModel model, BufferedWriter out) throws Exception + { + write(model.getDB().all(), out); + } } diff --git a/timeflow/model/Display.java b/timeflow/model/Display.java index b56c86b..47c3481 100755 --- a/timeflow/model/Display.java +++ b/timeflow/model/Display.java @@ -360,7 +360,7 @@ return lines; } - public boolean emptyMessage(Graphics g, TFModel model) + public boolean emptyMessage(Graphics g, TimeflowModel model) { if (model.getActs() == null || model.getActs().size() == 0) { diff --git a/timeflow/model/ModelPanel.java b/timeflow/model/ModelPanel.java index 4326f4e..f538e18 100755 --- a/timeflow/model/ModelPanel.java +++ b/timeflow/model/ModelPanel.java @@ -4,9 +4,9 @@ public abstract class ModelPanel extends JPanel implements TFListener { - TFModel model; + TimeflowModel model; - public ModelPanel(TFModel model) + public ModelPanel(TimeflowModel model) { this.model=model; } @@ -26,7 +26,7 @@ model.removeListener(this); } - public TFModel getModel() + public TimeflowModel getModel() { return model; } diff --git a/timeflow/model/TFListener.java b/timeflow/model/TFListener.java index 3268d05..6f2468d 100755 --- a/timeflow/model/TFListener.java +++ b/timeflow/model/TFListener.java @@ -1,5 +1,6 @@ package timeflow.model; -public interface TFListener { - public void note(TFEvent e); +public interface TFListener +{ + public void note(TFEvent e); } diff --git a/timeflow/model/TFModel.java b/timeflow/model/TimeflowModel.java similarity index 99% rename from timeflow/model/TFModel.java rename to timeflow/model/TimeflowModel.java index f4e30e4..eba0c1b 100755 --- a/timeflow/model/TFModel.java +++ b/timeflow/model/TimeflowModel.java @@ -10,9 +10,8 @@ // encapsulates all properties of a timeline model: // data, display properties, etc. // also does listening, etc. -public class TFModel +public class TimeflowModel { - private ActDB db; private ActList acts; private ActFilter filter = new ConstFilter(true); diff --git a/timeflow/views/AbstractView.java b/timeflow/views/AbstractView.java index a56a933..566a5a3 100755 --- a/timeflow/views/AbstractView.java +++ b/timeflow/views/AbstractView.java @@ -15,7 +15,7 @@ JPanel panel; ActDB lastDrawn, lastNotified; - public AbstractView(TFModel model) + public AbstractView(TimeflowModel model) { super(model); } @@ -45,7 +45,7 @@ }; controlLabel.setBackground(Color.lightGray); controlLabel.setForeground(Color.darkGray); - panel.add(controlLabel, BorderLayout.NORTH); + //panel.add(controlLabel, BorderLayout.NORTH); return panel; } diff --git a/timeflow/views/AbstractVisualizationView.java b/timeflow/views/AbstractVisualizationView.java index 349ee29..9450b2b 100755 --- a/timeflow/views/AbstractVisualizationView.java +++ b/timeflow/views/AbstractVisualizationView.java @@ -22,12 +22,12 @@ Point mouse = new Point(-10000, 0), firstMouse = new Point(); boolean mouseIsDown; ArrayList<Mouseover> objectLocations = new ArrayList<Mouseover>(); - TFModel model; + TimeflowModel model; Act selectedAct; RoughTime selectedTime; Set<JMenuItem> urlItems = new HashSet<JMenuItem>(); - public AbstractVisualizationView(TFModel model) + public AbstractVisualizationView(TimeflowModel model) { this.model = model; @@ -176,7 +176,7 @@ return null; } - public TFModel getModel() + public TimeflowModel getModel() { return model; } diff --git a/timeflow/views/BarGraphView.java b/timeflow/views/BarGraphView.java index a55ad05..07e1459 100755 --- a/timeflow/views/BarGraphView.java +++ b/timeflow/views/BarGraphView.java @@ -28,7 +28,7 @@ Aggregate agg; JComboBox splitFieldChoice, numFieldChoice; - public BarGraphView(TFModel model) + public BarGraphView(TimeflowModel model) { super(model); @@ -55,7 +55,7 @@ int ch = 25, pad = 5, cw = 160; controls.removeAll(); - TFModel model = getModel(); + TimeflowModel model = getModel(); if (model.getDB() == null || model.getDB().size() == 0) { JLabel empty = new JLabel("Empty database"); @@ -267,7 +267,7 @@ int w = getSize().width, h = getSize().height; g.setColor(Color.white); g.fillRect(0, 0, w, h); - TFModel model = getModel(); + TimeflowModel model = getModel(); Display display = model.getDisplay(); if (display.emptyMessage(g, model)) diff --git a/timeflow/views/CalendarView.java b/timeflow/views/CalendarView.java index 354b939..d0fcda9 100755 --- a/timeflow/views/CalendarView.java +++ b/timeflow/views/CalendarView.java @@ -32,7 +32,7 @@ return controls; } - public CalendarView(TFModel model) + public CalendarView(TimeflowModel model) { super(model); calendarPanel=new CalendarPanel(model); @@ -276,7 +276,7 @@ class CalendarPanel extends AbstractVisualizationView { - CalendarPanel(TFModel model) + CalendarPanel(TimeflowModel model) { super(model); setBackground(Color.white); diff --git a/timeflow/views/DescriptionView.java b/timeflow/views/DescriptionView.java index 45d66c7..dfd5fb6 100755 --- a/timeflow/views/DescriptionView.java +++ b/timeflow/views/DescriptionView.java @@ -14,7 +14,7 @@ JTextArea content; JComponent controls; - public DescriptionView(TFModel model) { + public DescriptionView(TimeflowModel model) { super(model); setLayout(new BorderLayout()); JPanel left=new Pad(5,5); diff --git a/timeflow/views/IntroView.java b/timeflow/views/IntroView.java index 8540401..e049ed8 100755 --- a/timeflow/views/IntroView.java +++ b/timeflow/views/IntroView.java @@ -34,7 +34,7 @@ Image image; Image repeat; - public IntroView(TFModel model) + public IntroView(TimeflowModel model) { super(model); setBackground(Color.white); diff --git a/timeflow/views/ListView.java b/timeflow/views/ListView.java index 1302bfa..37fbe11 100755 --- a/timeflow/views/ListView.java +++ b/timeflow/views/ListView.java @@ -35,7 +35,7 @@ private boolean changing = false; private JPanel controls; - public ListView(TFModel model) + public ListView(TimeflowModel model) { super(model); diff --git a/timeflow/views/SummaryView.java b/timeflow/views/SummaryView.java index ba198d6..aac546c 100755 --- a/timeflow/views/SummaryView.java +++ b/timeflow/views/SummaryView.java @@ -27,7 +27,7 @@ private Interval range; private JComponent controls; - public SummaryView(TFModel model) + public SummaryView(TimeflowModel model) { super(model); analysisDisplay = HtmlDisplay.create(); diff --git a/timeflow/views/TableView.java b/timeflow/views/TableView.java index 4ce1ff1..0fa9313 100755 --- a/timeflow/views/TableView.java +++ b/timeflow/views/TableView.java @@ -23,7 +23,7 @@ private boolean editable=true; private JPanel controls; - public TableView(TFModel model) + public TableView(TimeflowModel model) { super(model); diff --git a/timeflow/views/TimelineView.java b/timeflow/views/TimelineView.java index 06190c6..2e22fb6 100755 --- a/timeflow/views/TimelineView.java +++ b/timeflow/views/TimelineView.java @@ -37,7 +37,7 @@ return controls; } - public TimelineView(TFModel model) + public TimelineView(TimeflowModel model) { super(model); visuals = new TimelineVisuals(model); @@ -65,7 +65,7 @@ bottom.add(slider, BorderLayout.CENTER); controls = new JPanel(); - controls.setBackground(Color.white); + controls.setBackground(Color.red); controls.setLayout(new BorderLayout());//new GridLayout(2,1)); // top part of grid: zoom buttons. @@ -123,7 +123,7 @@ moveTime(visuals.getFitToVisibleRange()); }}); */ - controls.add(buttons, BorderLayout.NORTH); + controls.add(buttons, BorderLayout.SOUTH); // ok, now do second part of grid: layout style buttons. ComponentCluster layoutPanel = new ComponentCluster("Layout"); @@ -151,7 +151,7 @@ graph.addActionListener(new LayoutSetter(TimelineVisuals.Layout.GRAPH)); layoutGroup.add(graph); - controls.add(layoutPanel, BorderLayout.CENTER); + //controls.add(layoutPanel, BorderLayout.CENTER); } class LayoutSetter implements ActionListener @@ -325,7 +325,7 @@ class TimelinePanel extends AbstractVisualizationView { - public TimelinePanel(TFModel model) + public TimelinePanel(TimeflowModel model) { super(model); diff --git a/timeflow/vis/VisualActFactory.java b/timeflow/vis/VisualActFactory.java index bd267b6..919a766 100755 --- a/timeflow/vis/VisualActFactory.java +++ b/timeflow/vis/VisualActFactory.java @@ -10,7 +10,7 @@ import timeflow.data.db.ActDB; import timeflow.data.db.ActList; import timeflow.data.db.Field; -import timeflow.model.TFModel; +import timeflow.model.TimeflowModel; import timeflow.model.VirtualField; public class VisualActFactory @@ -60,7 +60,7 @@ return list; } - public static Collection<VisualAct> makeEmFit(TFModel model, ArrayList<VisualAct> vacts, Rectangle bounds) + public static Collection<VisualAct> makeEmFit(TimeflowModel model, ArrayList<VisualAct> vacts, Rectangle bounds) { // Does everything fit? Because, if so, we're already good to go. int area = bounds.width * bounds.height; diff --git a/timeflow/vis/VisualEncoder.java b/timeflow/vis/VisualEncoder.java index 9deee56..2dc61c2 100755 --- a/timeflow/vis/VisualEncoder.java +++ b/timeflow/vis/VisualEncoder.java @@ -9,11 +9,11 @@ public class VisualEncoder { - private TFModel model; + private TimeflowModel model; private java.util.List<VisualAct> visualActs = new ArrayList<VisualAct>(); private double maxSize = 0; - public VisualEncoder(TFModel model) + public VisualEncoder(TimeflowModel model) { this.model = model; } diff --git a/timeflow/vis/calendar/CalendarVisuals.java b/timeflow/vis/calendar/CalendarVisuals.java index d37f51c..5f3783e 100755 --- a/timeflow/vis/calendar/CalendarVisuals.java +++ b/timeflow/vis/calendar/CalendarVisuals.java @@ -11,7 +11,7 @@ public class CalendarVisuals { VisualEncoder encoder; - TFModel model; + TimeflowModel model; Rectangle bounds=new Rectangle(); public Grid grid; @@ -24,7 +24,7 @@ public enum FitStyle {LOOSE, TIGHT}; FitStyle fitStyle=FitStyle.LOOSE; - public CalendarVisuals(TFModel model) + public CalendarVisuals(TimeflowModel model) { this.model=model; encoder=new VisualEncoder(model); diff --git a/timeflow/vis/timeline/AxisRenderer.java b/timeflow/vis/timeline/AxisRenderer.java index 9e69341..68bc5fe 100755 --- a/timeflow/vis/timeline/AxisRenderer.java +++ b/timeflow/vis/timeline/AxisRenderer.java @@ -20,7 +20,7 @@ public void render(Graphics2D g, Collection<Mouseover> objectLocations) { - TFModel model = visuals.getModel(); + TimeflowModel model = visuals.getModel(); g.setColor(model.getDisplay().getColor("chart.background")); Rectangle bounds = visuals.getBounds(); @@ -41,7 +41,7 @@ void render(AxisTicMarks t, Graphics2D g, int x, int y, int h, int top, boolean full, Collection<Mouseover> objectLocations) { - TFModel model = visuals.getModel(); + TimeflowModel model = visuals.getModel(); int n = t.tics.size(); for (int i = 0; i < n - 1; i++) diff --git a/timeflow/vis/timeline/TimelineRenderer.java b/timeflow/vis/timeline/TimelineRenderer.java index 4c115a5..1c5aa54 100755 --- a/timeflow/vis/timeline/TimelineRenderer.java +++ b/timeflow/vis/timeline/TimelineRenderer.java @@ -36,7 +36,7 @@ g.setTransform(AffineTransform.getTranslateInstance(0, -dy)); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - TFModel model = visuals.getModel(); + TimeflowModel model = visuals.getModel(); Display display = model.getDisplay(); ActDB db = model.getDB(); diff --git a/timeflow/vis/timeline/TimelineVisuals.java b/timeflow/vis/timeline/TimelineVisuals.java index 4e54d8a..f19c09d 100755 --- a/timeflow/vis/timeline/TimelineVisuals.java +++ b/timeflow/vis/timeline/TimelineVisuals.java @@ -28,12 +28,12 @@ public enum Layout { - TIGHT, LOOSE, GRAPH }; + private Layout layoutStyle = Layout.TIGHT; private VisualEncoder encoder; - private TFModel model; + private TimeflowModel model; private int fullHeight; public int getFullHeight() @@ -41,7 +41,7 @@ return fullHeight; } - public TimelineVisuals(TFModel model) + public TimelineVisuals(TimeflowModel model) { this.model = model; encoder = new VisualEncoder(model); @@ -224,7 +224,7 @@ layout(); } - public TFModel getModel() + public TimeflowModel getModel() { return model; } -- Gitblit v1.6.2