Permalink
Browse files

Massive cleanup of code; pushed more implementations down to private …

…packages, making more (re)use of interfaces.
  • Loading branch information...
1 parent d6e1cc9 commit a1061d326736126021614462b4535a432d5ce7fa @jawi committed Jan 25, 2012
Showing with 2,898 additions and 2,814 deletions.
  1. +8 −0 api/src/main/java/nl/lxtreme/ols/api/UserSettings.java
  2. +5 −3 api/src/main/java/nl/lxtreme/ols/api/data/Channel.java
  3. +8 −1 api/src/main/java/nl/lxtreme/ols/api/data/Cursor.java
  4. +13 −5 api/src/main/java/nl/lxtreme/ols/api/data/DataContainer.java
  5. +91 −0 api/src/main/java/nl/lxtreme/ols/api/data/DataSet.java
  6. +3 −3 api/src/main/java/nl/lxtreme/ols/api/data/export/Exporter.java
  7. +44 −83 api/src/main/java/nl/lxtreme/ols/api/data/project/Project.java
  8. +60 −0 api/src/main/java/nl/lxtreme/ols/api/data/project/UserSettingsManager.java
  9. +0 −50 api/src/main/java/nl/lxtreme/ols/api/tools/annotation/Annotation.java
  10. +0 −59 api/src/main/java/nl/lxtreme/ols/api/tools/annotation/AnnotationListener.java
  11. +0 −46 api/src/main/java/nl/lxtreme/ols/api/tools/annotation/DataAnnotation.java
  12. +0 −292 api/src/test/java/nl/lxtreme/ols/api/data/CursorImpl.java
  13. +73 −0 client.project/pom.xml
  14. +80 −0 client.project/src/main/java/nl/lxtreme/ols/client/project/Activator.java
  15. +284 −0 client.project/src/main/java/nl/lxtreme/ols/client/project/impl/ChannelImpl.java
  16. +27 −1 ...display/cursor → client.project/src/main/java/nl/lxtreme/ols/client/project/impl}/CursorImpl.java
  17. +232 −0 client.project/src/main/java/nl/lxtreme/ols/client/project/impl/DataSetImpl.java
  18. +126 −132 ...ls/api/data → client.project/src/main/java/nl/lxtreme/ols/client/project/impl}/OlsDataHelper.java
  19. +55 −135 .../data/project → client.project/src/main/java/nl/lxtreme/ols/client/project/impl}/ProjectImpl.java
  20. +21 −21 ...er.java → client.project/src/main/java/nl/lxtreme/ols/client/project/impl/ProjectManagerImpl.java
  21. +1 −1 ...project → client.project/src/main/java/nl/lxtreme/ols/client/project/impl}/ProjectProperties.java
  22. +20 −13 ...settings → client.project/src/main/java/nl/lxtreme/ols/client/project/impl}/UserSettingsImpl.java
  23. +65 −54 ...va → client.project/src/main/java/nl/lxtreme/ols/client/project/impl/UserSettingsManagerImpl.java
  24. +15 −75 ...a/project → client.project/src/test/java/nl/lxtreme/ols/client/project/impl}/ProjectImplTest.java
  25. +16 −13 ...ava → client.project/src/test/java/nl/lxtreme/ols/client/project/impl/ProjectManagerImplTest.java
  26. +1 −1 ...ings → client.project/src/test/java/nl/lxtreme/ols/client/project/impl}/UserSettingsImplTest.java
  27. +29 −15 ...s → client.project/src/test/java/nl/lxtreme/ols/client/project/impl}/UserSettingsManagerTest.java
  28. +7 −14 client/src/main/java/nl/lxtreme/ols/client/Activator.java
  29. +177 −108 client/src/main/java/nl/lxtreme/ols/client/ClientController.java
  30. +3 −4 client/src/main/java/nl/lxtreme/ols/client/MainFrame.java
  31. +1 −1 client/src/main/java/nl/lxtreme/ols/client/action/RepeatCaptureAction.java
  32. +299 −10 client/src/main/java/nl/lxtreme/ols/client/diagram/settings/MutableDiagramSettings.java
  33. +98 −80 client/src/main/java/nl/lxtreme/ols/client/osgi/UserSessionManager.java
  34. +3 −3 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/IChannelChangeListener.java
  35. +8 −4 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/IDataModelChangeListener.java
  36. +27 −9 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/SignalDiagramComponent.java
  37. +5 −5 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/SignalDiagramController.java
  38. +2 −2 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/action/DeleteAllCursorsAction.java
  39. +0 −1 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/action/EditSignalElementLabelAction.java
  40. +0 −1 ...nt/src/main/java/nl/lxtreme/ols/client/signaldisplay/action/SetSignalElementVisibilityAction.java
  41. +0 −330 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/channel/Channel.java
  42. +15 −10 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/channel/ChannelGroup.java
  43. +52 −38 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/channel/ChannelGroupManager.java
  44. +36 −71 .../main/java/nl/lxtreme/ols/client/signaldisplay/channel/{ChannelImpl.java → GroupableChannel.java}
  45. +0 −345 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/cursor/Cursor.java
  46. +5 −17 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/dnd/ChannelTransferable.java
  47. +5 −1 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/ChannelLabelsUI.java
  48. +5 −0 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/CornerUI.java
  49. +10 −12 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/SignalUI.java
  50. +7 −2 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/laf/TimeLineUI.java
  51. +11 −0 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/AbstractViewModel.java
  52. +2 −2 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/ChannelLabelsViewModel.java
  53. +82 −29 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/SignalDiagramModel.java
  54. +4 −3 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/SignalElement.java
  55. +3 −1 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/model/SignalViewModel.java
  56. +4 −3 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/view/CaptureDetailsView.java
  57. +2 −3 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/view/ChannelLabelsView.java
  58. +2 −2 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/view/CursorDetailsView.java
  59. +7 −7 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/view/MeasurementView.java
  60. +1 −2 client/src/main/java/nl/lxtreme/ols/client/signaldisplay/view/TimeLineView.java
  61. +0 −24 client/src/test/java/nl/lxtreme/ols/client/diagram/settings/MutableDiagramSettingsTest.java
  62. +0 −144 client/src/test/java/nl/lxtreme/ols/client/osgi/UserSessionManagerTest.java
  63. +12 −39 client/src/test/java/nl/lxtreme/ols/client/osgi/WindowStateListenerTest.java
  64. +2 −1 export.image/src/main/java/nl/lxtreme/ols/export/image/ImageExporter.java
  65. +11 −12 export.vcd/src/main/java/nl/lxtreme/ols/export/vcd/ValueChangeDumpExporter.java
  66. +16 −20 export.vcd/src/test/java/nl/lxtreme/ols/export/vcd/ValueChangeDumpExporterTest.java
  67. +1 −0 ols.distribution/src/main/assembly/assembly.xml
  68. +6 −0 pom.xml
  69. +15 −16 test.util/src/main/java/nl/lxtreme/ols/test/data/DataTestUtils.java
  70. +318 −0 test.util/src/main/java/nl/lxtreme/ols/test/data/OlsDataHelper.java
  71. +178 −0 test.util/src/main/java/nl/lxtreme/ols/test/data/project/StubChannel.java
  72. +10 −10 test.util/src/main/java/nl/lxtreme/ols/test/data/project/{StubCursorImpl.java → StubCursor.java}
  73. +39 −174 ...data/ProjectImpl.java → test.util/src/main/java/nl/lxtreme/ols/test/data/project/StubDataSet.java
  74. +25 −149 test.util/src/main/java/nl/lxtreme/ols/test/data/project/StubTestProject.java
  75. +105 −102 ...ava/nl/lxtreme/ols/api → test.util/src/test/java/nl/lxtreme/ols/test}/data/OlsDataHelperTest.java
  76. 0 {api → test.util}/src/test/resources/datafiles/i2c_1.ols
  77. 0 {api → test.util}/src/test/resources/datafiles/i2c_2.ols
  78. 0 {api → test.util}/src/test/resources/datafiles/jtag_1.ols
  79. 0 {api → test.util}/src/test/resources/datafiles/odd_even_1.ols
  80. 0 {api → test.util}/src/test/resources/datafiles/spi_8bit_1.ols
  81. 0 {api → test.util}/src/test/resources/datafiles/spi_8bit_2.ols
  82. 0 {api → test.util}/src/test/resources/datafiles/spi_9bit_1.ols
@@ -98,6 +98,14 @@
public void put( String aName, String aValue );
/**
+ * Allows all given map of settings to be copied to this user settings.
+ *
+ * @param aSettings
+ * the map with settings to copy, cannot be <code>null</code>.
+ */
+ public void putAll( Map<?, ?> aSettings );
+
+ /**
* Associates the given boolean value to the given name.
*
* @param aName
@@ -22,14 +22,15 @@
import java.awt.*;
+import java.util.*;
import nl.lxtreme.ols.api.data.annotation.*;
/**
* Denotes a single channel in the data set.
*/
-public interface Channel
+public interface Channel extends Comparable<Channel>
{
// METHODS
@@ -49,9 +50,10 @@
/**
* Returns all available annotations for this channel.
*
- * @return a copy of all annotations, never <code>null</code>.
+ * @return an immutable collection of this channel's annotations, never
+ * <code>null</code>, never <code>null</code>.
*/
- Annotation<?>[] getAnnotations();
+ Collection<Annotation<?>> getAnnotations();
/**
* Returns the color signals should be drawn in.
@@ -28,7 +28,7 @@
* Defines a cursor, which is a temporary marker in time defined somewhere on
* the captured data.
*/
-public interface Cursor
+public interface Cursor extends Cloneable
{
// METHODS
@@ -38,6 +38,13 @@
void clear();
/**
+ * Creates a clone of this cursor.
+ *
+ * @return an exact copy of this cursor.
+ */
+ Cursor clone();
+
+ /**
* Returns the cursor color.
*
* @return the color of this cursor, never <code>null</code>.
@@ -149,7 +149,7 @@ public long getAbsoluteLength()
*/
public Channel[] getAllChannels()
{
- return this.projectManager.getCurrentProject().getChannels();
+ return getCurrentDataSet().getChannels();
}
/**
@@ -466,7 +466,7 @@ public boolean isCursorPositionSet( final int aCursorIdx )
*/
public boolean isCursorsEnabled()
{
- return this.projectManager.getCurrentProject().isCursorsEnabled();
+ return getCurrentDataSet().isCursorsEnabled();
}
/**
@@ -542,7 +542,7 @@ public void setChannelLabels( final String[] aLabels )
*/
public void setCursorEnabled( final boolean aCursorEnabled )
{
- this.projectManager.getCurrentProject().setCursorsEnabled( aCursorEnabled );
+ getCurrentDataSet().setCursorsEnabled( aCursorEnabled );
}
/**
@@ -600,14 +600,22 @@ protected long calculateTimeOffset( final long aTime )
*/
private AcquisitionResult getAcquisitionData()
{
- return this.projectManager.getCurrentProject().getCapturedData();
+ return getCurrentDataSet().getCapturedData();
+ }
+
+ /**
+ * @return
+ */
+ private DataSet getCurrentDataSet()
+ {
+ return this.projectManager.getCurrentProject().getDataSet();
}
/**
* @return the cursorPositions
*/
private Cursor[] getCursors()
{
- return this.projectManager.getCurrentProject().getCursors();
+ return getCurrentDataSet().getCursors();
}
}
@@ -0,0 +1,91 @@
+/*
+ * OpenBench LogicSniffer / SUMP project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
+ *
+ * Copyright (C) 2006-2010 Michael Poppitz, www.sump.org
+ * Copyright (C) 2010-2012 J.W. Janssen, www.lxtreme.nl
+ */
+package nl.lxtreme.ols.api.data;
+
+
+import nl.lxtreme.ols.api.acquisition.*;
+
+
+/**
+ * Denotes a set of data, including the acquisition result, the channels and the
+ * cursors.
+ */
+public interface DataSet
+{
+ // METHODS
+
+ /**
+ * Returns the captured data of this project.
+ *
+ * @return a captured data, can be <code>null</code>.
+ */
+ public AcquisitionResult getCapturedData();
+
+ /**
+ * Returns a single channel.
+ *
+ * @param aIndex
+ * the channel index, >= 0 && <
+ * {@link AcquisitionResult#getChannels()}.
+ * @return an array of channels, never <code>null</code>.
+ */
+ public Channel getChannel( int aIndex );
+
+ /**
+ * Returns the channels of this project.
+ *
+ * @return an array of channels, never <code>null</code>.
+ */
+ public Channel[] getChannels();
+
+ /**
+ * Returns a single cursor
+ *
+ * @param aIndex
+ * the index of the cursor to retrieve, >= 0.
+ */
+ public Cursor getCursor( int aIndex );
+
+ /**
+ * Returns the available cursors of this project.
+ *
+ * @return an array of cursors, never <code>null</code>.
+ */
+ public Cursor[] getCursors();
+
+ /**
+ * Returns whether or not cursors are enabled.
+ *
+ * @return <code>true</code> if cursors are enabled, <code>false</code>
+ * otherwise.
+ */
+ public boolean isCursorsEnabled();
+
+ /**
+ * Sets whether or not cursors are enabled.
+ *
+ * @param aEnabled
+ * <code>true</code> if cursors are enabled, <code>false</code>
+ * otherwise.
+ */
+ public void setCursorsEnabled( final boolean aEnabled );
+
+}
@@ -25,7 +25,7 @@
import javax.swing.*;
-import nl.lxtreme.ols.api.data.project.*;
+import nl.lxtreme.ols.api.data.*;
/**
@@ -39,7 +39,7 @@
/**
* Exports the given data container to the given writer.
*
- * @param aProject
+ * @param aDataSet
* the current project with all data to export, can never be
* <code>null</code>;
* @param aComponent
@@ -52,7 +52,7 @@
* @throws IOException
* in case of I/O problems.
*/
- void export( final Project aProject, final JComponent aComponent, final OutputStream aStream ) throws IOException;
+ void export( final DataSet aDataSet, final JComponent aComponent, final OutputStream aStream ) throws IOException;
/**
* Returns the file extensions supported by this exporter.
Oops, something went wrong.

0 comments on commit a1061d3

Please sign in to comment.