Search in sources :

Example 1 with XYRect

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;
}
Also used : XYRect(net.rim.device.api.ui.XYRect)

Example 2 with XYRect

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;
}
Also used : Graphics(net.rim.device.api.ui.Graphics) XYRect(net.rim.device.api.ui.XYRect)

Example 3 with XYRect

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;
}
Also used : Graphics(net.rim.device.api.ui.Graphics) XYRect(net.rim.device.api.ui.XYRect)

Example 4 with XYRect

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;
}
Also used : Graphics(net.rim.device.api.ui.Graphics) XYRect(net.rim.device.api.ui.XYRect)

Example 5 with XYRect

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;
}
Also used : Graphics(net.rim.device.api.ui.Graphics) XYRect(net.rim.device.api.ui.XYRect)

Aggregations

XYRect (net.rim.device.api.ui.XYRect)6 Graphics (net.rim.device.api.ui.Graphics)4 Field (net.rim.device.api.ui.Field)1 BitmapField (net.rim.device.api.ui.component.BitmapField)1 LabelField (net.rim.device.api.ui.component.LabelField)1