Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 16a047702310c60b81fc8803c00321da80966414 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*****************************************************************************
 * Copyright (c) 2010 CEA LIST.
 *
 *    
 * 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:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.preferences.ui;

import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.papyrus.preferences.Messages;
import org.eclipse.papyrus.preferences.utils.PreferenceConstantHelper;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;

// TODO: Auto-generated Javadoc
/**
 * The Class DimensionGroup that display fields for the the dimension of a node (width, height)
 */
public class DimensionGroup extends AbstractGroup {

	/** The Constant HEIGHT_INTFIELDEDITOR_LABEL. */
	private static final String HEIGHT_INTFIELDEDITOR_LABEL = "height";

	/** The Constant WIDTH_INTFIELDEDITOR_LABEL. */
	private static final String WIDTH_INTFIELDEDITOR_LABEL = "width";

	/** The width fied editor. */
	protected IntegerFieldEditor widthFiedEditor;

	/** The height fied editor. */
	protected IntegerFieldEditor heightFiedEditor;

	/**
	 * Instantiates a new dimension group.
	 * 
	 * @param parent
	 *        the parent
	 * @param key
	 *        the key
	 * @param dialogPage
	 *        the dialog page
	 */
	public DimensionGroup(Composite parent, String key, DialogPage dialogPage) {
		super(parent, key, dialogPage);
		createContent(parent);
	}

	/**
	 * Creates the content.
	 * 
	 * @param parent
	 *        the parent
	 */
	public void createContent(Composite parent) {
		Group decorationGroup = new Group(parent, 4);
		decorationGroup.setLayout(new GridLayout());
		decorationGroup.setText(Messages.DimensionGroupName);

		widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
		widthFiedEditor.setPage(dialogPage);

		addFieldEditor(widthFiedEditor);

		heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferenceConstantHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
		heightFiedEditor.setPage(dialogPage);

		addFieldEditor(heightFiedEditor);

	}
}

Back to the top