├── .gitignore ├── LICENSE ├── README.adoc ├── _config.yml ├── images ├── EQ-value.png ├── chart.png ├── exact-value.png ├── gt_value.png ├── inclusive-exclusive.png ├── login.png ├── map.png ├── network-latency.png ├── range-brackets.png ├── range.png ├── secondary-orering.png ├── simple-ordering.png ├── time-stamp-range.png └── timestamp-range-dialog.png ├── pom.xml └── src └── main ├── java └── net │ └── openhft │ └── chronicle │ └── engine │ └── gui │ ├── AddRow.java │ ├── ChartUI.java │ ├── ChronicleColumnViewResultSet.java │ ├── ColumnQueryDelegate.java │ ├── ColumnViewController.java │ ├── EntryPoint.java │ ├── KeyValueResultSetMetaData.java │ ├── Login.java │ ├── MainControl.java │ ├── MainUI.java │ ├── MapViewUI.java │ ├── MyStatement.java │ ├── QueueViewUI.java │ ├── TimeStampSearch.java │ ├── TreeController.java │ ├── TreeUI.java │ ├── UserControl.java │ └── UserUI.java ├── resources └── net │ └── openhft │ └── chronicle │ └── engine │ └── gui │ ├── Chronicle-Engine_200px.png │ ├── Chronicle-bar-graph_interface-icon.png │ ├── Chronicle-folder_interface-icon.png │ ├── MainUI.html │ ├── MapViewUI.html │ ├── QueueViewUI.html │ ├── TreeUI.html │ ├── UserUI.html │ ├── chart.png │ ├── folder.png │ ├── map.png │ ├── queue.png │ └── trash.png └── webapp └── VAADIN └── themes └── mytheme ├── add.png ├── addons.scss ├── designs.scss ├── favicon.ico ├── mytheme.scss ├── styles.css ├── styles.scss └── trash3.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | # IntelliJ 9 | .idea 10 | *.iml 11 | *.ipr 12 | *.iws 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* 16 | 17 | # Eclipse 18 | .classpath 19 | .project 20 | .settings/ 21 | 22 | # maven 23 | target 24 | #jmh 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Licensed under the *Apache License, Version 2.0* (the "License"); 2 | you may not use this file except in compliance with the License. 3 | You may obtain a copy of the License at 4 | 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | ## Chronicle-Engine-GUI 2 | 3 | // Settings: 4 | :experimental: 5 | :idprefix: 6 | :idseparator: - 7 | ifndef::env-github[:icons: font] 8 | ifdef::env-github,env-browser[] 9 | :toc: macro 10 | :toclevels: 1 11 | endif::[] 12 | ifdef::env-github[] 13 | :status: 14 | :outfilesuffix: .adoc 15 | :!toc-title: 16 | :caution-caption: :fire: 17 | :important-caption: :exclamation: 18 | :note-caption: :paperclip: 19 | :tip-caption: :bulb: 20 | :warning-caption: :warning: 21 | endif::[] 22 | // Aliases: 23 | :project-name: Asciidoctor PDF 24 | :project-handle: asciidoctor-pdf 25 | 26 | toc::[] 27 | 28 | You first have to start a Chronicle Engine, for example, go to the chronicle engine project and run 29 | the main of : 30 | [source, console] 31 | ---- 32 | Chronicle-Engine/src/test/java/net/openhft/chronicle/engine/StartEngineWithDummyData.java 33 | ---- 34 | Now from the Chronicle-Engine-GUI project, start the web based client management console, by starting a jetty application server: 35 | [source, console] 36 | ---- 37 | mvn compile jetty:run 38 | ---- 39 | 40 | Then in your web-browser go to http://localhost:8080, if you are running using "StartEngineWithDummyData" ( see above ), you should be able to just use the defaults below : 41 | 42 | image::images/login.png[] 43 | 44 | click on "Login". 45 | 46 | ## Screenshots 47 | ### Chart 48 | 49 | image::images/chart.png[] 50 | 51 | ### Chronicle Map 52 | image::images/map.png[] 53 | 54 | ### Network Latency 55 | 56 | Network latency charts are only available when using queue replication, to measure network latency requires measuring the round trip time of replication events. Hence, network latency is only recorded for messages that are acknowledged. To see more about chronicle-queue message acknowledgement, see : 57 | 58 | [source, java] 59 | ---- 60 | net.openhft.chronicle.queue.impl.WireStore.lastAcknowledgedIndexReplicated() 61 | ---- 62 | 63 | Queue-Replication is required to create data that can produce network traffic, you can run ( the following : ) 64 | 65 | [source, console] 66 | ---- 67 | Chronicle-Queue-Enterprise/src/test/java/net/openhft/chronicle/engine/StartEngineWithDummyData.java 68 | ---- 69 | 70 | This has to be run from the chronicle-queue-enterprise project ( Note: chronicle-queue-enterprise is a licensed project, if you wish to purchase a licence please contact sales@chronicle.software) 71 | 72 | image::images/network-latency.png[] 73 | 74 | 75 | ### Data Filtering 76 | 77 | Below are some examples for range searching 78 | 79 | 80 | image::images/EQ-value.png[] 81 | a short hand for the above is : 82 | 83 | image::images/exact-value.png[] 84 | 85 | if you want to find all values greater than say " 107.9", you can write this 86 | 87 | image::images/gt_value.png[] 88 | 89 | if you want to also filter it to only show values greater than "107.9" and less than "110" 90 | 91 | image::images/range.png[] 92 | 93 | another way to write the same thing is : 94 | 95 | image::images/range-brackets.png[] 96 | 97 | we also support this inclusive "[" and exclusive "(" formats like below ) 98 | 99 | image::images/inclusive-exclusive.png[] 100 | 101 | The time sample columns that feature a Long ( which is time in UTC milliseconds since epoch ), 102 | can be edited by clicking of the filter box, the following search dialog will appear : 103 | 104 | image::images/timestamp-range-dialog.png[] 105 | 106 | once you click done you will see the UTC milliseconds range that this generates, for example 107 | 108 | image::images/time-stamp-range.png[] 109 | 110 | ### Data Ordering 111 | 112 | If you click on the title this will order the data in your chart, click the title for second time 113 | will rerver the order of the data 114 | 115 | image::images/simple-ordering.png[] 116 | 117 | further more if you click on another title and hold down the SIFT key, you get set up ordering on 118 | both titles at the same time, you can repeat this process across as many columns as you have 119 | 120 | image::images/secondary-orering.png[] 121 | 122 | ### vaadin-charts 123 | 124 | WARNING: this project requires the following artifact 125 | 126 | A licenced version of this artifact can be obtained from https://vaadin.com/framework 127 | 128 | 129 | 130 | [source, console] 131 | ---- 132 | 133 | com.vaadin.addon 134 | vaadin-charts 135 | 3.2.0 136 | 137 | ---- 138 | `` 139 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /images/EQ-value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/EQ-value.png -------------------------------------------------------------------------------- /images/chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/chart.png -------------------------------------------------------------------------------- /images/exact-value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/exact-value.png -------------------------------------------------------------------------------- /images/gt_value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/gt_value.png -------------------------------------------------------------------------------- /images/inclusive-exclusive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/inclusive-exclusive.png -------------------------------------------------------------------------------- /images/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/login.png -------------------------------------------------------------------------------- /images/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/map.png -------------------------------------------------------------------------------- /images/network-latency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/network-latency.png -------------------------------------------------------------------------------- /images/range-brackets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/range-brackets.png -------------------------------------------------------------------------------- /images/range.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/range.png -------------------------------------------------------------------------------- /images/secondary-orering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/secondary-orering.png -------------------------------------------------------------------------------- /images/simple-ordering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/simple-ordering.png -------------------------------------------------------------------------------- /images/time-stamp-range.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/time-stamp-range.png -------------------------------------------------------------------------------- /images/timestamp-range-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/images/timestamp-range-dialog.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | 6 | net.openhft 7 | java-parent-pom 8 | 1.1.24 9 | 10 | 11 | 12 | chronicle-engine-gui 13 | war 14 | 1.0.6-SNAPSHOT 15 | OpenHFT/Chronicle-Engine-GUI 16 | 17 | 18 | 19 | 20 | 21 | com.vaadin 22 | vaadin-bom 23 | 7.7.3 24 | pom 25 | import 26 | 27 | 28 | 29 | net.openhft 30 | third-party-bom 31 | pom 32 | 3.5.9 33 | import 34 | 35 | 36 | 37 | net.openhft 38 | chronicle-bom 39 | 1.16-SNAPSHOT 40 | pom 41 | import 42 | 43 | 44 | 45 | 46 | 47 | 48 | 3 49 | 50 | 51 | 52 | 53 | 54 | chronicle-enterprise-release 55 | 56 | http://nexus.chronicle.software/content/repositories/releases 57 | 58 | 59 | true 60 | 61 | 62 | 63 | Release Repository 64 | Snapshot Repository 65 | https://oss.sonatype.org/content/repositories/releases 66 | 67 | true 68 | 69 | 70 | 71 | Snapshot Repository 72 | Snapshot Repository 73 | https://oss.sonatype.org/content/repositories/snapshots 74 | 75 | true 76 | 77 | 78 | 79 | 80 | vaadin-prereleases 81 | http://maven.vaadin.com/vaadin-prereleases 82 | 83 | 84 | vaadin-snapshots 85 | https://oss.sonatype.org/content/repositories/vaadin-snapshots/ 86 | 87 | false 88 | 89 | 90 | true 91 | 92 | 93 | 94 | chronicle-enterprise-snapshots 95 | Snapshot Repository 96 | 97 | http://nexus.chronicle.software/content/repositories/snapshots 98 | 99 | 100 | true 101 | 102 | 103 | 104 | 105 | vaadin-addons 106 | http://maven.vaadin.com/vaadin-addons 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | net.openhft 115 | chronicle-engine 116 | 117 | 118 | 119 | com.vaadin.addon 120 | vaadin-charts 121 | 122 | 123 | 124 | javax.servlet 125 | javax.servlet-api 126 | provided 127 | 128 | 129 | 130 | software.chronicle 131 | chronicle-queue-enterprise 132 | 133 | 134 | 135 | com.vaadin 136 | vaadin-server 137 | 138 | 139 | 140 | com.vaadin 141 | vaadin-push 142 | 143 | 144 | 145 | com.vaadin 146 | vaadin-client-compiled 147 | 148 | 149 | 150 | com.vaadin 151 | vaadin-themes 152 | 153 | 154 | 155 | org.slf4j 156 | slf4j-api 157 | 158 | 159 | 160 | org.slf4j 161 | slf4j-simple 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | org.apache.maven.plugins 170 | maven-war-plugin 171 | 2.6 172 | 173 | false 174 | 175 | WEB-INF/classes/VAADIN/widgetsets/WEB-INF/** 176 | 177 | 178 | 179 | 180 | com.vaadin 181 | vaadin-maven-plugin 182 | 7.7.3 183 | 184 | 185 | 186 | update-theme 187 | update-widgetset 188 | compile 189 | 190 | compile-theme 191 | 192 | 193 | 194 | 195 | 196 | org.apache.maven.plugins 197 | maven-clean-plugin 198 | 3.0.0 199 | 200 | 201 | 202 | 203 | src/main/webapp/VAADIN/themes 204 | 205 | **/styles.css 206 | **/styles.scss.cache 207 | 208 | 209 | 210 | 211 | 212 | 213 | 215 | 216 | org.eclipse.jetty 217 | jetty-maven-plugin 218 | 9.3.9.v20160517 219 | 220 | 2 221 | 222 | 223 | 224 | org.apache.maven.plugins 225 | maven-compiler-plugin 226 | 227 | 1.8 228 | 1.8 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | vaadin-prerelease 238 | 239 | false 240 | 241 | 242 | 243 | 244 | vaadin-prereleases 245 | http://maven.vaadin.com/vaadin-prereleases 246 | 247 | 248 | vaadin-snapshots 249 | https://oss.sonatype.org/content/repositories/vaadin-snapshots/ 250 | 251 | false 252 | 253 | 254 | true 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | scm:git:git@github.com:OpenHFT/Chronicle-Engine-GUI.git 263 | scm:git:git@github.com:OpenHFT/Chronicle-Engine-GUI.git 264 | scm:git:git@github.com:OpenHFT/Chronicle-Engine-GUI.git 265 | 266 | master 267 | 268 | 269 | 270 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/AddRow.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.data.Validator; 4 | import com.vaadin.server.Sizeable; 5 | import com.vaadin.ui.*; 6 | import net.openhft.chronicle.core.util.ObjectUtils; 7 | import net.openhft.chronicle.engine.api.column.Column; 8 | import net.openhft.chronicle.engine.api.column.ColumnViewInternal; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | import java.util.ArrayList; 12 | import java.util.Date; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | 16 | import static java.util.Collections.EMPTY_MAP; 17 | 18 | /** 19 | * @author Rob Austin. 20 | */ 21 | public class AddRow { 22 | 23 | private ColumnViewInternal columnView; 24 | 25 | public AddRow(ColumnViewInternal columnView) { 26 | this.columnView = columnView; 27 | } 28 | 29 | public void init() { 30 | 31 | // Create a sub-window and set the content 32 | @NotNull Window subWindow = new Window("Add Row"); 33 | subWindow.setClosable(false); 34 | subWindow.setModal(true); 35 | subWindow.setResizeLazy(true); 36 | subWindow.setResizable(false); 37 | subWindow.setSizeUndefined(); 38 | subWindow.setWidth(300, Sizeable.Unit.PIXELS); 39 | subWindow.setDraggable(true); 40 | 41 | @NotNull FormLayout form = new FormLayout(); 42 | form.setMargin(true); 43 | @NotNull ArrayList fields = new ArrayList<>(); 44 | final List columns1 = columnView.columns(); 45 | for (@NotNull Column column : columns1) { 46 | 47 | AbstractField field; 48 | 49 | if (column.type == Date.class) 50 | field = new DateField(column.name); 51 | else if (column.type == boolean.class) 52 | field = new CheckBox(column.name); 53 | else 54 | field = new TextField(column.name); 55 | field.setData(column.type); 56 | fields.add(field); 57 | 58 | if (column.primaryKey) 59 | field.setRequired(true); 60 | if (column.type == Date.class) 61 | field.setValue(new Date()); 62 | else if (column.type == boolean.class) 63 | field.setValue(false); 64 | else if (column.type.isPrimitive() || Number.class.isAssignableFrom(column.type)) 65 | field.setValue(ObjectUtils.convertTo(column.type, 0).toString()); 66 | 67 | field.addValidator((Validator) value -> { 68 | try { 69 | if (column.type == Date.class && (value == null || value.equals(""))) 70 | throw new Validator.InvalidValueException("can not convert to Date"); 71 | if (!(column.type.isAssignableFrom(value.getClass()))) 72 | ObjectUtils.convertTo(column.type, value); 73 | } catch (Exception e) { 74 | throw new Validator.InvalidValueException("can not convert to " + column.type.getSimpleName()); 75 | } 76 | }); 77 | 78 | form.addComponent(field); 79 | } 80 | 81 | @NotNull final HorizontalLayout buttons = new HorizontalLayout(); 82 | buttons.setMargin(true); 83 | buttons.setSpacing(true); 84 | @NotNull final Button cancel = new Button("Cancel"); 85 | cancel.addClickListener((Button.ClickListener) event1 -> subWindow.close()); 86 | buttons.addComponent(cancel); 87 | @NotNull final Button add = new Button("Add"); 88 | add.addClickListener((Button.ClickListener) event1 -> { 89 | 90 | @NotNull final HashMap row = new HashMap<>(); 91 | 92 | for (@NotNull AbstractField field : fields) { 93 | 94 | try { 95 | field.validate(); 96 | } catch (Validator.InvalidValueException e) { 97 | return; 98 | } 99 | row.put(field.getCaption(), ObjectUtils.convertTo((Class) field.getData(), field 100 | .getValue())); 101 | } 102 | columnView.changedRow(row, EMPTY_MAP); 103 | subWindow.close(); 104 | }); 105 | buttons.addComponent(add); 106 | buttons.setComponentAlignment(add, Alignment.MIDDLE_RIGHT); 107 | buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT); 108 | form.addComponent(buttons); 109 | subWindow.setContent(form); 110 | 111 | 112 | // Center it in the browser window 113 | subWindow.center(); 114 | 115 | // Open it in the UI 116 | UI.getCurrent().addWindow(subWindow); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/ChartUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.addon.charts.Chart; 4 | import com.vaadin.addon.charts.model.*; 5 | import com.vaadin.server.Sizeable; 6 | import com.vaadin.ui.Component; 7 | import net.openhft.chronicle.engine.api.column.*; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.function.Function; 14 | 15 | import static java.util.Collections.singletonList; 16 | 17 | @SuppressWarnings("serial") 18 | public class ChartUI { 19 | 20 | 21 | @NotNull 22 | protected Component getChart(@NotNull VaadinChart vaadinChart) { 23 | 24 | final ColumnViewInternal columnView = vaadinChart.columnView(); 25 | @NotNull final Chart chart; 26 | 27 | chart = new Chart(ChartType.COLUMN); 28 | chart.setHeight(100, Sizeable.Unit.PERCENTAGE); 29 | 30 | final Configuration conf = chart.getConfiguration(); 31 | final ChartProperties chartProperties = vaadinChart.chartProperties(); 32 | conf.setTitle(chartProperties.title); 33 | 34 | @Nullable String yAxisLabel = null; 35 | 36 | boolean hasXAxis = false; 37 | 38 | for (@NotNull VaadinChartSeries vaadinChartSeries : vaadinChart.series()) { 39 | 40 | @NotNull final List lables = new ArrayList(); 41 | @NotNull final List data = new ArrayList<>(); 42 | final ClosableIterator iterator = columnView.iterator(sortedFilter(vaadinChart)); 43 | 44 | while (iterator.hasNext()) { 45 | Row row = iterator.next(); 46 | 47 | final Object o = row.get(vaadinChart.columnNameField()); 48 | 49 | final Function xAxisLableRender = chartProperties.xAxisLabelRender; 50 | 51 | if (o != null) { 52 | final String columnName = (xAxisLableRender == null) ? o.toString() : xAxisLableRender 53 | .apply(o); 54 | 55 | lables.add(columnName); 56 | 57 | @NotNull Number number = (Number) row.get(vaadinChartSeries.field); 58 | data.add(new DataSeriesItem(columnName, number)); 59 | } 60 | } 61 | 62 | if (!hasXAxis) { 63 | hasXAxis = true; 64 | @NotNull XAxis x = new XAxis(); 65 | x.setCategories((String[]) lables.toArray(new String[lables.size()])); 66 | conf.addxAxis(x); 67 | } 68 | 69 | @NotNull DataSeries dataSeries = new DataSeries(data); 70 | 71 | switch (vaadinChartSeries.type()) { 72 | case SPLINE: { 73 | dataSeries.setPlotOptions(new PlotOptionsSpline()); 74 | break; 75 | } 76 | 77 | case COLUMN: { 78 | @NotNull PlotOptionsColumn plotOptions = new PlotOptionsColumn(); 79 | plotOptions.setPointWidth(vaadinChartSeries.width()); 80 | dataSeries.setPlotOptions(plotOptions); 81 | break; 82 | } 83 | } 84 | 85 | 86 | final String ylabel = vaadinChartSeries.yAxisLabel(); 87 | 88 | if (ylabel != null && !ylabel.contentEquals("") && (yAxisLabel == null || !yAxisLabel 89 | .equals(ylabel))) { 90 | @NotNull YAxis yAxis = new YAxis(); 91 | yAxis.setTitle(ylabel); 92 | conf.addyAxis(yAxis); 93 | yAxisLabel = ylabel; 94 | } 95 | 96 | dataSeries.setName(vaadinChartSeries.field); 97 | conf.addSeries(dataSeries); 98 | 99 | } 100 | chart.drawChart(conf); 101 | 102 | return chart; 103 | } 104 | 105 | @NotNull 106 | private ColumnViewInternal.SortedFilter sortedFilter(@NotNull final VaadinChart vaadinChart) { 107 | 108 | @NotNull ColumnViewInternal.SortedFilter sortedFilter = new ColumnViewInternal.SortedFilter(); 109 | 110 | long countFromEnd = vaadinChart.chartProperties().countFromEnd; 111 | if (countFromEnd > 0) { 112 | sortedFilter.countFromEnd = countFromEnd; 113 | } 114 | 115 | sortedFilter.marshableOrderBy = singletonList(new ColumnViewInternal 116 | .MarshableOrderBy(vaadinChart.columnNameField())); 117 | 118 | ChartProperties chartProperties = vaadinChart.chartProperties(); 119 | if (chartProperties.filter != null) 120 | sortedFilter.marshableFilters = singletonList(chartProperties.filter); 121 | return sortedFilter; 122 | } 123 | 124 | } -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/ChronicleColumnViewResultSet.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import net.openhft.chronicle.engine.api.column.Column; 4 | import net.openhft.chronicle.engine.api.column.Row; 5 | import org.intellij.lang.annotations.MagicConstant; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import java.io.InputStream; 9 | import java.io.Reader; 10 | import java.math.BigDecimal; 11 | import java.net.URL; 12 | import java.sql.*; 13 | import java.util.Calendar; 14 | import java.util.Iterator; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | * @author Rob Austin. 20 | */ 21 | class ChronicleColumnViewResultSet implements ResultSet { 22 | 23 | @NotNull 24 | private final Iterator iterator; 25 | private final int pagelength; 26 | private Row entry; 27 | private int count = 0; 28 | 29 | @NotNull 30 | private List columns; 31 | 32 | ChronicleColumnViewResultSet(@NotNull Iterator iterator, 33 | int pagelength, 34 | final @NotNull List columns) { 35 | assert iterator.hasNext(); 36 | this.iterator = iterator; 37 | this.pagelength = pagelength; 38 | this.columns = columns; 39 | } 40 | 41 | @Override 42 | public boolean next() throws SQLException { 43 | boolean success = iterator.hasNext() && count < pagelength; 44 | if (success) { 45 | entry = iterator.next(); 46 | count++; 47 | } 48 | return success; 49 | } 50 | 51 | @Override 52 | public void close() throws SQLException { 53 | 54 | } 55 | 56 | @Override 57 | public boolean wasNull() throws SQLException { 58 | throw new UnsupportedOperationException("todo"); 59 | } 60 | 61 | @NotNull 62 | @Override 63 | public String getString(int columnIndex) throws SQLException { 64 | /* if (columnIndex == 1) 65 | return entry.getKey().toString(); 66 | if (columnIndex == 2) 67 | return entry.getValue().toString(); 68 | */ 69 | throw new UnsupportedOperationException(); 70 | } 71 | 72 | @Override 73 | public boolean getBoolean(int columnIndex) throws SQLException { 74 | throw new UnsupportedOperationException("todo"); 75 | } 76 | 77 | @Override 78 | public byte getByte(int columnIndex) throws SQLException { 79 | throw new UnsupportedOperationException("todo"); 80 | } 81 | 82 | @Override 83 | public short getShort(int columnIndex) throws SQLException { 84 | throw new UnsupportedOperationException("todo"); 85 | } 86 | 87 | @Override 88 | public int getInt(int columnIndex) throws SQLException { 89 | throw new UnsupportedOperationException("todo"); 90 | } 91 | 92 | @Override 93 | public long getLong(int columnIndex) throws SQLException { 94 | throw new UnsupportedOperationException("todo"); 95 | } 96 | 97 | @Override 98 | public float getFloat(int columnIndex) throws SQLException { 99 | throw new UnsupportedOperationException("todo"); 100 | } 101 | 102 | @Override 103 | public double getDouble(int columnIndex) throws SQLException { 104 | throw new UnsupportedOperationException("todo"); 105 | } 106 | 107 | @NotNull 108 | @Override 109 | public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { 110 | throw new UnsupportedOperationException("todo"); 111 | } 112 | 113 | @NotNull 114 | @Override 115 | public byte[] getBytes(int columnIndex) throws SQLException { 116 | throw new UnsupportedOperationException("todo"); 117 | } 118 | 119 | @NotNull 120 | @Override 121 | public Date getDate(int columnIndex) throws SQLException { 122 | throw new UnsupportedOperationException("todo"); 123 | } 124 | 125 | @NotNull 126 | @Override 127 | public Time getTime(int columnIndex) throws SQLException { 128 | throw new UnsupportedOperationException("todo"); 129 | } 130 | 131 | @NotNull 132 | @Override 133 | public Timestamp getTimestamp(int columnIndex) throws SQLException { 134 | throw new UnsupportedOperationException("todo"); 135 | } 136 | 137 | @NotNull 138 | @Override 139 | public InputStream getAsciiStream(int columnIndex) throws SQLException { 140 | throw new UnsupportedOperationException("todo"); 141 | } 142 | 143 | @NotNull 144 | @Override 145 | public InputStream getUnicodeStream(int columnIndex) throws SQLException { 146 | throw new UnsupportedOperationException("todo"); 147 | } 148 | 149 | @NotNull 150 | @Override 151 | public InputStream getBinaryStream(int columnIndex) throws SQLException { 152 | throw new UnsupportedOperationException("todo"); 153 | } 154 | 155 | @NotNull 156 | @Override 157 | public String getString(String columnLabel) throws SQLException { 158 | throw new UnsupportedOperationException("todo"); 159 | } 160 | 161 | @Override 162 | public boolean getBoolean(String columnLabel) throws SQLException { 163 | throw new UnsupportedOperationException("todo"); 164 | } 165 | 166 | @Override 167 | public byte getByte(String columnLabel) throws SQLException { 168 | throw new UnsupportedOperationException("todo"); 169 | } 170 | 171 | @Override 172 | public short getShort(String columnLabel) throws SQLException { 173 | throw new UnsupportedOperationException("todo"); 174 | } 175 | 176 | @Override 177 | public int getInt(String columnLabel) throws SQLException { 178 | throw new UnsupportedOperationException("todo"); 179 | } 180 | 181 | @Override 182 | public long getLong(String columnLabel) throws SQLException { 183 | throw new UnsupportedOperationException("todo"); 184 | } 185 | 186 | @Override 187 | public float getFloat(String columnLabel) throws SQLException { 188 | throw new UnsupportedOperationException("todo"); 189 | } 190 | 191 | @Override 192 | public double getDouble(String columnLabel) throws SQLException { 193 | throw new UnsupportedOperationException("todo"); 194 | } 195 | 196 | @NotNull 197 | @Override 198 | public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { 199 | throw new UnsupportedOperationException("todo"); 200 | } 201 | 202 | @NotNull 203 | @Override 204 | public byte[] getBytes(String columnLabel) throws SQLException { 205 | throw new UnsupportedOperationException("todo"); 206 | } 207 | 208 | @NotNull 209 | @Override 210 | public Date getDate(String columnLabel) throws SQLException { 211 | throw new UnsupportedOperationException("todo"); 212 | } 213 | 214 | @NotNull 215 | @Override 216 | public Time getTime(String columnLabel) throws SQLException { 217 | throw new UnsupportedOperationException("todo"); 218 | } 219 | 220 | @NotNull 221 | @Override 222 | public Timestamp getTimestamp(String columnLabel) throws SQLException { 223 | throw new UnsupportedOperationException("todo"); 224 | } 225 | 226 | @NotNull 227 | @Override 228 | public InputStream getAsciiStream(String columnLabel) throws SQLException { 229 | throw new UnsupportedOperationException("todo"); 230 | } 231 | 232 | @NotNull 233 | @Override 234 | public InputStream getUnicodeStream(String columnLabel) throws SQLException { 235 | throw new UnsupportedOperationException("todo"); 236 | } 237 | 238 | @NotNull 239 | @Override 240 | public InputStream getBinaryStream(String columnLabel) throws SQLException { 241 | throw new UnsupportedOperationException("todo"); 242 | } 243 | 244 | @NotNull 245 | @Override 246 | public SQLWarning getWarnings() throws SQLException { 247 | throw new UnsupportedOperationException("todo"); 248 | } 249 | 250 | @Override 251 | public void clearWarnings() throws SQLException { 252 | throw new UnsupportedOperationException("todo"); 253 | } 254 | 255 | @NotNull 256 | @Override 257 | public String getCursorName() throws SQLException { 258 | throw new UnsupportedOperationException("todo"); 259 | } 260 | 261 | @NotNull 262 | @Override 263 | public ResultSetMetaData getMetaData() throws SQLException { 264 | return new KeyValueResultSetMetaData(columns); 265 | } 266 | 267 | @Override 268 | public Object getObject(int columnIndex) throws SQLException { 269 | return entry.get(columnIndex - 1); 270 | } 271 | 272 | @Override 273 | public Object getObject(String columnLabel) throws SQLException { 274 | return entry.get(columnLabel); 275 | } 276 | 277 | @Override 278 | public int findColumn(String columnLabel) throws SQLException { 279 | throw new UnsupportedOperationException("todo"); 280 | } 281 | 282 | @NotNull 283 | @Override 284 | public Reader getCharacterStream(int columnIndex) throws SQLException { 285 | throw new UnsupportedOperationException("todo"); 286 | } 287 | 288 | @NotNull 289 | @Override 290 | public Reader getCharacterStream(String columnLabel) throws SQLException { 291 | throw new UnsupportedOperationException("todo"); 292 | } 293 | 294 | @NotNull 295 | @Override 296 | public BigDecimal getBigDecimal(int columnIndex) throws SQLException { 297 | throw new UnsupportedOperationException("todo"); 298 | } 299 | 300 | @NotNull 301 | @Override 302 | public BigDecimal getBigDecimal(String columnLabel) throws SQLException { 303 | throw new UnsupportedOperationException("todo"); 304 | } 305 | 306 | @Override 307 | public boolean isBeforeFirst() throws SQLException { 308 | throw new UnsupportedOperationException("todo"); 309 | } 310 | 311 | @Override 312 | public boolean isAfterLast() throws SQLException { 313 | throw new UnsupportedOperationException("todo"); 314 | } 315 | 316 | @Override 317 | public boolean isFirst() throws SQLException { 318 | throw new UnsupportedOperationException("todo"); 319 | } 320 | 321 | @Override 322 | public boolean isLast() throws SQLException { 323 | throw new UnsupportedOperationException("todo"); 324 | } 325 | 326 | @Override 327 | public void beforeFirst() throws SQLException { 328 | throw new UnsupportedOperationException("todo"); 329 | } 330 | 331 | @Override 332 | public void afterLast() throws SQLException { 333 | throw new UnsupportedOperationException("todo"); 334 | } 335 | 336 | @Override 337 | public boolean first() throws SQLException { 338 | throw new UnsupportedOperationException("todo"); 339 | } 340 | 341 | @Override 342 | public boolean last() throws SQLException { 343 | throw new UnsupportedOperationException("todo"); 344 | } 345 | 346 | @Override 347 | public int getRow() throws SQLException { 348 | throw new UnsupportedOperationException("todo"); 349 | } 350 | 351 | @Override 352 | public boolean absolute(int row) throws SQLException { 353 | throw new UnsupportedOperationException("todo"); 354 | } 355 | 356 | @Override 357 | public boolean relative(int rows) throws SQLException { 358 | throw new UnsupportedOperationException("todo"); 359 | } 360 | 361 | @Override 362 | public boolean previous() throws SQLException { 363 | throw new UnsupportedOperationException("todo"); 364 | } 365 | 366 | @Override 367 | public void setFetchDirection(@MagicConstant(intValues = {ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, ResultSet.FETCH_UNKNOWN}) int direction) throws SQLException { 368 | throw new UnsupportedOperationException("todo"); 369 | } 370 | 371 | @Override 372 | public int getFetchDirection() throws SQLException { 373 | throw new UnsupportedOperationException("todo"); 374 | } 375 | 376 | @Override 377 | public void setFetchSize(int rows) throws SQLException { 378 | throw new UnsupportedOperationException("todo"); 379 | } 380 | 381 | @Override 382 | public int getFetchSize() throws SQLException { 383 | throw new UnsupportedOperationException("todo"); 384 | } 385 | 386 | @Override 387 | public int getType() throws SQLException { 388 | throw new UnsupportedOperationException("todo"); 389 | } 390 | 391 | @Override 392 | public int getConcurrency() throws SQLException { 393 | throw new UnsupportedOperationException("todo"); 394 | } 395 | 396 | @Override 397 | public boolean rowUpdated() throws SQLException { 398 | throw new UnsupportedOperationException("todo"); 399 | } 400 | 401 | @Override 402 | public boolean rowInserted() throws SQLException { 403 | throw new UnsupportedOperationException("todo"); 404 | } 405 | 406 | @Override 407 | public boolean rowDeleted() throws SQLException { 408 | throw new UnsupportedOperationException("todo"); 409 | } 410 | 411 | @Override 412 | public void updateNull(int columnIndex) throws SQLException { 413 | throw new UnsupportedOperationException("todo"); 414 | } 415 | 416 | @Override 417 | public void updateBoolean(int columnIndex, boolean x) throws SQLException { 418 | throw new UnsupportedOperationException("todo"); 419 | } 420 | 421 | @Override 422 | public void updateByte(int columnIndex, byte x) throws SQLException { 423 | throw new UnsupportedOperationException("todo"); 424 | } 425 | 426 | @Override 427 | public void updateShort(int columnIndex, short x) throws SQLException { 428 | throw new UnsupportedOperationException("todo"); 429 | } 430 | 431 | @Override 432 | public void updateInt(int columnIndex, int x) throws SQLException { 433 | throw new UnsupportedOperationException("todo"); 434 | } 435 | 436 | @Override 437 | public void updateLong(int columnIndex, long x) throws SQLException { 438 | throw new UnsupportedOperationException("todo"); 439 | } 440 | 441 | @Override 442 | public void updateFloat(int columnIndex, float x) throws SQLException { 443 | throw new UnsupportedOperationException("todo"); 444 | } 445 | 446 | @Override 447 | public void updateDouble(int columnIndex, double x) throws SQLException { 448 | throw new UnsupportedOperationException("todo"); 449 | } 450 | 451 | @Override 452 | public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { 453 | throw new UnsupportedOperationException("todo"); 454 | } 455 | 456 | @Override 457 | public void updateString(int columnIndex, String x) throws SQLException { 458 | throw new UnsupportedOperationException("todo"); 459 | } 460 | 461 | @Override 462 | public void updateBytes(int columnIndex, byte[] x) throws SQLException { 463 | throw new UnsupportedOperationException("todo"); 464 | } 465 | 466 | @Override 467 | public void updateDate(int columnIndex, Date x) throws SQLException { 468 | throw new UnsupportedOperationException("todo"); 469 | } 470 | 471 | @Override 472 | public void updateTime(int columnIndex, Time x) throws SQLException { 473 | throw new UnsupportedOperationException("todo"); 474 | } 475 | 476 | @Override 477 | public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { 478 | throw new UnsupportedOperationException("todo"); 479 | } 480 | 481 | @Override 482 | public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { 483 | throw new UnsupportedOperationException("todo"); 484 | } 485 | 486 | @Override 487 | public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { 488 | throw new UnsupportedOperationException("todo"); 489 | } 490 | 491 | @Override 492 | public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { 493 | throw new UnsupportedOperationException("todo"); 494 | } 495 | 496 | @Override 497 | public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { 498 | throw new UnsupportedOperationException("todo"); 499 | } 500 | 501 | @Override 502 | public void updateObject(int columnIndex, Object x) throws SQLException { 503 | throw new UnsupportedOperationException("todo"); 504 | } 505 | 506 | @Override 507 | public void updateNull(String columnLabel) throws SQLException { 508 | throw new UnsupportedOperationException("todo"); 509 | } 510 | 511 | @Override 512 | public void updateBoolean(String columnLabel, boolean x) throws SQLException { 513 | throw new UnsupportedOperationException("todo"); 514 | } 515 | 516 | @Override 517 | public void updateByte(String columnLabel, byte x) throws SQLException { 518 | throw new UnsupportedOperationException("todo"); 519 | } 520 | 521 | @Override 522 | public void updateShort(String columnLabel, short x) throws SQLException { 523 | throw new UnsupportedOperationException("todo"); 524 | } 525 | 526 | @Override 527 | public void updateInt(String columnLabel, int x) throws SQLException { 528 | throw new UnsupportedOperationException("todo"); 529 | } 530 | 531 | @Override 532 | public void updateLong(String columnLabel, long x) throws SQLException { 533 | throw new UnsupportedOperationException("todo"); 534 | } 535 | 536 | @Override 537 | public void updateFloat(String columnLabel, float x) throws SQLException { 538 | throw new UnsupportedOperationException("todo"); 539 | } 540 | 541 | @Override 542 | public void updateDouble(String columnLabel, double x) throws SQLException { 543 | throw new UnsupportedOperationException("todo"); 544 | } 545 | 546 | @Override 547 | public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { 548 | throw new UnsupportedOperationException("todo"); 549 | } 550 | 551 | @Override 552 | public void updateString(String columnLabel, String x) throws SQLException { 553 | throw new UnsupportedOperationException("todo"); 554 | } 555 | 556 | @Override 557 | public void updateBytes(String columnLabel, byte[] x) throws SQLException { 558 | throw new UnsupportedOperationException("todo"); 559 | } 560 | 561 | @Override 562 | public void updateDate(String columnLabel, Date x) throws SQLException { 563 | throw new UnsupportedOperationException("todo"); 564 | } 565 | 566 | @Override 567 | public void updateTime(String columnLabel, Time x) throws SQLException { 568 | throw new UnsupportedOperationException("todo"); 569 | } 570 | 571 | @Override 572 | public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { 573 | throw new UnsupportedOperationException("todo"); 574 | } 575 | 576 | @Override 577 | public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { 578 | throw new UnsupportedOperationException("todo"); 579 | } 580 | 581 | @Override 582 | public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { 583 | throw new UnsupportedOperationException("todo"); 584 | } 585 | 586 | @Override 587 | public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { 588 | throw new UnsupportedOperationException("todo"); 589 | } 590 | 591 | @Override 592 | public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { 593 | throw new UnsupportedOperationException("todo"); 594 | } 595 | 596 | @Override 597 | public void updateObject(String columnLabel, Object x) throws SQLException { 598 | throw new UnsupportedOperationException("todo"); 599 | } 600 | 601 | @Override 602 | public void insertRow() throws SQLException { 603 | throw new UnsupportedOperationException("todo"); 604 | } 605 | 606 | @Override 607 | public void updateRow() throws SQLException { 608 | throw new UnsupportedOperationException("todo"); 609 | } 610 | 611 | @Override 612 | public void deleteRow() throws SQLException { 613 | throw new UnsupportedOperationException("todo"); 614 | } 615 | 616 | @Override 617 | public void refreshRow() throws SQLException { 618 | throw new UnsupportedOperationException("todo"); 619 | } 620 | 621 | @Override 622 | public void cancelRowUpdates() throws SQLException { 623 | throw new UnsupportedOperationException("todo"); 624 | } 625 | 626 | @Override 627 | public void moveToInsertRow() throws SQLException { 628 | throw new UnsupportedOperationException("todo"); 629 | } 630 | 631 | @Override 632 | public void moveToCurrentRow() throws SQLException { 633 | throw new UnsupportedOperationException("todo"); 634 | } 635 | 636 | @NotNull 637 | @Override 638 | public Statement getStatement() throws SQLException { 639 | return new MyStatement(); 640 | } 641 | 642 | @NotNull 643 | @Override 644 | public Object getObject(int columnIndex, Map> map) throws SQLException { 645 | throw new UnsupportedOperationException("todo"); 646 | } 647 | 648 | @NotNull 649 | @Override 650 | public Ref getRef(int columnIndex) throws SQLException { 651 | throw new UnsupportedOperationException("todo"); 652 | } 653 | 654 | @NotNull 655 | @Override 656 | public Blob getBlob(int columnIndex) throws SQLException { 657 | throw new UnsupportedOperationException("todo"); 658 | } 659 | 660 | @NotNull 661 | @Override 662 | public Clob getClob(int columnIndex) throws SQLException { 663 | throw new UnsupportedOperationException("todo"); 664 | } 665 | 666 | @NotNull 667 | @Override 668 | public Array getArray(int columnIndex) throws SQLException { 669 | throw new UnsupportedOperationException("todo"); 670 | } 671 | 672 | @NotNull 673 | @Override 674 | public Object getObject(String columnLabel, Map> map) throws SQLException { 675 | throw new UnsupportedOperationException("todo"); 676 | } 677 | 678 | @NotNull 679 | @Override 680 | public Ref getRef(String columnLabel) throws SQLException { 681 | throw new UnsupportedOperationException("todo"); 682 | } 683 | 684 | @NotNull 685 | @Override 686 | public Blob getBlob(String columnLabel) throws SQLException { 687 | throw new UnsupportedOperationException("todo"); 688 | } 689 | 690 | @NotNull 691 | @Override 692 | public Clob getClob(String columnLabel) throws SQLException { 693 | throw new UnsupportedOperationException("todo"); 694 | } 695 | 696 | @NotNull 697 | @Override 698 | public Array getArray(String columnLabel) throws SQLException { 699 | throw new UnsupportedOperationException("todo"); 700 | } 701 | 702 | @NotNull 703 | @Override 704 | public Date getDate(int columnIndex, Calendar cal) throws SQLException { 705 | throw new UnsupportedOperationException("todo"); 706 | } 707 | 708 | @NotNull 709 | @Override 710 | public Date getDate(String columnLabel, Calendar cal) throws SQLException { 711 | throw new UnsupportedOperationException("todo"); 712 | } 713 | 714 | @NotNull 715 | @Override 716 | public Time getTime(int columnIndex, Calendar cal) throws SQLException { 717 | throw new UnsupportedOperationException("todo"); 718 | } 719 | 720 | @NotNull 721 | @Override 722 | public Time getTime(String columnLabel, Calendar cal) throws SQLException { 723 | throw new UnsupportedOperationException("todo"); 724 | } 725 | 726 | @NotNull 727 | @Override 728 | public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { 729 | throw new UnsupportedOperationException("todo"); 730 | } 731 | 732 | @NotNull 733 | @Override 734 | public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { 735 | throw new UnsupportedOperationException("todo"); 736 | } 737 | 738 | @NotNull 739 | @Override 740 | public URL getURL(int columnIndex) throws SQLException { 741 | throw new UnsupportedOperationException("todo"); 742 | } 743 | 744 | @NotNull 745 | @Override 746 | public URL getURL(String columnLabel) throws SQLException { 747 | throw new UnsupportedOperationException("todo"); 748 | } 749 | 750 | @Override 751 | public void updateRef(int columnIndex, Ref x) throws SQLException { 752 | throw new UnsupportedOperationException("todo"); 753 | } 754 | 755 | @Override 756 | public void updateRef(String columnLabel, Ref x) throws SQLException { 757 | throw new UnsupportedOperationException("todo"); 758 | } 759 | 760 | @Override 761 | public void updateBlob(int columnIndex, Blob x) throws SQLException { 762 | throw new UnsupportedOperationException("todo"); 763 | } 764 | 765 | @Override 766 | public void updateBlob(String columnLabel, Blob x) throws SQLException { 767 | throw new UnsupportedOperationException("todo"); 768 | } 769 | 770 | @Override 771 | public void updateClob(int columnIndex, Clob x) throws SQLException { 772 | throw new UnsupportedOperationException("todo"); 773 | } 774 | 775 | @Override 776 | public void updateClob(String columnLabel, Clob x) throws SQLException { 777 | throw new UnsupportedOperationException("todo"); 778 | } 779 | 780 | @Override 781 | public void updateArray(int columnIndex, Array x) throws SQLException { 782 | throw new UnsupportedOperationException("todo"); 783 | } 784 | 785 | @Override 786 | public void updateArray(String columnLabel, Array x) throws SQLException { 787 | throw new UnsupportedOperationException("todo"); 788 | } 789 | 790 | @NotNull 791 | @Override 792 | public RowId getRowId(int columnIndex) throws SQLException { 793 | throw new UnsupportedOperationException("todo"); 794 | } 795 | 796 | @NotNull 797 | @Override 798 | public RowId getRowId(String columnLabel) throws SQLException { 799 | throw new UnsupportedOperationException("todo"); 800 | } 801 | 802 | @Override 803 | public void updateRowId(int columnIndex, RowId x) throws SQLException { 804 | throw new UnsupportedOperationException("todo"); 805 | } 806 | 807 | @Override 808 | public void updateRowId(String columnLabel, RowId x) throws SQLException { 809 | throw new UnsupportedOperationException("todo"); 810 | } 811 | 812 | @Override 813 | public int getHoldability() throws SQLException { 814 | throw new UnsupportedOperationException("todo"); 815 | } 816 | 817 | @Override 818 | public boolean isClosed() throws SQLException { 819 | throw new UnsupportedOperationException("todo"); 820 | } 821 | 822 | @Override 823 | public void updateNString(int columnIndex, String nString) throws SQLException { 824 | throw new UnsupportedOperationException("todo"); 825 | } 826 | 827 | @Override 828 | public void updateNString(String columnLabel, String nString) throws SQLException { 829 | throw new UnsupportedOperationException("todo"); 830 | } 831 | 832 | @Override 833 | public void updateNClob(int columnIndex, NClob nClob) throws SQLException { 834 | throw new UnsupportedOperationException("todo"); 835 | } 836 | 837 | @Override 838 | public void updateNClob(String columnLabel, NClob nClob) throws SQLException { 839 | throw new UnsupportedOperationException("todo"); 840 | } 841 | 842 | @NotNull 843 | @Override 844 | public NClob getNClob(int columnIndex) throws SQLException { 845 | throw new UnsupportedOperationException("todo"); 846 | } 847 | 848 | @NotNull 849 | @Override 850 | public NClob getNClob(String columnLabel) throws SQLException { 851 | throw new UnsupportedOperationException("todo"); 852 | } 853 | 854 | @NotNull 855 | @Override 856 | public SQLXML getSQLXML(int columnIndex) throws SQLException { 857 | throw new UnsupportedOperationException("todo"); 858 | } 859 | 860 | @NotNull 861 | @Override 862 | public SQLXML getSQLXML(String columnLabel) throws SQLException { 863 | throw new UnsupportedOperationException("todo"); 864 | } 865 | 866 | @Override 867 | public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { 868 | throw new UnsupportedOperationException("todo"); 869 | } 870 | 871 | @Override 872 | public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { 873 | throw new UnsupportedOperationException("todo"); 874 | } 875 | 876 | @NotNull 877 | @Override 878 | public String getNString(int columnIndex) throws SQLException { 879 | throw new UnsupportedOperationException("todo"); 880 | } 881 | 882 | @NotNull 883 | @Override 884 | public String getNString(String columnLabel) throws SQLException { 885 | throw new UnsupportedOperationException("todo"); 886 | } 887 | 888 | @NotNull 889 | @Override 890 | public Reader getNCharacterStream(int columnIndex) throws SQLException { 891 | throw new UnsupportedOperationException("todo"); 892 | } 893 | 894 | @NotNull 895 | @Override 896 | public Reader getNCharacterStream(String columnLabel) throws SQLException { 897 | throw new UnsupportedOperationException("todo"); 898 | } 899 | 900 | @Override 901 | public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { 902 | throw new UnsupportedOperationException("todo"); 903 | } 904 | 905 | @Override 906 | public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { 907 | throw new UnsupportedOperationException("todo"); 908 | } 909 | 910 | @Override 911 | public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { 912 | throw new UnsupportedOperationException("todo"); 913 | } 914 | 915 | @Override 916 | public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { 917 | throw new UnsupportedOperationException("todo"); 918 | } 919 | 920 | @Override 921 | public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { 922 | throw new UnsupportedOperationException("todo"); 923 | } 924 | 925 | @Override 926 | public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { 927 | throw new UnsupportedOperationException("todo"); 928 | } 929 | 930 | @Override 931 | public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { 932 | throw new UnsupportedOperationException("todo"); 933 | } 934 | 935 | @Override 936 | public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { 937 | throw new UnsupportedOperationException("todo"); 938 | } 939 | 940 | @Override 941 | public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { 942 | throw new UnsupportedOperationException("todo"); 943 | } 944 | 945 | @Override 946 | public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { 947 | throw new UnsupportedOperationException("todo"); 948 | } 949 | 950 | @Override 951 | public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { 952 | throw new UnsupportedOperationException("todo"); 953 | } 954 | 955 | @Override 956 | public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { 957 | throw new UnsupportedOperationException("todo"); 958 | } 959 | 960 | @Override 961 | public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { 962 | throw new UnsupportedOperationException("todo"); 963 | } 964 | 965 | @Override 966 | public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { 967 | throw new UnsupportedOperationException("todo"); 968 | } 969 | 970 | @Override 971 | public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { 972 | throw new UnsupportedOperationException("todo"); 973 | } 974 | 975 | @Override 976 | public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { 977 | throw new UnsupportedOperationException("todo"); 978 | } 979 | 980 | @Override 981 | public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { 982 | throw new UnsupportedOperationException("todo"); 983 | } 984 | 985 | @Override 986 | public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { 987 | throw new UnsupportedOperationException("todo"); 988 | } 989 | 990 | @Override 991 | public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { 992 | throw new UnsupportedOperationException("todo"); 993 | } 994 | 995 | @Override 996 | public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { 997 | throw new UnsupportedOperationException("todo"); 998 | } 999 | 1000 | @Override 1001 | public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { 1002 | throw new UnsupportedOperationException("todo"); 1003 | } 1004 | 1005 | @Override 1006 | public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { 1007 | throw new UnsupportedOperationException("todo"); 1008 | } 1009 | 1010 | @Override 1011 | public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { 1012 | throw new UnsupportedOperationException("todo"); 1013 | } 1014 | 1015 | @Override 1016 | public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { 1017 | throw new UnsupportedOperationException("todo"); 1018 | } 1019 | 1020 | @Override 1021 | public void updateClob(int columnIndex, Reader reader) throws SQLException { 1022 | throw new UnsupportedOperationException("todo"); 1023 | } 1024 | 1025 | @Override 1026 | public void updateClob(String columnLabel, Reader reader) throws SQLException { 1027 | throw new UnsupportedOperationException("todo"); 1028 | } 1029 | 1030 | @Override 1031 | public void updateNClob(int columnIndex, Reader reader) throws SQLException { 1032 | throw new UnsupportedOperationException("todo"); 1033 | } 1034 | 1035 | @Override 1036 | public void updateNClob(String columnLabel, Reader reader) throws SQLException { 1037 | throw new UnsupportedOperationException("todo"); 1038 | } 1039 | 1040 | @NotNull 1041 | @Override 1042 | public T getObject(int columnIndex, Class type) throws SQLException { 1043 | throw new UnsupportedOperationException("todo"); 1044 | } 1045 | 1046 | @NotNull 1047 | @Override 1048 | public T getObject(String columnLabel, Class type) throws SQLException { 1049 | throw new UnsupportedOperationException("todo"); 1050 | } 1051 | 1052 | @NotNull 1053 | @Override 1054 | public T unwrap(Class iface) throws SQLException { 1055 | throw new UnsupportedOperationException("todo"); 1056 | } 1057 | 1058 | @Override 1059 | public boolean isWrapperFor(Class iface) throws SQLException { 1060 | throw new UnsupportedOperationException("todo"); 1061 | } 1062 | } 1063 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/ColumnQueryDelegate.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.data.Container; 4 | import com.vaadin.data.util.filter.SimpleStringFilter; 5 | import com.vaadin.data.util.sqlcontainer.ColumnProperty; 6 | import com.vaadin.data.util.sqlcontainer.RowItem; 7 | import com.vaadin.data.util.sqlcontainer.query.OrderBy; 8 | import com.vaadin.data.util.sqlcontainer.query.QueryDelegate; 9 | import net.openhft.chronicle.engine.api.column.Column; 10 | import net.openhft.chronicle.engine.api.column.ColumnViewInternal; 11 | import net.openhft.chronicle.engine.api.column.Row; 12 | import org.jetbrains.annotations.NotNull; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | import java.sql.ResultSet; 16 | import java.sql.SQLException; 17 | import java.util.*; 18 | import java.util.stream.Collectors; 19 | 20 | import static net.openhft.chronicle.engine.api.column.ColumnViewInternal.*; 21 | 22 | /** 23 | * @author Rob Austin. 24 | */ 25 | class ColumnQueryDelegate implements QueryDelegate { 26 | 27 | @NotNull 28 | private final ColumnViewInternal columnView; 29 | @NotNull 30 | private List filters = Collections.emptyList(); 31 | @NotNull 32 | private List orderBys = Collections.emptyList(); 33 | 34 | ColumnQueryDelegate(@NotNull ColumnViewInternal columnView) { 35 | this.columnView = columnView; 36 | } 37 | 38 | @Override 39 | public int getCount() throws SQLException { 40 | 41 | if (filters.isEmpty() && orderBys.isEmpty()) 42 | return columnView.rowCount(new SortedFilter()); 43 | 44 | @NotNull final SortedFilter sortedFilter = new SortedFilter(); 45 | sortedFilter.marshableFilters = toMarshables(filters); 46 | return columnView.rowCount(sortedFilter); 47 | } 48 | 49 | @NotNull 50 | @Override 51 | public ResultSet getResults(int offset, int pageLength) throws SQLException { 52 | return new ChronicleColumnViewResultSet(newIterator(offset), pageLength, columnView.columns()); 53 | } 54 | 55 | 56 | @Override 57 | public boolean implementationRespectsPagingLimits() { 58 | return true; 59 | } 60 | 61 | @Override 62 | public void setFilters(@Nullable List filters) throws UnsupportedOperationException { 63 | 64 | if (filters == null) 65 | filters = Collections.emptyList(); 66 | 67 | if (this.filters.equals(filters)) 68 | return; 69 | 70 | this.filters = filters; 71 | } 72 | 73 | private Iterator newIterator(int fromIndex) { 74 | @NotNull SortedFilter sortedFilter = toQuery(fromIndex, filters); 75 | return columnView.iterator(sortedFilter); 76 | } 77 | 78 | @NotNull 79 | private SortedFilter toQuery(int fromIndex, @NotNull List filters) { 80 | @NotNull final SortedFilter sortedFilter = new SortedFilter(); 81 | sortedFilter.fromIndex = fromIndex; 82 | sortedFilter.marshableFilters.clear(); 83 | sortedFilter.marshableFilters.addAll(toMarshables(filters)); 84 | 85 | for (@NotNull OrderBy orderBy : orderBys) { 86 | sortedFilter.marshableOrderBy.add(toMarshables(orderBy)); 87 | } 88 | 89 | return sortedFilter; 90 | } 91 | 92 | /** 93 | * converts a vaadin filter to a marshable filter 94 | * 95 | * @param filters the vaadin filter 96 | * @return the marshable filter 97 | */ 98 | @NotNull 99 | private List toMarshables(@NotNull List 100 | filters) { 101 | @NotNull ArrayList result = new ArrayList<>(); 102 | for (Container.Filter filter0 : filters) { 103 | if (filter0 instanceof SimpleStringFilter) { 104 | @NotNull SimpleStringFilter filter = (SimpleStringFilter) filter0; 105 | result.add(new MarshableFilter(filter.getPropertyId().toString(), 106 | filter.getFilterString())); 107 | } 108 | } 109 | 110 | return result; 111 | } 112 | 113 | 114 | @NotNull 115 | private MarshableOrderBy toMarshables(@NotNull OrderBy orderBy) { 116 | return new MarshableOrderBy(orderBy.getColumn(), orderBy.isAscending()); 117 | } 118 | 119 | @Override 120 | public void setOrderBy(@Nullable List orderBys) throws UnsupportedOperationException { 121 | @Nullable final List orderBys0 = (orderBys == null) ? Collections.EMPTY_LIST : orderBys; 122 | 123 | if (orderBys0 == null) { 124 | this.orderBys = Collections.emptyList(); 125 | return; 126 | } 127 | 128 | if (orderBys0.equals(this.orderBys)) 129 | return; 130 | 131 | this.orderBys = orderBys0; 132 | } 133 | 134 | /** 135 | * Stores a row in the database. The implementation of this interface 136 | * decides how to identify whether to store a new row or update an existing 137 | * one. 138 | * 139 | * @param row A map containing the values for all columns to be stored or updated. 140 | * @return the number of affected rows in the database table 141 | * @throws UnsupportedOperationException if the implementation is read only. 142 | */ 143 | @Override 144 | public int storeRow(@NotNull RowItem row) throws UnsupportedOperationException, SQLException { 145 | 146 | @NotNull final Map oldRow = new HashMap<>(); 147 | @NotNull final Map newRow = new HashMap<>(); 148 | 149 | for (@NotNull Column c : columnView.columns()) { 150 | @NotNull final ColumnProperty cp = (ColumnProperty) row.getItemProperty(c.name); 151 | newRow.put(c.name, cp.getValue()); 152 | oldRow.put(c.name, cp.getOldValue()); 153 | } 154 | 155 | return columnView.changedRow(newRow, oldRow); 156 | } 157 | 158 | @Override 159 | public boolean removeRow(@NotNull RowItem row) throws UnsupportedOperationException, SQLException { 160 | 161 | @NotNull final Map oldRow = new HashMap<>(); 162 | 163 | for (@NotNull Column c : columnView.columns()) { 164 | @NotNull final ColumnProperty cp = (ColumnProperty) row.getItemProperty(c.name); 165 | oldRow.put(c.name, cp.getOldValue()); 166 | } 167 | 168 | return columnView.changedRow(Collections.emptyMap(), oldRow) == 1; 169 | } 170 | 171 | @Override 172 | public void beginTransaction() throws SQLException { 173 | 174 | } 175 | 176 | @Override 177 | public void commit() throws SQLException { 178 | 179 | } 180 | 181 | @Override 182 | public void rollback() throws SQLException { 183 | 184 | } 185 | 186 | @Override 187 | public List getPrimaryKeyColumns() { 188 | return columnView.columns().stream() 189 | .filter(c -> c.primaryKey).map(c -> c.name) 190 | .collect(Collectors.toList()); 191 | } 192 | 193 | public boolean containsRowWithKey(@NotNull Object... keys) throws SQLException { 194 | if (keys.length == 0) 195 | return false; 196 | return columnView.containsRowWithKey(Arrays.asList(keys)); 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/ColumnViewController.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.data.Container; 4 | import com.vaadin.data.Item; 5 | import com.vaadin.data.util.GeneratedPropertyContainer; 6 | import com.vaadin.data.util.PropertyValueGenerator; 7 | import com.vaadin.data.util.converter.Converter; 8 | import com.vaadin.data.util.filter.SimpleStringFilter; 9 | import com.vaadin.data.util.sqlcontainer.SQLContainer; 10 | import com.vaadin.data.util.sqlcontainer.query.QueryDelegate; 11 | import com.vaadin.event.FieldEvents; 12 | import com.vaadin.server.Resource; 13 | import com.vaadin.server.Sizeable; 14 | import com.vaadin.server.ThemeResource; 15 | import com.vaadin.ui.Button.ClickListener; 16 | import com.vaadin.ui.Grid; 17 | import com.vaadin.ui.TextField; 18 | import com.vaadin.ui.UI; 19 | import com.vaadin.ui.renderers.ImageRenderer; 20 | import com.vaadin.ui.renderers.NumberRenderer; 21 | import com.vaadin.ui.renderers.TextRenderer; 22 | import net.openhft.chronicle.core.Jvm; 23 | import net.openhft.chronicle.engine.api.column.Column; 24 | import net.openhft.chronicle.engine.api.column.ColumnViewInternal; 25 | import net.openhft.chronicle.engine.map.ObjectSubscription; 26 | import org.jetbrains.annotations.NotNull; 27 | import org.jetbrains.annotations.Nullable; 28 | 29 | import java.sql.SQLException; 30 | import java.text.DecimalFormat; 31 | import java.time.Instant; 32 | import java.time.LocalDateTime; 33 | import java.time.ZoneOffset; 34 | import java.util.*; 35 | import java.util.concurrent.atomic.AtomicLong; 36 | 37 | import static com.vaadin.ui.AbstractTextField.TextChangeEventMode.EAGER; 38 | import static com.vaadin.ui.Grid.HeaderCell; 39 | import static com.vaadin.ui.Grid.HeaderRow; 40 | 41 | /** 42 | * @author Rob Austin. 43 | */ 44 | class ColumnViewController { 45 | 46 | @NotNull 47 | private final ColumnViewInternal columnView; 48 | @NotNull 49 | private final MapViewUI view; 50 | 51 | @NotNull 52 | private final DecimalFormat removeFormatting; 53 | 54 | ColumnViewController(@NotNull ColumnViewInternal columnView, @NotNull MapViewUI view, String path) { 55 | this.columnView = columnView; 56 | this.view = view; 57 | 58 | 59 | view.path.setValue(path); 60 | view.recordCount.setValue(Long.toString(columnView.rowCount(new ColumnViewInternal.SortedFilter()))); 61 | 62 | final ObjectSubscription objectSubscription = columnView.objectSubscription(); 63 | onChange(view, objectSubscription); 64 | 65 | removeFormatting = new DecimalFormat(); 66 | removeFormatting.setGroupingUsed(false); 67 | } 68 | 69 | class TextChangeListener implements FieldEvents.TextChangeListener { 70 | 71 | private Container.Filterable filterable; 72 | private Object pid; 73 | 74 | public TextChangeListener(Container.Filterable filterable, Object pid, final TextField filterField) { 75 | this.filterable = filterable; 76 | this.pid = pid; 77 | } 78 | 79 | @Override 80 | public void textChange(@NotNull FieldEvents.TextChangeEvent change) { 81 | // Can't modify filters so need to replace 82 | // data.removeContainerFilters(pid); 83 | 84 | @NotNull final Collection containerFilters = (Collection) 85 | filterable.getContainerFilters(); 86 | 87 | Optional first = containerFilters.stream().filter(x -> x.getPropertyId().equals(pid)).findFirst(); 88 | if (first.isPresent()) 89 | filterable.removeContainerFilter(first.get()); 90 | 91 | // (Re)create the filter if necessary 92 | if (!change.getText().isEmpty()) { 93 | filterable.addContainerFilter( 94 | new SimpleStringFilter(pid, change.getText(), true, false)); 95 | 96 | } 97 | } 98 | } 99 | 100 | class FocusListener implements FieldEvents.FocusListener { 101 | 102 | 103 | @Nullable 104 | private final TimeStampSearch timeStampSearch; 105 | 106 | public FocusListener(@NotNull final TextField filterField, 107 | FieldEvents.TextChangeListener textChangeListener) { 108 | timeStampSearch = new TimeStampSearch(filterField, textChangeListener); 109 | } 110 | 111 | @Override 112 | public void focus(FieldEvents.FocusEvent event) { 113 | 114 | if (!timeStampSearch.hasFocus()) { 115 | timeStampSearch.doSearch(); 116 | } else { 117 | timeStampSearch.hasFocus(false); 118 | } 119 | } 120 | } 121 | 122 | private void onChange(@NotNull MapViewUI view, ObjectSubscription objectSubscription) { 123 | /* view.topicSubscriberCount.setValue(Integer.toString(objectSubscription 124 | .topicSubscriberCount())); 125 | 126 | try { 127 | view.keySubscriberCount.setValue(Integer.toString(objectSubscription 128 | .keySubscriberCount())); 129 | } catch (UnsupportedOperationException e) { 130 | view.keySubscriberCount.setValue("Unknown"); 131 | } 132 | 133 | try { 134 | view.entrySubscriberCount.setValue(Integer.toString(objectSubscription 135 | .entrySubscriberCount())); 136 | } catch (UnsupportedOperationException e) { 137 | view.entrySubscriberCount.setValue("Unknown"); 138 | } 139 | 140 | 141 | view.keyStoreValue.setValue(objectSubscription.getClass().getSimpleName());*/ 142 | } 143 | 144 | private final AtomicLong refreshUI = new AtomicLong(); 145 | 146 | 147 | void init() { 148 | view.gridHolder.removeAllComponents(); 149 | 150 | @NotNull final Container.Indexed data = createContainer(new ColumnQueryDelegate(columnView)); 151 | @NotNull final GeneratedPropertyContainer generatedPropertyContainer = addDeleteButton(data); 152 | @NotNull final Grid grid = new Grid(generatedPropertyContainer); 153 | 154 | grid.setWidth(100, Sizeable.Unit.PERCENTAGE); 155 | grid.setHeight(100, Sizeable.Unit.PERCENTAGE); 156 | grid.removeAllColumns(); 157 | 158 | final List columns = columnView.columns(); 159 | 160 | for (@NotNull Column column : columns) { 161 | final Grid.Column gridColumn = grid.addColumn(column.name); 162 | gridColumn.setSortable(column.sortable); 163 | gridColumn.setEditable(!column.isReadOnly()); 164 | 165 | if (column.type != null && (Number.class.isAssignableFrom(column.type) || Boolean.class.isAssignableFrom 166 | (column.type))) { 167 | gridColumn.setWidth(120); 168 | } 169 | 170 | if (column.type == Long.class && column.name.equalsIgnoreCase("TimeStamp")) { 171 | gridColumn.setRenderer(new TextRenderer(), new Converter() { 172 | 173 | @Override 174 | public Long convertToModel(String value, Class targetType, Locale locale) throws ConversionException { 175 | final LocalDateTime dt = LocalDateTime.parse(value); 176 | return Date.from(dt.toInstant(ZoneOffset.UTC)).getTime(); 177 | } 178 | 179 | @Override 180 | public String convertToPresentation(Long value, Class targetType, Locale locale) throws ConversionException { 181 | final Instant instant = Instant.ofEpochMilli(value); 182 | final LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC); 183 | return ldt.toString(); 184 | } 185 | 186 | @NotNull 187 | @Override 188 | public Class getModelType() { 189 | return Long.class; 190 | } 191 | 192 | @NotNull 193 | @Override 194 | public Class getPresentationType() { 195 | return String.class; 196 | } 197 | }); 198 | gridColumn.setWidth(250); 199 | 200 | } else if (column.type == Long.class || column.type == Integer.class) { 201 | gridColumn.setRenderer(new NumberRenderer(removeFormatting)); 202 | } 203 | } 204 | 205 | grid.setSizeFull(); 206 | 207 | view.addButton.addClickListener((ClickListener) event -> new AddRow(columnView).init()); 208 | 209 | 210 | columnView.registerChangeListener(() -> { 211 | refreshUI.compareAndSet(0, System.currentTimeMillis()); 212 | }); 213 | 214 | UI.getCurrent().addPollListener(e -> { 215 | if (grid.isVisible()) 216 | refreshUI((SQLContainer) data); 217 | }); 218 | 219 | if (data instanceof SQLContainer) { 220 | ((SQLContainer) data).setAutoCommit(true); 221 | } 222 | 223 | 224 | if (columnView.canDeleteRows()) { 225 | 226 | grid.setEditorEnabled(true); 227 | grid.setEditorBuffered(false); 228 | grid.setSelectionMode(Grid.SelectionMode.NONE); 229 | 230 | // Render a button that deletes the data row (item) 231 | final Grid.Column deleteColumn = grid.addColumn("delete"); 232 | deleteColumn.setWidth(64); 233 | deleteColumn.setHeaderCaption(""); 234 | deleteColumn.setEditable(false); 235 | deleteColumn.setResizable(false); 236 | 237 | grid.setCellStyleGenerator(cellRef -> 238 | "delete".equals(cellRef.getPropertyId()) ? "rightalign" : null); 239 | 240 | deleteColumn.setRenderer(new ImageRenderer( 241 | e -> grid.getContainerDataSource().removeItem(e.getItemId()))); 242 | } 243 | 244 | view.gridHolder.addComponent(grid); 245 | grid.setHeight(100, Sizeable.Unit.PERCENTAGE); 246 | 247 | if (data instanceof Container.Filterable) { 248 | 249 | // Create a header row to hold column filters 250 | final HeaderRow filterRow = grid.appendHeaderRow(); 251 | @NotNull final Container.Filterable filterable = (Container.Filterable) data; 252 | 253 | // Set up a filter for all columns 254 | for (@NotNull Object pid : grid.getContainerDataSource() 255 | .getContainerPropertyIds()) { 256 | 257 | if ("delete".equals(pid)) 258 | continue; 259 | 260 | final HeaderCell cell = filterRow.getCell(pid); 261 | 262 | // Have an input field to use for filter 263 | @NotNull TextField filterField = new TextField(); 264 | filterField.setHeight(24, Sizeable.Unit.PIXELS); 265 | 266 | 267 | // Update filter When the filter input is changed 268 | @NotNull final TextChangeListener listener1 = new TextChangeListener(filterable, pid, filterField); 269 | filterField.addTextChangeListener(listener1); 270 | filterField.setTextChangeEventMode(EAGER); 271 | 272 | if (pid.toString().toUpperCase().endsWith("TIMESTAMP")) { 273 | @NotNull FocusListener listener = new FocusListener(filterField, listener1); 274 | filterField.addFocusListener(listener); 275 | filterField.setWidth(200, Sizeable.Unit.PIXELS); 276 | } else 277 | filterField.setWidth(100, Sizeable.Unit.PIXELS); 278 | 279 | cell.setComponent(filterField); 280 | } 281 | } 282 | 283 | } 284 | 285 | private void refreshUI(SQLContainer data) { 286 | /* final long l = refreshUI.get(); 287 | 288 | if (l + 5_000 < System.currentTimeMillis()) { 289 | refreshUI.set(0); 290 | data.refresh(); 291 | view.recordCount.setValue(Long.toString(columnView.rowCount(Collections.emptyList()))); 292 | }*/ 293 | 294 | } 295 | 296 | @NotNull 297 | private static Container.Indexed createContainer(@NotNull final QueryDelegate delegate) { 298 | try { 299 | return new SQLContainer(delegate); 300 | } catch (SQLException e) { 301 | throw Jvm.rethrow(e); 302 | } 303 | } 304 | 305 | @NotNull 306 | private static GeneratedPropertyContainer addDeleteButton(Container.Indexed container) { 307 | @NotNull final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(container); 308 | 309 | gpc.addGeneratedProperty("delete", 310 | new PropertyValueGenerator() { 311 | @NotNull 312 | @Override 313 | public Resource getValue(Item item, Object itemId, Object propertyId) { 314 | return new ThemeResource("trash3.png"); 315 | } 316 | 317 | @NotNull 318 | @Override 319 | public Class getType() { 320 | return Resource.class; 321 | } 322 | }); 323 | 324 | return gpc; 325 | } 326 | 327 | 328 | public static void main(String[] args) { 329 | 330 | @NotNull DecimalFormat df = new DecimalFormat(); 331 | df.setGroupingUsed(false); 332 | System.out.println(df.format(100000)); 333 | } 334 | 335 | } 336 | 337 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/EntryPoint.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.Theme; 4 | import com.vaadin.annotations.VaadinServletConfiguration; 5 | import com.vaadin.navigator.Navigator; 6 | import com.vaadin.navigator.View; 7 | import com.vaadin.navigator.ViewChangeListener; 8 | import com.vaadin.server.VaadinRequest; 9 | import com.vaadin.server.VaadinServlet; 10 | import com.vaadin.ui.Component; 11 | import com.vaadin.ui.Notification; 12 | import com.vaadin.ui.UI; 13 | import com.vaadin.ui.VerticalLayout; 14 | import net.openhft.chronicle.engine.tree.VanillaAssetTree; 15 | import net.openhft.chronicle.network.VanillaSessionDetails; 16 | import net.openhft.chronicle.network.connection.ClientConnectionMonitor; 17 | import net.openhft.chronicle.network.connection.FatalFailureConnectionStrategy; 18 | import org.jetbrains.annotations.NotNull; 19 | 20 | import javax.servlet.annotation.WebServlet; 21 | 22 | import static net.openhft.chronicle.wire.WireType.BINARY; 23 | 24 | 25 | /** 26 | * This UI is the application entry point. A UI may either represent a browser window 27 | * (or tab) or some part of a html page where a Vaadin application is embedded. 28 | *

29 | * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be 30 | * overridden to add component to the user interface and initialize non-component functionality. 31 | */ 32 | @SuppressWarnings("WeakerAccess") 33 | @Theme("mytheme") 34 | public class EntryPoint extends UI { 35 | 36 | Navigator navigator; 37 | protected static final String MAINVIEW = "main"; 38 | 39 | 40 | public static class LoginView extends VerticalLayout implements View { 41 | Login c; 42 | 43 | public LoginView(Navigator navigator) { 44 | c = new Login(navigator, "Welcome to chronicle-engine, Please login :"); 45 | addComponent(c); 46 | } 47 | 48 | @Override 49 | public void enter(ViewChangeListener.ViewChangeEvent event) { 50 | Notification.show("Please Login"); 51 | c.enter(event); 52 | } 53 | } 54 | 55 | 56 | public class MainView extends VerticalLayout implements View { 57 | 58 | 59 | @Override 60 | public void enter(ViewChangeListener.ViewChangeEvent event) { 61 | removeAllComponents(); 62 | @NotNull VanillaAssetTree tree = (VanillaAssetTree) getSession().getAttribute("tree"); 63 | if (tree == null) { 64 | navigator.navigateTo(""); 65 | return; 66 | } 67 | @NotNull Component c = new MainControl().newComponent(tree); 68 | addComponent(c); 69 | setSizeFull(); 70 | 71 | } 72 | } 73 | 74 | @Override 75 | protected void init(VaadinRequest vaadinRequest) { 76 | getPage().setTitle("Chronicle Engine"); 77 | // Create a navigator to control the views 78 | navigator = new Navigator(this, this); 79 | 80 | navigator.addView("", new LoginView(navigator)); 81 | navigator.addView(MAINVIEW, new MainView()); 82 | } 83 | 84 | @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) 85 | @VaadinServletConfiguration(ui = EntryPoint.class, productionMode = false) 86 | public static class MyUIServlet extends VaadinServlet { 87 | 88 | } 89 | 90 | static VanillaAssetTree remote(final String connectionDetails) { 91 | return new VanillaAssetTree().forRemoteAccess(connectionDetails); 92 | } 93 | 94 | @NotNull 95 | static VanillaAssetTree remote(@NotNull final String connectionDetails, 96 | @NotNull VanillaSessionDetails sessionDetails, 97 | @NotNull ClientConnectionMonitor cm) { 98 | @NotNull final VanillaAssetTree tree = new VanillaAssetTree(); 99 | tree.root().forRemoteAccess(new String[]{connectionDetails}, BINARY, sessionDetails, cm, new FatalFailureConnectionStrategy(3)); 100 | return tree; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/KeyValueResultSetMetaData.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import net.openhft.chronicle.engine.api.column.Column; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.sql.ResultSetMetaData; 7 | import java.sql.SQLException; 8 | import java.util.List; 9 | 10 | /** 11 | * @author Rob Austin. 12 | */ 13 | class KeyValueResultSetMetaData implements ResultSetMetaData { 14 | 15 | @NotNull 16 | private final List columns; 17 | 18 | KeyValueResultSetMetaData(@NotNull List columns) { 19 | this.columns = columns; 20 | } 21 | 22 | @Override 23 | public int getColumnCount() throws SQLException { 24 | return columns.size(); 25 | } 26 | 27 | @Override 28 | public boolean isAutoIncrement(int column) throws SQLException { 29 | return false; 30 | } 31 | 32 | @Override 33 | public boolean isCaseSensitive(int column) throws SQLException { 34 | throw new UnsupportedOperationException("todo"); 35 | } 36 | 37 | @Override 38 | public boolean isSearchable(int column) throws SQLException { 39 | throw new UnsupportedOperationException("todo"); 40 | } 41 | 42 | @Override 43 | public boolean isCurrency(int column) throws SQLException { 44 | throw new UnsupportedOperationException("todo"); 45 | } 46 | 47 | @Override 48 | public int isNullable(int column) throws SQLException { 49 | return 0; 50 | } 51 | 52 | @Override 53 | public boolean isSigned(int column) throws SQLException { 54 | throw new UnsupportedOperationException("todo"); 55 | } 56 | 57 | @Override 58 | public int getColumnDisplaySize(int column) throws SQLException { 59 | throw new UnsupportedOperationException("todo"); 60 | } 61 | 62 | @Override 63 | public String getColumnLabel(int column) throws SQLException { 64 | return columns.get(column - 1).name; 65 | } 66 | 67 | @Override 68 | public String getColumnName(int column) throws SQLException { 69 | return columns.get(column - 1).name; 70 | } 71 | 72 | @NotNull 73 | @Override 74 | public String getSchemaName(int column) throws SQLException { 75 | throw new UnsupportedOperationException("todo"); 76 | } 77 | 78 | @Override 79 | public int getPrecision(int column) throws SQLException { 80 | throw new UnsupportedOperationException("todo"); 81 | } 82 | 83 | @Override 84 | public int getScale(int column) throws SQLException { 85 | throw new UnsupportedOperationException("todo"); 86 | } 87 | 88 | @NotNull 89 | @Override 90 | public String getTableName(int column) throws SQLException { 91 | throw new UnsupportedOperationException("todo"); 92 | } 93 | 94 | @NotNull 95 | @Override 96 | public String getCatalogName(int column) throws SQLException { 97 | throw new UnsupportedOperationException("todo"); 98 | } 99 | 100 | @Override 101 | public int getColumnType(int column) throws SQLException { 102 | throw new UnsupportedOperationException("todo"); 103 | } 104 | 105 | @NotNull 106 | @Override 107 | public String getColumnTypeName(int column) throws SQLException { 108 | return columns.get(column - 1).type().getSimpleName(); 109 | } 110 | 111 | @Override 112 | public boolean isReadOnly(int column) throws SQLException { 113 | return columns.get(column - 1).isReadOnly(); 114 | } 115 | 116 | @Override 117 | public boolean isWritable(int column) throws SQLException { 118 | return !columns.get(column - 1).isReadOnly(); 119 | } 120 | 121 | @Override 122 | public boolean isDefinitelyWritable(int column) throws SQLException { 123 | throw new UnsupportedOperationException("todo"); 124 | } 125 | 126 | @NotNull 127 | @Override 128 | public String getColumnClassName(int column) throws SQLException { 129 | return "java.lang.String"; 130 | } 131 | 132 | @NotNull 133 | @Override 134 | public T unwrap(Class iface) throws SQLException { 135 | throw new UnsupportedOperationException("todo"); 136 | } 137 | 138 | @Override 139 | public boolean isWrapperFor(Class iface) throws SQLException { 140 | throw new UnsupportedOperationException("todo"); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/Login.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.data.validator.AbstractValidator; 4 | import com.vaadin.event.UIEvents; 5 | import com.vaadin.navigator.Navigator; 6 | import com.vaadin.navigator.View; 7 | import com.vaadin.navigator.ViewChangeListener; 8 | import com.vaadin.server.StreamResource; 9 | import com.vaadin.shared.ui.MarginInfo; 10 | import com.vaadin.ui.*; 11 | import com.vaadin.ui.themes.Reindeer; 12 | import net.openhft.chronicle.core.annotation.Nullable; 13 | import net.openhft.chronicle.engine.tree.VanillaAssetTree; 14 | import net.openhft.chronicle.network.VanillaSessionDetails; 15 | import net.openhft.chronicle.network.connection.ClientConnectionMonitor; 16 | import org.jetbrains.annotations.NotNull; 17 | 18 | import java.net.SocketAddress; 19 | 20 | import static net.openhft.chronicle.engine.gui.EntryPoint.MAINVIEW; 21 | import static net.openhft.chronicle.engine.gui.EntryPoint.remote; 22 | 23 | public class Login extends CustomComponent implements View, Button.ClickListener { 24 | 25 | private static final String NAME = "login"; 26 | private static final String DEFAULT_HOSTPORT = "localhost:9090"; 27 | private static final String DEFAULT_USER = "admin"; 28 | @NotNull 29 | private final TextField user; 30 | @NotNull 31 | private final TextField hostPort; 32 | @NotNull 33 | private final PasswordField password; 34 | @NotNull 35 | private final Button loginButton; 36 | private final Navigator navigator; 37 | 38 | @org.jetbrains.annotations.Nullable 39 | private volatile UIEvents.PollListener eventListener; 40 | @org.jetbrains.annotations.Nullable 41 | private volatile VanillaAssetTree remoteTree = null; 42 | @org.jetbrains.annotations.Nullable 43 | private volatile Boolean isConnected = null; 44 | 45 | public Login(Navigator navigator, final String caption) { 46 | this.navigator = navigator; 47 | 48 | setSizeFull(); 49 | 50 | // Create the host input field 51 | hostPort = new TextField("HostPort:"); 52 | hostPort.setWidth("300px"); 53 | 54 | hostPort.setInputPrompt(DEFAULT_HOSTPORT); 55 | hostPort.setInvalidAllowed(false); 56 | 57 | @NotNull StreamResource streamResource = new StreamResource((StreamResource.StreamSource) () -> Login.class.getResourceAsStream("Chronicle-Engine_200px.png"), "Chronicle-Engine_200px.png"); 58 | 59 | @NotNull Image image = new Image("", streamResource); 60 | 61 | // Create the user input field 62 | user = new TextField("User:"); 63 | user.setWidth("300px"); 64 | user.setInputPrompt(DEFAULT_USER); 65 | user.setInvalidAllowed(false); 66 | 67 | // Create the password input field 68 | password = new PasswordField("Password:"); 69 | password.setWidth("300px"); 70 | password.addValidator(new PasswordValidator()); 71 | 72 | password.setValue(""); 73 | password.setNullRepresentation(""); 74 | 75 | // Create login button 76 | loginButton = new Button("Login", this); 77 | loginButton.setDisableOnClick(true); 78 | 79 | // Add both to a panel 80 | @NotNull VerticalLayout fields = new VerticalLayout(image, hostPort, user, password, loginButton); 81 | fields.setCaption(caption); 82 | fields.setSpacing(true); 83 | fields.setMargin(new MarginInfo(true, true, true, false)); 84 | fields.setSizeUndefined(); 85 | 86 | // The view root layout 87 | @NotNull VerticalLayout viewLayout = new VerticalLayout(fields); 88 | viewLayout.setSizeFull(); 89 | viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); 90 | viewLayout.setStyleName(Reindeer.LAYOUT_BLUE); 91 | setCompositionRoot(viewLayout); 92 | } 93 | 94 | @Override 95 | public void enter(ViewChangeListener.ViewChangeEvent event0) { 96 | // focus the username field when user arrives to the login view 97 | isConnected = null; 98 | 99 | @org.jetbrains.annotations.Nullable UIEvents.PollListener eventListener0 = this.eventListener; 100 | if (eventListener0 != null) 101 | getUI().getCurrent().removePollListener(eventListener0); 102 | 103 | this.eventListener = event -> { 104 | if (isConnected == null) 105 | return; 106 | if (isConnected) { 107 | getSession().setAttribute("tree", remoteTree); 108 | navigator.navigateTo(MAINVIEW); 109 | getUI().getCurrent().removePollListener(this.eventListener); 110 | this.eventListener = null; 111 | } else { 112 | getSession().setAttribute("tree", null); 113 | remoteTree.close(); 114 | remoteTree = null; 115 | navigator.navigateTo(""); 116 | isConnected = null; 117 | getUI().getCurrent().removePollListener(this.eventListener); 118 | this.eventListener = null; 119 | } 120 | }; 121 | 122 | getUI().getCurrent().setPollInterval(1000); 123 | getUI().getCurrent().addPollListener(this.eventListener); 124 | 125 | } 126 | 127 | @Override 128 | public void buttonClick(Button.ClickEvent event) { 129 | 130 | String username = user.getValue(); 131 | String password = this.password.getValue(); 132 | 133 | 134 | // Navigate to main view 135 | //getUI().getNavigator().navigateTo(NAME); 136 | final String hostPort = this.hostPort.getValue(); 137 | 138 | @NotNull final VanillaSessionDetails sessionDetails = new VanillaSessionDetails(); 139 | @NotNull String userId = username == null || username.isEmpty() ? DEFAULT_USER : username; 140 | sessionDetails.userId(userId); 141 | sessionDetails.securityToken(password); 142 | 143 | 144 | @NotNull final String remoteHost = "".isEmpty() ? DEFAULT_HOSTPORT : hostPort; 145 | 146 | 147 | @NotNull final ClientConnectionMonitor monitor = new ClientConnectionMonitor() { 148 | 149 | @Override 150 | public void onConnected(@Nullable String name, 151 | @NotNull SocketAddress socketAddress) { 152 | isConnected = true; 153 | } 154 | 155 | @Override 156 | public void onDisconnected(@Nullable String name, 157 | @NotNull SocketAddress socketAddress) { 158 | isConnected = false; 159 | } 160 | }; 161 | 162 | remoteTree = remote(remoteHost, sessionDetails, monitor); 163 | 164 | } 165 | 166 | // Validator for validating the passwords 167 | private static final class PasswordValidator extends 168 | AbstractValidator { 169 | 170 | private PasswordValidator() { 171 | super("The password provided is not valid"); 172 | } 173 | 174 | @Override 175 | protected boolean isValidValue(String value) { 176 | return true; 177 | } 178 | 179 | @NotNull 180 | @Override 181 | public Class getType() { 182 | return String.class; 183 | } 184 | } 185 | 186 | 187 | } -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/MainControl.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.ui.Component; 4 | import com.vaadin.ui.VerticalLayout; 5 | import net.openhft.chronicle.engine.api.tree.AssetTree; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | /** 9 | * @author Rob Austin. 10 | */ 11 | class MainControl { 12 | 13 | private final UserControl userUiManager = new UserControl(); 14 | 15 | @NotNull 16 | Component newComponent(@NotNull final AssetTree remoteAssetTree) { 17 | @NotNull MainUI mainUI = new MainUI(); 18 | @NotNull Component userComponent = userUiManager.newComponent(); 19 | 20 | 21 | VerticalLayout content = mainUI.content; 22 | 23 | mainUI.userButton.addClickListener(clickEvent -> { 24 | content.removeAllComponents(); 25 | content.addComponent(userUiManager.newComponent()); 26 | }); 27 | 28 | @NotNull TreeUI treeUI = new TreeUI(); 29 | new TreeController(remoteAssetTree, treeUI); 30 | 31 | mainUI.treeButton.addClickListener(clickEvent -> { 32 | content.removeAllComponents(); 33 | content.addComponent(treeUI); 34 | }); 35 | 36 | 37 | mainUI.content.addComponent(treeUI); 38 | 39 | return mainUI; 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/MainUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.AutoGenerated; 4 | import com.vaadin.annotations.DesignRoot; 5 | import com.vaadin.ui.declarative.Design; 6 | import com.vaadin.ui.HorizontalLayout; 7 | import com.vaadin.ui.Label; 8 | import com.vaadin.ui.Button; 9 | import com.vaadin.ui.CssLayout; 10 | import com.vaadin.ui.VerticalLayout; 11 | 12 | /** 13 | * !! DO NOT EDIT THIS FILE !! 14 | * 15 | * This class is generated by Vaadin Designer and will be overwritten. 16 | * 17 | * Please make a subclass with logic and additional interfaces as needed, 18 | * e.g class LoginView extends LoginDesign implements View { } 19 | */ 20 | @DesignRoot 21 | @AutoGenerated 22 | @SuppressWarnings("serial") 23 | public class MainUI extends HorizontalLayout { 24 | protected HorizontalLayout menuTitle; 25 | protected Label menuTitleLabel; 26 | protected Button menuToggle; 27 | protected CssLayout menuItems; 28 | protected Button userButton; 29 | protected Button treeButton; 30 | protected VerticalLayout content; 31 | 32 | public MainUI() { 33 | Design.read(this); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/MapViewUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.AutoGenerated; 4 | import com.vaadin.annotations.DesignRoot; 5 | import com.vaadin.ui.Button; 6 | import com.vaadin.ui.Label; 7 | import com.vaadin.ui.VerticalLayout; 8 | import com.vaadin.ui.declarative.Design; 9 | 10 | /** 11 | * !! DO NOT EDIT THIS FILE !! 12 | * 13 | * This class is generated by Vaadin Designer and will be overwritten. 14 | * 15 | * Please make a subclass with logic and additional interfaces as needed, 16 | * e.g class LoginView extends LoginDesign implements View { } 17 | */ 18 | @DesignRoot 19 | @AutoGenerated 20 | @SuppressWarnings("serial") 21 | public class MapViewUI extends VerticalLayout { 22 | protected Label entrySubscriberCount; 23 | protected Label recordCount; 24 | protected Label topicSubscriberCount; 25 | protected Label keySubscriberCount; 26 | protected Label path; 27 | protected Label keyStoreValue; 28 | protected VerticalLayout gridHolder; 29 | protected Button addButton; 30 | 31 | public MapViewUI() { 32 | Design.read(this); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/MyStatement.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import org.intellij.lang.annotations.MagicConstant; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.sql.*; 7 | 8 | /** 9 | * @author Rob Austin. 10 | */ 11 | public class MyStatement implements Statement { 12 | @NotNull 13 | @Override 14 | public ResultSet executeQuery(String sql) throws SQLException { 15 | throw new UnsupportedOperationException("todo"); 16 | } 17 | 18 | @Override 19 | public int executeUpdate(String sql) throws SQLException { 20 | throw new UnsupportedOperationException("todo"); 21 | } 22 | 23 | @Override 24 | public void close() throws SQLException { 25 | 26 | } 27 | 28 | @Override 29 | public int getMaxFieldSize() throws SQLException { 30 | throw new UnsupportedOperationException("todo"); 31 | } 32 | 33 | @Override 34 | public void setMaxFieldSize(int max) throws SQLException { 35 | throw new UnsupportedOperationException("todo"); 36 | } 37 | 38 | @Override 39 | public int getMaxRows() throws SQLException { 40 | throw new UnsupportedOperationException("todo"); 41 | } 42 | 43 | @Override 44 | public void setMaxRows(int max) throws SQLException { 45 | throw new UnsupportedOperationException("todo"); 46 | } 47 | 48 | @Override 49 | public void setEscapeProcessing(boolean enable) throws SQLException { 50 | throw new UnsupportedOperationException("todo"); 51 | } 52 | 53 | @Override 54 | public int getQueryTimeout() throws SQLException { 55 | throw new UnsupportedOperationException("todo"); 56 | } 57 | 58 | @Override 59 | public void setQueryTimeout(int seconds) throws SQLException { 60 | throw new UnsupportedOperationException("todo"); 61 | } 62 | 63 | @Override 64 | public void cancel() throws SQLException { 65 | throw new UnsupportedOperationException("todo"); 66 | } 67 | 68 | @NotNull 69 | @Override 70 | public SQLWarning getWarnings() throws SQLException { 71 | throw new UnsupportedOperationException("todo"); 72 | } 73 | 74 | @Override 75 | public void clearWarnings() throws SQLException { 76 | throw new UnsupportedOperationException("todo"); 77 | } 78 | 79 | @Override 80 | public void setCursorName(String name) throws SQLException { 81 | throw new UnsupportedOperationException("todo"); 82 | } 83 | 84 | @Override 85 | public boolean execute(String sql) throws SQLException { 86 | throw new UnsupportedOperationException("todo"); 87 | } 88 | 89 | @NotNull 90 | @Override 91 | public ResultSet getResultSet() throws SQLException { 92 | throw new UnsupportedOperationException("todo"); 93 | } 94 | 95 | @Override 96 | public int getUpdateCount() throws SQLException { 97 | throw new UnsupportedOperationException("todo"); 98 | } 99 | 100 | @Override 101 | public boolean getMoreResults() throws SQLException { 102 | throw new UnsupportedOperationException("todo"); 103 | } 104 | 105 | @Override 106 | public void setFetchDirection(@MagicConstant(intValues = {ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, ResultSet.FETCH_UNKNOWN}) int direction) throws SQLException { 107 | throw new UnsupportedOperationException("todo"); 108 | } 109 | 110 | @Override 111 | public int getFetchDirection() throws SQLException { 112 | throw new UnsupportedOperationException("todo"); 113 | } 114 | 115 | @Override 116 | public void setFetchSize(int rows) throws SQLException { 117 | throw new UnsupportedOperationException("todo"); 118 | } 119 | 120 | @Override 121 | public int getFetchSize() throws SQLException { 122 | throw new UnsupportedOperationException("todo"); 123 | } 124 | 125 | @Override 126 | public int getResultSetConcurrency() throws SQLException { 127 | throw new UnsupportedOperationException("todo"); 128 | } 129 | 130 | @Override 131 | public int getResultSetType() throws SQLException { 132 | throw new UnsupportedOperationException("todo"); 133 | } 134 | 135 | @Override 136 | public void addBatch(String sql) throws SQLException { 137 | throw new UnsupportedOperationException("todo"); 138 | } 139 | 140 | @Override 141 | public void clearBatch() throws SQLException { 142 | throw new UnsupportedOperationException("todo"); 143 | } 144 | 145 | @NotNull 146 | @Override 147 | public int[] executeBatch() throws SQLException { 148 | throw new UnsupportedOperationException("todo"); 149 | } 150 | 151 | @NotNull 152 | @Override 153 | public Connection getConnection() throws SQLException { 154 | throw new UnsupportedOperationException("todo"); 155 | } 156 | 157 | @Override 158 | public boolean getMoreResults(@MagicConstant(intValues = {Statement.CLOSE_CURRENT_RESULT, Statement.KEEP_CURRENT_RESULT, Statement.CLOSE_ALL_RESULTS}) int current) throws SQLException { 159 | throw new UnsupportedOperationException("todo"); 160 | } 161 | 162 | @NotNull 163 | @Override 164 | public ResultSet getGeneratedKeys() throws SQLException { 165 | throw new UnsupportedOperationException("todo"); 166 | } 167 | 168 | @Override 169 | public int executeUpdate(String sql, @MagicConstant(intValues = {Statement.RETURN_GENERATED_KEYS, Statement.NO_GENERATED_KEYS}) int autoGeneratedKeys) throws SQLException { 170 | throw new UnsupportedOperationException("todo"); 171 | } 172 | 173 | @Override 174 | public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { 175 | throw new UnsupportedOperationException("todo"); 176 | } 177 | 178 | @Override 179 | public int executeUpdate(String sql, String[] columnNames) throws SQLException { 180 | throw new UnsupportedOperationException("todo"); 181 | } 182 | 183 | @Override 184 | public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { 185 | throw new UnsupportedOperationException("todo"); 186 | } 187 | 188 | @Override 189 | public boolean execute(String sql, int[] columnIndexes) throws SQLException { 190 | throw new UnsupportedOperationException("todo"); 191 | } 192 | 193 | @Override 194 | public boolean execute(String sql, String[] columnNames) throws SQLException { 195 | throw new UnsupportedOperationException("todo"); 196 | } 197 | 198 | @Override 199 | public int getResultSetHoldability() throws SQLException { 200 | throw new UnsupportedOperationException("todo"); 201 | } 202 | 203 | @Override 204 | public boolean isClosed() throws SQLException { 205 | throw new UnsupportedOperationException("todo"); 206 | } 207 | 208 | @Override 209 | public void setPoolable(boolean poolable) throws SQLException { 210 | throw new UnsupportedOperationException("todo"); 211 | } 212 | 213 | @Override 214 | public boolean isPoolable() throws SQLException { 215 | throw new UnsupportedOperationException("todo"); 216 | } 217 | 218 | @Override 219 | public void closeOnCompletion() throws SQLException { 220 | throw new UnsupportedOperationException("todo"); 221 | } 222 | 223 | @Override 224 | public boolean isCloseOnCompletion() throws SQLException { 225 | throw new UnsupportedOperationException("todo"); 226 | } 227 | 228 | @NotNull 229 | @Override 230 | public T unwrap(Class iface) throws SQLException { 231 | throw new UnsupportedOperationException("todo"); 232 | } 233 | 234 | @Override 235 | public boolean isWrapperFor(Class iface) throws SQLException { 236 | throw new UnsupportedOperationException("todo"); 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/QueueViewUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.AutoGenerated; 4 | import com.vaadin.annotations.DesignRoot; 5 | import com.vaadin.ui.declarative.Design; 6 | import com.vaadin.ui.VerticalLayout; 7 | import com.vaadin.ui.Grid; 8 | import com.vaadin.ui.Label; 9 | 10 | /** 11 | * !! DO NOT EDIT THIS FILE !! 12 | * 13 | * This class is generated by Vaadin Designer and will be overwritten. 14 | * 15 | * Please make a subclass with logic and additional interfaces as needed, 16 | * e.g class LoginView extends LoginDesign implements View { } 17 | */ 18 | @DesignRoot 19 | @AutoGenerated 20 | @SuppressWarnings("serial") 21 | public class QueueViewUI extends VerticalLayout { 22 | protected Label path; 23 | protected Grid datagrid; 24 | 25 | public QueueViewUI() { 26 | Design.read(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/TimeStampSearch.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.event.FieldEvents; 4 | import com.vaadin.server.Sizeable; 5 | import com.vaadin.ui.*; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import java.text.DateFormatSymbols; 9 | import java.time.DateTimeException; 10 | import java.time.ZoneOffset; 11 | import java.time.ZonedDateTime; 12 | import java.util.*; 13 | import java.util.Calendar; 14 | import java.util.function.Consumer; 15 | import java.util.function.Supplier; 16 | 17 | import static com.vaadin.data.Property.ValueChangeListener; 18 | import static java.util.Arrays.asList; 19 | 20 | /** 21 | * @author Rob Austin. 22 | */ 23 | class TimeStampSearch { 24 | 25 | private final static String[] MONTHS_ARRAY = Arrays.copyOf(new DateFormatSymbols().getMonths 26 | (), 12); 27 | public static final List MONTHS = asList(MONTHS_ARRAY); 28 | 29 | public static final int COMBO_BOX_WIDTH = 80; 30 | @NotNull 31 | private final TextField filterField; 32 | private final FieldEvents.TextChangeListener textChangeListener; 33 | 34 | private boolean hasFocus; 35 | 36 | public TimeStampSearch(@NotNull TextField filterField, FieldEvents.TextChangeListener textChangeListener) { 37 | this.filterField = filterField; 38 | this.textChangeListener = textChangeListener; 39 | } 40 | 41 | boolean hasFocus() { 42 | return hasFocus; 43 | } 44 | 45 | private class MyTextChangeEvent extends FieldEvents.TextChangeEvent { 46 | 47 | private final String newValue; 48 | 49 | MyTextChangeEvent(String newValue) { 50 | super(filterField); 51 | this.newValue = newValue; 52 | } 53 | 54 | @Override 55 | public String getText() { 56 | return newValue; 57 | } 58 | 59 | @Override 60 | public int getCursorPosition() { 61 | throw new UnsupportedOperationException("todo"); 62 | } 63 | } 64 | 65 | void doSearch() { 66 | 67 | @NotNull final String value = filterField.getValue().trim(); 68 | 69 | long lower = System.currentTimeMillis(); 70 | long upper = System.currentTimeMillis(); 71 | 72 | if ((value.startsWith("[") || value.startsWith("(")) 73 | && (value.endsWith("]") || value.endsWith(")"))) { 74 | 75 | boolean startExclusive = value.startsWith("("); 76 | boolean endInclusive = value.startsWith("]"); 77 | 78 | @NotNull String substring = value.substring(1, value.length() - 1); 79 | @NotNull String[] split = substring.split("\\,"); 80 | 81 | if (split.length == 2) { 82 | lower = Long.parseLong(split[0].trim()); 83 | upper = Long.parseLong(split[1].trim()); 84 | } 85 | 86 | if (startExclusive) lower++; 87 | 88 | if (endInclusive) upper++; 89 | 90 | } 91 | 92 | 93 | // Create a sub-window and set the content 94 | @NotNull Window subWindow = new Window("Search - Date Time Range"); 95 | subWindow.setClosable(false); 96 | subWindow.setModal(true); 97 | subWindow.setResizeLazy(true); 98 | subWindow.setResizable(false); 99 | subWindow.setSizeUndefined(); 100 | subWindow.setWidth(920, Sizeable.Unit.PIXELS); 101 | subWindow.setDraggable(true); 102 | hasFocus = true; 103 | 104 | 105 | @NotNull FormLayout form = new FormLayout(); 106 | form.setMargin(false); 107 | 108 | @NotNull AbstractOrderedLayout fromLayout = new HorizontalLayout(); 109 | 110 | @NotNull Label fromMillisLabel = new Label("fromMillisLabel"); 111 | fromMillisLabel.setValue("" + lower + " milliseconds UTC"); 112 | @NotNull Supplier supplyFromMillisUtc = addComboBoxes(fromLayout, s -> fromMillisLabel 113 | .setValue(s.toString() + " milliseconds UTC"), lower); 114 | 115 | { 116 | @NotNull HorizontalLayout components0 = new HorizontalLayout(); 117 | components0.addComponent(new Label("From: UTC time [inclusive]:")); 118 | @NotNull HorizontalLayout c = new HorizontalLayout(); 119 | c.setWidth(100, Sizeable.Unit.PERCENTAGE); 120 | components0.addComponent(c); 121 | components0.addComponent(fromMillisLabel); 122 | components0.setWidth(100, Sizeable.Unit.PERCENTAGE); 123 | form.addComponent(components0); 124 | } 125 | 126 | form.addComponent(fromLayout); 127 | form.setComponentAlignment(fromLayout, Alignment.MIDDLE_LEFT); 128 | 129 | @NotNull AbstractOrderedLayout toLayout = new HorizontalLayout(); 130 | @NotNull Label toMillisLabel = new Label("toMillisLabel"); 131 | toMillisLabel.setValue("" + upper + " milliseconds UTC"); 132 | @NotNull Supplier supplyToMillisUtc = addComboBoxes(toLayout, s -> toMillisLabel.setValue 133 | (s.toString() + " milliseconds UTC"), upper); 134 | { 135 | @NotNull HorizontalLayout components0 = new HorizontalLayout(); 136 | components0.addComponent(new Label("To: UTC time (exclusive):")); 137 | @NotNull HorizontalLayout c = new HorizontalLayout(); 138 | c.setWidth(100, Sizeable.Unit.PERCENTAGE); 139 | components0.addComponent(c); 140 | components0.addComponent(toMillisLabel); 141 | components0.setWidth(100, Sizeable.Unit.PERCENTAGE); 142 | form.addComponent(components0); 143 | } 144 | 145 | form.addComponent(toLayout); 146 | form.setComponentAlignment(toLayout, Alignment.MIDDLE_LEFT); 147 | 148 | // buttons layout --------------- 149 | 150 | @NotNull HorizontalLayout buttonParentLayout = new HorizontalLayout(); 151 | buttonParentLayout.setWidth(100, Sizeable.Unit.PERCENTAGE); 152 | 153 | buttonParentLayout.setMargin(true); 154 | @NotNull HorizontalLayout padding = new HorizontalLayout(); 155 | padding.setWidth(100, Sizeable.Unit.PERCENTAGE); 156 | buttonParentLayout.addComponent(padding); 157 | buttonParentLayout.setComponentAlignment(padding, Alignment.MIDDLE_LEFT); 158 | 159 | @NotNull HorizontalLayout buttons = new HorizontalLayout(); 160 | buttons.setSpacing(true); 161 | 162 | // --------------- 163 | 164 | 165 | @NotNull final Button doneButton = new Button("Done"); 166 | doneButton.addClickListener((Button.ClickListener) event1 -> { 167 | subWindow.close(); 168 | 169 | long fromMillis = supplyFromMillisUtc.get(); 170 | long toMillis = supplyToMillisUtc.get(); 171 | 172 | @NotNull String newValue = "[" + fromMillis + "," + toMillis + ")"; 173 | filterField.setValue(newValue); 174 | textChangeListener.textChange(new MyTextChangeEvent(newValue)); 175 | }); 176 | 177 | @NotNull final Button clearButton = new Button("Clear"); 178 | clearButton.addClickListener((Button.ClickListener) event1 -> { 179 | subWindow.close(); 180 | @NotNull String newValue = ""; 181 | filterField.setValue(newValue); 182 | textChangeListener.textChange(new MyTextChangeEvent("")); 183 | }); 184 | 185 | 186 | buttons.addComponent(clearButton); 187 | buttons.addComponent(doneButton); 188 | buttonParentLayout.addComponent(buttons); 189 | buttonParentLayout.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT); 190 | 191 | form.addComponent(buttonParentLayout); 192 | form.setComponentAlignment(buttonParentLayout, Alignment.MIDDLE_RIGHT); 193 | 194 | subWindow.setContent(form); 195 | 196 | // Center it in the browser window 197 | subWindow.center(); 198 | 199 | // Open it in the UI 200 | UI.getCurrent().addWindow(subWindow); 201 | } 202 | 203 | 204 | @NotNull 205 | private Supplier addComboBoxes(@NotNull final AbstractOrderedLayout result, @NotNull Consumer 206 | onChange, long milliSecondsUtc) { 207 | 208 | @NotNull final AbstractOrderedLayout dayLayout = new HorizontalLayout(); 209 | dayLayout.setMargin(true); 210 | 211 | @NotNull final ComboBox day = dayComboBox(milliSecondsUtc); 212 | day.setNullSelectionAllowed(false); 213 | @NotNull ComboBox month = monthComboBox(milliSecondsUtc); 214 | month.setNullSelectionAllowed(false); 215 | @NotNull ComboBox year = yearCombBox(milliSecondsUtc); 216 | year.setNullSelectionAllowed(false); 217 | 218 | dayLayout.setSpacing(true); 219 | dayLayout.addComponent(day); 220 | dayLayout.addComponent(month); 221 | dayLayout.addComponent(year); 222 | result.addComponent(dayLayout); 223 | result.setComponentAlignment(dayLayout, Alignment.MIDDLE_LEFT); 224 | 225 | @NotNull final AbstractOrderedLayout timeLayout = new HorizontalLayout(); 226 | @NotNull final ComboBox hour = hourCombBox(milliSecondsUtc); 227 | hour.setNullSelectionAllowed(false); 228 | @NotNull ComboBox min = minCombBox(milliSecondsUtc); 229 | min.setNullSelectionAllowed(false); 230 | 231 | @NotNull final ComboBox seconds = secCombBox(milliSecondsUtc); 232 | seconds.setNullSelectionAllowed(false); 233 | 234 | @NotNull final ComboBox milliseconds = millisecondsCombBox(milliSecondsUtc); 235 | milliseconds.setNullSelectionAllowed(false); 236 | 237 | timeLayout.setSpacing(true); 238 | timeLayout.addComponent(hour); 239 | timeLayout.addComponent(min); 240 | timeLayout.addComponent(seconds); 241 | timeLayout.addComponent(milliseconds); 242 | result.addComponent(timeLayout); 243 | result.setComponentAlignment(timeLayout, Alignment.MIDDLE_RIGHT); 244 | 245 | @NotNull final Supplier utcMillisSupplier = () -> { 246 | for (int i = 0; i < 5; i++) { 247 | 248 | int year0 = Integer.valueOf(year.getValue().toString()); 249 | 250 | int month0 = monthSelected(month); 251 | int dayOfMonth0 = Integer.valueOf(day.getValue().toString()); 252 | int hour0 = Integer.valueOf(hour.getValue().toString()); 253 | int minute0 = Integer.valueOf(min.getValue().toString()); 254 | int second0 = Integer.valueOf(seconds.getValue().toString()); 255 | int milliseconds0 = Integer.valueOf(milliseconds.getValue().toString()); 256 | int nanoOfSecond0 = milliseconds0 * 1_000_000; 257 | 258 | try { 259 | final ZonedDateTime time = ZonedDateTime.of(year0, 260 | month0, dayOfMonth0, hour0, minute0, second0, 261 | nanoOfSecond0, ZoneOffset.UTC); 262 | return (time.toEpochSecond() * 1000) + milliseconds0; 263 | } catch (DateTimeException e) { 264 | day.setValue(Integer.toString(dayOfMonth0 - 1)); 265 | } 266 | 267 | } 268 | throw new IllegalStateException(); 269 | }; 270 | 271 | @NotNull final ValueChangeListener listener = event -> onChange.accept(utcMillisSupplier.get()); 272 | day.addValueChangeListener(listener); 273 | month.addValueChangeListener(listener); 274 | year.addValueChangeListener(listener); 275 | hour.addValueChangeListener(listener); 276 | min.addValueChangeListener(listener); 277 | seconds.addValueChangeListener(listener); 278 | milliseconds.addValueChangeListener(listener); 279 | 280 | return utcMillisSupplier; 281 | 282 | } 283 | 284 | private int monthSelected(@NotNull ComboBox month) { 285 | int i = MONTHS.indexOf(month.getValue()); 286 | if (i == -1) 287 | i = 0; 288 | return i + 1; 289 | } 290 | 291 | @NotNull 292 | private ComboBox monthComboBox(long utcTime) { 293 | 294 | @NotNull final ComboBox month = new ComboBox("month", MONTHS); 295 | 296 | month.setInvalidAllowed(false); 297 | month.setNullSelectionAllowed(false); 298 | month.addItems(MONTHS); 299 | month.setWidth(150, Sizeable.Unit.PIXELS); 300 | Calendar instance = Calendar.getInstance(); 301 | instance.setTime(new Date(utcTime)); 302 | month.setValue(MONTHS_ARRAY[instance.get(Calendar.MONTH)]); 303 | 304 | return month; 305 | } 306 | 307 | @NotNull 308 | private ComboBox dayComboBox(long utcTime) { 309 | 310 | @NotNull ComboBox result = new ComboBox("day"); 311 | 312 | result.setInvalidAllowed(false); 313 | result.setNullSelectionAllowed(false); 314 | result.setWidth(COMBO_BOX_WIDTH, Sizeable.Unit.PIXELS); 315 | @NotNull List days = new ArrayList<>(); 316 | for (int i = 1; i <= 31; i++) { 317 | days.add(Integer.toString(i)); 318 | } 319 | 320 | result.addItems(days); 321 | 322 | final Calendar instance = Calendar.getInstance(); 323 | instance.setTime(new Date(utcTime)); 324 | result.setValue(Integer.toString(instance.get(Calendar.DAY_OF_MONTH))); 325 | return result; 326 | } 327 | 328 | 329 | @NotNull 330 | private ComboBox yearCombBox(long utcTime) { 331 | 332 | @NotNull ComboBox result = new ComboBox("year"); 333 | 334 | result.setInvalidAllowed(false); 335 | result.setNullSelectionAllowed(false); 336 | result.setWidth(100, Sizeable.Unit.PIXELS); 337 | @NotNull List years = new ArrayList<>(); 338 | for (int i = 1970; i < 2070; i++) { 339 | years.add(Integer.toString(i)); 340 | } 341 | 342 | result.addItems(years); 343 | 344 | final Calendar instance = Calendar.getInstance(); 345 | instance.setTime(new Date(utcTime)); 346 | result.setValue(Integer.toString(instance.get(Calendar.YEAR))); 347 | return result; 348 | } 349 | 350 | 351 | @NotNull 352 | private ComboBox hourCombBox(long utcTime) { 353 | 354 | @NotNull ComboBox result = new ComboBox("hour"); 355 | 356 | result.setInvalidAllowed(false); 357 | result.setNullSelectionAllowed(false); 358 | result.setWidth(COMBO_BOX_WIDTH, Sizeable.Unit.PIXELS); 359 | @NotNull List hour = new ArrayList<>(); 360 | for (int i = 0; i <= 23; i++) { 361 | hour.add(Integer.toString(i)); 362 | } 363 | 364 | result.addItems(hour); 365 | 366 | final Calendar instance = Calendar.getInstance(); 367 | instance.setTime(new Date(utcTime)); 368 | result.setValue(Integer.toString(instance.get(Calendar.HOUR_OF_DAY))); 369 | return result; 370 | } 371 | 372 | @NotNull 373 | private ComboBox minCombBox(long utcTime) { 374 | 375 | @NotNull ComboBox result = new ComboBox("min"); 376 | 377 | result.setInvalidAllowed(false); 378 | result.setNullSelectionAllowed(false); 379 | result.setWidth(COMBO_BOX_WIDTH, Sizeable.Unit.PIXELS); 380 | @NotNull List min = new ArrayList<>(); 381 | for (int i = 0; i <= 59; i++) { 382 | min.add(Integer.toString(i)); 383 | } 384 | 385 | result.addItems(min); 386 | 387 | final Calendar instance = Calendar.getInstance(); 388 | instance.setTime(new Date(utcTime)); 389 | result.setValue(Integer.toString(instance.get(Calendar.MINUTE))); 390 | return result; 391 | } 392 | 393 | @NotNull 394 | private ComboBox secCombBox(long utcTime) { 395 | 396 | @NotNull ComboBox result = new ComboBox("second"); 397 | 398 | result.setInvalidAllowed(false); 399 | result.setNullSelectionAllowed(false); 400 | result.setWidth(COMBO_BOX_WIDTH, Sizeable.Unit.PIXELS); 401 | @NotNull List min = new ArrayList<>(); 402 | for (int i = 0; i <= 59; i++) { 403 | min.add(Integer.toString(i)); 404 | } 405 | 406 | result.addItems(min); 407 | 408 | final Calendar instance = Calendar.getInstance(); 409 | instance.setTime(new Date(utcTime)); 410 | result.setValue(Integer.toString(instance.get(Calendar.SECOND))); 411 | return result; 412 | } 413 | 414 | @NotNull 415 | private ComboBox millisecondsCombBox(long utcTime) { 416 | 417 | @NotNull ComboBox result = new ComboBox("milli-second"); 418 | 419 | result.setInvalidAllowed(false); 420 | result.setNullSelectionAllowed(false); 421 | result.setWidth(120, Sizeable.Unit.PIXELS); 422 | @NotNull List min = new ArrayList<>(); 423 | for (int i = 0; i <= 1000; i++) { 424 | min.add(Integer.toString(i)); 425 | } 426 | 427 | result.addItems(min); 428 | 429 | final Calendar instance = Calendar.getInstance(); 430 | instance.setTime(new Date(utcTime)); 431 | long l = utcTime % 1000L; 432 | 433 | result.setValue("" + l); 434 | return result; 435 | } 436 | 437 | 438 | public void hasFocus(boolean hasFocus) { 439 | this.hasFocus = hasFocus; 440 | } 441 | } 442 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/TreeController.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.event.ItemClickEvent; 4 | import com.vaadin.server.StreamResource; 5 | import com.vaadin.ui.Tree; 6 | import net.openhft.chronicle.engine.api.column.ColumnViewInternal; 7 | import net.openhft.chronicle.engine.api.column.MapColumnView; 8 | import net.openhft.chronicle.engine.api.column.QueueColumnView; 9 | import net.openhft.chronicle.engine.api.column.VaadinChart; 10 | import net.openhft.chronicle.engine.api.map.MapView; 11 | import net.openhft.chronicle.engine.api.pubsub.Subscriber; 12 | import net.openhft.chronicle.engine.api.tree.Asset; 13 | import net.openhft.chronicle.engine.api.tree.AssetTree; 14 | import net.openhft.chronicle.engine.api.tree.RequestContext; 15 | import net.openhft.chronicle.engine.query.Filter; 16 | import net.openhft.chronicle.engine.tree.QueueView; 17 | import net.openhft.chronicle.engine.tree.TopologicalEvent; 18 | import net.openhft.chronicle.threads.NamedThreadFactory; 19 | import org.jetbrains.annotations.NotNull; 20 | import org.jetbrains.annotations.Nullable; 21 | 22 | import java.util.Set; 23 | import java.util.concurrent.ExecutorService; 24 | import java.util.concurrent.Executors; 25 | 26 | /** 27 | * @author Rob Austin. 28 | */ 29 | class TreeController { 30 | 31 | static { 32 | RequestContext.loadDefaultAliases(); 33 | } 34 | 35 | private static final String MAP_VIEW = "::map_view"; 36 | private static final String QUEUE_VIEW = "::queue_view"; 37 | private static final String BAR_CHART_VIEW = "::barchart_view"; 38 | @NotNull 39 | final ItemClickEvent.ItemClickListener clickListener; 40 | @NotNull 41 | private final ChartUI histogramUI = new ChartUI(); 42 | @NotNull 43 | static ExecutorService executorService = Executors.newSingleThreadExecutor(new NamedThreadFactory 44 | ("scheduler", true)); 45 | 46 | TreeController(@NotNull final AssetTree remoteTree, 47 | @NotNull TreeUI treeUI) { 48 | 49 | final Tree tree = treeUI.tree; 50 | 51 | @NotNull RequestContext rc = RequestContext.requestContext("") 52 | .elementType(TopologicalEvent.class).bootstrap(true); 53 | 54 | @NotNull final Subscriber sub = e -> updateTree(tree, e, remoteTree); 55 | remoteTree.acquireSubscription(rc).registerSubscriber(rc, sub, Filter.empty()); 56 | 57 | clickListener = click -> { 58 | final String source = click.getItemId().toString(); 59 | treeUI.contents.removeAllComponents(); 60 | 61 | if (source.endsWith(BAR_CHART_VIEW)) { 62 | @NotNull final Asset asset = findAsset(source, remoteTree); 63 | @NotNull VaadinChart chart = asset.acquireView(VaadinChart.class); 64 | treeUI.contents.addComponent(histogramUI.getChart(chart)); 65 | return; 66 | } 67 | 68 | if (source.endsWith(MAP_VIEW) || source.endsWith(QUEUE_VIEW)) { 69 | @NotNull MapViewUI mapViewUI = new MapViewUI(); 70 | treeUI.contents.addComponent(mapViewUI); 71 | 72 | @NotNull Asset asset = findAsset(source, remoteTree); 73 | 74 | @Nullable 75 | final ColumnViewInternal view = source.endsWith(MAP_VIEW) ? 76 | asset.acquireView(MapColumnView.class) : 77 | asset.acquireView(QueueColumnView.class); 78 | 79 | @NotNull 80 | ColumnViewController mapControl = new ColumnViewController(view, 81 | mapViewUI, 82 | path(source)); 83 | mapControl.init(); 84 | 85 | } 86 | 87 | }; 88 | 89 | tree.addItemClickListener(clickListener); 90 | } 91 | 92 | 93 | @NotNull 94 | public Asset findAsset(@NotNull String source, @NotNull AssetTree remoteTree) { 95 | @NotNull final String path = path(source); 96 | return remoteTree.acquireAsset(path); 97 | } 98 | 99 | private String path(@NotNull String source) { 100 | final int len = source.length(); 101 | 102 | for (@NotNull String view : new String[]{MAP_VIEW, QUEUE_VIEW, BAR_CHART_VIEW}) { 103 | if (source.endsWith(view)) 104 | return source.substring(0, len - view.length()); 105 | } 106 | 107 | throw new IllegalStateException(); 108 | } 109 | 110 | private void updateTree(@NotNull Tree tree, @NotNull TopologicalEvent e, @NotNull AssetTree assetTree) { 111 | 112 | if (e.assetName() == null) 113 | return; 114 | 115 | tree.markAsDirty(); 116 | 117 | tree.addItem(e.fullName()); 118 | tree.setItemCaption(e.fullName(), e.name()); 119 | 120 | if (!"/".equals(e.assetName())) 121 | tree.setParent(e.fullName(), e.assetName()); 122 | 123 | tree.setItemIcon(e.fullName(), new StreamResource( 124 | () -> TreeController.class.getResourceAsStream("folder.png"), "folder")); 125 | 126 | tree.setChildrenAllowed(e.fullName(), true); 127 | 128 | 129 | Set viewTypes = e.viewTypes(); 130 | viewTypes.forEach(System.out::println); 131 | 132 | try { 133 | 134 | if (viewTypes.stream().anyMatch(VaadinChart.class::isAssignableFrom)) 135 | addBarChart(tree, e, assetTree); 136 | 137 | if (viewTypes.stream().anyMatch(QueueView.class::isAssignableFrom)) { 138 | addQueue(tree, e); 139 | return; 140 | } 141 | 142 | if (viewTypes.stream().anyMatch(MapView.class::isAssignableFrom)) { 143 | addMap(tree, e); 144 | return; 145 | } 146 | 147 | } catch (Throwable t) { 148 | t.printStackTrace(); 149 | } 150 | } 151 | 152 | private void addBarChart(@NotNull final Tree tree, @NotNull TopologicalEvent e, @NotNull AssetTree 153 | assetTree) { 154 | tree.addItem(e.fullName() + BAR_CHART_VIEW); 155 | tree.setParent(e.fullName() + BAR_CHART_VIEW, e.fullName()); 156 | 157 | // we can make an RPC call engine, while inside a TopologicalEvent 158 | executorService.submit(() -> { 159 | @NotNull VaadinChart chart = assetTree.acquireAsset(e.fullName()).acquireView(VaadinChart.class); 160 | final String menuLabel = chart.chartProperties().menuLabel; 161 | tree.setItemCaption(e.fullName() + BAR_CHART_VIEW, menuLabel == null ? "bar-chart" : 162 | menuLabel); 163 | }); 164 | 165 | tree.setItemIcon(e.fullName() + BAR_CHART_VIEW, new StreamResource( 166 | () -> TreeController.class.getResourceAsStream("chart.png"), "chart")); 167 | tree.setChildrenAllowed(e.fullName() + BAR_CHART_VIEW, false); 168 | } 169 | 170 | private void addMap(@NotNull Tree tree, @NotNull TopologicalEvent e) { 171 | tree.addItem(e.fullName() + MAP_VIEW); 172 | tree.setParent(e.fullName() + MAP_VIEW, e.fullName()); 173 | tree.setItemCaption(e.fullName() + MAP_VIEW, "map"); 174 | tree.setItemIcon(e.fullName() + MAP_VIEW, new StreamResource( 175 | () -> TreeController.class.getResourceAsStream("map.png"), "map")); 176 | tree.setChildrenAllowed(e.fullName() + MAP_VIEW, false); 177 | } 178 | 179 | private void addQueue(@NotNull Tree tree, @NotNull TopologicalEvent e) { 180 | tree.addItem(e.fullName() + QUEUE_VIEW); 181 | tree.setParent(e.fullName() + QUEUE_VIEW, e.fullName()); 182 | tree.setItemCaption(e.fullName() + QUEUE_VIEW, "queue"); 183 | tree.setItemIcon(e.fullName() + QUEUE_VIEW, new StreamResource( 184 | () -> TreeController.class.getResourceAsStream("queue.png"), "queue")); 185 | tree.setChildrenAllowed(e.fullName() + QUEUE_VIEW, false); 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/TreeUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.AutoGenerated; 4 | import com.vaadin.annotations.DesignRoot; 5 | import com.vaadin.ui.HorizontalLayout; 6 | import com.vaadin.ui.Tree; 7 | import com.vaadin.ui.VerticalLayout; 8 | import com.vaadin.ui.declarative.Design; 9 | 10 | /** 11 | * !! DO NOT EDIT THIS FILE !! 12 | * 13 | * This class is generated by Vaadin Designer and will be overwritten. 14 | * 15 | * Please make a subclass with logic and additional interfaces as needed, 16 | * e.g class LoginView extends LoginDesign implements View { } 17 | */ 18 | @DesignRoot 19 | @AutoGenerated 20 | @SuppressWarnings("serial") 21 | public class TreeUI extends HorizontalLayout { 22 | protected Tree tree; 23 | protected VerticalLayout contents; 24 | 25 | 26 | public TreeUI() { 27 | Design.read(this); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/UserControl.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.addon.charts.Chart; 4 | import com.vaadin.addon.charts.model.*; 5 | import com.vaadin.addon.charts.model.style.SolidColor; 6 | import com.vaadin.server.Sizeable; 7 | import com.vaadin.ui.Component; 8 | import com.vaadin.ui.UI; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | import java.util.Random; 13 | import java.util.concurrent.ExecutionException; 14 | import java.util.concurrent.Future; 15 | 16 | /** 17 | * @author Rob Austin. 18 | */ 19 | class UserControl { 20 | 21 | 22 | @NotNull 23 | Component newComponent() { 24 | @NotNull final UserUI components = new UserUI(); 25 | components.readBps.addComponent(newRandomChart("readBps")); 26 | components.writeBps.addComponent(newRandomChart("writeBps")); 27 | return components; 28 | } 29 | 30 | @NotNull 31 | private Chart newRandomChart(final String text) { 32 | @NotNull final Random random = new Random(); 33 | 34 | @NotNull final Chart chart = new Chart(); 35 | chart.setWidth("500px"); 36 | 37 | final Configuration configuration = chart.getConfiguration(); 38 | 39 | configuration.getChart().setType(ChartType.SPLINE); 40 | configuration.getTitle().setText(text); 41 | 42 | XAxis xAxis = configuration.getxAxis(); 43 | xAxis.setType(AxisType.DATETIME); 44 | xAxis.setTickPixelInterval(200); 45 | 46 | YAxis yAxis = configuration.getyAxis(); 47 | yAxis.setTitle(new AxisTitle("K Bytes Per Second")); 48 | yAxis.setPlotLines(new PlotLine(0, 1, new SolidColor("#808080"))); 49 | 50 | configuration.getTooltip().setEnabled(false); 51 | configuration.getLegend().setEnabled(false); 52 | 53 | @NotNull final DataSeries series2 = new DataSeries(); 54 | { 55 | @NotNull PlotOptionsLine plotOptions = new PlotOptionsLine(); 56 | series2.setPlotOptions(plotOptions); 57 | } 58 | @NotNull final DataSeries series = new DataSeries(); 59 | @NotNull PlotOptionsColumn plotOptions = new PlotOptionsColumn(); 60 | plotOptions.setColor(new SolidColor("#F0F0F0")); 61 | series.setPlotOptions(plotOptions); 62 | 63 | 64 | series.setName("Random data"); 65 | for (int i = -(5 * 60); i <= 0; i++) { 66 | series.add(new DataSeriesItem( 67 | System.currentTimeMillis() + i * 1000, random.nextDouble())); 68 | series2.add(new DataSeriesItem( 69 | System.currentTimeMillis() + i * 1000, 0.5 + ((random.nextDouble() * 0.2) - 70 | 0.1))); 71 | } 72 | runWhileAttached(chart, () -> { 73 | final long x = System.currentTimeMillis(); 74 | final double y = random.nextDouble(); 75 | @NotNull DataSeriesItem item = new DataSeriesItem(x, y); 76 | @NotNull DataSeriesItem item1 = new DataSeriesItem(x, 0.5 + ((random.nextDouble() * 0.2) - 77 | 0.1)); 78 | series.add(item, true, true); 79 | series2.add(item1, true, true); 80 | 81 | series.update(item); 82 | series2.update(item1); 83 | }, 2000, 2000); 84 | 85 | 86 | configuration.addSeries(series); 87 | configuration.addSeries(series2); 88 | 89 | chart.drawChart(configuration); 90 | chart.setWidth(100, Sizeable.Unit.PERCENTAGE); 91 | return chart; 92 | } 93 | 94 | 95 | /** 96 | * Runs given task repeatedly until the reference component is attached 97 | * 98 | * @param component 99 | * @param task 100 | * @param interval 101 | * @param initialPause a timeout after tas is started 102 | */ 103 | private static void runWhileAttached(@NotNull final Component component, 104 | final Runnable task, 105 | final int interval, 106 | final int initialPause) { 107 | // Until reliable push available in our demo servers 108 | UI.getCurrent().setPollInterval(interval); 109 | 110 | @NotNull final Thread thread = new Thread() { 111 | @Override 112 | public void run() { 113 | try { 114 | Thread.sleep(initialPause); 115 | while (component.getUI() != null) { 116 | Future future = component.getUI().access(task); 117 | future.get(); 118 | Thread.sleep(interval); 119 | } 120 | } catch (@NotNull InterruptedException | com.vaadin.ui.UIDetachedException e) { 121 | } catch (ExecutionException e) { 122 | System.out.println("Stopping repeating command due to an exception"); 123 | 124 | } catch (Exception e) { 125 | System.out.println("Unexpected exception while running scheduled update"); 126 | } 127 | System.out.println("Thread stopped"); 128 | } 129 | 130 | ; 131 | }; 132 | thread.start(); 133 | } 134 | 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/net/openhft/chronicle/engine/gui/UserUI.java: -------------------------------------------------------------------------------- 1 | package net.openhft.chronicle.engine.gui; 2 | 3 | import com.vaadin.annotations.AutoGenerated; 4 | import com.vaadin.annotations.DesignRoot; 5 | import com.vaadin.ui.declarative.Design; 6 | import com.vaadin.ui.VerticalLayout; 7 | import com.vaadin.ui.ComboBox; 8 | 9 | /** 10 | * !! DO NOT EDIT THIS FILE !! 11 | * 12 | * This class is generated by Vaadin Designer and will be overwritten. 13 | * 14 | * Please make a subclass with logic and additional interfaces as needed, 15 | * e.g class LoginView extends LoginDesign implements View { } 16 | */ 17 | @DesignRoot 18 | @AutoGenerated 19 | @SuppressWarnings("serial") 20 | public class UserUI extends VerticalLayout { 21 | protected ComboBox userName; 22 | protected VerticalLayout readBps; 23 | protected VerticalLayout writeBps; 24 | 25 | public UserUI() { 26 | Design.read(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-Engine_200px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-Engine_200px.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-bar-graph_interface-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-bar-graph_interface-icon.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-folder_interface-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/Chronicle-folder_interface-icon.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/MainUI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Chronicle Engine 14 | 15 | 16 | 17 | Menu 18 | 19 | 20 | 21 | User 22 | 23 | 24 | Tree 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/MapViewUI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | EntrySubscriberCount 16 | 17 | 18 | 19 | 20 | String 21 | 22 | 23 | 24 | 25 | 26 | 27 | NumberOfRecords 28 | 29 | 30 | 31 | 32 | String 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | TopicSubscriberCount 43 | 44 | 45 | 46 | 47 | String 48 | 49 | 50 | 51 | 52 | 53 | 54 | KeySubscriberCount 55 | 56 | 57 | 58 | 59 | String 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Path 70 | 71 | 72 | 73 | 74 | /user/data/mymap 75 | 76 | 77 | 78 | 79 | 80 | 81 | KeyStore 82 | 83 | 84 | 85 | 86 | 102,322 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Add 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/QueueViewUI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Path 17 | 18 | 19 | 20 | 21 | /user/data/myqueue 22 | 23 | 24 | 25 | 26 | 27 | 28 | Type 29 | 30 | 31 | 32 | 33 | Chronicle Queue 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Chronicle Queue 45 | 46 | 47 | 48 | Search 49 | 50 | 51 | 52 | records : 0..9 /1024 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 |
Element
Customer Project 1
Customer Project 2
Customer Project 3
Customer Project 4
Customer Project 5
Customer Project 6
Customer Project 7
Customer Project 8
Customer Project 9
95 |
96 |
97 |
98 | 99 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/TreeUI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/UserUI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | User 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/chart.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/folder.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/map.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/queue.png -------------------------------------------------------------------------------- /src/main/resources/net/openhft/chronicle/engine/gui/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/resources/net/openhft/chronicle/engine/gui/trash.png -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/webapp/VAADIN/themes/mytheme/add.png -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/addons.scss: -------------------------------------------------------------------------------- 1 | /* This file is automatically managed and will be overwritten from time to time. */ 2 | /* Do not manually edit this file. */ 3 | 4 | /* Import and include this mixin into your project theme to include the addon themes */ 5 | @mixin addons { 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/designs.scss: -------------------------------------------------------------------------------- 1 | // Styles imported from Responsive Application 2 | // Workaround for a https://dev.vaadin.com/ticket/19170 to get hidden icons in some environments to show 3 | #responsive-application-template.valo-menu-responsive .valo-menu-part .valo-menu-item span.v-icon { 4 | opacity: 1.0; 5 | } 6 | 7 | 8 | // Styles imported from NavigationTemplateDark 9 | .root-layout.navigation-template-dark { 10 | $root-background-color: #000; 11 | $template-font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 12 | 13 | $header-bar-background: #323C3C; 14 | $header-bar-font-size: 16px; 15 | $header-bar-text-color: #C8D2D2; 16 | 17 | $search-field-border: 0; 18 | $search-field-bevel: 0; 19 | $search-field-prompt-color: #959595; 20 | $search-field-border-color: #586262; 21 | $username-label-color: #fff; 22 | 23 | $side-bar-background: $header-bar-background; 24 | $menu-button-selected-text-color: #C8D2D2; 25 | $menu-button-selected-background: $root-background-color; 26 | $menu-button-text-color: $menu-button-selected-text-color; 27 | $menu-button-icon-color: $menu-button-selected-text-color; 28 | 29 | background-color: $root-background-color; 30 | 31 | .header-bar .v-nativebutton, 32 | .side-bar .v-nativebutton { 33 | background: none; 34 | border: none; 35 | 36 | &:hover{ 37 | cursor: pointer; 38 | } 39 | } 40 | 41 | .scroll-panel { 42 | background-color: $root-background-color; 43 | border: none; 44 | border-radius: 0; 45 | } 46 | 47 | .header-bar { 48 | background-color: $header-bar-background; 49 | padding: 0px 15px 0 15px; 50 | vertical-align: middle; 51 | height: 65px; 52 | 53 | > * { 54 | color: $header-bar-text-color; 55 | float: right; 56 | padding: 0; 57 | line-height: 20px; 58 | margin-left: 15px; 59 | font-size: $header-bar-font-size; 60 | font-family: $template-font-family; 61 | 62 | /** Vertically center everything **/ 63 | position: relative; 64 | top: 50%; 65 | -webkit-transform: translateY(-50%); 66 | -ms-transform: translateY(-50%); 67 | transform: translateY(-50%); 68 | } 69 | 70 | > .search-field { 71 | background: none; 72 | color: $search-field-prompt-color; 73 | padding-left: 5px; 74 | box-shadow: none; 75 | border: $search-field-border; 76 | border-bottom: solid 2px $search-field-border-color; 77 | border-radius: 0; 78 | font-style: italic; 79 | } 80 | 81 | .user-name-label { 82 | color: $username-label-color; 83 | } 84 | } 85 | 86 | .side-bar { 87 | background-color: $side-bar-background; 88 | width: 100px; 89 | 90 | > .menu-button { 91 | position: relative; 92 | color: $menu-button-text-color; 93 | height: 90px; 94 | 95 | &.selected{ 96 | background-color: $menu-button-selected-background; 97 | 98 | .v-nativebutton-caption { 99 | color: $menu-button-selected-text-color; 100 | } 101 | 102 | } 103 | 104 | .v-nativebutton-caption { 105 | font-family: $template-font-family; 106 | font-size: .7em; 107 | text-transform: uppercase; 108 | position: absolute; 109 | bottom: 8px; 110 | text-align: center; 111 | left: 0; 112 | right: 0; 113 | margin-left: auto; 114 | margin-right: auto; 115 | } 116 | 117 | .v-icon { 118 | color: $menu-button-icon-color; 119 | position: absolute; 120 | font-size: 35px; 121 | margin-left: auto; 122 | margin-right: auto; 123 | top: 10px; 124 | left: 0; 125 | right: 0; 126 | } 127 | } 128 | } 129 | 130 | .dashboard-layout { 131 | padding: 60px 60px 0 60px; 132 | } 133 | 134 | &[width-range~="321px-768px"] { 135 | .dashboard-layout{ 136 | padding: 10px; 137 | } 138 | 139 | .dashboard-item { 140 | width: 100% !important; 141 | min-width: 321px; 142 | margin: 0; 143 | } 144 | 145 | .side-bar { 146 | width: 60px; 147 | 148 | > .menu-button{ 149 | 150 | height: 50px; 151 | 152 | > .v-nativebutton-caption{ 153 | visibility: hidden; 154 | } 155 | 156 | > .v-icon{ 157 | top: 0; 158 | } 159 | } 160 | } 161 | 162 | .header-bar { 163 | height: 45px; 164 | padding: 2px; 165 | } 166 | } 167 | } 168 | 169 | .navigation-template-dark[width-range~="321px-768px"] { 170 | visibility: visible; 171 | } 172 | 173 | -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/webapp/VAADIN/themes/mytheme/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/mytheme.scss: -------------------------------------------------------------------------------- 1 | // If you edit this file you need to compile the theme. See README.md for details. 2 | 3 | // Global variable overrides. Must be declared before importing Valo. 4 | 5 | // Defines the plaintext font size, weight and family. Font size affects general component sizing. 6 | //$v-font-size: 16px; 7 | //$v-font-weight: 300; 8 | //$v-font-family: "Open Sans", sans-serif; 9 | 10 | // Defines the border used by all components. 11 | //$v-border: 1px solid (v-shade 0.7); 12 | //$v-border-radius: 4px; 13 | 14 | // Affects the color of some component elements, e.g Button, Panel barChartProperties, etc 15 | //$v-background-color: hsl(210, 0%, 98%); 16 | // Affects the color of content areas, e.g Panel and Window content, TextField input etc 17 | //$v-app-background-color: $v-background-color; 18 | 19 | // Affects the visual appearance of all components 20 | //$v-gradient: v-linear 8%; 21 | //$v-bevel-depth: 30%; 22 | //$v-shadow-opacity: 5%; 23 | 24 | // Defines colors for indicating status (focus, success, failure) 25 | //$v-focus-color: valo-focus-color(); // Calculates a suitable color automatically 26 | //$v-friendly-color: #2c9720; 27 | //$v-error-indicator-color: #ed473b; 28 | 29 | // For more information, see: https://vaadin.com/book/-/page/themes.valo.html 30 | // Example variants can be copy/pasted from https://vaadin.com/wiki/-/wiki/Main/Valo+Examples 31 | 32 | @import "../valo/valo.scss"; 33 | 34 | @mixin mytheme { 35 | @include valo; 36 | 37 | .myTableStyle .v-icon { 38 | font-size: 30px; 39 | } 40 | 41 | .content{ 42 | border-bottom: 1px solid #ccc; 43 | border-right: 1px solid #ccc; 44 | border-left: 1px solid #ccc; 45 | border-top: 1px solid #ccc; 46 | } 47 | 48 | 49 | 50 | // Insert your own theme rules here 51 | } 52 | -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/styles.scss: -------------------------------------------------------------------------------- 1 | @import "designs.scss"; 2 | @import "mytheme.scss"; 3 | @import "addons.scss"; 4 | 5 | // This file prefixes all rules with the theme name to avoid causing conflicts with other themes. 6 | // The actual styles should be defined in mytheme.scss 7 | 8 | .mytheme { 9 | @include addons; 10 | @include mytheme; 11 | } 12 | 13 | .layout-with-border { 14 | border: 1px solid black; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/webapp/VAADIN/themes/mytheme/trash3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenHFT/Chronicle-Engine-GUI/3ba5aacc23eff951050fabc682508f576200a3b1/src/main/webapp/VAADIN/themes/mytheme/trash3.png --------------------------------------------------------------------------------