1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2000, 2010 IBM Corporation and others.
|
3
|
* All rights reserved. This program and the accompanying materials
|
4
|
* are made available under the terms of the Eclipse Public License v1.0
|
5
|
* which accompanies this distribution, and is available at
|
6
|
* http://www.eclipse.org/legal/epl-v10.html
|
7
|
*
|
8
|
* Contributors:
|
9
|
* IBM Corporation - initial API and implementation
|
10
|
*******************************************************************************/
|
11
|
package org.eclipse.draw2d;
|
12
|
|
13
|
import org.eclipse.draw2d.geometry.Insets;
|
14
|
import org.eclipse.draw2d.geometry.Rectangle;
|
15
|
|
16
|
/**
|
17
|
* Provides a two pixel wide constant sized border, having an etched look.
|
18
|
*/
|
19
|
public final class SimpleEtchedBorder extends SchemeBorder {
|
20
|
|
21
|
/** The singleton instance of this class */
|
22
|
public static final Border singleton = new SimpleEtchedBorder();
|
23
|
|
24
|
/** The insets */
|
25
|
protected static final Insets INSETS = new Insets(2);
|
26
|
|
27
|
/**
|
28
|
* Constructs a default border having a two pixel wide border.
|
29
|
*
|
30
|
* @since 2.0
|
31
|
*/
|
32
|
protected SimpleEtchedBorder() {
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* Returns the Insets used by this border. This is a constant value of two
|
37
|
* pixels in each direction.
|
38
|
*
|
39
|
* @see Border#getInsets(IFigure)
|
40
|
*/
|
41
|
public Insets getInsets(IFigure figure) {
|
42
|
return new Insets(INSETS);
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* Returns the opaque state of this border. This border is opaque and takes
|
47
|
* responsibility to fill the region it encloses.
|
48
|
*
|
49
|
* @see Border#isOpaque()
|
50
|
*/
|
51
|
public boolean isOpaque() {
|
52
|
return true;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* @see Border#paint(IFigure, Graphics, Insets)
|
57
|
*/
|
58
|
public void paint(IFigure figure, Graphics g, Insets insets) {
|
59
|
Rectangle rect = getPaintRectangle(figure, insets);
|
60
|
FigureUtilities.paintEtchedBorder(g, rect);
|
61
|
}
|
62
|
|
63
|
}
|