1 /*******************************************************************************
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.charts.preference;
14 import org.simantics.charts.ontology.ChartResource;
15 import org.simantics.databoard.annotations.Optional;
16 import org.simantics.databoard.annotations.Range;
17 import org.simantics.databoard.annotations.Unit;
18 import org.simantics.databoard.util.Bean;
20 public class ChartTimeWindowTemplate extends Bean {
22 public static final ChartTimeWindowTemplate WholeHistory, Last60Seconds, Last10Minutes;
23 public static final String[][] radioGroup;
28 public @Unit("s") @Optional Double HasTimeWindowStart;
29 public @Unit("s") @Optional Double TimeWindowLength;
30 public @Range("[0..100]") @Optional Double TimeWindowIncrement;
32 public static ChartTimeWindowTemplate getTemplate(String id)
34 if (id.equals(WholeHistory.id)) return WholeHistory;
35 if (id.equals(Last60Seconds.id)) return Last60Seconds;
36 if (id.equals(Last10Minutes.id)) return Last10Minutes;
41 WholeHistory = new ChartTimeWindowTemplate();
42 WholeHistory.id = "WholeHistory";
43 WholeHistory.Label = "Whole History";
44 WholeHistory.TimeWindowIncrement = 50.0;
45 WholeHistory.uri = ChartResource.URIs.WholeHistoryChartTemplate;
47 Last60Seconds = new ChartTimeWindowTemplate();
48 Last60Seconds.id = "Last60Seconds";
49 Last60Seconds.Label = "Last 60 Seconds";
50 Last60Seconds.TimeWindowIncrement = 50.0;
51 Last60Seconds.TimeWindowLength = 60.0;
52 Last60Seconds.uri = ChartResource.URIs.Last60SecondsChartTemplate;
54 Last10Minutes = new ChartTimeWindowTemplate();
55 Last10Minutes.id = "Last10Minutes";
56 Last10Minutes.Label = "Last 10 Minutes";
57 Last10Minutes.TimeWindowIncrement = 50.0;
58 Last10Minutes.TimeWindowLength = 600.0;
59 Last10Minutes.uri = ChartResource.URIs.Last10MinutesChartTemplate;
63 { WholeHistory.Label, WholeHistory.id },
64 { Last60Seconds.Label, Last60Seconds.id },
65 { Last10Minutes.Label, Last10Minutes.id }
69 public static void main(String[] args) throws Exception {
71 System.out.println( WholeHistory );
72 System.out.println( Last60Seconds );
73 System.out.println( Last10Minutes );