public final class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areEquals(java.lang.Object a,
java.lang.Object b)
Compare two objects
|
(package private) static <A extends java.lang.annotation.Annotation> |
callAnnotatedMethod(java.lang.Object object,
java.lang.Class<A> annotationType)
Call annotated method method.
|
(package private) static void |
callInitDragDrop(Element ele)
Draw drag event JS
Constants.DRAG_BROWSER_EVENT listener of
Element |
(package private) static java.lang.String |
drawEventHTML(EventListener listener,
Element element,
boolean innerHTML)
This method is calling when html is drawing.
|
(package private) static java.lang.String |
drawEventScript(EventListener listener,
Element element)
This method is calling when we add listener after html drawing - the
object exist at browser.
|
(package private) static void |
drawHTML(Element we,
boolean innerHTMLtoJS,
boolean drawIntro)
drawing HTML view below elements of this element in tree.
|
(package private) static java.lang.String |
drawInitDragDrop(Element ele)
Draw DragDrop initialisation JS string.
|
static java.lang.String |
encodeScript(java.lang.String script)
Encoding JS in order to convert extra characters to ascii
Replace + to %20 which is right decoded by JS function
"decodeURIComponent".
|
static java.lang.String |
escapeHTML(java.lang.String aTagFragment)
Replace characters having special meaning inside HTML tags with
their escaped equivalents, using character entities such as
'&'.
|
static java.lang.String |
escapeNestedScript(java.lang.String js)
Escapes string to right JavaScript literals for inline scripts as correct
nested in string.
|
static java.lang.StringBuilder |
escapeScript(java.lang.String js)
Escapes string to right JavaScript literals.
|
static java.lang.StringBuilder |
escapeScriptWhiteSpaces(java.lang.String js)
Escapes white spaces in JavaScripts for inline scripts.
|
(package private) static <A extends java.lang.annotation.Annotation> |
findAnnotation(java.lang.Object object,
java.lang.Class<A> annotationType)
Search for annotation in inheritance hierarchy.
|
static Element |
findElement(Element current,
java.lang.String objectId)
Find web object in elements tree.
|
static <T extends Element> |
findParent(java.lang.Class<T> c,
Element curr)
Looking in object tree parent object of given class type.
|
(package private) static java.lang.String |
getScriptInnerHTML(Element e)
Returns innerHTML prefix of Element.
|
static java.lang.String |
getScriptPrefix(Element e)
Returns prefix of FireWeb element selector
|
static java.lang.String |
pathToDebugScript(java.lang.String orginPath)
Change path to script by add "-debug" suffix to it's name.
|
static Color |
rgb(int red,
int green,
int blue)
Create color from RGB
|
static java.lang.Integer |
rgbToInt(int red,
int green,
int blue)
Convert RGB to integer value.
|
static java.lang.Boolean |
toBool(java.lang.String s)
Converts JavaScript String to Boolean.
|
static java.lang.Integer |
toInt(java.lang.String s)
Converts JavaScript String to Integer.
|
(package private) static void |
write(java.lang.String s)
Standard to browser printer
|
static final java.lang.String getScriptInnerHTML(Element e)
e
- Element to build the prefixstatic final java.lang.String drawEventHTML(EventListener listener, Element element, boolean innerHTML)
listener
- of event to drawelement
- to drawinnerHTML
- if inner textstatic final java.lang.String drawEventScript(EventListener listener, Element element)
listener
- event to drawelement
- element to drawstatic final void drawHTML(Element we, boolean innerHTMLtoJS, boolean drawIntro)
we
- Element to drawinnerHTMLtoJS
- True - if call is from AJAX, then we have to escape inner text
for JavaScript. False if call from HTML request when we don't
have to escape for JavaScriptdrawIntro
- True if draw intro of HTML code form Servlet false in other
casesFireWebException
- if element type is null.static final java.lang.String drawInitDragDrop(Element ele)
ele
- Element to get the stringConstants.DRAG_BROWSER_EVENT
static final void callInitDragDrop(Element ele)
Constants.DRAG_BROWSER_EVENT
listener of
Element
ele
- The elementstatic final void write(java.lang.String s)
s
- String to send to browserstatic final <A extends java.lang.annotation.Annotation> A findAnnotation(java.lang.Object object, java.lang.Class<A> annotationType)
A
- annotation type to findobject
- Object instanceannotationType
- Annotation type to looking up.static final <A extends java.lang.annotation.Annotation> void callAnnotatedMethod(java.lang.Object object, java.lang.Class<A> annotationType)
A
- annotation type to findobject
- to call methodannotationType
- annotation to findpublic static final java.lang.String escapeHTML(java.lang.String aTagFragment)
The escaped characters are :
aTagFragment
- to escapepublic static final java.lang.StringBuilder escapeScript(java.lang.String js)
js
- String to escapepublic static final java.lang.String escapeNestedScript(java.lang.String js)
js
- String to escapepublic static final java.lang.StringBuilder escapeScriptWhiteSpaces(java.lang.String js)
js
- String to escapepublic static final java.lang.String encodeScript(java.lang.String script)
script
- The script to convertpublic static final java.lang.String getScriptPrefix(Element e)
e
- Element to build the prefixpublic static final Element findElement(Element current, java.lang.String objectId)
current
- the root for searchingobjectId
- Object id to findpublic static final <T extends Element> T findParent(java.lang.Class<T> c, Element curr)
T
- type of elementc
- Class to findcurr
- The object for which we looking of root object - starting
point.public static final java.lang.Integer toInt(java.lang.String s)
s
- String to convertpublic static final java.lang.Boolean toBool(java.lang.String s)
s
- String to convertpublic static final java.lang.Integer rgbToInt(int red, int green, int blue)
red
- color levelgreen
- color levelblue
- color levelpublic static final Color rgb(int red, int green, int blue)
red
- color levelgreen
- color levelblue
- color levelpublic static final boolean areEquals(java.lang.Object a, java.lang.Object b)
a
- Object to compareb
- Object to comparepublic static final java.lang.String pathToDebugScript(java.lang.String orginPath)
From script.js to script-debug.js
orginPath
- path to non debug form script (compressed)