idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
132,300 | public static String getDisplayedTimezone ( long startMillis , String localTimezone , String eventTimezone ) { String tzDisplay = null ; if ( ! TextUtils . equals ( localTimezone , eventTimezone ) ) { TimeZone tz = TimeZone . getTimeZone ( localTimezone ) ; if ( tz == null || tz . getID ( ) . equals ( "GMT" ) ) { tzDis... | Returns the timezone to display in the event info if the local timezone is different from the event timezone . Otherwise returns null . |
132,301 | private static boolean singleDayEvent ( long startMillis , long endMillis , long localGmtOffset ) { if ( startMillis == endMillis ) { return true ; } int startDay = Time . getJulianDay ( startMillis , localGmtOffset ) ; int endDay = Time . getJulianDay ( endMillis - 1 , localGmtOffset ) ; return startDay == endDay ; } | Returns whether the specified time interval is in a single day . |
132,302 | private static int isTodayOrTomorrow ( Resources r , long dayMillis , long currentMillis , long localGmtOffset ) { int startDay = Time . getJulianDay ( dayMillis , localGmtOffset ) ; int currentDay = Time . getJulianDay ( currentMillis , localGmtOffset ) ; int days = startDay - currentDay ; if ( days == 1 ) { return TO... | Returns TODAY or TOMORROW if applicable . Otherwise returns NONE . |
132,303 | public static Intent createEmailAttendeesIntent ( Resources resources , String eventTitle , String body , List < String > toEmails , List < String > ccEmails , String ownerAccount ) { List < String > toList = toEmails ; List < String > ccList = ccEmails ; if ( toEmails . size ( ) <= 0 ) { if ( ccEmails . size ( ) <= 0 ... | Create an intent for emailing attendees of an event . |
132,304 | public static String getVersionCode ( Context context ) { if ( sVersion == null ) { try { sVersion = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) . versionName ; } catch ( PackageManager . NameNotFoundException e ) { Log . e ( TAG , "Error finding package " + context . getApplic... | Return the app version code . |
132,305 | private static int findNanpMatchEnd ( CharSequence text , int startPos ) { if ( text . length ( ) > startPos + 4 && text . subSequence ( startPos , startPos + 4 ) . toString ( ) . equalsIgnoreCase ( "tel:" ) ) { startPos += 4 ; } int endPos = text . length ( ) ; int curPos = startPos ; int foundDigits = 0 ; char firstD... | Checks to see if there is a valid phone number in the input starting at the specified offset . If so the index of the last character + 1 is returned . The input is assumed to begin with a non - whitespace character . |
132,306 | private static boolean spanWillOverlap ( Spannable spanText , URLSpan [ ] spanList , int start , int end ) { if ( start == end ) { return false ; } for ( URLSpan span : spanList ) { int existingStart = spanText . getSpanStart ( span ) ; int existingEnd = spanText . getSpanEnd ( span ) ; if ( ( start >= existingStart &&... | Determines whether a new span at [ start end ) will overlap with any existing span . |
132,307 | private static int dayToUtilDay ( int day ) { switch ( day ) { case EventRecurrence . SU : return Calendar . SUNDAY ; case EventRecurrence . MO : return Calendar . MONDAY ; case EventRecurrence . TU : return Calendar . TUESDAY ; case EventRecurrence . WE : return Calendar . WEDNESDAY ; case EventRecurrence . TH : retur... | Converts EventRecurrence s day of week to DateUtil s day of week . |
132,308 | protected static String reportURL ( String type ) throws EasyPostException { try { String urlType = URLEncoder . encode ( type , "UTF-8" ) . toLowerCase ( ) ; return String . format ( "%s/reports/%s/" , EasyPost . API_BASE , urlType ) ; } catch ( java . io . UnsupportedEncodingException e ) { throw new EasyPostExceptio... | generate report URL pattern |
132,309 | public Item retrieveReference ( String name , String value ) throws EasyPostException { return retrieveReference ( name , value , null ) ; } | retrieve by custom reference |
132,310 | private URI getOriginalUri ( HttpServletRequest request ) { String requestUrl = request . getRequestURL ( ) . toString ( ) ; String incomingScheme = URI . create ( requestUrl ) . getScheme ( ) ; String originalScheme = request . getHeader ( "X-Forwarded-Proto" ) ; if ( originalScheme != null && ! incomingScheme . equal... | Return the URL as it was originally received from a possible frontend proxy . |
132,311 | private static byte [ ] hmacSha ( String crypto , byte [ ] keyBytes , byte [ ] text ) { try { Mac hmac ; hmac = Mac . getInstance ( crypto ) ; SecretKeySpec macKey = new SecretKeySpec ( keyBytes , "RAW" ) ; hmac . init ( macKey ) ; return hmac . doFinal ( text ) ; } catch ( GeneralSecurityException gse ) { throw new Un... | This method uses the JCE to provide the crypto algorithm . HMAC computes a Hashed Message Authentication Code with the crypto hash algorithm as a parameter . |
132,312 | public static int generateTOTP ( byte [ ] key , long time , int digits , String crypto ) { byte [ ] msg = ByteBuffer . allocate ( 8 ) . putLong ( time ) . array ( ) ; byte [ ] hash = hmacSha ( crypto , key , msg ) ; int offset = hash [ hash . length - 1 ] & 0xf ; int binary = ( ( hash [ offset ] & 0x7f ) << 24 ) | ( ( ... | This method generates a TOTP value for the given set of parameters . |
132,313 | @ SuppressWarnings ( "unchecked" ) public final List < RegisteredService > loadServices ( ) { logger . info ( "Loading Registered Services from: [ {} ]..." , this . servicesConfigFile ) ; final List < RegisteredService > resolvedServices = new ArrayList < RegisteredService > ( ) ; try { final Map < String , List > m = ... | This method is used as a Spring bean loadServices - method as well as the reloading method when the change in the services definition resource is detected at runtime |
132,314 | public void init ( ) throws Exception { try { unmarshalAndSetBackingMap ( ) ; } catch ( final ClassCastException ex ) { throw new BeanCreationException ( String . format ( "The semantic structure of the person attributes JSON config is not correct. Please fix it in this resource: [%s]" , this . personAttributesConfigFi... | Init method un - marshals JSON representation of the person attributes . |
132,315 | public void onApplicationEvent ( final ResourceChangeDetectingEventNotifier . ResourceChangedEvent resourceChangedEvent ) { try { if ( ! resourceChangedEvent . getResourceUri ( ) . equals ( this . personAttributesConfigFile . getURI ( ) ) ) { return ; } } catch ( final Throwable e ) { logger . error ( "An exception is ... | Reload person attributes when JSON config is changed . In case of un - marshaling errors or any other errors do not disturb running CAS server by propagating the exceptions but instead log the error and leave the previously cached person attributes state alone . |
132,316 | void init ( ) throws Throwable { if ( this . digestAlgorithmName != null ) { this . hashService . setHashAlgorithmName ( this . digestAlgorithmName ) ; } if ( this . hashIterations > 0 ) { this . hashService . setHashIterations ( this . hashIterations ) ; } } | This method is only intended to be called by the infrastructure code managing instances of this class once during initialization of this instance |
132,317 | public OutlookMessage parseMsg ( final InputStream msgFileStream ) throws IOException { final OutlookMessage msg = new OutlookMessage ( rtf2htmlConverter ) ; try { checkDirectoryEntry ( new POIFSFileSystem ( msgFileStream ) . getRoot ( ) , msg ) ; } finally { msgFileStream . close ( ) ; } convertHeaders ( msg ) ; retur... | Parses a . msg file provided by an input stream . |
132,318 | private byte [ ] getBytesFromStream ( final InputStream dstream ) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final byte [ ] buffer = new byte [ 1024 ] ; int read ; while ( ( read = dstream . read ( buffer ) ) > 0 ) { baos . write ( buffer , 0 , read ) ; } return baos . toByt... | Reads the bytes from the stream to a byte array . |
132,319 | public void setProperty ( final OutlookMessageProperty msgProp ) { final String name = msgProp . getClazz ( ) ; final Object value = msgProp . getData ( ) ; if ( name != null && value != null ) { switch ( name ) { case "3701" : setSize ( msgProp . getSize ( ) ) ; setData ( ( byte [ ] ) value ) ; break ; case "3704" : s... | Sets the property specified by the name parameter . Unknown names are ignored . |
132,320 | private String getStringResource ( String path ) { InputStream in = getClass ( ) . getResourceAsStream ( path ) ; StringBuilder index = new StringBuilder ( ) ; char [ ] buffer = new char [ 1024 ] ; int read = 0 ; try ( InputStreamReader reader = new InputStreamReader ( in ) ) { while ( ( read = reader . read ( buffer )... | read the description contained in the index . html file |
132,321 | public Service getServiceObjectFromId ( String id ) { log . fine ( "Return service object for " + id ) ; Service service = null ; for ( Service s : services . getServices ( ) ) { if ( id . equals ( s . getId ( ) ) ) { return s ; } } return service ; } | Returns the service object associated with the given id |
132,322 | public File createGitRepository ( String repositoryName ) throws IOException { RepositoryService service = new RepositoryService ( ) ; service . getClient ( ) . setOAuth2Token ( oAuthToken ) ; Repository repository = new Repository ( ) ; repository . setName ( repositoryName ) ; repository = service . createRepository ... | Creates a repository on GitHub and in a local temporary directory . This is a one time operation as once it is created on GitHub and locally it cannot be recreated . |
132,323 | public static boolean hasChildNode ( Node parentNode , String nodeName ) { return getChildNode ( parentNode , nodeName , null ) != null ? true : false ; } | Determine if the parent node contains a child node with matching name |
132,324 | public static Node getChildNode ( Node parentNode , String name , String value ) { List < Node > matchingChildren = getChildren ( parentNode , name , value ) ; return ( matchingChildren . size ( ) > 0 ) ? matchingChildren . get ( 0 ) : null ; } | Get the matching child node |
132,325 | public static Node getGrandchildNode ( Node parentNode , String childNodeName , String grandChildNodeName , String grandChildNodeValue ) { List < Node > matchingChildren = getChildren ( parentNode , childNodeName , null ) ; for ( Node child : matchingChildren ) { Node matchingGrandChild = getChildNode ( child , grandCh... | Get the matching grand child node |
132,326 | private static List < Node > getChildren ( Node parentNode , String name , String value ) { List < Node > childNodes = new ArrayList < Node > ( ) ; if ( parentNode == null || name == null ) { return childNodes ; } if ( parentNode . getNodeType ( ) == Node . ELEMENT_NODE && parentNode . hasChildNodes ( ) ) { NodeList ch... | Get all matching child nodes |
132,327 | public static Node addChildNode ( Document doc , Node parentNode , String childName , String childValue ) { if ( doc == null || parentNode == null || childName == null ) { return null ; } Node childNode = doc . createElement ( childName ) ; if ( childValue != null ) { childNode . setTextContent ( childValue ) ; } paren... | Add a child node |
132,328 | public static Node findOrAddChildNode ( Document doc , Node parentNode , String childName , String childValue ) { Node matchingChild = getChildNode ( parentNode , childName , childValue ) ; return matchingChild != null ? matchingChild : addChildNode ( doc , parentNode , childName , childValue ) ; } | Get the matching child node . Create a node if it doens t already exist |
132,329 | public WebElement waitForElement ( By by ) { int attempts = 0 ; int size = driver . findElements ( by ) . size ( ) ; while ( size == 0 ) { size = driver . findElements ( by ) . size ( ) ; if ( attempts == MAX_ATTEMPTS ) fail ( String . format ( "Could not find %s after %d seconds" , by . toString ( ) , MAX_ATTEMPTS ) )... | Method that acts as an arbiter of implicit timeouts of sorts .. sort of like a Wait For Ajax method . |
132,330 | public String url ( ) { String url = "" ; if ( ! StringUtils . isEmpty ( baseUrl ( ) ) ) { url = baseUrl ( ) + path ( ) ; } else { if ( ! StringUtils . isEmpty ( properties . getProperty ( Constants . DEFAULT_PROPERTY_URL ) ) ) { url = properties . getProperty ( Constants . DEFAULT_PROPERTY_URL ) ; } if ( testConfig !=... | Url that automated tests will be testing . |
132,331 | public static IDataSource create ( JsonObject config ) throws DataSourceCreationException { String title = config . getAsJsonPrimitive ( "title" ) . getAsString ( ) ; String description = config . getAsJsonPrimitive ( "description" ) . getAsString ( ) ; String typeName = config . getAsJsonPrimitive ( "type" ) . getAsSt... | Create a datasource using a JSON config |
132,332 | private IDataSource getDataSource ( HttpServletRequest request ) throws DataSourceNotFoundException { String contextPath = request . getContextPath ( ) ; String requestURI = request . getRequestURI ( ) ; String path = contextPath == null ? requestURI : requestURI . substring ( contextPath . length ( ) ) ; if ( path . e... | Get the datasource |
132,333 | public void addMetadata ( final Model model ) { final Resource datasetId = model . createResource ( getDatasetURI ( ) ) ; final Resource fragmentId = model . createResource ( fragmentURL ) ; datasetId . addProperty ( CommonResources . RDF_TYPE , CommonResources . VOID_DATASET ) ; datasetId . addProperty ( CommonResourc... | Adds some basic metadata to the given RDF model . This method may be overridden in subclasses . |
132,334 | public void addControls ( final Model model ) { final URIBuilder pagedURL ; try { pagedURL = new URIBuilder ( fragmentURL ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( e ) ; } final Resource fragmentId = model . createResource ( fragmentURL ) ; final Resource firstPageId = model . createRe... | Adds an RDF description of page links to the given RDF model . This method may be overridden in subclasses . |
132,335 | private Triple toTriple ( TripleID tripleId ) { return new Triple ( dictionary . getNode ( tripleId . getSubject ( ) , TripleComponentRole . SUBJECT ) , dictionary . getNode ( tripleId . getPredicate ( ) , TripleComponentRole . PREDICATE ) , dictionary . getNode ( tripleId . getObject ( ) , TripleComponentRole . OBJECT... | Converts the HDT triple to a Jena Triple . |
132,336 | public ElasticsearchContainer withSecureSetting ( String key , String value ) { securedKeys . put ( key , value ) ; return this ; } | Define the elasticsearch docker registry base url |
132,337 | public ElasticsearchContainer withPluginDir ( Path pluginDir ) { if ( pluginDir == null ) { return this ; } this . pluginDir = createVolumeDirectory ( true ) ; addFileSystemBind ( this . pluginDir . toString ( ) , "/plugins" , BindMode . READ_ONLY ) ; logger ( ) . debug ( "Installing plugins from [{}]" , pluginDir ) ; ... | Path to plugin dir which contains plugins that needs to be installed |
132,338 | public void start ( ) { Thread thread = new Thread ( new LogCatCommandExecutor ( ) ) ; thread . setName ( getClass ( ) . getSimpleName ( ) + " logcat for " + device . getSerialNumber ( ) ) ; thread . start ( ) ; try { sleep ( 500 ) ; } catch ( InterruptedException e ) { } logListenerCommandShell . activate ( ) ; } | Start receiving and acting on paparazzo requests from the device . |
132,339 | public static RGBColor rgb ( int r , int g , int b ) { return new RGBColor ( makeRgb ( r , g , b ) ) ; } | RGB color as r g b triple . |
132,340 | public double cur ( Element elem , String prop , boolean force ) { if ( JsUtils . isWindow ( elem ) ) { if ( "width" . equals ( prop ) ) { return getContentDocument ( elem ) . getClientWidth ( ) ; } if ( "height" . equals ( prop ) ) { return getContentDocument ( elem ) . getClientHeight ( ) ; } elem = GQuery . body ; }... | Returns the numeric value of a css property . |
132,341 | public String curCSS ( Element elem , String name , boolean force ) { if ( elem == null ) { return "" ; } name = fixPropertyName ( name ) ; String ret = elem . getStyle ( ) . getProperty ( name ) ; if ( force ) { Element toDetach = null ; if ( JsUtils . isDetached ( elem ) ) { toDetach = attachTemporary ( elem ) ; } if... | Return the string value of a css property of an element . |
132,342 | private void fixInlineElement ( Element e ) { if ( e . getClientHeight ( ) == 0 && e . getClientWidth ( ) == 0 && "inline" . equals ( curCSS ( e , "display" , true ) ) ) { setStyleProperty ( e , "display" , "inline-block" ) ; setStyleProperty ( e , "width" , "auto" ) ; setStyleProperty ( e , "height" , "auto" ) ; } } | inline elements do not have width nor height unless we set it to inline - block |
132,343 | public void setStyleProperty ( Element e , String prop , String val ) { if ( e == null || prop == null ) { return ; } prop = fixPropertyName ( prop ) ; if ( prop . matches ( "^[A-Z]+$" ) ) { prop = prop . toLowerCase ( ) ; } prop = JsUtils . camelize ( prop ) ; if ( val == null || val . trim ( ) . length ( ) == 0 ) { r... | Set the value of a style property of an element . |
132,344 | public String defaultDisplay ( String tagName ) { String ret = elemdisplay . get ( tagName ) ; if ( ret == null ) { Element e = DOM . createElement ( tagName ) ; Document . get ( ) . getBody ( ) . appendChild ( e ) ; ret = curCSS ( e , "display" , false ) ; e . removeFromParent ( ) ; if ( ret == null || ret . matches (... | Returns the default display value for each html tag . |
132,345 | public void setItems ( java . util . Collection < java . util . Map < String , AttributeValue > > items ) { if ( items == null ) { this . items = null ; return ; } java . util . List < java . util . Map < String , AttributeValue > > itemsCopy = new java . util . ArrayList < java . util . Map < String , AttributeValue >... | Sets the value of the Items property for this object . |
132,346 | public void queueAnimation ( final GQAnimation anim , final int duration ) { if ( isOff ( ) ) { anim . onStart ( ) ; anim . onComplete ( ) ; } else { queue ( anim . e , DEFAULT_NAME , new Function ( ) { public void cancel ( Element e ) { Animation anim = ( Animation ) data ( e , GQAnimation . ACTUAL_ANIMATION , null ) ... | Queue an animation for an element . |
132,347 | public static String vendorProperty ( String prop ) { return vendorPropNames . get ( prop ) != null ? vendorPropNames . get ( prop ) : prop ; } | Get the cached vendor property name . |
132,348 | public Effects slideToggle ( Function ... f ) { return as ( Effects ) . slideToggle ( Speed . DEFAULT , f ) ; } | Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion . Only the height is adjusted for this animation causing all matched elements to be hidden or shown in a sliding manner |
132,349 | private void initResultsTable ( DeferredSelector [ ] dg , Benchmark ... benchs ) { int numRows = dg . length ; grid = new FlexTable ( ) ; grid . addStyleName ( "resultstable" ) ; RootPanel . get ( "results" ) . clear ( ) ; RootPanel . get ( "results" ) . add ( grid ) ; grid . setText ( 0 , 0 , "Selector" ) ; for ( int ... | Reset the result table |
132,350 | public Callbacks add ( com . google . gwt . core . client . Callback < ? , ? > ... c ) { addAll ( ( Object [ ] ) c ) ; return this ; } | Add a Callback or a collection of callbacks to a callback list . |
132,351 | public Callbacks fire ( Object ... o ) { if ( ! done ) { done = isOnce ; if ( isMemory ) { memory = new ArrayList < > ( Arrays . asList ( o ) ) ; } if ( stack != null ) for ( Object c : stack ) { if ( ! run ( c , o ) && stopOnFalse ) { break ; } } } return this ; } | Call all of the callbacks with the given arguments . |
132,352 | public synchronized void save ( String persistence ) { try { createObjectMapper ( ) . writeValue ( new File ( persistence ) , tableList ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } | Maybe save automatically on destroy? |
132,353 | public ObjectMapper createObjectMapper ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; mapper . setVisibility ( PropertyAccessor . FIELD , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . CREATOR , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . SETTER , JsonAutoDetec... | Not sure about this . If correct and only need one only create one instance |
132,354 | public void setSS ( java . util . Collection < String > sS ) { if ( sS == null ) { this . sS = null ; return ; } java . util . List < String > sSCopy = new java . util . ArrayList < String > ( sS . size ( ) ) ; sSCopy . addAll ( sS ) ; this . sS = sSCopy ; } | A set of strings . |
132,355 | public void setNS ( java . util . Collection < String > nS ) { if ( nS == null ) { this . nS = null ; return ; } java . util . List < String > nSCopy = new java . util . ArrayList < String > ( nS . size ( ) ) ; nSCopy . addAll ( nS ) ; this . nS = nSCopy ; } | A set of numbers . |
132,356 | public void setBS ( java . util . Collection < java . nio . ByteBuffer > bS ) { if ( bS == null ) { this . bS = null ; return ; } java . util . List < java . nio . ByteBuffer > bSCopy = new java . util . ArrayList < java . nio . ByteBuffer > ( bS . size ( ) ) ; bSCopy . addAll ( bS ) ; this . bS = bSCopy ; } | A set of binary attributes . |
132,357 | public static Promise when ( Object ... d ) { int l = d . length ; Promise [ ] p = new Promise [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { p [ i ] = makePromise ( d [ i ] ) ; } return when ( p ) ; } | Provides a way to execute callback functions based on one or more objects usually Deferred objects that represent asynchronous events . |
132,358 | protected void trigger ( GwtEvent < ? > e , Function callback , Element element ) { trigger ( e , callback , element , eventBus ) ; } | fire event and call callback function . |
132,359 | public Iterator < T > iterator ( ) { final List < T > allResultsCopy = new ArrayList < T > ( ) ; allResultsCopy . addAll ( allResults ) ; final Iterator < T > iter = allResultsCopy . iterator ( ) ; return new Iterator < T > ( ) { Iterator < T > iterator = iter ; int pos = 0 ; public boolean hasNext ( ) { return iterato... | Returns an iterator over this list that lazily initializes results as necessary . |
132,360 | public List < T > subList ( int arg0 , int arg1 ) { while ( allResults . size ( ) < arg1 && nextResultsAvailable ( ) ) { moveNextResults ( ) ; } return Collections . unmodifiableList ( allResults . subList ( arg0 , arg1 ) ) ; } | Returns a sub - list in the range specified loading more results as necessary . |
132,361 | public int indexOf ( Object arg0 ) { int indexOf = allResults . indexOf ( arg0 ) ; if ( indexOf >= 0 ) return indexOf ; while ( nextResultsAvailable ( ) ) { indexOf = nextResults . indexOf ( arg0 ) ; int size = allResults . size ( ) ; moveNextResults ( ) ; if ( indexOf >= 0 ) return indexOf + size ; } return - 1 ; } | Returns the first index of the object given in the list . Additional results are loaded incrementally as necessary . |
132,362 | private static boolean supportsTransform3d ( ) { if ( transform == null ) { return false ; } String rotate = "rotateY(1deg)" ; divStyle . setProperty ( transform , rotate ) ; rotate = divStyle . getProperty ( transform ) ; return rotate != null && ! rotate . isEmpty ( ) ; } | Some browsers like HTMLUnit only support 2d transformations |
132,363 | public static String getVendorPropertyName ( String prop ) { String vendorProp = JsUtils . camelize ( "-" + prefix + "-" + prop ) ; if ( JsUtils . hasProperty ( divStyle , vendorProp ) ) { return vendorProp ; } if ( JsUtils . hasProperty ( divStyle , prop ) ) { return prop ; } String camelProp = JsUtils . camelize ( pr... | Compute the correct CSS property name for a specific browser vendor . |
132,364 | public static Transform getInstance ( Element e , String initial ) { Transform t = GQuery . data ( e , TRANSFORM ) ; if ( t == null || initial != null ) { if ( initial == null ) { initial = GQuery . getSelectorEngine ( ) . getDocumentStyleImpl ( ) . curCSS ( e , transform , false ) ; } t = new Transform ( initial ) ; G... | Return the Transform dictionary object of an element but reseting historical values and setting them to the initial value passed . |
132,365 | private void parse ( String s ) { if ( s != null ) { for ( MatchResult r = transformParseRegex . exec ( s ) ; r != null ; r = transformParseRegex . exec ( s ) ) { setFromString ( vendorProperty ( r . getGroup ( 1 ) ) , r . getGroup ( 2 ) ) ; } } } | Parse a transform value as string and fills the dictionary map . |
132,366 | public void setFromString ( String prop , String ... val ) { if ( val . length == 1 ) { String [ ] vals = val [ 0 ] . split ( "[\\s,]+" ) ; set ( prop , vals ) ; } else { set ( prop , val ) ; } } | Set a transform multi - value giving either a set of strings or just an string of values separated by comma . |
132,367 | @ SuppressWarnings ( "unchecked" ) public T clearQueue ( String name ) { for ( Element e : elements ( ) ) { queue ( e , name , null ) . clear ( ) ; } return ( T ) this ; } | remove all queued function from the named queue . |
132,368 | @ SuppressWarnings ( "unchecked" ) public T delay ( int milliseconds , String name , Function ... funcs ) { for ( Element e : elements ( ) ) { queue ( e , name , new DelayFunction ( e , name , milliseconds , funcs ) ) ; } return ( T ) this ; } | Add a delay in the named queue . |
132,369 | @ SuppressWarnings ( "unchecked" ) public T dequeue ( String name ) { for ( Element e : elements ( ) ) { dequeueCurrentAndRunNext ( e , name ) ; } return ( T ) this ; } | Removes a queued function from the front of the named queue and executes it . |
132,370 | public Promise promise ( final String name ) { final Promise . Deferred dfd = Deferred ( ) ; final Function resolve = new Function ( ) { int count = 1 ; { for ( Element elem : elements ( ) ) { if ( queue ( elem , name , null ) != null ) { emptyHooks ( elem , name ) . add ( this ) ; count ++ ; } } } public void f ( ) { ... | Returns a dynamically generated Promise that is resolved once all actions in the named queue have ended . |
132,371 | public int queue ( String name ) { Queue < ? > q = isEmpty ( ) ? null : queue ( get ( 0 ) , name , null ) ; return q == null ? 0 : q . size ( ) ; } | Show the number of functions to be executed on the first matched element in the named queue . |
132,372 | @ SuppressWarnings ( "unchecked" ) public T queue ( Function ... funcs ) { for ( Element e : elements ( ) ) { for ( Function f : funcs ) { queue ( e , DEFAULT_NAME , f ) ; } } return ( T ) this ; } | Adds new functions to be executed onto the end of the effects queue of all matched elements . |
132,373 | @ SuppressWarnings ( "unchecked" ) public T queue ( final String name , Function ... funcs ) { for ( final Function f : funcs ) { for ( Element e : elements ( ) ) { queue ( e , name , f ) ; } } return ( T ) this ; } | Adds new functions to be executed onto the end of the named queue of all matched elements . |
132,374 | @ SuppressWarnings ( "unchecked" ) public T queue ( String name , Queue < ? > queue ) { for ( Element e : elements ( ) ) { replacequeue ( e , name , queue ) ; } return ( T ) this ; } | Replaces the current named queue with the given queue on all matched elements . |
132,375 | public void dequeueIfNotDoneYet ( Element elem , String name , Object object ) { @ SuppressWarnings ( "rawtypes" ) Queue queue = queue ( elem , name , null ) ; if ( queue != null && object . equals ( queue . peek ( ) ) ) { dequeueCurrentAndRunNext ( elem , name ) ; } } | Dequeue the object and run the next if it is the first in the queue . |
132,376 | public final Object f ( Object ... args ) { return dfd != null && ( cache == CacheType . ALL || cache == CacheType . RESOLVED && dfd . promise ( ) . isResolved ( ) || cache == CacheType . REJECTED && dfd . promise ( ) . isRejected ( ) ) ? dfd . promise ( ) : new PromiseFunction ( ) { public void f ( Deferred dfd ) { Fu... | This function is called when the previous promise in the pipe is resolved . |
132,377 | @ SuppressWarnings ( "unchecked" ) public < T extends JavaScriptObject > T getArgumentJSO ( int argIdx , int pos ) { return ( T ) getArgument ( argIdx , pos , JavaScriptObject . class ) ; } | Utility method for safety getting a JavaScriptObject present at a certain position in the list of arguments composed by arrays . |
132,378 | public Object [ ] getArgumentArray ( int idx ) { Object o = idx < 0 ? arguments : getArgument ( idx ) ; if ( o != null ) { return o . getClass ( ) . isArray ( ) ? ( Object [ ] ) o : new Object [ ] { o } ; } else if ( idx == 0 ) { return arguments ; } return new Object [ 0 ] ; } | Utility method for safety getting an array present at a certain position in the list of arguments . |
132,379 | public < T > T getArgument ( int idx , Class < ? extends T > type ) { return getArgument ( - 1 , idx , type ) ; } | Safety return the argument in the position idx . |
132,380 | @ SuppressWarnings ( "unchecked" ) public < T > T getArgument ( int argIdx , int pos , Class < ? extends T > type ) { Object [ ] objs = getArgumentArray ( argIdx ) ; Object o = objs . length > pos ? objs [ pos ] : null ; if ( o != null && ( type == null || o . getClass ( ) == type || type == JavaScriptObject . class &&... | Utility method for safety getting an object present at a certain position in the list of arguments composed by arrays . |
132,381 | public Object f ( Widget w , int i ) { setElement ( w . getElement ( ) ) ; setIndex ( i ) ; f ( w ) ; return null ; } | Override this for GQuery methods which loop over matched widgets and invoke a callback on each widget . |
132,382 | public void f ( int i , Object ... args ) { setIndex ( i ) ; setArguments ( args ) ; if ( args . length == 1 && args [ 0 ] instanceof JavaScriptObject ) { if ( JsUtils . isElement ( ( JavaScriptObject ) args [ 0 ] ) ) { setElement ( ( com . google . gwt . dom . client . Element ) args [ 0 ] ) ; f ( getElement ( ) , i )... | Override this method for bound callbacks . |
132,383 | public boolean f ( Event e , Object ... arg ) { setArguments ( arg ) ; setEvent ( e ) ; return f ( e ) ; } | Override this method for bound event handlers if you wish to deal with per - handler user data . |
132,384 | public void f ( Widget w ) { setElement ( w . getElement ( ) ) ; if ( loop ) { loop = false ; f ( ) ; } else { f ( w . getElement ( ) . < com . google . gwt . dom . client . Element > cast ( ) ) ; } } | Override this for GQuery methods which take a callback but do not expect a return value apply to a single widget . |
132,385 | public static Promise ajax ( Settings settings ) { resolveSettings ( settings ) ; final Function onSuccess = settings . getSuccess ( ) ; if ( onSuccess != null ) { onSuccess . setElement ( settings . getContext ( ) ) ; } final Function onError = settings . getError ( ) ; if ( onError != null ) { onError . setElement ( ... | Perform an ajax request to the server . |
132,386 | public static final < T extends JavaScriptObject > T checkNull ( T js ) { if ( ! GWT . isProdMode ( ) && js == null ) { throw new NullPointerException ( ) ; } return js ; } | Throw a NPE when a js is null . |
132,387 | public static < T > T prop ( JavaScriptObject o , Object id , Class < ? extends T > type ) { return o == null ? null : o . < JsCache > cast ( ) . get ( id , type ) ; } | Returns a property present in a javascript object . |
132,388 | public static void prop ( JavaScriptObject o , Object id , Object val ) { if ( o != null ) { o . < JsCache > cast ( ) . put ( id , val ) ; } } | Set a property to a javascript object . |
132,389 | public static < T > T exec ( JavaScriptObject jsFunction , Object ... args ) { assert isFunction ( jsFunction ) ; return jsni ( jsFunction , "call" , jsFunction , args ) ; } | Execute a native javascript function . |
132,390 | public static void export ( String name , Function f ) { export ( GQuery . window , name , f ) ; } | Assign a function to a property of the window object . |
132,391 | public static void export ( JavaScriptObject o , String name , Function f ) { prop ( o , name , ( Object ) ( f != null ? wrapFunction ( f ) : null ) ) ; } | Export a function as a property of a javascript object . |
132,392 | public static NodeList < Element > copyNodeList ( NodeList < Element > oldNodes , NodeList < Element > newNodes , boolean create ) { NodeList < Element > ret = oldNodes == null || create ? JsNodeArray . create ( ) : oldNodes ; JsCache idlist = JsCache . create ( ) ; for ( int i = 0 ; oldNodes != null && i < oldNodes . ... | Merge the oldNodes list into the newNodes one . If oldNodes is null a new list will be created and returned . If oldNodes is not null a new list will be created depending on the create flag . |
132,393 | public static Document getOwnerDocument ( Node n ) { return n == null || ! isElement ( n ) ? null : n . getNodeType ( ) == Node . DOCUMENT_NODE ? n . < Document > cast ( ) : n . getOwnerDocument ( ) ; } | Returns the owner document element of an element . |
132,394 | public static boolean isDetached ( Node n ) { assert n != null ; if ( "html" . equalsIgnoreCase ( n . getNodeName ( ) ) ) { return false ; } return ! getOwnerDocument ( n ) . getBody ( ) . isOrHasChild ( n ) ; } | Return whether a node is detached to the DOM . |
132,395 | public static boolean isXML ( Node o ) { return o == null ? false : ! "HTML" . equals ( getOwnerDocument ( o ) . getDocumentElement ( ) . getNodeName ( ) ) ; } | Check if an element is a DOM or a XML node . |
132,396 | public static Properties parseJSON ( String json ) { try { return utilsImpl . parseJSON ( json ) ; } catch ( Exception e ) { if ( ! GWT . isProdMode ( ) ) { System . err . println ( "Error while parsing json: " + e . getMessage ( ) + ".\n" + json ) ; } return Properties . create ( ) ; } } | Parses a json string returning a Object with useful method to get the content . |
132,397 | public static < T > T jsni ( JavaScriptObject jso , String meth , Object ... args ) { return runJavascriptFunction ( jso , meth , args ) ; } | Call any arbitrary function present in a Javascript object . It checks the existence of the function and object hierarchy before executing it . It s very useful in order to avoid writing jsni blocks for very simple snippets . |
132,398 | public static < T > T jsni ( String meth , Object ... args ) { return runJavascriptFunction ( null , meth , args ) ; } | Run any arbitrary function in javascript scope using the window as the base object . It checks the existence of the function and object hierarchy before executing it . It s very useful in order to avoid writing jsni blocks for very simple snippets . |
132,399 | public static < T > T runJavascriptFunction ( JavaScriptObject o , String meth , Object ... args ) { return runJavascriptFunctionImpl ( o , meth , JsObjectArray . create ( ) . add ( args ) . < JsArrayMixed > cast ( ) ) ; } | Call via jsni any arbitrary function present in a Javascript object . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.