if (style.before != null) { this.beforeWidth = style.beforeWidth + this.paddingHorizontal; this.beforeHeight = style.beforeHeight;
String beforeUrlStr = style.getProperty("before"); this.beforeUrl = beforeUrlStr; if (beforeUrlStr != null) { if ( !beforeUrlStr.equals(this.beforeUrl) ) { try { this.beforeImage = StyleSheet.getImage(beforeUrlStr, null, true ); this.beforeWidth = this.beforeImage.getWidth() + this.paddingHorizontal; this.beforeHeight = this.beforeImage.getHeight(); } catch (IOException e) { this.beforeUrl = null; this.beforeImage = null; this.beforeWidth = 0; this.beforeHeight = 0; } }
	public void setStyle( Style style ) {		//#debug		System.out.println("setting style - with background: " + (style.background != null));		this.isInitialised = false;		this.isStyleInitialised = true;		this.style = style;		if (style != StyleSheet.defaultStyle) {			this.layout = style.layout;		}		// horizontal styles: center -> right -> left		if ( ( this.layout & LAYOUT_CENTER ) == LAYOUT_CENTER ) {			this.isLayoutCenter = true;			this.isLayoutRight = false;		} else {			this.isLayoutCenter = false;			if ( ( this.layout & LAYOUT_RIGHT ) == LAYOUT_RIGHT ) {				this.isLayoutRight = true;			} else {				this.isLayoutRight = false;			}		}		//System.out.println(" style [" + style.name + "]: right: " + this.isLayoutRight + " center: " + this.isLayoutCenter);		// vertical styles: vcenter -> bottom -> top		// expanding layouts:		if ( ( this.layout & LAYOUT_EXPAND ) == LAYOUT_EXPAND ) {			this.isLayoutExpand = true;		} else {			this.isLayoutExpand = false;		}		this.background = style.background;		this.border = style.border;		if (this.border != null) {			this.borderWidth = this.border.borderWidth;		} else if (this.background != null){			this.borderWidth = this.background.borderWidth;		} else {			this.borderWidth = 0;		}		this.paddingLeft = style.paddingLeft;		this.paddingRight = style.paddingRight;		this.paddingTop = style.paddingTop;		this.paddingBottom = style.paddingBottom;		this.paddingVertical = style.paddingVertical;		this.paddingHorizontal = style.paddingHorizontal;		this.marginLeft = style.marginLeft;		this.marginRight = style.marginRight;		this.marginTop = style.marginTop;		this.marginBottom = style.marginBottom;		//#ifdef polish.useBeforeStyle			if (style.before != null) {				this.beforeWidth = style.beforeWidth + this.paddingHorizontal;				this.beforeHeight = style.beforeHeight;			} else {				this.beforeWidth = 0;				this.beforeHeight = 0;			}			this.beforeImage = style.before;		//#endif		//#ifdef polish.useAfterStyle			if (style.after != null) {				this.afterWidth = style.afterWidth + this.paddingHorizontal;				this.afterHeight = style.afterHeight;			} else {				this.afterWidth = 0;				this.afterHeight = 0;			}			this.afterImage = style.after;		//#endif		//#ifdef polish.css.label-style			Style labStyle = (Style) style.getObjectProperty("label-style");			if (labStyle != null) {				this.labelStyle = labStyle;			} else if (this.labelStyle == null || this.isFocused) {				this.labelStyle = StyleSheet.labelStyle;			}		//#else			this.labelStyle = StyleSheet.labelStyle;		//#endif		if (this.label != null) {			this.label.setStyle( this.labelStyle );					}		//#ifdef polish.css.min-width			Integer minWidthInt = style.getIntProperty("min-width");			if (minWidthInt != null) {				this.minimumWidth = minWidthInt.intValue();			}		//#endif		//#ifdef polish.css.max-width			Integer maxWidthInt  = style.getIntProperty("max-width");			if (maxWidthInt != null) {				this.maximumWidth = maxWidthInt.intValue();			}		//#endif		//#ifdef polish.css.min-height			Integer minHeightInt = style.getIntProperty("min-height");			if (minHeightInt != null) {				this.minimumHeight = minHeightInt.intValue();			}		//#endif		//#ifdef polish.css.max-height			Integer maxHeightInt  = style.getIntProperty("max-height");			if (maxHeightInt != null) {				this.maximumHeight = maxHeightInt.intValue();			}		//#endif		//#ifdef polish.css.focused-style			//Object object = style.getObjectProperty("focused-style");			//if (object != null) {			//	System.out.println("focused-type: " + object.getClass().getName());			//}			Style focused = (Style) style.getObjectProperty("focused-style");			if (focused != null) {				this.focusedStyle = focused;//				if (this instanceof ChoiceGroup) {//					System.out.println("Setting focused style for choicegroup!");//				}			}		//#endif		//#if polish.css.colspan			Integer colSpanInt = style.getIntProperty("colspan");			if ( colSpanInt != null ) {				this.colSpan = colSpanInt.intValue();			}		//#endif			//#if polish.css.include-label			Boolean includeLabelBool = style.getBooleanProperty("include-label");			if (includeLabelBool != null) {				this.includeLabel = includeLabelBool.booleanValue();			}		//#endif			}