Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: da9bff31fc5d9c30d5a4152bffaf720a71fbcccf (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*****************************************************************************
 * Copyright (c) 2011 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:
 *	Amine EL KOUHEN (CEA LIST/LIFL) - Amine.Elkouhen@cea.fr
 *  Vincent Lorenzo (CEA LIST) - Vincent.lorenzo@cea.fr - bug 481507
 *****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview;

import java.util.List;

import org.eclipse.papyrus.infra.services.decoration.util.DecorationImageUtils;
import org.eclipse.papyrus.infra.services.decoration.util.IPapyrusDecoration;
import org.eclipse.swt.graphics.Image;



/**
 * The Class ModelExplorerDecorationAdapter.
 */
public class ModelExplorerDecorationAdapter {

	/** The decorator target. */
	protected Image decoratorTarget;

	/** The decoration. */
	protected List<IPapyrusDecoration> decorations;

	/** The decoration position. */
	protected int decorationPosition;

	/**
	 * Instantiates a new model explorer decoration adapter.
	 *
	 * @param baseImage
	 *            the base image
	 */
	public ModelExplorerDecorationAdapter(Image baseImage) {
		this.decoratorTarget = baseImage;
	}

	/**
	 * Gets the decorator target.
	 *
	 * @return the decorator target
	 */
	public Image getDecoratorTarget() {
		return this.decoratorTarget;
	}

	/**
	 * Sets the decoration.
	 *
	 * @param decoration
	 *            the decoration
	 * @param decorationPosition
	 *            the decoration position
	 */
	public void setDecorations(List<IPapyrusDecoration> decorations) {
		this.decorations = decorations;
	}

	/**
	 * Sets the decorator target.
	 *
	 * @param decoratorTarget
	 *            the new decorator target
	 */
	public void setDecoratorTarget(Image decoratorTarget) {
		this.decoratorTarget = decoratorTarget;
	}


	/**
	 * Sets the decoration position.
	 *
	 * @param decorationPosition
	 *            the new decoration position
	 */
	public void setDecorationPosition(int decorationPosition) {
		this.decorationPosition = decorationPosition;
	}

	/**
	 * Sets the decorated image.
	 *
	 * @param baseImage
	 *            the base image
	 * @param decoration
	 *            the decoration
	 * @param decorationPosition
	 *            the decoration position
	 */
	public Image getDecoratedImage() {
		return DecorationImageUtils.getDecoratedImage(decoratorTarget, decorations, DecorationImageUtils.SIZE_16_16);
	}

	/**
	 * 
	 * @return
	 * 		a unique id to identify the image
	 * @deprecated since Papyrus 1.2
	 */
	@Deprecated
	public String calcId() {
		return DecorationImageUtils.calcId(decoratorTarget, decorations);
	}
}

Back to the top