diff options
Diffstat (limited to 'bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util')
40 files changed, 0 insertions, 7904 deletions
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/AbstractCssTraverser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/AbstractCssTraverser.java deleted file mode 100644 index 1e9f9c60cd..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/AbstractCssTraverser.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - -import java.util.ArrayList; -import java.util.Stack; -import java.util.Vector; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet; - - - -/** - * - */ -public abstract class AbstractCssTraverser { - - public static short TRAV_CONT = 0; - public static short TRAV_PRUNE = 1; - public static short TRAV_STOP = 2; - protected java.util.Stack travStack; - private boolean fTraverseImported = false; - private boolean fTraverseImportFirst = false; - private java.util.Vector traversedSheets; - - /** - * CssPropCMNode constructor comment. - */ - public AbstractCssTraverser() { - super(); - } - - /** - * @param model - * org.eclipse.wst.css.core.model.interfaces.ICSSModel - */ - public final void apply(ICSSModel model) { - apply(model.getDocument()); - } - - public final void apply(ICSSNode root) { - travStack = new Stack(); - if (fTraverseImported) { - traversedSheets = new Vector(); - if (root != null && root.getOwnerDocument() != null && root.getOwnerDocument().getNodeType() == ICSSNode.STYLESHEET_NODE) { - traversedSheets.add(root.getOwnerDocument()); - } - } - - // first call begin() - begin(root); - - // traverse - traverse(root); - - // last call end() - end(root); - } - - - protected void begin(ICSSNode node) { - } - - - protected void end(ICSSNode node) { - } - - /** - * @return boolean - */ - public final boolean isTraverseImported() { - return fTraverseImported; - } - - - protected short postNode(ICSSNode node) { - return (short) 0; - } - - - protected short preNode(ICSSNode node) { - return (short) 0; - } - - /** - * @param newTraverseImported - * boolean - */ - public final void setTraverseImported(boolean newTraverseImported) { - fTraverseImported = newTraverseImported; - } - - /** - * @param newTraverseImportFirst - * boolean - */ - public final void setTraverseImportFirst(boolean newTraverseImportFirst) { - fTraverseImportFirst = newTraverseImportFirst; - } - - - private final short traverse(ICSSNode node) { - if (node == null) - return TRAV_CONT; - - travStack.push(node); - - // pre-action - short ret = preNode(node); - - if (ret == TRAV_CONT) { - if (fTraverseImported && (node.getNodeType() == ICSSNode.IMPORTRULE_NODE)) { - ICSSImportRule rule = (ICSSImportRule) node; - // traverse external style-sheet - ICSSStyleSheet sheet = (ICSSStyleSheet) rule.getStyleSheet(); - if (sheet != null && !traversedSheets.contains(sheet)) { // prevent - // loop - traversedSheets.add(sheet); - short retExt = traverse(sheet); - if (retExt == TRAV_STOP) { - travStack.pop(); - return retExt; - } - } - } - - // collect children - ArrayList children = new ArrayList(); - ICSSNode child = node.getFirstChild(); - if (fTraverseImportFirst) { - ArrayList others = new ArrayList(); - - while (child != null) { - if (child.getNodeType() == ICSSNode.IMPORTRULE_NODE) - children.add(child); - else - others.add(child); - child = child.getNextSibling(); - } - children.addAll(others); - } - else { - while (child != null) { - children.add(child); - child = child.getNextSibling(); - } - } - - // traverse children - for (int i = 0; i < children.size(); i++) { - child = (ICSSNode) children.get(i); - short retChild = traverse(child); - if (retChild == TRAV_STOP) { - travStack.pop(); - return retChild; - } - } - } - else if (ret == TRAV_STOP) { - travStack.pop(); - return ret; - } - - // post-action - ret = postNode(node); - - travStack.pop(); - return (ret == TRAV_PRUNE) ? TRAV_CONT : ret; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSClassTraverser.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSClassTraverser.java deleted file mode 100644 index e7574d6f6d..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSClassTraverser.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSMediaRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet; - - -/** - * - */ -public class CSSClassTraverser extends AbstractCssTraverser { - - ArrayList fClassNames; - - /** - * - */ - public CSSClassTraverser() { - super(); - } - - /** - * - */ - private void addClassNames(ICSSStyleRule rule) { - ICSSSelectorList selectorList = rule.getSelectors(); - Iterator iSelector = selectorList.getIterator(); - while (iSelector.hasNext()) { - ICSSSelector selector = (ICSSSelector) iSelector.next(); - Iterator iItem = selector.getIterator(); - while (iItem.hasNext()) { - ICSSSelectorItem item = (ICSSSelectorItem) iItem.next(); - if (item.getItemType() == ICSSSelectorItem.SIMPLE) { - ICSSSimpleSelector sel = (ICSSSimpleSelector) item; - int nClasses = sel.getNumOfClasses(); - for (int iClass = 0; iClass < nClasses; iClass++) { - String className = sel.getClass(iClass); - if (!fClassNames.contains(className)) - fClassNames.add(className); - } - } - } - } - } - - /** - * - */ - protected void begin(ICSSNode node) { - if (fClassNames == null) - fClassNames = new ArrayList(); - } - - /** - * - */ - protected void end(ICSSNode node) { - } - - /** - * - */ - public Collection getClassNames() { - return (fClassNames != null) ? fClassNames : Collections.EMPTY_LIST; - } - - /** - * - */ - protected short postNode(ICSSNode node) { - return TRAV_CONT; - } - - /** - * - */ - protected short preNode(ICSSNode node) { - short ret; - if (node instanceof ICSSStyleRule) { - addClassNames((ICSSStyleRule) node); - ret = TRAV_PRUNE; - } - else if (node instanceof ICSSStyleSheet || node instanceof ICSSMediaRule || node instanceof ICSSImportRule) { - ret = TRAV_CONT; - } - else { - ret = TRAV_PRUNE; - } - return ret; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSLinkConverter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSLinkConverter.java deleted file mode 100644 index e5d3690a3f..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSLinkConverter.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import org.eclipse.core.runtime.Preferences; -import org.eclipse.wst.css.core.internal.CSSCorePlugin; -import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.css.CSSPrimitiveValue; -import org.w3c.dom.css.CSSValue; - - -/** - * - */ -public class CSSLinkConverter extends org.eclipse.wst.css.core.internal.util.AbstractCssTraverser { - private static final String URL_BEGIN = "url("; //$NON-NLS-1$ - private static final String URL_END = ")"; //$NON-NLS-1$ - private static final String EMPTY = ""; //$NON-NLS-1$ - private static final String D_QUOTE = "\""; //$NON-NLS-1$ - private static final String S_QUOTE = "\'"; //$NON-NLS-1$ - - IStructuredModel baseModel; - - /** - * - */ - public CSSLinkConverter(IStructuredModel model) { - super(); - baseModel = model; - if (model instanceof ICSSModel && ((ICSSModel) model).getStyleSheetType() != ICSSModel.EXTERNAL) { - IDOMNode node = (IDOMNode) ((ICSSModel) model).getOwnerDOMNode(); - baseModel = node.getModel(); - } - } - - /** - * - */ - public static String addFunc(String value) { - if (!value.trim().toLowerCase().startsWith(URL_BEGIN)) { - // pa_TODO css pref - Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences(); - - String quote = preferences.getString(CSSCorePreferenceNames.FORMAT_QUOTE); - value = CSSUtil.stripQuotes(value); - quote = CSSUtil.detectQuote(value, quote); - String str = URL_BEGIN; - if (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER) - str = str.toUpperCase(); - StringBuffer buf = new StringBuffer(str); - buf.append(quote); - buf.append(value); - buf.append(quote); - buf.append(URL_END); - return buf.toString(); - } - return value; - } - - - - /** - * - */ - protected void begin(ICSSNode node) { - if (baseModel == null) { - baseModel = node.getOwnerDocument().getModel(); - if (baseModel instanceof ICSSModel && ((ICSSModel) baseModel).getStyleSheetType() != ICSSModel.EXTERNAL) { - IDOMNode xmlNode = (IDOMNode) ((ICSSModel) baseModel).getOwnerDOMNode(); - baseModel = xmlNode.getModel(); - } - } - } - - /** - * - */ - private static boolean isUrl(String source) { - if (source == null) - return false; - source = source.trim().toLowerCase(); - return source.startsWith(URL_BEGIN); - } - - /** - * - */ - protected short preNode(ICSSNode node) { - if (node.getNodeType() == ICSSNode.PRIMITIVEVALUE_NODE) { - toAbsolute((CSSValue) node); - } else if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) { - ICSSImportRule iRule = (ICSSImportRule) node; - iRule.setHref(toAbsolute(addFunc(iRule.getHref()))); - } - return TRAV_CONT; - } - - /** - * - * @return java.lang.String - * @param value - * java.lang.String - */ - public static String removeFunc(String value) { - if (value == null) - return EMPTY; - String field = value.trim(); - // first : tear "url(....)" - if (field.toLowerCase().startsWith(URL_BEGIN)) { - int url = field.toLowerCase().indexOf(URL_BEGIN); - int endParenthesis = field.lastIndexOf(URL_END); - if (endParenthesis > url) { - field = field.substring(url + 4, endParenthesis); - } else - field = field.substring(url + 4); - } - return field.trim(); - } - - /** - * - */ - public static String stripFunc(String value) { - if (value == null) - return EMPTY; - // first : tear "url(....)" - String field = removeFunc(value); - // second : tear quotations - if (field.toLowerCase().startsWith(D_QUOTE)) { - int quote = field.indexOf(D_QUOTE); - int end = field.lastIndexOf(D_QUOTE); - if (end > quote) { - field = field.substring(quote + 1, end); - } else - field = field.substring(quote + 1); - } else if (field.toLowerCase().startsWith(S_QUOTE)) { - int quote = field.indexOf(S_QUOTE); - int end = field.lastIndexOf(S_QUOTE); - if (end > quote) { - field = field.substring(quote + 1, end); - } else - field = field.substring(quote + 1); - } - - return field.trim(); - } - - /** - * - */ - public String toAbsolute(String source) { - if (isUrl(source)) { - String url = CSSPathService.getAbsoluteURL(baseModel, stripFunc(source)); - return (url != null) ? addFunc(url) : (URL_BEGIN + URL_END); - } - return source; - } - - /** - * - */ - public boolean toAbsolute(CSSValue node) { - if (node instanceof ICSSPrimitiveValue) { - ICSSPrimitiveValue value = (ICSSPrimitiveValue) node; - if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI) { - value.setValue(stripFunc(toAbsolute(URL_BEGIN + value.getStringValue() + URL_END))); - return true; - } - } - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSPathService.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSPathService.java deleted file mode 100644 index 9fa8433609..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSPathService.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; - -/** - * - */ -public class CSSPathService { - - // Constants - private static final String FILEURLSCHEME = "file";//$NON-NLS-1$ - private static final String URLCOLON = ":"; //$NON-NLS-1$ - private static final String FILEURLPREFIX = FILEURLSCHEME + URLCOLON + "//";//$NON-NLS-1$ - private static final String URLSEPARATOR = "/"; //$NON-NLS-1$ - - /** - * @return java.lang.String - */ - public static String getAbsoluteURL(IStructuredModel baseModel, String ref) { - String absLink = URLModelProviderCSS.resolveURI(baseModel, ref, true); - String url = absLink; - if (absLink != null) { // if it has not scheme, we must add "file" - // scheme - try { - new java.net.URL(absLink); - } - catch (java.net.MalformedURLException e) { - IPath path = new Path(absLink); - if (path != null) - url = toURL(path); - } - } - return url; - } - - /** - * - * @return org.eclipse.core.resources.IFile - * @param location - * java.lang.String - */ - public static IFile location2File(String location) { - Path path = new Path(location); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); - if (file == null && path.segmentCount() > 1) - file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - return file; - } - - /** - * Gets a file URL for the path. - */ - private static String toURL(IPath path) { - path = new Path(path.toFile().getAbsolutePath()); - if (path.isUNC() == true) { - // it's UNC. return file://host/foo/bar/baz.html - return FILEURLSCHEME + URLCOLON + path.toString(); - } - return FILEURLPREFIX + URLSEPARATOR + path.toString(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSSelectorListFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSSelectorListFactory.java deleted file mode 100644 index 04b97e8793..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSSelectorListFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - -import org.eclipse.wst.css.core.internal.document.CSSSelectorListImpl; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList; - - -public class CSSSelectorListFactory { - static synchronized public CSSSelectorListFactory getInstance() { - if (fInstance == null) { - fInstance = new CSSSelectorListFactory(); - } - return fInstance; - } - - public ICSSSelectorList createSelectorList(String selectorString) { - return new CSSSelectorListImpl(selectorString); - } - - - private CSSSelectorListFactory() { - super(); - } - - private static CSSSelectorListFactory fInstance; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSStyleDeclarationFactory.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSStyleDeclarationFactory.java deleted file mode 100644 index 285ace38b3..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSStyleDeclarationFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import org.eclipse.wst.css.core.internal.document.CSSStyleDeclarationFactoryContext; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; - - -/** - * - */ -public class CSSStyleDeclarationFactory extends CSSStyleDeclarationFactoryContext { - - private static CSSStyleDeclarationFactory fInstance = null; - - /** - * CSSStyleDeclarationFactory constructor comment. - */ - private CSSStyleDeclarationFactory() { - super(); - } - - /** - * @return org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclaration - * @param decl - * org.eclipse.wst.css.core.model.interfaces.ICSSStyleDeclaration - */ - public ICSSStyleDeclaration createStyleDeclaration(ICSSStyleDeclaration decl) { - if (decl == null) { - return null; - } - ICSSStyleDeclaration newNode = createStyleDeclaration(); - - if (newNode == null) { - return null; - } - fOwnerDocument = newNode; - cloneChildNodes(decl, newNode); - return newNode; - } - - /** - * - */ - public synchronized static CSSStyleDeclarationFactory getInstance() { - if (fInstance == null) { - fInstance = new CSSStyleDeclarationFactory(); - } - return fInstance; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSUtil.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSUtil.java deleted file mode 100644 index 3583859ba8..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/CSSUtil.java +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.Enumeration; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.Logger; -import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; - - -public class CSSUtil { - - /** - * - */ - public static void debugOut(String str) { - Logger.log(Logger.WARNING, "css warning: " + str); //$NON-NLS-1$ - } - - /** - * - */ - // public static Vector extractMediaContents(Vector regions) { - // Vector media = new Vector(); - // if (regions == null) { return media; } - // - // boolean bReady = true; - // for (Iterator i = regions.iterator(); i.hasNext(); ) { - // ITextRegion region = (ITextRegion)i.next(); - // if (region == null) { continue; } - // String type = region.getType(); - // if (bReady) { - // if (type == IDENT) { - // media.addElement(region.getText()); - // bReady = false; - // } - // } else { - // if (type == COMMA) { - // bReady = true; - // } - // } - // } - // - // return media; - // } - /** - * - */ - public static String extractStringContents(String text) { - return stripQuotes(text); - } - - /** - * - */ - public static String extractUriContents(String text) { - String contents = text.trim(); - if (contents.toLowerCase().startsWith("url(") && //$NON-NLS-1$ - contents.toLowerCase().endsWith(")")) {//$NON-NLS-1$ - // strip "url(", ")" - contents = contents.substring(4, contents.length() - 1); - } - contents = stripQuotes(contents); - - return contents; - } - - /** - * - */ - public static IStructuredDocumentRegion findNextSignificantNode(IStructuredDocumentRegion startNode) { - if (startNode == null) { - return null; - } - IStructuredDocumentRegion node = startNode.getNext(); - while (node != null) { - String type = getStructuredDocumentRegionType(node); - if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) { - return node; - } - node = node.getNext(); - } - return null; - } - - /** - * - */ - public static IStructuredDocumentRegion findNodeBackward(IStructuredDocumentRegion startNode, IStructuredDocumentRegion endNode, String type) { - IStructuredDocumentRegion node; - for (node = startNode; node != null; node = node.getPrevious()) { - if (node.getStartOffset() < endNode.getStartOffset()) { - node = null; - break; - } - else if (getStructuredDocumentRegionType(node) == type) { - break; - } - } - return node; - } - - /** - * - */ - public static IStructuredDocumentRegion findNodeForward(IStructuredDocumentRegion startNode, IStructuredDocumentRegion endNode, String type) { - IStructuredDocumentRegion node; - for (node = startNode; node != null; node = node.getNext()) { - if (endNode.getStartOffset() < node.getStartOffset()) { - node = null; - break; - } - else if (getStructuredDocumentRegionType(node) == type) { - break; - } - } - return node; - } - - /** - * - */ - public static IStructuredDocumentRegion findPreviousSignificantNode(IStructuredDocumentRegion startNode) { - if (startNode == null) { - return null; - } - IStructuredDocumentRegion node = startNode.getPrevious(); - while (node != null) { - String type = getStructuredDocumentRegionType(node); - if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) { - return node; - } - node = node.getPrevious(); - } - return null; - } - - /** - * - */ - public static String getClassString(Object object) { - if (object == null) { - return "null"; //$NON-NLS-1$ - } - else { - String name = object.getClass().toString(); - int lastPeriod = name.lastIndexOf('.'); - return name.substring(lastPeriod + 1); - } - } - - /** - * - */ - public static String getStructuredDocumentRegionType(IStructuredDocumentRegion flatNode) { - if (flatNode == null) { - return CSSRegionContexts.CSS_UNDEFINED; - } - ITextRegionList regions = flatNode.getRegions(); - if (regions == null || regions.size() == 0) { - return CSSRegionContexts.CSS_UNDEFINED; - } - ITextRegion region = regions.get(0); - return region.getType(); - } - - /** - * - */ - public static int getLengthDifference(IStructuredDocumentRegionList newNodes, IStructuredDocumentRegionList oldNodes) { - int newLen = getTextLength(newNodes); - int oldLen = getTextLength(oldNodes); - return newLen - oldLen; - } - - /** - * - */ - public static String getRegionText(IStructuredDocumentRegion flatNode, ITextRegionList regions) { - StringBuffer buf = new StringBuffer(); - if (regions != null) { - for (Iterator i = regions.iterator(); i.hasNext();) { - ITextRegion region = (ITextRegion) i.next(); - if (region == null) { - continue; - } - buf.append(flatNode.getText(region)); - } - } - - return buf.toString(); - } - - /** - * - */ - public static int getTextLength(IStructuredDocumentRegionList nodes) { - int length = 0; - - if (nodes != null) { - for (Enumeration e = nodes.elements(); e.hasMoreElements();) { - IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e.nextElement(); - if (flatNode != null) { - length += flatNode.getText().length(); - } - } - } - - return length; - } - - /** - * - * @param token - * @return - */ - public static boolean isLength(CSSTextToken token) { - if (token == null) - return false; - if (token.kind == CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION) - return true; - if (token.kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - double number = Double.parseDouble(token.image); - if (number == 0.0) - return true; - } - return false; - } - - /** - * - */ - public static boolean isSelectorText(IStructuredDocumentRegion region) { - String type = getStructuredDocumentRegionType(region); - if (CSSRegionUtil.isSelectorBegginingType(type)) { - return true; - } - else if (type == CSSRegionContexts.CSS_UNKNOWN) { - // String text = flatNode.getText(); - // if (text != null && text.indexOf('.') == 0) { - return true; - // } - } - - return false; - } - - /** - * - */ - public static String stripQuotes(String text) { - if (text == null) - return null; - String contents = text.trim(); - if (2 <= contents.length()) { - char first = contents.charAt(0); - char last = contents.charAt(contents.length() - 1); - if ((first == '\"' && last == '\"') || (first == '\'' && last == '\'')) { - contents = contents.substring(1, contents.length() - 1); - } - } - return contents; - } - - public static String detectQuote(String source, String defaultQuote) { - if (source == null) - return defaultQuote; - final String D_QUOTE = "\""; //$NON-NLS-1$ - final String S_QUOTE = "\'"; //$NON-NLS-1$ - - int dIndex = source.indexOf(D_QUOTE); - int sIndex = source.indexOf(S_QUOTE); - if (dIndex < 0 && sIndex < 0) { - return defaultQuote; - } - else if (dIndex < 0) { - return D_QUOTE; - } - else if (sIndex < 0) { - return S_QUOTE; - } - else if (dIndex < sIndex) { - return S_QUOTE; - } - else { - return D_QUOTE; - } - } - - /** - * - */ - public static void stripSurroundingSpace(ITextRegionList regions) { - if (regions == null) { - return; - } - while (!regions.isEmpty()) { - ITextRegion region = regions.get(0); - String type = region.getType(); - if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) { - regions.remove(0); - } - else { - break; - } - } - while (!regions.isEmpty()) { - ITextRegion region = regions.get(regions.size() - 1); - String type = region.getType(); - if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) { - regions.remove(region); - } - else { - break; - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportRuleCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportRuleCollector.java deleted file mode 100644 index 6ec4ec0de4..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportRuleCollector.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.Vector; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet; - - -/** - * - */ -public class ImportRuleCollector extends org.eclipse.wst.css.core.internal.util.AbstractCssTraverser { - - protected java.util.Vector rules = new Vector(); - protected ICSSStyleSheet target = null; - - /** - * - */ - public ImportRuleCollector() { - super(); - setTraverseImported(false); - } - - /** - * - */ - public ImportRuleCollector(ICSSStyleSheet sheet) { - super(); - target = sheet; - } - - /** - * - */ - public java.util.Vector getRules() { - return rules; - } - - /** - * - */ - protected short preNode(ICSSNode node) { - if (node.getNodeType() == ICSSNode.MEDIARULE_NODE || node.getNodeType() == ICSSNode.STYLESHEET_NODE) { - return TRAV_CONT; - } - if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) { - if (target != null) { - ICSSImportRule imp = (ICSSImportRule) node; - if (imp.getStyleSheet() != target) - return TRAV_PRUNE; - } - if (!rules.contains(node)) - rules.add(node); - } - return TRAV_PRUNE; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportedCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportedCollector.java deleted file mode 100644 index 2c4751ef8f..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/ImportedCollector.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.List; -import java.util.Vector; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; - - -/** - * - */ -public class ImportedCollector extends org.eclipse.wst.css.core.internal.util.AbstractCssTraverser { - - protected java.util.Vector externals = new Vector(); - - /** - * - */ - public ImportedCollector() { - super(); - setTraverseImported(true); - } - - /** - * - */ - public List getExternals() { - return externals; - } - - /** - * - */ - protected short preNode(ICSSNode node) { - if (node.getNodeType() == ICSSNode.MEDIARULE_NODE) { - return TRAV_CONT; - } - if (node.getNodeType() == ICSSNode.STYLESHEET_NODE) { - if (!externals.contains(node)) { - externals.add(node); - } - return TRAV_CONT; - } - if (node.getNodeType() == ICSSNode.IMPORTRULE_NODE) { - return TRAV_CONT; - } - return TRAV_PRUNE; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/RegionIterator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/RegionIterator.java deleted file mode 100644 index 5f2626dd45..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/RegionIterator.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -/** - * - */ -public class RegionIterator { - - private IStructuredDocumentRegion documentRegion = null; - private IStructuredDocumentRegion curDocumentRegion = null; - private int current = -1; - - /** - * - */ - public RegionIterator(IStructuredDocument structuredDocument, int index) { - super(); - - reset(structuredDocument, index); - } - - /** - * - */ - public RegionIterator(IStructuredDocumentRegion flatNode, ITextRegion region) { - super(); - reset(flatNode, region); - } - - /** - * - */ - public IStructuredDocumentRegion getStructuredDocumentRegion() { - return curDocumentRegion; - } - - /** - * - */ - public boolean hasNext() { - if (documentRegion == null) - return false; - if (current < 0) - return false; - if (current < documentRegion.getRegions().size()) - return true; - return false; - } - - /** - * - */ - public boolean hasPrev() { - // the same as hasNext() - return hasNext(); - } - - /** - * - */ - public ITextRegion next() { - if (documentRegion == null) - return null; - if (current < 0 || documentRegion.getRegions() == null || documentRegion.getRegions().size() <= current) - return null; - - ITextRegion region = documentRegion.getRegions().get(current); - curDocumentRegion = documentRegion; - - if (current >= documentRegion.getRegions().size() - 1) { - documentRegion = documentRegion.getNext(); - current = -1; - } - current++; - - return region; - } - - /** - * - */ - public ITextRegion prev() { - if (documentRegion == null) - return null; - if (current < 0 || documentRegion.getRegions() == null || documentRegion.getRegions().size() <= current) - return null; - - ITextRegion region = documentRegion.getRegions().get(current); - curDocumentRegion = documentRegion; - - if (current == 0) { - documentRegion = documentRegion.getPrevious(); - if (documentRegion != null) - current = documentRegion.getRegions().size(); - else - current = 0; - } - current--; - - return region; - } - - /** - * - */ - public void reset(IStructuredDocument structuredDocument, int index) { - documentRegion = structuredDocument.getRegionAtCharacterOffset(index); - curDocumentRegion = documentRegion; - if (documentRegion != null) { - ITextRegion region = documentRegion.getRegionAtCharacterOffset(index); - current = documentRegion.getRegions().indexOf(region); - } - } - - /** - * - */ - public void reset(IStructuredDocumentRegion flatNode, ITextRegion region) { - if (region != null && flatNode != null) { - this.documentRegion = flatNode; - curDocumentRegion = flatNode; - current = flatNode.getRegions().indexOf(region); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectionCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectionCollector.java deleted file mode 100644 index b52393284e..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectionCollector.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; - - -/** - */ -public class SelectionCollector extends org.eclipse.wst.css.core.internal.util.AbstractCssTraverser { - - int start, end; - List selectedNodes; - - /** - * SelectionCollector constructor comment. - */ - public SelectionCollector() { - super(); - } - - /** - */ - protected void begin(ICSSNode node) { - selectedNodes = new ArrayList(); - } - - /** - */ - public List getSelectedNodes() { - if (selectedNodes == null) - return new ArrayList(); - else - return new ArrayList(selectedNodes); - } - - /** - */ - protected short preNode(ICSSNode node) { - IndexedRegion iNode = (IndexedRegion) node; - if (iNode.getStartOffset() <= end && start < iNode.getEndOffset()) { - if (node.getNodeType() != ICSSNode.STYLESHEET_NODE) { - IndexedRegion iFirstChild = (IndexedRegion) node.getFirstChild(); - IndexedRegion iLastChild = (IndexedRegion) node.getLastChild(); - if (iFirstChild == null || start < iFirstChild.getStartOffset() || iLastChild.getEndOffset() <= end) - selectedNodes.add(node); - } - return TRAV_CONT; - } - if (iNode.getStartOffset() > end) - return TRAV_STOP; - else - return TRAV_PRUNE; - } - - /** - */ - public void setRegion(int newStart, int newEnd) { - start = newStart; - end = newEnd; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorValidator.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorValidator.java deleted file mode 100644 index 0a92aafd51..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorValidator.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import org.eclipse.wst.css.core.internal.document.CSSSelectorListImpl; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector; - - -public class SelectorValidator { - - /** - * Constructor for SelectorValidator. - */ - public SelectorValidator(String text) { - super(); - fText = text; - } - - /** - * Returns true if the text consists of one CLASS selector. syntax check - * is a little loose (.123 is passed) - * - * ".class" -> true ".123" -> true ".class , .class2" -> false - * ".class.class2" -> false ".123{}" -> false - */ - public boolean isClass() { - ICSSSimpleSelector selector = getOnlyOneSimpleSelector(); - if (selector != null) { - return (selector.getName().length() == 0 && selector.getNumOfAttributes() == 0 && selector.getNumOfClasses() == 1 && selector.getNumOfIDs() == 0 && selector.getNumOfPseudoNames() == 0); - } - return false; - } - - /** - * Returns true if the text consists of one ID selector. - * - * "#ID" -> true "H1#myID" -> false "#abc{}" -> false - */ - public boolean isID() { - ICSSSimpleSelector selector = getOnlyOneSimpleSelector(); - if (selector != null) { - return (selector.getName().length() == 0 && selector.getNumOfAttributes() == 0 && selector.getNumOfClasses() == 0 && selector.getNumOfIDs() == 1 && selector.getNumOfPseudoNames() == 0); - } - return false; - } - - /** - * overall check - * - * "P#hoge98 + *:hover > A:link, A.external:visited" -> true "H1 H2 {}" -> - * false - */ - public boolean isValid() { - parse(); - return (fSelectorList != null && fSelectorList.getErrorCount() == 0); - } - - private ICSSSimpleSelector getOnlyOneSimpleSelector() { - parse(); - if (fSelectorList != null && fSelectorList.getLength() == 1) { - ICSSSelector selector = fSelectorList.getSelector(0); - int nItem = selector.getLength(); - if (nItem == 1) { - ICSSSelectorItem item = selector.getItem(0); - if (item instanceof ICSSSimpleSelector) { - return (ICSSSimpleSelector) item; - } - } - } - return null; - } - - private void parse() { - if (fSelectorList == null) { - if (fText != null) { - fSelectorList = new CSSSelectorListImpl(fText); - } - } - } - - - private String fText = null; - private ICSSSelectorList fSelectorList = null; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorsCollector.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorsCollector.java deleted file mode 100644 index fcaa32ee98..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/SelectorsCollector.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule; - - -/** - * - */ -public class SelectorsCollector extends AbstractCssTraverser { - - protected Vector selectors = new Vector(); - protected Vector selectorsToAvoid = null; - - /** - * - */ - public SelectorsCollector() { - super(); - setTraverseImported(false); - } - - /** - * - */ - public void addSelectorToAvoid(ICSSSelector selToAvoid) { - if (selToAvoid == null) - return; - if (selectorsToAvoid == null) - selectorsToAvoid = new Vector(); - - if (!selectorsToAvoid.contains(selToAvoid)) - selectorsToAvoid.add(selToAvoid); - } - - /** - * - */ - public void addSelectorToAvoid(ICSSStyleRule rule) { - ICSSSelectorList list = rule.getSelectors(); - Iterator it = list.getIterator(); - while (it.hasNext()) { - ICSSSelector sel = (ICSSSelector) it.next(); - addSelectorToAvoid(sel); - } - } - - /** - * - */ - public java.util.List getSelectors() { - return selectors; - } - - /** - * - */ - protected short preNode(ICSSNode node) { - if (node.getNodeType() == ICSSNode.STYLERULE_NODE) { - ICSSStyleRule rule = (ICSSStyleRule) node; - ICSSSelectorList list = rule.getSelectors(); - Iterator it = list.getIterator(); - while (it.hasNext()) { - Object obj = it.next(); - if (selectorsToAvoid != null && selectorsToAvoid.contains(obj)) - continue; - if (!selectors.contains(obj)) - selectors.add(obj); - } - return TRAV_PRUNE; - } - else if (node.getNodeType() == ICSSNode.STYLESHEET_NODE) { - return TRAV_CONT; - } - return TRAV_PRUNE; - } - - /** - * - */ - public void setSelectorsToAvoid(java.util.Vector newSelectorsToAvoid) { - selectorsToAvoid = newSelectorsToAvoid; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLHelper.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLHelper.java deleted file mode 100644 index f51460e781..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLHelper.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.wst.sse.core.internal.util.PathHelper; - -/** - * Hyperlink manager. Proved useful services like link conversion An utility - * class to help other parsre modules to convert links - */ -public class URLHelper { - - private static final String FILE_PROTOCOL_SEARCH_SIG = "file:/";//$NON-NLS-1$ - private static final String FILE_PROTOCOL_SIG = "file:///";//$NON-NLS-1$ - private static String RELATIVE_PATH_SIG = "..";//$NON-NLS-1$ - private static final String FORWARD_SLASH = "/";//$NON-NLS-1$ - private URL fBaseUrl = null; // base url. assumed to a absulute url - private String fBaseUrlString = null; - private URL fDocRoot = null; - private String fDocRootString = null; - - public URLHelper(String baseUrl) { - initialize(baseUrl, null); - } - - public URLHelper(String baseUrl, String docRoot) { - initialize(baseUrl, docRoot); - } - - /** - * Special adujust for file url - */ - public String adjustFileProtocolUrl(String url) { - if (url.startsWith(FILE_PROTOCOL_SEARCH_SIG)) { - url = FILE_PROTOCOL_SIG + url.substring(FILE_PROTOCOL_SEARCH_SIG.length()); - } - return url; - } - - private String convert(String url, URL baseUrl, String urlString) { - String absUrl = url; - if (baseUrl != null) { - try { - // do special thing file protocol - if (baseUrl.getProtocol().equalsIgnoreCase("file")) {//$NON-NLS-1$ - // remove the fist - if (url.startsWith("/"))//$NON-NLS-1$ - url = url.substring(1); - // empty string causes malformed exception - String tempUrl = url; - if ("".equals(url))//$NON-NLS-1$ - tempUrl = " ";//$NON-NLS-1$ - URL newUrl = new URL(baseUrl, tempUrl); - // do extra math for file protocol to support ie based - absUrl = adjustFileProtocolUrl(newUrl.toString()); - } - else { - URL newUrl = new URL(fBaseUrl, url); - absUrl = newUrl.toString(); - } - } - catch (MalformedURLException me) { - } - // convert everything to forward slash - absUrl = PathHelper.switchToForwardSlashes(absUrl); - } - else { - // the given may be based on file - if (urlString != null) { - // swich the url to proper direction - url = PathHelper.removeLeadingSeparator(url); - File fle = new File(urlString, url); - absUrl = fle.getPath(); - - } - // convert everything to forward slash - absUrl = PathHelper.switchToForwardSlashes(absUrl); - - // if the path ends with ".." we need to add a terminating slash - // or - // else the link will not be resolved correctly. (it will look - // like - // /url/path/to/somewhere/.. instead of /url/path/to/ - if (absUrl.endsWith(FORWARD_SLASH + RELATIVE_PATH_SIG)) { - absUrl += FORWARD_SLASH; - } - } - - // resolve relative path to absolute - absUrl = PathHelper.adjustPath(absUrl); - return absUrl; - } - - private void initialize(String baseUrl, String docRoot) { - // - // Find out whether baes url is a url or file name - // - try { - String temp = PathHelper.appendTrailingURLSlash(baseUrl); - fBaseUrl = new URL(temp); - } - catch (MalformedURLException mue) { - } - if (fBaseUrl == null) { - // it is a file based url - fBaseUrlString = baseUrl; - } - - // do the same for doc root - if (docRoot != null) { - try { - String temp = PathHelper.appendTrailingURLSlash(docRoot); - fDocRoot = new URL(temp); - - } - catch (MalformedURLException mue) { - } - if (fDocRoot == null) { - // it is a file based url - fDocRootString = docRoot; - } - } - } - - /** - * Convert the given url to a abolute url using the base url Input url can - * be of any othe following format Absolute urls -------------- . - * http://www.foo.com/ . http://www.foo.com . http://www.foo.com/folder . - * http://www.foo.com/folder/ . http://www.foo.com/index.html . - * http://www.foo.com/folder/index.html . - * http://www.foo.com/folder/../index.html Url relative on document root - * ------------------------- . / . /folder . /index.html . - * /folder/index.html . /folder/../index.html - * - * Self relative ------------------------- . index.html . ./index.html . - * ../index.html . folder/index.html . folder/../index.html - * - * file based url adds another dimension since it doesn't have a document - * root So uses fDocRoot if provided - */ - public String toAbsolute(String url) { - String absUrl = url; - - URL newUrl = null; - // try to see it is a absolute url - try { - newUrl = new URL(url); - } - catch (MalformedURLException me) { - } - // if document root is provided - // do special case - if (newUrl == null) { - if (fDocRoot == null && fDocRootString == null) { - // try to check relative url - absUrl = convert(url, fBaseUrl, fBaseUrlString); - } - else { - // doc root is provided - // if the url is a doc root based use doc root - - if (url.startsWith("/"))//$NON-NLS-1$ - absUrl = convert(url, fDocRoot, fDocRootString); - else - absUrl = convert(url, fBaseUrl, fBaseUrlString); - - } - } - return absUrl; - } - - /** - * Convert from an absolute url to relative url based on the given url - * Both are assumed to be ablsute url - */ - public String toRelative(String url, String documentUrl) { - String output = url; - // assuming both urls are absolute - try { - URL inputUrl = new URL(url); - URL docUrl = new URL(documentUrl); - // filter out if the urls are not fro the same domain - if (!inputUrl.getProtocol().equals(docUrl.getProtocol()) || !inputUrl.getHost().equals(docUrl.getHost()) || inputUrl.getPort() != docUrl.getPort()) - return output; - // both url are coming form the same place - // strip off the domain parts - String inputName = inputUrl.getFile(); - String docName = docUrl.getFile(); - output = PathHelper.convertToRelative(inputName, docName); - } - catch (MalformedURLException me) { - output = null; - } - return output; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLModelProviderCSS.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLModelProviderCSS.java deleted file mode 100644 index f72bb62214..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/URLModelProviderCSS.java +++ /dev/null @@ -1,387 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util; - - - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.charset.UnsupportedCharsetException; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.encoding.EncodingRule; -import org.eclipse.wst.sse.core.internal.provisional.IModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; -import org.eclipse.wst.sse.core.internal.util.PathHelper; -import org.eclipse.wst.sse.core.internal.util.ProjectResolver; -import org.eclipse.wst.sse.core.internal.util.URIResolver; - -/** - */ -public class URLModelProviderCSS { - - private static final int GET_MODEL_FOR_READ = 1; - // private static final int GET_NEW_MODEL_FOR_READ = 2; - private static final int GET_MODEL_FOR_EDIT = 3; - // private static final int GET_NEW_MODEL_FOR_EDIT = 4; - // private static final int READ_BUFFER_SIZE = 4096; - // IModelManager - private IModelManager modelManager = null; - - /** - */ - public URLModelProviderCSS() { - super(); - - // obtain model manager - modelManager = StructuredModelManager.getModelManager(); - } - - /** - * Calculate ID from a filename. This must be same as - * FileModelProvider.calculateId(IFile) - */ - private static String calculateId(IPath fullIPath) { - return fullIPath.toString(); - } - - /** - * <code>baseModel</code>: the model containing the link - * <code>ref</code>: the link URL string - */ - private IStructuredModel getCommonModelFor(final IStructuredModel baseModel, final String ref, final int which) throws IOException { - // first, create absolute url - String absURL = resolveURI(baseModel, ref, true); - if ((absURL == null) || (absURL.length() == 0)) { - return null; - } - - // need to remove file:// scheme if necessary - try { - final URL aURL = new URL(absURL); - // An actual URL was given, only file:/// is supported - // resolve it by finding the file it points to - if (!aURL.getProtocol().equals("platform")) { //$NON-NLS-1$ - if (aURL.getProtocol().equals("file") && (aURL.getHost().equals("localhost") || aURL.getHost().length() == 0)) { //$NON-NLS-2$//$NON-NLS-1$ - absURL = aURL.getFile(); - final IPath ipath = new Path(absURL); - // if path has a device, and if it begins with - // IPath.SEPARATOR, remove it - final String device = ipath.getDevice(); - if ((device != null) && (device.length() > 0)) { - if (device.charAt(0) == IPath.SEPARATOR) { - final String newDevice = device.substring(1); - absURL = ipath.setDevice(newDevice).toString(); - } - } - - } - } - } - catch (MalformedURLException mfuExc) { - } - - // next, decide project - IProject project = null; - final IPath fullIPath = new Path(absURL); - IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot(); - IContainer container = workspace.getContainerForLocation(fullIPath); - if (container != null) { - // fullIPath doesn't exist in workspace - project = container.getProject(); - } - - // If HTML document has a link to an extern CSS which is not in - // IProject - // workspace.getContainerForLoation() may return null. We need to take - // care - // of this case - - // now, get absURL's IFile - if ((project != null) && (project.getLocation().isPrefixOf(fullIPath) == false)) { - // it's at outside of Project - return null; - } - - IStructuredModel model = null; - if (project != null) { - IPath filePath = fullIPath.removeFirstSegments(project.getLocation().segmentCount()); - IFile file = (filePath != null && !filePath.isEmpty()) ? project.getFile(filePath) : null; - if (file == null) { - return null; - } - - // obtain model - if (which == GET_MODEL_FOR_EDIT) { - model = getModelForEdit(file); - } - else if (which == GET_MODEL_FOR_READ) { - model = getModelForRead(file); - } - - // setting synchronization stamp is IModelManager's client's - // responsibility - if (model != null && model.getSynchronizationStamp() == IResource.NULL_STAMP) - model.resetSynchronizationStamp(file); - } - else { - String id = null; - InputStream inStream = null; - // obtain resolver - URIResolver resolver = (project != null) ? (URIResolver) project.getAdapter(URIResolver.class) : null; - if (resolver == null) { - // ProjectResolver can take care of the case if project is - // null. - resolver = new ProjectResolver(project); - } - if (resolver == null) { - return null; - } - - // there is no project. we can't expect IProject help to create - // id/inputStream - File file = fullIPath.toFile(); - - // obatin id - id = calculateId(fullIPath); - - // obtain InputStream - try { - inStream = new FileInputStream(file); - } - catch (FileNotFoundException fnfe) { - // the file does not exist, or we don't have read permission - return null; - } - - // obtain model - try { - if (which == GET_MODEL_FOR_EDIT) { - model = getModelManager().getModelForEdit(id, inStream, resolver); - } - else if (which == GET_MODEL_FOR_READ) { - model = getModelManager().getModelForRead(id, inStream, resolver); - } - } - catch (UnsupportedEncodingException ue) { - } - catch (IOException ioe) { - } - finally { - // close now ! - if (inStream != null) { - inStream.close(); - } - } - } - - // set locationid - if (model != null && model.getBaseLocation() == null) { - model.setBaseLocation(fullIPath.toString()); - } - - return model; - } - - /** - * <code>baseModel</code>: the model containing the link - * <code>ref</code>: the link URL string - */ - public IStructuredModel getModelForEdit(IStructuredModel baseModel, String ref) throws IOException { - return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_EDIT); - } - - /** - */ - private IStructuredModel getModelForEdit(IFile file) throws IOException { - if (file == null) - return null; - IModelManager manager = getModelManager(); - - // create a fake InputStream - IStructuredModel model = null; - try { - model = manager.getModelForEdit(file); - } - catch (UnsupportedCharsetException ex) { - try { - model = manager.getModelForEdit(file, EncodingRule.FORCE_DEFAULT); - } - catch (IOException ioe) { - } - catch (CoreException ce) { - } - } - catch (CoreException ce) { - } - return model; - } - - /** - * <code>baseModel</code>: the model containing the link - * <code>ref</code>: the link URL string - */ - public IStructuredModel getModelForRead(IStructuredModel baseModel, String ref) throws UnsupportedEncodingException, IOException { - return getCommonModelFor(baseModel, ref, GET_MODEL_FOR_READ); - } - - /** - */ - private IStructuredModel getModelForRead(IFile file) throws IOException { - if (file == null) - return null; - IModelManager manager = getModelManager(); - - // create a fake InputStream - IStructuredModel model = null; - try { - model = manager.getModelForRead(file); - } - catch (UnsupportedCharsetException ex) { - try { - model = manager.getModelForRead(file, EncodingRule.FORCE_DEFAULT); - } - catch (IOException ioe) { - } - catch (CoreException ce) { - } - } - catch (CoreException ce) { - } - return model; - } - - /** - */ - private IModelManager getModelManager() { - return modelManager; - } - - public IStructuredModel getNewModelForEdit(IFile iFile) { - if (iFile == null) - return null; - IModelManager manager = getModelManager(); - if (manager == null) - return null; - - IStructuredModel model = null; - try { - model = manager.getNewModelForEdit(iFile, false); - } - catch (IOException ex) { - } - catch (ResourceInUse riu) { - } - catch (ResourceAlreadyExists rae) { - } - catch (CoreException ce) { - } - return model; - } - - public IStructuredModel getNewModelForRead(IFile iFile) { - if (iFile == null) - return null; - IModelManager manager = getModelManager(); - if (manager == null) - return null; - - IStructuredModel model = null; - try { - model = manager.getNewModelForEdit(iFile, false); - } - catch (IOException ex) { - } - catch (ResourceInUse riu) { - } - catch (ResourceAlreadyExists rae) { - } - catch (CoreException ce) { - } - return model; - } - - /** - * <code>baseModel</code>: the model containing the link - * <code>ref</code>: the link URL string - * <code>resolveCrossProjectLinks</code>: If resolveCrossProjectLinks - * is set to true, then this method will properly resolve the URI if it is - * a valid URI pointing to another (appropriate) project. - */ - public static String resolveURI(IStructuredModel baseModel, String ref, boolean resolveCrossProjectLinks) { - if (baseModel == null) - return null; - - // get resolver in Model - final URIResolver resolver = baseModel.getResolver(); - - // resolve to absolute url - final String absurl = (resolver != null) ? resolver.getLocationByURI(ref, resolveCrossProjectLinks) : null; - if ((resolver != null) && (absurl == null) && (ref != null) && (ref.trim().length() > 0) && (ref.trim().charAt(0) == '/')) { - // to reach here means : - // ref is a Docroot relative - // resolver can't resolve ref - // so that href is a broken and should not create model - return null; - } - if ((absurl != null) && (absurl.length() > 0)) { - return absurl; - } - - // maybe ref is at outside of the Project - // obtain docroot; - final IContainer container = (resolver != null) ? resolver.getRootLocation() : null; - String docroot = null; - if (container != null) { - docroot = container.getLocation().toString(); - } - if (docroot == null) { - docroot = baseModel.getBaseLocation(); - } - if (docroot == null) { - // should not be - return null; - } - - // obtain document url - String modelBaseLocation = baseModel.getBaseLocation(); - if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) { - // fallback... - modelBaseLocation = baseModel.getId(); - } - if ((modelBaseLocation == null) || (modelBaseLocation.length() == 0)) { - // i can't resolve uri ! - return null; - } - - // resolve url - URLHelper helper = new URLHelper(PathHelper.getContainingFolderPath(modelBaseLocation), PathHelper.getContainingFolderPath(PathHelper.appendTrailingURLSlash(docroot))); - return helper.toAbsolute(ref); - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionXSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionXSubStyleAdapter.java deleted file mode 100644 index 29ab93ce28..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionXSubStyleAdapter.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.contentmodel.IValID; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValueList; -import org.w3c.dom.css.CSSPrimitiveValue; -import org.w3c.dom.css.CSSValue; - - -/** - * for horizontal value of 'background-position' - */ -public class BackgroundPositionXSubStyleAdapter implements ISubPropertyAdapter { - - /** - * - */ - public BackgroundPositionXSubStyleAdapter() { - super(); - } - - /** - * - */ - protected CSSTextToken[] correctMeaningToken(CSSTextToken[] src) { - java.util.ArrayList list = new java.util.ArrayList(); - for (int i = 0; i < src.length; i++) { - if (src[i].kind != CSSRegionContexts.CSS_S && src[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S && src[i].kind != CSSRegionContexts.CSS_COMMENT) - list.add(src[i]); - } - CSSTextToken[] ret = new CSSTextToken[list.size()]; - list.toArray(ret); - return ret; - } - - /** - * - */ - public String get(ICSS2Properties properties) { - String str = null; - Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION)); - if (obj != null) { - PropCMProperty propX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X); - PropCMProperty propY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y); - if (obj instanceof ICSSValueList) { - ICSSValueList list = (ICSSValueList) obj; - ICSSValue value = (ICSSValue) list.item(0); - if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; - if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { - // check not top or bottom - if (!propX.canHave(prim.getStringValue()) && propY.canHave(prim.getStringValue())) { - // case order is vertical -> horizontal - value = (ICSSValue) list.item(1); - } - } - } - str = value.getCSSValueText(); - } - else if (obj instanceof ICSSValue) { - str = ((ICSSValue) obj).getCSSValueText(); - if (str.equalsIgnoreCase(IValID.V_BOTTOM) || str.equalsIgnoreCase(IValID.V_TOP)) - str = "";//$NON-NLS-1$ - } - else { - str = obj.toString(); - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, str); - CSSTextToken[] tokens = parser.getTokens(); - - tokens = correctMeaningToken(tokens); - if (tokens.length == 0) - str = "";//$NON-NLS-1$ - else if (tokens.length == 1 && (tokens[0].image.equalsIgnoreCase(IValID.V_BOTTOM) || tokens[0].image.equalsIgnoreCase(IValID.V_TOP))) - str = "";//$NON-NLS-1$ - else - str = tokens[0].image; - } - } - return (str != null) ? str : "";//$NON-NLS-1$ - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String newValue = null; - String valH = value; - String valV = properties.getBackgroundPositionY(); - if (valV == null || valV.length() == 0) - newValue = valH; - else if (valH == null || valH.length() == 0) { - Collection valX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues(); - Collection valY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues(); - PropCMUtil.minus(valY, valX); - Iterator it = valY.iterator(); - while (it.hasNext()) { - Object obj = it.next(); - if (obj.toString().equals(valV.toLowerCase())) { - // need not compensate for ... - newValue = valV; - break; - } - } - // compensate for Horizontal value - if (newValue == null) { - // check valV is length or not - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, valV.trim()); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens != null && tokens.length > 0 && tokens[0].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - newValue = IValID.V_LEFT + " " + valV;//$NON-NLS-1$ - } - else - newValue = "0% " + valV;//$NON-NLS-1$ - } - } - else - newValue = valH + " " + valV;//$NON-NLS-1$ - properties.setBackgroundPosition(newValue); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionYSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionYSubStyleAdapter.java deleted file mode 100644 index bb9e9a7d6e..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundPositionYSubStyleAdapter.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.contentmodel.IValID; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMUtil; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValueList; -import org.w3c.dom.css.CSSPrimitiveValue; -import org.w3c.dom.css.CSSValue; - - -/** - * for vertical value of 'background-position' - */ -public class BackgroundPositionYSubStyleAdapter implements ISubPropertyAdapter { - - /** - * - */ - public BackgroundPositionYSubStyleAdapter() { - super(); - } - - /** - * - */ - protected CSSTextToken[] correctMeaningToken(CSSTextToken[] src) { - java.util.ArrayList list = new java.util.ArrayList(); - for (int i = 0; i < src.length; i++) { - if (src[i].kind != CSSRegionContexts.CSS_S && src[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S && src[i].kind != CSSRegionContexts.CSS_COMMENT) - list.add(src[i]); - } - CSSTextToken[] ret = new CSSTextToken[list.size()]; - list.toArray(ret); - return ret; - } - - /** - * - */ - public String get(ICSS2Properties properties) { - String str = null; - Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION)); - if (obj != null) { - PropCMProperty propX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X); - PropCMProperty propY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y); - if (obj instanceof ICSSValueList) { - ICSSValueList list = (ICSSValueList) obj; - int index = 1; - ICSSValue value = (ICSSValue) list.item(0); - if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; - if (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { - // check not top or bottom - if (!propX.canHave(prim.getStringValue()) && propY.canHave(prim.getStringValue())) { - // case order is vertical -> horizontal - index = 0; - } - } - } - str = ((ICSSValue) list.item(index)).getCSSValueText(); - } - else if (obj instanceof ICSSValue) { - str = ((ICSSValue) obj).getCSSValueText(); - if (!str.equalsIgnoreCase(IValID.V_BOTTOM) && !str.equalsIgnoreCase(IValID.V_TOP)) - str = "";//$NON-NLS-1$ - } - else { - str = obj.toString(); - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, str); - CSSTextToken[] tokens = parser.getTokens(); - - tokens = correctMeaningToken(tokens); - if (tokens.length == 1 && (tokens[0].image.equalsIgnoreCase(IValID.V_BOTTOM) || tokens[0].image.equalsIgnoreCase(IValID.V_TOP))) - str = tokens[0].image; - else if (tokens.length > 1) - str = tokens[1].image; - else - str = "";//$NON-NLS-1$ - } - } - return (str != null) ? str : "";//$NON-NLS-1$ - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String newValue = null; - String valH = properties.getBackgroundPositionX(); - String valV = value; - if (valH != null && (valH.trim().equals("0%") /* default value */|| //$NON-NLS-1$ - valH.trim().equalsIgnoreCase(IValID.V_LEFT) /* - * another - * default - * value - */)) - valH = null; - if (valV == null || valV.length() == 0) - newValue = valH; - else if (valH == null || valH.length() == 0) { - Collection valX = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues(); - Collection valY = PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues(); - PropCMUtil.minus(valY, valX); - Iterator it = valY.iterator(); - while (it.hasNext()) { - Object obj = it.next(); - if (obj.toString().equals(valV.toLowerCase())) { - // need not compensate for ... - newValue = valV; - break; - } - } - // compensate for Horizontal value - if (newValue == null) { - // check valV is length or not - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, valV.trim()); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens != null && tokens.length > 0 && tokens[0].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - newValue = IValID.V_LEFT + " " + valV;//$NON-NLS-1$ - } - else - newValue = "0% " + valV;//$NON-NLS-1$ - } - } - else - newValue = valH + " " + valV;//$NON-NLS-1$ - properties.setBackgroundPosition(newValue); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundShorthandAdapter.java deleted file mode 100644 index d9b5fe6d54..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BackgroundShorthandAdapter.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'background' property 'background' will be expanded to - * 'background-attachment', 'background-color', 'background-image', - * 'background-position', 'background-repeat', - */ -public class BackgroundShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BackgroundShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", image = "", repeat = "", attach = "", pos = "";//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR); - PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE); - PropCMProperty propRepeat = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT); - PropCMProperty propAttach = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT); - PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - else if (propImage.canHave(tokens[i].image)) - image = tokens[i].image; - else if (propRepeat.canHave(tokens[i].image)) - repeat = tokens[i].image; - else if (propAttach.canHave(tokens[i].image)) - attach = tokens[i].image; - else if (propPos.canHave(tokens[i].image)) { - if (pos == null || pos.length() <= 0) - pos = tokens[i].image; - else - pos = pos + " " + tokens[i].image;//$NON-NLS-1$ - } - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) { - if (pos == null || pos.length() <= 0) - pos = tokens[i].image; - else - pos = pos + " " + tokens[i].image;//$NON-NLS-1$ - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) { - image = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propImage.getName(), image); - dest.set(propRepeat.getName(), repeat); - dest.set(propAttach.getName(), attach); - dest.set(propPos.getName(), pos); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, image = null, repeat = null, attach = null, pos = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR); - PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE); - PropCMProperty propRepeat = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT); - PropCMProperty propAttach = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT); - PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - else if (propImage.canHave(tokens[i].image)) - image = tokens[i].image; - else if (propRepeat.canHave(tokens[i].image)) - repeat = tokens[i].image; - else if (propAttach.canHave(tokens[i].image)) - attach = tokens[i].image; - else if (propPos.canHave(tokens[i].image)) { - if (pos == null) - pos = tokens[i].image; - else - pos = pos + " " + tokens[i].image;//$NON-NLS-1$ - } - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) { - if (pos == null) - pos = tokens[i].image; - else - pos = pos + " " + tokens[i].image;//$NON-NLS-1$ - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) { - image = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propImage == propDest) - return image; - else if (propRepeat == propDest) - return repeat; - else if (propAttach == propDest) - return attach; - else if (propPos == propDest) - return pos; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderBottomShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderBottomShorthandAdapter.java deleted file mode 100644 index 09b505eaad..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderBottomShorthandAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-bottom' property 'border-bottom' will be expanded to - * 'border-bottom-color', 'border-bottom-style', 'border-bottom-width', - */ -public class BorderBottomShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderBottomShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propStyle.getName(), style); - dest.set(propWidth.getName(), width); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, style = null, width = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propStyle == propDest) - return style; - else if (propWidth == propDest) - return width; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderColorShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderColorShorthandAdapter.java deleted file mode 100644 index e314007295..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderColorShorthandAdapter.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-color' property 'border-color' will be expanded to - * 'border-top-color', 'border-right-color', 'border-bottom-color', - * 'border-left-color', - */ -public class BorderColorShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderColorShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) - idents[j++] = tokens[i].image; - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - idents[j++] = buf.toString(); - } - if (j == 4) - break; - } - - String[] dests = new String[4]; - if (j == 0) - return true; - else if (j == 1) { - dests[0] = dests[1] = dests[2] = dests[3] = idents[0]; - } - else if (j == 2) { - dests[0] = dests[2] = idents[0]; - dests[1] = dests[3] = idents[1]; - } - else if (j == 3) { - dests[0] = idents[0]; - dests[1] = dests[3] = idents[1]; - dests[2] = idents[2]; - } - else { - for (int k = 0; k < 4; k++) - dests[k] = idents[k]; - } - dest.set(PropCMProperty.P_BORDER_TOP_COLOR, dests[0]); - dest.set(PropCMProperty.P_BORDER_RIGHT_COLOR, dests[1]); - dest.set(PropCMProperty.P_BORDER_BOTTOM_COLOR, dests[2]); - dest.set(PropCMProperty.P_BORDER_LEFT_COLOR, dests[3]); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) - idents[j++] = tokens[i].image; - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - idents[j++] = buf.toString(); - } - if (j == 4) - break; - } - - if (j == 0) - return null; - else if (j == 1) - return idents[0]; - else if (j == 2) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR) - return idents[0]; - else - return idents[1]; - } - else if (j == 3) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR) - return idents[2]; - else - return idents[1]; - } - else { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_COLOR) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_COLOR) - return idents[1]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_COLOR) - return idents[2]; - else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_COLOR) - return idents[3]; - else - return null; - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderLeftShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderLeftShorthandAdapter.java deleted file mode 100644 index cbc793082b..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderLeftShorthandAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-left' property 'border-left' will be expanded to - * 'border-left-color', 'border-left-style', 'border-left-width', - */ -public class BorderLeftShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderLeftShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propStyle.getName(), style); - dest.set(propWidth.getName(), width); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, style = null, width = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propStyle == propDest) - return style; - else if (propWidth == propDest) - return width; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderRightShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderRightShorthandAdapter.java deleted file mode 100644 index d74e440bb5..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderRightShorthandAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-right' property 'border-right' will be expanded to - * 'border-right-color', 'border-right-style', 'border-right-width', - */ -public class BorderRightShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderRightShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propStyle.getName(), style); - dest.set(propWidth.getName(), width); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, style = null, width = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propStyle == propDest) - return style; - else if (propWidth == propDest) - return width; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderShorthandAdapter.java deleted file mode 100644 index 6da333361b..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderShorthandAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border' property 'border' will be expanded to 'border-color', - * 'border-style', 'border-width', - */ -public class BorderShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propStyle.getName(), style); - dest.set(propWidth.getName(), width); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, style = null, width = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propStyle == propDest) - return style; - else if (propWidth == propDest) - return width; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderStyleShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderStyleShorthandAdapter.java deleted file mode 100644 index b5fb9629d4..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderStyleShorthandAdapter.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-style' property 'border-style' will be expanded to - * 'border-top-style', 'border-right-style', 'border-bottom-style', - * 'border-left-style', - */ -public class BorderStyleShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderStyleShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - String[] dests = new String[4]; - if (j == 0) - return true; - else if (j == 1) { - dests[0] = dests[1] = dests[2] = dests[3] = idents[0]; - } - else if (j == 2) { - dests[0] = dests[2] = idents[0]; - dests[1] = dests[3] = idents[1]; - } - else if (j == 3) { - dests[0] = idents[0]; - dests[1] = dests[3] = idents[1]; - dests[2] = idents[2]; - } - else { - for (int k = 0; k < 4; k++) - dests[k] = idents[k]; - } - dest.set(PropCMProperty.P_BORDER_TOP_STYLE, dests[0]); - dest.set(PropCMProperty.P_BORDER_RIGHT_STYLE, dests[1]); - dest.set(PropCMProperty.P_BORDER_BOTTOM_STYLE, dests[2]); - dest.set(PropCMProperty.P_BORDER_LEFT_STYLE, dests[3]); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - if (j == 0) - return null; - else if (j == 1) - return idents[0]; - else if (j == 2) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE) - return idents[0]; - else - return idents[1]; - } - else if (j == 3) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE) - return idents[2]; - else - return idents[1]; - } - else { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_STYLE) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_STYLE) - return idents[1]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_STYLE) - return idents[2]; - else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_STYLE) - return idents[3]; - else - return null; - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderTopShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderTopShorthandAdapter.java deleted file mode 100644 index a728399aad..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderTopShorthandAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-top' property 'border-top' will be expanded to - * 'border-top-color', 'border-top-style', 'border-top-width', - */ -public class BorderTopShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderTopShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String color = "", style = "", width = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - dest.set(propColor.getName(), color); - dest.set(propStyle.getName(), style); - dest.set(propWidth.getName(), width); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String color = null, style = null, width = null; - PropCMProperty propColor = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE); - PropCMProperty propWidth = PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propWidth.canHave(tokens[i].image)) - width = tokens[i].image; - else if (propColor.canHave(tokens[i].image)) - color = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER) { - width = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_HASH) { - color = tokens[i].image; - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) { - StringBuffer buf = new StringBuffer(); - while (i < tokens.length) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) { - i++; - continue; - } - buf.append(tokens[i].image); - if (tokens[i++].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) - break; - } - i--; - color = buf.toString(); - } - } - - if (propColor == propDest) - return color; - else if (propStyle == propDest) - return style; - else if (propWidth == propDest) - return width; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderWidthShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderWidthShorthandAdapter.java deleted file mode 100644 index cda09e6fc7..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/BorderWidthShorthandAdapter.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'border-width' property 'border-width' will be expanded to - * 'border-top-width', 'border-right-width', 'border-bottom-width', - * 'border-left-width', - */ -public class BorderWidthShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public BorderWidthShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - String[] dests = new String[4]; - if (j == 0) - return true; - else if (j == 1) { - dests[0] = dests[1] = dests[2] = dests[3] = idents[0]; - } - else if (j == 2) { - dests[0] = dests[2] = idents[0]; - dests[1] = dests[3] = idents[1]; - } - else if (j == 3) { - dests[0] = idents[0]; - dests[1] = dests[3] = idents[1]; - dests[2] = idents[2]; - } - else { - for (int k = 0; k < 4; k++) - dests[k] = idents[k]; - } - dest.set(PropCMProperty.P_BORDER_TOP_WIDTH, dests[0]); - dest.set(PropCMProperty.P_BORDER_RIGHT_WIDTH, dests[1]); - dest.set(PropCMProperty.P_BORDER_BOTTOM_WIDTH, dests[2]); - dest.set(PropCMProperty.P_BORDER_LEFT_WIDTH, dests[3]); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - if (j == 0) - return null; - else if (j == 1) - return idents[0]; - else if (j == 2) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH || propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH) - return idents[0]; - else - return idents[1]; - } - else if (j == 3) { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH) - return idents[2]; - else - return idents[1]; - } - else { - if (propDest.getName() == PropCMProperty.P_BORDER_TOP_WIDTH) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_BORDER_RIGHT_WIDTH) - return idents[1]; - else if (propDest.getName() == PropCMProperty.P_BORDER_BOTTOM_WIDTH) - return idents[2]; - else if (propDest.getName() == PropCMProperty.P_BORDER_LEFT_WIDTH) - return idents[3]; - else - return null; - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/CSSPropertyContext.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/CSSPropertyContext.java deleted file mode 100644 index 1b40706a19..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/CSSPropertyContext.java +++ /dev/null @@ -1,2997 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue; -import org.w3c.dom.css.CSSValue; - - -/** - * - */ -public class CSSPropertyContext implements ICSS2Properties { - - protected Hashtable fProperties = new Hashtable(); - HashSet fModified = null; - private static java.util.Hashtable subPropertyAdapters; - private static java.util.Hashtable shorthandAdapters; - - /** - * - */ - public CSSPropertyContext() { - super(); - initShorthandAdapters(); - initSubPropertyAdapters(); - } - - /** - * - */ - public CSSPropertyContext(ICSSStyleDeclaration decl) { - super(); - initShorthandAdapters(); - initSubPropertyAdapters(); - initialize(decl); - } - - /** - * This function exports all property/value pairs to 'decl' declaration - */ - public void applyFull(ICSSStyleDeclaration decl) { - if (decl == null) - return; - Enumeration keys = fProperties.keys(); - while (keys.hasMoreElements()) { - Object key = keys.nextElement(); - Object val = fProperties.get(key); - String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : val.toString(); - - if (value == null || value.length() <= 0) - decl.removeProperty(key.toString()); - else - decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$ - } - } - - /** - * This function exports modified property/value pairs to 'decl' - * declaration - */ - public void applyModified(ICSSStyleDeclaration decl) { - if (decl == null || fModified == null) - return; - Iterator it = fModified.iterator(); - while (it.hasNext()) { - Object key = it.next(); - Object val = fProperties.get(key); - String value = (val instanceof ICSSValue) ? ((ICSSValue) val).getCSSValueText() : ((val != null) ? val.toString() : null); - - if (value == null || value.length() <= 0) - decl.removeProperty(key.toString()); - else - decl.setProperty(key.toString(), value.trim(), (val instanceof ValueData && ((ValueData) val).important) ? "!important" : "");//$NON-NLS-2$//$NON-NLS-1$ - } - } - - /** - * create clone of this context - */ - public Object clone() { - CSSPropertyContext clone = new CSSPropertyContext(); - if (this.fModified != null) - clone.fModified = (HashSet) this.fModified.clone(); - else - clone.fModified = null; - clone.fProperties = (Hashtable) this.fProperties.clone(); - return clone; - } - - /** - * This function expands a short-hand property's value to each leaf - * property's value and set them to 'foreign' - * - * For example, given [prop=border-top, value="solid 1px yellow"] will be - * expanded to [border-top-color=yellow, border-top-style=solid, - * border-top-width=1px] and they are stored to 'foreign' context. - * - * Note that recursively shorthanded property like 'border' will be - * expanded to all descendant leaf properties like - * 'border-[top/right/bottom/left]-[color/style/width]' - * - * @param prop - * org.eclipse.wst.css.core.contentmodel.PropCMProperty - * @param value - * java.lang.String - * @param foreign - * org.eclipse.wst.css.core.util.declaration.CSSPropertyContext - */ - protected static void expandToLeaf(PropCMProperty prop, String value, CSSPropertyContext foreign) { - // expand shorthand property - if (value != null && value.trim().length() > 0) { - IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(prop); - if (adapter != null) { - adapter.expand(value, foreign); - foreign.set(prop.getName(), "");//$NON-NLS-1$ - for (int i = 0; i < prop.getNumChild(); i++) { - Object obj = prop.getChildAt(i); - if (obj instanceof PropCMProperty && !(obj instanceof PropCMSubProperty)) { - PropCMProperty expandedProp = (PropCMProperty) obj; - value = foreign.get(expandedProp.getName()); - expandToLeaf(expandedProp, value, foreign); - } - } - } - else if (!value.equals(foreign.get(prop.getName()))) { - foreign.set(prop.getName(), value); - } - } - } - - /** - * This function returns value of 'prop'. Querying value mechanism checks - * short-hand properties. - * - * For example, given "background=fixed white" is set in this insatnce and - * param "prop=background-color", the return value will be "white". - * - */ - public java.lang.String get(org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty prop) { - if (prop instanceof PropCMSubProperty) { - ISubPropertyAdapter adapter = (ISubPropertyAdapter) subPropertyAdapters.get(prop.getName()); - if (adapter != null) - return adapter.get(this); - } - String str = get(prop.getName()); - if ((str == null || str.length() == 0) && prop.getShorthandContainerCount() > 0) { - // get expanded property - for (int i = 0; i < prop.getShorthandContainerCount(); i++) { - PropCMProperty propParent = prop.shorthandContainerAt(i); - String strParent = get(propParent); - if (strParent != null && strParent.trim().length() > 0) { - IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(propParent); - if (adapter != null) { - String extractedValue = adapter.extract(strParent, prop); - return (extractedValue != null) ? extractedValue : "";//$NON-NLS-1$ - } - } - } - } - return str; - } - - /** - * This function returns value of 'prop'. Querying value mechanism does - * not care shorthand properties. - */ - protected String get(String propName) { - String str = null; - Object obj = fProperties.get(propName); - if (obj != null) { - if (obj instanceof ICSSValue) - str = ((ICSSValue) obj).getCSSValueText(); - else - str = obj.toString(); - } - return (str != null) ? str : "";//$NON-NLS-1$ - } - - /** - * See the azimuth property definition in CSS2. - * - * @exception org.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getAzimuth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_AZIMUTH)); - } - - /** - * See the background property definition in CSS2. - * - * @exception org.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackground() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG)); - } - - /** - * See the background-attachment property definition in CSS2. - * - * @exception org.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackgroundAttachment() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT)); - } - - /** - * See the background-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackgroundColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR)); - } - - /** - * See the background-image property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackgroundImage() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE)); - } - - /** - * See the background-position property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackgroundPosition() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION)); - } - - /** - * - */ - public java.lang.String getBackgroundPositionX() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X)); - /* - * String str = null; Object obj = - * fProperties.get(PropCMProperty.P_BG_POSITION); if (obj != null) { - * PropCMProperty propX = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X); - * PropCMProperty propY = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y); - * if (obj instanceof ICSSValueList) { ICSSValueList list = - * (ICSSValueList) obj; ICSSValue value = (ICSSValue) list.item(0); if - * (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - * ICSSPrimitiveValue prim = (ICSSPrimitiveValue) value; if - * (prim.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { // check - * not top or bottom if (!propX.canHave(prim.getStringValue()) && - * propY.canHave(prim.getStringValue())) { // case order is vertical -> - * horizontal value = (ICSSValue) list.item(1); } } } str = - * value.getCSSValueText(); } else if (obj instanceof ICSSValue) { str = - * ((ICSSValue)obj).getCSSValueText(); } else str = obj.toString(); } - * return (str != null) ? str : ""; - */ - } - - /** - * - */ - public java.lang.String getBackgroundPositionY() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y)); - /* - * String str = null; Object obj = - * fProperties.get(PropCMProperty.P_BG_POSITION); if (obj != null) { - * PropCMProperty propX = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X); - * PropCMProperty propY = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y); - * if (obj instanceof ICSSValueList) { ICSSValueList list = - * (ICSSValueList) obj; int index = 1; ICSSValue value = (ICSSValue) - * list.item(0); if (value.getCssValueType() == - * CSSValue.CSS_PRIMITIVE_VALUE) { ICSSPrimitiveValue prim = - * (ICSSPrimitiveValue) value; if (prim.getPrimitiveType() == - * CSSPrimitiveValue.CSS_IDENT) { // check not top or bottom if - * (!propX.canHave(prim.getStringValue()) && - * propY.canHave(prim.getStringValue())) { // case order is vertical -> - * horizontal index = 0; } } } str = - * ((ICSSValue)list.item(index)).getCSSValueText(); } else if (obj - * instanceof ICSSValue) { // do nothing --- value is null } else str = - * obj.toString(); } return (str != null) ? str : ""; - */ - } - - /** - * See the background-repeat property definition in CSS2. - * - * @exception org.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBackgroundRepeat() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT)); - } - - /** - * See the border property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorder() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER)); - } - - /** - * See the border-bottom property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderBottom() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM)); - } - - /** - * See the border-bottom-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderBottomColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR)); - } - - /** - * See the border-bottom-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderBottomStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE)); - } - - /** - * See the border-bottom-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderBottomWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH)); - } - - /** - * See the border-collapse property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderCollapse() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLLAPSE)); - } - - /** - * See the border-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR)); - } - - /** - * See the border-left property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderLeft() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT)); - } - - /** - * See the border-left-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderLeftColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR)); - } - - /** - * See the border-left-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderLeftStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE)); - } - - /** - * See the border-left-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderLeftWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH)); - } - - /** - * See the border-right property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderRight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT)); - } - - /** - * See the border-right-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderRightColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR)); - } - - /** - * See the border-right-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderRightStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE)); - } - - /** - * See the border-right-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderRightWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH)); - } - - /** - * See the border-spacing property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderSpacing() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_SPACING)); - } - - /** - * See the border-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE)); - } - - /** - * See the border-top property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderTop() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP)); - } - - /** - * See the border-top-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderTopColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR)); - } - - /** - * See the border-top-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderTopStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE)); - } - - /** - * See the border-top-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderTopWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH)); - } - - /** - * See the border-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBorderWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH)); - } - - /** - * See the bottom property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getBottom() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_BOTTOM)); - } - - /** - * See the caption-side property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCaptionSide() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CAPTION_SIDE)); - } - - /** - * See the clear property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getClear() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLEAR)); - } - - /** - * See the clip property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getClip() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP)); - } - - /** - * - */ - public String getClipBottom() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM)); - } - - /** - * - */ - public String getClipLeft() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT)); - } - - /** - * - */ - public String getClipRight() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT)); - } - - /** - * - */ - public String getClipTop() { - return get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP)); - } - - /** - * See the color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COLOR)); - } - - /** - * See the content property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getContent() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CONTENT)); - } - - /** - * See the counter-increment property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCounterIncrement() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_INCREMENT)); - } - - /** - * See the counter-reset property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCounterReset() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_RESET)); - } - - /** - * See the float property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCssFloat() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FLOAT)); - } - - /** - * See the cue property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCue() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE)); - } - - /** - * See the cue-after property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCueAfter() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER)); - } - - /** - * See the cue-before property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCueBefore() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE)); - } - - /** - * See the cursor property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getCursor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_CURSOR)); - } - - /** - * See the direction property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getDirection() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_DIRECTION)); - } - - /** - * See the display property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getDisplay() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_DISPLAY)); - } - - /** - * See the elevation property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getElevation() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_ELEVATION)); - } - - /** - * See the empty-cells property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getEmptyCells() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_EMPTY_CELLS)); - } - - /** - * See the font property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFont() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT)); - } - - /** - * See the font-family property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontFamily() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY)); - } - - /** - * See the font-size property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontSize() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE)); - } - - /** - * See the font-size-adjust property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontSizeAdjust() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE_ADJUST)); - } - - /** - * See the font-stretch property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontStretch() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STRETCH)); - } - - /** - * See the font-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE)); - } - - /** - * See the font-variant property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontVariant() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT)); - } - - /** - * See the font-weight property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getFontWeight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT)); - } - - /** - * See the height property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getHeight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_HEIGHT)); - } - - /** - * See the left property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getLeft() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LEFT)); - } - - /** - * See the letter-spacing property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getLetterSpacing() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LETTER_SPACING)); - } - - /** - * See the line-height property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getLineHeight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT)); - } - - /** - * See the list-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getListStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE)); - } - - /** - * See the list-style-image property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getListStyleImage() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE)); - } - - /** - * See the list-style-position property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getListStylePosition() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION)); - } - - /** - * See the list-style-type property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getListStyleType() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE)); - } - - /** - * See the margin property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMargin() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN)); - } - - /** - * See the margin-bottom property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarginBottom() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM)); - } - - /** - * See the margin-left property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarginLeft() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT)); - } - - /** - * See the margin-right property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarginRight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT)); - } - - /** - * See the margin-top property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarginTop() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP)); - } - - /** - * See the marker-offset property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarkerOffset() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKER_OFFSET)); - } - - /** - * See the marks property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMarks() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKS)); - } - - /** - * See the max-height property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMaxHeight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_HEIGHT)); - } - - /** - * See the max-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMaxWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_WIDTH)); - } - - /** - * See the min-height property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMinHeight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_HEIGHT)); - } - - /** - * See the min-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getMinWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_WIDTH)); - } - - /** - * See the orphans property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOrphans() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_ORPHANS)); - } - - /** - * See the outline property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOutline() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE)); - } - - /** - * See the outline-color property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOutlineColor() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR)); - } - - /** - * See the outline-style property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOutlineStyle() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE)); - } - - /** - * See the outline-width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOutlineWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH)); - } - - /** - * See the overflow property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getOverflow() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_OVERFLOW)); - } - - /** - * See the padding property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPadding() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING)); - } - - /** - * See the padding-bottom property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPaddingBottom() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM)); - } - - /** - * See the padding-left property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPaddingLeft() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT)); - } - - /** - * See the padding-right property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPaddingRight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT)); - } - - /** - * See the padding-top property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPaddingTop() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP)); - } - - /** - * See the page property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPage() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE)); - } - - /** - * See the page-break-after property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPageBreakAfter() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_AFTER)); - } - - /** - * See the page-break-before property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPageBreakBefore() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_BEFORE)); - } - - /** - * See the page-break-inside property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPageBreakInside() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_INSIDE)); - } - - /** - * See the pause property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPause() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE)); - } - - /** - * See the pause-after property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPauseAfter() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_AFTER)); - } - - /** - * See the pause-before property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPauseBefore() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_BEFORE)); - } - - /** - * See the pitch property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPitch() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH)); - } - - /** - * See the pitch-range property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPitchRange() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH_RANGE)); - } - - /** - * See the play-during property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPlayDuring() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_PLAY_DURING)); - } - - /** - * See the position property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getPosition() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_POSITION)); - } - - /** - * See the quotes property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getQuotes() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_QUOTES)); - } - - /** - * See the richness property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getRichness() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_RICHNESS)); - } - - /** - * See the right property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getRight() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_RIGHT)); - } - - /** - * @return org.eclipse.wst.css.core.util.declaration.IShorthandAdapter - * @param org.eclipse.wst.css.core.contentmodel.PropCMProperty - */ - public static IShorthandAdapter getShorthandAdapter(PropCMProperty prop) { - return (IShorthandAdapter) shorthandAdapters.get(prop); - } - - /** - * See the size property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSize() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SIZE)); - } - - /** - * See the speak property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSpeak() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK)); - } - - /** - * See the speak-header property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSpeakHeader() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_HEADER)); - } - - /** - * See the speak-numeral property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSpeakNumeral() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_NUMERAL)); - } - - /** - * See the speak-punctuation property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSpeakPunctuation() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_PUNCTUATION)); - } - - /** - * See the speech-rate property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getSpeechRate() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEECH_RATE)); - } - - /** - * See the stress property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getStress() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_STRESS)); - } - - /** - * See the table-layout property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTableLayout() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TABLE_LAYOUT)); - } - - /** - * See the text-align property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTextAlign() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_ALIGN)); - } - - /** - * See the text-decoration property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTextDecoration() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_DECORATION)); - } - - /** - * See the text-indent property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTextIndent() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_INDENT)); - } - - /** - * See the text-shadow property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTextShadow() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_SHADOW)); - } - - /** - * See the text-transform property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTextTransform() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_TRANSFORM)); - } - - /** - * See the top property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getTop() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_TOP)); - } - - /** - * See the unicode-bidi property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getUnicodeBidi() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_UNICODE_BIDI)); - } - - /** - * See the vertical-align property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getVerticalAlign() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VERTICAL_ALIGN)); - } - - /** - * See the visibility property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getVisibility() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VISIBILITY)); - } - - /** - * See the voice-family property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getVoiceFamily() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VOICE_FAMILY)); - } - - /** - * See the volume property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getVolume() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_VOLUME)); - } - - /** - * See the white-space property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getWhiteSpace() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WHITE_SPACE)); - } - - /** - * See the widows property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getWidows() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDOWS)); - } - - /** - * See the width property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getWidth() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDTH)); - } - - /** - * See the word-spacing property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getWordSpacing() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_WORD_SPACING)); - } - - /** - * See the z-index property definition in CSS2. - * - * @exceptionorg.w3c.dom.DOMException - * SYNTAX_ERR: Raised if the new value has a syntax error - * and is unparsable. <br> - * NO_MODIFICATION_ALLOWED_ERR: Raised if this property is - * readonly. - */ - public String getZIndex() { - return get(PropCMProperty.getInstanceOf(PropCMProperty.P_Z_INDEX)); - } - - /** - * - */ - public void initialize(ICSSStyleDeclaration decl) { - fProperties.clear(); - if (fModified != null) - fModified.clear(); - if (decl == null) - return; - - int nProperties = decl.getLength(); - for (int i = 0; i < nProperties; i++) { - String propName = decl.item(i); - if (propName != null) { - String propN = propName.trim().toLowerCase(); - if (propN.length() != 0) { - CSSValue val = decl.getPropertyCSSValue(propName); - if (val != null) - fProperties.put(propN, val); - } - } - } - } - - /** - * - */ - static void initShorthandAdapters() { - if (shorthandAdapters == null) { - shorthandAdapters = new Hashtable(); - // register - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BG), new BackgroundShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER), new BorderShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR), new BorderColorShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE), new BorderStyleShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH), new BorderWidthShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP), new BorderTopShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT), new BorderRightShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM), new BorderBottomShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT), new BorderLeftShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT), new FontShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE), new ListStyleShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN), new MarginShorthandAdapter()); - shorthandAdapters.put(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING), new PaddingShorthandAdapter()); - - } - } - - /** - * - */ - static void initSubPropertyAdapters() { - if (subPropertyAdapters == null) { - subPropertyAdapters = new Hashtable(); - - // register - subPropertyAdapters.put(PropCMSubProperty.PSUB_BG_POSITION_X, new BackgroundPositionXSubStyleAdapter()); - subPropertyAdapters.put(PropCMSubProperty.PSUB_BG_POSITION_Y, new BackgroundPositionYSubStyleAdapter()); - subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_TOP, new ClipTopSubStyleAdapter()); - subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_RIGHT, new ClipRightSubStyleAdapter()); - subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_BOTTOM, new ClipBottomSubStyleAdapter()); - subPropertyAdapters.put(PropCMSubProperty.PSUB_CLIP_LEFT, new ClipLeftSubStyleAdapter()); - } - } - - /** - * - */ - public boolean isModified() { - return (fModified != null && fModified.size() != 0); - } - - /** - * - */ - public Enumeration properties() { - return fProperties.keys(); - } - - /** - * - */ - public Iterator propertiesModified() { - if (fModified != null) { - return ((Collection) fModified.clone()).iterator(); - } - else - return new Iterator() { - public boolean hasNext() { - return false; - } - - public Object next() { - return null; - } - - public void remove() { - } - }; - } - - /** - * This function expands the value of shorthand 'prop' to 'foreign' - * context. Note that if this has parent shorthand properties of 'prop', - * they are all expanded to 'foreign' context. - */ - protected void recursiveExtract(PropCMProperty prop, CSSPropertyContext foreign) { - // expand shorthand property - for (int i = 0; i < prop.getShorthandContainerCount(); i++) { - recursiveExtract(prop.shorthandContainerAt(i), foreign); - } - String str = get(prop.getName()); - if (str == null || str.trim().length() == 0) - str = foreign.get(prop.getName()); - if (str != null && str.trim().length() > 0) { - IShorthandAdapter adapter = (IShorthandAdapter) shorthandAdapters.get(prop); - if (adapter != null) { - adapter.expand(str, foreign); - foreign.set(prop.getName(), "");//$NON-NLS-1$ - } - } - } - - /** - * - */ - protected void removeDescendants(PropCMProperty prop) { - if (prop.isShorthand()) { - // remove properties - int n = prop.getNumChild(); - for (int i = 0; i < n; i++) { - Object obj = prop.getChildAt(i); - if (obj instanceof PropCMProperty) { - removeDescendants((PropCMProperty) obj); - - String str = get(obj.toString()); - if (str != null && str.length() > 0) - set(obj.toString(), "");//$NON-NLS-1$ - } - } - } - } - - /** - * - */ - public void resetModified() { - if (fModified != null) - fModified.clear(); - } - - /** - * This function sets the pair of 'prop'/'value'. If shorthand properties - * related to 'prop' are already defined, they will be expanded to avoid - * property confliction. If descendant properties of 'prop' are already - * defined, they will be removed to avoid property confliction. - * - */ - public void set(org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty prop, java.lang.String value) throws org.w3c.dom.DOMException { - if (prop instanceof PropCMSubProperty) { - ISubPropertyAdapter adapter = (ISubPropertyAdapter) subPropertyAdapters.get(prop.getName()); - if (adapter != null) { - adapter.set(this, value); - return; - } - } - if (prop.getShorthandContainerCount() > 0) { - // expand shorthand property - CSSPropertyContext context = new CSSPropertyContext(); - for (int i = 0; i < prop.getShorthandContainerCount(); i++) { - recursiveExtract(prop.shorthandContainerAt(i), context); - } - Enumeration properties = context.properties(); - while (properties.hasMoreElements()) { - String propForeign = properties.nextElement().toString(); - set(propForeign, context.get(propForeign)); - } - } - - removeDescendants(prop); - - set(prop.getName(), value); - } - - /** - * This function sets the pair of 'propName'/'value' regardless of its - * shorthand properties. - */ - protected void set(String propName, String value) throws org.w3c.dom.DOMException { - String key = propName; - if (value == null) - fProperties.remove(key); - else - fProperties.put(key, value); - if (fModified == null) - fModified = new HashSet(); - fModified.add(key); - } - - /** - * - */ - public void setAzimuth(String azimuth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_AZIMUTH), azimuth); - } - - /** - * - */ - public void setBackground(String background) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG), background); - } - - /** - * - */ - public void setBackgroundAttachment(String backgroundAttachment) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_ATTACHMENT), backgroundAttachment); - } - - /** - * - */ - public void setBackgroundColor(String backgroundColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_COLOR), backgroundColor); - } - - /** - * - */ - public void setBackgroundImage(String backgroundImage) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_IMAGE), backgroundImage); - } - - /** - * - */ - public void setBackgroundPosition(String backgroundPosition) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_POSITION), backgroundPosition); - } - - /** - * - */ - public void setBackgroundPositionX(java.lang.String backgroundPositionX) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X), backgroundPositionX); - /* - * String newValue = null; String valH = backgroundPositionX; String - * valV = getBackgroundPositionY(); if (valV == null || - * valV.length()== 0) newValue = valH; else if (valH == null || - * valH.length() == 0) { Collection valX = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues(); - * Collection valY = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues(); - * PropCMUtil.minus(valY,valX); Iterator it = valY.iterator(); - * while(it.hasNext()) { Object obj = it.next(); if - * (obj.toString().equals(valV.toLowerCase())) { // need not - * compensate for ... newValue = valV; break; } } // compensate for - * Horizontal value if (newValue == null) newValue = "0% " + valV; } - * else newValue = valH + " " + valV; setBackgroundPosition(newValue); - */ - } - - /** - * - */ - public void setBackgroundPositionY(java.lang.String backgroundPositionY) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y), backgroundPositionY); - /* - * String newValue = null; String valH = getBackgroundPositionX(); - * String valV = backgroundPositionY; if (valV == null || - * valV.length()== 0) newValue = valH; else if (valH == null || - * valH.length() == 0) { Collection valX = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_X).getValues(); - * Collection valY = - * PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_BG_POSITION_Y).getValues(); - * PropCMUtil.minus(valY,valX); Iterator it = valY.iterator(); - * while(it.hasNext()) { Object obj = it.next(); if - * (obj.toString().equals(valV.toLowerCase())) { // need not - * compensate for ... newValue = valV; break; } } // compensate for - * Horizontal value if (newValue == null) newValue = "0% " + valV; } - * else newValue = valH + " " + valV; setBackgroundPosition(newValue); - */ - } - - /** - * - */ - public void setBackgroundRepeat(String backgroundRepeat) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BG_REPEAT), backgroundRepeat); - } - - /** - * - */ - public void setBorder(String border) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER), border); - } - - /** - * - */ - public void setBorderBottom(String borderBottom) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM), borderBottom); - } - - /** - * - */ - public void setBorderBottomColor(String borderBottomColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_COLOR), borderBottomColor); - } - - /** - * - */ - public void setBorderBottomStyle(String borderBottomStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_STYLE), borderBottomStyle); - } - - /** - * - */ - public void setBorderBottomWidth(String borderBottomWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_BOTTOM_WIDTH), borderBottomWidth); - } - - /** - * - */ - public void setBorderCollapse(String borderCollapse) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLLAPSE), borderCollapse); - } - - /** - * - */ - public void setBorderColor(String borderColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_COLOR), borderColor); - } - - /** - * - */ - public void setBorderLeft(String borderLeft) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT), borderLeft); - } - - /** - * - */ - public void setBorderLeftColor(String borderLeftColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_COLOR), borderLeftColor); - } - - /** - * - */ - public void setBorderLeftStyle(String borderLeftStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_STYLE), borderLeftStyle); - } - - /** - * - */ - public void setBorderLeftWidth(String borderLeftWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_LEFT_WIDTH), borderLeftWidth); - } - - /** - * - */ - public void setBorderRight(String borderRight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT), borderRight); - } - - /** - * - */ - public void setBorderRightColor(String borderRightColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_COLOR), borderRightColor); - } - - /** - * - */ - public void setBorderRightStyle(String borderRightStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_STYLE), borderRightStyle); - } - - /** - * - */ - public void setBorderRightWidth(String borderRightWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_RIGHT_WIDTH), borderRightWidth); - } - - /** - * - */ - public void setBorderSpacing(String borderSpacing) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_SPACING), borderSpacing); - } - - /** - * - */ - public void setBorderStyle(String borderStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_STYLE), borderStyle); - } - - /** - * - */ - public void setBorderTop(String borderTop) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP), borderTop); - } - - /** - * - */ - public void setBorderTopColor(String borderTopColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_COLOR), borderTopColor); - } - - /** - * - */ - public void setBorderTopStyle(String borderTopStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_STYLE), borderTopStyle); - } - - /** - * - */ - public void setBorderTopWidth(String borderTopWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_TOP_WIDTH), borderTopWidth); - } - - /** - * - */ - public void setBorderWidth(String borderWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BORDER_WIDTH), borderWidth); - } - - /** - * - */ - public void setBottom(String bottom) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_BOTTOM), bottom); - } - - /** - * - */ - public void setCaptionSide(String captionSide) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CAPTION_SIDE), captionSide); - } - - /** - * - */ - public void setClear(String clear) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLEAR), clear); - } - - /** - * - */ - public void setClip(String clip) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), clip); - } - - /** - * - */ - public void setClipBottom(java.lang.String clip) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM), clip); - } - - /** - * - */ - public void setClipLeft(java.lang.String clip) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT), clip); - } - - /** - * - */ - public void setClipRight(java.lang.String clip) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT), clip); - } - - /** - * - */ - public void setClipTop(java.lang.String clip) throws org.w3c.dom.DOMException { - set(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP), clip); - } - - /** - * - */ - public void setColor(String color) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_COLOR), color); - } - - /** - * - */ - public void setContent(String content) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CONTENT), content); - } - - /** - * - */ - public void setCounterIncrement(String counterIncrement) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_INCREMENT), counterIncrement); - } - - /** - * - */ - public void setCounterReset(String counterReset) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_COUNTER_RESET), counterReset); - } - - /** - * - */ - public void setCssFloat(String cssFloat) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FLOAT), cssFloat); - } - - /** - * - */ - public void setCue(String cue) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE), cue); - } - - /** - * - */ - public void setCueAfter(String cueAfter) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_AFTER), cueAfter); - } - - /** - * - */ - public void setCueBefore(String cueBefore) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CUE_BEFORE), cueBefore); - } - - /** - * - */ - public void setCursor(String cursor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_CURSOR), cursor); - } - - /** - * - */ - public void setDirection(String direction) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_DIRECTION), direction); - } - - /** - * - */ - public void setDisplay(String display) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_DISPLAY), display); - } - - /** - * - */ - public void setElevation(String elevation) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_ELEVATION), elevation); - } - - /** - * - */ - public void setEmptyCells(String emptyCells) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_EMPTY_CELLS), emptyCells); - } - - /** - * - */ - public void setFont(String font) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT), font); - } - - /** - * - */ - public void setFontFamily(String fontFamily) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY), fontFamily); - } - - /** - * - */ - public void setFontSize(String fontSize) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE), fontSize); - } - - /** - * - */ - public void setFontSizeAdjust(String fontSizeAdjust) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE_ADJUST), fontSizeAdjust); - } - - /** - * - */ - public void setFontStretch(String fontStretch) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STRETCH), fontStretch); - } - - /** - * - */ - public void setFontStyle(String fontStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE), fontStyle); - } - - /** - * - */ - public void setFontVariant(String fontVariant) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT), fontVariant); - } - - /** - * - */ - public void setFontWeight(String fontWeight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT), fontWeight); - } - - /** - * - */ - public void setHeight(String height) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_HEIGHT), height); - } - - /** - * - */ - public void setLeft(String left) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LEFT), left); - } - - /** - * - */ - public void setLetterSpacing(String letterSpacing) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LETTER_SPACING), letterSpacing); - } - - /** - * - */ - public void setLineHeight(String lineHeight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT), lineHeight); - } - - /** - * - */ - public void setListStyle(String listStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE), listStyle); - } - - /** - * - */ - public void setListStyleImage(String listStyleImage) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE), listStyleImage); - } - - /** - * - */ - public void setListStylePosition(String listStylePosition) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION), listStylePosition); - } - - /** - * - */ - public void setListStyleType(String listStyleType) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE), listStyleType); - } - - /** - * - */ - public void setMargin(String margin) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN), margin); - } - - /** - * - */ - public void setMarginBottom(String marginBottom) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_BOTTOM), marginBottom); - } - - /** - * - */ - public void setMarginLeft(String marginLeft) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_LEFT), marginLeft); - } - - /** - * - */ - public void setMarginRight(String marginRight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_RIGHT), marginRight); - } - - /** - * - */ - public void setMarginTop(String marginTop) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARGIN_TOP), marginTop); - } - - /** - * - */ - public void setMarkerOffset(String markerOffset) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKER_OFFSET), markerOffset); - } - - /** - * - */ - public void setMarks(String marks) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MARKS), marks); - } - - /** - * - */ - public void setMaxHeight(String maxHeight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_HEIGHT), maxHeight); - } - - /** - * - */ - public void setMaxWidth(String maxWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MAX_WIDTH), maxWidth); - } - - /** - * - */ - public void setMinHeight(String minHeight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_HEIGHT), minHeight); - } - - /** - * - */ - public void setMinWidth(String minWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_MIN_WIDTH), minWidth); - } - - /** - * - */ - public void setOrphans(String orphans) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_ORPHANS), orphans); - } - - /** - * - */ - public void setOutline(String outline) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE), outline); - } - - /** - * - */ - public void setOutlineColor(String outlineColor) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_COLOR), outlineColor); - } - - /** - * - */ - public void setOutlineStyle(String outlineStyle) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_STYLE), outlineStyle); - } - - /** - * - */ - public void setOutlineWidth(String outlineWidth) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_OUTLINE_WIDTH), outlineWidth); - } - - /** - * - */ - public void setOverflow(String overflow) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_OVERFLOW), overflow); - } - - /** - * - */ - public void setPadding(String padding) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING), padding); - } - - /** - * - */ - public void setPaddingBottom(String paddingBottom) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_BOTTOM), paddingBottom); - } - - /** - * - */ - public void setPaddingLeft(String paddingLeft) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_LEFT), paddingLeft); - } - - /** - * - */ - public void setPaddingRight(String paddingRight) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_RIGHT), paddingRight); - } - - /** - * - */ - public void setPaddingTop(String paddingTop) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PADDING_TOP), paddingTop); - } - - /** - * - */ - public void setPage(String page) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE), page); - } - - /** - * - */ - public void setPageBreakAfter(String pageBreakAfter) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_AFTER), pageBreakAfter); - } - - /** - * - */ - public void setPageBreakBefore(String pageBreakBefore) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_BEFORE), pageBreakBefore); - } - - /** - * - */ - public void setPageBreakInside(String pageBreakInside) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAGE_BREAK_INSIDE), pageBreakInside); - } - - /** - * - */ - public void setPause(String pause) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE), pause); - } - - /** - * - */ - public void setPauseAfter(String pauseAfter) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_AFTER), pauseAfter); - } - - /** - * - */ - public void setPauseBefore(String pauseBefore) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PAUSE_BEFORE), pauseBefore); - } - - /** - * - */ - public void setPitch(String pitch) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH), pitch); - } - - /** - * - */ - public void setPitchRange(String pitchRange) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PITCH_RANGE), pitchRange); - } - - /** - * - */ - public void setPlayDuring(String playDuring) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_PLAY_DURING), playDuring); - } - - /** - * - */ - public void setPosition(String position) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_POSITION), position); - } - - /** - * - */ - public void setQuotes(String quotes) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_QUOTES), quotes); - } - - /** - * - */ - public void setRichness(String richness) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_RICHNESS), richness); - } - - /** - * - */ - public void setRight(String right) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_RIGHT), right); - } - - /** - * - */ - public void setSize(String size) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SIZE), size); - } - - /** - * - */ - public void setSpeak(String speak) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK), speak); - } - - /** - * - */ - public void setSpeakHeader(String speakHeader) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_HEADER), speakHeader); - } - - /** - * - */ - public void setSpeakNumeral(String speakNumeral) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_NUMERAL), speakNumeral); - } - - /** - * - */ - public void setSpeakPunctuation(String speakPunctuation) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEAK_PUNCTUATION), speakPunctuation); - } - - /** - * - */ - public void setSpeechRate(String speechRate) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_SPEECH_RATE), speechRate); - } - - /** - * - */ - public void setStress(String stress) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_STRESS), stress); - } - - /** - * - */ - public void setTableLayout(String tableLayout) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TABLE_LAYOUT), tableLayout); - } - - /** - * - */ - public void setTextAlign(String textAlign) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_ALIGN), textAlign); - } - - /** - * - */ - public void setTextDecoration(String textDecoration) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_DECORATION), textDecoration); - } - - /** - * - */ - public void setTextIndent(String textIndent) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_INDENT), textIndent); - } - - /** - * - */ - public void setTextShadow(String textShadow) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_SHADOW), textShadow); - } - - /** - * - */ - public void setTextTransform(String textTransform) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TEXT_TRANSFORM), textTransform); - } - - /** - * - */ - public void setTop(String top) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_TOP), top); - } - - /** - * - */ - public void setUnicodeBidi(String unicodeBidi) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_UNICODE_BIDI), unicodeBidi); - } - - /** - * - */ - public void setVerticalAlign(String verticalAlign) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_VERTICAL_ALIGN), verticalAlign); - } - - /** - * - */ - public void setVisibility(String visibility) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_VISIBILITY), visibility); - } - - /** - * - */ - public void setVoiceFamily(String voiceFamily) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_VOICE_FAMILY), voiceFamily); - } - - /** - * - */ - public void setVolume(String volume) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_VOLUME), volume); - } - - /** - * - */ - public void setWhiteSpace(String whiteSpace) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_WHITE_SPACE), whiteSpace); - } - - /** - * - */ - public void setWidows(String widows) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDOWS), widows); - } - - /** - * - */ - public void setWidth(String width) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_WIDTH), width); - } - - /** - * - */ - public void setWordSpacing(String wordSpacing) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_WORD_SPACING), wordSpacing); - } - - /** - * - */ - public void setZIndex(String zIndex) throws org.w3c.dom.DOMException { - set(PropCMProperty.getInstanceOf(PropCMProperty.P_Z_INDEX), zIndex); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipBottomSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipBottomSubStyleAdapter.java deleted file mode 100644 index 28f06fc521..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipBottomSubStyleAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; - -/** - * For bottom value of 'clip' property's rect() function - */ -public class ClipBottomSubStyleAdapter extends ClipSubStyleAdapter { - - /** - * - */ - public ClipBottomSubStyleAdapter() { - super(); - } - - /** - * - */ - String get(org.w3c.dom.css.Rect rect) { - return rect.getBottom().getCssText(); - } - - /** - * - */ - int index() { - return 2; - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP)); - String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT)); - String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT)); - - set(properties, top, right, value, left, value == null || value.length() == 0); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipLeftSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipLeftSubStyleAdapter.java deleted file mode 100644 index 58ba873b73..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipLeftSubStyleAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; - -/** - * For left value of 'clip' property's rect() function - */ -public class ClipLeftSubStyleAdapter extends ClipSubStyleAdapter { - - /** - * - */ - public ClipLeftSubStyleAdapter() { - super(); - } - - /** - * - */ - String get(org.w3c.dom.css.Rect rect) { - return rect.getLeft().getCssText(); - } - - /** - * - */ - int index() { - return 3; - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP)); - String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT)); - String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM)); - - set(properties, top, right, bottom, value, value == null || value.length() == 0); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipRightSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipRightSubStyleAdapter.java deleted file mode 100644 index 1560afccd5..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipRightSubStyleAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; - -/** - * For right value of 'clip' property's rect() function - */ -public class ClipRightSubStyleAdapter extends ClipSubStyleAdapter { - - /** - * - */ - public ClipRightSubStyleAdapter() { - super(); - } - - /** - * - */ - String get(org.w3c.dom.css.Rect rect) { - return rect.getRight().getCssText(); - } - - /** - * - */ - int index() { - return 1; - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String top = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_TOP)); - String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM)); - String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT)); - - set(properties, top, value, bottom, left, value == null || value.length() == 0); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipSubStyleAdapter.java deleted file mode 100644 index e019a34d0c..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipSubStyleAdapter.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.IValID; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue; -import org.w3c.dom.css.Rect; - - -/** - * Abstract class for clip sub-properties - */ -abstract public class ClipSubStyleAdapter implements ISubPropertyAdapter { - - /** - * - */ - public ClipSubStyleAdapter() { - super(); - } - - /** - * - */ - public String get(ICSS2Properties properties) { - String str = null; - Object obj = properties.get(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP)); - if (obj != null) { - if (obj instanceof org.w3c.dom.css.Rect) { - str = get((org.w3c.dom.css.Rect) obj); - } - else { - if (obj instanceof ICSSValue) { - str = ((ICSSValue) obj).getCSSValueText(); - } - else { - str = obj.toString(); - } - str = str.trim().toLowerCase(); - int pos = str.indexOf("rect(");//$NON-NLS-1$ - if (pos >= 0) { - String subStr = null; - pos += 5; - int i = 0; - do { - int posEnd = str.indexOf(",", pos);//$NON-NLS-1$ - if (posEnd < 0) - posEnd = str.indexOf(")", pos);//$NON-NLS-1$ - if (posEnd < 0 && pos < str.length()) - posEnd = str.length(); - if (posEnd >= pos) { - subStr = str.substring(pos, posEnd); - pos = posEnd + 1; - } - else - pos = -1; - } - while (i++ < index() && pos > 0); - - if (pos > 0) - str = subStr.trim(); - else - str = null; - } - else - str = null; - } - } - return (str != null) ? str : "";//$NON-NLS-1$ - } - - /** - * - */ - abstract String get(Rect rect); - - /** - * - */ - abstract int index(); - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - } - - /** - * Insert the method's description here. Creation date: (2001/10/04 - * 19:25:46) - * - * @param properties - * org.eclipse.wst.css.core.util.declaration.ICSS2Properties - * @param top - * java.lang.String - * @param right - * java.lang.String - * @param bottom - * java.lang.String - * @param left - * java.lang.String - * @param removeCheck - * boolean - */ - void set(ICSS2Properties properties, String top, String right, String bottom, String left, boolean removeCheck) { - if (top == null || top.length() == 0) - top = IValID.V_AUTO; - if (right == null || right.length() == 0) - right = IValID.V_AUTO; - if (bottom == null || bottom.length() == 0) - bottom = IValID.V_AUTO; - if (left == null || left.length() == 0) - left = IValID.V_AUTO; - - if (removeCheck && top.trim().equalsIgnoreCase(IValID.V_AUTO) && right.trim().equalsIgnoreCase(IValID.V_AUTO) && bottom.trim().equalsIgnoreCase(IValID.V_AUTO) && left.trim().equalsIgnoreCase(IValID.V_AUTO)) { - properties.set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), null); - } - else - properties.set(PropCMProperty.getInstanceOf(PropCMProperty.P_CLIP), "rect(" + top + ", " + right + ", " + bottom + ", " + left + ")");//$NON-NLS-5$//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipTopSubStyleAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipTopSubStyleAdapter.java deleted file mode 100644 index 71b5d537f8..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ClipTopSubStyleAdapter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMSubProperty; - -/** - * For top value of 'clip' property's rect() function - */ -public class ClipTopSubStyleAdapter extends ClipSubStyleAdapter { - - /** - * - */ - public ClipTopSubStyleAdapter() { - super(); - } - - /** - * - */ - String get(org.w3c.dom.css.Rect rect) { - return rect.getTop().getCssText(); - } - - /** - * - */ - int index() { - return 0; - } - - /** - * - */ - public void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException { - String right = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_RIGHT)); - String bottom = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_BOTTOM)); - String left = properties.get(PropCMSubProperty.getInstanceOf(PropCMSubProperty.PSUB_CLIP_LEFT)); - - set(properties, value, right, bottom, left, value == null || value.length() == 0); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/FontShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/FontShorthandAdapter.java deleted file mode 100644 index 41d49ccf55..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/FontShorthandAdapter.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.IValID; -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'font' property 'font' will be expanded to 'font-family', 'font-size', - * 'font-style', 'font-variant', 'font-weight', 'line-height', - */ -public class FontShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public FontShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String style = null, variant = null, weight = null, size = null, height = null, family = null; - PropCMProperty propFont = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE); - PropCMProperty propVariant = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT); - PropCMProperty propWeight = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT); - PropCMProperty propSize = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE); - boolean bNormalSpecified = false; - - int i = 0; - for (; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - // first of all, check font idents - if (i == 0) { - for (int j = 0; j < propFont.getNumChild(); j++) { - Object obj = propFont.getChildAt(i); - if (obj instanceof String && tokens[i].image.compareToIgnoreCase(obj.toString()) == 0) - return false; - } - } - // value "normal" is shared !! - if (tokens[i].image.equalsIgnoreCase(IValID.V_NORMAL)) { - bNormalSpecified = true; - } - else { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propVariant.canHave(tokens[i].image)) - variant = tokens[i].image; - else if (propWeight.canHave(tokens[i].image)) - weight = tokens[i].image; - else if (propSize.canHave(tokens[i].image)) { - size = tokens[i].image; - break; // if size found, break loop - } - } - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER && weight == null && propWeight.canHave(tokens[i].image)) { - weight = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) { - size = tokens[i].image; - break; // if size found, break loop - } - } - - if (bNormalSpecified) { - if (style == null) - style = IValID.V_NORMAL; - if (variant == null) - variant = IValID.V_NORMAL; - if (weight == null) - weight = IValID.V_NORMAL; - } - - // skip whitespace - for (i++; i < tokens.length; i++) { - if (tokens[i].kind != CSSRegionContexts.CSS_S || tokens[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S) - break; - } - - // line-height ? - if (i < tokens.length && tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && tokens[i].image.equals("/")) { //$NON-NLS-1$ - for (i++; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - height = tokens[i++].image; - break; - } - } - } - - // font-family - StringBuffer buf = new StringBuffer(); - for (; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) - buf.append(" ");//$NON-NLS-1$ - else - buf.append(tokens[i].image); - } - family = buf.toString().trim(); - - dest.set(PropCMProperty.P_FONT_STYLE, style); - dest.set(PropCMProperty.P_FONT_VARIANT, variant); - dest.set(PropCMProperty.P_FONT_WEIGHT, weight); - dest.set(PropCMProperty.P_FONT_SIZE, size); - dest.set(PropCMProperty.P_LINE_HEIGHT, height); - dest.set(PropCMProperty.P_FONT_FAMILY, family); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String style = null, variant = null, weight = null, size = null, height = null, family = null; - PropCMProperty propFont = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT); - PropCMProperty propStyle = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_STYLE); - PropCMProperty propVariant = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_VARIANT); - PropCMProperty propWeight = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_WEIGHT); - PropCMProperty propSize = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_SIZE); - PropCMProperty propHeight = PropCMProperty.getInstanceOf(PropCMProperty.P_LINE_HEIGHT); - PropCMProperty propFamily = PropCMProperty.getInstanceOf(PropCMProperty.P_FONT_FAMILY); - boolean bNormalSpecified = false; - - int i = 0; - for (; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - // first of all, check font idents - if (i == 0) { - for (int j = 0; j < propFont.getNumChild(); j++) { - Object obj = propFont.getChildAt(i); - if (obj instanceof String && tokens[i].image.compareToIgnoreCase(obj.toString()) == 0) - return null; - } - } - // value "normal" is shared !! - if (tokens[i].image.equalsIgnoreCase(IValID.V_NORMAL)) { - bNormalSpecified = true; - } - else { - if (propStyle.canHave(tokens[i].image)) - style = tokens[i].image; - else if (propVariant.canHave(tokens[i].image)) - variant = tokens[i].image; - else if (propWeight.canHave(tokens[i].image)) - weight = tokens[i].image; - else if (propSize.canHave(tokens[i].image)) { - size = tokens[i].image; - break; // if size found, break loop - } - } - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER && weight == null && propWeight.canHave(tokens[i].image)) { - weight = tokens[i].image; - } - else if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) { - size = tokens[i].image; - break; // if size found, break loop - } - } - - if (bNormalSpecified) { - if (style == null) - style = IValID.V_NORMAL; - if (variant == null) - variant = IValID.V_NORMAL; - if (weight == null) - weight = IValID.V_NORMAL; - } - - // skip whitespace - for (i++; i < tokens.length; i++) { - if (tokens[i].kind != CSSRegionContexts.CSS_S || tokens[i].kind != CSSRegionContexts.CSS_DECLARATION_VALUE_S) - break; - } - - // line-height ? - if (i < tokens.length && tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR && tokens[i].image.equals("/")) { //$NON-NLS-1$ - for (i++; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - height = tokens[i++].image; - break; - } - } - } - - // font-family - StringBuffer buf = new StringBuffer(); - for (; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_COMMENT) - buf.append(" ");//$NON-NLS-1$ - else - buf.append(tokens[i].image); - } - family = buf.toString().trim(); - - if (propStyle == propDest) - return style; - else if (propVariant == propDest) - return variant; - else if (propWeight == propDest) - return weight; - else if (propSize == propDest) - return size; - else if (propHeight == propDest) - return height; - else if (propFamily == propDest) - return family; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ICSS2Properties.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ICSS2Properties.java deleted file mode 100644 index 02d518c4ec..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ICSS2Properties.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import java.util.Enumeration; -import java.util.Iterator; - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; -import org.w3c.dom.css.CSS2Properties; - - -/** - * - */ -public interface ICSS2Properties extends CSS2Properties { - - /** - * - */ - void applyFull(ICSSStyleDeclaration decl); - - /** - * - */ - void applyModified(ICSSStyleDeclaration decl); - - /** - * - */ - String get(PropCMProperty prop); - - /** - * - */ - String getBackgroundPositionX(); - - /** - * - */ - String getBackgroundPositionY(); - - /** - * - */ - String getClipBottom(); - - /** - * - */ - String getClipLeft(); - - /** - * - */ - String getClipRight(); - - /** - * - */ - String getClipTop(); - - /** - * - */ - boolean isModified(); - - /** - * - */ - Enumeration properties(); - - /** - * - */ - Iterator propertiesModified(); - - /** - * - */ - void resetModified(); - - /** - * - */ - void set(PropCMProperty prop, String value) throws org.w3c.dom.DOMException; - - /** - * - */ - void setBackgroundPositionX(String backgroundPosition) throws org.w3c.dom.DOMException; - - /** - * - */ - void setBackgroundPositionY(String backgroundPosition) throws org.w3c.dom.DOMException; - - /** - * - */ - void setClipBottom(String backgroundPosition) throws org.w3c.dom.DOMException; - - /** - * - */ - void setClipLeft(String backgroundPosition) throws org.w3c.dom.DOMException; - - /** - * - */ - void setClipRight(String backgroundPosition) throws org.w3c.dom.DOMException; - - /** - * - */ - void setClipTop(String backgroundPosition) throws org.w3c.dom.DOMException; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/IShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/IShorthandAdapter.java deleted file mode 100644 index 5a91f0a723..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/IShorthandAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; - -/** - * - */ -public interface IShorthandAdapter { - - /** - * - */ - boolean expand(String source, CSSPropertyContext dest); - - /** - * - */ - String extract(String source, PropCMProperty propDest); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ISubPropertyAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ISubPropertyAdapter.java deleted file mode 100644 index 7d87b6bc01..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ISubPropertyAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -/** - * - */ -public interface ISubPropertyAdapter { - - /** - * - */ - String get(ICSS2Properties properties); - - /** - * - */ - void set(ICSS2Properties properties, String value) throws org.w3c.dom.DOMException; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ListStyleShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ListStyleShorthandAdapter.java deleted file mode 100644 index f6020335f9..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ListStyleShorthandAdapter.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'list-style' property 'list-style' will be expanded to - * 'list-style-image', 'list-style-position', 'list-style-type', - */ -public class ListStyleShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public ListStyleShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String image = "", pos = "", type = "";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$ - PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION); - PropCMProperty propType = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE); - PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propPos.canHave(tokens[i].image)) - pos = tokens[i].image; - else { // value="none" is shared !! - if (propType.canHave(tokens[i].image)) - type = tokens[i].image; - if (propImage.canHave(tokens[i].image)) - image = tokens[i].image; - } - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) { - image = tokens[i].image; - } - } - - dest.set(propPos.getName(), pos); - dest.set(propType.getName(), type); - dest.set(propImage.getName(), image); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String image = null, pos = null, type = null; - PropCMProperty propPos = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_POSITION); - PropCMProperty propType = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_TYPE); - PropCMProperty propImage = PropCMProperty.getInstanceOf(PropCMProperty.P_LIST_STYLE_IMAGE); - - for (int i = 0; i < tokens.length; i++) { - if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT) { - if (propPos.canHave(tokens[i].image)) - pos = tokens[i].image; - else { // value="none" is shared !! - if (propType.canHave(tokens[i].image)) - type = tokens[i].image; - if (propImage.canHave(tokens[i].image)) - image = tokens[i].image; - } - } - else if (tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_URI) { - image = tokens[i].image; - } - } - - if (propPos == propDest) - return pos; - else if (propType == propDest) - return type; - else if (propImage == propDest) - return image; - else - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/MarginShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/MarginShorthandAdapter.java deleted file mode 100644 index b53afc6f70..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/MarginShorthandAdapter.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'margin' property 'margin' will be expanded to 'margin-top', - * 'margin-right', 'margin-bottom', 'margin-left', - */ -public class MarginShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public MarginShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - String[] dests = new String[4]; - if (j == 0) - return true; - else if (j == 1) { - dests[0] = dests[1] = dests[2] = dests[3] = idents[0]; - } - else if (j == 2) { - dests[0] = dests[2] = idents[0]; - dests[1] = dests[3] = idents[1]; - } - else if (j == 3) { - dests[0] = idents[0]; - dests[1] = dests[3] = idents[1]; - dests[2] = idents[2]; - } - else { - for (int k = 0; k < 4; k++) - dests[k] = idents[k]; - } - dest.set(PropCMProperty.P_MARGIN_TOP, dests[0]); - dest.set(PropCMProperty.P_MARGIN_RIGHT, dests[1]); - dest.set(PropCMProperty.P_MARGIN_BOTTOM, dests[2]); - dest.set(PropCMProperty.P_MARGIN_LEFT, dests[3]); - - return true; - - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - if (j == 0) - return null; - else if (j == 1) - return idents[0]; - else if (j == 2) { - if (propDest.getName() == PropCMProperty.P_MARGIN_TOP || propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM) - return idents[0]; - else - return idents[1]; - } - else if (j == 3) { - if (propDest.getName() == PropCMProperty.P_MARGIN_TOP) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM) - return idents[2]; - else - return idents[1]; - } - else { - if (propDest.getName() == PropCMProperty.P_MARGIN_TOP) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_MARGIN_RIGHT) - return idents[1]; - else if (propDest.getName() == PropCMProperty.P_MARGIN_BOTTOM) - return idents[2]; - else if (propDest.getName() == PropCMProperty.P_MARGIN_LEFT) - return idents[3]; - else - return null; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/PaddingShorthandAdapter.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/PaddingShorthandAdapter.java deleted file mode 100644 index 5cde483c2f..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/PaddingShorthandAdapter.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -import org.eclipse.wst.css.core.internal.contentmodel.PropCMProperty; -import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts; -import org.eclipse.wst.css.core.internal.parserz.CSSTextParser; -import org.eclipse.wst.css.core.internal.parserz.CSSTextToken; - - -/** - * For 'padding' property 'padding' will be expanded to 'padding-top', - * 'padding-right', 'padding-bottom', 'padding-left', - */ -public class PaddingShorthandAdapter implements IShorthandAdapter { - - /** - * - */ - public PaddingShorthandAdapter() { - super(); - } - - /** - * - */ - public boolean expand(String source, CSSPropertyContext dest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return false; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - String[] dests = new String[4]; - if (j == 0) - return true; - else if (j == 1) { - dests[0] = dests[1] = dests[2] = dests[3] = idents[0]; - } - else if (j == 2) { - dests[0] = dests[2] = idents[0]; - dests[1] = dests[3] = idents[1]; - } - else if (j == 3) { - dests[0] = idents[0]; - dests[1] = dests[3] = idents[1]; - dests[2] = idents[2]; - } - else { - for (int k = 0; k < 4; k++) - dests[k] = idents[k]; - } - dest.set(PropCMProperty.P_PADDING_TOP, dests[0]); - dest.set(PropCMProperty.P_PADDING_RIGHT, dests[1]); - dest.set(PropCMProperty.P_PADDING_BOTTOM, dests[2]); - dest.set(PropCMProperty.P_PADDING_LEFT, dests[3]); - - return true; - } - - /** - * - */ - public String extract(String source, PropCMProperty propDest) { - CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_DECLARATION_VALUE, source); - CSSTextToken[] tokens = parser.getTokens(); - if (tokens.length <= 0) { - return null; - } - String[] idents = new String[4]; - int j = 0; - for (int i = 0; i < tokens.length; i++) { - if (org.eclipse.wst.css.core.internal.util.CSSUtil.isLength(tokens[i]) || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER || tokens[i].kind == CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE) - idents[j++] = tokens[i].image; - if (j == 4) - break; - } - - if (j == 0) - return null; - else if (j == 1) - return idents[0]; - else if (j == 2) { - if (propDest.getName() == PropCMProperty.P_PADDING_TOP || propDest.getName() == PropCMProperty.P_PADDING_BOTTOM) - return idents[0]; - else - return idents[1]; - } - else if (j == 3) { - if (propDest.getName() == PropCMProperty.P_PADDING_TOP) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_PADDING_BOTTOM) - return idents[2]; - else - return idents[1]; - } - else { - if (propDest.getName() == PropCMProperty.P_PADDING_TOP) - return idents[0]; - else if (propDest.getName() == PropCMProperty.P_PADDING_RIGHT) - return idents[1]; - else if (propDest.getName() == PropCMProperty.P_PADDING_BOTTOM) - return idents[2]; - else if (propDest.getName() == PropCMProperty.P_PADDING_LEFT) - return idents[3]; - else - return null; - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ValueData.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ValueData.java deleted file mode 100644 index a64f3b12d4..0000000000 --- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/util/declaration/ValueData.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.css.core.internal.util.declaration; - - - -/** - * - */ -public class ValueData { - - public String value; - public boolean important = false; - - /** - * - */ - public ValueData() { - super(); - } - - /** - * - */ - public ValueData(String val, boolean imp) { - super(); - value = val; - important = imp; - } - - /** - * - */ - public String toString() { - return value; - } -}
\ No newline at end of file |