2
|
1 |
|
|
2 |
|
|
3 |
function Layout() {
|
|
4 |
}
|
|
5 |
|
|
6 |
Layout.prototype.layout = function(instance, laf) {
|
|
7 |
var existingLaf = findExistingLookAndFeel(instance);
|
|
8 |
// this gets called creating the display model, before accessible from data model
|
|
9 |
if (existingLaf != null && existingLaf != laf)
|
|
10 |
throw new java.lang.IllegalArgumentException("findExistingLookAndFeel failed");
|
|
11 |
|
|
12 |
|
|
13 |
var children = instance.children;
|
|
14 |
var properties = instance.properties;
|
|
15 |
|
|
16 |
var childProperties = children[0].properties;
|
|
17 |
childProperties.location.x = properties.location.x;
|
|
18 |
childProperties.location.y = properties.location.y + 25;
|
|
19 |
var prefSize = children[0].getPreferredSize(properties.size.width, properties.size.height - 25);
|
|
20 |
childProperties.size.width = prefSize.x;
|
|
21 |
childProperties.size.height = prefSize.y;
|
|
22 |
}
|
|
23 |
|
|
24 |
Layout.prototype.getPreferredSize = function(instance, laf, wHint, hHint) {
|
|
25 |
return new Point(wHint, hHint);
|
|
26 |
}
|
|
27 |
|