renamed to SheetViewer in honor of Jason Height's fine work to make it not
suck anymore! Thanks Jason! Also added JAvadoc and remove template javadoc comments on overridden methods so that they'll bleed through on javadoc generation. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352801 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
862c09d871
commit
2a62650d46
@ -7,8 +7,12 @@ import javax.swing.border.AbstractBorder;
|
|||||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an attempt to implement Excel style borders for the SuckyViewer
|
* This is an attempt to implement Excel style borders for the SheetViewer.
|
||||||
*
|
* Mostly just overrides stuff so the javadoc won't appear here but will
|
||||||
|
* appear in the generated stuff.
|
||||||
|
*
|
||||||
|
* @author Andrew C. Oliver (acoliver at apache dot org)
|
||||||
|
* @author Jason Height
|
||||||
*/
|
*/
|
||||||
public class SVBorder extends AbstractBorder {
|
public class SVBorder extends AbstractBorder {
|
||||||
private Color northColor = null;
|
private Color northColor = null;
|
||||||
@ -60,6 +64,11 @@ public class SVBorder extends AbstractBorder {
|
|||||||
g.setColor(oldColor);
|
g.setColor(oldColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the border of a selected cell.
|
||||||
|
* The paramaters are the Graphics object, location and dimensions of the
|
||||||
|
* cell.
|
||||||
|
*/
|
||||||
private void paintSelectedBorder(Graphics g, int x, int y, int width,
|
private void paintSelectedBorder(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
@ -74,6 +83,10 @@ public class SVBorder extends AbstractBorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the various versions of normal line
|
||||||
|
* borders for a cell.
|
||||||
|
*/
|
||||||
private void paintNormalBorders(Graphics g, int x, int y, int width,
|
private void paintNormalBorders(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
|
|
||||||
@ -141,6 +154,10 @@ public class SVBorder extends AbstractBorder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the dotted line
|
||||||
|
* borders for a cell.
|
||||||
|
*/
|
||||||
private void paintDottedBorders(Graphics g, int x, int y, int width,
|
private void paintDottedBorders(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
if (northBorder &&
|
if (northBorder &&
|
||||||
@ -203,7 +220,10 @@ public class SVBorder extends AbstractBorder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the various versions of dotted line
|
||||||
|
* borders for a cell.
|
||||||
|
*/
|
||||||
private void paintDashedBorders(Graphics g, int x, int y, int width,
|
private void paintDashedBorders(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
if (northBorder &&
|
if (northBorder &&
|
||||||
@ -293,7 +313,10 @@ public class SVBorder extends AbstractBorder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the double line
|
||||||
|
* borders for a cell.
|
||||||
|
*/
|
||||||
private void paintDoubleBorders(Graphics g, int x, int y, int width,
|
private void paintDoubleBorders(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
if (northBorder &&
|
if (northBorder &&
|
||||||
@ -381,7 +404,10 @@ public class SVBorder extends AbstractBorder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by paintBorder to paint the various versions of dash dot dot line
|
||||||
|
* borders for a cell.
|
||||||
|
*/
|
||||||
private void paintDashDotDotBorders(Graphics g, int x, int y, int width,
|
private void paintDashDotDotBorders(Graphics g, int x, int y, int width,
|
||||||
int height) {
|
int height) {
|
||||||
if (northBorder &&
|
if (northBorder &&
|
||||||
@ -483,6 +509,9 @@ public class SVBorder extends AbstractBorder {
|
|||||||
return 18;
|
return 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns the line thickness for a border based on border type
|
||||||
|
*/
|
||||||
private int getThickness(int thickness) {
|
private int getThickness(int thickness) {
|
||||||
int retval=1;
|
int retval=1;
|
||||||
switch (thickness) {
|
switch (thickness) {
|
||||||
|
@ -67,7 +67,7 @@ import org.apache.poi.hssf.usermodel.*;
|
|||||||
import org.apache.poi.hssf.util.HSSFColor;
|
import org.apache.poi.hssf.util.HSSFColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucky Viewer Table Cell Editor -- not commented via javadoc as it
|
* Sheet Viewer Table Cell Editor -- not commented via javadoc as it
|
||||||
* nearly completely consists of overridden methods.
|
* nearly completely consists of overridden methods.
|
||||||
*
|
*
|
||||||
* @author Jason Height
|
* @author Jason Height
|
||||||
@ -85,11 +85,6 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
|||||||
private HSSFCell editorValue;
|
private HSSFCell editorValue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Constructor for the SVTableCellEditor object
|
|
||||||
*
|
|
||||||
* @param wb Description of the Parameter
|
|
||||||
*/
|
|
||||||
public SVTableCellEditor(HSSFWorkbook wb) {
|
public SVTableCellEditor(HSSFWorkbook wb) {
|
||||||
this.wb = wb;
|
this.wb = wb;
|
||||||
this.editor = new JTextField();
|
this.editor = new JTextField();
|
||||||
@ -99,7 +94,6 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
|||||||
/**
|
/**
|
||||||
* Gets the cellEditable attribute of the SVTableCellEditor object
|
* Gets the cellEditable attribute of the SVTableCellEditor object
|
||||||
*
|
*
|
||||||
* @param e Description of the Parameter
|
|
||||||
* @return The cellEditable value
|
* @return The cellEditable value
|
||||||
*/
|
*/
|
||||||
public boolean isCellEditable(java.util.EventObject e) {
|
public boolean isCellEditable(java.util.EventObject e) {
|
||||||
@ -110,34 +104,17 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of the Method
|
|
||||||
*
|
|
||||||
* @param anEvent Description of the Parameter
|
|
||||||
* @return Description of the Return Value
|
|
||||||
*/
|
|
||||||
public boolean shouldSelectCell(EventObject anEvent) {
|
public boolean shouldSelectCell(EventObject anEvent) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of the Method
|
|
||||||
*
|
|
||||||
* @param anEvent Description of the Parameter
|
|
||||||
* @return Description of the Return Value
|
|
||||||
*/
|
|
||||||
public boolean startCellEditing(EventObject anEvent) {
|
public boolean startCellEditing(EventObject anEvent) {
|
||||||
System.out.println("Start Cell Editing");
|
System.out.println("Start Cell Editing");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of the Method
|
|
||||||
*
|
|
||||||
* @return Description of the Return Value
|
|
||||||
*/
|
|
||||||
public boolean stopCellEditing() {
|
public boolean stopCellEditing() {
|
||||||
System.out.println("Stop Cell Editing");
|
System.out.println("Stop Cell Editing");
|
||||||
fireEditingStopped();
|
fireEditingStopped();
|
||||||
@ -145,18 +122,12 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Description of the Method */
|
|
||||||
public void cancelCellEditing() {
|
public void cancelCellEditing() {
|
||||||
System.out.println("Cancel Cell Editing");
|
System.out.println("Cancel Cell Editing");
|
||||||
fireEditingCanceled();
|
fireEditingCanceled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description of the Method
|
|
||||||
*
|
|
||||||
* @param e Description of the Parameter
|
|
||||||
*/
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
System.out.println("Action performed");
|
System.out.println("Action performed");
|
||||||
stopCellEditing();
|
stopCellEditing();
|
||||||
@ -178,11 +149,6 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
|
|||||||
/**
|
/**
|
||||||
* Gets the tableCellEditorComponent attribute of the SVTableCellEditor object
|
* Gets the tableCellEditorComponent attribute of the SVTableCellEditor object
|
||||||
*
|
*
|
||||||
* @param table Description of the Parameter
|
|
||||||
* @param value Description of the Parameter
|
|
||||||
* @param isSelected Description of the Parameter
|
|
||||||
* @param row Description of the Parameter
|
|
||||||
* @param column Description of the Parameter
|
|
||||||
* @return The tableCellEditorComponent value
|
* @return The tableCellEditorComponent value
|
||||||
*/
|
*/
|
||||||
public Component getTableCellEditorComponent(JTable table, Object value,
|
public Component getTableCellEditorComponent(JTable table, Object value,
|
||||||
|
@ -75,7 +75,7 @@ import org.apache.poi.hssf.util.HSSFColor;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucky Viewer Table Cell Render -- not commented via javadoc as it
|
* Sheet Viewer Table Cell Render -- not commented via javadoc as it
|
||||||
* nearly completely consists of overridden methods.
|
* nearly completely consists of overridden methods.
|
||||||
*
|
*
|
||||||
* @author Andrew C. Oliver
|
* @author Andrew C. Oliver
|
||||||
|
@ -64,7 +64,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|||||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucky Viewer Table Model - The model for the Sucky Viewer just overrides things.
|
* Sheet Viewer Table Model - The model for the Sheet Viewer just overrides things.
|
||||||
* @author Andrew C. Oliver
|
* @author Andrew C. Oliver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -68,13 +68,14 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|||||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sucky Viewer - Views XLS files via HSSF. Can be used as an applet with
|
* Sheet Viewer - Views XLS files via HSSF. Can be used as an applet with
|
||||||
* filename="" or as a applications (pass the filename as the first parameter).
|
* filename="" or as a applications (pass the filename as the first parameter).
|
||||||
* Or you can pass it a URL in a "url" parameter when run as an applet or just
|
* Or you can pass it a URL in a "url" parameter when run as an applet or just
|
||||||
* that first parameter must start with http:// and it will guess its a url. I
|
* that first parameter must start with http:// and it will guess its a url. I
|
||||||
* only tested it as an applet though, so it probably won't work...you fix it.
|
* only tested it as an applet though, so it probably won't work...you fix it.
|
||||||
*
|
*
|
||||||
* @author Andrew C. Oliver
|
* @author Andrew C. Oliver
|
||||||
|
* @author Jason Height
|
||||||
*/
|
*/
|
||||||
public class SViewer extends JApplet {
|
public class SViewer extends JApplet {
|
||||||
private SViewerPanel panel;
|
private SViewerPanel panel;
|
||||||
|
Loading…
Reference in New Issue
Block a user