Initialize
[sdk/ide/product.git] / org.eclipse.jst.pagedesigner / src / org / eclipse / jst / pagedesigner / css2 / property / WhiteSpaceMeta.java
1 /*******************************************************************************\r
2  * Copyright (c) 2006 Sybase, Inc. and others.\r
3  *\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     Sybase, Inc. - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.eclipse.jst.pagedesigner.css2.property;\r
13 \r
14 import org.eclipse.jst.pagedesigner.IHTMLConstants;\r
15 import org.eclipse.jst.pagedesigner.css2.ICSSStyle;\r
16 import org.eclipse.jst.pagedesigner.utils.DOMUtil;\r
17 import org.w3c.dom.Element;\r
18 \r
19 /**\r
20  * @author mengbo\r
21  */\r
22 public class WhiteSpaceMeta extends CSSPropertyMeta {\r
23         static final String[] KEYWORDS = new String[] { ICSSPropertyID.VAL_NORMAL,\r
24                         ICSSPropertyID.VAL_PRE, ICSSPropertyID.VAL_NOWRAP };\r
25 \r
26         /**\r
27          * Default constructor\r
28          */\r
29         public WhiteSpaceMeta() {\r
30                 super(true, ICSSPropertyID.VAL_NORMAL);\r
31         }\r
32 \r
33         /*\r
34          * (non-Javadoc)\r
35          * \r
36          * @see org.eclipse.jst.pagedesigner.css2.property.CSSPropertyMeta#getKeywordValues()\r
37          */\r
38         protected String[] getKeywordValues() {\r
39                 return KEYWORDS;\r
40         }\r
41 \r
42         public Object calculateHTMLAttributeOverride(Element element,\r
43                         String htmltag, String propertyName, ICSSStyle style) {\r
44                 if (IHTMLConstants.TAG_TD.equalsIgnoreCase(htmltag)\r
45                                 || IHTMLConstants.TAG_TH.equalsIgnoreCase(htmltag)) {\r
46                         String noWrap = DOMUtil.getAttributeIgnoreCase(element,\r
47                                         IHTMLConstants.ATTR_NOWRAP);\r
48                         if (Boolean.TRUE.toString().equalsIgnoreCase(noWrap)) {\r
49                                 return ICSSPropertyID.VAL_NOWRAP;\r
50                         }\r
51                 }\r
52                 return super.calculateHTMLAttributeOverride(element, htmltag,\r
53                                 propertyName, style);\r
54         }\r
55 }\r