X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Fpreference%2FChartPreferencePage.java;fp=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Fpreference%2FChartPreferencePage.java;h=675b429cb291a77434f19b9f8aba39ed67590899;hp=aab09b8d6996b66afc8e0c9dbfbe91851fa8ed69;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartPreferencePage.java b/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartPreferencePage.java index aab09b8d6..675b429cb 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartPreferencePage.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/preference/ChartPreferencePage.java @@ -1,144 +1,144 @@ -/******************************************************************************* - * Copyright (c) 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.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.simantics.charts.Activator; -import org.simantics.trend.configuration.ItemPlacement; -import org.simantics.trend.configuration.TimeFormat; -import org.simantics.trend.configuration.LineQuality; - -/** - * @author Toni Kalajainen - */ -public class ChartPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - private IntegerFieldEditor fRedrawIntervalEditor = null; - private IntegerFieldEditor fAutoscaleIntervalEditor = null; - private BooleanFieldEditor fDrawSamplesEditor = null; - private RadioGroupFieldEditor fTimeFormatEditor = null; - private RadioGroupFieldEditor fItemPlacementEditor = null; - private RadioGroupFieldEditor fValueFormatEditor = null; - private RadioGroupFieldEditor fLineQualityEditor = null; - private RadioGroupFieldEditor fTextQualityEditor = null; - - - /** - * Create the console page. - */ - public ChartPreferencePage() { - super(GRID); - - //setDescription("Chart prefrences"); - setPreferenceStore(Activator.getDefault().getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(Composite) - */ - @Override - public void createControl(Composite parent) { - super.createControl(parent); - } - - /** - * Create all field editors for this page - */ - @Override - public void createFieldEditors() { - fRedrawIntervalEditor = new IntegerFieldEditor(ChartPreferences.P_REDRAW_INTERVAL, Messages.ChartPreferencePage_redrawIntervalLabel, getFieldEditorParent()); - fRedrawIntervalEditor.setValidRange(1, Integer.MAX_VALUE); - fRedrawIntervalEditor.setErrorMessage(Messages.ChartPreferencePage_redrawIntervalInvalid); - addField(fRedrawIntervalEditor); - - fAutoscaleIntervalEditor = new IntegerFieldEditor(ChartPreferences.P_AUTOSCALE_INTERVAL, Messages.ChartPreferencePage_autoscaleIntervalLabel, getFieldEditorParent()); - fAutoscaleIntervalEditor.setValidRange(1, Integer.MAX_VALUE); - fAutoscaleIntervalEditor.setErrorMessage(Messages.ChartPreferencePage_autoscaleIntervalInvalid); - addField(fAutoscaleIntervalEditor); - - fDrawSamplesEditor = new BooleanFieldEditor(ChartPreferences.P_DRAW_SAMPLES, Messages.ChartPreferencePage_drawSamplesLabel, getFieldEditorParent()); - addField(fDrawSamplesEditor); - - fTimeFormatEditor = new RadioGroupFieldEditor( - ChartPreferences.P_TIMEFORMAT, - "Preferred time format", - 1, - new String[][] { - new String[] {"Time", TimeFormat.Time.name()}, - new String[] {"Decimal", TimeFormat.Decimal.name()} - }, - getFieldEditorParent()); - addField(fTimeFormatEditor); - - fValueFormatEditor = new RadioGroupFieldEditor( - ChartPreferences.P_VALUEFORMAT, - "Preferred value format", - 1, - new String[][] { - new String[] {"Default", "Default"}, - new String[] {"Currency", "Currency"}, - new String[] {"Scientific", "Scientific"}, - new String[] {"Engineering", "Engineering"} - }, - getFieldEditorParent()); - addField(fValueFormatEditor); - - fItemPlacementEditor = new RadioGroupFieldEditor( - ChartPreferences.P_ITEMPLACEMENT, - "Item autoscale placement", - 1, - new String[][] { - new String[] {"Stacked", ItemPlacement.Stacked.name()}, - new String[] {"Overlapping", ItemPlacement.Overlapping.name()} - }, - getFieldEditorParent()); - addField(fItemPlacementEditor); - - fLineQualityEditor = new RadioGroupFieldEditor( - ChartPreferences.P_LINEQUALITY, - "Line Quality", - 1, - new String[][] { - new String[] {"Normal", LineQuality.Normal.name()}, - new String[] {"Anti-alias", LineQuality.Antialias.name()} - }, - getFieldEditorParent()); - addField( fLineQualityEditor ); - - fTextQualityEditor = new RadioGroupFieldEditor( - ChartPreferences.P_TEXTQUALITY, - "Text Quality", - 1, - new String[][] { - new String[] {"Normal", LineQuality.Normal.name()}, - new String[] {"Anti-alias", LineQuality.Antialias.name()} - }, - getFieldEditorParent()); - addField( fTextQualityEditor ); - - } - - /** - * @see IWorkbenchPreferencePage#init(IWorkbench) - */ - @Override - public void init(IWorkbench workbench) { - } - - -} +/******************************************************************************* + * Copyright (c) 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.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.simantics.charts.Activator; +import org.simantics.trend.configuration.ItemPlacement; +import org.simantics.trend.configuration.TimeFormat; +import org.simantics.trend.configuration.LineQuality; + +/** + * @author Toni Kalajainen + */ +public class ChartPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + private IntegerFieldEditor fRedrawIntervalEditor = null; + private IntegerFieldEditor fAutoscaleIntervalEditor = null; + private BooleanFieldEditor fDrawSamplesEditor = null; + private RadioGroupFieldEditor fTimeFormatEditor = null; + private RadioGroupFieldEditor fItemPlacementEditor = null; + private RadioGroupFieldEditor fValueFormatEditor = null; + private RadioGroupFieldEditor fLineQualityEditor = null; + private RadioGroupFieldEditor fTextQualityEditor = null; + + + /** + * Create the console page. + */ + public ChartPreferencePage() { + super(GRID); + + //setDescription("Chart prefrences"); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createControl(Composite) + */ + @Override + public void createControl(Composite parent) { + super.createControl(parent); + } + + /** + * Create all field editors for this page + */ + @Override + public void createFieldEditors() { + fRedrawIntervalEditor = new IntegerFieldEditor(ChartPreferences.P_REDRAW_INTERVAL, Messages.ChartPreferencePage_redrawIntervalLabel, getFieldEditorParent()); + fRedrawIntervalEditor.setValidRange(1, Integer.MAX_VALUE); + fRedrawIntervalEditor.setErrorMessage(Messages.ChartPreferencePage_redrawIntervalInvalid); + addField(fRedrawIntervalEditor); + + fAutoscaleIntervalEditor = new IntegerFieldEditor(ChartPreferences.P_AUTOSCALE_INTERVAL, Messages.ChartPreferencePage_autoscaleIntervalLabel, getFieldEditorParent()); + fAutoscaleIntervalEditor.setValidRange(1, Integer.MAX_VALUE); + fAutoscaleIntervalEditor.setErrorMessage(Messages.ChartPreferencePage_autoscaleIntervalInvalid); + addField(fAutoscaleIntervalEditor); + + fDrawSamplesEditor = new BooleanFieldEditor(ChartPreferences.P_DRAW_SAMPLES, Messages.ChartPreferencePage_drawSamplesLabel, getFieldEditorParent()); + addField(fDrawSamplesEditor); + + fTimeFormatEditor = new RadioGroupFieldEditor( + ChartPreferences.P_TIMEFORMAT, + "Preferred time format", + 1, + new String[][] { + new String[] {"Time", TimeFormat.Time.name()}, + new String[] {"Decimal", TimeFormat.Decimal.name()} + }, + getFieldEditorParent()); + addField(fTimeFormatEditor); + + fValueFormatEditor = new RadioGroupFieldEditor( + ChartPreferences.P_VALUEFORMAT, + "Preferred value format", + 1, + new String[][] { + new String[] {"Default", "Default"}, + new String[] {"Currency", "Currency"}, + new String[] {"Scientific", "Scientific"}, + new String[] {"Engineering", "Engineering"} + }, + getFieldEditorParent()); + addField(fValueFormatEditor); + + fItemPlacementEditor = new RadioGroupFieldEditor( + ChartPreferences.P_ITEMPLACEMENT, + "Item autoscale placement", + 1, + new String[][] { + new String[] {"Stacked", ItemPlacement.Stacked.name()}, + new String[] {"Overlapping", ItemPlacement.Overlapping.name()} + }, + getFieldEditorParent()); + addField(fItemPlacementEditor); + + fLineQualityEditor = new RadioGroupFieldEditor( + ChartPreferences.P_LINEQUALITY, + "Line Quality", + 1, + new String[][] { + new String[] {"Normal", LineQuality.Normal.name()}, + new String[] {"Anti-alias", LineQuality.Antialias.name()} + }, + getFieldEditorParent()); + addField( fLineQualityEditor ); + + fTextQualityEditor = new RadioGroupFieldEditor( + ChartPreferences.P_TEXTQUALITY, + "Text Quality", + 1, + new String[][] { + new String[] {"Normal", LineQuality.Normal.name()}, + new String[] {"Anti-alias", LineQuality.Antialias.name()} + }, + getFieldEditorParent()); + addField( fTextQualityEditor ); + + } + + /** + * @see IWorkbenchPreferencePage#init(IWorkbench) + */ + @Override + public void init(IWorkbench workbench) { + } + + +}