1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.trend.chart.properties.bar;
\r
14 import org.eclipse.jface.layout.GridDataFactory;
\r
15 import org.eclipse.jface.layout.GridLayoutFactory;
\r
16 import org.eclipse.swt.SWT;
\r
17 import org.eclipse.swt.widgets.Composite;
\r
18 import org.eclipse.swt.widgets.Label;
\r
19 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;
\r
20 import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
\r
21 import org.simantics.browsing.ui.swt.widgets.TrackedText;
\r
22 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
\r
23 import org.simantics.db.management.ISessionContext;
\r
24 import org.simantics.layer0.Layer0;
\r
25 import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;
\r
26 import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory;
\r
27 import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier;
\r
28 import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite;
\r
31 * Composite for modifying properties of a series in a bar chart
\r
32 * @author Teemu Lempinen
\r
35 public class BarSeriesPropertyComposite extends Composite {
\r
37 private TrackedText variable, label;
\r
39 public BarSeriesPropertyComposite(Composite parent, final ISessionContext context, WidgetSupport support, int style) {
\r
40 super(parent, style);
\r
42 GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);
\r
44 // Variable for the series
\r
45 Label label = new Label(this, SWT.NONE);
\r
46 label.setText("Variable:");
\r
47 GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);
\r
49 variable = new TrackedText(this, support, SWT.BORDER);
\r
50 variable.setTextFactory(new RVIFactory());
\r
51 variable.addModifyListener(new RVIModifier(variable.getWidget(), support));
\r
52 variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));
\r
53 GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());
\r
56 label = new Label(this, SWT.NONE);
\r
57 label.setText("Range:");
\r
58 GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);
\r
60 RangeComposite rangeComposite = new RangeComposite(this, context, support, SWT.NONE);
\r
61 GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);
\r
64 // Label to be displayed in chart for this series
\r
65 label = new Label(this, SWT.NONE);
\r
66 label.setText("Label:");
\r
67 GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);
\r
69 this.label = new TrackedText(this, support, SWT.BORDER);
\r
70 this.label.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));
\r
71 this.label.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));
\r
72 this.label.setColorProvider(new JFreeChartPropertyColorProvider(this.label.getResourceManager()));
\r
73 GridDataFactory.fillDefaults().grab(true, false).applyTo(this.label.getWidget());
\r