| java.lang.Object org.netbeans.modules.visualweb.insync.Util
Util | final public class Util (Code) | | Common utility methods for helping with NB, Swing and DOM objects.
author: Carl Quinn author: Tor Norbye |
Inner Class :public interface BufferResult | |
Method Summary | |
public static void | addLocalStyleValueForElement(Element element, int style, String value) | public static void | clearErrors(boolean delayed) | public static String | computeFileName(Object location) | public static int | computeLine(Document doc, Element element) | public static int | computeLineNumber(Object location, int lineno) | public static void | customizeCreation(DesignBean[] beans, FacesModel facesModel) | public static void | displayErrorForFileObject(String message, FileObject fileObject, int line, int column) | public static void | displayErrorForLocation(String message, Object location, int line, int column) | public static Element | findChild(String tag, Node parent, boolean create) Locate an element of the given tag name as a direct child of the given parent. | public static DataObject | findDataObject(FileObject file) Get/find the NB DataObject for a given FileObject
Parameters: file - The given FileObject. | public static Element | findDescendant(String tag, Node node) Find the given tag anywhere in the subtree of the given node
(possibly including the node itself). | public static DesignBean | findHtmlContainer(DesignBean parent) Find the nearest DesignBean container that allows html children. | public static DesignBean | findParent(String className, DesignBean droppee, Node parentNode, boolean searchUp, FacesModel facesModel) | public static DesignBean | findParentBean(Node node) | public static String | fromURL(String url) | public static org.openide.nodes.Node.Cookie | getCookie(FileObject file, Class type) Get the NB (data) cookie of a specified type for a given FileObject.
Parameters: file - The given FileObject. Parameters: type - The cookie type to get. | public static URL | getDocumentUrl(Document doc) | public static Element | getElement(DesignBean lb) Return the element for the live bean. | public static FacesBean | getFacesBean(DesignBean lb) Return the FacesBean for the live bean. | public static FileObject | getFileObject(Document doc) | public static Element | getHtmlBodyForDocument(Document document) | public static Element | getHtmlBodyForMarkupFile(FileObject markupFile) | public static DocumentFragment | getHtmlDomFragmentForDocument(Document document) | public static String | getHtmlStream(org.w3c.dom.Node node) Generate the html string from the given node. | public static String | getHtmlStream(Element element) | public static String | getHtmlStream(org.w3c.dom.Document document) Generate the html string from the given element. | public static String | getHtmlStream(DocumentFragment df) | public static MarkupBean | getMarkupBean(DesignBean lb) Return the MarkupBean for the live bean. | public static String[] | getMimeTypes() | public static List | getWebPages(Project project, boolean includePages, boolean includeFragments) | public static boolean | isBraveheartPage(Document dom) | public static boolean | isFormBean(FacesModel facesModel, DesignBean bean) | public static boolean | isGridMode(FacesModel facesModel) Return true if this document is in "grid mode" (objects
should be positioned by absolute coordinates instead of in
"flow" order. | public static boolean | isPageRootContainerDesignBean(DesignBean designBean) | public static boolean | isSpecialBean(DesignBean bean) Return true iff the given DesignBean is the body bean, or the form bean, OR THE LIVE BEAN
CONTAINER. | public static boolean | isWebPage(FileObject fo) | public static boolean | isWoodstockPage(Document dom) | public static BufferResult | loadDocumentBuffer(StyledDocument doc) Load a swing abstract document into a buffer. | public static BufferResult | loadDocumentOrFileObjectBuffer(FileObject fileObject) | public static BufferResult | loadFileObjectBuffer(FileObject fileObject) | public static void | removeLocalStyleValueForElement(Element element, int style) | public static URL | resolveUrl(URL base, Document document, String src) | public static StyledDocument | retrieveDocument(FileObject file, boolean open) Retrieve the swing Abstract Document from a given data object.
Parameters: file - The file object to retrieve the document from Parameters: open - If true, open the document if it's not already open. | public static void | selectErrors() | public static boolean | setDesignProperty(DesignBean bean, String attribute, int length) Attempt to set the given attribute on the bean to the given length
and return true iff it succeeds. | public static String | truncateString(String s, int maxLength) Strip the given string to the given maximum length of
characters. | public static void | updateItemProperty(FileObject file, String name, String newval) Update a Project GenericItem's property to a given value, removing the property if the value
is null or blank, and not touching the property if the new value is not a change. | public static void | updateLocalStyleValuesForElement(Element element, StyleData[] stylesToSet, StyleData[] stylesToRemove) |
addLocalStyleValueForElement | public static void addLocalStyleValueForElement(Element element, int style, String value)(Code) | | |
clearErrors | public static void clearErrors(boolean delayed)(Code) | | |
computeLineNumber | public static int computeLineNumber(Object location, int lineno)(Code) | | |
displayErrorForFileObject | public static void displayErrorForFileObject(String message, FileObject fileObject, int line, int column)(Code) | | |
displayErrorForLocation | public static void displayErrorForLocation(String message, Object location, int line, int column)(Code) | | |
findChild | public static Element findChild(String tag, Node parent, boolean create)(Code) | | Locate an element of the given tag name as a direct child of the given parent. If no element
of that tag name is found it will either return null if the create flag is false, or if the
create flag is true, the element will be created and inserted before it is returned.
Parameters: tag - The tag name of the tag to be found or created Parameters: parent - The element parent under which we want to search Parameters: create - If true, create the element if it doesn't exist, otherwise return null if thetag is not found. |
findDataObject | public static DataObject findDataObject(FileObject file)(Code) | | Get/find the NB DataObject for a given FileObject
Parameters: file - The given FileObject. The corresponding DataObject. |
findDescendant | public static Element findDescendant(String tag, Node node)(Code) | | Find the given tag anywhere in the subtree of the given node
(possibly including the node itself).
Parameters: tag - The name of the tag element to be found Parameters: node - The root node to begin the search The first element in the node tree with the given tag name |
findHtmlContainer | public static DesignBean findHtmlContainer(DesignBean parent)(Code) | | Find the nearest DesignBean container that allows html children.
This will typically be the parent you pass in, but if there
are any beans up in the hierarchy that renders their own
children, then the outermost such parent's parent will be used,
since "renders children" jsf components cannot contain markup.
|
findParentBean | public static DesignBean findParentBean(Node node)(Code) | | Given a node, return the nearest DesignBean that "contains" it
|
getCookie | public static org.openide.nodes.Node.Cookie getCookie(FileObject file, Class type)(Code) | | Get the NB (data) cookie of a specified type for a given FileObject.
Parameters: file - The given FileObject. Parameters: type - The cookie type to get. The cookie. |
getElement | public static Element getElement(DesignBean lb)(Code) | | Return the element for the live bean. May be null, for non faces beans for example.
|
getFacesBean | public static FacesBean getFacesBean(DesignBean lb)(Code) | | Return the FacesBean for the live bean. May be null, for non faces live beans.
Parameters: lb - The live bean to get the faces bean for. May be null. the FacesBean corresponding to the live bean, or null. |
getFileObject | public static FileObject getFileObject(Document doc)(Code) | | |
getHtmlBodyForMarkupFile | public static Element getHtmlBodyForMarkupFile(FileObject markupFile)(Code) | | |
getHtmlStream | public static String getHtmlStream(org.w3c.dom.Node node)(Code) | | Generate the html string from the given node. This will return
an empty string unless the Node is an Element or a DocumentFragment
or a Document.
|
getHtmlStream | public static String getHtmlStream(Element element)(Code) | | Generate the html string from the given element
|
getMarkupBean | public static MarkupBean getMarkupBean(DesignBean lb)(Code) | | Return the MarkupBean for the live bean. May be null, for non markup live beans.
Parameters: lb - The live bean to get the faces bean for. May be null. the MarkupBean corresponding to the live bean, or null. |
getWebPages | public static List getWebPages(Project project, boolean includePages, boolean includeFragments)(Code) | | |
isBraveheartPage | public static boolean isBraveheartPage(Document dom)(Code) | | |
isFormBean | public static boolean isFormBean(FacesModel facesModel, DesignBean bean)(Code) | | Return true iff the given DesignBean is the form bean for this form OR THE LIVE BEAN CONTAINER,
since it acts like the form bean in many ways (not draggable, not deletable, etc.)
|
isGridMode | public static boolean isGridMode(FacesModel facesModel)(Code) | | Return true if this document is in "grid mode" (objects
should be positioned by absolute coordinates instead of in
"flow" order.
true iff the document should be in grid mode |
isPageRootContainerDesignBean | public static boolean isPageRootContainerDesignBean(DesignBean designBean)(Code) | | |
isSpecialBean | public static boolean isSpecialBean(DesignBean bean)(Code) | | Return true iff the given DesignBean is the body bean, or the form bean, OR THE LIVE BEAN
CONTAINER. These beans have special behavior since they are not draggable, not deletable,
etc.
TODO Move this into insync.
|
isWebPage | public static boolean isWebPage(FileObject fo)(Code) | | |
isWoodstockPage | public static boolean isWoodstockPage(Document dom)(Code) | | |
loadDocumentBuffer | public static BufferResult loadDocumentBuffer(StyledDocument doc)(Code) | | Load a swing abstract document into a buffer. Use doc.getLength() to get the length in chars.
Parameters: doc - BufferResult with the allocated char[] buffer and size or null and 0. |
loadDocumentOrFileObjectBuffer | public static BufferResult loadDocumentOrFileObjectBuffer(FileObject fileObject)(Code) | | |
loadFileObjectBuffer | public static BufferResult loadFileObjectBuffer(FileObject fileObject)(Code) | | |
removeLocalStyleValueForElement | public static void removeLocalStyleValueForElement(Element element, int style)(Code) | | |
retrieveDocument | public static StyledDocument retrieveDocument(FileObject file, boolean open)(Code) | | Retrieve the swing Abstract Document from a given data object.
Parameters: file - The file object to retrieve the document from Parameters: open - If true, open the document if it's not already open. If false, this method willreturn null for data object whose document is not already open. The document, or null if the data object is not openable (or if the document is notopen and you did not set the open parameter to true.) |
selectErrors | public static void selectErrors()(Code) | | |
setDesignProperty | public static boolean setDesignProperty(DesignBean bean, String attribute, int length)(Code) | | Attempt to set the given attribute on the bean to the given length
and return true iff it succeeds.
|
truncateString | public static String truncateString(String s, int maxLength)(Code) | | Strip the given string to the given maximum length of
characters. If the string is not that long, just return
it. If it needs to be truncated, truncate it and append
"...". maxLength must be at least 4.
|
updateItemProperty | public static void updateItemProperty(FileObject file, String name, String newval)(Code) | | Update a Project GenericItem's property to a given value, removing the property if the value
is null or blank, and not touching the property if the new value is not a change.
Parameters: item - The item whose property is to be set. Parameters: name - The property name to set. Parameters: newval - The new property value. |
updateLocalStyleValuesForElement | public static void updateLocalStyleValuesForElement(Element element, StyleData[] stylesToSet, StyleData[] stylesToRemove)(Code) | | |
|
|