View Javadoc

1   package net.sourceforge.barbecue.output;
2   
3   import java.awt.font.TextLayout;
4   
5   public abstract class LabelLayout {
6   	static final int NOT_SET = -1;
7   
8   	protected final int x;
9   	protected final int y;
10  	protected final int width;
11  	protected final int height;
12  	protected TextLayout textLayout;
13  	protected float textX;
14  	protected float textY;
15  	protected int bgX;
16  	protected int bgY;
17  	protected int bgWidth;
18  	protected int bgHeight;
19  
20  	protected LabelLayout(int x, int y, int width, int height) {
21  		this.x = x;
22  		this.y = y;
23  		this.width = width;
24  		this.height = height;
25  	}
26  
27  	public void setTextLayout(TextLayout textLayout) {
28  		this.textLayout = textLayout;
29  		calculate();
30  	}
31  
32  	protected abstract void calculate();
33  
34  	public float getTextX() {
35  		return textX;
36  	}
37  
38  	public float getTextY() {
39  		return textY;
40  	}
41  
42  	public int getBackgroundX() {
43  		return bgX;
44  	}
45  
46  	public int getBackgroundY() {
47  		return bgY;
48  	}
49  
50  	public int getBackgroundWidth() {
51  		return bgWidth;
52  	}
53  
54  	public int getBackgroundHeight() {
55  		return bgHeight;
56  	}
57  }