de.agilecoders.wicket.jquery
Class JQuery

java.lang.Object
  extended by de.agilecoders.wicket.jquery.JQuery
All Implemented Interfaces:
Serializable, org.apache.wicket.util.io.IClusterable

public class JQuery
extends Object
implements org.apache.wicket.util.io.IClusterable

The Jquery class helps to keep all javascript jquery scripts type safe.

Author:
miha
See Also:
Serialized Form

Method Summary
static JQuery $(Attr selector)
          helper method to allow a jquery like code style

static JQuery $(CharSequence selector)
          helper method to allow a jquery like code style.
static JQuery $(org.apache.wicket.Component component)
          helper method to allow a jquery like code style
static JQuery $(org.apache.wicket.Component component, Attr... additionalSelector)
          helper method to allow a jquery like code style
static JQuery $(org.apache.wicket.Component component, CharSequence... additionalSelector)
          helper method to allow a jquery like code style
 org.apache.wicket.markup.head.OnDomReadyHeaderItem asDomReadyScript()
           
static Attr auto(Object value)
          creates a auto detect attribute
 String build()
           
 JQuery chain(CharSequence functionName)
          adds a chained function to this jquery instance
 JQuery chain(CharSequence functionName, Config config, Config... extraConfigs)
          adds a chained function to this jquery instance
 JQuery chain(IFunction function)
          adds a chained function to this jquery instance
 JQuery closest(Attr selector)
          For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
 JQuery closest(CharSequence selector)
          For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
 JQuery find(Attr selector)
          Get the descendants of each element in the current set of matched elements, filtered by a selector.
 JQuery find(CharSequence selector)
          Get the descendants of each element in the current set of matched elements, filtered by a selector.
 String get()
           
static Attr.MarkupId markupId(CharSequence markupId)
          creates a quoted markup id selector
static Attr.MarkupId markupId(org.apache.wicket.Component component)
          creates a quoted markup id selector
 JQuery on(Attr events, Attr selector, JavaScriptInlineFunction handler)
          Attach an event handler function for one or more events to the selected elements.
 JQuery on(Attr events, JavaScriptInlineFunction handler)
          Attach an event handler function for one or more events to the selected elements.
 JQuery on(CharSequence events, CharSequence selector, JavaScriptInlineFunction handler)
          Attach an event handler function for one or more events to the selected elements.
 JQuery on(CharSequence events, JavaScriptInlineFunction handler)
          Attach an event handler function for one or more events to the selected elements.
static Attr plain(CharSequence value)
          creates a plain attribute without quotes
static Attr quoted(CharSequence value)
          creates a quoted attribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

quoted

public static Attr quoted(CharSequence value)
creates a quoted attribute

Parameters:
value - the selector
Returns:
quoted attribute

plain

public static Attr plain(CharSequence value)
creates a plain attribute without quotes

Parameters:
value - the selector
Returns:
plain attribute

markupId

public static Attr.MarkupId markupId(org.apache.wicket.Component component)
creates a quoted markup id selector

Parameters:
component - the component to extract markup id
Returns:
plain attribute

markupId

public static Attr.MarkupId markupId(CharSequence markupId)
creates a quoted markup id selector

Parameters:
markupId - the markup id
Returns:
plain attribute

auto

public static Attr auto(Object value)
creates a auto detect attribute

Parameters:
value - the selector
Returns:
the attribute value

$

public static JQuery $(CharSequence selector)
helper method to allow a jquery like code style. The selector will be quoted.

     JQuery.$("selector") // = $('selector')
 

Parameters:
selector - The jquery selector
Returns:
new Jquery instance

$

public static JQuery $(Attr selector)
helper method to allow a jquery like code style

     JQuery.$(plain("document")) // = $(document)
 

Parameters:
selector - The jquery selector
Returns:
new Jquery instance

$

public static JQuery $(org.apache.wicket.Component component)
helper method to allow a jquery like code style

Parameters:
component - The markup id of given component is used as jquery selector
Returns:
new Jquery instance

$

public static JQuery $(org.apache.wicket.Component component,
                       CharSequence... additionalSelector)
helper method to allow a jquery like code style

Parameters:
component - The markup id of given component is used as jquery selector
additionalSelector - an additional initial selector
Returns:
new Jquery instance

$

public static JQuery $(org.apache.wicket.Component component,
                       Attr... additionalSelector)
helper method to allow a jquery like code style

Parameters:
component - The markup id of given component is used as jquery selector
additionalSelector - an additional initial selector
Returns:
new Jquery instance

chain

public JQuery chain(IFunction function)
adds a chained function to this jquery instance

Parameters:
function - the function to add
Returns:
this instance for chaining

on

public JQuery on(CharSequence events,
                 JavaScriptInlineFunction handler)
Attach an event handler function for one or more events to the selected elements. The events parameter will be quoted.

Parameters:
events - One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
handler - A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
Returns:
this instance for chaining.

on

public JQuery on(CharSequence events,
                 CharSequence selector,
                 JavaScriptInlineFunction handler)
Attach an event handler function for one or more events to the selected elements. The events and selector parameter will be quoted.

Parameters:
events - One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
selector - A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
handler - A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
Returns:
this instance for chaining.

on

public JQuery on(Attr events,
                 Attr selector,
                 JavaScriptInlineFunction handler)
Attach an event handler function for one or more events to the selected elements.

Parameters:
events - One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
selector - A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
handler - A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
Returns:
this instance for chaining.

on

public JQuery on(Attr events,
                 JavaScriptInlineFunction handler)
Attach an event handler function for one or more events to the selected elements.

Parameters:
events - One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
handler - A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
Returns:
this instance for chaining.

closest

public JQuery closest(CharSequence selector)
For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

Parameters:
selector - the selector to use (will be quoted).
Returns:
this instance for chaining

closest

public JQuery closest(Attr selector)
For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

Parameters:
selector - the selector to use.
Returns:
this instance for chaining

find

public JQuery find(CharSequence selector)
Get the descendants of each element in the current set of matched elements, filtered by a selector.

Parameters:
selector - the selector to use (will be quoted).
Returns:
this instance for chaining

find

public JQuery find(Attr selector)
Get the descendants of each element in the current set of matched elements, filtered by a selector.

Parameters:
selector - the selector to use.
Returns:
this instance for chaining

chain

public JQuery chain(CharSequence functionName)
adds a chained function to this jquery instance

Parameters:
functionName - the function to add
Returns:
this instance for chaining

get

public String get()
Returns:
this jquery chain as string and a semicolon as last char

build

public String build()
Returns:
this jquery chain as string but doesn't close chain with semicolon.

asDomReadyScript

public org.apache.wicket.markup.head.OnDomReadyHeaderItem asDomReadyScript()
Returns:
this jquery script as OnDomReadyHeaderItem instance

chain

public JQuery chain(CharSequence functionName,
                    Config config,
                    Config... extraConfigs)
adds a chained function to this jquery instance

Parameters:
functionName - the function to add
config - the function configuration
Returns:
this instance for chaining


Copyright © 2017. All Rights Reserved.