@Test public void cachesByBackground_WhenElementIdIsNull() { when( element.getId() ).thenReturn( null ); CellBackground bg = new CellBackground(); CellStyle style = producer.createCellStyle( null, element, bg ); CellStyle style2 = producer.createCellStyle( null, element, bg ); assertCached( style, style2 ); }
public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; }
FastExcelCellStyleProducer implements CellStyleProducer { public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; } }
FastExcelCellStyleProducer implements CellStyleProducer { public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; } FastExcelCellStyleProducer( final CellStyleProducer backend ); }
FastExcelCellStyleProducer implements CellStyleProducer { public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; } FastExcelCellStyleProducer( final CellStyleProducer backend ); CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ); ExcelFontFactory getFontFactory(); }
FastExcelCellStyleProducer implements CellStyleProducer { public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; } FastExcelCellStyleProducer( final CellStyleProducer backend ); CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ); ExcelFontFactory getFontFactory();  }