if (key.endsWith("style")) {
if (attributeType == CssAttribute.STYLE || key.endsWith("style")) {
	protected void processStyle(Style style, ArrayList codeList, StyleSheet styleSheet, Device device, BooleanEvaluator evaluator ) {		String styleName = style.getStyleName();		//System.out.println("processing style " + style.getStyleName() + ": " + style.toString() );		// create a new style:		codeList.add( STANDALONE_MODIFIER + "Style " + styleName + "Style = new Style (");		// process the margins:		HashMap group = style.removeGroup("margin");		if ( group != null ) {			processFields( 0, false, group, "margin", style, codeList, styleSheet, device );		} else {			codeList.add("\t\t0,0,0,0,\t// default margin");		}		// process the paddings:		group = style.removeGroup("padding");		if ( group != null ) {			processFields( 1, true, group, "padding", style, codeList, styleSheet, device );		} else {			codeList.add("\t\t1,1,1,1,1,1,\t// default padding");		}		// process the layout:		group = style.removeGroup("layout");		if ( group != null ) {			processLayout( group, style, codeList, styleSheet );		} else {			codeList.add("\t\tItem.LAYOUT_DEFAULT,\t// default layout");		}		// process the content-font:		group = style.removeGroup("font");		String bitMapFontUrl = null;		if ( group != null ) {			// if a bitmap-font is defined,			// add a extended (string) attribute:			bitMapFontUrl = (String) group.get("bitmap");			if (bitMapFontUrl != null && !"none".equals( bitMapFontUrl)) {				if (!bitMapFontUrl.endsWith(".bmf")) {					bitMapFontUrl += ".bmf";				}				if (bitMapFontUrl.charAt(0) != '/') {					bitMapFontUrl = "/" + bitMapFontUrl;				}				HashMap bitMapFontGroup = new HashMap(1);				bitMapFontGroup.put("bitmap", bitMapFontUrl );				style.addGroup( "font", bitMapFontGroup );				//System.out.println("adding bitmap-font " + bitMapFontUrl);			}			processFont( group, "font", style, codeList, styleSheet, false );		} else {			codeList.add("\t\tdefaultFontColor,\t// font-color is not defined");			codeList.add("\t\tdefaultFont,");		}				// process the content-font:		boolean removeLabelGroup = true;		group = style.getGroup("label");		if (group != null) {			String labelStyle = (String) group.get("style"); 			if ( labelStyle != null ) {				if (styleSheet.isDefined(labelStyle)) {					// okay this is a valid reference:					removeLabelGroup = false;				}			}		}		if (removeLabelGroup) {			style.removeGroup("label");					}				// process the background:		group = style.removeGroup("background");		if ( group != null ) {			processBackground( style.getSelector(), group, style, codeList, styleSheet, false );		} else {			codeList.add("\t\tnull,\t// no background");		}		// process the background:		group = style.removeGroup("border");		if ( group != null ) {			processBorder( style.getSelector(), group, style, codeList, styleSheet, false );		} else {			codeList.add("\t\tnull\t// no border");		}		// add the URL of the before-image but only when at least one before-element has been defined:		if (styleSheet.containsBeforeStyle()) {			group = style.removeGroup("before");			if (group != null) {				String url = getUrl( (String) group.get("before") );				if (url != null) {					codeList.add("\t\t, \"" + url + "\"\t// URL of the before element" );				} else {					codeList.add("\t\t, null\t// no before element has been defined");				}			} else {				codeList.add("\t\t, null\t// no before element has been defined");							}		}		// add the URL of the after-image but only when at least one after-element has been defined:		if (styleSheet.containsAfterStyle()) {			group = style.removeGroup("after");			if (group != null) {				String url = getUrl( (String) group.get("after") );				if (url != null) {					codeList.add("\t\t, \"" + url + "\"\t// URL of the after element" );				} else {					codeList.add("\t\t, null\t// no after element has been defined");				}			} else {				codeList.add("\t\t, null\t// no after element has been defined");							}		}		// add the selector of the style, but only when dynamic styles are used:		if (styleSheet.containsDynamicStyles()) {			codeList.add("\t\t, \"" + style.getSelector() + "\"\t// the selector of this style");		}				// now add all additional non standard-properties:		String[] groupNames = style.getGroupNames();		if (groupNames.length == 0) {			codeList.add( "\t\t, null, null\t// no additional attributes have been defined" );		} else {			// counting the number of special attributes:			int numberOfAttributes = 0;			for (int i = 0; i < groupNames.length; i++) {				String groupName = groupNames[i];				group = style.getGroup(groupName);				numberOfAttributes += group.size();			}			StringBuffer keyList = new StringBuffer();			keyList.append("new short[]{ ");			StringBuffer valueList = new StringBuffer();			valueList.append("new Object[]{ ");			int currentAttribute = 0;			for (int i = 0; i < groupNames.length; i++) {				String groupName = groupNames[i];				group = style.getGroup(groupName);				if (group == null) {					System.err.println("unable to get group [" + groupName + "] of style : " + style.toString());				}				Set keys = group.keySet();				for (Iterator iter = keys.iterator(); iter.hasNext();) {					currentAttribute++;					String key = (String) iter.next();					String value = (String) group.get( key );					String attributeName;					if (key.equals(groupName)) {						attributeName = groupName;					} else {						attributeName = groupName + "-" + key;					}					short attributesId = styleSheet.getAttributeId(attributeName);					if (attributesId == -1) {						throw new BuildException("Invalid CSS: The CSS-attribute [" + attributeName + "] is not supported. Please check your [polish.css] file(s).");					}					keyList.append( attributesId );					if ( currentAttribute < numberOfAttributes) {						keyList.append(", ");					}										int attributeType = CssAttribute.STRING;					CssAttribute attribute = this.attributesManager.getAttribute( attributeName );					if (attribute != null) {						attributeType = attribute.getType();						attribute.checkValue( value, evaluator );						if (attributeType == CssAttribute.INTEGER && attribute.hasFixValues()) {							value = Integer.toString( attribute.getValuePosition(value) );						}					} else {						// the attribute is not registered anywhere:						System.out.println("Recommendation: It is advised to register the CSS-attribute [" + attributeName + "] in the [custom-css-attributes.xml].");					}					// process columns-width value:					// remove all spaces and check for the star-value (e.g. "20, *"):					if (key.equals("width") && groupName.equals("columns")) {						value = StringUtil.replace( value, " ", "" );						int starPos = value.indexOf('*');						if (starPos != -1) {							if (starPos < value.length() - 1 ) {								value = value.substring( 0, starPos ) + "-1" + value.substring( starPos + 1 );							} else {								value = value.substring( 0, starPos ) + "-1";							}							/*							String screenWidthStr = device.getCapability("ScreenWidth");							if (screenWidthStr != null) {								int screenWidth = Integer.parseInt( screenWidthStr );								String[] valueChunks = StringUtil.split( value, ',' );								int combinedWidth = 0;								int starIndex = -1;								for (int j = 0; j < valueChunks.length; j++) {									String widthStr = valueChunks[j];									if ("*".equals( widthStr)) {										starIndex = j;									} else {										combinedWidth += Integer.parseInt( widthStr );									}								}								valueChunks[ starIndex ] = "" + ( screenWidth - combinedWidth);								StringBuffer buffer = new StringBuffer();								for (int j = 0; j < valueChunks.length; j++) {									buffer.append( valueChunks[j] );									if (j != valueChunks.length -1) {										buffer.append(',');									}								}								value = buffer.toString();							}							*/						}					}					if (key.endsWith("style")) {						value = getStyleReference( value, style, styleSheet );					} else if (attributeType == CssAttribute.COLOR || key.endsWith("color")) {						value = getColor( value );						attributeType = CssAttribute.COLOR;					} else if (key.equals("url")) {						value = getUrl( value );					}					if (value.startsWith("url")) {						value = getUrl( value );					} else if (value.startsWith("style(")) {						value = getStyleReference( value, style, styleSheet );					}										if (attributeType == CssAttribute.STRING 							|| attributeType == CssAttribute.IMAGE_URL 							|| attributeType == CssAttribute.CHAR) 					{						if ( "none".equals(value)) {							valueList.append("null");						} else {							valueList.append('"')							.append( value )							.append('"');						}					} else if (attributeType == CssAttribute.STYLE) {						valueList.append( value );					} else if (attributeType == CssAttribute.COLOR 							|| attributeType == CssAttribute.INTEGER ) 					{						// check integer value:						if (attributeType == CssAttribute.INTEGER ) {							try {								Integer.parseInt( value );							} catch (NumberFormatException e) {								throw new BuildException("Invalid CSS: The attribute [" + attributeName + "] needs an integer value. The value [" + value + "] cannot be accepted.");							}						}						valueList.append( "new Integer( ")						.append( value )						.append(")");					} else if (attributeType == CssAttribute.BOOLEAN) {						if (value.equals("true") || value.equals("yes")) {							valueList.append( "Style.TRUE" );						} else if (value.equals("false") || value.equals("no")) {							valueList.append( "Style.FALSE" );						} else {							throw new BuildException("Invalid CSS Code: invalid value for the boolean attribute [" + attributeName + "]:  use either [true]/[yes] or [false]/[no].");						}					} else if (attributeType == CssAttribute.OBJECT) {						String mappedValue = attribute.getMappingFrom( value );						if (mappedValue != null) {							 if ("none".equals( mappedValue)) {								valueList.append("null");							 } else {							 	//System.out.println("Using mapped value [" + mappedValue + "] for attribute [" + attribute.getId() + "]");							 	valueList.append( mappedValue );							 }						} else if ("none".equals( value )){							valueList.append("null");						} else {							if (groupName.equals("view") && key.equals("type") ) {								// the value represents a fully qualified class:								valueList.append("new ").append( value ).append("()");								/*								String translatedViewType = (String) VIEW_TYPES.get( value );								if (translatedViewType == null ) {									// the value represents a full class:									valueList.append("new ").append( value ).append("()");								} else if ("none".equals( translatedViewType)) {									valueList.append("null");								} else {									// a standard view is used:									valueList.append("new ").append( translatedViewType ).append("()");								}								*/							} else {								valueList.append( value );							}						}					} else {						throw new BuildException("Error while processing CSS code. Encountered unknown attributes-type [" + attributeType + "]: please report this error to j2mepolish@enough.de.");					}					if ( currentAttribute < numberOfAttributes) {						valueList.append(", ");					}									}			}			keyList.append("}");			valueList.append("}");			codeList.add( "\t\t, " + keyList.toString());			codeList.add( "\t\t, " + valueList.toString());		} // if there are any non-standard attribute-groups				// close the style definition:		codeList.add("\t);");	}