Fields Summary |
---|
private static final String | HIDDEN_ATTRIBUTE |
private static final String | SLICE_ATTRIBUTE |
private static final String | SCROLL_ATTRIBUTE |
private static final String | MEET_ATTRIBUTE |
private static final String | FILL_ATTRIBUTE |
private static final String | ID_ATTRIBUTE_NAME |
private static final String | WIDTH_ATTRIBUTE_NAME |
private static final String | TITLE_ATTRIBUTE_NAME |
private static final String | HEIGHT_ATTRIBUTE_NAME |
private static final String | BACKGROUND_COLOR_ATTRIBUTE_NAME |
private static final String | Z_INDEX_ATTRIBUTE_NAME |
private static final String | TOP_ATTRIBUTE_NAME |
private static final String | LEFT_ATTRIBUTE_NAME |
private static final String | RIGHT_ATTRIBUTE_NAME |
private static final String | BOTTOM_ATTRIBUTE_NAME |
private static final String | FIT_ATTRIBUTE_NAME |
private static final String | TAG |
private static final boolean | DEBUG |
private static final boolean | LOCAL_LOGV |
Methods Summary |
---|
public java.lang.String | getBackgroundColor()
return this.getAttribute(BACKGROUND_COLOR_ATTRIBUTE_NAME);
|
public java.lang.String | getFit()
String fit = getAttribute(FIT_ATTRIBUTE_NAME);
if (FILL_ATTRIBUTE.equalsIgnoreCase(fit)) {
return FILL_ATTRIBUTE;
} else if (MEET_ATTRIBUTE.equalsIgnoreCase(fit)) {
return MEET_ATTRIBUTE;
} else if (SCROLL_ATTRIBUTE.equalsIgnoreCase(fit)) {
return SCROLL_ATTRIBUTE;
} else if (SLICE_ATTRIBUTE.equalsIgnoreCase(fit)) {
return SLICE_ATTRIBUTE;
} else {
return HIDDEN_ATTRIBUTE;
}
|
public int | getHeight()
try {
return parseRegionLength(getAttribute(HEIGHT_ATTRIBUTE_NAME), false);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Height attribute is not set or incorrect.");
}
}
int bbh = ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getHeight();
try {
bbh -= parseRegionLength(getAttribute(TOP_ATTRIBUTE_NAME), false);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Top attribute is not set or incorrect.");
}
}
try {
bbh -= parseRegionLength(getAttribute(BOTTOM_ATTRIBUTE_NAME), false);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Bottom attribute is not set or incorrect.");
}
}
return bbh;
|
public java.lang.String | getId()
return this.getAttribute(ID_ATTRIBUTE_NAME);
|
public int | getLeft()
try {
return parseRegionLength(getAttribute(LEFT_ATTRIBUTE_NAME), true);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Left attribute is not set or incorrect.");
}
}
try {
int bbw = ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getWidth();
int right = parseRegionLength(getAttribute(RIGHT_ATTRIBUTE_NAME), true);
int width = parseRegionLength(getAttribute(WIDTH_ATTRIBUTE_NAME), true);
return bbw - right - width;
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Right or width attribute is not set or incorrect.");
}
}
return 0;
|
public java.lang.String | getTitle()
return this.getAttribute(TITLE_ATTRIBUTE_NAME);
|
public int | getTop()
try {
return parseRegionLength(getAttribute(TOP_ATTRIBUTE_NAME), false);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Top attribute is not set or incorrect.");
}
}
try {
int bbh = ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getHeight();
int bottom = parseRegionLength(getAttribute(BOTTOM_ATTRIBUTE_NAME), false);
int height = parseRegionLength(getAttribute(HEIGHT_ATTRIBUTE_NAME), false);
return bbh - bottom - height;
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Bottom or height attribute is not set or incorrect.");
}
}
return 0;
|
public int | getWidth()
try {
return parseRegionLength(getAttribute(WIDTH_ATTRIBUTE_NAME), true);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Width attribute is not set or incorrect.");
}
}
int bbw = ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getWidth();
try {
bbw -= parseRegionLength(getAttribute(LEFT_ATTRIBUTE_NAME), true);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Left attribute is not set or incorrect.");
}
}
try {
bbw -= parseRegionLength(getAttribute(RIGHT_ATTRIBUTE_NAME), true);
} catch (NumberFormatException _) {
if (LOCAL_LOGV) {
Log.v(TAG, "Right attribute is not set or incorrect.");
}
}
return bbw;
|
public int | getZIndex()
try {
return Integer.parseInt(this.getAttribute(Z_INDEX_ATTRIBUTE_NAME));
} catch (NumberFormatException _) {
return 0;
}
|
private int | parseRegionLength(java.lang.String length, boolean horizontal)
if (length.endsWith("px")) {
length = length.substring(0, length.indexOf("px"));
return Integer.parseInt(length);
} else if (length.endsWith("%")) {
double value = 0.01*Integer.parseInt(length.substring(0, length.length() - 1));
if (horizontal) {
value *= ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getWidth();
} else {
value *= ((SMILDocument) getOwnerDocument()).getLayout().getRootLayout().getHeight();
}
return (int) Math.round(value);
} else {
return Integer.parseInt(length);
}
|
public void | setBackgroundColor(java.lang.String backgroundColor)
this.setAttribute(BACKGROUND_COLOR_ATTRIBUTE_NAME, backgroundColor);
|
public void | setFit(java.lang.String fit)
if (fit.equalsIgnoreCase(FILL_ATTRIBUTE)
|| fit.equalsIgnoreCase(MEET_ATTRIBUTE)
|| fit.equalsIgnoreCase(SCROLL_ATTRIBUTE)
|| fit.equalsIgnoreCase(SLICE_ATTRIBUTE)) {
this.setAttribute(FIT_ATTRIBUTE_NAME, fit.toLowerCase());
} else {
this.setAttribute(FIT_ATTRIBUTE_NAME, HIDDEN_ATTRIBUTE);
}
|
public void | setHeight(int height)
this.setAttribute(HEIGHT_ATTRIBUTE_NAME, String.valueOf(height) + "px");
|
public void | setId(java.lang.String id)
this.setAttribute(ID_ATTRIBUTE_NAME, id);
|
public void | setLeft(int left)
this.setAttribute(LEFT_ATTRIBUTE_NAME, String.valueOf(left));
|
public void | setTitle(java.lang.String title)
this.setAttribute(TITLE_ATTRIBUTE_NAME, title);
|
public void | setTop(int top)
this.setAttribute(TOP_ATTRIBUTE_NAME, String.valueOf(top));
|
public void | setWidth(int width)
this.setAttribute(WIDTH_ATTRIBUTE_NAME, String.valueOf(width) + "px");
|
public void | setZIndex(int zIndex)
if (zIndex > 0) {
this.setAttribute(Z_INDEX_ATTRIBUTE_NAME, Integer.toString(zIndex));
} else {
this.setAttribute(Z_INDEX_ATTRIBUTE_NAME, Integer.toString(0));
}
|
public java.lang.String | toString()
return super.toString()
+ ": id=" + getId()
+ ", width=" + getWidth()
+ ", height=" + getHeight()
+ ", left=" + getLeft()
+ ", top=" + getTop();
|