1b9f492eebca6480bf547f1241068c808afbaf61
wiki/howto/development/fix-tracking.md
| ... | ... | @@ -32,7 +32,7 @@ The concrete MongoDB-based implementation of `SensorFixStore` is `MongoSensorFix |
| 32 | 32 | |
| 33 | 33 | The persistence and domain model fixes build upon on different type of Fixes: |
| 34 | 34 | while we persist a certain sensor data in the persistence layer, the domain model can define a typed view on top of the underlying sensor datatype. |
| 35 | - |
|
| 35 | + lass |
|
| 36 | 36 | There are different ways to implement extensions to handle new types of fixes. |
| 37 | 37 | |
| 38 | 38 | The persistence defined by `SensorFixStore` implementations can be extended to store custom fix implementations. |
| ... | ... | @@ -95,3 +95,27 @@ Further `DoubleVectorFixImporter` implementations can be registered to the OSGi |
| 95 | 95 | |
| 96 | 96 | The importer to be used to process the file is defined by the user by choosing the appropriate importer in the admin console upload formular. |
| 97 | 97 | The list available importer types is retrieved dynamically in the administration console. Therefore, simply registering an importer as a service in the OSGi registry makes it available in the admin ui. |
| 98 | + |
|
| 99 | +## Bringing sensor data to the frontend |
|
| 100 | + |
|
| 101 | +Usually, the imported fixes also should be displayed in the leaderboard and eventually in the competitor chart. |
|
| 102 | + |
|
| 103 | +Further reading can be found [here](../../info/landscape/typical-development-scenarios.html) in the sections: |
|
| 104 | + |
|
| 105 | +* Adding a Column to the Leaderboard |
|
| 106 | +* Adding new available information to the competitor chart |
|
| 107 | + |
|
| 108 | +The currently implemented bravo fixes showcase how this information can be brought to the frontend, in short: |
|
| 109 | + |
|
| 110 | +* add information to DetailType and DetailTypeFormatter and to the StringMessages accordingly |
|
| 111 | +* add information to BravoFix and BravoFixImpl |
|
| 112 | +* add information to BravoFixTrack and BravoFixTrackImpl |
|
| 113 | +* add information to LegEntryDTO |
|
| 114 | +* add information to LeaderboardPanel |
|
| 115 | +* add information to AbstractSimpleLeaderboardImpl |
|
| 116 | +* create column classes in LegColumn for the new DetailTypes, eventually create new column classes and renderers if required |
|
| 117 | +* add information to TrackedLegOfCompetitorImpl |
|
| 118 | +* add information to the list of available types in MultiCompetitorRaceChartSettingsComponent |
|
| 119 | +* make SailingServiceImpl.getCompetitorRaceDataEntry provide the data for the requested detailtype |
|
| 120 | + |
|
| 121 | + |
wiki/info/landscape/typical-development-scenarios.md
| ... | ... | @@ -98,32 +98,32 @@ TODO |
| 98 | 98 | ## Adding a Column to the Leaderboard |
| 99 | 99 | It is a typical request to have a new column with a new key figure added to the leaderboard structure. A number of things need to be considered to implement this. |
| 100 | 100 | |
| 101 | -## Extending LeaderboardDTO Contents |
|
| 101 | +### Extending LeaderboardDTO Contents |
|
| 102 | 102 | The content to be displayed by the LeaderboardPanel user interface component is transmitted from the server to the client using a LeaderboardDTO object. The class describes overall measures and data for the entire leaderboard, has overviews for each race as well as all detail figures for all legs. For example, the LeaderboardDTO object contains LeaderboardRowDTO objects, one for each competitor. Each such row object, in turn, contains LeaderboardEntryDTOs, one for each race column in the leaderboard. Those contain aggregates for the respective race/competitor as well as a list of LegEntryDTOs describing key figures for the competitors performance in each leg of the race. |
| 103 | 103 | |
| 104 | 104 | Depending on the level (overall, race, leg) at which to add a column, a corresponding field may need to be added to one of LeaderboardDTO, LeaderboardRowDTO, LeaderboardEntryDTO or LegEntryDTO. It may, however, at times also be possible to derive a new value from other values already fully contained in the LeaderboardDTO object. In such a case, no change is required to the LeaderboardDTO type hierarchy. |
| 105 | 105 | |
| 106 | -## Filling LeaderboardDTO Extensions |
|
| 106 | +### Filling LeaderboardDTO Extensions |
|
| 107 | 107 | The LeaderboardDTO objects are constructed in SailingServiceImpl.computeLeaderboardByName and its outbound call hierarchy. Looking at the existing code, it should become clear how to extend this. Usually, if really new measures are to be introduced, a corresponding extension to TrackedRace and its key implementation class TrackedRaceImpl becomes necessary where the new measures are computed, based on the raw tracking data and the various domain APIs available there. |
| 108 | 108 | |
| 109 | 109 | When a new measure is introduced such that computeLeaderboardByName needs to access data which may change over time, it is important to make sure that the leaderboard caches in LiveLeaderboardUpdater and LeaderboardDTOCache are invalidated accordingly if the data used by the computations introduced changes. For example, if the new figure depends on the structure of the leaderboard, the cache needs to be invalidated when the leaderboard's column layout changes. Fortunately, in this case, such an observer pattern already exists for the leaderboard caches and can be used to understand how such a pattern needs to be implemented. |
| 110 | 110 | |
| 111 | -## Adding the Column Type |
|
| 111 | +### Adding the Column Type |
|
| 112 | 112 | The LeaderboardPanel and its dependent components are the user interface components used to display the leaderboard. The underlying GWT component used to render the leaderboard is a CellTable with Column implementations for the various different column types. In a little "micro-framework" we support expandable columns (those with a "+" button in the header allowing the user to expand more details for that column), columns with CSS styles that travel with the column as the column moves to the right or the left in the table, as well as sortable columns. A special column base class exists to represent Double values. This column type displays a colored bar, symbolizing the relative value's magnitude, compared to the other values in the column. |
| 113 | 113 | |
| 114 | 114 | A column class is implemented as a subclass of SortableColumn. If the column is to display a numeric value where comparing between values makes sense, consider using a FormattedDoubleLegDetailColumn which displays a bar in the value's background, indicating the value's magnitude. To make this column type widely applicable, its constructor accepts a LegDetailField value which is responsible for computing or extracting the value to be displayed from a LeaderboardRowDTO object. |
| 115 | 115 | |
| 116 | 116 | A column which may itself have details should be implemented as a subclass of ExpandableSortableColumn, implementing the getDetailColumnMap method to specify the detail columns, as explained later in Adding to Parent Column's Detail Column Map. |
| 117 | 117 | |
| 118 | -## Extending DetailType |
|
| 118 | +### Extending DetailType |
|
| 119 | 119 | The enumeration type DetailType has a literal for each column type available. The literal describes the column's precision as a number of decimals (not used for non-numeric column types) and the default sorting order. |
| 120 | 120 | |
| 121 | 121 | To make the new DetailType literal displayable, DetailTypeFormatter.format needs to be extended by a corresponding case clause so that it supports the new literal. |
| 122 | 122 | |
| 123 | -## Adding to List of Available Columns |
|
| 123 | +### Adding to List of Available Columns |
|
| 124 | 124 | Mostly for the presentation in the leaderboard settings panel, the lists of available column types are maintained in class-level methods on LeaderboardPanel (getAvailableRaceDetailColumnTypes and getAvailableOverallDetailColumnTypes) ManeuverCountRaceColumn (getAvailableManeuverDetailColumnTypes) and LegColumn (getAvailableLegDetailColumnTypes). When adding a detail column to a parent column, the corresponding getAvailable...ColumnTypes method needs to be extended by returning the respective DetailsType literal so the column is offered in the settings panel. |
| 125 | 125 | |
| 126 | -## Adding to Parent Column's Detail Column Map |
|
| 126 | +### Adding to Parent Column's Detail Column Map |
|
| 127 | 127 | If the column added is supposed to be a detail of a parent column, the new column type needs to be returned by the parent column's getDetailColumnMap method. Check the LegColumn.getDetailColumnMap for details. |
| 128 | 128 | |
| 129 | 129 | **Discussion** |
| ... | ... | @@ -131,6 +131,23 @@ The current approach to extending the leaderboard panel by another column is unn |
| 131 | 131 | |
| 132 | 132 | Generally, there are too many special cases necessitating specific handling. Instead, it would be much better to have a homogeneous hierarchy of column types which automatically leads to the necessary results in getDetailColumnMap and the settings dialogs. |
| 133 | 133 | |
| 134 | +## Adding new available information to the competitor chart |
|
| 135 | + |
|
| 136 | +The user can choose the information to be displayed in the competitor chart by choosing from the available information. |
|
| 137 | +This information is a subset of the information available as defined in the DetailType enumeration. |
|
| 138 | + |
|
| 139 | +For a given information to be available for the Competitor-Chart, it must: |
|
| 140 | + |
|
| 141 | +* be defined as a enum element in DetailType |
|
| 142 | +* be added to the list of available items in the constructor of MultiCompetitorRaceChartSettingsComponent |
|
| 143 | + |
|
| 144 | +Further, |
|
| 145 | + |
|
| 146 | +* the DetailTypeFormatter is used to properly render the information label |
|
| 147 | +* the SailingService.getCompetitorRaceDataEntry(...) Method is used to load the specified information |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + |
|
| 134 | 151 | ## Adding a ScoreCorrectionProvider |
| 135 | 152 | External regatta management systems can usually provide the official scores through some electronic interface. These interfaces come with a pull or push transport protocol which may range from direct TCP, HTTP to an FTP file transfer, and a content format which can be anything from a simple CSV format to a complex XML document structure. Using such interfaces results in the capability of importing the official scores as score corrections into our leader boards, thus aligning the tracking results and the official results. |
| 136 | 153 |