Avik Sengupta wrote: >Sorry didnt get u completely :) > > > >>RequiresContextInterface //later we may need specifics like workbook, >>sheet, row, cell....but not yet >>setContext(Context); >> >> > >this interface will be implemented by the PTG's that need it?? > > yes.
>>From where and when will the setContext method be passed? > > that which constructs the PTG (ultimately HSSFCell) > > >Quoting "Andrew C. Oliver" <[EMAIL PROTECTED]>: > ><snip /> > > > >>Thats preferrable to the workbook context being stored as a "current >>book" and the such. Possibilities >> >>1. Pass the workbook reference >>2. Workbook manage its context via "ThreadLocal" as you had it >>3. Implement a workbook context manager. >> >>org.apache.poi.hssf.model.context >> >>ContextManagerInterface >>getContext() >> >>ContextManager >>ContextManager(HSSFWorkbook) >>ContextManager(HSSFWorkbook, HSSFSheet) >>ContextManager(HSSFWorkbook, HSSFSheet, HSSFRow) >>ContextManager(HSSFWorkbook, HSSFSheet, HSSFRow, HSSFCell) >>getContext(); >> >>ContextInterface >>public final static byte CONTEXT_TYPE_WORKBOOK=0 >>public final static byte CONTEXT_TYPE_SHEET=1 >>public final static byte CONTEXT_TYPE_ROW=2 >>public final static byte CONTEXT_TYPE_CELL=3 >>getContextType() >>getWorkbook() >>getSheet() >>getRow() >>getCell() >> >>RequiresContextInterface //later we may need specifics like workbook, >>sheet, row, cell....but not yet >>setContext(Context); >> >>Anyhow the above is just for example purposes, reality may end up being >>different. >> >>The context should be passed to the constructed item (don't overuse the >>singleton pattern). >> >>This means that the sheet-reference-aware PTGs would be dependant upon >>the context (which is logical). They'd still be dependant upon the >>workbook. They'd not need any tricks (ThreadLocal, static variables, >>etc). And you wouldn't be passing the workbook around. >> >>If this is agreeable, we can convert usermodel.* to work the same way >>internally (currently HSSFRow refers to HSSFSheet & Workbook etc etc). >> Makes them constructors get smaller and neater too. >> >>Tie that one on and tell me what ya think ;-) >> >>Thanks, >> >>-Andy >> >> >> >>>Thoughts? >>>- >>>Avik >>> >>> >>> >>> >>> >>> >> >>-- >>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> >> >> >> >> > > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
