public int weight;
}
-
-
+ private static void readMargins(ExtendedMargins extendedMargins, LayoutBean layout) {
+ if (extendedMargins != null) {
+ layout.marginLeft = extendedMargins.left;
+ layout.marginRight = extendedMargins.right;
+ layout.marginTop = extendedMargins.top;
+ layout.marginBottom = extendedMargins.bottom;
+ } else {
+ layout.marginLeft = 3;
+ layout.marginRight = 3;
+ layout.marginTop = 3;
+ layout.marginBottom = 3;
+ }
+ }
+
public static GridLayoutBean getLayout(RequestProcessor processor, Resource configuration) throws DatabaseException {
return processor.sync(new ResourceRead<GridLayoutBean>(configuration) {
ExtendedMargins extendedMargins = graph.getPossibleRelatedValue(resource, VIEW.GridLayout_extendedMargins, EXTENDED_MARGINS_BINDING);
GridLayoutBean layout = new GridLayoutBean();//.fillDefaults().numColumns(1).equalWidth(false).margins(0, 0).spacing(0, 0).create();
- layout.numColumns = columns;
- layout.horizontalSpacing = horizontalSpacing;
- layout.verticalSpacing = verticalSpacing;
- layout.marginLeft = extendedMargins.left;
- layout.marginRight = extendedMargins.right;
- layout.marginTop = extendedMargins.top;
- layout.marginBottom = extendedMargins.bottom;
+ layout.numColumns = columns != null ? columns : 1;
+ layout.horizontalSpacing = horizontalSpacing != null ? horizontalSpacing : 5;
+ layout.verticalSpacing = verticalSpacing != null ? verticalSpacing : 5;
+ readMargins(extendedMargins, layout);
return layout;
ExtendedMargins extendedMargins = graph.getPossibleRelatedValue(resource, VIEW.RowLayout_extendedMargins, EXTENDED_MARGINS_BINDING);
RowLayoutBean layout = new RowLayoutBean();
- layout.type = type;
- layout.spacing = spacing;
- layout.center = center;
- layout.fill = fill;
- layout.justify = justify;
- layout.pack = pack;
- layout.wrap = wrap;
- layout.marginLeft = extendedMargins.left;
- layout.marginRight = extendedMargins.right;
- layout.marginTop = extendedMargins.top;
- layout.marginBottom = extendedMargins.bottom;
+ layout.type = type != null ? type : 256;
+ layout.spacing = spacing != null ? spacing : 3;
+ layout.center = center != null ? center : false;
+ layout.fill = fill != null ? fill : false;
+ layout.justify = justify != null ? justify : false;
+ layout.pack = pack != null ? pack : true;
+ layout.wrap = wrap != null ? wrap : true;
+ readMargins(extendedMargins, layout);
return layout;
}
});
public RowDataBean perform(ReadGraph graph) throws DatabaseException {
ViewsResources VIEW = ViewsResources.getInstance(graph);
RowDataBean data = new RowDataBean();
- data.width = graph.getPossibleRelatedValue(resource, VIEW.GridLayout_GridData_preferredWidth, Bindings.INTEGER);
- data.height = graph.getPossibleRelatedValue(resource, VIEW.GridLayout_GridData_preferredHeight, Bindings.INTEGER);
+ Integer width = graph.getPossibleRelatedValue(resource, VIEW.GridLayout_GridData_preferredWidth, Bindings.INTEGER);
+ Integer height = graph.getPossibleRelatedValue(resource, VIEW.GridLayout_GridData_preferredHeight, Bindings.INTEGER);
+ data.width = width != null ? width : -1;
+ data.height = height != null ? height : -1;
return data;
}
});
bean.key = key;
bean.label = label;
bean.alignment = alignment;
- bean.width = width;
+ bean.width = width != null ? width : -1;
bean.tooltip = tooltip;
- bean.grab = grab;
- bean.weight = weight;
+ bean.grab = grab != null ? grab : false;
+ bean.weight = weight != null ? weight : 0;
return bean;