8 |
/** A class that manages the types of nodes in a buoy view. |
/** A class that manages the types of nodes in a buoy view. |
9 |
*/ |
*/ |
10 |
public class BuoyAdaptor implements BuoyViewNodeType { |
public class BuoyAdaptor implements BuoyViewNodeType { |
|
CellBuoyViewNodeType[] cellNodes; |
|
11 |
|
|
12 |
|
/** The cell node types used by the current instance. |
13 |
|
*/ |
14 |
|
public CellBuoyViewNodeType[] cellNodes; |
15 |
|
|
16 |
|
/** The cell-to-X link types used by the current instance. |
17 |
|
*/ |
18 |
|
public CellBuoyViewLinker[] cellLinkers; |
19 |
|
|
20 |
|
/** Get the node type that is responsible for showing the |
21 |
|
* given Cell. |
22 |
|
*/ |
23 |
private CellBuoyViewNodeType getNode(Cell c) { |
private CellBuoyViewNodeType getNode(Cell c) { |
24 |
for(int i=0; i<cellNodes.length; i++) { |
for(int i=0; i<cellNodes.length; i++) { |
25 |
if(cellNodes[i].ownsCell(c)) { |
if(cellNodes[i].ownsCell(c)) { |
48 |
throw new Error("Unknown anchor!"); |
throw new Error("Unknown anchor!"); |
49 |
} |
} |
50 |
|
|
51 |
|
/** An adaptor class that call |
52 |
|
*/ |
53 |
private class LinkAdaptor implements CellPlacementHook { |
private class LinkAdaptor implements CellPlacementHook { |
54 |
LinkAdaptor(BuoyLinkListener l) { this.l = l; } |
LinkAdaptor(BuoyLinkListener l) { this.l = l; } |
55 |
BuoyLinkListener l; |
BuoyLinkListener l; |
56 |
|
|
57 |
public void placed(Cell c, VobScene sc, int b, ViewContext context) { |
public void placed(Cell c, VobScene vs, int cs, ViewContext context) { |
58 |
|
for(int i=0; i<cellLinkers.length; i++) |
59 |
|
cellLinkers[i].doLinks(c, vs, cs, BuoyAdaptor.this, l); |
60 |
} |
} |
61 |
} |
} |
62 |
|
|