idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
39,800 | public void clear ( ) { itemBox . setValue ( "" ) ; label . removeStyleName ( CssName . ACTIVE ) ; Collection < Widget > values = suggestionMap . values ( ) ; for ( Widget widget : values ) { Widget parent = widget . getParent ( ) ; if ( parent instanceof ListItem ) { parent . removeFromParent ( ) ; } } suggestionMap .... | Clear the chip items on the autocomplete box |
39,801 | protected String nativeCaptureToDataURL ( CanvasElement canvas , Element element , String mimeType ) { VideoElement videoElement = ( VideoElement ) element ; int width = videoElement . getVideoWidth ( ) ; int height = videoElement . getVideoHeight ( ) ; if ( Double . isNaN ( width ) || Double . isNaN ( height ) ) { wid... | Native call to capture the frame of the video stream . |
39,802 | public static boolean isSupported ( ) { return Navigator . webkitGetUserMedia != null || Navigator . getUserMedia != null || Navigator . mozGetUserMedia != null || Navigator . msGetUserMedia != null ; } | Tests if the browser supports the Streams API . This should be called before creating any MaterialCameraCapture widgets to avoid errors on the browser . |
39,803 | public void setLineDistanceWidth ( int lineDistanceWidth ) { if ( divLine . isAttached ( ) ) { divLine . setWidth ( lineDistanceWidth + "px" ) ; } else { divLine . addAttachHandler ( event -> divLine . setWidth ( lineDistanceWidth + "px" ) ) ; } } | Will set the distance width of the step line from another step . |
39,804 | public void crop ( String url , Type type ) { setUrl ( url ) ; bind ( url , ( ) -> crop ( type ) ) ; } | Cropped the image with given URL and result type |
39,805 | public void bind ( String url , Functions . Func callback ) { cropper . croppie ( "bind" , url ) . then ( ( result , object ) -> { callback . call ( ) ; return true ; } ) ; } | Bind an image the cropper . Returns a promise to be resolved when the image has been loaded and the cropper has been initialized . |
39,806 | public void setPopupPosition ( int popupX , int popupY ) { this . popupX = popupX ; this . popupY = popupY ; setLeft ( popupX ) ; setTop ( popupY ) ; } | Set the popup position of the context menu |
39,807 | protected void masonryRemove ( Widget target ) { this . target = target ; if ( target != sizerDiv ) { super . remove ( target ) ; reload ( ) ; } } | Remove the item with Masonry support |
39,808 | protected void revalidateLayout ( ) { for ( MaterialIcon icon : iconList ) { icon . removeFromParent ( ) ; } iconList . clear ( ) ; MouseOutHandler outHandler = event -> { if ( ! isEnabled ( ) || ! isEditable ( ) ) { return ; } revalidateSelection ( currentRating ) ; } ; for ( int i = 0 ; i < maxRating ; i ++ ) { final... | Method called internally by the component to re - validate the number of icons when the maximum rating is changed . |
39,809 | protected void revalidateSelection ( int rating ) { for ( MaterialIcon icon : iconList ) { icon . removeStyleName ( AddinsCssName . MATERIAL_RATING_UNSELECTED ) ; icon . removeStyleName ( AddinsCssName . MATERIAL_RATING_SELECTED ) ; } for ( int i = 0 ; i < rating && i < iconList . size ( ) ; i ++ ) { MaterialIcon icon ... | Method called internally by the component to revalidade selections by the user switching the icons accordingly . |
39,810 | public void setDimension ( int width , int height ) { setWidth ( String . valueOf ( width ) ) ; setHeight ( String . valueOf ( height ) ) ; reload ( ) ; } | Allowing to set the dimension of the Avatar component . |
39,811 | public static void animate ( Widget source , final Widget target ) { animate ( source . getElement ( ) , target . getElement ( ) ) ; } | Helper method to apply the path animator . |
39,812 | public static void reverseAnimate ( final Widget source , final Widget target ) { reverseAnimate ( source . getElement ( ) , target . getElement ( ) ) ; } | Helper method to reverse animate the source element to target element . |
39,813 | public static void reverseAnimate ( Widget source , Widget target , Functions . Func reverseCallback ) { reverseAnimate ( source . getElement ( ) , target . getElement ( ) , reverseCallback ) ; } | Helper method to reverse animate the source element to target element with reverse callback . |
39,814 | public static void reverseAnimate ( Element sourceElement , Element targetElement , Functions . Func reverseCallback ) { MaterialPathAnimator animator = new MaterialPathAnimator ( ) ; animator . setSourceElement ( sourceElement ) ; animator . setTargetElement ( targetElement ) ; animator . setReverseCallback ( reverseC... | Helper method to reverse animate the source element to target element with reverse callback |
39,815 | public void setValue ( Double value , boolean fireEvents , boolean autoStart ) { super . setValue ( value , fireEvents ) ; setEndValue ( value ) ; if ( autoStart ) { start ( ) ; } } | Provide a better control whether you want to automatically start the counting of the new value . By Default it will start counting with the given value . |
39,816 | public void open ( ) { if ( ! isAttached ( ) ) { RootPanel . get ( ) . add ( this ) ; } windowCount ++ ; if ( windowOverlay != null && ! windowOverlay . isAttached ( ) ) { RootPanel . get ( ) . add ( windowOverlay ) ; } if ( fullsceenOnMobile && Window . matchMedia ( Resolution . ALL_MOBILE . asMediaQuery ( ) ) ) { set... | Open the window . |
39,817 | public void close ( ) { RootPanel . get ( ) . getElement ( ) . getStyle ( ) . setCursor ( Style . Cursor . DEFAULT ) ; windowCount -- ; if ( closeAnimation == null ) { getOpenMixin ( ) . setOn ( false ) ; if ( windowOverlay != null && windowOverlay . isAttached ( ) && windowCount < 1 ) { windowOverlay . removeFromParen... | Close the window . |
39,818 | protected void expandItems ( MaterialTreeItem item ) { item . expand ( ) ; item . setHide ( true ) ; item . getTreeItems ( ) . forEach ( this :: expandItems ) ; } | Recursive function to expand each tree item . |
39,819 | public void deselectSelectedItem ( ) { if ( selectedItem != null ) { clearSelectedStyles ( selectedItem ) ; setSelectedItem ( null ) ; SelectionEvent . fire ( this , null ) ; } } | Deselect selected tree item |
39,820 | protected void collapseItems ( MaterialTreeItem item ) { item . collapse ( ) ; item . setHide ( false ) ; item . getTreeItems ( ) . forEach ( this :: collapseItems ) ; } | Recursive function to collapse each tree item . |
39,821 | public void nextStep ( ) { if ( currentStepIndex >= getWidgetCount ( ) - 1 ) { CompleteEvent . fire ( MaterialStepper . this , currentStepIndex + 1 ) ; } else { Widget w = getWidget ( currentStepIndex ) ; if ( w instanceof MaterialStep ) { MaterialStep step = ( MaterialStep ) w ; step . setActive ( false ) ; step . set... | Go to next step used by linear stepper . |
39,822 | public void prevStep ( ) { if ( currentStepIndex > 0 ) { Widget w = getWidget ( currentStepIndex ) ; if ( w instanceof MaterialStep ) { MaterialStep step = ( MaterialStep ) w ; step . setActive ( false ) ; int prevStepIndex = getWidgetIndex ( step ) - 1 ; if ( prevStepIndex >= 0 ) { for ( int i = prevStepIndex ; i >= 0... | Go to previous step used by linear stepper . |
39,823 | public void goToStep ( int step ) { for ( int i = 0 ; i < getWidgetCount ( ) ; i ++ ) { Widget w = getWidget ( i ) ; if ( w instanceof MaterialStep ) { ( ( MaterialStep ) w ) . setActive ( false ) ; } } Widget w = getWidget ( step - 1 ) ; if ( w instanceof MaterialStep ) { ( ( MaterialStep ) w ) . setActive ( true ) ; ... | Go to specific step manually by setting which step index you want to go . |
39,824 | public void goToStepId ( int id ) { for ( int i = 0 ; i < getWidgetCount ( ) ; i ++ ) { Widget w = getWidget ( i ) ; if ( w instanceof MaterialStep ) { MaterialStep materialStep = ( MaterialStep ) w ; boolean active = materialStep . getStep ( ) == id ; materialStep . setActive ( active ) ; if ( active ) { setCurrentSte... | Go to the step with the specified step id . |
39,825 | public MaterialStep getCurrentStep ( ) { if ( currentStepIndex > getWidgetCount ( ) - 1 || currentStepIndex < 0 ) { return null ; } Widget w = getWidget ( currentStepIndex ) ; if ( w instanceof MaterialStep ) { return ( MaterialStep ) w ; } return null ; } | Gets the current step component . |
39,826 | public void showFeedback ( String feedbackText ) { feedbackSpan . setText ( feedbackText ) ; new MaterialAnimation ( ) . transition ( Transition . FADEINUP ) . duration ( 400 ) . animate ( feedbackSpan ) ; MaterialLoader . loading ( true , getCurrentStep ( ) . getDivBody ( ) ) ; add ( divFeedback ) ; } | Show feedback message and circular loader on body container |
39,827 | public void onSelection ( SelectionEvent < MaterialStep > event ) { if ( stepSkippingAllowed ) { if ( event . getSelectedItem ( ) . getState ( ) == State . SUCCESS ) { goToStep ( event . getSelectedItem ( ) ) ; } } } | Called when a step title is clicked . |
39,828 | public void open ( ) { setCutOutStyle ( ) ; if ( targetElement == null ) { throw new IllegalStateException ( "The target element should be set before calling open()." ) ; } targetElement . scrollIntoView ( ) ; if ( computedBackgroundColor == null ) { setupComputedBackgroundColor ( ) ; } Style docStyle = Document . get ... | Opens the dialog cut out taking all the screen . The target element should be set before calling this method . |
39,829 | public void close ( boolean autoClosed ) { Document . get ( ) . getDocumentElement ( ) . getStyle ( ) . setProperty ( "overflow" , viewportOverflow ) ; getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; getHandlerRegistry ( ) . clearHandlers ( ) ; if ( autoAddedToDocument ) { this . removeFromParent ( ) ; ... | Closes the cut out . |
39,830 | protected void setupWindowHandlers ( ) { registerHandler ( Window . addResizeHandler ( event -> setupCutOutPosition ( focusElement , targetElement , cutOutPadding , circle ) ) ) ; registerHandler ( Window . addWindowScrollHandler ( event -> setupCutOutPosition ( focusElement , targetElement , cutOutPadding , circle ) )... | Configures a resize handler and a scroll handler on the window to properly adjust the Cut Out . |
39,831 | protected void setupComputedBackgroundColor ( ) { MaterialWidget temp = new MaterialWidget ( Document . get ( ) . createDivElement ( ) ) ; temp . setBackgroundColor ( backgroundColor ) ; Style style = temp . getElement ( ) . getStyle ( ) ; style . setPosition ( Position . FIXED ) ; style . setWidth ( 1 , Unit . PX ) ; ... | Gets the computed background color based on the backgroundColor CSS class . |
39,832 | public void setLanguage ( Language language ) { this . language = language ; this . label . setText ( language . getName ( ) ) ; this . image . setUrl ( language . getImage ( ) ) ; } | Update the ui for the name and image components . |
39,833 | protected UploadFile convertUploadFile ( File file ) { Date lastModifiedDate = new Date ( ) ; if ( file . lastModifiedDate != null && ! file . lastModifiedDate . isEmpty ( ) ) { lastModifiedDate = new Date ( file . lastModifiedDate ) ; } return new UploadFile ( file . name , lastModifiedDate , Double . parseDouble ( fi... | Converts a Native File Object to Upload File object |
39,834 | public double getThickness ( ) { return options . thickness != null ? Double . parseDouble ( options . thickness . replace ( "px" , "" ) ) : null ; } | Get the bar s thickness in px . |
39,835 | public Axis getAxis ( ) { return options . orientation != null ? Axis . fromStyleName ( options . orientation ) : null ; } | Get the axis orientation of splitter component . |
39,836 | public Dock getDock ( ) { return options . dock != null ? Dock . fromStyleName ( options . dock ) : null ; } | Get the dock value . |
39,837 | public void addItem ( String text , T value , OptGroup optGroup ) { if ( ! values . contains ( value ) ) { values . add ( value ) ; optGroup . add ( buildOption ( text , value ) ) ; } } | Add item directly to combobox component with existing OptGroup |
39,838 | public Option addItem ( String text , T value ) { if ( ! values . contains ( value ) ) { Option option = buildOption ( text , value ) ; values . add ( value ) ; listbox . add ( option ) ; return option ; } return null ; } | Add Value directly to combobox component |
39,839 | protected Option buildOption ( String text , T value ) { Option option = new Option ( ) ; option . setText ( text ) ; option . setValue ( keyFactory . generateKey ( value ) ) ; return option ; } | Build the Option Element with provided params |
39,840 | public T getSingleValue ( ) { List < T > values = getSelectedValue ( ) ; if ( ! values . isEmpty ( ) ) { return values . get ( 0 ) ; } return null ; } | Only return a single value even if multi support is activate . |
39,841 | public void setSingleValue ( T value , boolean fireEvents ) { int index = this . values . indexOf ( value ) ; if ( index < 0 && value instanceof String ) { index = getIndexByString ( ( String ) value ) ; } if ( index > - 1 ) { List < T > before = getValue ( ) ; setSelectedIndex ( index ) ; if ( fireEvents ) { ValueChan... | Set the selected value using a single item generally used in single selection mode . |
39,842 | public void setFillColor ( Color fillColor ) { this . fillColor = fillColor ; options . fill = ColorHelper . setupComputedBackgroundColor ( fillColor ) ; } | Set the fillColor of the circular progress |
39,843 | public void setEmptyFillColor ( Color emptyFillColor ) { this . emptyFillColor = emptyFillColor ; options . emptyFill = ColorHelper . setupComputedBackgroundColor ( emptyFillColor ) ; } | Set the empty fill color of the circular progress |
39,844 | public void add ( String text , Image image ) { this . imageElem = image . getElement ( ) . toString ( ) ; add ( text + image ) ; } | Autocomplete with Image item selection . |
39,845 | public void recycle ( RecyclePosition position ) { stubCount = determineStubCount ( ) ; switch ( position ) { case BOTTOM : if ( hasRecycledWidgets ( ) ) { remove ( getRecycledWidgets ( ) . stream ( ) . skip ( 0 ) . limit ( ( parent . getLimit ( ) * ( currentIndex + 1 ) ) - stubCount ) . collect ( Collectors . toList (... | Will recycle the provided widgets ( |
39,846 | public List < Widget > getRecycledWidgets ( ) { List < Widget > widgets = new ArrayList < > ( ) ; for ( Integer recycledIndex : recycledWidgets . keySet ( ) ) { widgets . addAll ( recycledWidgets . get ( recycledIndex ) ) ; } return widgets ; } | Get all recycled widgets |
39,847 | protected void executeSassScript ( String sassScript ) throws MojoExecutionException , MojoFailureException { final Log log = this . getLog ( ) ; System . setProperty ( "org.jruby.embed.localcontext.scope" , "threadsafe" ) ; log . debug ( "Execute SASS Ruby Script:\n" + sassScript ) ; final ScriptEngineManager scriptEn... | Execute the SASS Compilation Ruby Script |
39,848 | public final VH onCreateViewHolder ( ViewGroup parent , int viewType ) { VH viewHolder ; if ( isHeaderType ( viewType ) ) { viewHolder = onCreateHeaderViewHolder ( parent , viewType ) ; } else if ( isFooterType ( viewType ) ) { viewHolder = onCreateFooterViewHolder ( parent , viewType ) ; } else { viewHolder = onCreate... | Invokes onCreateHeaderViewHolder onCreateItemViewHolder or onCreateFooterViewHolder methods based on the view type param . |
39,849 | public final void onBindViewHolder ( VH holder , int position ) { if ( isHeaderPosition ( position ) ) { onBindHeaderViewHolder ( holder , position ) ; } else if ( isFooterPosition ( position ) ) { onBindFooterViewHolder ( holder , position ) ; } else { onBindItemViewHolder ( holder , position ) ; } } | Invokes onBindHeaderViewHolder onBindItemViewHolder or onBindFooterViewHOlder methods based on the position param . |
39,850 | public int getItemViewType ( int position ) { int viewType = TYPE_ITEM ; if ( isHeaderPosition ( position ) ) { viewType = TYPE_HEADER ; } else if ( isFooterPosition ( position ) ) { viewType = TYPE_FOOTER ; } return viewType ; } | Returns the type associated to an item given a position passed as arguments . If the position is related to a header item returns the constant TYPE_HEADER or TYPE_FOOTER if the position is related to the footer if not returns TYPE_ITEM . |
39,851 | public int getItemCount ( ) { int size = items . size ( ) ; if ( hasHeader ( ) ) { size ++ ; } if ( hasFooter ( ) ) { size ++ ; } return size ; } | Returns the items list size if there is no a header configured or the size taking into account that if a header or a footer is configured the number of items returned is going to include this elements . |
39,852 | Point getPointForID ( int id ) { for ( int i = 0 ; i < pointCount ; i ++ ) { if ( id == - 1 || points [ i ] . id == id ) { return points [ i ] ; } } return null ; } | Gets the Point matching the given ID . if available |
39,853 | void assignPrimaryID ( ) { if ( pointCount == 0 ) { primaryID = - 1 ; } else if ( primaryID <= 0 ) { primaryID = points [ 0 ] . id ; } else { for ( int i = 0 ; i < pointCount ; i ++ ) { if ( points [ i ] . id == primaryID ) { return ; } } primaryID = points [ 0 ] . id ; } } | Updates the primary point ID |
39,854 | Point addPoint ( Point p ) { if ( points . length == pointCount ) { points = Arrays . copyOf ( points , points . length * 2 ) ; } if ( points [ pointCount ] == null ) { points [ pointCount ] = new Point ( ) ; } if ( p != null ) { p . copyTo ( points [ pointCount ] ) ; } return points [ pointCount ++ ] ; } | Adds a Point to this state object . |
39,855 | void removePointForID ( int id ) { for ( int i = 0 ; i < pointCount ; i ++ ) { if ( points [ i ] . id == id ) { if ( i < pointCount - 1 ) { System . arraycopy ( points , i + 1 , points , i , pointCount - i - 1 ) ; points [ pointCount - 1 ] = null ; } pointCount -- ; } } } | Removes the point with the given ID |
39,856 | void setPoint ( int index , Point p ) { if ( index >= pointCount ) { throw new IndexOutOfBoundsException ( ) ; } p . copyTo ( points [ index ] ) ; } | Replaces the touch point data at the given index with the given touch point data |
39,857 | boolean equalsSorted ( TouchState ts ) { if ( ts . pointCount == pointCount && ts . primaryID == primaryID && ts . window == window ) { for ( int i = 0 ; i < pointCount ; i ++ ) { Point p1 = ts . points [ i ] ; Point p2 = points [ i ] ; if ( p1 . x != p2 . x || p1 . y != p2 . y || p1 . id != p2 . id ) { return false ; ... | Compare two non - null states whose points are sorted by ID |
39,858 | boolean canBeFoldedWith ( TouchState ts , boolean ignoreIDs ) { if ( ts . pointCount != pointCount ) { return false ; } if ( ignoreIDs ) { return true ; } for ( int i = 0 ; i < pointCount ; i ++ ) { if ( ts . points [ i ] . id != points [ i ] . id ) { return false ; } } return true ; } | Finds out whether two non - null states are identical in everything but their touch point coordinates |
39,859 | int getValue ( LinuxEventBuffer buffer ) { int axis = buffer . getEventCode ( ) ; int value = buffer . getEventValue ( ) ; int i ; for ( i = 0 ; i < axes . length && axes [ i ] != - 1 ; i ++ ) { if ( axes [ i ] == axis ) { return transform ( i , value ) ; } } if ( i == axes . length ) { axes = Arrays . copyOf ( axes , ... | Gets the transformed pixel coordinate of the current event in the buffer provided . |
39,860 | int getAxis ( LinuxEventBuffer buffer ) { int axis = buffer . getEventCode ( ) ; if ( flipXY ) { switch ( axis ) { case LinuxInput . ABS_X : return LinuxInput . ABS_Y ; case LinuxInput . ABS_Y : return LinuxInput . ABS_X ; case LinuxInput . ABS_MT_POSITION_X : return LinuxInput . ABS_MT_POSITION_Y ; case LinuxInput . A... | Gets the transformed axis number of the current event in the buffer provided . |
39,861 | MonocleWindow getWindow ( boolean recalculateCache ) { if ( window == null || recalculateCache ) { window = ( MonocleWindow ) MonocleWindowManager . getInstance ( ) . getFocusedWindow ( ) ; } return window ; } | Returns the Glass window on which this event state is located . |
39,862 | protected void pushToSystem ( HashMap < String , Object > cacheData , int supportedActions ) { MouseInput . getInstance ( ) . notifyDragStart ( ) ; ( ( MonocleApplication ) Application . GetApplication ( ) ) . enterDnDEventLoop ( ) ; actionPerformed ( Clipboard . ACTION_COPY_OR_MOVE ) ; } | Here the magic happens . When this method is called all input events should be grabbed and appropriate drag notifications should be sent instead of regular input events |
39,863 | void add ( TouchPipeline pipeline ) { for ( int i = 0 ; i < pipeline . filters . size ( ) ; i ++ ) { addFilter ( pipeline . filters . get ( i ) ) ; } } | Adds the filters in the given pipeline to this pipeline |
39,864 | void addNamedFilters ( String filterNameList ) { String [ ] touchFilterNames = filterNameList . split ( "," ) ; if ( touchFilterNames != null ) { for ( String touchFilterName : touchFilterNames ) { String s = touchFilterName . trim ( ) ; if ( s . length ( ) > 0 ) { addNamedFilter ( s ) ; } } } } | Attempts to add the filters named in the comma - separated list provided . |
39,865 | void flush ( ) { for ( int i = 0 ; i < filters . size ( ) ; i ++ ) { TouchFilter filter = filters . get ( i ) ; while ( filter . flush ( flushState ) ) { if ( MonocleSettings . settings . traceEventsVerbose ) { MonocleTrace . traceEvent ( "Flushing %s from %s" , flushState , filter ) ; } boolean consumed = false ; for ... | Flushes any remaining data in the pipeline possibly pushing more state objects to TouchInput . |
39,866 | public static synchronized NativePlatform getNativePlatform ( ) { if ( platform == null ) { String platformFactoryProperty = AccessController . doPrivileged ( ( PrivilegedAction < String > ) ( ) -> System . getProperty ( "monocle.platform" , "MX6,OMAP,Dispman,Android,X11,Linux,Headless" ) ) ; String [ ] platformFactori... | Obtains a NativePlatform that matches the platform on which we are running . |
39,867 | static synchronized Udev getInstance ( ) { if ( instance == null ) { try { instance = new Udev ( ) ; } catch ( IOException e ) { System . err . println ( "Udev: failed to open connection" ) ; e . printStackTrace ( ) ; } } return instance ; } | Gets the singleton Udev object |
39,868 | private Map < String , String > readEvent ( ) throws IOException { Map < String , String > map = new HashMap < > ( ) ; ByteBuffer b ; synchronized ( this ) { b = buffer ; if ( b == null ) { return map ; } } int length = _readEvent ( fd , b ) ; synchronized ( this ) { if ( buffer == null ) { return map ; } int propertie... | Reads data from the udev monitor . Blocks until data is available |
39,869 | synchronized void close ( ) { thread . interrupt ( ) ; _close ( fd ) ; fd = 0l ; buffer = null ; thread = null ; } | Closes the udev monitor connection |
39,870 | synchronized boolean put ( ByteBuffer event ) throws InterruptedException { boolean isSync = event . getInt ( eventStruct . getTypeIndex ( ) ) == 0 && event . getInt ( eventStruct . getValueIndex ( ) ) == 0 ; while ( bb . limit ( ) - bb . position ( ) < event . limit ( ) ) { if ( MonocleSettings . settings . traceEvent... | Adds a raw Linux event to the buffer . Blocks if the buffer is full . Checks whether this is a SYN SYN_REPORT event terminator . |
39,871 | synchronized void nextEvent ( ) { if ( currentPosition > positionOfLastSync ) { throw new IllegalStateException ( "Cannot advance past the last" + " EV_SYN EV_SYN_REPORT 0" ) ; } currentPosition += eventStruct . getSize ( ) ; if ( MonocleSettings . settings . traceEventsVerbose && hasNextEvent ( ) ) { MonocleTrace . tr... | Advances to the next event line . Call from the application thread . |
39,872 | static String typeToString ( short type ) { for ( Field field : LinuxInput . class . getDeclaredFields ( ) ) { try { if ( field . getName ( ) . startsWith ( "EV_" ) && field . getType ( ) == Short . TYPE && field . getShort ( null ) == type ) { return field . getName ( ) ; } } catch ( IllegalAccessException e ) { } } r... | Convert an event type to its equivalent string . This method is inefficient and is for debugging use only . |
39,873 | static String codeToString ( String type , short code ) { int i = type . indexOf ( "_" ) ; if ( i >= 0 ) { String prefix = type . substring ( i + 1 ) ; String altPrefix = prefix . equals ( "KEY" ) ? "BTN" : prefix ; for ( Field field : LinuxInput . class . getDeclaredFields ( ) ) { String name = field . getName ( ) ; t... | Convert an event code to its equivalent string given its type string . The type string is needed because event codes are context sensitive . For example the code 1 is SYN_CONFIG for an EV_SYN event but KEY_ESC for an EV_KEY event . This method is inefficient and is for debugging use only . |
39,874 | static Map < Integer , LinuxAbsoluteInputCapabilities > getCapabilities ( File devNode , BitSet axes ) throws IOException { if ( axes == null || axes . isEmpty ( ) ) { return null ; } LinuxSystem system = LinuxSystem . getLinuxSystem ( ) ; LinuxSystem . InputAbsInfo info = new LinuxSystem . InputAbsInfo ( ) ; long fd =... | Reads capabilities from a device node . |
39,875 | private void releaseID ( int id ) { ids . removeInt ( id ) ; nextID = 1 ; for ( int i = 0 ; i < ids . size ( ) ; i ++ ) { nextID = Math . max ( ids . get ( i ) + 1 , nextID ) ; } } | Release a touch point ID |
39,876 | void invokeAndWait ( final Runnable r ) { final CountDownLatch latch = new CountDownLatch ( 1 ) ; queue . postRunnable ( ( ) -> { try { r . run ( ) ; } finally { latch . countDown ( ) ; } } ) ; try { latch . await ( ) ; } catch ( InterruptedException e ) { } } | Posts a Runnable to the JavaFX event queue and waits for the Runnable to complete . |
39,877 | String eglErrorToString ( int errorCode ) { if ( errorCode >= 0x3000 && errorCode < 0x3020 ) { for ( Field field : EGL . class . getFields ( ) ) { try { if ( field . getName ( ) . startsWith ( "EGL_" ) && field . getType ( ) == Integer . TYPE && field . getInt ( null ) == errorCode ) { return field . getName ( ) ; } } ... | Convert an EGL error code such as EGL_BAD_CONTEXT to a string representation . |
39,878 | TouchPipeline getBasePipeline ( ) { if ( basePipeline == null ) { basePipeline = new TouchPipeline ( ) ; String [ ] touchFilterNames = AccessController . doPrivileged ( ( PrivilegedAction < String > ) ( ) -> System . getProperty ( "monocle.input.touchFilters" , "SmallMove" ) ) . split ( "," ) ; if ( touchFilterNames !=... | Gets the base touch filter pipeline common to all touch devices |
39,879 | void setState ( TouchState newState ) { if ( MonocleSettings . settings . traceEvents ) { MonocleTrace . traceEvent ( "Set %s" , newState ) ; } newState . sortPointsByID ( ) ; newState . assignPrimaryID ( ) ; MonocleWindow oldWindow = state . getWindow ( false , null ) ; boolean recalculateWindow = state . getPointCoun... | Called from the input processor to update the touch state and send touch and mouse events . |
39,880 | private void postTouchEvent ( TouchState state , int eventType ) { Window window = state . getWindow ( false , null ) ; View view = window == null ? null : window . getView ( ) ; if ( view != null ) { switch ( state . getPointCount ( ) ) { case 0 : postNoPoints ( view ) ; break ; case 1 : postPoint ( window , view , ev... | Sends the same event type for all points in the given state |
39,881 | private void postTouchEvent ( MonocleWindow window , View view , TouchState newState ) { int count = countEvents ( newState ) ; switch ( count ) { case 0 : postNoPoints ( view ) ; break ; case 1 : if ( state . getPointCount ( ) == 1 ) { TouchState . Point oldPoint = state . getPoint ( 0 ) ; TouchState . Point newPoint ... | Sends updated touch points within the same View as last processed touch points . |
39,882 | protected long _createWindow ( long NativeWindow , long NativeScreen , int mask ) { id = MonocleWindowManager . getInstance ( ) . addWindow ( this ) ; return id ; } | creates the native window |
39,883 | void shutdown ( ) { runnableProcessor . shutdown ( ) ; if ( cursor != null ) { cursor . shutdown ( ) ; } if ( screen != null ) { screen . shutdown ( ) ; } } | Called once during JavaFX shutdown to release platform resources . |
39,884 | public synchronized AcceleratedScreen getAcceleratedScreen ( int [ ] attributes ) throws GLException , UnsatisfiedLinkError { if ( accScreen == null ) { accScreen = new AcceleratedScreen ( attributes ) ; } return accScreen ; } | Gets the AcceleratedScreen for this platform |
39,885 | public synchronized AcceleratedScreen getAcceleratedScreen ( int [ ] attributes ) throws GLException { if ( accScreen == null ) { accScreen = new AndroidAcceleratedScreen ( attributes ) ; } return accScreen ; } | Create the accelerated screen for this platform |
39,886 | static Map < String , BitSet > readCapabilities ( File sysPath ) { Map < String , BitSet > capsMap = new HashMap < String , BitSet > ( ) ; File [ ] capsFiles = new File ( sysPath , "device/capabilities" ) . listFiles ( ) ; if ( capsFiles == null ) { return capsMap ; } for ( int i = 0 ; i < capsFiles . length ; i ++ ) {... | Read input device capability data from sysfs |
39,887 | static void triggerUdevNotification ( String sysClass ) { File [ ] devices = new File ( "/sys/class/" + sysClass ) . listFiles ( ) ; byte [ ] action = "change" . getBytes ( ) ; for ( File device : devices ) { File uevent = new File ( device , "uevent" ) ; if ( uevent . exists ( ) ) { try { write ( uevent . getAbsoluteP... | Fires udev notification events for devices of the given type |
39,888 | static int [ ] readInts ( String location , int expectedLength ) throws IOException { BufferedReader r = new BufferedReader ( new FileReader ( location ) ) ; String s = r . readLine ( ) ; r . close ( ) ; if ( s != null && s . length ( ) > 0 ) { String [ ] elements = s . split ( "," ) ; try { if ( expectedLength == 0 ||... | Read a comma - separated list of integer values from a file |
39,889 | static int readInt ( String location ) throws IOException { BufferedReader r = new BufferedReader ( new FileReader ( location ) ) ; String s = r . readLine ( ) ; r . close ( ) ; try { if ( s != null && s . length ( ) > 0 ) { return Integer . parseInt ( s ) ; } else { throw new IOException ( location + " does not contai... | Read a single integer value from a file |
39,890 | public void enableRendering ( boolean flag ) { if ( flag ) { egl . eglMakeCurrent ( eglDisplay , eglSurface , eglSurface , eglContext ) ; } else { egl . eglMakeCurrent ( eglDisplay , 0 , 0 , eglContext ) ; } } | Make the EGL drawing surface current or not |
39,891 | boolean initPlatformLibraries ( ) throws UnsatisfiedLinkError { if ( ! initialized ) { glesLibraryHandle = ls . dlopen ( "libGLESv2.so" , LinuxSystem . RTLD_LAZY | LinuxSystem . RTLD_GLOBAL ) ; if ( glesLibraryHandle == 0l ) { throw new UnsatisfiedLinkError ( "Error loading libGLESv2.so" ) ; } eglLibraryHandle = ls . d... | Load any native libraries needed to instantiate and initialize the native drawing surface and rendering context |
39,892 | public boolean swapBuffers ( ) { boolean result = false ; synchronized ( NativeScreen . framebufferSwapLock ) { result = egl . eglSwapBuffers ( eglDisplay , eglSurface ) ; if ( ! result ) { createSurface ( ) ; result = egl . eglSwapBuffers ( eglDisplay , eglSurface ) ; } } return result ; } | Copy the contents of the GL backbuffer to the screen |
39,893 | private void processXEvent ( X . XEvent event , RunnableProcessor runnableProcessor ) { switch ( X . XEvent . getType ( event . p ) ) { case X . ButtonPress : { X . XButtonEvent buttonEvent = new X . XButtonEvent ( event ) ; int button = X . XButtonEvent . getButton ( buttonEvent . p ) ; runnableProcessor . invokeLater... | Dispatch the X Event to the appropriate processor . All processors run via invokeLater |
39,894 | private static int buttonToGlassButton ( int button ) { switch ( button ) { case X . Button1 : return MouseEvent . BUTTON_LEFT ; case X . Button2 : return MouseEvent . BUTTON_OTHER ; case X . Button3 : return MouseEvent . BUTTON_RIGHT ; default : return MouseEvent . BUTTON_NONE ; } } | Convenience method to convert X11 button codes to glass button codes |
39,895 | MonocleWindow getWindow ( boolean recalculateCache ) { if ( window == null || recalculateCache ) { window = ( MonocleWindow ) MonocleWindowManager . getInstance ( ) . getWindowForLocation ( x , y ) ; } return window ; } | Returns the Glass window on which the coordinates of this state are located . |
39,896 | int getModifiers ( ) { int modifiers = KeyEvent . MODIFIER_NONE ; for ( int i = 0 ; i < buttonsPressed . size ( ) ; i ++ ) { switch ( buttonsPressed . get ( i ) ) { case MouseEvent . BUTTON_LEFT : modifiers |= KeyEvent . MODIFIER_BUTTON_PRIMARY ; break ; case MouseEvent . BUTTON_OTHER : modifiers |= KeyEvent . MODIFIER... | Returns the Glass event modifiers for this state |
39,897 | boolean canBeFoldedWith ( MouseState ms ) { return ms . buttonsPressed . equals ( buttonsPressed ) && ms . wheel == wheel ; } | Finds out whether two non - null states are identical in everything but their coordinates |
39,898 | void difference ( IntSet dest , IntSet compared ) { int i = 0 ; int j = 0 ; while ( i < size && j < compared . size ) { int a = elements [ i ] ; int b = compared . elements [ j ] ; if ( a < b ) { dest . addInt ( a ) ; i ++ ; } else if ( a > b ) { j ++ ; } else { i ++ ; j ++ ; } } while ( i < size ) { dest . addInt ( el... | Adds to the set dest values that in this set but are not in the set compared . |
39,899 | void copyTo ( IntSet target ) { if ( target . elements . length < size ) { target . elements = Arrays . copyOf ( elements , elements . length ) ; } else { System . arraycopy ( elements , 0 , target . elements , 0 , size ) ; } target . size = size ; } | Copies the contents of this set to the target set . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.