idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
141,900
boolean checkAccessTopicGlobalAC ( UserContext ctx , String topic ) throws IllegalAccessException { logger . debug ( "Looking for accessController for topic '{}' from GlobalAccess" , topic ) ; Iterable < JsTopicAccessController > accessControls = topicAccessController . select ( DEFAULT_AT ) ; return checkAccessTopicFr...
Check if global access control is allowed
141,901
boolean checkAccessTopicFromJsTopicAccessControllers ( UserContext ctx , String topic , Iterable < JsTopicAccessController > controllers ) throws IllegalAccessException { logger . debug ( "Looking for accessController for topic '{}' from JsTopicAccessControllers" , topic ) ; for ( JsTopicAccessController jsTopicAccessC...
Check if specific access control is allowed from controllers
141,902
boolean checkAccessTopicFromController ( UserContext ctx , String topic , JsTopicAccessController jsTopicAccessController ) throws IllegalAccessException { logger . debug ( "Looking for accessController for topic '{}' from JsTopicAccessController {}" , topic , jsTopicAccessController ) ; JsTopicControls jsTopicControls...
Check if specific access control is allowed from controller
141,903
boolean checkAccessTopicFromControllers ( UserContext ctx , String topic , Iterable < JsTopicAccessController > accessControls ) throws IllegalAccessException { logger . debug ( "Looking for accessController for topic '{}' : '{}'" , topic , accessControls ) ; boolean tacPresent = false ; if ( null != accessControls ) {...
Check if access topic is granted by accessControls
141,904
boolean isJsonPayload ( Method method ) { if ( null == method || ! method . isAnnotationPresent ( JsTopic . class ) ) { return false ; } JsTopic jsTopic = method . getAnnotation ( JsTopic . class ) ; return jsTopic . jsonPayload ( ) ; }
The topic receive directly payload in json
141,905
JsTopicName getJsTopicNameAnnotation ( Annotation [ ] parameterAnnotations ) { for ( Annotation parameterAnnotation : parameterAnnotations ) { if ( parameterAnnotation . annotationType ( ) . equals ( JsTopicName . class ) ) { return ( JsTopicName ) parameterAnnotation ; } } return null ; }
Get JsTopicName annotation
141,906
String computeTopic ( JsTopicName jsTopicName , String topic ) { StringBuilder result = new StringBuilder ( ) ; if ( ! jsTopicName . prefix ( ) . isEmpty ( ) ) { result . append ( jsTopicName . prefix ( ) ) . append ( Constants . Topic . COLON ) ; } result . append ( topic ) ; if ( ! jsTopicName . postfix ( ) . isEmpty...
Compute full topicname from jsTopicName . prefix topic and jsTopicName . postfix
141,907
Object proceedAndSendMessage ( InvocationContext ctx , String topic , boolean jsonPayload ) throws Exception { MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( topic ) ; Object result = ctx . proceed ( ) ; if ( jsonPayload ) { if ( ! String . class . isInstance ( result ) ) { throw ...
Proceed the method and send MessageToClient to topic
141,908
public ComplexPixel mult ( double r , double i ) { double thisr = real ( ) , thisi = imag ( ) ; return setComplex ( thisr * r - thisi * i , thisr * i + thisi * r ) ; }
Multiplies a complex number to this pixel . This performs a complex multiplication and stores the result in this pixel .
141,909
public static void savePrivateKey ( OutputStream os , PrivateKey key , PrivateKeyEncoding encoding ) throws IOException { switch ( encoding ) { case PKCS_1 : savePrivateKeyPKCS1 ( os , key ) ; break ; case PKCS_8 : savePrivateKeyPKCS8 ( os , key ) ; break ; default : throw new IllegalArgumentException ( "Unsupported pr...
Serializes a private key to an output stream according to an encoding .
141,910
private static void savePrivateKeyPKCS8 ( OutputStream os , PrivateKey key ) throws IllegalArgumentException , IOException { CertificateUtils . savePrivateKey ( os , key , Encoding . PEM , null , null ) ; }
Serializes a private key to an output stream following the pkcs8 encoding .
141,911
private static void savePrivateKeyPKCS1 ( OutputStream os , PrivateKey key ) throws IllegalArgumentException , IOException { CertificateUtils . savePrivateKey ( os , key , Encoding . PEM , null , new char [ 0 ] , true ) ; }
Serializes a private key to an output stream following the pkcs1 encoding .
141,912
public static void saveProxyCredentials ( String proxyFileName , X509Credential uc , PrivateKeyEncoding encoding ) throws IOException { File f = new File ( proxyFileName ) ; RandomAccessFile raf = new RandomAccessFile ( f , "rws" ) ; FileChannel channel = raf . getChannel ( ) ; FilePermissionHelper . setProxyPermission...
Saves proxy credentials to a file . This method ensures that the stored proxy is saved with the appropriate file permissions .
141,913
Collection < Session > getValidSessionsElseRemove ( String httpid , Predicate < Session > predicat ) { Collection < Session > wss = new ArrayList ( ) ; if ( httpid_wss . containsKey ( httpid ) ) { Collection < Session > befores = httpid_wss . get ( httpid ) ; for ( Session before : befores ) { if ( predicat . test ( be...
Return all sessions for httpid and for the predicate if some session negate the predicate its are removed
141,914
public static void checkPrivateKeyPermissions ( String privateKeyFile ) throws IOException { for ( PosixFilePermission p : PRIVATE_KEY_PERMS ) { try { matchesFilePermissions ( privateKeyFile , p ) ; return ; } catch ( FilePermissionError e ) { } } final String errorMessage = String . format ( "Wrong file permissions on...
Checks whether a private key file has the right permissions
141,915
public static void matchesFilePermissions ( String filename , PosixFilePermission p ) throws IOException { filenameSanityChecks ( filename ) ; if ( p == null ) throw new NullPointerException ( "null permission passed as argument" ) ; File f = new File ( filename ) ; String canonicalPath = f . getCanonicalPath ( ) ; Str...
Checks that a given file has the appropriate unix permissions . This naive implementation just fetches the output of ls - al on a given file and matches the resulting string with the permissionString passed as argument .
141,916
public String getMd5 ( String msg ) { MessageDigest md ; try { md = getMessageDigest ( ) ; byte [ ] hash = md . digest ( msg . getBytes ( StandardCharsets . UTF_8 ) ) ; StringBuilder sb = new StringBuilder ( 2 * hash . length ) ; for ( byte b : hash ) { sb . append ( String . format ( "%02x" , b & 0xff ) ) ; } return s...
Create a md5 from string
141,917
Locale getLocale ( HandshakeRequest request ) { if ( null != request ) { Map < String , List < String > > headers = request . getHeaders ( ) ; if ( null != headers ) { List < String > accepts = headers . get ( HttpHeaders . ACCEPT_LANGUAGE ) ; logger . debug ( "Get accept-language from client headers : {}" , accepts ) ...
Return locale of client
141,918
public void modifyHandshake ( ServerEndpointConfig sec , HandshakeRequest request , HandshakeResponse response ) { sec . getUserProperties ( ) . put ( Constants . HANDSHAKEREQUEST , request ) ; super . modifyHandshake ( sec , request , response ) ; }
Set user information from open websocket
141,919
public boolean sendMessageToClient ( MessageFromClient message , Session client ) { MessageToClient mtc = messageToClientService . createMessageToClient ( message , client ) ; if ( mtc != null ) { client . getAsyncRemote ( ) . sendObject ( mtc ) ; return true ; } return false ; }
Build and send response messages after call request
141,920
protected void onBlock ( ConnectionFilter filter , String remoteAddr , int connections , int requests , int bytes ) { filter . disconnect ( ) ; filter . onDisconnect ( ) ; }
Called when connections requests or bytes reach to the limit .
141,921
public void setParameters ( int period , int connections , int requests , int bytes ) { this . period = period ; this . connections_ = connections ; this . requests_ = requests ; this . bytes_ = bytes ; }
Reset the parameters
141,922
public void sendObjectToTopic ( @ JsTopicEvent ( "" ) Object payload , EventMetadata metadata ) { MessageToClient msg = new MessageToClient ( ) ; InjectionPoint injectionPoint = metadata . getInjectionPoint ( ) ; Annotated annotated = injectionPoint . getAnnotated ( ) ; JsTopicEvent jte = annotated . getAnnotation ( Js...
Send message to topic
141,923
public void processJsCacheRemoveAll ( ) { logger . debug ( "Process JsCacheRemoveAll annotation" ) ; MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( Constants . Cache . CLEANCACHE_TOPIC ) ; messageToClient . setResponse ( Constants . Cache . ALL ) ; wsEvent . fire ( messageToClient...
Process annotation JsCacheRemoveAll and send message for suppress all the cache
141,924
public void processJsCacheRemove ( JsCacheRemove jcr , List < String > paramNames , List < String > jsonArgs ) { logger . debug ( "Process JsCacheRemove annotation : {}" , jcr ) ; MessageToClient messageToClient = new MessageToClient ( ) ; messageToClient . setId ( Constants . Cache . CLEANCACHE_TOPIC ) ; String argpar...
Process an annotation JsCacheRemove and send a removeCache message to all clients connected
141,925
String computeCacheKey ( Class cls , String methodName , String argpart ) { String cachekey = keyMaker . getMd5 ( cls . getName ( ) + "." + methodName ) ; if ( ! argpart . isEmpty ( ) ) { cachekey += "_" + keyMaker . getMd5 ( argpart ) ; } logger . debug ( "CACHEID : {}.{}_{} = {}" , cls . getName ( ) , methodName , ar...
Compute the cache key from classname methodname and args
141,926
public long processCacheAnnotations ( Method nonProxiedMethod , List < String > parameters ) { if ( isJsCached ( nonProxiedMethod ) ) { return jsCacheAnnotationServices . getJsCacheResultDeadline ( nonProxiedMethod . getAnnotation ( JsCacheResult . class ) ) ; } return 0L ; }
Process annotations JsCacheResult JsCacheRemove and JsCacheRemoves
141,927
boolean isJsCached ( Method nonProxiedMethod ) { boolean cached = nonProxiedMethod . isAnnotationPresent ( JsCacheResult . class ) ; logger . debug ( "The result of the method {} should be cached on client side {}." , nonProxiedMethod . getName ( ) , cached ) ; return cached ; }
Check if result should be cached in front - end
141,928
public void readDashboardRolesConfig ( @ Initialized ( ApplicationScoped . class ) ServletContext sc ) { readFromConfigurationRoles ( ) ; readFromInitParameter ( sc ) ; logger . debug ( "'{}' value : '{}'." , Constants . Options . DASHBOARD_ROLES , roles ) ; }
Read in web . xml and differents producers the optional DASHBOARD_ROLES config and set it in OcelotConfiguration
141,929
public Fault buildFault ( Throwable ex ) { Fault fault ; int stacktracelength = configuration . getStacktracelength ( ) ; if ( stacktracelength == 0 || logger . isDebugEnabled ( ) ) { logger . error ( "Invocation failed" , ex ) ; } fault = new Fault ( ex , stacktracelength ) ; return fault ; }
Build an fault Object from exception with stacktrace length from configuration
141,930
public void print ( final PrintStream out , final ICodingAnnotationStudy study , final ICodingAnnotationItem item ) { Map < Object , Map < Object , Double > > coincidence = CodingAnnotationStudy . countCategoryCoincidence ( item ) ; doPrint ( out , study , coincidence ) ; }
Print the coincidence matrix for the given annotation item .
141,931
public void print ( final PrintStream out , final Iterable < Object > categories , final IDistanceFunction distanceFunction ) { doPrint ( out , categories , null , distanceFunction ) ; }
Print a matrix of the distances between each pair of categories .
141,932
public void print ( final PrintStream out , final ICodingAnnotationStudy study , final IDistanceFunction distanceFunction ) { doPrint ( out , study . getCategories ( ) , study , distanceFunction ) ; }
Print a matrix representation of the distances between each pair of categories of the given study .
141,933
private boolean isViewElementFindableOrList ( Field field ) { Class < ? > fieldType = field . getType ( ) ; return View . class . isAssignableFrom ( fieldType ) || Element . class . isAssignableFrom ( fieldType ) || Findable . class . isAssignableFrom ( fieldType ) || List . class . isAssignableFrom ( fieldType ) ; }
Those are only supported types which make sense to look at .
141,934
private boolean isRequired ( Field field ) { return field . getAnnotation ( Require . class ) != null || ( field . getDeclaringClass ( ) . getAnnotation ( RequireAll . class ) != null && field . getAnnotation ( NotRequired . class ) == null ) ; }
Determines whether a field is required or not based on combination of Require RequireAll and NotRequired annotations .
141,935
public String getLiteralType ( Type type ) { String result = "" ; if ( type != null ) { if ( ParameterizedType . class . isAssignableFrom ( type . getClass ( ) ) ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; result = parameterizedType . toString ( ) ; } else { result = ( ( Class ) type ) . getC...
Return human reading of type
141,936
public IJsonMarshaller getJsonMarshaller ( Annotation [ ] annotations ) throws JsonMarshallerException { if ( annotations != null ) { for ( Annotation annotation : annotations ) { if ( JsonUnmarshaller . class . isAssignableFrom ( annotation . annotationType ( ) ) ) { return getJsonMarshallerFromAnnotation ( ( JsonUnma...
Return JsonUnmarshaller instance if annotation JsonUnmarshaller is present
141,937
public IJsonMarshaller getJsonMarshallerFromAnnotation ( JsonUnmarshaller jua ) throws JsonMarshallerException { if ( jua != null ) { return argumentServices . getIJsonMarshallerInstance ( jua . value ( ) ) ; } return null ; }
Return JsonUnmarshaller instance from annotation JsonUnmarshaller
141,938
public String getInstanceNameFromDataservice ( Class cls ) { DataService dataService = ( DataService ) cls . getAnnotation ( DataService . class ) ; String clsName = dataService . name ( ) ; if ( clsName . isEmpty ( ) ) { clsName = cls . getSimpleName ( ) ; } return getInstanceName ( clsName ) ; }
Get instancename from Dataservice Class
141,939
public boolean isConsiderateMethod ( Method method ) { if ( method . isAnnotationPresent ( TransientDataService . class ) || method . isAnnotationPresent ( WsDataService . class ) || method . getDeclaringClass ( ) . isAssignableFrom ( Object . class ) ) { return false ; } int modifiers = method . getModifiers ( ) ; ret...
Method is expose to frontend ?
141,940
Object getInstanceOfClass ( Class cls ) { if ( Boolean . class . isAssignableFrom ( cls ) || Boolean . TYPE . isAssignableFrom ( cls ) ) { return Boolean . FALSE ; } else if ( Integer . TYPE . isAssignableFrom ( cls ) || Short . TYPE . isAssignableFrom ( cls ) || Integer . class . isAssignableFrom ( cls ) || Short . cl...
Get instance for classic class
141,941
Object getObjectFromConstantFields ( Class cls ) { Field [ ] fields = cls . getFields ( ) ; Object instance = null ; for ( Field field : fields ) { instance = getObjectFromConstantField ( cls , field ) ; if ( instance != null ) { break ; } } return instance ; }
If the class has not empty constructor look static field if it return instance
141,942
String getTemplateOfParameterizedType ( ParameterizedType parameterizedType , IJsonMarshaller jsonMarshaller ) { Class cls = ( Class ) parameterizedType . getRawType ( ) ; Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ; String res ; if ( Iterable . class . isAssignableFrom ( cls ) ) { re...
Get template from parameterizedType
141,943
String getTemplateOfIterable ( Type [ ] actualTypeArguments , IJsonMarshaller jsonMarshaller ) { String res = "[" ; for ( Type actualTypeArgument : actualTypeArguments ) { String template = _getTemplateOfType ( actualTypeArgument , jsonMarshaller ) ; res += template + "," + template ; break ; } return res + "]" ; }
Get template of iterable class from generic type
141,944
String getTemplateOfMap ( Type [ ] actualTypeArguments , IJsonMarshaller jsonMarshaller ) { StringBuilder res = new StringBuilder ( "{" ) ; boolean first = true ; for ( Type actualTypeArgument : actualTypeArguments ) { if ( ! first ) { res . append ( ":" ) ; } res . append ( _getTemplateOfType ( actualTypeArgument , js...
Get template of map class from generic type
141,945
String getInstanceName ( String clsName ) { return clsName . substring ( 0 , 1 ) . toLowerCase ( Locale . ENGLISH ) + clsName . substring ( 1 ) ; }
Get instancename from clasname
141,946
public static < T > Builder < T , ItemListBox < T > > builder ( ) { return new Builder < T , ItemListBox < T > > ( new ItemListBox < T > ( ) ) ; }
Creates a new builder for an ItemListBox .
141,947
public boolean removeItem ( T item ) { int index = _items . indexOf ( item ) ; if ( index == - 1 ) { return false ; } _items . remove ( index ) ; removeItem ( index ) ; return true ; }
Removes the supplied item from this list box returning true if the item was found .
141,948
protected static boolean addRow ( SmartTable table , List < Widget > widgets ) { if ( widgets == null ) { return false ; } int row = table . getRowCount ( ) ; for ( int col = 0 ; col < widgets . size ( ) ; ++ col ) { table . setWidget ( row , col , widgets . get ( col ) ) ; table . getFlexCellFormatter ( ) . setStyleNa...
Convenience function to append a list of widgets to a table as a new row .
141,949
protected Field findField ( ) throws FinderFieldNotFoundException { try { if ( fieldName != null ) { return beanType . getField ( fieldName ) ; } try { return beanType . getField ( "find" ) ; } catch ( NoSuchFieldException e ) { return beanType . getField ( "FIND" ) ; } } catch ( NoSuchFieldException e ) { throw new Fi...
Find and return the find field .
141,950
public void setCellAlignment ( HasAlignment . HorizontalAlignmentConstant horiz , HasAlignment . VerticalAlignmentConstant vert ) { _cellHorizAlign = horiz ; _cellVertAlign = vert ; }
Configures the horizontal and vertical alignment of cells . This must be called before the grid is displayed .
141,951
protected void formatCell ( HTMLTable . CellFormatter formatter , int row , int col , int limit ) { formatter . setHorizontalAlignment ( row , col , _cellHorizAlign ) ; formatter . setVerticalAlignment ( row , col , _cellVertAlign ) ; formatter . setStyleName ( row , col , "Cell" ) ; if ( row == ( limit - 1 ) / _cols )...
Configures the formatting for a particular cell based on its location in the grid .
141,952
@ SuppressWarnings ( "unchecked" ) < C , T > Stage < T > doCollectEmpty ( final Function < ? super Collection < C > , ? extends T > collector ) { try { return this . completed ( collector . apply ( ( Collection < C > ) EMPTY_RESULTS ) ) ; } catch ( Exception e ) { return failed ( e ) ; } }
Shortcut for when the list of stages is empty .
141,953
< T , U > Stage < U > doStreamCollectEmpty ( final Consumer < ? super T > consumer , final Supplier < ? extends U > supplier ) { try { return this . completed ( supplier . get ( ) ) ; } catch ( Exception e ) { return failed ( e ) ; } }
Shortcut for when the list of stages is empty with stream collector .
141,954
< T , U > Stage < U > doStreamCollect ( final Collection < ? extends Stage < ? extends T > > stages , final Consumer < ? super T > consumer , final Supplier < ? extends U > supplier ) { final Completable < U > target = completable ( ) ; final StreamCollectHelper < ? super T , ? extends U > done = new StreamCollectHelpe...
Perform collection for stream collector .
141,955
< T , U > Stage < U > doEventuallyCollect ( final Collection < ? extends Callable < ? extends Stage < ? extends T > > > tasks , final Consumer < ? super T > consumer , Supplier < ? extends U > supplier , int parallelism ) { final ExecutorService executor = executor ( ) ; final Completable < U > stage = completable ( ) ...
Perform an eventual collection .
141,956
Stage < Void > doCollectAndDiscard ( Collection < ? extends Stage < ? > > stages ) { final Completable < Void > target = completable ( ) ; final CollectAndDiscardHelper done = new CollectAndDiscardHelper ( stages . size ( ) , target ) ; for ( final Stage < ? > q : stages ) { q . handle ( done ) ; } bindSignals ( target...
Perform a collect and discard .
141,957
void bindSignals ( final Stage < ? > target , final Collection < ? extends Stage < ? > > stages ) { target . whenCancelled ( ( ) -> { for ( final Stage < ? > f : stages ) { f . cancel ( ) ; } } ) ; }
Bind the given collection of stages to the target completable which if cancelled or failed will do the corresponding to their collection of stages .
141,958
public void onFailure ( Throwable cause ) { Console . log ( "Callback failure" , "for" , _trigger , cause ) ; setEnabled ( true ) ; reportFailure ( cause ) ; }
from interface AsyncCallback
141,959
public ClickCallback < T > setConfirmChoices ( String confirm , String abort ) { _confirmChoices = new String [ ] { confirm , abort } ; return this ; }
Configures the choices to be shown in the confirmation dialog .
141,960
protected void showError ( Throwable cause , Widget near ) { if ( near == null ) { Popups . error ( formatError ( cause ) ) ; } else { Popups . errorBelow ( formatError ( cause ) , near ) ; } }
Displays a popup reporting the specified error near the specified widget if it is non - null .
141,961
protected int addConfirmPopupMessage ( SmartTable contents , int row ) { if ( _confirmHTML ) { contents . setHTML ( row , 0 , _confirmMessage , 2 , "Message" ) ; } else { contents . setText ( row , 0 , _confirmMessage , 2 , "Message" ) ; } return row + 1 ; }
Adds the message area for the confirmation popup to the given row and returns the row to insert next .
141,962
private void createEnhancingMethods ( final Class < ? > resourceClass , final Object resourceInstance , final List < ModelProcessorUtil . Method > newMethods ) { final Template template = resourceClass . getAnnotation ( Template . class ) ; if ( template != null ) { final Class < ? > annotatedResourceClass = ModelHelpe...
Creates enhancing methods for given resource .
141,963
public void setHref ( String href ) { if ( _forceProtocol ) { if ( ! href . matches ( "^\\s*\\w+://.*" ) ) { href = "http://" + href ; } } else { if ( href . trim ( ) . toLowerCase ( ) . startsWith ( "javascript:" ) ) { href = "#" ; } } DOM . setElementProperty ( getElement ( ) , "href" , href ) ; }
Set the href location .
141,964
public static Document prepareForCloning ( Document domainXml ) { XPathFactory xpf = XPathFactory . instance ( ) ; domainXml . getRootElement ( ) . removeChild ( "uuid" ) ; XPathExpression < Element > macExpr = xpf . compile ( "/domain/devices/interface/mac" , Filters . element ( ) ) ; for ( Element mac : macExpr . eva...
remove elements that need to be unique per clone .
141,965
public static void join ( Object strand , long timeout , TimeUnit unit ) throws ExecutionException , InterruptedException , TimeoutException { Strand . join ( strand , timeout , unit ) ; }
Awaits the termination of a given strand at most for the timeout duration specified . This method blocks until this strand terminates or the timeout elapses .
141,966
static void log ( Object targetObj , String msg ) { if ( EventsParams . isDebug ( ) ) { Log . d ( TAG , toLogStr ( targetObj , msg ) ) ; } }
Logs target object
141,967
static void logE ( Object targetObj , String msg ) { Log . e ( TAG , toLogStr ( targetObj , msg ) ) ; }
Logs target object error
141,968
static void logE ( String eventKey , String msg ) { Log . e ( TAG , toLogStr ( eventKey , msg ) ) ; }
Logs event error
141,969
private static JFreeChart createChart ( String title , String xAxis , String yAxis1 , XYDataset dataset1 , String yAxis2 , XYDataset dataset2 ) { JFreeChart chart = ChartFactory . createXYLineChart ( title , xAxis , yAxis1 , dataset1 , PlotOrientation . VERTICAL , true , true , false ) ; final XYPlot plot = ( XYPlot ) ...
Creates a chart .
141,970
public static void showChart ( String name , String xAxis , String yAxis1 , XYDataset dataset1 , String yAxis2 , XYDataset dataset2 ) { final JFreeChart chart = createChart ( name , xAxis , yAxis1 , dataset1 , yAxis2 , dataset2 ) ; final ChartPanel chartPanel = createPanel ( chart ) ; final ApplicationFrame app = new A...
Starting point for the demonstration application .
141,971
public void submit ( final Metric metric ) { if ( metric != null ) { LOGGER . debug ( "Collecting metric: {}" , metric ) ; queue . offer ( metric ) ; } }
Submits a metric to the queue
141,972
public int flush ( final MetricSender sender ) throws IOException , HttpException { Preconditions . checkNotNull ( sender ) ; long currentMinute = ( System . currentTimeMillis ( ) / MS_IN_MIN ) * MS_IN_MIN ; LOGGER . debug ( "Flushing metrics < {}" , currentMinute ) ; LOGGER . debug ( "Metrics queue size {}" , queue . ...
Flushes all queued metrics to Stackify
141,973
public static InfoPopup infoOn ( String message , Widget target ) { return centerOn ( new InfoPopup ( message ) , target ) ; }
Displays an info message centered horizontally on the page and centered vertically on the specified target widget .
141,974
public static < T extends PopupPanel > T show ( T popup , Position pos , Widget target ) { popup . setVisible ( false ) ; popup . show ( ) ; int left , top ; switch ( pos ) { case RIGHT : left = target . getAbsoluteLeft ( ) + target . getOffsetWidth ( ) + NEAR_GAP ; break ; default : left = target . getAbsoluteLeft ( )...
Shows the supplied popup in the specified position relative to the specified target widget .
141,975
public static < T extends PopupPanel > T showAbove ( T popup , Widget target ) { return show ( popup , Position . ABOVE , target ) ; }
Shows the supplied popup panel near the specified target .
141,976
public static < T extends PopupPanel > T showOver ( T popup , Widget target ) { return show ( popup , Position . OVER , target ) ; }
Shows the supplied popup panel over the specified target .
141,977
public static < T extends PopupPanel > T showBelow ( T popup , Widget target ) { return show ( popup , Position . BELOW , target ) ; }
Shows the supplied popup panel below the specified target .
141,978
public static PopupPanel newPopup ( String styleName , Widget contents ) { PopupPanel panel = new PopupPanel ( ) ; panel . setStyleName ( styleName ) ; panel . setWidget ( contents ) ; return panel ; }
Creates and returns a new popup with the specified style name and contents .
141,979
public static PopupPanel newPopup ( String styleName , Widget contents , Position pos , Widget target ) { PopupPanel panel = newPopup ( styleName , contents ) ; show ( panel , pos , target ) ; return panel ; }
Creates a new popup with the specified style name and contents and shows it near the specified target widget . Returns the newly created popup .
141,980
public static ClickHandler createHider ( final PopupPanel popup ) { return new ClickHandler ( ) { public void onClick ( ClickEvent event ) { popup . hide ( ) ; } } ; }
Creates a click handler that hides the specified popup . Useful when creating popups that behave like menus .
141,981
public static void makeDraggable ( HasAllMouseHandlers dragHandle , PopupPanel target ) { DragHandler dragger = new DragHandler ( target ) ; dragHandle . addMouseDownHandler ( dragger ) ; dragHandle . addMouseUpHandler ( dragger ) ; dragHandle . addMouseMoveHandler ( dragger ) ; }
Adds mouse handlers to the specified drag handle that cause the supplied target popup to be dragged around the display . The drag handle is assumed to be a child of the popup .
141,982
public void setHTML ( int row , int column , String text , int colSpan , String ... styles ) { setHTML ( row , column , text ) ; if ( colSpan > 0 ) { getFlexCellFormatter ( ) . setColSpan ( row , column , colSpan ) ; } setStyleNames ( row , column , styles ) ; }
Sets the HTML in the specified cell with the specified style and column span .
141,983
public int addText ( Object text , int colSpan , String ... styles ) { int row = getRowCount ( ) ; setText ( row , 0 , text , colSpan , styles ) ; return row ; }
Adds text to the bottom row of this table in column zero with the specified column span and style .
141,984
public int addWidget ( Widget widget , int colSpan , String ... styles ) { int row = getRowCount ( ) ; setWidget ( row , 0 , widget , colSpan , styles ) ; return row ; }
Adds a widget to the bottom row of this table in column zero with the specified column span and style .
141,985
public void setStyleNames ( int row , int column , String ... styles ) { int idx = 0 ; for ( String style : styles ) { if ( idx ++ == 0 ) { getFlexCellFormatter ( ) . setStyleName ( row , column , style ) ; } else { getFlexCellFormatter ( ) . addStyleName ( row , column , style ) ; } } }
Configures the specified style names on the specified row and column . The first style is set as the primary style and additional styles are added onto that .
141,986
public void setColumnCellStyles ( int column , String ... styles ) { int rowCount = getRowCount ( ) ; for ( int row = 0 ; row < rowCount ; ++ row ) { setStyleNames ( row , column , styles ) ; } }
Sets the style of all cells in the given column to the given values . The first style is set as the primary style and additional styles are added onto that .
141,987
public void removeStyleNames ( int row , int column , String ... styles ) { for ( String style : styles ) { getFlexCellFormatter ( ) . removeStyleName ( row , column , style ) ; } }
Removes the specified style names on the specified row and column .
141,988
public MethodCall with ( String name1 , Object arg1 ) { return with ( name1 , arg1 , null , null , null , null ) ; }
Add the single argument .
141,989
public MethodCall with ( String name1 , Object arg1 , String name2 , Object arg2 ) { return with ( name1 , arg1 , name2 , arg2 , null , null ) ; }
Add the two arguments .
141,990
public MethodCall with ( String name1 , Object arg1 , String name2 , Object arg2 , String name3 , Object arg3 , String name4 , Object arg4 ) { args . put ( name1 , arg1 ) ; if ( name2 != null ) { args . put ( name2 , arg2 ) ; if ( name3 != null ) { args . put ( name3 , arg3 ) ; if ( name4 != null ) { args . put ( name4...
Add four arguments .
141,991
public static < K , V > Function < K , V > forMap ( final Map < K , ? extends V > map , final V defaultValue ) { return new Function < K , V > ( ) { public V apply ( K key ) { V value = map . get ( key ) ; return ( value != null || map . containsKey ( key ) ) ? value : defaultValue ; } } ; }
Returns a function which performs a map lookup with a default value . The function created by this method returns defaultValue for all inputs that do not belong to the map s key set .
141,992
public static < T > Function < T , Boolean > forPredicate ( final Predicate < T > predicate ) { return new Function < T , Boolean > ( ) { public Boolean apply ( T arg ) { return predicate . apply ( arg ) ; } } ; }
Returns a function that returns the same boolean output as the given predicate for all inputs .
141,993
public static Set < String > getOvercastPropertyNames ( final String path ) { Config overcastConfig = getOvercastConfig ( ) ; if ( ! overcastConfig . hasPath ( path ) ) { return new HashSet < > ( ) ; } Config cfg = overcastConfig . getConfig ( path ) ; Set < String > result = new HashSet < > ( ) ; for ( Map . Entry < S...
Get set of property names directly below path .
141,994
public static int getScrollIntoView ( Widget target ) { int top = Window . getScrollTop ( ) , height = Window . getClientHeight ( ) ; int ttop = target . getAbsoluteTop ( ) , theight = target . getOffsetHeight ( ) ; if ( theight > height || ttop < top ) { return ttop ; } else if ( ttop + theight > top + height ) { retu...
Returns the vertical scroll position needed to place the specified target widget in view while trying to minimize scrolling .
141,995
public static int getScrollToMiddle ( Widget target ) { int wheight = Window . getClientHeight ( ) , theight = target . getOffsetHeight ( ) ; int ttop = target . getAbsoluteTop ( ) ; return Math . max ( ttop , ttop + ( wheight - theight ) ) ; }
Returns the vertical scroll position needed to center the target widget vertically in the browser viewport . If the widget is taller than the viewport its top is returned .
141,996
public static boolean isScrolledIntoView ( Widget target , int minPixels ) { int wtop = Window . getScrollTop ( ) , wheight = Window . getClientHeight ( ) ; int ttop = target . getAbsoluteTop ( ) ; if ( ttop > wtop ) { return ( wtop + wheight - ttop > minPixels ) ; } else { return ( ttop + target . getOffsetHeight ( ) ...
Returns true if the target widget is vertically scrolled into view .
141,997
public static MetricAggregate fromMetricIdentity ( final MetricIdentity identity , final long currentMinute ) { Preconditions . checkNotNull ( identity ) ; return new MetricAggregate ( identity , currentMinute ) ; }
Creates a MetricAggregate
141,998
public static void log ( String message , Object ... args ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( message ) ; if ( args . length > 1 ) { sb . append ( " [" ) ; for ( int ii = 0 , ll = args . length / 2 ; ii < ll ; ii ++ ) { if ( ii > 0 ) { sb . append ( ", " ) ; } sb . append ( args [ 2 * ii ] ) . ...
Formats and logs a message . If we are running in HostedMode the log message will be reported to its console . If we re running in Firefox the log message will be sent to Firebug if it is enabled .
141,999
public static void main ( String [ ] args ) { if ( args . length <= 1 ) { System . err . println ( "Usage: I18nSyncTask rootDir rootDir/com/mypackage/Foo.properties " + "[.../Bar.properties ...]" ) ; System . exit ( 255 ) ; } File rootDir = new File ( args [ 0 ] ) ; if ( ! rootDir . isDirectory ( ) ) { System . err . p...
Entry point for command line tool .