idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
1,800
protected < T > Provider < T > findProvider ( Class < T > type , Annotation qualifier ) throws ProviderMissingException { String key = PokeHelper . makeProviderKey ( type , qualifier ) ; Component targetComponent = getRootComponent ( ) . componentLocator . get ( key ) ; Provider provider = null ; if ( targetComponent !...
Find the provider specified by the type and qualifier . It will look through the providers registered to this component and all its children components .
1,801
private void addNewKeyToComponent ( String key , Component component ) throws ProviderConflictException { Component root = getRootComponent ( ) ; if ( componentLocator . keySet ( ) . contains ( key ) ) { String msg = String . format ( "Type %s has already been registered " + "in this component(%s)." , key , getComponen...
Add key to the component locator of the component . This component and the the component tree root s component locator will both be updated .
1,802
public void release ( final Object target ) { if ( uiThreadRunner . isOnUiThread ( ) ) { try { graph . release ( target , Inject . class ) ; } catch ( ProviderMissingException e ) { throw new MvcGraphException ( e . getMessage ( ) , e ) ; } } else { uiThreadRunner . post ( new Runnable ( ) { public void run ( ) { try {...
Release cached instances held by fields of target object . References of instances of the instances will be decremented . Once the reference count of a contract type reaches 0 it will be removed from the instances .
1,803
private void go ( ) { if ( navigateEvent != null ) { navigationManager . postEvent2C ( navigateEvent ) ; if ( navigationManager . logger . isTraceEnabled ( ) ) { if ( navigateEvent instanceof NavigationManager . Event . OnLocationForward ) { NavigationManager . Event . OnLocationForward event = ( NavigationManager . Ev...
Sends out the navigation event to execute the navigation
1,804
void destroy ( ) { if ( onSettled != null ) { onSettled . run ( ) ; } if ( pendingReleaseInstances != null ) { for ( PendingReleaseInstance i : pendingReleaseInstances ) { try { Mvc . graph ( ) . dereference ( i . instance , i . type , i . qualifier ) ; } catch ( ProviderMissingException e ) { navigationManager . logge...
Internal use . Don t do it in your app .
1,805
private void checkAppExit ( Object sender ) { NavLocation curLocation = navigationManager . getModel ( ) . getCurrentLocation ( ) ; if ( curLocation == null ) { navigationManager . postEvent2C ( new NavigationManager . Event . OnAppExit ( sender ) ) ; } }
Check the app is exiting
1,806
private void dumpHistory ( ) { if ( navigationManager . dumpHistoryOnLocationChange ) { navigationManager . logger . trace ( "" ) ; navigationManager . logger . trace ( "Nav Controller: dump: begin -------------------------------------------- ) ; NavLocation curLoc = navigationManager . getModel ( ) . getCurrentLocatio...
Prints navigation history
1,807
void retain ( Object owner , Field field ) { retain ( ) ; Map < String , Integer > fields = owners . get ( owner ) ; if ( fields == null ) { fields = new HashMap < > ( ) ; owners . put ( owner , fields ) ; } Integer count = fields . get ( field . toGenericString ( ) ) ; if ( count == null ) { fields . put ( field . toG...
Retain an instance injected as a field of an object
1,808
void release ( Object owner , Field field ) { Map < String , Integer > fields = owners . get ( owner ) ; if ( fields != null ) { release ( ) ; Integer count = fields . get ( field . toGenericString ( ) ) ; if ( -- count > 0 ) { fields . put ( field . toGenericString ( ) , count ) ; } else { fields . remove ( field . to...
Release an instance injected as a field of an object
1,809
public T getCachedInstance ( ) { ScopeCache cache = getScopeCache ( ) ; if ( cache != null ) { String key = PokeHelper . makeProviderKey ( type , qualifier ) ; Object instance = cache . findInstance ( key ) ; if ( instance != null ) { return ( T ) instance ; } } return null ; }
Get the cached instance of this provider when there is a instances associated with this provider and the instance is cached already . Note that the method will NOT increase reference count of this provider
1,810
void registerEventBuses ( ) { if ( ! eventsRegistered ) { Mvc . graph ( ) . inject ( this ) ; eventBusV . register ( androidComponent ) ; eventsRegistered = true ; logger . trace ( "+Event2V bus registered for view - '{}'." , androidComponent . getClass ( ) . getSimpleName ( ) ) ; } else { logger . trace ( "!Event2V bu...
Register event bus for views .
1,811
void unregisterEventBuses ( ) { if ( eventsRegistered ) { eventBusV . unregister ( androidComponent ) ; eventsRegistered = false ; logger . trace ( "-Event2V bus unregistered for view - '{}' and its controllers." , androidComponent . getClass ( ) . getSimpleName ( ) ) ; Mvc . graph ( ) . release ( this ) ; } else { log...
Unregister event bus for views .
1,812
public void inject ( Object target , Class < ? extends Annotation > injectAnnotation ) throws ProvideException , ProviderMissingException , CircularDependenciesException { if ( monitors != null ) { int size = monitors . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { monitors . get ( i ) . onInject ( target ) ; } } do...
Inject all fields annotated by the given injectAnnotation
1,813
private void recordVisitField ( Object object , Field objectField , Field field ) { Map < String , Set < String > > bag = visitedFields . get ( object ) ; if ( bag == null ) { bag = new HashMap < > ( ) ; visitedFields . put ( object , bag ) ; } Set < String > fields = bag . get ( objectField ) ; String objectFiledKey =...
Records the field of a target object is visited
1,814
private boolean isFieldVisited ( Object object , Field objectField , Field field ) { Map < String , Set < String > > bag = visitedFields . get ( object ) ; if ( bag == null ) { return false ; } String objectFiledKey = objectField == null ? "" : objectField . toGenericString ( ) ; Set < String > fields = bag . get ( obj...
Indicates whether the field of a target object is visited
1,815
private void throwCircularDependenciesException ( ) throws CircularDependenciesException { String msg = "Circular dependencies found. Check the circular graph below:\n" ; boolean firstNode = true ; String tab = " " ; for ( String visit : visitedInjectNodes ) { if ( ! firstNode ) { msg += tab + "->" ; tab += tab ; } ms...
Print readable circular graph
1,816
protected List < ImageDTO > extractImagesFromCursor ( Cursor cursor , int offset , int limit ) { List < ImageDTO > images = new ArrayList < > ( ) ; int count = 0 ; int begin = offset > 0 ? offset : 0 ; if ( cursor . moveToPosition ( begin ) ) { do { ImageDTO image = extractOneImageFromCurrentCursor ( cursor ) ; images ...
Extract a list of imageDTO from current cursor with the given offset and limit .
1,817
protected List < VideoDTO > extractVideosFromCursor ( Cursor cursor , int offset , int limit ) { List < VideoDTO > videos = new ArrayList < > ( ) ; int count = 0 ; int begin = offset > 0 ? offset : 0 ; if ( cursor . moveToPosition ( begin ) ) { do { VideoDTO video = extractOneVideoFromCursor ( cursor ) ; videos . add (...
Extract a list of videoDTO from current cursor with the given offset and limit .
1,818
public static void setField ( Object obj , Field field , Object value ) { boolean accessible = field . isAccessible ( ) ; if ( ! accessible ) { field . setAccessible ( true ) ; } try { field . set ( obj , value ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } field . setAccessible ( accessible ) ;...
Sets value to the field of the given object .
1,819
public static Object getFieldValue ( Object obj , Field field ) { Object value = null ; boolean accessible = field . isAccessible ( ) ; if ( ! accessible ) { field . setAccessible ( true ) ; } try { value = field . get ( obj ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; } field . setAccessible ( ...
Gets value of the field of the given object .
1,820
public PageSnapshot highlight ( WebElement element ) { try { highlight ( element , Color . red , 3 ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE , rfe ) ; } return this ; }
Highlights WebElement within the page with Color . red and line width 3 .
1,821
public PageSnapshot highlight ( WebElement element , Color color , int lineWidth ) { try { image = ImageProcessor . highlight ( image , new Coordinates ( element , devicePixelRatio ) , color , lineWidth ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_ME...
Highlights WebElement within the page with provided color and line width .
1,822
public PageSnapshot blur ( WebElement element ) { try { image = ImageProcessor . blurArea ( image , new Coordinates ( element , devicePixelRatio ) ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE , rfe ) ; } return this ; }
Blur provided element within the page only .
1,823
public PageSnapshot monochrome ( WebElement element ) { try { image = ImageProcessor . monochromeArea ( image , new Coordinates ( element , devicePixelRatio ) ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE , rfe ) ; } return this ; }
Makes an element withing a page monochrome - applies gray - and - white filter . Original colors remain on the rest of the page .
1,824
public PageSnapshot blurExcept ( WebElement element ) { try { image = ImageProcessor . blurExceptArea ( image , new Coordinates ( element , devicePixelRatio ) ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE , rfe ) ; } return this ; }
Blurs all the page except the element provided .
1,825
public PageSnapshot cropAround ( WebElement element , int offsetX , int offsetY ) { try { image = ImageProcessor . cropAround ( image , new Coordinates ( element , devicePixelRatio ) , offsetX , offsetY ) ; } catch ( RasterFormatException rfe ) { throw new ElementOutsideViewportException ( ELEMENT_OUT_OF_VIEWPORT_EX_ME...
Crop the image around specified element with offset .
1,826
public static boolean imagesAreEqualsWithDiff ( BufferedImage image1 , BufferedImage image2 , String pathFileName , double deviation ) { BufferedImage output = new BufferedImage ( image1 . getWidth ( ) , image1 . getHeight ( ) , BufferedImage . TYPE_INT_RGB ) ; int width1 = image1 . getWidth ( null ) ; int width2 = ima...
Extends the functionality of imagesAreEqualsWithDiff but creates a third BufferedImage and applies pixel manipulation to it .
1,827
public DrawerProfile setAvatar ( Context context , Bitmap avatar ) { mAvatar = new BitmapDrawable ( context . getResources ( ) , avatar ) ; notifyDataChanged ( ) ; return this ; }
Sets an avatar image to the drawer profile
1,828
public DrawerProfile setRoundedAvatar ( Context context , Bitmap image ) { return setAvatar ( new RoundedAvatarDrawable ( new BitmapDrawable ( context . getResources ( ) , image ) . getBitmap ( ) ) ) ; }
Sets a rounded avatar image to the drawer profile
1,829
public DrawerProfile setBackground ( Context context , Bitmap background ) { mBackground = new BitmapDrawable ( context . getResources ( ) , background ) ; notifyDataChanged ( ) ; return this ; }
Sets a background to the drawer profile
1,830
public DrawerItem setImageMode ( int imageMode ) { if ( imageMode != ICON && imageMode != AVATAR && imageMode != SMALL_AVATAR ) { throw new IllegalArgumentException ( "Image mode must be either ICON or AVATAR." ) ; } mImageMode = imageMode ; notifyDataChanged ( ) ; return this ; }
Sets an image mode to the drawer item
1,831
public DrawerItem setTextSecondary ( String textSecondary , int textMode ) { mTextSecondary = textSecondary ; setTextMode ( textMode ) ; notifyDataChanged ( ) ; return this ; }
Sets a secondary text with a given text mode to the drawer item
1,832
public DrawerItem setTextMode ( int textMode ) { if ( textMode != SINGLE_LINE && textMode != TWO_LINE && textMode != THREE_LINE ) { throw new IllegalArgumentException ( "Image mode must be either SINGLE_LINE, TWO_LINE or THREE_LINE." ) ; } mTextMode = textMode ; notifyDataChanged ( ) ; return this ; }
Sets a text mode to the drawer item
1,833
public DrawerView addProfile ( DrawerProfile profile ) { if ( profile . getId ( ) <= 0 ) { profile . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerProfile oldProfile : mProfileAdapter . getItems ( ) ) { if ( oldProfile . getId ( ) == profile . getId ( ) ) { mProfileAda...
Adds a profile to the drawer view
1,834
public DrawerProfile findProfileById ( long id ) { for ( DrawerProfile profile : mProfileAdapter . getItems ( ) ) { if ( profile . getId ( ) == id ) { return profile ; } } return null ; }
Gets a profile from the drawer view
1,835
public DrawerView clearProfiles ( ) { for ( DrawerProfile profile : mProfileAdapter . getItems ( ) ) { profile . detach ( ) ; } mProfileAdapter . clear ( ) ; updateProfile ( ) ; return this ; }
Removes all profiles from the drawer view
1,836
public DrawerView addItems ( List < DrawerItem > items ) { mAdapter . setNotifyOnChange ( false ) ; for ( DrawerItem item : items ) { if ( item . getId ( ) <= 0 ) { item . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerItem oldItem : mAdapter . getItems ( ) ) { if ( old...
Adds items to the drawer view
1,837
public DrawerView addItem ( DrawerItem item ) { if ( item . getId ( ) <= 0 ) { item . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerItem oldItem : mAdapter . getItems ( ) ) { if ( oldItem . getId ( ) == item . getId ( ) ) { mAdapter . remove ( oldItem ) ; break ; } } i...
Adds an item to the drawer view
1,838
public DrawerItem findItemById ( long id ) { for ( DrawerItem item : mAdapter . getItems ( ) ) { if ( item . getId ( ) == id ) { return item ; } } return null ; }
Gets an item from the drawer view
1,839
public DrawerView selectItemById ( long id ) { mAdapterFixed . clearSelection ( ) ; int count = mAdapter . getCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { if ( mAdapter . getItem ( i ) . getId ( ) == id ) { mAdapter . select ( i ) ; return this ; } } return this ; }
Selects an item from the drawer view
1,840
public DrawerView clearItems ( ) { for ( DrawerItem item : mAdapter . getItems ( ) ) { item . detach ( ) ; } mAdapter . clear ( ) ; updateList ( ) ; return this ; }
Removes all items from the drawer view
1,841
public DrawerView addFixedItems ( List < DrawerItem > items ) { mAdapterFixed . setNotifyOnChange ( false ) ; for ( DrawerItem item : items ) { if ( item . getId ( ) <= 0 ) { item . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerItem oldItem : mAdapterFixed . getItems (...
Adds fixed items to the drawer view
1,842
public DrawerView addFixedItem ( DrawerItem item ) { if ( item . getId ( ) <= 0 ) { item . setId ( System . nanoTime ( ) * 100 + Math . round ( Math . random ( ) * 100 ) ) ; } for ( DrawerItem oldItem : mAdapterFixed . getItems ( ) ) { if ( oldItem . getId ( ) == item . getId ( ) ) { mAdapterFixed . remove ( oldItem ) ...
Adds a fixed item to the drawer view
1,843
public DrawerItem findFixedItemById ( long id ) { for ( DrawerItem item : mAdapterFixed . getItems ( ) ) { if ( item . getId ( ) == id ) { return item ; } } return null ; }
Gets a fixed item from the drawer view
1,844
public DrawerView clearFixedItems ( ) { for ( DrawerItem item : mAdapterFixed . getItems ( ) ) { item . detach ( ) ; } mAdapterFixed . clear ( ) ; updateFixedList ( ) ; return this ; }
Removes all fixed items from the drawer view
1,845
public void setAdapter ( ListAdapter adapter ) { if ( mAdapter != null ) { mAdapter . unregisterDataSetObserver ( mDataObserver ) ; } mAdapter = adapter ; if ( mAdapter != null ) { mAdapter . registerDataSetObserver ( mDataObserver ) ; mAreAllItemsSelectable = mAdapter . areAllItemsEnabled ( ) ; } setupChildren ( ) ; }
Sets the data behind this LinearListView .
1,846
public void setEmptyView ( View emptyView ) { mEmptyView = emptyView ; final ListAdapter adapter = getAdapter ( ) ; final boolean empty = ( ( adapter == null ) || adapter . isEmpty ( ) ) ; updateEmptyStatus ( empty ) ; }
Sets the view to show if the adapter is empty
1,847
private void fillBuffer ( ) throws IOException { if ( ! endOfInput && ( lastCoderResult == null || lastCoderResult . isUnderflow ( ) ) ) { encoderIn . compact ( ) ; int position = encoderIn . position ( ) ; int c = reader . read ( encoderIn . array ( ) , position , encoderIn . remaining ( ) ) ; if ( c == - 1 ) { endOfI...
Fills the internal char buffer from the reader .
1,848
public T header ( String name , String value ) { Collection < String > l = headers . get ( name ) ; if ( l == null ) { l = new ArrayList < String > ( ) ; } l . add ( value ) ; headers . put ( name , l ) ; return derived . cast ( this ) ; }
Add a header .
1,849
public T queryString ( String name , String value ) { List < String > l = queryString . get ( name ) ; if ( l == null ) { l = new ArrayList < String > ( ) ; } l . add ( value ) ; queryString . put ( name , l ) ; return derived . cast ( this ) ; }
Add a query param .
1,850
public static Link create ( final String text , final TextStyle ts , final NamedObject table ) { return new Link ( text , ts , '#' + table . getName ( ) ) ; }
Create a new styled Link to a table
1,851
public static Link create ( final String text , final NamedObject table ) { return new Link ( text , null , '#' + table . getName ( ) ) ; }
Create a new Link to a table
1,852
public static Link create ( final String text , final TextStyle ts , final String ref ) { return new Link ( text , ts , '#' + ref ) ; }
Create a new styled link to a given ref
1,853
public static Link create ( final String text , final String ref ) { return new Link ( text , null , '#' + ref ) ; }
Create a new link to a given ref
1,854
public static Link create ( final String text , final TextStyle ts , final File file ) { return new Link ( text , ts , file . toURI ( ) . toString ( ) ) ; }
Create a new styled link to a given file
1,855
public static Link create ( final String text , final File file ) { return new Link ( text , null , file . toURI ( ) . toString ( ) ) ; }
Create a new link to a given file
1,856
public static Link create ( final String text , final TextStyle ts , final URL url ) { return new Link ( text , ts , url . toString ( ) ) ; }
Create a new styled link to a given url
1,857
public static Link create ( final String text , final URL url ) { return new Link ( text , null , url . toString ( ) ) ; }
Create a new link to a given url
1,858
public TableCellStyleBuilder borderAll ( final Length size , final Color borderColor , final BorderAttribute . Style style ) { final BorderAttribute bs = new BorderAttribute ( size , borderColor , style ) ; this . bordersBuilder . all ( bs ) ; return this ; }
Add a border style for all the borders of this cell .
1,859
public TableCellStyleBuilder borderBottom ( final Length size , final Color borderColor , final BorderAttribute . Style style ) { final BorderAttribute bs = new BorderAttribute ( size , borderColor , style ) ; this . bordersBuilder . bottom ( bs ) ; return this ; }
Add a border style for the bottom border of this cell .
1,860
public TableCellStyleBuilder borderLeft ( final Length size , final Color borderColor , final BorderAttribute . Style style ) { final BorderAttribute bs = new BorderAttribute ( size , borderColor , style ) ; this . bordersBuilder . left ( bs ) ; return this ; }
Add a border style for the left border of this cell .
1,861
public TableCellStyleBuilder borderRight ( final Length size , final Color borderColor , final BorderAttribute . Style style ) { final BorderAttribute bs = new BorderAttribute ( size , borderColor , style ) ; this . bordersBuilder . right ( bs ) ; return this ; }
Add a border style for the right border of this cell .
1,862
public TableCellStyleBuilder borderTop ( final Length size , final Color borderColor , final BorderAttribute . Style style ) { final BorderAttribute bs = new BorderAttribute ( size , borderColor , style ) ; this . bordersBuilder . top ( bs ) ; return this ; }
Add a border style for the top border of this cell .
1,863
public boolean add ( final K key , final V value ) { final V curValue = this . valueByKey . get ( key ) ; if ( curValue == null ) { if ( this . mode == Mode . UPDATE ) return false ; } else { if ( this . mode == Mode . CREATE ) return false ; } if ( this . closed && ! this . valueByKey . containsKey ( key ) ) { throw n...
If mode is update then the key must exist . If the mode is create then the key must not exist . Otherwise the key may exist . If the container is frozen no new key - value pair is accepted .
1,864
public void appendEAttribute ( final Appendable appendable , final CharSequence attrName , final String attrRawValue ) throws IOException { appendable . append ( ' ' ) . append ( attrName ) . append ( "=\"" ) . append ( this . escaper . escapeXMLAttribute ( attrRawValue ) ) . append ( '"' ) ; }
Append a space and new element to the appendable element the name of the element is attrName and the value is attrRawValue . The will be escaped if necessary
1,865
public void appendAttribute ( final Appendable appendable , final CharSequence attrName , final boolean attrValue ) throws IOException { this . appendAttribute ( appendable , attrName , Boolean . toString ( attrValue ) ) ; }
Append a new element to the appendable element the name of the element is attrName and the value is the boolean attrValue .
1,866
public void appendAttribute ( final Appendable appendable , final CharSequence attrName , final CharSequence attrValue ) throws IOException { appendable . append ( ' ' ) . append ( attrName ) . append ( "=\"" ) . append ( attrValue ) . append ( '"' ) ; }
Append a space then a new element to the appendable element the name of the element is attrName and the value is attrValue . The value won t be escaped .
1,867
public void appendTag ( final Appendable appendable , final CharSequence tagName , final String content ) throws IOException { appendable . append ( '<' ) . append ( tagName ) . append ( '>' ) . append ( this . escaper . escapeXMLContent ( content ) ) . append ( "</" ) . append ( tagName ) . append ( '>' ) ; }
Append a content inside a tag
1,868
public static OdsFactory create ( final Logger logger , final Locale locale ) { final PositionUtil positionUtil = new PositionUtil ( new EqualityUtil ( ) , new TableNameUtil ( ) ) ; final WriteUtil writeUtil = WriteUtil . create ( ) ; final XMLUtil xmlUtil = XMLUtil . create ( ) ; final DataStyles format = DataStylesBu...
create an ods factory
1,869
private AnonymousOdsDocument createAnonymousDocument ( ) { final OdsElements odsElements = OdsElements . create ( this . positionUtil , this . xmlUtil , this . writeUtil , this . format , this . libreOfficeMode ) ; return AnonymousOdsDocument . create ( this . logger , this . xmlUtil , odsElements ) ; }
Create a new empty document for an anonymous writer . Use addTable to add tables .
1,870
private NamedOdsDocument createNamedDocument ( ) { final OdsElements odsElements = OdsElements . create ( this . positionUtil , this . xmlUtil , this . writeUtil , this . format , this . libreOfficeMode ) ; return NamedOdsDocument . create ( this . logger , this . xmlUtil , odsElements ) ; }
Create a new empty document for a normal writer . Use addTable to add tables .
1,871
public OdsFileWriterAdapter createWriterAdapter ( final File file ) throws IOException { final NamedOdsDocument document = this . createNamedDocument ( ) ; final ZipUTF8WriterBuilder zipUTF8Writer = ZipUTF8WriterImpl . builder ( ) . noWriterBuffer ( ) ; final OdsFileWriterAdapter writerAdapter = OdsFileWriterAdapter . ...
Create an adapter for a writer .
1,872
public Position getPosition ( final String pos ) { final String s = pos . toUpperCase ( Locale . US ) ; final int len = s . length ( ) ; int status = 0 ; int row = 0 ; int col = 0 ; int n = 0 ; while ( n < len ) { final char c = s . charAt ( n ) ; switch ( status ) { case BEGIN_LETTER : case BEGIN_DIGIT : status ++ ; i...
Convert a cell position string like B3 to the column number .
1,873
public static Color fromRGB ( final int red , final int green , final int blue ) { if ( ColorHelper . helper == null ) ColorHelper . helper = new ColorHelper ( ) ; return ColorHelper . helper . getFromRGB ( red , green , blue ) ; }
Create a color from RGB values
1,874
public Color getFromRGB ( final int red , final int green , final int blue ) { return this . getFromString ( "#" + this . toHexString ( red ) + this . toHexString ( green ) + this . toHexString ( blue ) ) ; }
Helper function to create any available color string from color values .
1,875
public static FractionStyleBuilder create ( final String name , final Locale locale ) { checker . checkStyleName ( name ) ; return new FractionStyleBuilder ( name , locale ) ; }
Create a new number style builder with the name name minimum integer digits is minIntDigits and decimal places is decPlaces .
1,876
public void appendXMLToTable ( final XMLUtil util , final Appendable appendable , final int count ) throws IOException { appendable . append ( "<table:table-column" ) ; util . appendEAttribute ( appendable , "table:style-name" , this . name ) ; if ( count > 1 ) util . appendAttribute ( appendable , "table:number-column...
Append the XML to the table representation
1,877
public void addToContentStyles ( final StylesContainer stylesContainer ) { stylesContainer . addContentStyle ( this ) ; if ( this . defaultCellStyle != null ) { stylesContainer . addContentStyle ( this . defaultCellStyle ) ; } }
Add this style to a styles container
1,878
private void setDateTimeNow ( ) { final Date dt = new Date ( ) ; this . dateTime = MetaElement . DF_DATE . format ( dt ) + "T" + MetaElement . DF_TIME . format ( dt ) ; }
Store the date and time of the document creation in the MetaElement data .
1,879
synchronized public E get ( ) { if ( this . isClosed ( ) ) throw new NoSuchElementException ( ) ; while ( this . elements . isEmpty ( ) ) { try { this . wait ( ) ; } catch ( final InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } } return this . elements . remo...
Get an element from the bus . Blocking method .
1,880
public static boolean openFile ( final File f ) { if ( desktop != null && f . exists ( ) && f . isFile ( ) ) { try { desktop . open ( f ) ; return true ; } catch ( final IOException e ) { Logger . getLogger ( FastOds . class . getName ( ) ) . log ( Level . SEVERE , "Can't open file " + f + " in appropriate application"...
Opens a file with the default application .
1,881
public void saveAs ( final File file ) throws IOException { try { final FileOutputStream out = new FileOutputStream ( file ) ; try { this . save ( out ) ; } finally { out . flush ( ) ; out . close ( ) ; } } catch ( final FileNotFoundException e ) { this . logger . log ( Level . SEVERE , "Can't open " + file , e ) ; thr...
Save the new file .
1,882
public void saveAs ( final String filename , final ZipUTF8WriterBuilder builder ) throws IOException { try { final FileOutputStream out = new FileOutputStream ( filename ) ; final ZipUTF8Writer writer = builder . build ( out ) ; try { this . save ( writer ) ; } finally { writer . close ( ) ; } } catch ( final FileNotFo...
Save the document to filename .
1,883
public F content ( final String string ) { this . curRegionBox . set ( Text . content ( string ) ) ; return ( F ) this ; }
Set the text content of the section
1,884
public static Footer simpleFooter ( final String text , final TextStyle ts ) { return new SimplePageSectionBuilder ( ) . text ( Text . styledContent ( text , ts ) ) . buildFooter ( ) ; }
Create a simple footer with a styled text
1,885
public static Header simpleHeader ( final String text , final TextStyle ts ) { return new SimplePageSectionBuilder ( ) . text ( Text . styledContent ( text , ts ) ) . buildHeader ( ) ; }
Create a simple header with a styled text
1,886
public BordersBuilder all ( final Length size , final Color color , final BorderAttribute . Style style ) { return this . all ( new BorderAttribute ( size , color , style ) ) ; }
Set all borders
1,887
public TableCellStyle addChildCellStyle ( final TableCellStyle style , final TableCell . Type type ) { final TableCellStyle newStyle ; final DataStyle dataStyle = this . format . getDataStyle ( type ) ; if ( dataStyle == null ) { newStyle = style ; } else { newStyle = this . stylesContainer . addChildCellStyle ( style ...
Create an automatic style for this TableCellStyle and this type of cell . Do not produce any effect if the type is Type . STRING or Type . VOID .
1,888
public void flushRows ( final XMLUtil util , final ZipUTF8Writer writer , final SettingsElement settingsElement ) throws IOException { this . ensureContentBegin ( util , writer ) ; final int lastTableIndex = this . tables . size ( ) - 1 ; if ( lastTableIndex == - 1 ) return ; int tableIndex = this . flushPosition . get...
Flush the rows from the last position to the current position
1,889
public void flushTables ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { this . ensureContentBegin ( util , writer ) ; final int lastTableIndex = this . tables . size ( ) - 1 ; if ( lastTableIndex < 0 ) return ; int tableIndex = this . flushPosition . getTableIndex ( ) ; Table table = this . tab...
Flush the tables .
1,890
public void writePostamble ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { if ( this . autofilters != null ) this . appendAutofilters ( writer , util ) ; writer . write ( "</office:spreadsheet>" ) ; writer . write ( "</office:body>" ) ; writer . write ( "</office:document-content>" ) ; writer ....
Write the postamble into the given writer . Used by the FinalizeFlusher and by standard write method
1,891
public void writePreamble ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { writer . putNextEntry ( new ZipEntry ( "content.xml" ) ) ; writer . write ( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ) ; writer . write ( "<office:document-content xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:...
Write the preamble into the given writer . Used by the MetaAndStylesElementsFlusher and by standard write method
1,892
public TextBuilder parStyledContent ( final String text , final TextStyle ts ) { return this . par ( ) . styledSpan ( text , ts ) ; }
Create a new paragraph with a text content
1,893
public void addChildCellStyle ( final TableCellStyle style , final TableCell . Type type ) { this . odsElements . addChildCellStyle ( style , type ) ; }
Add a cell style for a given data type . Use only if you want to flush data before the end of the document construction . Do not produce any effect if the type is Type . STRING or Type . VOID
1,894
public static PreprocessedRowsFlusher create ( final XMLUtil xmlUtil , final List < TableRow > tableRows ) throws IOException { return new PreprocessedRowsFlusher ( xmlUtil , tableRows , new StringBuilder ( STRING_BUILDER_SIZE ) ) ; }
Create an new rows flusher
1,895
public static Text styledContent ( final String text , final TextStyle ts ) { return Text . builder ( ) . parStyledContent ( text , ts ) . build ( ) ; }
Create a simple Text object with a style
1,896
public synchronized void flushAdaptee ( ) throws IOException { OdsFlusher flusher = this . flushers . poll ( ) ; if ( flusher == null ) return ; while ( flusher != null ) { this . adaptee . update ( flusher ) ; if ( flusher . isEnd ( ) ) { this . stopped = true ; this . notifyAll ( ) ; return ; } flusher = this . flush...
Flushes all available flushers to the adaptee writer . The thread falls asleep if we reach the end of the queue without a FinalizeFlusher .
1,897
public synchronized void waitForData ( ) { while ( this . flushers . isEmpty ( ) && this . isNotStopped ( ) ) { try { this . wait ( ) ; } catch ( final InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } } }
wait for the data
1,898
public String escapeTableName ( final String tableName ) { boolean toQuote = false ; int apostropheCount = 0 ; for ( int i = 0 ; i < tableName . length ( ) ; i ++ ) { final char c = tableName . charAt ( i ) ; if ( Character . isWhitespace ( c ) || c == '.' ) { toQuote = true ; } else if ( c == '\'' ) { toQuote = true ;...
9 . 2 . 1 Referencing Table Cells
1,899
public TableCellStyle addChildCellStyle ( final TableCellStyle style , final DataStyle dataStyle ) { final ChildCellStyle childKey = new ChildCellStyle ( style , dataStyle ) ; TableCellStyle anonymousStyle = this . anonymousStyleByChildCellStyle . get ( childKey ) ; if ( anonymousStyle == null ) { this . addDataStyle (...
Add a child style that mixes the cell style with a data style to the container