X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Fpreference%2FChartTimeWindowTemplate.java;fp=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Fpreference%2FChartTimeWindowTemplate.java;h=3c227e7c40971cba8a1bbe457cd2af390d9a819e;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartTimeWindowTemplate.java b/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartTimeWindowTemplate.java new file mode 100644 index 000000000..3c227e7c4 --- /dev/null +++ b/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartTimeWindowTemplate.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.charts.preference; + +import org.simantics.charts.ontology.ChartResource; +import org.simantics.databoard.annotations.Optional; +import org.simantics.databoard.annotations.Range; +import org.simantics.databoard.annotations.Unit; +import org.simantics.databoard.util.Bean; + +public class ChartTimeWindowTemplate extends Bean { + + public static final ChartTimeWindowTemplate WholeHistory, Last60Seconds, Last10Minutes; + public static final String[][] radioGroup; + + public String id; + public String Label; + public String uri; + public @Unit("s") @Optional Double HasTimeWindowStart; + public @Unit("s") @Optional Double TimeWindowLength; + public @Range("[0..100]") @Optional Double TimeWindowIncrement; + + public static ChartTimeWindowTemplate getTemplate(String id) + { + if (id.equals(WholeHistory.id)) return WholeHistory; + if (id.equals(Last60Seconds.id)) return Last60Seconds; + if (id.equals(Last10Minutes.id)) return Last10Minutes; + return null; + } + + static { + WholeHistory = new ChartTimeWindowTemplate(); + WholeHistory.id = "WholeHistory"; + WholeHistory.Label = "Whole History"; + WholeHistory.TimeWindowIncrement = 50.0; + WholeHistory.uri = ChartResource.URIs.WholeHistoryChartTemplate; + + Last60Seconds = new ChartTimeWindowTemplate(); + Last60Seconds.id = "Last60Seconds"; + Last60Seconds.Label = "Last 60 Seconds"; + Last60Seconds.TimeWindowIncrement = 50.0; + Last60Seconds.TimeWindowLength = 60.0; + Last60Seconds.uri = ChartResource.URIs.Last60SecondsChartTemplate; + + Last10Minutes = new ChartTimeWindowTemplate(); + Last10Minutes.id = "Last10Minutes"; + Last10Minutes.Label = "Last 10 Minutes"; + Last10Minutes.TimeWindowIncrement = 50.0; + Last10Minutes.TimeWindowLength = 600.0; + Last10Minutes.uri = ChartResource.URIs.Last10MinutesChartTemplate; + + radioGroup = + new String[][] { + { WholeHistory.Label, WholeHistory.id }, + { Last60Seconds.Label, Last60Seconds.id }, + { Last10Minutes.Label, Last10Minutes.id } + }; + } + + public static void main(String[] args) throws Exception { + + System.out.println( WholeHistory ); + System.out.println( Last60Seconds ); + System.out.println( Last10Minutes ); + + } + +}