Methods Summary |
---|
private org.apache.poi.hssf.usermodel.HSSFWorkbook | constructWorkbook(java.lang.String filename)
HSSFWorkbook wb = null;
FileInputStream in = new FileInputStream(filename);
wb = new HSSFWorkbook(in);
in.close();
return wb;
|
private org.apache.poi.hssf.usermodel.HSSFWorkbook | constructWorkbook(java.io.InputStream in)
HSSFWorkbook wb = null;
wb = new HSSFWorkbook(in);
in.close();
return wb;
|
public void | destroy()Destroy the applet
|
public java.lang.String | getAppletInfo()Get Applet information
return "Applet Information";
|
public java.lang.String | getParameter(java.lang.String key, java.lang.String def)Get a parameter value
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
|
public java.lang.String[][] | getParameterInfo()Get parameter info
return null;
|
private java.io.InputStream | getXLSFromURL(java.lang.String urlstring)opens a url and returns an inputstream
URL url = new URL(urlstring);
URLConnection uc = url.openConnection();
String field = uc.getHeaderField(0);
for (int i=0;field != null; i++) {
System.out.println(field);
field = uc.getHeaderField(i);
}
BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
return is;
|
public void | init()Initialize the applet
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
System.exit(1);
}
|
private void | jbInit()Component initialization
InputStream i = null;
boolean isurl = false;
if (filename == null) filename = getParameter("filename");
if (filename == null || filename.substring(0,7).equals("http://")) {
isurl = true;
if (filename == null) filename = getParameter("url");
i = getXLSFromURL(filename);
}
HSSFWorkbook wb = null;
if (isurl) {
wb = constructWorkbook(i);
} else {
wb = constructWorkbook(filename);
}
panel = new SViewerPanel(wb, false);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(panel, BorderLayout.CENTER);
|
public static void | main(java.lang.String[] args)Main method
SViewer applet = new SViewer();
applet.isStandalone = true;
applet.filename = args[0];
Frame frame;
frame = new Frame() {
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
};
frame.setTitle("Applet Frame");
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400,320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
|
public void | start()Start the applet
|
public void | stop()Stop the applet
|