idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
142,000 | public static < T , P > AsyncCallback < T > map ( AsyncCallback < P > target , final Function < T , P > f ) { return new ChainedCallback < T , P > ( target ) { public void onSuccess ( T result ) { forwardSuccess ( f . apply ( result ) ) ; } } ; } | Creates a chained callback that maps the result using the supplied function and passes the mapped result to the target callback . |
142,001 | public static < T > AsyncCallback < T > before ( AsyncCallback < T > target , final Function < T , Void > preOp ) { return new ChainedCallback < T , T > ( target ) { public void onSuccess ( T result ) { preOp . apply ( result ) ; forwardSuccess ( result ) ; } } ; } | Creates a chained callback that calls the supplied pre - operation before passing the result on to the supplied target callback . |
142,002 | public static < T > AsyncCallback < T > disabler ( AsyncCallback < T > callback , final HasEnabled ... disablees ) { for ( HasEnabled widget : disablees ) { widget . setEnabled ( false ) ; } return new ChainedCallback < T , T > ( callback ) { public void onSuccess ( T result ) { for ( HasEnabled widget : disablees ) { ... | Immediately disables the specified widgets and wraps the supplied callback in one that will reenable those widgets when the callback returns successfully or with failure . |
142,003 | @ SuppressWarnings ( "unchecked" ) protected final MODEL_ID tryConvertId ( Object id ) { try { return ( MODEL_ID ) getModelBeanDescriptor ( ) . convertId ( id ) ; } catch ( Exception e ) { throw new UnprocessableEntityException ( Messages . get ( "info.query.id.unprocessable.entity" ) , e ) ; } } | convert to id |
142,004 | protected boolean deleteMultipleModel ( Set < MODEL_ID > idCollection , boolean permanent ) throws Exception { if ( permanent ) { server . deleteAllPermanent ( modelType , idCollection ) ; } else { server . deleteAll ( modelType , idCollection ) ; } return permanent ; } | delete multiple Model |
142,005 | protected boolean deleteModel ( MODEL_ID id , boolean permanent ) throws Exception { if ( permanent ) { server . deletePermanent ( modelType , id ) ; } else { server . delete ( modelType , id ) ; } return permanent ; } | delete a model |
142,006 | public Response findByIds ( @ PathParam ( "ids" ) URI_ID id , @ PathParam ( "ids" ) final PathSegment ids , @ QueryParam ( "include_deleted" ) final boolean includeDeleted ) throws Exception { final Query < MODEL > query = server . find ( modelType ) ; final MODEL_ID firstId = tryConvertId ( ids . getPath ( ) ) ; Set <... | Find a model or model list given its Ids . |
142,007 | public Response fetchHistoryAsOf ( @ PathParam ( "id" ) URI_ID id , @ PathParam ( "asof" ) final Timestamp asOf ) throws Exception { final MODEL_ID mId = tryConvertId ( id ) ; matchedFetchHistoryAsOf ( mId , asOf ) ; final Query < MODEL > query = server . find ( modelType ) ; defaultFindOrderBy ( query ) ; Object entit... | find history as of timestamp |
142,008 | public static String parseQueryFields ( UriInfo uriInfo ) { List < String > selectables = uriInfo . getQueryParameters ( ) . get ( EntityFieldsScopeResolver . FIELDS_PARAM_NAME ) ; StringBuilder builder = new StringBuilder ( ) ; if ( selectables != null ) { for ( int i = 0 ; i < selectables . size ( ) ; i ++ ) { String... | Parse and return a BeanPathProperties format from UriInfo |
142,009 | public void setSelectedValue ( E value ) { String valstr = value . toString ( ) ; for ( int ii = 0 ; ii < getItemCount ( ) ; ii ++ ) { if ( getValue ( ii ) . equals ( valstr ) ) { setSelectedIndex ( ii ) ; break ; } } } | Selects the specified value . |
142,010 | public E getSelectedEnum ( ) { int selidx = getSelectedIndex ( ) ; return ( selidx < 0 ) ? null : Enum . valueOf ( _eclass , getValue ( selidx ) ) ; } | Returns the currently selected value or null if no value is selected . |
142,011 | public boolean hasPath ( String path ) { Props props = pathMap . get ( path ) ; return props != null && ! props . isEmpty ( ) ; } | Return true if the path is defined and has properties . |
142,012 | public Set < String > getProperties ( String path ) { Props props = pathMap . get ( path ) ; return props == null ? null : props . getProperties ( ) ; } | Get the properties for a given path . |
142,013 | public void put ( String path , Set < String > properties ) { pathMap . put ( path , new Props ( this , null , path , properties ) ) ; } | Set the properties for a given path . |
142,014 | public void each ( Each < Props > each ) { for ( Map . Entry < String , Props > entry : pathMap . entrySet ( ) ) { Props props = entry . getValue ( ) ; each . execute ( props ) ; } } | Each these path properties as fetch paths to the query . |
142,015 | public void finished ( ) { final ScheduledFuture < ? > scheduled = nextCall . getAndSet ( null ) ; if ( scheduled != null ) { scheduled . cancel ( true ) ; } } | Must be called when the target completable finishes to clean up any potential scheduled _future_ events . |
142,016 | public static void bindEnabled ( Value < Boolean > value , final FocusWidget ... targets ) { value . addListenerAndTrigger ( new Value . Listener < Boolean > ( ) { public void valueChanged ( Boolean enabled ) { for ( FocusWidget target : targets ) { target . setEnabled ( enabled ) ; } } } ) ; } | Binds the enabledness state of the target widget to the supplied boolean value . |
142,017 | public static void bindVisible ( Value < Boolean > value , final Widget ... targets ) { value . addListenerAndTrigger ( new Value . Listener < Boolean > ( ) { public void valueChanged ( Boolean visible ) { for ( Widget target : targets ) { target . setVisible ( visible ) ; } } } ) ; } | Binds the visible state of the target widget to the supplied boolean value . |
142,018 | public static < T extends HasMouseOverHandlers & HasMouseOutHandlers > void bindHovered ( final Value < Boolean > value , T ... targets ) { HoverHandler handler = new HoverHandler ( value ) ; for ( T target : targets ) { target . addMouseOverHandler ( handler ) ; target . addMouseOutHandler ( handler ) ; } } | Binds the hovered state of the supplied target widgets to the supplied boolean value . The supplied value will be toggled to true when the mouse is hovering over any of the supplied targets and false otherwise . |
142,019 | public static void bindLabel ( final Value < String > value , final HasText target ) { value . addListenerAndTrigger ( new Value . Listener < String > ( ) { public void valueChanged ( String value ) { if ( ! target . getText ( ) . equals ( value ) ) { target . setText ( value ) ; } } } ) ; } | Binds the specified string value to the supplied text - having widget . The binding is one - way in that only changes to the value will be reflected in the text - having widget . It is expected that no other changes will be made to the widget . |
142,020 | public static ClickHandler makeToggler ( final Value < Boolean > value ) { Preconditions . checkNotNull ( value , "value" ) ; return new ClickHandler ( ) { public void onClick ( ClickEvent event ) { value . update ( ! value . get ( ) ) ; } } ; } | Returns a click handler that toggles the supplied boolean value when clicked . |
142,021 | public static void bindStateStyle ( Value < Boolean > value , final String onStyle , final String offStyle , final Widget ... targets ) { value . addListenerAndTrigger ( new Value . Listener < Boolean > ( ) { public void valueChanged ( Boolean value ) { String add , remove ; if ( value ) { remove = offStyle ; add = onS... | Configures either onStyle or offStyle on the supplied target widgets depending on the state of the supplied boolean value . |
142,022 | private List < MigrationInfo > resolved ( MigrationInfo [ ] migrationInfos ) { if ( migrationInfos . length == 0 ) throw new NotFoundException ( ) ; List < MigrationInfo > resolvedMigrations = Lists . newArrayList ( ) ; for ( MigrationInfo migrationInfo : migrationInfos ) { if ( migrationInfo . getState ( ) . isResolve... | Retrieves the full set of infos about the migrations resolved on the classpath . |
142,023 | private List < MigrationInfo > failed ( MigrationInfo [ ] migrationInfos ) { if ( migrationInfos . length == 0 ) throw new NotFoundException ( ) ; List < MigrationInfo > failedMigrations = Lists . newArrayList ( ) ; for ( MigrationInfo migrationInfo : migrationInfos ) { if ( migrationInfo . getState ( ) . isFailed ( ) ... | Retrieves the full set of infos about the migrations that failed . |
142,024 | private List < MigrationInfo > future ( MigrationInfo [ ] migrationInfos ) { if ( migrationInfos . length == 0 ) throw new NotFoundException ( ) ; List < MigrationInfo > futureMigrations = Lists . newArrayList ( ) ; for ( MigrationInfo migrationInfo : migrationInfos ) { if ( ( migrationInfo . getState ( ) == MigrationS... | Retrieves the full set of infos about future migrations applied to the DB . |
142,025 | public static void updateDisks ( Document domainXml , List < StorageVol > volumes ) throws LibvirtException { XPathFactory xpf = XPathFactory . instance ( ) ; XPathExpression < Element > diskExpr = xpf . compile ( XPATH_DISK , Filters . element ( ) ) ; XPathExpression < Attribute > fileExpr = xpf . compile ( XPATH_DISK... | update the disks in the domain XML . It is assumed that the the size of the volumes is the same as the number of disk elements and that the order is the same . |
142,026 | public static List < Disk > getDisks ( Connect connect , Document domainXml ) { try { List < Disk > ret = new ArrayList < > ( ) ; XPathFactory xpf = XPathFactory . instance ( ) ; XPathExpression < Element > diskExpr = xpf . compile ( XPATH_DISK , Filters . element ( ) ) ; XPathExpression < Attribute > typeExpr = xpf . ... | Get the disks connected to the domain . |
142,027 | public static GroupMapping mapping ( Map . Entry < String , Mapping < ? > > ... fields ) { return new GroupMapping ( Arrays . asList ( fields ) ) ; } | shortcut method to construct group mapping |
142,028 | public static Map . Entry < String , Mapping < ? > > field ( String name , Mapping < ? > mapping ) { return FrameworkUtils . entry ( name , mapping ) ; } | helper method to construct group field mapping |
142,029 | public boolean removeCustomer ( Long customerId ) { Customer customer = getCustomer ( customerId ) ; if ( customer != null ) { customerRepository . delete ( customer ) ; return true ; } return false ; } | Remove customer from the repository |
142,030 | public static void parkAndSerialize ( final FiberWriter writer ) { try { Fiber . parkAndSerialize ( writer ) ; } catch ( SuspendExecution e ) { throw RuntimeSuspendExecution . of ( e ) ; } } | Parks the fiber and allows the given callback to serialize it . |
142,031 | public static < V > Fiber < V > unparkSerialized ( byte [ ] serFiber , FiberScheduler scheduler ) { return Fiber . unparkSerialized ( serFiber , scheduler ) ; } | Deserializes a fiber from the given byte array and unparks it . |
142,032 | public static < V > V runInFiber ( FiberScheduler scheduler , SuspendableCallable < V > target ) throws ExecutionException , InterruptedException { return FiberUtil . runInFiber ( scheduler , target ) ; } | Runs an action in a new fiber awaits the fiber s termination and returns its result . |
142,033 | public static void runInFiber ( FiberScheduler scheduler , SuspendableRunnable target ) throws ExecutionException , InterruptedException { FiberUtil . runInFiber ( scheduler , target ) ; } | Runs an action in a new fiber and awaits the fiber s termination . |
142,034 | @ RequestMapping ( path = "" , method = RequestMethod . GET ) public Page < Order > getOrder ( Pageable pageable ) { return orderService . getOrders ( pageable ) ; } | Get page of orders |
142,035 | @ RequestMapping ( path = "/{orderId}" , method = { RequestMethod . GET , RequestMethod . POST } ) public ResponseEntity < Order > getOrder ( @ PathVariable ( "orderId" ) Long orderId ) { Order order = orderService . getOrder ( orderId ) ; if ( order != null ) { return new ResponseEntity ( order , HttpStatus . OK ) ; }... | Get order by id |
142,036 | @ RequestMapping ( path = "/{orderId}/status" , method = RequestMethod . PUT ) public ResponseEntity < Order > updateStatus ( @ PathVariable ( "orderId" ) Long orderId , @ RequestParam ( "status" ) OrderStatus status ) { Order order = orderService . updateStatus ( orderId , status ) ; if ( order != null ) { return new ... | Update order status |
142,037 | public boolean vmExists ( final String vmOrUuid ) { String [ ] lines = execute ( "list" , "vms" ) . split ( "\\s" ) ; for ( String line : lines ) { if ( line . endsWith ( "{" + vmOrUuid + "}" ) || line . startsWith ( "\"" + vmOrUuid + "\"" ) ) return true ; } return false ; } | Checks if VM exists . Accepts UUID or VM name as an argument . |
142,038 | public void loadSnapshot ( String vm , String snapshotUuid ) { if ( ! EnumSet . of ( POWEROFF , SAVED ) . contains ( vmState ( vm ) ) ) { powerOff ( vm ) ; } execute ( "snapshot" , vm , "restore" , snapshotUuid ) ; start ( vm ) ; } | Shuts down if running restores the snapshot and starts VM . |
142,039 | public String execute ( String ... command ) { return commandProcessor . run ( aCommand ( "VBoxManage" ) . withArguments ( command ) ) . getOutput ( ) ; } | Executes custom VBoxManage command |
142,040 | public void setExtraData ( String vm , String k , String v ) { execute ( "setextradata" , vm , k , v ) ; } | Sets extra data on the VM |
142,041 | public void update ( T value ) { _value = value ; for ( Listener < T > listener : new ArrayList < Listener < T > > ( _listeners ) ) { listener . valueChanged ( value ) ; } } | Updates this value and notifies all listeners . This will notify the listeners regardless of whether the supplied value differs from the current value . |
142,042 | public void displayPage ( final int page , boolean forceRefresh ) { if ( _page == page && ! forceRefresh ) { return ; } configureLoadingNavi ( _controls , 0 , _infoCol ) ; _page = Math . max ( page , 0 ) ; final boolean overQuery = ( _model . getItemCount ( ) < 0 ) ; final int count = _resultsPerPage ; final int start ... | Displays the specified page . Does nothing if we are already displaying that page unless forceRefresh is true . |
142,043 | public void removeItem ( T item ) { if ( _model == null ) { return ; } _model . removeItem ( item ) ; displayPage ( _page , true ) ; } | Removes the specified item from the panel . If the item is currently being displayed its interface element will be removed as well . |
142,044 | protected void configureNavi ( FlexTable controls , int row , int col , int start , int limit , int total ) { HorizontalPanel panel = new HorizontalPanel ( ) ; panel . add ( new Label ( "Page:" ) ) ; int page = 1 + start / _resultsPerPage ; int pages ; if ( total < 0 ) { pages = page + 1 ; } else { pages = total / _res... | Get the text that should be shown in the header bar between the prev and next buttons . |
142,045 | protected void reportFailure ( Throwable caught ) { java . util . logging . Logger . getLogger ( "PagedWidget" ) . warning ( "Failure to page: " + caught ) ; } | Report a service failure . |
142,046 | public void onKeyPress ( KeyPressEvent event ) { if ( event . getCharCode ( ) == KeyCodes . KEY_ESCAPE ) { _onEscape . onClick ( null ) ; } } | from interface KeyPressHandler |
142,047 | private static List < MediaType > getResourceMethodProducibleTypes ( final ExtendedUriInfo extendedUriInfo ) { if ( extendedUriInfo . getMatchedResourceMethod ( ) != null && ! extendedUriInfo . getMatchedResourceMethod ( ) . getProducedTypes ( ) . isEmpty ( ) ) { return extendedUriInfo . getMatchedResourceMethod ( ) . ... | Return a list of producible media types of the last matched resource method . |
142,048 | public static Charset getTemplateOutputEncoding ( Configuration configuration , String suffix ) { final String enc = PropertiesHelper . getValue ( configuration . getProperties ( ) , MvcFeature . ENCODING + suffix , String . class , null ) ; if ( enc == null ) { return DEFAULT_ENCODING ; } else { return Charset . forNa... | Get output encoding from configuration . |
142,049 | public static Map < String , String > getMacs ( Document domainXml ) { Map < String , String > macs = new HashMap < > ( ) ; XPathFactory xpf = XPathFactory . instance ( ) ; XPathExpression < Element > interfaces = xpf . compile ( "/domain/devices/interface" , Filters . element ( ) ) ; for ( Element iface : interfaces .... | Get a map of mac addresses of interfaces defined on the domain . This is somewhat limited at the moment . It is assumed that only one network interface with mac is connected to a bridge or network . For instance if you have a bridged network device connected to br0 then you will find it s MAC address with the key br0 . |
142,050 | public static < V > V runWithMock ( EbeanServer mock , Callable < V > test ) throws Exception { return start ( mock ) . run ( test ) ; } | Run the test runnable using the mock EbeanServer and restoring the original EbeanServer afterward . |
142,051 | public < V > V run ( Callable < V > testCallable ) throws Exception { try { beforeRun ( ) ; return testCallable . call ( ) ; } finally { afterRun ( ) ; restoreOriginal ( ) ; } } | Run the test callable restoring the original EbeanServer afterwards . |
142,052 | public void restoreOriginal ( ) { if ( original == null ) { throw new IllegalStateException ( "Original EbeanServer instance is null" ) ; } if ( original . getName ( ) == null ) { throw new IllegalStateException ( "Original EbeanServer name is null" ) ; } Ebean . mock ( original . getName ( ) , original , true ) ; } | Restore the original EbeanServer implementation as the default EbeanServer . |
142,053 | protected static Integer getSingleIntegerParam ( List < String > list ) { String s = getSingleParam ( list ) ; if ( s != null ) { try { return Integer . valueOf ( s ) ; } catch ( NumberFormatException e ) { return null ; } } return null ; } | Return a single Integer parameter . |
142,054 | protected static String getSingleParam ( List < String > list ) { if ( list != null && list . size ( ) == 1 ) { return list . get ( 0 ) ; } return null ; } | Return a single parameter value . |
142,055 | public static < T extends FocusWidget & HasText > String requireNonEmpty ( T widget , String error ) { String text = widget . getText ( ) . trim ( ) ; if ( text . length ( ) == 0 ) { Popups . errorBelow ( error , widget ) ; widget . setFocus ( true ) ; throw new InputException ( ) ; } return text ; } | Returns a text widget s value making sure it is non - empty . |
142,056 | public static void tint ( View view , Tint tint ) { final ColorStateList color = tint . getColor ( view . getContext ( ) ) ; if ( view instanceof ImageView ) { tint ( ( ( ImageView ) view ) . getDrawable ( ) , color ) ; } else if ( view instanceof TextView ) { TextView text = ( TextView ) view ; Drawable [ ] comp = tex... | Tints ImageView drawable or TextView compound drawables to given tint color . |
142,057 | public DomainWrapper cloneWithBackingStore ( String cloneName , List < Filesystem > mappings ) { logger . info ( "Creating clone from {}" , getName ( ) ) ; try { Document cloneXmlDocument = domainXml . clone ( ) ; setDomainName ( cloneXmlDocument , cloneName ) ; prepareForCloning ( cloneXmlDocument ) ; updateCloneMetad... | Clone the domain . All disks are cloned using the original disk as backing store . The names of the disks are created by suffixing the original disk name with a number . |
142,058 | public static < T > SimpleDataModel < T > newModel ( List < T > items ) { return new SimpleDataModel < T > ( items ) ; } | Creates a new simple data model with the supplied list of items . |
142,059 | public SimpleDataModel < T > filter ( Predicate < T > pred ) { List < T > items = new ArrayList < T > ( ) ; for ( T item : _items ) { if ( pred . apply ( item ) ) { items . add ( item ) ; } } return createFilteredModel ( items ) ; } | Returns a data model that contains only items that match the supplied predicate . |
142,060 | public void addItem ( int index , T item ) { if ( _items == null ) { return ; } _items . add ( index , item ) ; } | Adds an item to this model . Does not force the refresh of any display . |
142,061 | public void updateItem ( T item ) { if ( _items == null ) { return ; } int idx = _items . indexOf ( item ) ; if ( idx == - 1 ) { _items . add ( 0 , item ) ; } else { _items . set ( idx , item ) ; } } | Updates the specified item if found in the model prepends it otherwise . |
142,062 | public T findItem ( Predicate < T > p ) { if ( _items == null ) { return null ; } for ( T item : _items ) { if ( p . apply ( item ) ) { return item ; } } return null ; } | Returns the first item that matches the supplied predicate or null if no items in this model matches the predicate . |
142,063 | @ SuppressWarnings ( "unchecked" ) public < M extends T > M byId ( ID id ) { return ( M ) server ( ) . find ( getModelType ( ) , id ) ; } | Retrieves an entity by ID . |
142,064 | @ SuppressWarnings ( "unchecked" ) public < M extends T > M ref ( ID id ) { return ( M ) server ( ) . getReference ( getModelType ( ) , id ) ; } | Retrieves an entity reference for this ID . |
142,065 | @ SuppressWarnings ( "unchecked" ) public < M extends T > Map < ? , M > findMap ( ) { return ( Map < ? , M > ) query ( ) . findMap ( ) ; } | Executes the query and returns the results as a map of objects . |
142,066 | @ SuppressWarnings ( "unchecked" ) public < M extends T > Set < M > findSet ( ) { return ( Set < M > ) query ( ) . findSet ( ) ; } | Executes the query and returns the results as a set of objects . |
142,067 | public static SimplePanel newSimplePanel ( String styleName , Widget widget ) { SimplePanel panel = new SimplePanel ( ) ; if ( widget != null ) { panel . setWidget ( widget ) ; } return setStyleNames ( panel , styleName ) ; } | Creates a SimplePanel with the supplied style and widget |
142,068 | public static FlowPanel newFlowPanel ( String styleName , Widget ... contents ) { FlowPanel panel = new FlowPanel ( ) ; for ( Widget child : contents ) { if ( child != null ) { panel . add ( child ) ; } } return setStyleNames ( panel , styleName ) ; } | Creates a FlowPanel with the provided style and widgets . |
142,069 | public static ScrollPanel newScrollPanelX ( Widget contents , int maxWidth ) { ScrollPanel panel = new ScrollPanel ( contents ) ; DOM . setStyleAttribute ( panel . getElement ( ) , "maxWidth" , maxWidth + "px" ) ; return panel ; } | Wraps the supplied contents in a scroll panel with the specified maximum width . |
142,070 | public static ScrollPanel newScrollPanelY ( Widget contents , int maxHeight ) { ScrollPanel panel = new ScrollPanel ( contents ) ; DOM . setStyleAttribute ( panel . getElement ( ) , "maxHeight" , maxHeight + "px" ) ; return panel ; } | Wraps the supplied contents in a scroll panel with the specified maximum height . |
142,071 | public static HorizontalPanel newRow ( String styleName , Widget ... contents ) { return newRow ( HasAlignment . ALIGN_MIDDLE , styleName , contents ) ; } | Creates a row of widgets in a horizontal panel with a 5 pixel gap between them . |
142,072 | public static HorizontalPanel newRow ( HasAlignment . VerticalAlignmentConstant valign , String styleName , Widget ... contents ) { HorizontalPanel row = new HorizontalPanel ( ) ; row . setVerticalAlignment ( valign ) ; if ( styleName != null ) { row . setStyleName ( styleName ) ; } for ( Widget widget : contents ) { i... | Creates a row of widgets in a horizontal panel with a 5 pixel gap between them . The supplied style name is added to the container panel . |
142,073 | public static Label newLabel ( String text , String ... styles ) { return setStyleNames ( new Label ( text ) , styles ) ; } | Creates a label with the supplied text and style and optional additional styles . |
142,074 | public static InlineLabel newInlineLabel ( String text , String ... styles ) { return setStyleNames ( new InlineLabel ( text ) , styles ) ; } | Creates an inline label with optional styles . |
142,075 | public static Label newActionLabel ( String text , ClickHandler onClick ) { return newActionLabel ( text , null , onClick ) ; } | Creates a label that triggers an action using the supplied text and handler . |
142,076 | public static Label newActionLabel ( String text , String style , ClickHandler onClick ) { return makeActionLabel ( newLabel ( text , style ) , onClick ) ; } | Creates a label that triggers an action using the supplied text and handler . The label will be styled as specified with an additional style that configures the mouse pointer and adds underline to the text . |
142,077 | public static Label makeActionLabel ( Label label , ClickHandler onClick ) { return makeActionable ( label , onClick , null ) ; } | Makes the supplied label into an action label . The label will be styled such that it configures the mouse pointer and adds underline to the text . |
142,078 | public static < T extends Widget & HasClickHandlers > T makeActionable ( final T target , final ClickHandler onClick , Value < Boolean > enabled ) { if ( onClick != null ) { if ( enabled != null ) { enabled . addListenerAndTrigger ( new Value . Listener < Boolean > ( ) { public void valueChanged ( Boolean enabled ) { i... | Makes the supplied widget actionable which means adding the actionLabel style to it and binding the supplied click handler . |
142,079 | public static HTML newHTML ( String text , String ... styles ) { return setStyleNames ( new HTML ( text ) , styles ) ; } | Creates a new HTML element with the specified contents and style . |
142,080 | public static Image newImage ( String path , String ... styles ) { return setStyleNames ( new Image ( path ) , styles ) ; } | Creates an image with the supplied path and style . |
142,081 | public static Image makeActionImage ( Image image , String tip , ClickHandler onClick ) { if ( tip != null ) { image . setTitle ( tip ) ; } return makeActionable ( image , onClick , null ) ; } | Makes an image into one that responds to clicking . |
142,082 | public static TextBox newTextBox ( String text , int maxLength , int visibleLength ) { return initTextBox ( new TextBox ( ) , text , maxLength , visibleLength ) ; } | Creates a text box with all of the configuration that you re bound to want to do . |
142,083 | public static String getText ( TextBoxBase box , String defaultAsBlank ) { String s = box . getText ( ) . trim ( ) ; return s . equals ( defaultAsBlank ) ? "" : s ; } | Retrieve the text from the TextBox unless it is the specified default in which case we return . |
142,084 | public static TextBox initTextBox ( TextBox box , String text , int maxLength , int visibleLength ) { if ( text != null ) { box . setText ( text ) ; } box . setMaxLength ( maxLength > 0 ? maxLength : 255 ) ; if ( visibleLength > 0 ) { box . setVisibleLength ( visibleLength ) ; } return box ; } | Configures a text box with all of the configuration that you re bound to want to do . This is useful for configuring a PasswordTextBox . |
142,085 | public static TextArea newTextArea ( String text , int width , int height ) { TextArea area = new TextArea ( ) ; if ( text != null ) { area . setText ( text ) ; } if ( width > 0 ) { area . setCharacterWidth ( width ) ; } if ( height > 0 ) { area . setVisibleLines ( height ) ; } return area ; } | Creates a text area with all of the configuration that you re bound to want to do . |
142,086 | public static LimitedTextArea newTextArea ( String text , int width , int height , int maxLength ) { LimitedTextArea area = new LimitedTextArea ( maxLength , width , height ) ; if ( text != null ) { area . setText ( text ) ; } return area ; } | Creates a limited text area with all of the configuration that you re bound to want to do . |
142,087 | public static PushButton newImageButton ( String style , ClickHandler onClick ) { PushButton button = new PushButton ( ) ; maybeAddClickHandler ( button , onClick ) ; return setStyleNames ( button , style , "actionLabel" ) ; } | Creates an image button that changes appearance when you click and hover over it . |
142,088 | public static < T extends Widget > T setStyleNames ( T widget , String ... styles ) { int idx = 0 ; for ( String style : styles ) { if ( style == null ) { continue ; } if ( idx ++ == 0 ) { widget . setStyleName ( style ) ; } else { widget . addStyleName ( style ) ; } } return widget ; } | Configures the supplied styles on the supplied widget . Existing styles will not be preserved unless you call this with no - non - null styles . Returns the widget for easy chaining . |
142,089 | private ConcurrentManaged < T > newManaged ( ) { return ConcurrentManaged . newManaged ( async , caller , managedOptions , setup , teardown ) ; } | Construct a new managed reference . |
142,090 | public static PreProcessor changePrefix ( String from , String to ) { return mkPreProcessorWithMeta ( ( prefix , data , options ) -> { logger . debug ( "changing prefix at '{}' from '{}' to '{}'" , prefix , from , to ) ; return data . entrySet ( ) . stream ( ) . map ( e -> { if ( ! e . getKey ( ) . startsWith ( prefix ... | change data key prefix from one to other |
142,091 | public static Command delay ( final Command command , final int delay ) { return ( command == null ) ? null : new Command ( ) { public void execute ( ) { new Timer ( ) { public void run ( ) { command . execute ( ) ; } } . schedule ( delay ) ; } } ; } | Returns a command that when executed itself will execute the supplied command after the specified millisecond delay . For convenience purposes if a null command is supplied null is returned . |
142,092 | private String escapeSockJsSpecialChars ( char [ ] characters ) { StringBuilder result = new StringBuilder ( ) ; for ( char c : characters ) { if ( isSockJsSpecialChar ( c ) ) { result . append ( '\\' ) . append ( 'u' ) ; String hex = Integer . toHexString ( c ) . toLowerCase ( ) ; for ( int i = 0 ; i < ( 4 - hex . len... | See JSON Unicode Encoding section of SockJS protocol . |
142,093 | private boolean isSockJsSpecialChar ( char ch ) { return ch <= '\u001F' || ch >= '\u200C' && ch <= '\u200F' || ch >= '\u2028' && ch <= '\u202F' || ch >= '\u2060' && ch <= '\u206F' || ch >= '\uFFF0' || ch >= '\uD800' && ch <= '\uDFFF' ; } | See escapable_by_server variable in the SockJS protocol test suite . |
142,094 | private void scheduleActiveStatusesUpdates ( EventTarget target , EventStatus status ) { for ( Event event : activeEvents ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . STATUS ) { Utils . log ( event . getKey ( ) , meth... | Schedules status updates of all active events for given target . |
142,095 | private void scheduleStatusUpdates ( Event event , EventStatus status ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . STATUS ) { Utils . log ( event . getKey ( ) , method , "Schedul... | Schedules status update of given event for all registered targets . |
142,096 | private void scheduleSubscribersInvocation ( Event event ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . SUBSCRIBE ) { Utils . log ( event . getKey ( ) , method , "Scheduling event ... | Schedules handling of given event for all registered targets . |
142,097 | private void scheduleResultCallbacks ( Event event , EventResult result ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . RESULT ) { Utils . log ( event . getKey ( ) , method , "Sched... | Schedules sending result to all registered targets . |
142,098 | private void scheduleFailureCallbacks ( Event event , EventFailure failure ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . FAILURE ) { Utils . log ( event . getKey ( ) , method , "S... | Schedules sending failure callback to all registered targets . |
142,099 | private void handleRegistration ( Object targetObj ) { if ( targetObj == null ) { throw new NullPointerException ( "Target cannot be null" ) ; } for ( EventTarget target : targets ) { if ( target . targetObj == targetObj ) { Utils . logE ( targetObj , "Already registered" ) ; return ; } } EventTarget target = new Event... | Handles target object registration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.