001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.visualweb.api.designer;
043:
044: import java.awt.Image;
045:
046: import org.w3c.dom.Element;
047: import org.w3c.dom.Node;
048:
049: /**
050: * Provides 'static' global service methods.
051: * XXX FIXME Get rid of it.
052: *
053: * @author Peter Zavadsky
054: */
055: public interface DomProviderService {
056:
057: // public MarkupDesignBean getMarkupDesignBeanForElement(Element element);
058: // public MarkupMouseRegion getMarkupMouseRegionForElement(Element element);
059:
060: // /** Gets <coce>MarkupDesignBean</code> only if the specified element
061: // * represents the root element generated for the component. */
062: // public MarkupDesignBean getMarkupDesignBeanForComponentRootElement(Element element, Element parentBoxElement);
063:
064: public int getExpandedOffset(String unexpanded, int unexpandedOffset);
065:
066: public int getUnexpandedOffset(String unexpanded, int expandedOffset);
067:
068: public String expandHtmlEntities(String html, boolean warn,
069: Node node);
070:
071: // public ClassLoader getContextClassLoaderForDesignContext(DesignContext designContext);
072:
073: public String getHtmlStream(Node node);
074:
075: public String getDomDocumentReplacedEventConstant();
076:
077: // XXX Methods we should get rid of.
078: // /** If there is no <code>Designer</code> for the <code>DataObject</code> tries to create one. */
079: // public Designer[] getDesignersForDataObject(DataObject jsfJspDataObject);
080: // /** Just retrieves existing <code>FileObject</code>s for specified <code>DataObject</code>. */
081: // public Designer[] findDesignersForFileObject(FileObject jsfJspFileObject);
082: // /** Just retrieves existing <code>Designer</code>s for specified <code>DesignContext</code>. */
083: // public Designer[] findDesignersForDesignContext(DesignContext designContext);
084: // /** Just retrieves existing <code>Designer</code>s for specified <code>Element</code>. */
085: // public Designer[] findDesignersForElement(Element element);
086: // /** Just retrieves existing <code>Designer</code>s for specified <code>org.openide.nodes.Node</code>. */
087: // public Designer[] findDesignersForNode(org.openide.nodes.Node node);
088:
089: // public boolean isValueBindingExpression(String value, boolean containsOK);
090:
091: // XXX Get rid of those.
092: // public String computeFileName(Object location);
093: // public int computeLineNumber(Object location, int lineno);
094:
095: // public URL getDocumentUrl(Document document);
096:
097: // public void displayErrorForLocation(String message, Object location, int lineno, int column);
098:
099: // public Element getHtmlBodyForDocument(Document document);
100: // public DocumentFragment getHtmlDomFragmentForDocument(Document document);
101:
102: // XXX Get rid of these
103: // public boolean isFacesBean(MarkupDesignBean bean);
104: // public boolean isSpecialBean(DesignBean designBean);
105: // public boolean isTrayBean(DesignBean designBean);
106: // public boolean isCssPositionable(DesignBean designBean);
107: // /** XXX Gets source element. */
108: // public Element getElement(DesignBean designBean);
109: // XXX Get rid of, source element used.
110: public Element getSourceElement(Element componentRootElement);
111:
112: // /** XXX Gets source element. Is it the same like the #getElement method? */
113: // public Element getMarkupBeanElement(DesignBean designBean);
114: // XXX Modifying should be done outside of designer.
115: // public boolean setDesignProperty(MarkupDesignBean bean, String attribute, int value);
116: // public boolean setStyleAttribute(Element componentRootElement, String attribute, int value);
117:
118: // public Element findHtmlElementDescendant(DocumentFragment df);
119:
120: // public void updateLocalStyleValuesForElement(Element e, StyleData[] setStyleData, StyleData[] removeStyleData);
121:
122: // // XXX Bad architecture. Model itself should take care of this and not fire dummy events.
123: // public long getContextGenearation(DesignContext context);
124:
125: // public boolean isWebFormFileObject(FileObject fileObject);
126:
127: public boolean isPrincipalElement(Element element,
128: Element parentBoxElement);
129:
130: public boolean isFocusedElement(Element element);
131:
132: public boolean ignoreDesignBorder(Element element);
133:
134: // XXX Get rid of source elements usage.
135: public Element getSourceElementWhichRendersChildren(Element element);
136:
137: public Element[] getChildComponentRootElements(
138: Element componentRootElement);
139:
140: // // XXX Hack.
141: // public MarkupDesignBean adjustRenderBeanHack(MarkupDesignBean renderBean);
142:
143: // // XXX Get rid of it.
144: // public boolean isFacesComponentBean(DesignBean bean);
145: // public boolean isEscapedDesignBean(DesignBean bean);
146:
147: public boolean isFacesComponent(Element componentRootElement);
148:
149: // /** Gets the component root element (rendered element) for specified bean. */
150: // public Element getRenderedElement(DesignBean designBean);
151:
152: public String getRegionDisplayName(Element regionElement);
153:
154: public boolean isSameRegionOfElement(Element regionElement,
155: Element element);
156:
157: // // XXX Get rid of this.
158: // public Element getComponentRootElementForMarkupDesignBean(MarkupDesignBean markupDesignBean);
159: public Element getComponentRootElementForElement(Element element);
160:
161: public String getInstanceName(Element componentRootElement);
162:
163: public boolean isIncludeComponentBox(Element componentRootElement);
164:
165: public boolean isSpecialComponent(Element componentRootElement);
166:
167: public boolean isTrayComponent(Element componentRootElement);
168:
169: public boolean isCssPositionable(Element componentRootElement);
170:
171: public boolean isEscapedComponent(Element componentRootElement);
172:
173: public Element getParentComponent(Element componentRootElement);
174:
175: public Element[] getChildComponents(Element componentRootElement);
176:
177: public boolean isContainerComponent(Element componentRootElement);
178:
179: public boolean isContainerTypeComponent(Element componentRootElement);
180:
181: // XXX Inline editing.
182: // public String[] getEditablePropertyNames(Element componentRootElement);
183: public String[] getEditableProperties(Element componentRootElement);
184:
185: public enum ResizeConstraint {
186: TOP, LEFT, BOTTOM, RIGHT, MAINTAIN_ASPECT_RATIO, VERTICAL, HORIZONTAL, ANY
187: } // End of enum.
188:
189: public ResizeConstraint[] getResizeConstraintsForComponent(
190: Element componentRootElement);
191:
192: public boolean isRootContainerComponent(Element componentRootElement);
193:
194: // XXX Bad properties hacks, get rid of, it should be part of some action.
195: public boolean hasDefaultProperty(Element componentRootElement);
196:
197: public boolean focusDefaultProperty(Element componentRootElement,
198: String content);
199:
200: public Image getIcon(Element componentRootElement);
201:
202: // public org.openide.nodes.Node getNodeRepresentation(Element componentRootElement);
203: public Element getComponentRootElementFromNode(
204: org.openide.nodes.Node node);
205:
206: // // XXX Get rid of this.
207: // public MarkupPosition getDefaultMarkupPositionUnderParent(DesignBean parent);
208:
209: // public DomProvider.Location computeLocationForPositions(String facet, Point canvasPos, Node documentPosNode, int documentPosOffset, Dimension dimension, boolean isGrid, Element droppeeElement, Element dropeeComponentRootElement, Element defaultParentComponentRootElement);
210:
211: // XXX Bad architecture of Table handling. Try to get rid of it.
212: public boolean hasTableResizeSupport(
213: Element tableComponentRootElement);
214:
215: public int testResizeColumn(Element tableComponentRootElement,
216: int row, int column, int width);
217:
218: public int testResizeRow(Element tableComponentRootElement,
219: int row, int column, int height);
220:
221: public void resizeColumn(Element tableComponentRootElement,
222: int column, int width);
223:
224: public void resizeRow(Element tableComponentRootElement, int row,
225: int height);
226:
227: // XXX
228: public boolean areLinkedToSameBean(Element oneElement,
229: Element otherElement);
230:
231: // XXX
232: public Node findPropertyNode(Node root, String xpaths);
233: }
|