]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
f8334c71348bdecf970dd3d3d2c5a9519872719b
[simantics/sysdyn.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.sysdyn.ui.trend.chart.properties;\r
13 \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.Group;\r
19 import org.simantics.browsing.ui.swt.widgets.Button;\r
20 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
21 import org.simantics.db.management.ISessionContext;\r
22 import org.simantics.sysdyn.JFreeChartResource;\r
23 \r
24 /**\r
25  * Class containing properties for hiding pars of an axis\r
26  * \r
27  * @author Teemu Lempinen\r
28  *\r
29  */\r
30 public class AxisHidePropertyComposite extends Composite {\r
31 \r
32     public AxisHidePropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
33         super(parent, style);\r
34         \r
35         GridLayoutFactory.fillDefaults().applyTo(this);\r
36         \r
37         Group hideGroup  = new Group(this, SWT.NONE);\r
38         hideGroup.setText("Hide");\r
39         GridDataFactory.fillDefaults().applyTo(hideGroup);\r
40         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
41         \r
42         Button label = new Button(hideGroup, support, SWT.CHECK);\r
43         label.setText("Label");\r
44         label.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Axis_visibleLabel, true));\r
45         label.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Axis_visibleLabel));\r
46         GridDataFactory.fillDefaults().applyTo(label.getWidget());\r
47 \r
48         Button tmarks = new Button(hideGroup, support, SWT.CHECK);\r
49         tmarks.setText("Tick marks");\r
50         tmarks.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Axis_visibleTickMarks, true));\r
51         tmarks.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Axis_visibleTickMarks));\r
52         GridDataFactory.fillDefaults().applyTo(tmarks.getWidget());\r
53         \r
54         Button axisLine = new Button(hideGroup, support, SWT.CHECK);\r
55         axisLine.setText("Axis line");\r
56         axisLine.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Axis_visibleAxisLine, true));\r
57         axisLine.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Axis_visibleAxisLine));\r
58         GridDataFactory.fillDefaults().applyTo(axisLine.getWidget());\r
59 \r
60         Button tlabels = new Button(hideGroup, support, SWT.CHECK);\r
61         tlabels.setText("Tick labels");\r
62         tlabels.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Axis_visibleTickLabels, true));\r
63         tlabels.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Axis_visibleTickLabels));\r
64         GridDataFactory.fillDefaults().applyTo(tlabels.getWidget());\r
65     }\r
66 \r
67 }\r