| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.click.element.Element
org.apache.click.element.ResourceElement
org.apache.click.element.JsImport
public class JsImport
Provides a JavaScript HEAD element for importing external JavaScript files using the <script> tag.
Example usage:
 public class MyPage extends Page {
     public List getHeadElements() {
         // We use lazy loading to ensure the JS import is only added the
         // first time this method is called.
         if (headElements == null) {
             // Get the head elements from the super implementation
             headElements = super.getHeadElements();
             JsImport jsImport = new JsImport("/js/js-library.js");
             headElements.add(jsImport);
         }
         return headElements;
     }
 } 
 The jsImport instance will be rendered as follows (assuming the context
 path is myApp):
 <script type="text/javascript" href="/myApp/js/js-library.js"></script>
| Field Summary | 
|---|
| Fields inherited from class org.apache.click.element.ResourceElement | 
|---|
IF_IE, IF_IE7, IF_LESS_THAN_IE7, IF_LESS_THAN_IE9, IF_LESS_THAN_OR_EQUAL_TO_IE7 | 
| Constructor Summary | |
|---|---|
JsImport()
Constructs a new JavaScript import element.  | 
|
JsImport(String src)
Construct a new JavaScript import element with the specified src attribute.  | 
|
JsImport(String src,
         boolean useApplicationVersionIndicator)
Construct a new JavaScript import element with the specified src attribute.  | 
|
JsImport(String src,
         String versionIndicator)
Construct a new JavaScript import element with the specified src attribute and version indicator.  | 
|
| Method Summary | |
|---|---|
 boolean | 
equals(Object o)
 | 
 String | 
getSrc()
Return the src attribute.  | 
 String | 
getTag()
Returns the JavaScript import HTML tag: <script>.  | 
 int | 
hashCode()
 | 
 boolean | 
isUnique()
This method always return true because a JavaScript import must be unique based on its src attribute.  | 
 void | 
render(HtmlStringBuffer buffer)
Render the HTML representation of the JsImport element to the specified buffer.  | 
 void | 
setSrc(String src)
Sets the src attribute.  | 
| Methods inherited from class org.apache.click.element.ResourceElement | 
|---|
getConditionalComment, getVersionIndicator, isRenderId, setConditionalComment, setRenderId, setVersionIndicator | 
| Methods inherited from class org.apache.click.element.Element | 
|---|
appendAttributes, getAttribute, getAttributes, getContext, getId, hasAttribute, hasAttributes, setAttribute, setId, toString | 
| Methods inherited from class java.lang.Object | 
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public JsImport()
version indicator
 will automatically be set to the
 application version indicator.
public JsImport(String src)
version indicator
 will automatically be set to the
 application version indicator.
 
 Please note if the given src begins with a
 "/" character the src will be prefixed with the web
 application context path.
src - the JavaScript import src attribute
public JsImport(String src,
                boolean useApplicationVersionIndicator)
version indicator will
 automatically be set to the
 application version indicator.
 
 Please note if the given src begins with a
 "/" character the src will be prefixed with the web
 application context path.
src - the JavaScript import src attributeuseApplicationVersionIndicator - indicates whether the version
 indicator will automatically be set to the application version indicator
public JsImport(String src,
                String versionIndicator)
src - the JsImport src attributeversionIndicator - the version indicator to add to the src path| Method Detail | 
|---|
public String getTag()
getTag in class Elementpublic boolean isUnique()
isUnique in class ResourceElementResourceElement.isUnique()public void setSrc(String src)
src - the new src attributepublic String getSrc()
public void render(HtmlStringBuffer buffer)
render in class ResourceElementbuffer - the buffer to render output topublic boolean equals(Object o)
equals in class Objecto - the object with which to compare this instance with
Object.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||