use of net.rim.device.api.ui.XYRect in project Samples-for-Java by blackberry.
the class Banner method determineLeft.
/**
* Determine the left position of a field, to the right or left, based on
* other fields that are closer to the given side.
*
* @param field
* the field to determine the position of.
* @param availableWidth
* the width of the display.
* @param other
* the other fields which take priority.
* @param style
* DrawStyle.LEFT or DrawStyle.RIGHT.
* @return the x position for the left of the field.
*/
private int determineLeft(Field field, int availableWidth, Field[] others, int style) {
int childX = 0;
if (hasField(field)) {
XYRect extent = field.getExtent();
if (style == DrawStyle.RIGHT) {
childX = hPadding + availableWidth - extent.width;
for (int i = 0; i < others.length; i++) {
if (hasField(others[i]) && others[i].getExtent().width > 0) {
childX -= others[i].getExtent().width;
childX -= interiorPadding;
}
}
} else if (style == DrawStyle.LEFT) {
childX = hPadding;
for (int i = 0; i < others.length; i++) {
if (hasField(others[i]) && others[i].getExtent().width > 0) {
childX += others[i].getExtent().width;
childX += interiorPadding;
}
}
}
}
return childX;
}
use of net.rim.device.api.ui.XYRect in project CodenameOne by codenameone.
the class BlackBerryImplementation method getClipY.
public int getClipY(Object graphics) {
XYRect r = new XYRect();
((Graphics) graphics).getAbsoluteClippingRect(r);
return r.y;
}
use of net.rim.device.api.ui.XYRect in project CodenameOne by codenameone.
the class BlackBerryImplementation method getClipWidth.
public int getClipWidth(Object graphics) {
XYRect r = new XYRect();
((Graphics) graphics).getAbsoluteClippingRect(r);
return r.width;
}
use of net.rim.device.api.ui.XYRect in project CodenameOne by codenameone.
the class BlackBerryImplementation method getClipX.
public int getClipX(Object graphics) {
XYRect r = new XYRect();
((Graphics) graphics).getAbsoluteClippingRect(r);
return r.x;
}
use of net.rim.device.api.ui.XYRect in project CodenameOne by codenameone.
the class BlackBerryImplementation method getClipHeight.
public int getClipHeight(Object graphics) {
XYRect r = new XYRect();
((Graphics) graphics).getAbsoluteClippingRect(r);
return r.height;
}
Aggregations