1 | /**
|
---|
2 | * XRawItem.java
|
---|
3 | * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package org.expeditee.io.flowlayout;
|
---|
20 |
|
---|
21 | import org.expeditee.items.Item;
|
---|
22 | import org.expeditee.items.Text;
|
---|
23 |
|
---|
24 | public class XRawItem extends XItem
|
---|
25 | {
|
---|
26 | protected Item item;
|
---|
27 | protected XGroupItem xgroup;
|
---|
28 |
|
---|
29 | public XRawItem(Item item, final XGroupItem belongsTo)
|
---|
30 | {
|
---|
31 | this.item = item;
|
---|
32 | this.xgroup = belongsTo;
|
---|
33 |
|
---|
34 | if (item instanceof Text) {
|
---|
35 | // Expecting it to be a text item
|
---|
36 | // For it's bounding rectangle, go with the tighter 'PixelBounds' version
|
---|
37 |
|
---|
38 | Text text_item = (Text)item;
|
---|
39 | bounding_rect = text_item.getPixelBoundsUnion();
|
---|
40 | }
|
---|
41 | else {
|
---|
42 | // Just in case it isn't a text item
|
---|
43 | bounding_rect = item.getArea().getBounds();
|
---|
44 | }
|
---|
45 |
|
---|
46 | }
|
---|
47 |
|
---|
48 | public Item getItem()
|
---|
49 | {
|
---|
50 | return item;
|
---|
51 | }
|
---|
52 |
|
---|
53 | public XGroupItem getGroup() {
|
---|
54 | return xgroup;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public String toString() {
|
---|
58 | return "XRawItem For " + item.toString();
|
---|
59 | }
|
---|
60 |
|
---|
61 | }
|
---|