Hi Eric,
Because its in "contrib" its not up to the same level of scruitiny that
a contribution to the main tunk is. I'm dividing these into basically
things that are required for me (and probably most anyone else) to
commit this and feedback/suggestions (as you requested)
Requirements for me (personally) to commit it:
1. submit it via the instructions here:
http://jakarta.apache.org/poi/getinvolved/index.html (submitting
patches) (directory preserving archive being the essential piece)
include the commons jars you used in lib/optional
2. Test that it compiles in the build
3. Supply the appropriate patches to build it in contrib and create a jar
4. Fill in the Javadoc comments that are just templates or delete them
if they are inherited. Correct the javadoc that refers to classes that
you did not submit (hint: search on report).
Humble requests:
1. I hate the name of HSSFUtil. Name it something more descriptive of
its function.
2. Unit tests.
3. Patches to the documentation pages...add a "contrib" under "project"
add a sub-dir called "hssf-conveinience" or something like that
(whatever you want to name this), explain what it does and document it.
Otherwise hardly anyone will notice its there.
Thanks for your contribution,
Andy
[EMAIL PROTECTED] wrote:
> Hi all,
>
> I finished putting all the various methods in for HSSFRegionUtil and
> HSSFUtil. A couple things that I can see drawing comment...
>
> One is that I use a PropertyUtils method to copy properties between two
> CellStyles. I also used a NestableException. Not sure how POI feels about
> dependencies on various packages in Commons.
>
> I look forward to your feedback. And as I find more region stuff
> (background colors come to mind) I will add them if no one else beats me to
> it!
>
> Since I am not sure how to do a diff when nothing exists, I have just
> attached the two classes.
>
> Eric Pugh
>
>
>
> -----Original Message-----
> From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 29, 2002 11:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Draw Border Around Region
>
>
> Works for me....
>
> encapsulation is "annoying" ? ;-)
>
> [EMAIL PROTECTED] wrote:
>
>>Okay,
>>
>>Here is my plan of action.. I am going to create
>>contrib/src/org.apache.poi.hssf.usermodel.contrib.HSSFRegionUtil, and
>
> going
>
>>to stick my region code in there. This will be just working around the
>>edges of the usermodel. I just started trying to get all the various
>>elements to compile and run the tests etc, but to meet my immediate need,
>
> I
>
>>will add my util code there. Also, I will ass
>>contrib/src/org.apache.poi.hssf.usermodel.contrib.HSSFUtil that has things
>>like getCell and getRow that make life easier.
>>
>>Hopefully, as I get up to speed (and hit all the annoyances of coding
>
> around
>
>>the API versus updating the API :-) ) then I will try and get the
>
> usermodel
>
>>stuff working.
>>
>>Sound good?
>>Eric
>>
>>-----Original Message-----
>>From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, July 29, 2002 11:07 AM
>>To: [EMAIL PROTECTED]
>>Subject: Re: Draw Border Around Region
>>
>>
>>To understand merged regions. Create them with borders in excel and use:
>>
>>org.apache.poi.hssf.dev.BiffViewer
>>
>>on the resulting file.
>>
>>
>>
>>
>>>If not, then I will just continue down the workaround util code to make it
>>>easier to assign borders to regions of cells. If I end up on that path,
>>
>>and
>>
>>
>>>you would like a contrib/src/ package, what should the package statement
>>
>>be?
>>
>>
>>perhaps:
>>contrib/src/org.apache.poi.hssf.usermodel.contrib.*
>>or maybe
>>contrib/src/org.apache.poi.hssf.usermodel.ext.*
>>
>>and we'll make a poi-hssf-optional.jar or something to that effect. Do
>>something generic enough that later contributors can donate and use the
>>same scheme.
>>
>>This might be a good way to suck others into the project. They start
>>out hacking in contrib adding friendly functions and get sucked further
>>into the project without even realizing it ;-)
>>
>>-Andy
>>
>>
>>
>>
>>>Eric
>>>
>>>-----Original Message-----
>>>From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
>>>Sent: Monday, July 29, 2002 10:27 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: Re: Draw Border Around Region
>>>
>>>
>>>Okay maybe I misunderstood. If this is to support a border to the
>>>MergedRegion as opposed to the cells in the merged region, then I
>>>support the addition of this. If this is a utility to make it
>>>convenient to draw borders around cells then I'll -1 it in the core API.
>>>I'd consider that to be the domain of the application programmer. I'd
>>>be okay with putting it in some kind of contrib/src/ package for
>>>convenience functions around HSSF but not in HSSF proper.
>>>
>>>We're at the stage where we're getting stable, but I think we have to
>>>fight against bloat.
>>>
>>>That being said, if there is some way to expose a property of
>>>MergedRegion (org.apache.poi.hssf.record.MergedRegionRecord) that will
>>>assign it borders then thats cool with me. I'd rather it not go in util
>>>but become part of the usermodel.
>>>
>>>-Andy
>>>
>>>[EMAIL PROTECTED] wrote:
>>>
>>>
>>>
>>>>Okay...
>>>>
>>>>I started digging into it a little more, and things became more complex
>>>
>>>(of
>>>
>>>
>>>
>>>>course....) I saw you have some other *Util classes floating around that
>>>
>>>do
>>>
>>>
>>>
>>>>things.
>>>>
>>>>It seems that I need to have access to the sheet, the row, and the
>>>
> cell...
>
>>>>So I was going to create a class called HSSFRegionUtil with methods like
>>>>this:
>>>>
>>>> public void leftBorder( HSSFCell cell ) {
>>>> HSSFCellStyle style = copy( cell.getCellStyle() );
>>>>
>>>> if ( style.getBorderLeft() == HSSFCellStyle.BORDER_MEDIUM )
>>>>{
>>>> log.debug( "setting left border for cell with left
>>>>border setting of medium" );
>>>> }
>>>>
>>>> style.setBorderLeft( HSSFCellStyle.BORDER_MEDIUM );
>>>> style.setLeftBorderColor( HSSFColor.BLACK.index );
>>>>
>>>> cell.setCellStyle( style );
>>>> }
>>>>
>>>>
>>>> protected void leftBorder( Region region ) {
>>>> int rowStart = region.getRowFrom();
>>>> int rowEnd = region.getRowTo();
>>>> int column = region.getColumnFrom();
>>>> log.debug( "rosStart:" + rowStart + ", rowend:" + rowEnd );
>>>>
>>>> for ( int i = rowStart; i <= rowEnd; i++ ) {
>>>> leftBorder( this.getCell( this.getRow( i ), column )
>>>>);
>>>> }
>>>>
>>>> }
>>>>
>>>> public HSSFCellStyle copy( HSSFCellStyle style ) {
>>>> HSSFCellStyle style2 = wb.createCellStyle();
>>>> style2.setFont( wb.getFontAt( style.getFontIndex() ) );
>>>> style2.setVerticalAlignment( style.getVerticalAlignment() );
>>>> style2.setAlignment( style.getAlignment() );
>>>> style2.setWrapText( style.getWrapText() );
>>>> return style2;
>>>> }
>>>>
>>>>What I am concerned about is the need to make each cell have it's own
>>>
> cell
>
>>>>style, because otherwise it seems to share that style over every cell.
>>>
> So
>
>>>>if you make one cell have a left border, then all cells, sharing that
>>>
> cell
>
>>>>style, end up with a left border.
>>>>
>>>>Is doing this fit the poi model?
>>>>
>>>>Eric
>>>>
>>>>-----Original Message-----
>>>>From: Andrew C. Oliver [mailto:[EMAIL PROTECTED]]
>>>>Sent: Friday, July 26, 2002 8:02 PM
>>>>To: [EMAIL PROTECTED]
>>>>Subject: re: Draw Border Around Region
>>>>
>>>>
>>>>*sounds reasonable, but you'll need to create a new abstraction for
>>>>region (HSSFMergedRegion in usermodel)
>>>>because Region is used for more than merged regions.
>>>>
>>>
>>>
> ----------------------------------------------------------------------------
>
>>>>-----------------------------------------------------------------
>>>>
>>>>Subject:* Draw Border Around Region
>>>>*From:* EPugh <at> upstate.com
>>>>*Newsgroups:* gmane.comp.jakarta.poi.user
>>>>*Date:* Jul 26 2002 14:27:38
>>>>
>>>>Hi all,
>>>>
>>>>I wanted to check on the status of the enhancment request for putting in
>>>
> a
>
>>>>setBorder commands for a region as well as a cell?
>>>>
>>>>I need it pretty urgently, so, if no one has taken a stab at it, I will.
>>>>
>>>>Basically, after looking at it, I think all I need to add to the Region
>>>
>>>code
>>>
>>>
>>>
>>>>is:
>>>>
>>>>setBorderLeft( HSSFCellStyle.BORDER_MEDIUM)
>>>>
>>>>Then in the method, I just figure out what cells are in the left side of
>>>
>>>the
>>>
>>>
>>>
>>>>reagion, and just interate through them, grab their style, and call
>>>>cell.setBorderLeft(my passed in border)....
>>>>
>>>>Seems easy enough, am I on the right track?
>>>>
>>>>Eric
>>>>
>>>>
>>>>
>>>>--
>>>>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]>
>>
>>
>>
>>
>>
>>
>>--
>>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]>
>
>
> ------------------------------------------------------------------------
>
> --
> 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]>