signature:
public class CellUtility { /** * Gets the cell string value with number type .
 * @ param poiCell
 * the poi cell
 * @ return the cell string value with number type */
private static String getCellStringValueWithNumberType ( final Cell poiCell ) { } }

implementation:
String result ; if ( DateUtil . isCellDateFormatted ( poiCell ) ) { result = poiCell . getDateCellValue ( ) . toString ( ) ; } else { result = BigDecimal . valueOf ( poiCell . getNumericCellValue ( ) ) . toPlainString ( ) ; // remove . 0 from end for int
if ( result . endsWith ( ".0" ) ) { result = result . substring ( 0 , result . length ( ) - 2 ) ; } } return result ;


signature:
public class CellUtility { /** * Set cell value with giving String value .
 * @ param c
 * cell .
 * @ param value
 * giving value .
 * @ return cell . */
@ SuppressWarnings ( "deprecation" ) public static Cell setCellValue ( final Cell c , final String value ) { } }

implementation: try { if ( value . length ( ) == 0 ) { c . setCellType ( CellType . BLANK ) ; } else if ( WebSheetUtility . isNumeric ( value ) ) { setCellValueNumber ( c , value ) ; } else if ( WebSheetUtility . isDate ( value ) ) { setCellValueDate ( c , value ) ; } else if ( c . getCellTypeEnum ( ) == CellType . BOOLEAN ) { setCellValueBoolean ( c , value ) ; } else { setCellValueString ( c , value ) ; } } catch ( Exception e ) { LOG . log ( Level . SEVERE , " error in setCellValue of CellUtility = " + e . getLocalizedMessage ( ) , e ) ; setCellValueString ( c , value ) ; } return c ;


signature:
public class CellUtility { /** * Sets the cell value string .
 * @ param c
 * the c
 * @ param value
 * the value */
private static void setCellValueString ( final Cell c , final String value ) { } }

implementation: c . setCellType ( CellType . STRING ) ; c . setCellValue ( value ) ;


signature:
public class CellUtility { /** * Sets the cell value boolean .
 * @ param c
 * the c
 * @ param value
 * the value */
private static void setCellValueBoolean ( final Cell c , final String value ) { } }

implementation: if ( "Y" . equalsIgnoreCase ( value ) || "Yes" . equalsIgnoreCase ( value ) || "True" . equalsIgnoreCase ( value ) ) { c . setCellValue ( true ) ; } else { c . setCellValue ( false ) ; }


signature:
public class CellUtility { /** * Sets the cell value date .
 * @ param c
 * the c
 * @ param value
 * the value */
private static void setCellValueDate ( final Cell c , final String value ) { } }

implementation: String date = WebSheetUtility . parseDate ( value ) ; setCellValueString ( c , date ) ;


signature:
public class CellUtility { /** * Sets the cell value number .
 * @ param c
 * the c
 * @ param value
 * the value */
private static void setCellValueNumber ( final Cell c , final String value ) { } }

implementation: double val = Double . parseDouble ( value . replace ( Character . toString ( ',' ) , "" ) ) ; c . setCellType ( CellType . NUMERIC ) ; c . setCellValue ( val ) ;


signature:
public class CellUtility { /** * Copy rows .
 * @ param srcSheet
 * the src sheet
 * @ param destSheet
 * the dest sheet
 * @ param srcRowStart
 * the src row start
 * @ param srcRowEnd
 * the src row end
 * @ param destRow
 * the dest row
 * @ param checkLock
 * the check lock
 * @ param setHiddenColumn
 * the set hidden column */
public static void copyRows ( final Sheet srcSheet , final Sheet destSheet , final int srcRowStart , final int srcRowEnd , final int destRow , final boolean checkLock , final boolean setHiddenColumn ) { } }

implementation:
int length = srcRowEnd - srcRowStart + 1 ; if ( length <= 0 ) { return ; } destSheet . shiftRows ( destRow , destSheet . getLastRowNum ( ) , length , true , false ) ; for ( int i = 0 ; i < length ; i ++ ) { copySingleRow ( srcSheet , destSheet , srcRowStart + i , destRow + i , checkLock , setHiddenColumn ) ; } // If there are are any merged regions in the source row , copy to new
// row
for ( int i = 0 ; i < srcSheet . getNumMergedRegions ( ) ; i ++ ) { CellRangeAddress cellRangeAddress = srcSheet . getMergedRegion ( i ) ; if ( ( cellRangeAddress . getFirstRow ( ) >= srcRowStart ) && ( cellRangeAddress . getLastRow ( ) <= srcRowEnd ) ) { int targetRowFrom = cellRangeAddress . getFirstRow ( ) - srcRowStart + destRow ; int targetRowTo = cellRangeAddress . getLastRow ( ) - srcRowStart + destRow ; CellRangeAddress newCellRangeAddress = new CellRangeAddress ( targetRowFrom , targetRowTo , cellRangeAddress . getFirstColumn ( ) , cellRangeAddress . getLastColumn ( ) ) ; destSheet . addMergedRegion ( newCellRangeAddress ) ; } }


signature:
public class CellUtility { /** * Copy single row .
 * @ param srcSheet
 * the src sheet
 * @ param destSheet
 * the dest sheet
 * @ param sourceRowNum
 * the source row num
 * @ param destinationRowNum
 * the destination row num
 * @ param checkLock
 * the check lock
 * @ param setHiddenColumn
 * the set hidden column */
private static void copySingleRow ( final Sheet srcSheet , final Sheet destSheet , final int sourceRowNum , final int destinationRowNum , final boolean checkLock , final boolean setHiddenColumn ) { } }

implementation:
// Get the source / new row
Row newRow = destSheet . getRow ( destinationRowNum ) ; Row sourceRow = srcSheet . getRow ( sourceRowNum ) ; if ( newRow == null ) { newRow = destSheet . createRow ( destinationRowNum ) ; } newRow . setHeight ( sourceRow . getHeight ( ) ) ; // Loop through source columns to add to new row
for ( int i = 0 ; i < sourceRow . getLastCellNum ( ) ; i ++ ) { // Grab a copy of the old / new cell
copyCell ( destSheet , sourceRow , newRow , i , checkLock ) ; } if ( setHiddenColumn ) { ConfigurationUtility . setOriginalRowNumInHiddenColumn ( newRow , sourceRow . getRowNum ( ) ) ; } return ;


signature:
public class CellUtility { /** * Copy cell .
 * @ param destSheet
 * the dest sheet
 * @ param sourceRow
 * the source row
 * @ param newRow
 * the new row
 * @ param cellIndex
 * the cell index
 * @ param checkLock
 * the check lock
 * @ return the int */
public static Cell copyCell ( final Sheet destSheet , final Row sourceRow , final Row newRow , final int cellIndex , final boolean checkLock ) { } }

implementation:
// If the old cell is null jump to next cell
Cell sourceCell = sourceRow . getCell ( cellIndex ) ; if ( sourceCell == null ) { return null ; } // If source cell is dest cell refresh it
boolean refreshCell = false ; if ( sourceRow . equals ( newRow ) && ( sourceCell . getColumnIndex ( ) == cellIndex ) ) { sourceRow . removeCell ( sourceCell ) ; refreshCell = true ; } Cell newCell = newRow . createCell ( cellIndex ) ; try { if ( ! refreshCell && ( sourceCell . getCellComment ( ) != null ) ) { // If there is a cell comment , copy
cloneComment ( sourceCell , newCell ) ; } copyCellSetStyle ( destSheet , sourceCell , newCell ) ; copyCellSetValue ( sourceCell , newCell , checkLock ) ; } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "copy cell set error = " + ex . getLocalizedMessage ( ) , ex ) ; } return newCell ;


signature:
public class CellUtility { /** * set cell value .
 * @ param sourceCell
 * source cell .
 * @ param newCell
 * new cell .
 * @ param checkLock
 * check lock flag . */
@ SuppressWarnings ( "deprecation" ) private static void copyCellSetValue ( final Cell sourceCell , final Cell newCell , final boolean checkLock ) { } }

implementation: CellStyle newCellStyle = newCell . getCellStyle ( ) ; String name = sourceCell . getCellTypeEnum ( ) . toString ( ) ; CellValueType e = Enum . valueOf ( CellValueType . class , name ) ; e . setCellValue ( newCell , sourceCell , checkLock , newCellStyle ) ;


signature:
public class CellUtility { /** * set up cell style .
 * @ param destSheet
 * dest sheet .
 * @ param sourceCell
 * source cell .
 * @ param newCell
 * new cell . */
@ SuppressWarnings ( "deprecation" ) private static void copyCellSetStyle ( final Sheet destSheet , final Cell sourceCell , final Cell newCell ) { } }

implementation:
CellStyle newCellStyle = getCellStyleFromSourceCell ( destSheet , sourceCell ) ; newCell . setCellStyle ( newCellStyle ) ; // If there is a cell hyperlink , copy
if ( sourceCell . getHyperlink ( ) != null ) { newCell . setHyperlink ( sourceCell . getHyperlink ( ) ) ; } // Set the cell data type
newCell . setCellType ( sourceCell . getCellTypeEnum ( ) ) ;


signature:
public class CellUtility { /** * clone existing comments into new cell comment .
 * @ param sourceCell
 * source cell .
 * @ param newCell
 * target cell . */
public static void cloneComment ( final Cell sourceCell , final Cell newCell ) { } }

implementation:
XSSFSheet sheet = ( XSSFSheet ) newCell . getSheet ( ) ; CreationHelper factory = sheet . getWorkbook ( ) . getCreationHelper ( ) ; Drawing drawing = sheet . createDrawingPatriarch ( ) ; XSSFComment sourceComment = ( XSSFComment ) sourceCell . getCellComment ( ) ; // Below code are from POI busy manual .
// When the comment box is visible , have it show in a 1x3 space
ClientAnchor anchor = createCommentAnchor ( newCell , factory ) ; // Create the comment and set the text + author
Comment comment = drawing . createCellComment ( anchor ) ; RichTextString str = factory . createRichTextString ( sourceComment . getString ( ) . toString ( ) ) ; comment . setString ( str ) ; comment . setAuthor ( sourceComment . getAuthor ( ) ) ; // Assign the comment to the cell
newCell . setCellComment ( comment ) ; comment . setColumn ( newCell . getColumnIndex ( ) ) ; comment . setRow ( newCell . getRowIndex ( ) ) ; // As POI doesn ' t has well support for comments ,
// So we have to use low level api to match the comments .
matchCommentSettings ( newCell , sourceCell ) ;


signature:
public class CellUtility { /** * Creates the comment anchor .
 * @ param newCell the new cell
 * @ param factory the factory
 * @ return the client anchor */
private static ClientAnchor createCommentAnchor ( final Cell newCell , CreationHelper factory ) { } }

implementation: ClientAnchor anchor = factory . createClientAnchor ( ) ; anchor . setCol1 ( newCell . getColumnIndex ( ) ) ; anchor . setCol2 ( newCell . getColumnIndex ( ) + 1 ) ; anchor . setRow1 ( newCell . getRowIndex ( ) ) ; anchor . setRow2 ( newCell . getRowIndex ( ) + 3 ) ; return anchor ;


signature:
public class CellUtility { /** * Creates the or insert comment .
 * @ param cell the cell
 * @ param commentStr the comment str */
public static void createOrInsertComment ( final Cell cell , final String commentStr ) { } }

implementation:
XSSFSheet sheet = ( XSSFSheet ) cell . getSheet ( ) ; CreationHelper factory = sheet . getWorkbook ( ) . getCreationHelper ( ) ; Drawing drawing = sheet . createDrawingPatriarch ( ) ; Comment comment = cell . getCellComment ( ) ; String originStr = "" ; if ( comment == null ) { // Below code are from POI busy manual .
// When the comment box is visible , have it show in a 1x3 space
ClientAnchor anchor = createCommentAnchor ( cell , factory ) ; // Create the comment and set the text + author
comment = drawing . createCellComment ( anchor ) ; } else { originStr = comment . getString ( ) . getString ( ) + "\n" ; } originStr += commentStr ; RichTextString str = factory . createRichTextString ( originStr ) ; comment . setString ( str ) ; comment . setAuthor ( "" ) ; // Assign the comment to the cell
cell . setCellComment ( comment ) ; comment . setColumn ( cell . getColumnIndex ( ) ) ; comment . setRow ( cell . getRowIndex ( ) ) ;


signature:
public class CellUtility { /** * Use low level API to match the comments setting .
 * @ param newCell
 * target cell .
 * @ param sourceCell
 * source cell . */
private static void matchCommentSettings ( final Cell newCell , final Cell sourceCell ) { } }

implementation:
try { XSSFVMLDrawing sourceVml = getVmlDrawingFromCell ( sourceCell ) ; XSSFVMLDrawing targetVml = getVmlDrawingFromCell ( newCell ) ; CTShape sourceCtShape = getCtShapeFromVml ( sourceCell , sourceVml ) ; CTShape targetCtShape = getCtShapeFromVml ( newCell , targetVml ) ; targetCtShape . setType ( sourceCtShape . getType ( ) ) ; CTClientData sourceClientData = sourceCtShape . getClientDataArray ( 0 ) ; CTClientData targetClientData = targetCtShape . getClientDataArray ( 0 ) ; String [ ] anchorArray = sourceClientData . getAnchorList ( ) . get ( 0 ) . split ( "," ) ; int shiftRows = newCell . getRowIndex ( ) - sourceCell . getRowIndex ( ) ; /* * AchorArray mappings : 0 - > col1 1 - > dx1 2 - > row1 3 - > dy1 4 - > col2 5 - > dx2 6 - > row2
 * 7 - > dy2 */
anchorArray [ 2 ] = Integer . toString ( Integer . parseInt ( anchorArray [ 2 ] . trim ( ) ) + shiftRows ) ; anchorArray [ 6 ] = Integer . toString ( Integer . parseInt ( anchorArray [ 6 ] . trim ( ) ) + shiftRows ) ; targetClientData . getAnchorList ( ) . set ( 0 , FacesUtility . strJoin ( anchorArray , "," ) ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "matchCommentSettings error = " + e . getLocalizedMessage ( ) , e ) ; }


signature:
public class CellUtility { /** * Find vmldrawing part according to cell .
 * @ param cell
 * cell .
 * @ return vmldrawing . */
private static XSSFVMLDrawing getVmlDrawingFromCell ( final Cell cell ) { } }

implementation: XSSFSheet sourceSheet = ( XSSFSheet ) cell . getSheet ( ) ; for ( POIXMLDocumentPart sourcePart : sourceSheet . getRelations ( ) ) { if ( ( sourcePart != null ) && ( sourcePart instanceof XSSFVMLDrawing ) ) { return ( XSSFVMLDrawing ) sourcePart ; } } return null ;


signature:
public class CellUtility { /** * Find CtShape from vml object . This class use reflection to invoke the
 * protected method in POI .
 * @ param sourceCell cell .
 * @ param sourceVml vml .
 * @ return ctShape .
 * @ throws ReflectiveOperationException the reflective operation exception
 * @ throws SecurityException the security exception */
@ SuppressWarnings ( "rawtypes" ) private static CTShape getCtShapeFromVml ( final Cell sourceCell , XSSFVMLDrawing sourceVml ) throws ReflectiveOperationException { } }

implementation:
Method findshape ; // int parameter
Class [ ] paramInt = new Class [ 2 ] ; paramInt [ 0 ] = Integer . TYPE ; paramInt [ 1 ] = Integer . TYPE ; findshape = sourceVml . getClass ( ) . getDeclaredMethod ( "findCommentShape" , paramInt ) ; findshape . setAccessible ( true ) ; return ( CTShape ) findshape . invoke ( sourceVml , sourceCell . getRowIndex ( ) , sourceCell . getColumnIndex ( ) ) ;


signature:
public class CellUtility { /** * create cell style from source cell .
 * @ param destSheet
 * dest sheet .
 * @ param sourceCell
 * source cell .
 * @ return cell style . */
private static CellStyle getCellStyleFromSourceCell ( final Sheet destSheet , final Cell sourceCell ) { } }

implementation:
Workbook wb = destSheet . getWorkbook ( ) ; // Copy style from old cell and apply to new cell
CellStyle newCellStyle = wb . createCellStyle ( ) ; newCellStyle . cloneStyleFrom ( sourceCell . getCellStyle ( ) ) ; return newCellStyle ;


signature:
public class CellUtility { /** * return cell index number key . e . g . $ 0 $ 0 for A1 cell .
 * @ param cell
 * input cell .
 * @ return string . */
public static String getCellIndexNumberKey ( final Cell cell ) { } }

implementation: if ( cell != null ) { return TieConstants . CELL_ADDR_PRE_FIX + cell . getColumnIndex ( ) + TieConstants . CELL_ADDR_PRE_FIX + cell . getRowIndex ( ) ; } return null ;


signature:
public class CellUtility { /** * return cell index number key . e . g . $ 0 $ 0 for A1 cell .
 * @ param columnIndex
 * column index .
 * @ param rowIndex
 * row index .
 * @ return string . */
public static String getCellIndexNumberKey ( final int columnIndex , final int rowIndex ) { } }

implementation: return TieConstants . CELL_ADDR_PRE_FIX + columnIndex + TieConstants . CELL_ADDR_PRE_FIX + rowIndex ;


signature:
public class CellUtility { /** * return cell index key with column letter and row index . e . g . $ A $ 0 for A1
 * cell .
 * @ param columnLetter
 * column letter .
 * @ param rowIndex
 * row index .
 * @ return String . */
public static String getCellIndexLetterKey ( final String columnLetter , final int rowIndex ) { } }

implementation: return TieConstants . CELL_ADDR_PRE_FIX + columnLetter + TieConstants . CELL_ADDR_PRE_FIX + rowIndex ;


signature:
public class CellUtility { /** * return cell index key with column and row index . e . g . $ A $ 0 for A1 cell .
 * @ param columnIndex
 * column index .
 * @ param rowIndex
 * row index .
 * @ return key . */
public static String getCellIndexLetterKey ( final int columnIndex , final int rowIndex ) { } }

implementation: return TieConstants . CELL_ADDR_PRE_FIX + WebSheetUtility . getExcelColumnName ( columnIndex ) + TieConstants . CELL_ADDR_PRE_FIX + rowIndex ;


signature:
public class CellUtility { /** * set up facesCell ' s attribute from poiCell and others . */
public static void convertCell ( final SheetConfiguration sheetConfig , final FacesCell fcell , final Cell poiCell , final Map < String , CellRangeAddress > cellRangeMap , final int originRowIndex , final CellAttributesMap cellAttributesMap , final String saveAttrs ) { } }

implementation:
CellRangeAddress caddress ; String key = getCellIndexNumberKey ( poiCell ) ; caddress = cellRangeMap . get ( key ) ; if ( caddress != null ) { // has col or row span
fcell . setColspan ( caddress . getLastColumn ( ) - caddress . getFirstColumn ( ) + 1 ) ; fcell . setRowspan ( caddress . getLastRow ( ) - caddress . getFirstRow ( ) + 1 ) ; } CellControlsUtility . setupControlAttributes ( originRowIndex , fcell , poiCell , sheetConfig , cellAttributesMap ) ; fcell . setHasSaveAttr ( SaveAttrsUtility . isHasSaveAttr ( poiCell , saveAttrs ) ) ;


signature:
public class CellUtility { /** * Gets the row col from component attributes .
 * @ param target
 * the target
 * @ return the row col from component attributes */
public static int [ ] getRowColFromComponentAttributes ( final UIComponent target ) { } }

implementation: int rowIndex = ( Integer ) target . getAttributes ( ) . get ( "data-row" ) ; int colIndex = ( Integer ) target . getAttributes ( ) . get ( "data-column" ) ; int [ ] list = new int [ 2 ] ; list [ 0 ] = rowIndex ; list [ 1 ] = colIndex ; return list ;


signature:
public class CellUtility { /** * Gets the inits the rows from config .
 * @ param sheetConfig
 * the sheet config
 * @ return the inits the rows from config */
public static int getInitRowsFromConfig ( final SheetConfiguration sheetConfig ) { } }

implementation: int initRows = 1 ; if ( "Repeat" . equalsIgnoreCase ( sheetConfig . getFormBodyType ( ) ) ) { initRows = sheetConfig . getBodyInitialRows ( ) ; if ( initRows < 1 ) { initRows = 1 ; } } return initRows ;


signature:
public class CellUtility { /** * Gets the faces row from body row .
 * @ param row
 * the row
 * @ param bodyRows
 * the body rows
 * @ param topRow
 * the top row
 * @ return faces row */
public static FacesRow getFacesRowFromBodyRow ( final int row , final List < FacesRow > bodyRows , final int topRow ) { } }

implementation: FacesRow frow = null ; try { frow = bodyRows . get ( row - topRow ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "getFacesRowFromBodyRow Error row = " + row + "top row = " + topRow + " ; error = " + e . getLocalizedMessage ( ) , e ) ; } return frow ;


signature:
public class CellUtility { /** * Gets the faces cell from body row .
 * @ param row
 * the row
 * @ param col
 * the col
 * @ param bodyRows
 * the body rows
 * @ param topRow
 * the top row
 * @ param leftCol
 * the left col
 * @ return the faces cell from body row */
public static FacesCell getFacesCellFromBodyRow ( final int row , final int col , final List < FacesRow > bodyRows , final int topRow , final int leftCol ) { } }

implementation: FacesCell cell = null ; try { cell = bodyRows . get ( row - topRow ) . getCells ( ) . get ( col - leftCol ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "getFacesCellFromBodyRow Error row = " + row + " col = " + col + "top row = " + topRow + " leftCol = " + leftCol + " ; error = " + e . getLocalizedMessage ( ) , e ) ; } return cell ;


signature:
public class CellUtility { /** * Gets the poi cell with row col from current page .
 * @ param rowIndex
 * the row index
 * @ param colIndex
 * the col index
 * @ param wb
 * workbook .
 * @ return the poi cell with row col from current page */
public static Cell getPoiCellWithRowColFromCurrentPage ( final int rowIndex , final int colIndex , final Workbook wb ) { } }

implementation: if ( wb != null ) { return getPoiCellFromSheet ( rowIndex , colIndex , wb . getSheetAt ( wb . getActiveSheetIndex ( ) ) ) ; } return null ;


signature:
public class CellUtility { /** * Gets the poi cell from sheet .
 * @ param rowIndex
 * the row index
 * @ param colIndex
 * the col index
 * @ param sheet1
 * the sheet 1
 * @ return the poi cell from sheet */
public static Cell getPoiCellFromSheet ( final int rowIndex , final int colIndex , final Sheet sheet1 ) { } }

implementation: if ( ( sheet1 != null ) && ( sheet1 . getRow ( rowIndex ) != null ) ) { return sheet1 . getRow ( rowIndex ) . getCell ( colIndex ) ; } return null ;


signature:
public class CellUtility { /** * Gets the skey from poi cell .
 * @ param poiCell the poi cell
 * @ return the skey from poi cell */
public static String getSkeyFromPoiCell ( final Cell poiCell ) { } }

implementation: return poiCell . getSheet ( ) . getSheetName ( ) + "!" + CellUtility . getCellIndexNumberKey ( poiCell . getColumnIndex ( ) , poiCell . getRowIndex ( ) ) ;


signature:
public class CellUtility { /** * Gets the or add tie cell in map .
 * @ param poiCell the poi cell
 * @ param tieCells the tie cells
 * @ return the or add tie cell in map */
public static TieCell getOrAddTieCellInMap ( final Cell poiCell , HashMap < String , TieCell > tieCells ) { } }

implementation: String skey = CellUtility . getSkeyFromPoiCell ( poiCell ) ; TieCell tieCell = tieCells . get ( skey ) ; if ( tieCell == null ) { tieCell = new TieCell ( ) ; tieCell . setSkey ( skey ) ; tieCells . put ( skey , tieCell ) ; } return tieCell ;


signature:
public class BarChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getSerListFromCtObjChart ( java . lang . Object ) */
@ SuppressWarnings ( "rawtypes" ) @ Override public List getSerListFromCtObjChart ( final Object ctObjChart ) { } }

implementation: if ( ctObjChart instanceof CTBarChart ) { return ( ( CTBarChart ) ctObjChart ) . getSerList ( ) ; } return emptySerlist ;


signature:
public class BarChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getCtAxDataSourceFromSerList ( java . util . List ) */
@ SuppressWarnings ( "rawtypes" ) @ Override public final CTAxDataSource getCtAxDataSourceFromSerList ( final List serList ) { } }

implementation: if ( ( serList != null ) && ( ! serList . isEmpty ( ) ) && ( serList . get ( 0 ) instanceof CTBarSer ) ) { return ( ( CTBarSer ) serList . get ( 0 ) ) . getCat ( ) ; } return null ;


signature:
public class BarChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getShapePropertiesFromCTSer ( java . lang . Object ) */
@ Override public final CTShapeProperties getShapePropertiesFromCTSer ( final Object ctObjSer ) { } }

implementation: if ( ctObjSer instanceof CTBarSer ) { return ( ( CTBarSer ) ctObjSer ) . getSpPr ( ) ; } return null ;


signature:
public class BarChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getCTNumDataSourceFromCTSer ( java . lang . Object ) */
@ Override public final CTNumDataSource getCTNumDataSourceFromCTSer ( final Object ctObjSer ) { } }

implementation: if ( ctObjSer instanceof CTBarSer ) { return ( ( CTBarSer ) ctObjSer ) . getVal ( ) ; } return null ;


signature:
public class TieWebSheetBeanCurrent { /** * Gets the current data context name .
 * @ return the currentDataContextName */
public final String getCurrentDataContextName ( ) { } }

implementation: if ( currentDataContextName == null ) { StringBuilder sb = new StringBuilder ( ) ; List < String > list = this . getCurrentDataContextNameList ( ) ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( ":" + list . get ( i ) ) ; } else { sb . append ( list . get ( i ) ) ; } } this . setCurrentDataContextName ( sb . toString ( ) ) ; } return currentDataContextName ;


signature:
public class ExpressionEngine { /** * Evaluate the expression .
 * @ param expression
 * string input expression .
 * @ param context
 * context map .
 * @ return evaluated object . */
public final Object evaluate ( final String expression , final Map < String , Object > context ) { } }

implementation: JexlContext jexlContext = new MapContext ( context ) ; try { JexlEngine jexl = JEXL_LOCAL . get ( ) ; Map < String , Expression > expMap = JEXL_MAP_LOCAL . get ( ) ; Expression jexlExpression = expMap . get ( expression ) ; if ( jexlExpression == null ) { jexlExpression = jexl . createExpression ( expression ) ; expMap . put ( expression , jexlExpression ) ; } return jexlExpression . evaluate ( jexlContext ) ; } catch ( Exception e ) { throw new EvaluationException ( e ) ; }


signature:
public class ExpressionEngine { /** * evaluate from giving context .
 * @ param context
 * context .
 * @ return object evaluated . */
public final Object evaluate ( final Map < String , Object > context ) { } }

implementation: JexlContext jexlContext = new MapContext ( context ) ; try { return jExpression . evaluate ( jexlContext ) ; } catch ( Exception e ) { throw new EvaluationException ( "An error occurred when evaluating expression " + jExpression . getExpression ( ) , e ) ; }


signature:
public class SerialRow { /** * save the row before serialize .
 * @ param out
 * outputstream .
 * @ throws IOException
 * io exception . */
private void writeObject ( final java . io . ObjectOutputStream out ) throws IOException { } }

implementation: this . rowIndex = this . getRow ( ) . getRowNum ( ) ; out . defaultWriteObject ( ) ;


signature:
public class RowsMapping { /** * Adds the row .
 * @ param sourceRowNum
 * the source row num
 * @ param targetRow
 * the target row */
public final void addRow ( final Integer sourceRowNum , final Row targetRow ) { } }

implementation: List < SerialRow > mapRowList = rowsMap . get ( sourceRowNum ) ; if ( mapRowList == null ) { mapRowList = new ArrayList < > ( ) ; } SerialRow serialTarget = new SerialRow ( targetRow , - 1 ) ; if ( ! mapRowList . contains ( serialTarget ) ) { mapRowList . add ( serialTarget ) ; rowsMap . put ( sourceRowNum , mapRowList ) ; }


signature:
public class RowsMapping { /** * Removes the row .
 * @ param sourceRowNum
 * the source row num
 * @ param targetRow
 * the target row */
public final void removeRow ( final Integer sourceRowNum , final Row targetRow ) { } }

implementation: List < SerialRow > mapRowList = rowsMap . get ( sourceRowNum ) ; if ( mapRowList != null ) { mapRowList . remove ( new SerialRow ( targetRow , - 1 ) ) ; rowsMap . put ( sourceRowNum , mapRowList ) ; }


signature:
public class RowsMapping { /** * Merge map .
 * @ param addMap
 * the add map */
public final void mergeMap ( final RowsMapping addMap ) { } }

implementation: Map < Integer , List < SerialRow > > map = addMap . getRowsMap ( ) ; for ( Map . Entry < Integer , List < SerialRow > > entry : map . entrySet ( ) ) { List < SerialRow > entryRowList = entry . getValue ( ) ; if ( ( entryRowList != null ) && ( ! entryRowList . isEmpty ( ) ) ) { for ( SerialRow row : entryRowList ) { this . addRow ( entry . getKey ( ) , row . getRow ( ) ) ; } } }


signature:
public class RowsMapping { /** * recover rows mapping by using it ' s address .
 * @ param sheet
 * sheet . */
public final void recover ( final Sheet sheet ) { } }

implementation: for ( Map . Entry < Integer , List < SerialRow > > entry : this . getRowsMap ( ) . entrySet ( ) ) { List < SerialRow > listRow = entry . getValue ( ) ; for ( SerialRow serialRow : listRow ) { serialRow . recover ( sheet ) ; } }


signature:
public class ChartUtility { /** * return chart type from CTChart object .
 * @ param ctChart
 * object .
 * @ return ChartType . */
public static ChartType getChartType ( final CTChart ctChart ) { } }

implementation: CTPlotArea plotArea = ctChart . getPlotArea ( ) ; for ( ChartType chartType : ChartType . values ( ) ) { if ( chartType . isThisType ( plotArea ) ) { return chartType ; } } return null ;


signature:
public class ChartUtility { /** * Convert style string to stroke object .
 * @ param style
 * One of STYLE _ xxx .
 * @ return Stroke for < i > style < / i > or null if style not supported . */
public static BasicStroke toStroke ( final String style ) { } }

implementation: BasicStroke result = null ; if ( style != null ) { float lineWidth = STROKE_DEFAULT_LINE_WIDTH ; float [ ] dash = { STROKE_DEFAULT_DASH_WIDTH } ; float [ ] dot = { lineWidth } ; if ( style . equalsIgnoreCase ( STYLE_LINE ) ) { result = new BasicStroke ( lineWidth ) ; } else if ( style . equalsIgnoreCase ( STYLE_DASH ) ) { result = new BasicStroke ( lineWidth , BasicStroke . CAP_BUTT , BasicStroke . JOIN_MITER , STROKE_MITER_LIMIT_STYLE_DASH , dash , STROKE_DEFAULT_DASHPHASE ) ; } else if ( style . equalsIgnoreCase ( STYLE_DOT ) ) { result = new BasicStroke ( lineWidth , BasicStroke . CAP_BUTT , BasicStroke . JOIN_MITER , STROKE_MITER_LIMIT_STYLE_DOT , dot , STROKE_DEFAULT_DASHPHASE ) ; } } return result ;


signature:
public class ChartUtility { /** * init chart data .
 * @ param chartId
 * chartId .
 * @ param chart
 * chart .
 * @ param wb
 * wb .
 * @ return chartdata . */
public static ChartData initChartDataFromXSSFChart ( final String chartId , final XSSFChart chart , final XSSFWorkbook wb ) { } }

implementation: ThemesTable themeTable = wb . getStylesSource ( ) . getTheme ( ) ; ChartData chartData = new ChartData ( ) ; XSSFRichTextString chartTitle = chart . getTitle ( ) ; if ( chartTitle != null ) { chartData . setTitle ( chartTitle . toString ( ) ) ; } CTChart ctChart = chart . getCTChart ( ) ; ChartType chartType = ChartUtility . getChartType ( ctChart ) ; if ( chartType == null ) { throw new IllegalChartException ( "Unknown chart type" ) ; } chartData . setBgColor ( ColorUtility . getBgColor ( ctChart . getPlotArea ( ) , themeTable ) ) ; chartData . setId ( chartId ) ; chartData . setType ( chartType ) ; List < CTCatAx > ctCatAxList = ctChart . getPlotArea ( ) . getCatAxList ( ) ; if ( ( ctCatAxList != null ) && ( ! ctCatAxList . isEmpty ( ) ) ) { chartData . setCatAx ( new ChartAxis ( ctCatAxList . get ( 0 ) ) ) ; } List < CTValAx > ctValAxList = ctChart . getPlotArea ( ) . getValAxList ( ) ; if ( ( ctValAxList != null ) && ( ! ctValAxList . isEmpty ( ) ) ) { chartData . setValAx ( new ChartAxis ( ctValAxList . get ( 0 ) ) ) ; } ChartObject ctObj = chartType . createChartObject ( ) ; if ( ctObj == null ) { throw new IllegalChartException ( "Cannot create chart object." ) ; } setUpChartData ( chartData , ctChart , themeTable , ctObj ) ; return chartData ;


signature:
public class ChartUtility { /** * build chartData for line chart . chartData include categoryList and
 * seriesList which used for generate jfreechart .
 * @ param chartData
 * chart data .
 * @ param ctChart
 * ct chart .
 * @ param themeTable
 * themeTable used for get color with theme name .
 * @ param ctObj
 * ct object . */
public static void setUpChartData ( final ChartData chartData , final CTChart ctChart , final ThemesTable themeTable , final ChartObject ctObj ) { } }

implementation:
Object chartObj = null ; @ SuppressWarnings ( "rawtypes" ) List plotCharts = ctObj . getChartListFromCtChart ( ctChart ) ; // chart object
if ( plotCharts != null && ( ! plotCharts . isEmpty ( ) ) ) { chartObj = plotCharts . get ( 0 ) ; } if ( chartObj != null ) { @ SuppressWarnings ( "rawtypes" ) List bsers = ctObj . getSerListFromCtObjChart ( chartObj ) ; if ( ! AppUtils . emptyList ( bsers ) ) { chartData . buildCategoryList ( ctObj . getCtAxDataSourceFromSerList ( bsers ) ) ; chartData . buildSeriesList ( bsers , themeTable , ctObj ) ; } }


signature:
public class ChartUtility { /** * retrieve anchor information from draw . xml for all the charts in the
 * workbook . then save them to anchors map .
 * @ param wb
 * workbook .
 * @ param charsData
 * the chars data */
public static void initXSSFAnchorsMap ( final XSSFWorkbook wb , final ChartsData charsData ) { } }

implementation: Map < String , ClientAnchor > anchortMap = charsData . getChartAnchorsMap ( ) ; Map < String , String > positionMap = charsData . getChartPositionMap ( ) ; anchortMap . clear ( ) ; positionMap . clear ( ) ; for ( int i = 0 ; i < wb . getNumberOfSheets ( ) ; i ++ ) { initXSSFAnchorsMapForSheet ( anchortMap , positionMap , wb . getSheetAt ( i ) ) ; }


signature:
public class ChartUtility { /** * Inits the XSSF anchors map for sheet .
 * @ param anchortMap
 * the anchort map
 * @ param positionMap
 * the position map
 * @ param sheet
 * the sheet */
private static void initXSSFAnchorsMapForSheet ( final Map < String , ClientAnchor > anchortMap , final Map < String , String > positionMap , final XSSFSheet sheet ) { } }

implementation: XSSFDrawing drawing = sheet . createDrawingPatriarch ( ) ; CTDrawing ctDrawing = drawing . getCTDrawing ( ) ; if ( ctDrawing . sizeOfTwoCellAnchorArray ( ) <= 0 ) { return ; } List < CTTwoCellAnchor > alist = ctDrawing . getTwoCellAnchorList ( ) ; for ( int j = 0 ; j < alist . size ( ) ; j ++ ) { CTTwoCellAnchor ctanchor = alist . get ( j ) ; String singleChartId = getAnchorAssociateChartId ( ctanchor ) ; if ( singleChartId != null ) { String chartId = sheet . getSheetName ( ) + "!" + singleChartId ; int dx1 = ( int ) ctanchor . getFrom ( ) . getColOff ( ) ; int dy1 = ( int ) ctanchor . getFrom ( ) . getRowOff ( ) ; int dx2 = ( int ) ctanchor . getTo ( ) . getColOff ( ) ; int dy2 = ( int ) ctanchor . getTo ( ) . getRowOff ( ) ; int col1 = ctanchor . getFrom ( ) . getCol ( ) ; int row1 = ctanchor . getFrom ( ) . getRow ( ) ; int col2 = ctanchor . getTo ( ) . getCol ( ) ; int row2 = ctanchor . getTo ( ) . getRow ( ) ; anchortMap . put ( chartId , new XSSFClientAnchor ( dx1 , dy1 , dx2 , dy2 , col1 , row1 , col2 , row2 ) ) ; positionMap . put ( WebSheetUtility . getFullCellRefName ( sheet . getSheetName ( ) , row1 , col1 ) , chartId ) ; } }


signature:
public class ChartUtility { /** * Gets the anchor associate chart id .
 * @ param ctanchor
 * the ctanchor
 * @ return the anchor associate chart id */
private static String getAnchorAssociateChartId ( final CTTwoCellAnchor ctanchor ) { } }

implementation: if ( ctanchor . getGraphicFrame ( ) == null ) { return null ; } Node parentNode = ctanchor . getGraphicFrame ( ) . getGraphic ( ) . getGraphicData ( ) . getDomNode ( ) ; NodeList childNodes = parentNode . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node childNode = childNodes . item ( i ) ; if ( ( childNode != null ) && ( "c:chart" . equalsIgnoreCase ( childNode . getNodeName ( ) ) ) && ( childNode . hasAttributes ( ) ) ) { String rId = getChartIdFromChildNodeAttributes ( childNode . getAttributes ( ) ) ; if ( rId != null ) { return rId ; } } } return null ;


signature:
public class ChartUtility { /** * Gets the chart id from child node attributes .
 * @ param attrs
 * the attrs
 * @ return the chart id from child node attributes */
private static String getChartIdFromChildNodeAttributes ( final NamedNodeMap attrs ) { } }

implementation: for ( int j = 0 ; j < attrs . getLength ( ) ; j ++ ) { Attr attribute = ( Attr ) attrs . item ( j ) ; if ( "r:id" . equalsIgnoreCase ( attribute . getName ( ) ) ) { return attribute . getValue ( ) ; } } return null ;


signature:
public class SerialWorkbook { /** * save the workbook before serialize .
 * @ param out
 * outputstream .
 * @ throws IOException
 * io exception . */
private void writeObject ( final java . io . ObjectOutputStream out ) throws IOException { } }

implementation: out . defaultWriteObject ( ) ; if ( wb != null ) { wb . write ( out ) ; }


signature:
public class SerialWorkbook { /** * recover the cell reference to the sheet . */
public void recover ( ) { } }

implementation: Map < String , SheetConfiguration > map = this . getSheetConfigMap ( ) ; for ( Entry < String , SheetConfiguration > entry : map . entrySet ( ) ) { entry . getValue ( ) . recover ( this . getWb ( ) ) ; }


signature:
public class EachCommand { /** * ( non - Javadoc )
 * @ see
 * org . tiefaces . components . websheet . configuration . Command # buildAt ( java . lang .
 * String , org . tiefaces . components . websheet . configuration . ConfigBuildRef ,
 * int , java . util . Map , java . util . List ) */
@ SuppressWarnings ( { } }

implementation:
"rawtypes" , "unchecked" } ) @ Override public final int buildAt ( String fullName , final ConfigBuildRef configBuildRef , final int atRow , final Map < String , Object > context , final List < RowsMapping > currentRowsMappingList ) { fullName = fullName + ":" + this . getCommandName ( ) ; Collection itemsCollection = ConfigurationUtility . transformToCollectionObject ( configBuildRef . getEngine ( ) , this . getItems ( ) , context ) ; String objClassName = this . getClassName ( ) ; if ( objClassName == null ) { objClassName = configBuildRef . getCollectionObjNameMap ( ) . get ( this . getVar ( ) ) ; } if ( configBuildRef . isAddMode ( ) && itemsCollection . isEmpty ( ) ) { // do something here to insert one empty object
try { itemsCollection . add ( Class . forName ( objClassName ) . newInstance ( ) ) ; } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "canot insert empty object in itemCollections error = " + ex . getLocalizedMessage ( ) , ex ) ; return 0 ; } } int insertPosition = buildEachObjects ( fullName , configBuildRef , atRow , context , currentRowsMappingList , itemsCollection , objClassName ) ; return insertPosition - atRow ;


signature:
public class EachCommand { /** * Builds the each objects .
 * @ param fullName
 * the full name
 * @ param configBuildRef
 * the config build ref
 * @ param atRow
 * the at row
 * @ param context
 * the context
 * @ param currentRowsMappingList
 * the current rows mapping list
 * @ param itemsCollection
 * the items collection
 * @ param objClassName
 * the obj class name
 * @ return the int */
@ SuppressWarnings ( "rawtypes" ) private int buildEachObjects ( String fullName , final ConfigBuildRef configBuildRef , final int atRow , final Map < String , Object > context , final List < RowsMapping > currentRowsMappingList , final Collection itemsCollection , final String objClassName ) { } }

implementation:
int index = 0 ; int insertPosition = atRow ; String thisObjClassName = objClassName ; // loop through each object in the collection
for ( Object obj : itemsCollection ) { // gather and cache object class name which used for add row
if ( thisObjClassName == null ) { thisObjClassName = obj . getClass ( ) . getName ( ) ; configBuildRef . getCollectionObjNameMap ( ) . put ( this . var , thisObjClassName ) ; } RowsMapping unitRowsMapping = new RowsMapping ( ) ; context . put ( var , obj ) ; CommandUtility . insertEachTemplate ( this . getConfigRange ( ) , configBuildRef , index , insertPosition , unitRowsMapping ) ; ConfigRange currentRange = ConfigurationUtility . buildCurrentRange ( this . getConfigRange ( ) , configBuildRef . getSheet ( ) , insertPosition ) ; currentRowsMappingList . add ( unitRowsMapping ) ; String unitFullName = fullName + "." + index ; currentRange . getAttrs ( ) . setAllowAdd ( false ) ; if ( ( this . allowAdd != null ) && ( "true" . equalsIgnoreCase ( this . allowAdd . trim ( ) ) ) ) { currentRange . getAttrs ( ) . setAllowAdd ( true ) ; configBuildRef . setBodyAllowAdd ( true ) ; } configBuildRef . putShiftAttrs ( unitFullName , currentRange . getAttrs ( ) , new RowsMapping ( unitRowsMapping ) ) ; int length = currentRange . buildAt ( unitFullName , configBuildRef , insertPosition , context , currentRowsMappingList ) ; currentRange . getAttrs ( ) . setFinalLength ( length ) ; insertPosition += length ; currentRowsMappingList . remove ( unitRowsMapping ) ; index ++ ; context . remove ( var ) ; } return insertPosition ;


signature:
public class CellHelper { /** * Save data in context .
 * @ param poiCell
 * the poi cell
 * @ param strValue
 * the str value */
public final void saveDataInContext ( final Cell poiCell , final String strValue ) { } }

implementation: String saveAttr = SaveAttrsUtility . prepareContextAndAttrsForCell ( poiCell , ConfigurationUtility . getFullNameFromRow ( poiCell . getRow ( ) ) , this ) ; if ( saveAttr != null ) { SaveAttrsUtility . saveDataToObjectInContext ( parent . getSerialDataContext ( ) . getDataContext ( ) , saveAttr , strValue , parent . getExpEngine ( ) ) ; parent . getHelper ( ) . getWebSheetLoader ( ) . setUnsavedStatus ( RequestContext . getCurrentInstance ( ) , true ) ; }


signature:
public class CellHelper { /** * recalc whole workbook . */
public final void reCalc ( ) { } }

implementation:
parent . getFormulaEvaluator ( ) . clearAllCachedResultValues ( ) ; try { parent . getFormulaEvaluator ( ) . evaluateAll ( ) ; } catch ( Exception ex ) { // skip the formula exception when recalc but log it
LOG . log ( Level . SEVERE , " recalc formula error : " + ex . getLocalizedMessage ( ) , ex ) ; }


signature:
public class CellHelper { /** * Gets the poi cell with row col from current page .
 * @ param rowIndex
 * the row index
 * @ param colIndex
 * the col index
 * @ return the poi cell with row col from current page */
public final Cell getPoiCellWithRowColFromCurrentPage ( final int rowIndex , final int colIndex ) { } }

implementation: return CellUtility . getPoiCellWithRowColFromCurrentPage ( rowIndex , colIndex , parent . getWb ( ) ) ;


signature:
public class CellHelper { /** * Gets the poi cell with row col from tab .
 * @ param rowIndex
 * the row index
 * @ param colIndex
 * the col index
 * @ param tabName
 * the tab name
 * @ return the poi cell with row col from tab */
public final Cell getPoiCellWithRowColFromTab ( final int rowIndex , final int colIndex , final String tabName ) { } }

implementation: if ( parent . getWb ( ) != null ) { return CellUtility . getPoiCellFromSheet ( rowIndex , colIndex , parent . getWb ( ) . getSheet ( parent . getSheetConfigMap ( ) . get ( tabName ) . getSheetName ( ) ) ) ; } return null ;


signature:
public class CellHelper { /** * Gets the faces cell with row col from current page .
 * @ param rowIndex
 * the row index
 * @ param colIndex
 * the col index
 * @ return the faces cell with row col from current page */
public final FacesCell getFacesCellWithRowColFromCurrentPage ( final int rowIndex , final int colIndex ) { } }

implementation: if ( parent . getBodyRows ( ) != null ) { int top = parent . getCurrent ( ) . getCurrentTopRow ( ) ; int left = parent . getCurrent ( ) . getCurrentLeftColumn ( ) ; return parent . getBodyRows ( ) . get ( rowIndex - top ) . getCells ( ) . get ( colIndex - left ) ; } return null ;


signature:
public class CellHelper { /** * Restore data context .
 * @ param fullName
 * the full name */
public final void restoreDataContext ( final String fullName ) { } }

implementation:
String [ ] parts = fullName . split ( ":" ) ; if ( ! isNeedRestore ( fullName , parts ) ) { return ; } boolean stopSkip = false ; List < String > list = parent . getCurrent ( ) . getCurrentDataContextNameList ( ) ; int listSize = list . size ( ) ; // prepare collection data in context .
// must loop through the full name which may have multiple
// layer .
// i . e . E . department . 1 : E . employee . 0
// need prepare department . 1 and employee . 0
for ( int i = 0 ; i < parts . length ; i ++ ) { String part = parts [ i ] ; boolean skip = false ; if ( ( ! stopSkip ) && ( i < listSize ) ) { String listPart = list . get ( i ) ; if ( part . equalsIgnoreCase ( listPart ) ) { skip = true ; } } if ( ! skip ) { stopSkip = true ; startRestoreDataContext ( part ) ; } } if ( stopSkip ) { parent . getCurrent ( ) . setCurrentDataContextName ( fullName ) ; } return ;


signature:
public class CellHelper { /** * Get last collect object from full name .
 * Last collect contain each command , collection and index .
 * @ param fullName
 * the full name
 * @ return the collection object */
public final CollectionObject getLastCollect ( final String fullName ) { } }

implementation: String [ ] parts = fullName . split ( ":" ) ; String part = parts [ parts . length - 1 ] ; return startRestoreDataContext ( part ) ;


signature:
public class CellHelper { /** * Checks if is need restore .
 * @ param fullName
 * the full name
 * @ param parts
 * the parts
 * @ return true , if is need restore */
private boolean isNeedRestore ( final String fullName , final String [ ] parts ) { } }

implementation: if ( fullName == null ) { return false ; } if ( ( parent . getCurrent ( ) . getCurrentDataContextName ( ) != null ) && ( parent . getCurrent ( ) . getCurrentDataContextName ( ) . toLowerCase ( ) . startsWith ( fullName . toLowerCase ( ) ) ) ) { return false ; } return ( ( parts != null ) && ( parts . length > 1 ) ) ;


signature:
public class CellHelper { /** * Start restore data context .
 * @ param part
 * the part
 * @ return the collection object */
private CollectionObject startRestoreDataContext ( final String part ) { } }

implementation: if ( part . startsWith ( TieConstants . EACH_COMMAND_FULL_NAME_PREFIX ) ) { String [ ] varparts = part . split ( "\\." ) ; CollectionObject collect = new CollectionObject ( ) ; collect . setEachCommand ( CommandUtility . getEachCommandFromPartsName ( parent . getCurrentSheetConfig ( ) . getCommandIndexMap ( ) , varparts ) ) ; collect . setLastCollection ( ConfigurationUtility . transformToCollectionObject ( parent . getExpEngine ( ) , collect . getEachCommand ( ) . getItems ( ) , parent . getSerialDataContext ( ) . getDataContext ( ) ) ) ; collect . setLastCollectionIndex ( CommandUtility . prepareCollectionDataInContext ( varparts , collect . getLastCollection ( ) , parent . getSerialDataContext ( ) . getDataContext ( ) ) ) ; return collect ; } return null ;


signature:
public class ConfigRange { /** * Shift row ref .
 * @ param sheet
 * the sheet
 * @ param shiftnum
 * the shiftnum */
public final void shiftRowRef ( final Sheet sheet , final int shiftnum ) { } }

implementation: try { this . setFirstRowRef ( sheet . getRow ( attrs . getFirstRowAddr ( ) . getRow ( ) + shiftnum ) . getCell ( attrs . getFirstRowAddr ( ) . getColumn ( ) , MissingCellPolicy . CREATE_NULL_AS_BLANK ) , false ) ; this . setLastRowPlusRef ( sheet , attrs . getLastRowPlusAddr ( ) . getColumn ( ) , attrs . getLastRowPlusAddr ( ) . getRow ( ) + shiftnum - 1 , false ) ; if ( commandList != null ) { for ( ConfigCommand command : commandList ) { command . shiftRowRef ( sheet , shiftnum ) ; } } } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "shiftRowRef error =" + ex . getLocalizedMessage ( ) , ex ) ; }


signature:
public class ConfigRange { /** * set first cell also set static relative address firstCellAddress .
 * @ param pFirstRowRef
 * first cell .
 * @ param alsoCreateAddr
 * whether need create cell address . */
public final void setFirstRowRef ( final Cell pFirstRowRef , final boolean alsoCreateAddr ) { } }

implementation: this . attrs . setFirstRowRef ( pFirstRowRef ) ; if ( alsoCreateAddr ) { this . setFirstRowAddr ( new SerialCellAddress ( pFirstRowRef ) ) ; }


signature:
public class ConfigRange { /** * set last cell also set static relative address lastCellAddress .
 * @ param sheet
 * sheet .
 * @ param rightCol
 * rightColumn .
 * @ param lastRow
 * lastRow .
 * @ param alsoSetAddr
 * whether need create cell address . */
public final void setLastRowPlusRef ( final Sheet sheet , final int rightCol , final int lastRow , final boolean alsoSetAddr ) { } }

implementation: if ( ( lastRow >= 0 ) && ( sheet != null ) && ( rightCol >= 0 ) ) { Row row = sheet . getRow ( lastRow + 1 ) ; if ( row == null ) { row = sheet . createRow ( lastRow + 1 ) ; } Cell cell = row . getCell ( rightCol ) ; if ( cell == null ) { cell = row . getCell ( rightCol , MissingCellPolicy . CREATE_NULL_AS_BLANK ) ; this . attrs . setLastCellCreated ( true ) ; } else { this . attrs . setLastCellCreated ( false ) ; } this . attrs . setLastRowPlusRef ( cell ) ; if ( alsoSetAddr ) { this . setLastRowPlusAddr ( new SerialCellAddress ( cell ) ) ; } } else { this . attrs . setLastRowPlusRef ( null ) ; if ( alsoSetAddr ) { this . attrs . setLastRowPlusAddr ( null ) ; } }


signature:
public class ConfigRange { /** * build the config range at specified point ( start row ) . context include
 * the data objects for evaluation . build sequence is inside - out . e . g . first
 * build all the command area the range included . each command will hold the
 * final length after data populated . then buildCells build all cells in the
 * range except those commands . and update the formulas .
 * @ param fullName
 * the full name
 * @ param configBuildRef
 * the config build ref
 * @ param atRow
 * the at row
 * @ param context
 * context map .
 * @ param currentRowsMappingList
 * the current rows mapping list
 * @ return final length . */
public final int buildAt ( final String fullName , final ConfigBuildRef configBuildRef , final int atRow , final Map < String , Object > context , final List < RowsMapping > currentRowsMappingList ) { } }

implementation: if ( commandList != null ) { for ( int i = 0 ; i < commandList . size ( ) ; i ++ ) { Command command = commandList . get ( i ) ; command . setFinalLength ( 0 ) ; int populatedLength = command . buildAt ( fullName , configBuildRef , command . getConfigRange ( ) . getFirstRowRef ( ) . getRowIndex ( ) , context , currentRowsMappingList ) ; command . setFinalLength ( populatedLength ) ; } } buildCells ( fullName , configBuildRef , atRow , context , currentRowsMappingList ) ; return this . getLastRowPlusRef ( ) . getRowIndex ( ) - this . getFirstRowRef ( ) . getRowIndex ( ) ;


signature:
public class ConfigRange { /** * Build all the static cells in the range ( exclude command areas ) .
 * @ param fullName
 * the full name
 * @ param configBuildRef
 * the config build ref
 * @ param atRow
 * start row .
 * @ param context
 * context .
 * @ param rowsMappingList
 * the rows mapping list */
private void buildCells ( final String fullName , final ConfigBuildRef configBuildRef , final int atRow , final Map < String , Object > context , final List < RowsMapping > rowsMappingList ) { } }

implementation:
if ( ( context == null ) || context . isEmpty ( ) ) { // no need to evaluate as there ' s no data object .
return ; } // keep rowsMappingList as current as no change
// allRowsMappingList = child + current
List < RowsMapping > allRowsMappingList = ConfigurationUtility . findChildRowsMappingFromShiftMap ( fullName , configBuildRef . getShiftMap ( ) ) ; allRowsMappingList . addAll ( rowsMappingList ) ; int lastRowPlus = this . getLastRowPlusRef ( ) . getRowIndex ( ) ; ShiftFormulaRef shiftFormulaRef = new ShiftFormulaRef ( configBuildRef . getWatchList ( ) , allRowsMappingList ) ; for ( int i = atRow ; i < lastRowPlus ; i ++ ) { buildCellsForRow ( configBuildRef . getSheet ( ) . getRow ( i ) , fullName , context , configBuildRef , shiftFormulaRef ) ; }


signature:
public class ConfigRange { /** * Builds the cells for row .
 * @ param row
 * the row
 * @ param fullName
 * the full name
 * @ param context
 * the context
 * @ param configBuildRef
 * the config build ref
 * @ param shiftFormulaRef
 * the shift formula ref */
private void buildCellsForRow ( final Row row , final String fullName , final Map < String , Object > context , final ConfigBuildRef configBuildRef , ShiftFormulaRef shiftFormulaRef ) { } }

implementation: if ( ( row == null ) || ! ConfigurationUtility . isStaticRowRef ( this , row ) ) { return ; } for ( Cell cell : row ) { buildSingleCell ( cell , context , configBuildRef , shiftFormulaRef ) ; } ConfigurationUtility . setFullNameInHiddenColumn ( row , fullName ) ;


signature:
public class ConfigRange { /** * Builds the single cell .
 * @ param cell
 * the cell
 * @ param context
 * the context
 * @ param configBuildRef
 * the config build ref
 * @ param shiftFormulaRef
 * the shift formula ref */
private void buildSingleCell ( final Cell cell , final Map < String , Object > context , final ConfigBuildRef configBuildRef , final ShiftFormulaRef shiftFormulaRef ) { } }

implementation:
try { CommandUtility . evaluate ( context , cell , configBuildRef . getEngine ( ) ) ; if ( cell . getCellTypeEnum ( ) == CellType . FORMULA ) { // rebuild formula if necessary for dynamic row
String originFormula = cell . getCellFormula ( ) ; shiftFormulaRef . setFormulaChanged ( 0 ) ; ConfigurationUtility . buildCellFormulaForShiftedRows ( configBuildRef . getSheet ( ) , configBuildRef . getWbWrapper ( ) , shiftFormulaRef , cell , cell . getCellFormula ( ) ) ; if ( shiftFormulaRef . getFormulaChanged ( ) > 0 ) { configBuildRef . getCachedCells ( ) . put ( cell , originFormula ) ; } } } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "build cell ( row = " + cell . getRowIndex ( ) + " column = " + cell . getColumnIndex ( ) + " error = " + ex . getLocalizedMessage ( ) , ex ) ; }


signature:
public class ConfigRange { /** * recover by using it ' s address .
 * @ param sheet
 * sheet . */
public final void recover ( final Sheet sheet ) { } }

implementation: this . getAttrs ( ) . recover ( sheet ) ; if ( this . commandList != null ) { for ( ConfigCommand command : this . commandList ) { command . recover ( sheet ) ; } }


signature:
public class SerialDataContext { /** * save the workbook before serialize .
 * @ param out
 * outputstream .
 * @ throws IOException
 * io exception . */
private void writeObject ( final java . io . ObjectOutputStream out ) throws IOException { } }

implementation: Gson objGson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; this . mapToJson = objGson . toJson ( this . dataContext ) ; out . defaultWriteObject ( ) ;


signature:
public class SerialDataContext { /** * load the workbook from saving .
 * @ param in
 * inputstream .
 * @ throws IOException
 * io exception . */
private void readObject ( final java . io . ObjectInputStream in ) throws IOException { } }

implementation: try { in . defaultReadObject ( ) ; Gson objGson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; Type listType = new TypeToken < Map < String , Object > > ( ) { } . getType ( ) ; this . dataContext = objGson . fromJson ( mapToJson , listType ) ; } catch ( EncryptedDocumentException | ClassNotFoundException e ) { LOG . log ( Level . SEVERE , " error in readObject of serialWorkbook : " + e . getLocalizedMessage ( ) , e ) ; }


signature:
public class ChartData { /** * build categotry list .
 * @ param ctAxDs
 * ctaxdatasource . */
public final void buildCategoryList ( final CTAxDataSource ctAxDs ) { } }

implementation: List < ParsedCell > cells = new ArrayList < > ( ) ; try { String fullRangeName = ctAxDs . getStrRef ( ) . getF ( ) ; String sheetName = WebSheetUtility . getSheetNameFromFullCellRefName ( fullRangeName ) ; CellRangeAddress region = CellRangeAddress . valueOf ( WebSheetUtility . removeSheetNameFromFullCellRefName ( fullRangeName ) ) ; for ( int row = region . getFirstRow ( ) ; row <= region . getLastRow ( ) ; row ++ ) { for ( int col = region . getFirstColumn ( ) ; col <= region . getLastColumn ( ) ; col ++ ) { cells . add ( new ParsedCell ( sheetName , row , col ) ) ; } } } catch ( Exception ex ) { LOG . log ( Level . FINE , "failed in buildCategoryList" , ex ) ; } this . setCategoryList ( cells ) ;


signature:
public class ChartData { /** * build series list .
 * @ param bsers
 * bsers .
 * @ param themeTable
 * themetable .
 * @ param ctObj
 * ctobj . */
@ SuppressWarnings ( "rawtypes" ) public final void buildSeriesList ( final List bsers , final ThemesTable themeTable , final ChartObject ctObj ) { } }

implementation: List < ChartSeries > lseriesList = new ArrayList < > ( ) ; try { for ( int index = 0 ; index < bsers . size ( ) ; index ++ ) { Object ctObjSer = bsers . get ( index ) ; ChartSeries ctSer = buildChartSeriesInList ( themeTable , ctObj , ctObjSer , index ) ; lseriesList . add ( ctSer ) ; } } catch ( Exception ex ) { LOG . log ( Level . FINE , "failed in buildSerialList" , ex ) ; } this . setSeriesList ( lseriesList ) ;


signature:
public class ChartData { /** * Builds the chart series in list .
 * @ param themeTable
 * the theme table
 * @ param ctObj
 * the ct obj
 * @ param ctObjSer
 * the ct obj ser
 * @ param index
 * the index
 * @ return the chart series */
private ChartSeries buildChartSeriesInList ( final ThemesTable themeTable , final ChartObject ctObj , final Object ctObjSer , final int index ) { } }

implementation: ChartSeries ctSer = new ChartSeries ( ) ; ctSer . setSeriesLabel ( new ParsedCell ( ctObj . getSeriesLabelFromCTSer ( ctObjSer ) ) ) ; ctSer . setSeriesColor ( ColorUtility . geColorFromSpPr ( index , ctObj . getShapePropertiesFromCTSer ( ctObjSer ) , themeTable , ctObj . isLineColor ( ) ) ) ; List < ParsedCell > cells = new ArrayList < > ( ) ; String fullRangeName = ( ctObj . getCTNumDataSourceFromCTSer ( ctObjSer ) ) . getNumRef ( ) . getF ( ) ; String sheetName = WebSheetUtility . getSheetNameFromFullCellRefName ( fullRangeName ) ; CellRangeAddress region = CellRangeAddress . valueOf ( WebSheetUtility . removeSheetNameFromFullCellRefName ( fullRangeName ) ) ; for ( int row = region . getFirstRow ( ) ; row <= region . getLastRow ( ) ; row ++ ) { for ( int col = region . getFirstColumn ( ) ; col <= region . getLastColumn ( ) ; col ++ ) { cells . add ( new ParsedCell ( sheetName , row , col ) ) ; } } ctSer . setValueList ( cells ) ; ctSer . setValueColorList ( getColorListFromDPTWithValueList ( ctObj . getDPtListFromCTSer ( ctObjSer ) , cells , themeTable , ctObj ) ) ; return ctSer ;


signature:
public class ChartData { /** * get color list from dpt .
 * @ param dptList
 * dpt .
 * @ param cells
 * cells .
 * @ param themeTable
 * themetable .
 * @ param ctObj
 * ctobj .
 * @ return list of xcolor . */
private List < XColor > getColorListFromDPTWithValueList ( final List < CTDPt > dptList , final List < ParsedCell > cells , final ThemesTable themeTable , final ChartObject ctObj ) { } }

implementation: List < XColor > colors = new ArrayList < > ( ) ; if ( ( dptList != null ) && ( cells != null ) ) { for ( int index = 0 ; index < cells . size ( ) ; index ++ ) { CTDPt dpt = getDPtFromListWithIndex ( dptList , index ) ; CTShapeProperties ctSpPr = null ; if ( dpt != null ) { ctSpPr = dpt . getSpPr ( ) ; } colors . add ( ColorUtility . geColorFromSpPr ( index , ctSpPr , themeTable , ctObj . isLineColor ( ) ) ) ; } } return colors ;


signature:
public class ChartData { /** * get dpt from list .
 * @ param dptList
 * dptlist .
 * @ param index
 * index .
 * @ return ctdpt . */
private CTDPt getDPtFromListWithIndex ( final List < CTDPt > dptList , final int index ) { } }

implementation: if ( dptList != null ) { for ( CTDPt dpt : dptList ) { if ( dpt . getIdx ( ) . getVal ( ) == index ) { return dpt ; } } } return null ;


signature:
public class SheetConfiguration { /** * Sets the command index map .
 * @ param pcommandIndexMap
 * the command index map */
public final void setCommandIndexMap ( final Map < String , Command > pcommandIndexMap ) { } }

implementation: if ( pcommandIndexMap instanceof HashMap ) { this . commandIndexMap = ( HashMap < String , Command > ) pcommandIndexMap ; } else { this . commandIndexMap = new HashMap < > ( ) ; this . commandIndexMap . putAll ( pcommandIndexMap ) ; }


signature:
public class SheetConfiguration { /** * recover the cell reference to the sheet .
 * @ param wb
 * workbook . */
public void recover ( final Workbook wb ) { } }

implementation: Sheet sheet = wb . getSheet ( this . sheetName ) ; this . getSerialCachedCells ( ) . recover ( sheet ) ; this . getSerialFinalCommentMap ( ) . recover ( sheet ) ; this . getFormCommand ( ) . recover ( sheet ) ; if ( this . getShiftMap ( ) != null ) { for ( Map . Entry < String , ConfigRangeAttrs > entry : this . getShiftMap ( ) . entrySet ( ) ) { entry . getValue ( ) . recover ( sheet ) ; } } if ( this . getCommandIndexMap ( ) != null ) { for ( Map . Entry < String , Command > entry : this . getCommandIndexMap ( ) . entrySet ( ) ) { entry . getValue ( ) . recover ( sheet ) ; } }


signature:
public class PicturesUtility { /** * Gets the pictrues map .
 * @ param wb
 * the wb
 * @ param picMap
 * the pic map */
public static void getPictruesMap ( final Workbook wb , final Map < String , Picture > picMap ) { } }

implementation: if ( wb instanceof XSSFWorkbook ) { getXSSFPictruesMap ( ( XSSFWorkbook ) wb , picMap ) ; } return ;


signature:
public class PicturesUtility { /** * Gets the XSSF pictrues map .
 * @ param wb
 * the wb
 * @ param picMap
 * the pic map */
private static void getXSSFPictruesMap ( final XSSFWorkbook wb , final Map < String , Picture > picMap ) { } }

implementation: picMap . clear ( ) ; List < XSSFPictureData > pictures = wb . getAllPictures ( ) ; if ( pictures . isEmpty ( ) ) { return ; } for ( int i = 0 ; i < wb . getNumberOfSheets ( ) ; i ++ ) { XSSFSheet sheet = wb . getSheetAt ( i ) ; for ( POIXMLDocumentPart dr : sheet . getRelations ( ) ) { try { indexPictureInMap ( picMap , sheet , dr ) ; } catch ( Exception ex ) { LOG . log ( Level . SEVERE , "Load Picture error = " + ex . getLocalizedMessage ( ) , ex ) ; } } } return ;


signature:
public class PicturesUtility { /** * save pciture in map with index .
 * @ param picMap
 * pciture map .
 * @ param sheet
 * sheet .
 * @ param dr
 * documentme part . */
private static void indexPictureInMap ( final Map < String , Picture > picMap , final XSSFSheet sheet , final POIXMLDocumentPart dr ) { } }

implementation: if ( dr instanceof XSSFDrawing ) { XSSFDrawing drawing = ( XSSFDrawing ) dr ; List < XSSFShape > shapes = drawing . getShapes ( ) ; for ( XSSFShape shape : shapes ) { if ( shape instanceof XSSFPicture ) { XSSFPicture pic = ( XSSFPicture ) shape ; XSSFClientAnchor anchor = pic . getPreferredSize ( ) ; CTMarker ctMarker = anchor . getFrom ( ) ; String picIndex = WebSheetUtility . getFullCellRefName ( sheet . getSheetName ( ) , ctMarker . getRow ( ) , ctMarker . getCol ( ) ) ; picMap . put ( picIndex , pic ) ; } } }


signature:
public class PicturesUtility { /** * Generate picture style .
 * @ param sheet1
 * the sheet 1
 * @ param fcell
 * the fcell
 * @ param cell
 * the cell
 * @ param pic
 * the pic
 * @ return the string */
public static String generatePictureStyle ( final Sheet sheet1 , final FacesCell fcell , final Cell cell , final Picture pic ) { } }

implementation: ClientAnchor anchor = pic . getClientAnchor ( ) ; if ( anchor != null ) { AnchorSize anchorSize = getAnchorSize ( sheet1 , fcell , cell , anchor ) ; if ( anchorSize != null ) { return "MARGIN-LEFT:" + String . format ( "%.2f" , anchorSize . getPercentLeft ( ) ) + "%;MARGIN-TOP:" + String . format ( "%.2f" , anchorSize . getPercentTop ( ) ) + "%;width:" + String . format ( "%.2f" , anchorSize . getPercentWidth ( ) ) + "%;" ; } } return "" ;


signature:
public class PicturesUtility { /** * Generate chart style .
 * @ param sheet1
 * the sheet 1
 * @ param fcell
 * the fcell
 * @ param cell
 * the cell
 * @ param chartId
 * the chart id
 * @ param anchorsMap
 * the anchors map
 * @ return the string */
public static String generateChartStyle ( final Sheet sheet1 , final FacesCell fcell , final Cell cell , final String chartId , final Map < String , ClientAnchor > anchorsMap ) { } }

implementation: ClientAnchor anchor = anchorsMap . get ( chartId ) ; if ( anchor != null ) { AnchorSize anchorSize = getAnchorSize ( sheet1 , fcell , cell , anchor ) ; if ( anchorSize != null ) { return "MARGIN-LEFT:" + String . format ( "%.2f" , anchorSize . getPercentLeft ( ) ) + "%;MARGIN-TOP:" + String . format ( "%.2f" , anchorSize . getPercentTop ( ) ) + "%;width:" + String . format ( "%.2f" , anchorSize . getPercentWidth ( ) ) + "%;height:135%;" ; } } return "" ;


signature:
public class PicturesUtility { /** * Gets the anchor size .
 * @ param sheet1
 * the sheet 1
 * @ param fcell
 * the fcell
 * @ param cell
 * the cell
 * @ param anchor
 * the anchor
 * @ return the anchor size */
public static AnchorSize getAnchorSize ( final Sheet sheet1 , final FacesCell fcell , final Cell cell , final ClientAnchor anchor ) { } }

implementation: if ( ! ( sheet1 instanceof XSSFSheet ) ) { return null ; } double picWidth = 0.0 ; double picHeight = 0.0 ; int left = anchor . getDx1 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL ; int top = ( int ) ( ( double ) anchor . getDy1 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL / WebSheetUtility . PICTURE_HEIGHT_ADJUST ) ; int right = anchor . getDx2 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL ; int bottom = ( int ) ( ( double ) anchor . getDy2 ( ) / org . apache . poi . util . Units . EMU_PER_PIXEL / WebSheetUtility . PICTURE_HEIGHT_ADJUST ) ; double cellWidth = 0.0 ; double cellHeight = 0.0 ; if ( ( cell != null ) && ( fcell != null ) ) { for ( int col = cell . getColumnIndex ( ) ; col < cell . getColumnIndex ( ) + fcell . getColspan ( ) ; col ++ ) { cellWidth += sheet1 . getColumnWidthInPixels ( col ) ; } double lastCellWidth = sheet1 . getColumnWidthInPixels ( cell . getColumnIndex ( ) + fcell . getColspan ( ) - 1 ) ; for ( int rowIndex = cell . getRowIndex ( ) ; rowIndex < cell . getRowIndex ( ) + fcell . getRowspan ( ) ; rowIndex ++ ) { cellHeight += WebSheetUtility . pointsToPixels ( sheet1 . getRow ( rowIndex ) . getHeightInPoints ( ) ) ; } double lastCellHeight = WebSheetUtility . pointsToPixels ( sheet1 . getRow ( cell . getRowIndex ( ) + fcell . getRowspan ( ) - 1 ) . getHeightInPoints ( ) ) ; picWidth = cellWidth - lastCellWidth + right - left ; picHeight = cellHeight - lastCellHeight + bottom - top ; } else { for ( short col = anchor . getCol1 ( ) ; col < anchor . getCol2 ( ) ; col ++ ) { picWidth += sheet1 . getColumnWidthInPixels ( col ) ; } for ( int rowindex = anchor . getRow1 ( ) ; rowindex < anchor . getRow2 ( ) ; rowindex ++ ) { Row row = sheet1 . getRow ( rowindex ) ; if ( row != null ) { picHeight += WebSheetUtility . pointsToPixels ( row . getHeightInPoints ( ) ) ; } } } return new AnchorSize ( left , top , ( int ) picWidth , ( int ) picHeight , cellWidth , cellHeight ) ;


signature:
public class CachedCells { /** * Put .
 * @ param cell
 * the cell
 * @ param formula
 * the cell type */
public final void put ( final Cell cell , final CellType formula ) { } }

implementation:
Map < Cell , FormulaMapping > map = cachedMap ; // if cellType not null then only specified Type will be put into Cache
// e . g . only formula cell will be cached then pass in
// Cell . CELL _ TYPE _ FORMULA
if ( ( cell != null ) && ( ( formula == null ) || ( cell . getCellTypeEnum ( ) == formula ) ) ) { String value = CellUtility . getCellValueWithFormat ( cell , parent . getFormulaEvaluator ( ) , parent . getDataFormatter ( ) ) ; FormulaMapping f = map . get ( cell ) ; if ( f == null ) { f = new FormulaMapping ( ) ; } f . setValue ( value ) ; map . put ( cell , f ) ; }


signature:
public class CachedCells { /** * Put .
 * @ param cell
 * the cell
 * @ param originFormula
 * the origin formula */
public final void put ( final Cell cell , final String originFormula ) { } }

implementation:
Map < Cell , FormulaMapping > map = cachedMap ; // if cellType not null then only specified Type will be put into Cache
// e . g . only formula cell will be cached then pass in
// Cell . CELL _ TYPE _ FORMULA
if ( ( cell != null ) && ( originFormula != null ) ) { FormulaMapping f = map . get ( cell ) ; if ( f == null ) { f = new FormulaMapping ( ) ; } f . setOriginFormula ( originFormula ) ; String value = CellUtility . getCellValueWithFormat ( cell , parent . getFormulaEvaluator ( ) , parent . getDataFormatter ( ) ) ; f . setValue ( value ) ; map . put ( cell , f ) ; }


signature:
public class CachedCells { /** * Checks if is value changed .
 * @ param cell
 * the cell
 * @ return true , if is value changed */
public final boolean isValueChanged ( final Cell cell ) { } }

implementation: String newValue = CellUtility . getCellValueWithFormat ( cell , parent . getFormulaEvaluator ( ) , parent . getDataFormatter ( ) ) ; return isValueChanged ( cell , newValue ) ;


signature:
public class CachedCells { /** * Checks if is value changed .
 * @ param cell
 * the cell
 * @ param pnewValue
 * the new value
 * @ return true , if is value changed */
public final boolean isValueChanged ( final Cell cell , final String pnewValue ) { } }

implementation: Map < Cell , FormulaMapping > map = cachedMap ; String oldValue = map . get ( cell ) . getValue ( ) ; String newValue = pnewValue ; if ( oldValue == null ) { oldValue = "" ; } if ( newValue == null ) { newValue = "" ; } return ( ! oldValue . equals ( newValue ) ) ;


signature:
public class TieCommandAlias { /** * Gets the pattern .
 * @ return the pattern */
public Pattern getPattern ( ) { } }

implementation: if ( ( this . pattern == null ) && ( alias != null ) ) { this . pattern = Pattern . compile ( "\\s*" + ParserUtility . wildcardToRegex ( alias ) ) ; } return pattern ;


signature:
public class TieWebSheetComponent { /** * ( non - Javadoc )
 * @ see
 * javax . faces . component . UIComponentBase # encodeBegin ( javax . faces . context
 * . FacesContext ) */
@ Override public final void encodeBegin ( final FacesContext context ) throws IOException { } }

implementation: webSheetBean = ( TieWebSheetBean ) this . getAttributes ( ) . get ( TieConstants . ATTRS_WEBSHEETBEAN ) ; if ( ( webSheetBean != null ) && ( webSheetBean . getWebFormClientId ( ) == null ) ) { LOG . fine ( "WebSheet component parameter setup" ) ; webSheetBean . setClientId ( this . getClientId ( ) ) ; webSheetBean . setWebFormClientId ( this . getClientId ( ) + ":" + TieConstants . COMPONENT_ID ) ; String maxrows = ( String ) this . getAttributes ( ) . get ( "maxRowsPerPage" ) ; if ( ( maxrows != null ) && ( ! maxrows . isEmpty ( ) ) ) { webSheetBean . setMaxRowsPerPage ( Integer . valueOf ( maxrows ) ) ; } Boolean hideSingleSheetTabTitle = ( Boolean ) this . getAttributes ( ) . get ( "hideSingleSheetTabTitle" ) ; if ( hideSingleSheetTabTitle != null ) { webSheetBean . setHideSingleSheetTabTitle ( hideSingleSheetTabTitle ) ; } } super . encodeBegin ( context ) ;


signature:
public class TieWebSheetChartsService { /** * Return real chart picture when browser requesting the image .
 * @ return empty chart ( phase = = render ) or real chart ( browser request ) .
 * @ throws IOException
 * exception . */
public StreamedContent getChart ( ) throws IOException { } }

implementation:
FacesContext context = FacesContext . getCurrentInstance ( ) ; if ( context . getCurrentPhaseId ( ) == PhaseId . RENDER_RESPONSE ) { // So , we ' re rendering the HTML . Return a stub StreamedContent so
// that it will generate right URL .
LOG . fine ( " return empty chart picture" ) ; return new DefaultStreamedContent ( ) ; } else { // So , browser is requesting the image . Return a real
// StreamedContent with the image bytes .
String chartId = context . getExternalContext ( ) . getRequestParameterMap ( ) . get ( "chartViewId" ) ; BufferedImage bufferedImg = ( BufferedImage ) FacesContext . getCurrentInstance ( ) . getExternalContext ( ) . getSessionMap ( ) . get ( chartId ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; ImageIO . write ( bufferedImg , "png" , os ) ; FacesContext . getCurrentInstance ( ) . getExternalContext ( ) . getSessionMap ( ) . remove ( chartId ) ; return new DefaultStreamedContent ( new ByteArrayInputStream ( os . toByteArray ( ) ) , "image/png" ) ; }


signature:
public class SerialCell { /** * save the cell before serialize .
 * @ param out
 * outputstream .
 * @ throws IOException
 * io exception . */
private void writeObject ( final java . io . ObjectOutputStream out ) throws IOException { } }

implementation: this . cellAddr = new SerialCellAddress ( this . cell ) ; out . defaultWriteObject ( ) ;


signature:
public class SerialCell { /** * recover cell by using it ' s address .
 * @ param sheet
 * sheet . */
public final void recover ( final Sheet sheet ) { } }

implementation: if ( this . cellAddr != null ) { this . setCell ( sheet . getRow ( this . cellAddr . getRow ( ) ) . getCell ( this . cellAddr . getColumn ( ) ) ) ; }


signature:
public class CellStyleUtility { /** * Gets the row style .
 * @ param wb
 * the wb
 * @ param poiCell
 * the poi cell
 * @ param inputType
 * the input type
 * @ param rowHeight
 * the row height
 * @ param rowspan
 * the rowspan
 * @ return the row style */
public static String getRowStyle ( final Workbook wb , final Cell poiCell , final String inputType , final float rowHeight , final int rowspan ) { } }

implementation: CellStyle cellStyle = poiCell . getCellStyle ( ) ; if ( ( cellStyle != null ) && ( rowspan == 1 ) ) { short fontIdx = cellStyle . getFontIndex ( ) ; Font font = wb . getFontAt ( fontIdx ) ; float maxHeight = rowHeight ; if ( ! inputType . isEmpty ( ) ) { maxHeight = Math . min ( font . getFontHeightInPoints ( ) + 8f , rowHeight ) ; } return "height:" + WebSheetUtility . pointsToPixels ( maxHeight ) + "px;" ; } return "" ;


signature:
public class CellStyleUtility { /** * Gets the cell font style .
 * @ param wb
 * the wb
 * @ param poiCell
 * the poi cell
 * @ return the cell font style */
public static String getCellFontStyle ( final Workbook wb , final Cell poiCell ) { } }

implementation: CellStyle cellStyle = poiCell . getCellStyle ( ) ; StringBuilder webStyle = new StringBuilder ( ) ; if ( cellStyle != null ) { short fontIdx = cellStyle . getFontIndex ( ) ; Font font = wb . getFontAt ( fontIdx ) ; if ( font . getItalic ( ) ) { webStyle . append ( "font-style: italic;" ) ; } if ( font . getBold ( ) ) { webStyle . append ( "font-weight: bold;" ) ; } webStyle . append ( "font-size: " + font . getFontHeightInPoints ( ) + "pt;" ) ; String decoration = getCellFontDecoration ( font ) ; if ( decoration . length ( ) > 0 ) { webStyle . append ( "text-decoration:" + decoration + ";" ) ; } webStyle . append ( getCellFontColor ( font ) ) ; } return webStyle . toString ( ) ;


signature:
public class CellStyleUtility { /** * get cell font color .
 * @ param font
 * font .
 * @ return String font color . */
private static String getCellFontColor ( final Font font ) { } }

implementation: short [ ] rgbfix = { TieConstants . RGB_MAX , TieConstants . RGB_MAX , TieConstants . RGB_MAX } ; if ( font instanceof XSSFFont ) { XSSFColor color = ( ( XSSFFont ) font ) . getXSSFColor ( ) ; if ( color != null ) { rgbfix = ColorUtility . getTripletFromXSSFColor ( color ) ; } } if ( rgbfix [ 0 ] != TieConstants . RGB_MAX ) { return "color:rgb(" + FacesUtility . strJoin ( rgbfix , "," ) + ");" ; } return "" ;


signature:
public class CellStyleUtility { /** * Get font decoration .
 * @ param font
 * font .
 * @ return font decoration . */
private static String getCellFontDecoration ( final Font font ) { } }

implementation: StringBuilder decoration = new StringBuilder ( ) ; if ( font . getUnderline ( ) != 0 ) { decoration . append ( " underline" ) ; } if ( font . getStrikeout ( ) ) { decoration . append ( " line-through" ) ; } return decoration . toString ( ) ;


signature:
public class CellStyleUtility { /** * Gets the cell style .
 * @ param wb
 * the wb
 * @ param poiCell
 * the poi cell
 * @ param inputType
 * the input type
 * @ return the cell style */
public static String getCellStyle ( final Workbook wb , final Cell poiCell , final String inputType ) { } }

implementation: CellStyle cellStyle = poiCell . getCellStyle ( ) ; StringBuilder webStyle = new StringBuilder ( ) ; if ( cellStyle != null ) { if ( ! inputType . isEmpty ( ) ) { webStyle . append ( getAlignmentFromCell ( poiCell , cellStyle ) ) ; webStyle . append ( getVerticalAlignmentFromCell ( cellStyle ) ) ; } webStyle . append ( ColorUtility . getBgColorFromCell ( wb , poiCell , cellStyle ) ) ; } return webStyle . toString ( ) ;


signature:
public class CellStyleUtility { /** * Gets the column style .
 * @ param wb
 * the wb
 * @ param fcell
 * the fcell
 * @ param poiCell
 * the poi cell
 * @ param rowHeight
 * the row height
 * @ return the column style */
public static String getColumnStyle ( final Workbook wb , final FacesCell fcell , final Cell poiCell , final float rowHeight ) { } }

implementation: String inputType = fcell . getInputType ( ) ; CellStyle cellStyle = poiCell . getCellStyle ( ) ; StringBuilder webStyle = new StringBuilder ( ) ; if ( cellStyle != null ) { if ( fcell . isContainPic ( ) || fcell . isContainChart ( ) ) { webStyle . append ( "vertical-align: top;" ) ; } else { webStyle . append ( getAlignmentFromCell ( poiCell , cellStyle ) ) ; webStyle . append ( getVerticalAlignmentFromCell ( cellStyle ) ) ; } webStyle . append ( ColorUtility . getBgColorFromCell ( wb , poiCell , cellStyle ) ) ; webStyle . append ( getRowStyle ( wb , poiCell , inputType , rowHeight , fcell . getRowspan ( ) ) ) ; } else { webStyle . append ( getAlignmentFromCellType ( poiCell ) ) ; } return webStyle . toString ( ) ;


signature:
public class CellStyleUtility { /** * Gets the alignment from cell .
 * @ param poiCell
 * the poi cell
 * @ param cellStyle
 * the cell style
 * @ return the alignment from cell */
private static String getAlignmentFromCell ( final Cell poiCell , final CellStyle cellStyle ) { } }

implementation: String style = "" ; switch ( cellStyle . getAlignmentEnum ( ) ) { case LEFT : style = TieConstants . TEXT_ALIGN_LEFT ; break ; case RIGHT : style = TieConstants . TEXT_ALIGN_RIGHT ; break ; case CENTER : style = TieConstants . TEXT_ALIGN_CENTER ; break ; case GENERAL : style = getAlignmentFromCellType ( poiCell ) ; break ; default : break ; } return style ;


signature:
public class CellStyleUtility { /** * Gets the vertical alignment from cell .
 * @ param cellStyle
 * the cell style
 * @ return the vertical alignment from cell */
private static String getVerticalAlignmentFromCell ( final CellStyle cellStyle ) { } }

implementation: String style = "" ; switch ( cellStyle . getVerticalAlignmentEnum ( ) ) { case TOP : style = TieConstants . VERTICAL_ALIGN_TOP ; break ; case CENTER : style = TieConstants . VERTICAL_ALIGN_CENTER ; break ; case BOTTOM : style = TieConstants . VERTICAL_ALIGN_BOTTOM ; break ; default : break ; } return style ;


signature:
public class CellStyleUtility { /** * e . g . lineNumberColumnWidth and addRowColumnWidth */
public static int calcTotalWidth ( final Sheet sheet1 , final int firstCol , final int lastCol , final int additionalWidth ) { } }

implementation: int totalWidth = additionalWidth ; for ( int i = firstCol ; i <= lastCol ; i ++ ) { totalWidth += sheet1 . getColumnWidth ( i ) ; } return totalWidth ;


signature:
public class CellStyleUtility { /** * Calc total height .
 * @ param sheet1
 * the sheet 1
 * @ param firstRow
 * the first row
 * @ param lastRow
 * the last row
 * @ param additionalHeight
 * the additional height
 * @ return the int */
public static int calcTotalHeight ( final Sheet sheet1 , final int firstRow , final int lastRow , final int additionalHeight ) { } }

implementation: int totalHeight = additionalHeight ; for ( int i = firstRow ; i <= lastRow ; i ++ ) { totalHeight += sheet1 . getRow ( i ) . getHeight ( ) ; } return totalHeight ;


signature:
public class CellStyleUtility { /** * Setup cell style .
 * @ param wb
 * the wb
 * @ param fcell
 * the fcell
 * @ param poiCell
 * the poi cell
 * @ param rowHeight
 * the row height */
public static void setupCellStyle ( final Workbook wb , final FacesCell fcell , final Cell poiCell , final float rowHeight ) { } }

implementation:
CellStyle cellStyle = poiCell . getCellStyle ( ) ; if ( ( cellStyle != null ) && ( ! cellStyle . getLocked ( ) ) ) { // not locked
if ( fcell . getInputType ( ) . isEmpty ( ) ) { fcell . setInputType ( CellStyleUtility . getInputTypeFromCellType ( poiCell ) ) ; } if ( fcell . getControl ( ) . isEmpty ( ) && ( ! fcell . getInputType ( ) . isEmpty ( ) ) ) { fcell . setControl ( "text" ) ; } setInputStyleBaseOnInputType ( fcell , poiCell ) ; } String webStyle = getCellStyle ( wb , poiCell , fcell . getInputType ( ) ) + getCellFontStyle ( wb , poiCell ) + getRowStyle ( wb , poiCell , fcell . getInputType ( ) , rowHeight , fcell . getRowspan ( ) ) ; fcell . setStyle ( webStyle ) ; fcell . setColumnStyle ( getColumnStyle ( wb , fcell , poiCell , rowHeight ) ) ;


signature:
public class CellStyleUtility { /** * set up Input Style parameter for input number component which need those
 * parameters to make it work . e . g . symbol , symbol position , decimal places .
 * @ param fcell
 * faces cell
 * @ param poiCell
 * poi cell */
static void setInputStyleBaseOnInputType ( final FacesCell fcell , final Cell poiCell ) { } }

implementation: if ( ( fcell == null ) || fcell . getInputType ( ) . isEmpty ( ) ) { return ; } switch ( fcell . getInputType ( ) ) { case TieConstants . CELL_INPUT_TYPE_PERCENTAGE : fcell . setSymbol ( "%" ) ; fcell . setSymbolPosition ( "p" ) ; fcell . setDecimalPlaces ( CellStyleUtility . getDecimalPlacesFromFormat ( poiCell ) ) ; break ; case TieConstants . CELL_INPUT_TYPE_INTEGER : fcell . setDecimalPlaces ( ( short ) 0 ) ; break ; case TieConstants . CELL_INPUT_TYPE_DOUBLE : fcell . setDecimalPlaces ( CellStyleUtility . getDecimalPlacesFromFormat ( poiCell ) ) ; fcell . setSymbol ( CellStyleUtility . getSymbolFromFormat ( poiCell ) ) ; fcell . setSymbolPosition ( CellStyleUtility . getSymbolPositionFromFormat ( poiCell ) ) ; break ; default : break ; }


signature:
public class CellStyleUtility { /** * Gets the input type from cell type .
 * @ param cell
 * the cell
 * @ return the input type from cell type */
@ SuppressWarnings ( "deprecation" ) private static String getInputTypeFromCellType ( final Cell cell ) { } }

implementation: String inputType = TieConstants . CELL_INPUT_TYPE_TEXT ; if ( cell . getCellTypeEnum ( ) == CellType . NUMERIC ) { inputType = TieConstants . CELL_INPUT_TYPE_DOUBLE ; } CellStyle style = cell . getCellStyle ( ) ; if ( style != null ) { int formatIndex = style . getDataFormat ( ) ; String formatString = style . getDataFormatString ( ) ; if ( DateUtil . isADateFormat ( formatIndex , formatString ) ) { inputType = TieConstants . CELL_INPUT_TYPE_DATE ; } else { if ( isAPercentageCell ( formatString ) ) { inputType = TieConstants . CELL_INPUT_TYPE_PERCENTAGE ; } } } return inputType ;


signature:
public class CellStyleUtility { /** * get decimal places from format string e . g . 0.00 will return 2
 * @ param cell
 * the cell
 * @ return decimal places of the formatted string */
private static short getDecimalPlacesFromFormat ( final Cell cell ) { } }

implementation: CellStyle style = cell . getCellStyle ( ) ; if ( style == null ) { return 0 ; } String formatString = style . getDataFormatString ( ) ; if ( formatString == null ) { return 0 ; } int ipos = formatString . indexOf ( '.' ) ; if ( ipos < 0 ) { return 0 ; } short counter = 0 ; for ( int i = ipos + 1 ; i < formatString . length ( ) ; i ++ ) { if ( formatString . charAt ( i ) == '0' ) { counter ++ ; } else { break ; } } return counter ;


signature:
public class CellStyleUtility { /** * get symbol from format string e . g . [ $ CAD ] # , # # 0.00 will return CAD . While
 * $ # , # # 0.00 will return $
 * @ param cell
 * the cell
 * @ return symbol of the formatted string */
private static String getSymbolFromFormat ( final Cell cell ) { } }

implementation:
CellStyle style = cell . getCellStyle ( ) ; if ( style == null ) { return null ; } String formatString = style . getDataFormatString ( ) ; if ( formatString == null ) { return null ; } if ( formatString . indexOf ( TieConstants . CELL_ADDR_PRE_FIX ) < 0 ) { return null ; } int ipos = formatString . indexOf ( "[$" ) ; if ( ipos < 0 ) { // only $ found , then return default dollar symbol
return "$" ; } // return specified dollar symbol
return formatString . substring ( ipos + 2 , formatString . indexOf ( ']' , ipos ) ) ;


signature:
public class CellStyleUtility { /** * get symbol position from format string e . g . [ $ CAD ] # , # # 0.00 will return
 * p . While # , # # 0.00 $ will return s
 * @ param cell
 * the cell
 * @ return symbol position of the formatted string */
private static String getSymbolPositionFromFormat ( final Cell cell ) { } }

implementation: CellStyle style = cell . getCellStyle ( ) ; if ( style == null ) { return "p" ; } String formatString = style . getDataFormatString ( ) ; if ( formatString == null ) { return "p" ; } int symbolpos = formatString . indexOf ( '$' ) ; int numberpos = formatString . indexOf ( '#' ) ; if ( numberpos < 0 ) { numberpos = formatString . indexOf ( '0' ) ; } if ( symbolpos < numberpos ) { return "p" ; } else { return "s" ; }


signature:
public class FacesUtility { /** * return faces context resource path .
 * @ param context
 * face context .
 * @ param path
 * path .
 * @ return a set of path . */
public static Set < String > getResourcePaths ( final FacesContext context , final String path ) { } }

implementation: return context . getExternalContext ( ) . getResourcePaths ( path ) ;


signature:
public class FacesUtility { /** * get resource file as stream .
 * @ param context
 * faces context .
 * @ param path
 * resource file path .
 * @ return stream . */
public static InputStream getResourceAsStream ( final FacesContext context , final String path ) { } }

implementation: return context . getExternalContext ( ) . getResourceAsStream ( path ) ;


signature:
public class FacesUtility { /** * evaluate expression .
 * @ param < T >
 * This is the type parameter
 * @ param context
 * faces context .
 * @ param expression
 * expression .
 * @ return evaluated object . */
@ SuppressWarnings ( "unchecked" ) public static < T > T evaluateExpressionGet ( final FacesContext context , final String expression ) { } }

implementation: if ( expression == null ) { return null ; } return ( T ) context . getApplication ( ) . evaluateExpressionGet ( context , expression , Object . class ) ;


signature:
public class FacesUtility { /** * remove prefix path of the full path .
 * @ param prefix
 * prefix string .
 * @ param resource
 * normal resource .
 * @ return removed path . */
public static String removePrefixPath ( final String prefix , final String resource ) { } }

implementation: String normalizedResource = resource ; if ( normalizedResource . startsWith ( prefix ) ) { normalizedResource = normalizedResource . substring ( prefix . length ( ) - 1 ) ; } return normalizedResource ;


signature:
public class FacesUtility { /** * evaluate input type .
 * @ param input
 * input string .
 * @ param type
 * input type .
 * @ return true if input meet type , otherwise false . */
public static boolean evalInputType ( final String input , final String type ) { } }

implementation: Scanner scanner = new Scanner ( input ) ; boolean ireturn = false ; if ( "Integer" . equalsIgnoreCase ( type ) ) { ireturn = scanner . hasNextInt ( ) ; } else if ( "Double" . equalsIgnoreCase ( type ) ) { ireturn = scanner . hasNextDouble ( ) ; } else if ( "Boolean" . equalsIgnoreCase ( type ) ) { ireturn = scanner . hasNextBoolean ( ) ; } else if ( "Byte" . equalsIgnoreCase ( type ) ) { ireturn = scanner . hasNextByte ( ) ; } else if ( type . toLowerCase ( ) . startsWith ( "text" ) ) { ireturn = true ; } scanner . close ( ) ; return ireturn ;


signature:
public class FacesUtility { /** * Find bean in context .
 * @ param < T >
 * This is the type parameter .
 * @ param beanName
 * bean name .
 * @ return bean object . */
@ SuppressWarnings ( "unchecked" ) public static < T > T findBean ( final String beanName ) { } }

implementation: FacesContext context = FacesContext . getCurrentInstance ( ) ; return ( T ) context . getApplication ( ) . evaluateExpressionGet ( context , TieConstants . EL_START + beanName + TieConstants . EL_END , Object . class ) ;


signature:
public class FacesUtility { /** * evaluate expression .
 * @ param < T >
 * This is the type parameter .
 * @ param expression
 * expression .
 * @ param expected
 * exprected type .
 * @ return evaluated object . */
public static < T > T evaluateExpression ( final String expression , final Class < ? extends T > expected ) { } }

implementation: return evaluateExpression ( FacesContext . getCurrentInstance ( ) , expression , expected ) ;


signature:
public class FacesUtility { /** * evaluate expression .
 * @ param < T >
 * This is the type parameter .
 * @ param context
 * faces context .
 * @ param expression
 * expression .
 * @ param expected
 * expected type .
 * @ return evaluated object . */
public static < T > T evaluateExpression ( final FacesContext context , final String expression , final Class < ? extends T > expected ) { } }

implementation: return context . getApplication ( ) . evaluateExpressionGet ( context , expression , expected ) ;


signature:
public class FacesUtility { /** * join string .
 * @ param aArr
 * attribute list .
 * @ param sSep
 * seperator string .
 * @ return joined string . */
public static String strJoin ( final short [ ] aArr , final String sSep ) { } }

implementation: StringBuilder sbStr = new StringBuilder ( ) ; for ( int i = 0 , il = aArr . length ; i < il ; i ++ ) { if ( i > 0 ) { sbStr . append ( sSep ) ; } sbStr . append ( aArr [ i ] ) ; } return sbStr . toString ( ) ;


signature:
public class FacesUtility { /** * round number according to decimal places .
 * @ param value
 * double value .
 * @ param places
 * decimal places .
 * @ return rounded number . */
public static double round ( final double value , final int places ) { } }

implementation: if ( places < 0 ) { throw new IllegalArgumentException ( ) ; } BigDecimal bd = BigDecimal . valueOf ( value ) ; bd = bd . setScale ( places , RoundingMode . HALF_UP ) ; return bd . doubleValue ( ) ;


signature:
public class TieWebSheetView { /** * get tab type .
 * @ return tab type . */
public String getTabType ( ) { } }

implementation: int sheetId = webFormTabView . getActiveIndex ( ) ; if ( ( sheetId >= 0 ) && ( tabs != null ) ) { if ( sheetId >= tabs . size ( ) ) { sheetId = 0 ; } tabType = tabs . get ( sheetId ) . type . toLowerCase ( ) ; } else { tabType = TieConstants . TAB_TYPE_NONE ; } return tabType ;


signature:
public class TieWebSheetView { /** * get tab style .
 * @ return string . */
public String getTabStyle ( ) { } }

implementation: String tabStyle = TieConstants . TAB_STYLE_VISIBLE ; int sheetId = webFormTabView . getActiveIndex ( ) ; if ( ( sheetId >= 0 ) && ( sheetId < tabs . size ( ) ) ) { tabStyle = TieConstants . TAB_STYLE_INVISIBLE ; } return tabStyle ;


signature:
public class TieWebSheetView { /** * Gets the default date pattern .
 * @ return the default date pattern */
public String getDefaultDatePattern ( ) { } }

implementation: if ( defaultDatePattern == null ) { DateFormat formatter = DateFormat . getDateInstance ( DateFormat . SHORT , Locale . getDefault ( ) ) ; defaultDatePattern = ( ( SimpleDateFormat ) formatter ) . toLocalizedPattern ( ) ; } return defaultDatePattern ;


signature:
public class TieWebSheetView { /** * Gets the decimal separator by default locale .
 * @ return the decimal separator by default locale */
public String getDecimalSeparatorByDefaultLocale ( ) { } }

implementation: final DecimalFormat nf = ( DecimalFormat ) DecimalFormat . getInstance ( getDefaultLocale ( ) ) ; return "" + nf . getDecimalFormatSymbols ( ) . getDecimalSeparator ( ) ;


signature:
public class TieWebSheetView { /** * Gets the thousand separator by default locale .
 * @ return the thousand separator by default locale */
public String getThousandSeparatorByDefaultLocale ( ) { } }

implementation: final DecimalFormat nf = ( DecimalFormat ) DecimalFormat . getInstance ( getDefaultLocale ( ) ) ; return "" + nf . getDecimalFormatSymbols ( ) . getGroupingSeparator ( ) ;


signature:
public class TieWebSheetView { /** * Sets the tie command alias list .
 * @ param aliasListJson the new tie command alias list */
public void setTieCommandAliasList ( String aliasListJson ) { } }

implementation: Gson gson = new Gson ( ) ; Type aliasListType = new TypeToken < ArrayList < TieCommandAlias > > ( ) { } . getType ( ) ; this . tieCommandAliasList = gson . fromJson ( aliasListJson , aliasListType ) ;


signature:
public class FormCommand { /** * Watch list serve for formula changes . Basically all the rows appeared in
 * the formula in the current sheet will be watched . Note if the cell
 * reference is from other sheet or workbooks , it will be ignored .
 * @ param wbWrapper
 * XSSFEvaluationWorkbook used for formula parse .
 * @ param sheet
 * current sheet .
 * @ return List row number for monitoring . */
private List < Integer > buildFormWatchList ( final XSSFEvaluationWorkbook wbWrapper , final Sheet sheet ) { } }

implementation:
List < Integer > watchList = new ArrayList < > ( ) ; ConfigRange cRange = this . getConfigRange ( ) ; List < ConfigCommand > commandList = cRange . getCommandList ( ) ; if ( commandList . isEmpty ( ) ) { // if no command then no dynamic changes . then no need formula
// shifts .
return watchList ; } int lastStaticRow = commandList . get ( 0 ) . getTopRow ( ) - 1 ; if ( lastStaticRow < 0 ) { lastStaticRow = this . getTopRow ( ) ; } int sheetIndex = sheet . getWorkbook ( ) . getSheetIndex ( sheet ) ; for ( int i = this . getTopRow ( ) ; i <= this . getLastRow ( ) ; i ++ ) { Row row = sheet . getRow ( i ) ; for ( Cell cell : row ) { if ( cell . getCellTypeEnum ( ) == CellType . FORMULA ) { buildWatchListForCell ( wbWrapper , sheetIndex , cell , watchList , lastStaticRow ) ; } } } return watchList ;


signature:
public class FormCommand { /** * Builds the watch list for cell .
 * @ param wbWrapper
 * the wb wrapper
 * @ param sheetIndex
 * the sheet index
 * @ param cell
 * the cell
 * @ param watchList
 * the watch list
 * @ param lastStaticRow
 * the last static row */
private void buildWatchListForCell ( final XSSFEvaluationWorkbook wbWrapper , final int sheetIndex , final Cell cell , final List < Integer > watchList , final int lastStaticRow ) { } }

implementation:
String formula = cell . getCellFormula ( ) ; Ptg [ ] ptgs = FormulaParser . parse ( formula , wbWrapper , FormulaType . CELL , sheetIndex ) ; for ( int k = 0 ; k < ptgs . length ; k ++ ) { Object ptg = ptgs [ k ] ; // For area formula , only first row is watched .
// Reason is the lastRow must shift same rows with
// firstRow .
// Otherwise it ' s difficult to calculate .
// In case some situation cannot fit , then should make
// change to the formula .
int areaInt = ShiftFormulaUtility . getFirstSupportedRowNumFromPtg ( ptg ) ; if ( areaInt >= 0 ) { addToWatchList ( areaInt , lastStaticRow , watchList ) ; } } // when insert row , the formula may changed . so here is the
// workaround .
// change formula to user formula to preserve the row
// changes .
cell . setCellType ( CellType . STRING ) ; cell . setCellValue ( TieConstants . USER_FORMULA_PREFIX + formula + TieConstants . USER_FORMULA_SUFFIX ) ;


signature:
public class FormCommand { /** * Only rows in dynamic area will be added to watch list .
 * @ param addRow
 * row want to add .
 * @ param lastStaticRow
 * last static row .
 * @ param watchList
 * watch list . */
private void addToWatchList ( final int addRow , final int lastStaticRow , final List < Integer > watchList ) { } }

implementation: if ( ( addRow > lastStaticRow ) && ! ( watchList . contains ( addRow ) ) ) { watchList . add ( addRow ) ; }


signature:
public class LineChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getSerListFromCtObjChart ( java . lang . Object ) */
@ SuppressWarnings ( "rawtypes" ) @ Override public final List getSerListFromCtObjChart ( final Object ctObjChart ) { } }

implementation: if ( ctObjChart instanceof CTLineChart ) { return ( ( CTLineChart ) ctObjChart ) . getSerList ( ) ; } return emptyLinelist ;


signature:
public class LineChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getShapePropertiesFromCTSer ( java . lang . Object ) */
@ Override public final CTShapeProperties getShapePropertiesFromCTSer ( final Object ctObjSer ) { } }

implementation: if ( ctObjSer instanceof CTLineSer ) { return ( ( CTLineSer ) ctObjSer ) . getSpPr ( ) ; } return null ;


signature:
public class LineChart { /** * ( non - Javadoc )
 * @ see org . tiefaces . components . websheet . chart . objects . ChartObject #
 * getCTNumDataSourceFromCTSer ( java . lang . Object ) */
@ Override public final CTNumDataSource getCTNumDataSourceFromCTSer ( final Object ctObjSer ) { } }

implementation: if ( ctObjSer instanceof CTLineSer ) { return ( ( CTLineSer ) ctObjSer ) . getVal ( ) ; } return null ;


signature:
public class ParserUtility { /** * check it ' s a command comment .
 * @ param str
 * comment string .
 * @ return ture if it ' s command . */
public static boolean isCommandString ( final String str ) { } }

implementation: if ( str == null ) { return false ; } return str . startsWith ( TieConstants . COMMAND_PREFIX ) ;


signature:
public class ParserUtility { /** * method string is start as $ follow by method name then with { and } . i . e .
 * $ init { department . name }
 * @ param str
 * the str
 * @ return true , if is method string */
public static boolean isMethodString ( final String str ) { } }

implementation: if ( str == null ) { return false ; } return str . matches ( TieConstants . METHOD_REGEX ) ;


signature:
public class ParserUtility { /** * empty method string is start as $ follow with { and } . i . e .
 * $ { department . name }
 * @ param str
 * the str
 * @ return true , if is empty method string */
public static boolean isEmptyMethodString ( final String str ) { } }

implementation: if ( str == null ) { return false ; } return str . startsWith ( TieConstants . METHOD_PREFIX ) ;


signature:
public class ParserUtility { /** * widget method start with $ widget . e . g . $ widget . calendar { . . . .
 * @ param str
 * the str
 * @ return true , if is widget method string */
public static boolean isWidgetMethodString ( final String str ) { } }

implementation: if ( str == null ) { return false ; } return str . startsWith ( TieConstants . METHOD_WIDGET_PREFIX ) ;


signature:
public class ParserUtility { /** * validate method start with $ validate { rule = " . . . " error = " . . . " } .
 * @ param str
 * the str .
 * @ return true , if is validate method string . */
public static boolean isValidateMethodString ( final String str ) { } }

implementation: if ( str == null ) { return false ; } return str . startsWith ( TieConstants . METHOD_VALIDATE_PREFIX ) ;