cvs commit: jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel TestHSSFSheet.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

cvs commit: jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel TestHSSFSheet.java

AviK-5
avik        2005/05/07 10:25:26

  Modified:    src/java/org/apache/poi/hssf/model Sheet.java
               src/java/org/apache/poi/hssf/usermodel HSSFSheet.java
               src/testcases/org/apache/poi/hssf/usermodel
                        TestHSSFSheet.java
  Log:
  user API to set window pane when wb is opened
  by Amol Deshmukh and Li Jianming
 
  Revision  Changes    Path
  1.53      +31 -0     jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java
 
  Index: Sheet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Sheet.java 5 May 2005 13:07:58 -0000 1.52
  +++ Sheet.java 7 May 2005 17:25:26 -0000 1.53
  @@ -1934,6 +1934,37 @@
           return retval;
       }
       
  +    public short getTopRow()
  +    {
  +     return (windowTwo==null) ? (short) 0 : windowTwo.getTopRow();
  +    }
  +    
  +    public void setTopRow(short topRow)
  +    {
  +     if (windowTwo!=null)
  +     {
  +     windowTwo.setTopRow(topRow);
  +     }
  +    }
  +  
  +    /**
  +     * Sets the left column to show in desktop window pane.
  +     * @param the left column to show in desktop window pane
  +     */
  +        public void setLeftCol(short leftCol){
  +         if (windowTwo!=null)
  +         {  
  +         windowTwo.setLeftCol(leftCol);
  +         }
  +        }
  +        
  +        public short getLeftCol()
  +        {
  +         return (windowTwo==null) ? (short) 0 : windowTwo.getLeftCol();
  +        }
  +        
  +        
  +    
       /**
        * Returns the active row
        *
 
 
 
  1.32      +31 -0     jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
 
  Index: HSSFSheet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- HSSFSheet.java 1 May 2005 11:26:18 -0000 1.31
  +++ HSSFSheet.java 7 May 2005 17:25:26 -0000 1.32
  @@ -871,6 +871,37 @@
           sclRecord.setDenominator((short)denominator);
           getSheet().setSCLRecord(sclRecord);
       }
  +    
  +    /**
  +     * The top row in the visible view when the sheet is
  +     * first viewed after opening it in a viewer
  +     * @return short indicating the rownum (0 based) of the top row
  +     */
  +    public short getTopRow()
  +    {
  +     return sheet.getTopRow();
  +    }
  +    
  +    /**
  +     * The left col in the visible view when the sheet is
  +     * first viewed after opening it in a viewer
  +     * @return short indicating the rownum (0 based) of the top row
  +     */
  +    public short getLeftCol()
  +    {
  +     return sheet.getLeftCol();
  +    }
  +    
  +    /**
  +     * Sets desktop window pane display area, when the
  +     * file is first opened in a viewer.
  +     * @param the top row to show in desktop window pane
  +     * @param the left column to show in desktop window pane
  +     */
  +    public void showInPane(short toprow, short leftcol){
  +        this.sheet.setTopRow((short)toprow);
  +        this.sheet.setLeftCol((short)leftcol);
  +        }
   
    /**
    * Shifts the merged regions left or right depending on mode
 
 
 
  1.24      +28 -1     jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
 
  Index: TestHSSFSheet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- TestHSSFSheet.java 28 Apr 2005 13:44:06 -0000 1.23
  +++ TestHSSFSheet.java 7 May 2005 17:25:26 -0000 1.24
  @@ -409,7 +409,34 @@
           assertEquals ("DBCS Sheet Name 2", wb.getSheetName(1),"\u090f\u0915" );
           assertEquals("DBCS Sheet Name 1", wb.getSheetName(0),"\u091c\u093e");
       }
  -
  +    
  +    /**
  +     * Testing newly added method that exposes the WINDOW2.toprow
  +     * parameter to allow setting the toprow in the visible view
  +     * of the sheet when it is first opened.
  +     */
  +    public void testTopRow() throws Exception
  +    {
  +        FileInputStream fis = null;
  +        HSSFWorkbook wb     = null;
  +        
  +        String filename = System.getProperty("HSSF.testdata.path");
  +
  +        filename = filename + "/SimpleWithPageBreaks.xls";
  +        fis = new FileInputStream(filename);
  +        wb = new HSSFWorkbook(fis);
  +        fis.close();
  +        
  +        HSSFSheet sheet = wb.getSheetAt(0);
  +        assertNotNull(sheet);
  +        
  +        short toprow = (short) 100;
  +        short leftcol = (short) 50;
  +        sheet.showInPane(toprow,leftcol);
  +        assertEquals("HSSFSheet.getTopRow()", toprow, sheet.getTopRow());
  +        assertEquals("HSSFSheet.getLeftCol()", leftcol, sheet.getLeftCol());
  +    }
  +    
    public static void main(java.lang.String[] args) {
    junit.textui.TestRunner.run(TestHSSFSheet.class);
    }    
 
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/