|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.jniwrapper.win32.jexcel.ui.JWorkbook
This class provides functionality for embedding Excel workbook into a Java Swing application as an ordinary Swing component.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JWorkbook()
Creates an instance of JWorkbook component. |
|
JWorkbook(Application application,
java.io.File workbook,
boolean staticView)
Creates an instance of JWorkbook component for specified Excel application process and displays the specified Excel workbook. |
|
JWorkbook(boolean staticView)
Creates an instance of JWorkbook component. |
|
JWorkbook(java.io.File workbook)
Creates an instance of JWorkbook component and displays the specified Excel workbook. |
|
JWorkbook(java.io.File workbook,
boolean staticView)
Creates an instance of JWorkbook component and displays the specified Excel workbook. |
|
| Method Summary | |
void |
activate()
Activates an embedded workbook. |
void |
addJWorkbookEventListener(JWorkbookEventListener eventListener)
Add a listener of the embedded workbook events. |
void |
addNotify()
|
void |
addWorkbookEventListener(WorkbookEventListener eventListener)
Adds the listener of workbook events. |
Worksheet |
addWorksheet(java.lang.String name)
Adds a worksheet to the workbook. |
Worksheet |
addWorksheet(Worksheet after,
java.lang.String name)
Adds a worksheet to the workbook. |
void |
close()
Closes an embedded workbook. |
void |
createWorkbook()
|
void |
deactivate()
Activates an embedded workbook. |
Worksheet |
getActiveWorksheet()
Returns the active worksheet. |
Application |
getApplication()
Returns the parent application. |
java.lang.String |
getAuthor()
Returns the workbook author name. |
java.io.File |
getFile()
If an embedded workbook has been loaded from a file or a new workbook has been saved, then the function returns the workbook file, otherwise it returns null. |
FileFormat |
getFileFormat()
Returns the format of the workbook file. |
java.lang.String |
getTitle()
Returns the currently set title of the workbook. |
Window |
getWindow()
Returns the windows that corresponds to the workbook. |
Workbook |
getWorkbook()
Returns an Excel workbook that is currently opened. |
java.lang.String |
getWorkbookName()
Returns the name of the workbook. |
Worksheet |
getWorksheet(int index)
Returns the worksheet that is specified by its index. |
Worksheet |
getWorksheet(java.lang.String name)
Returns the worksheet that is specified by its name. |
int |
getWorksheetCount()
Returns the number of worksheets in the workbook. |
java.util.List |
getWorksheets()
Returns the list of worksheets of the workbook. |
boolean |
hasPassword()
Returns true if the workbook has a password. |
boolean |
isClosed()
Checks if the workbook is closed. |
boolean |
isPrintPreview()
Returns true if the component is in the preview mode. |
boolean |
isReadOnly()
Checks if the workbook is read only. |
boolean |
isSaved()
Checks if the workbook is saved (have not benn changed since the last save operation). |
boolean |
isStaticMode()
Returns true if the workbook is displayed in a static mode and false otherwise. |
boolean |
isWorkbookCreated()
|
void |
moveWorksheet(Worksheet worksheet,
Worksheet after)
Moves the worksheet to the position after the specified worksheet. |
void |
newWorkbook()
Creates a new workbook in the container. |
void |
notifyPrintPreviewStateChanged()
|
void |
openWorkbook(java.io.File workbookFile)
Opens the specified Excel workbookFile in the container. |
void |
print(int copies)
Prints the specified number of copies of the workbook. |
void |
print(int firstSheet,
int lastSheet,
int copies)
Prints the specified range of worksheet. |
void |
removeEventHandler()
Removes the handler of workbook events. |
void |
removeJWorkbookEventListener(JWorkbookEventListener eventListener)
Removes the specified event listener. |
void |
removeNotify()
|
void |
removeWorkbookEventListener(WorkbookEventListener eventListener)
Removes the specified listener of workbook events. |
void |
removeWorksheet(Worksheet worksheet)
Removes the worksheet from the workbook. |
void |
save()
|
void |
saveAs(java.io.File file,
FileFormat fileFormat,
boolean overwrite)
|
com.jniwrapper.win32.HResult |
saveCopyAs(java.io.File file)
Saves a copy of the workbook to another file. |
void |
setAuthor(java.lang.String author)
Specifies the workbook author name. |
protected void |
setContainer(com.jniwrapper.win32.automation.OleContainer container)
|
void |
setEventHandler(WorkbookEventHandler eventHandler)
Specifies the handler of workbook events. |
void |
setPassword(java.lang.String password)
Sets up the password of the workbook. |
void |
setPrintPreview(boolean value)
Switches the workbook to the print preview mode and back. |
void |
setStaticMode(boolean value)
Changes the embedded workbook displaying mode. |
void |
setTitle(java.lang.String title)
Sets up the title of the workbook. |
void |
showPrintDialog()
Displays print dialog. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public JWorkbook()
throws ExcelException
ExcelException - if Excel cannot be run.
public JWorkbook(boolean staticView)
throws ExcelException
staticView - specifies whether the embedded workbook has active UI or not. If true
the workbook will be displayed in the static (not active) mode.
ExcelException - if Excel cannot be run.setStaticMode(boolean)
public JWorkbook(java.io.File workbook)
throws java.io.FileNotFoundException,
ExcelException
workbook - is an Excel workbook file.
ExcelException - if Excel cannot be run.
java.io.FileNotFoundException - if the specified file was not found.
public JWorkbook(java.io.File workbook,
boolean staticView)
throws java.io.FileNotFoundException,
ExcelException
workbook - is an Excel workbook file.staticView - specifies whether the embedded workbook has active UI or not. If true
the workbook will be displayed in the static (not active) mode.
ExcelException - if Excel cannot be run.
java.io.FileNotFoundException - if the specified file was not found.
public JWorkbook(Application application,
java.io.File workbook,
boolean staticView)
throws java.io.FileNotFoundException,
ExcelException
application - Excel application process.workbook - is an Excel workbook file.staticView - specifies whether the embedded workbook has active UI or not. If true
the workbook will be displayed in the static (not active) mode.
ExcelException - if Excel cannot be run.
java.io.FileNotFoundException - if the specified file was not found.| Method Detail |
public void removeNotify()
public void addNotify()
public Workbook getWorkbook()
Workbookpublic void activate()
activate in interface GenericWorkbookpublic Window getWindow()
GenericWorkbook
getWindow in interface GenericWorkbookWindowpublic java.lang.String getAuthor()
GenericWorkbook
getAuthor in interface GenericWorkbookpublic void setAuthor(java.lang.String author)
GenericWorkbook
setAuthor in interface GenericWorkbookauthor - is the workbook author name.public void removeWorksheet(Worksheet worksheet)
GenericWorkbook
removeWorksheet in interface GenericWorkbookworksheet - specifies the worksheet to be removed.
public void moveWorksheet(Worksheet worksheet,
Worksheet after)
GenericWorkbook
moveWorksheet in interface GenericWorkbookworksheet - specifies the worksheet to be moved.after - the worksheet will be moved to the position after this worksheet.
If the value is null, the worksheet will be moved
to the beginning of the worksheet list.public Application getApplication()
GenericWorkbook
getApplication in interface GenericWorkbook
public void save()
throws java.io.IOException
java.io.IOException
public void saveAs(java.io.File file,
FileFormat fileFormat,
boolean overwrite)
throws java.io.IOException
java.io.IOException
public com.jniwrapper.win32.HResult saveCopyAs(java.io.File file)
throws java.io.IOException
GenericWorkbook
saveCopyAs in interface GenericWorkbookfile - specifies the file name.
java.io.IOException - if the workbook cannot be saved to the specified file.public void deactivate()
public void close()
java.lang.IllegalStateException - if the component is in the preview mode.
public void openWorkbook(java.io.File workbookFile)
throws java.io.FileNotFoundException
workbookFile - is an Excel workbook file to be opened.
java.lang.IllegalArgumentException - if the target file is not an Excel workbookFile.
java.io.FileNotFoundException - if the target file doesn't exist.
java.lang.IllegalStateException - if the component is in the preview mode.public void createWorkbook()
public void newWorkbook()
java.lang.IllegalStateException - if the component is in the preview mode.public void setPrintPreview(boolean value)
value - if true the workbook will be switched to
the print preview mode.public boolean isPrintPreview()
true if the component is in the preview mode.
true if the component is in the preview mode.public void showPrintDialog()
java.lang.IllegalStateException - if the component is in the preview mode.
public Worksheet addWorksheet(java.lang.String name)
throws ExcelException
GenericWorkbook
addWorksheet in interface GenericWorkbookname - is the name of a new worksheet.
ExcelException - if a worksheet with such name already exists in the workbook.
public Worksheet addWorksheet(Worksheet after,
java.lang.String name)
throws ExcelException
GenericWorkbook
addWorksheet in interface GenericWorkbookafter - the worksheet will be added to the position after this worksheet.
If the value is null, the worksheet will be added
at the beginning of the worksheet list.name - is the name of a new worksheet.
ExcelException - if a worksheet with such name already exists in the workbook.public Worksheet getWorksheet(java.lang.String name)
GenericWorkbooknull.
getWorksheet in interface GenericWorkbookname - is the name of the worksheet.
null if such worksheet is not present.public java.util.List getWorksheets()
GenericWorkbookWorksheet class.
getWorksheets in interface GenericWorkbookpublic Worksheet getWorksheet(int index)
GenericWorkbook
getWorksheet in interface GenericWorkbookindex - is the index of the worksheet.
public Worksheet getActiveWorksheet()
GenericWorkbook
getActiveWorksheet in interface GenericWorkbookpublic void setEventHandler(WorkbookEventHandler eventHandler)
GenericWorkbook
setEventHandler in interface GenericWorkbookeventHandler - public void removeEventHandler()
GenericWorkbook
removeEventHandler in interface GenericWorkbookpublic void addWorkbookEventListener(WorkbookEventListener eventListener)
GenericWorkbook
addWorkbookEventListener in interface GenericWorkbookeventListener - public void removeWorkbookEventListener(WorkbookEventListener eventListener)
GenericWorkbook
removeWorkbookEventListener in interface GenericWorkbookeventListener - is the listener to be removed.public void setTitle(java.lang.String title)
GenericWorkbook
setTitle in interface GenericWorkbooktitle - is a new title of the workbook.public java.lang.String getTitle()
GenericWorkbook
getTitle in interface GenericWorkbookpublic java.io.File getFile()
null.
getFile in interface GenericWorkbookpublic FileFormat getFileFormat()
GenericWorkbook
getFileFormat in interface GenericWorkbook
public void print(int copies)
throws javax.print.PrintException
GenericWorkbook
print in interface GenericWorkbookcopies - is the number of copies to be printered.
javax.print.PrintException - if print problems occured.
public void print(int firstSheet,
int lastSheet,
int copies)
throws javax.print.PrintException
GenericWorkbook
print in interface GenericWorkbookfirstSheet - is the index of the first worksheet to be printered.lastSheet - is the index of the last worksheet to be printered.copies - is the number of copies to be printered.
javax.print.PrintException - if print problems occured.public int getWorksheetCount()
GenericWorkbook
getWorksheetCount in interface GenericWorkbookpublic void setPassword(java.lang.String password)
GenericWorkbook
setPassword in interface GenericWorkbookpassword - is a new password to be set up.public boolean hasPassword()
GenericWorkbooktrue if the workbook has a password.
hasPassword in interface GenericWorkbooktrue if the workbook has a password.public java.lang.String getWorkbookName()
GenericWorkbook
getWorkbookName in interface GenericWorkbookpublic boolean isReadOnly()
GenericWorkbook
isReadOnly in interface GenericWorkbooktrue if the workbook is read only.public boolean isSaved()
GenericWorkbook
isSaved in interface GenericWorkbooktrue if the workbook is saved.public boolean isClosed()
GenericWorkbook
isClosed in interface GenericWorkbooktrue if the workbook is closed.public void addJWorkbookEventListener(JWorkbookEventListener eventListener)
eventListener - JWorkbookEventListener,
JWorkbookEventAdapterpublic void removeJWorkbookEventListener(JWorkbookEventListener eventListener)
eventListener - JWorkbookEventListener,
JWorkbookEventAdapterpublic void setStaticMode(boolean value)
value - if true the workbook is displayed in a static mode, otherwise in a UI active mode.public boolean isStaticMode()
true if the workbook is displayed in a static mode and false otherwise.
true if the workbook is displayed in a static mode and false otherwise.public boolean isWorkbookCreated()
public void notifyPrintPreviewStateChanged()
protected void setContainer(com.jniwrapper.win32.automation.OleContainer container)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||