|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Canvas com.jniwrapper.win32.automation.OleContainer
This class enables to embed OLE/ActiveX controls into a java application. An
OLE/ActiveX control can be created in the container by class name: createObject(String
oleClassName)
or from file: createObject(File fileName)
method.
Note: If you need a java menu to be displayed over an
embedded ActiveX control, just add the following piece of code:
JPopupMenu.setDefaultLightWeightPopupEnabled(false)
Since version 2.2 an ability is added to insert an IOleObject instance into
the container using the insertObject(IOleObject oleObject)
method.
Nested Class Summary | |
static class |
OleContainer.AutoActivateMode
Represents enumeration of auto activation modes. |
static class |
OleContainer.SizeMode
Represents enumeration of available size modes. |
Nested classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
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 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 | |
OleContainer()
|
|
OleContainer(java.lang.Class clientSiteImpl)
|
|
OleContainer(java.lang.Class clientSiteImpl,
OleMessageLoop messageLoop)
|
|
OleContainer(OleMessageLoop messageLoop)
|
Method Summary | |
protected void |
activate()
|
void |
createObject(CLSID clsid)
Creates an object in the container by CLSID. |
void |
createObject(java.io.File file)
Creates an object in the container by association specified by the file name. |
void |
createObject(java.lang.String oleClassName)
Creates an object in the container by class name. |
void |
destroyObject()
Destroys the previously created OleObject. |
protected void |
disableFocusGainedIgnoreTimeout()
|
void |
doVerb(int verb)
Does the verb for OleObject. |
protected void |
draw()
Default method for drawing an embedded component which is in inactive state using oleDraw OLE function. |
protected void |
drawBitmap(Bitmap bitmap)
Draws bitmap object on the canvas of this container. |
protected void |
enableFocusGainedIgnoreTimeout()
|
protected boolean |
gainedFocus()
|
protected Wnd |
getActivatedWindow()
|
int |
getActivationVerb()
Returns the activation verb of this container. |
OleContainer.AutoActivateMode |
getAutoActivateMode()
|
java.awt.Rectangle |
getContainerBounds()
Returns the container bounds. |
Wnd |
getContainerWindow()
Returns window of this container. |
CLSID |
getCurrentDocumentType()
Returns identifier of embedded OLE object. |
FileOperationsHandler |
getFileOperationsHandler()
|
Wnd |
getObjectWindow()
Returns window of an embedded object. |
IOleClientSite |
getOleClientSite()
Returns an instance of OleClientSite. |
OleMessageLoop |
getOleMessageLoop()
|
IOleObjectImpl |
getOleObject()
Returns an OleObject. |
Size |
getOleObjectViewSize()
Returns the size of the embedded OLE object. |
protected java.awt.Container |
getParentContainer()
|
PrintHandler |
getPrintDocumentHandler()
|
protected static Wnd |
getRootWindow(Wnd wnd,
boolean ignoreWindowStyles)
|
protected OleContainerSibling |
getSibling()
|
OleContainer.SizeMode |
getSizeMode()
Returns active size mode. |
protected boolean |
gotSameRoots(Wnd wnd1,
Wnd wnd2)
|
void |
inPlaceDeactivate()
Performs in-place deactivation of the inserted OleObject. |
void |
insertObject(IOleObject oleObject)
Inserts an externally created OLE object. |
protected boolean |
isComponentDisplayed()
|
boolean |
isHandleUpdateAsSave()
|
protected boolean |
isIgnoreTimeout()
|
boolean |
isPrintPreview()
|
void |
load(byte[] data)
Loads an OLE object from the specified byte array. |
void |
load(java.io.InputStream stream)
Loads an OLE object from the specified stream. |
void |
load(IStorage storage)
Loads an OLE object from OLE storage. |
protected void |
makeContainerWindowFocused()
|
void |
open(java.io.File file)
Creates an OLE object from file. |
void |
paint(java.awt.Graphics g)
|
void |
removeNotify()
|
protected void |
resizeWindow()
|
byte[] |
save()
Saves an OLE object as byte array. |
HResult |
save(java.io.File file)
Saves an OLE object to file. |
void |
save(java.io.OutputStream stream)
Saves an OLE object to the specified stream. |
protected void |
setActivatedWindow(Wnd activatedWindow)
|
void |
setActivationVerb(int activationVerb)
Sets the default activation verb for the container. |
void |
setAutoActivateMode(OleContainer.AutoActivateMode value)
Determines how the object in an OLE container is activated. |
protected void |
setComponentDisplayed(boolean componentDisplayed)
|
void |
setFileOperationsHandler(FileOperationsHandler fileOperationsHandler)
|
void |
setHandleUpdateAsSave(boolean handleUpdateAsSave)
Set handle or not ole object update event. |
void |
setPrintDocumentHandler(PrintHandler printDocumentHandler)
|
void |
setSizeMode(OleContainer.SizeMode value)
Determines how the OLE object is sized in the OLE container. |
protected boolean |
shouldActivateWhenVisible()
|
Bitmap |
takeScreenshot()
Takes a screenshot of an embedded component. |
void |
uiActivate()
Activates the OLE objects' UI. |
void |
uiDeactivate()
Deactivates the OLE object's UI. |
Methods inherited from class java.awt.Canvas |
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OleContainer()
public OleContainer(OleMessageLoop messageLoop)
public OleContainer(java.lang.Class clientSiteImpl)
public OleContainer(java.lang.Class clientSiteImpl, OleMessageLoop messageLoop)
Method Detail |
public OleMessageLoop getOleMessageLoop()
public void setSizeMode(OleContainer.SizeMode value)
value
- new size mode.public OleContainer.SizeMode getSizeMode()
protected boolean isIgnoreTimeout()
protected boolean gainedFocus()
public void setAutoActivateMode(OleContainer.AutoActivateMode value)
value
- new auto activation mode.public OleContainer.AutoActivateMode getAutoActivateMode()
protected static Wnd getRootWindow(Wnd wnd, boolean ignoreWindowStyles)
protected boolean gotSameRoots(Wnd wnd1, Wnd wnd2)
protected void draw()
oleDraw
OLE function.
protected void makeContainerWindowFocused()
public CLSID getCurrentDocumentType()
public void open(java.io.File file)
file
- document filepublic HResult save(java.io.File file)
file
- for saving
HResult.S_OK
,
HResult.S_FALSE
protected void activate()
protected boolean shouldActivateWhenVisible()
protected OleContainerSibling getSibling()
public void removeNotify()
protected void resizeWindow()
public void createObject(CLSID clsid) throws ComException
clsid
- class ID of a component
ComException
- if any exception occurspublic void createObject(java.lang.String oleClassName) throws ComException
oleClassName
- ProgID of a component
ComException
- if any exception occurspublic void createObject(java.io.File file) throws ComException
file
- document file
ComException
- if any exception occurspublic void insertObject(IOleObject oleObject)
Important. The object should be created in OleMessageLoop:
public void insertEmbeddedObject()
{
...
OleMessageLoop.invoke(this, "createEbmeddedObject");
...
}
public void createEmbeddedObject()
{
_DPdf areader = Pdf.create(new ClsCtx(ClsCtx.CLSCTX_ALL));
IOleObject oleObject = new IOleObjectImpl(areader);
_container.insertObject(oleObject);
}
Note. If you insert an OLE object provided by local COM server,
you should release all references to the inserted OLE object for unloading the COM server.
oleObject
- is an OLE object inserted into container.public void destroyObject()
public IOleObjectImpl getOleObject()
public IOleClientSite getOleClientSite()
public void doVerb(int verb)
verb
- is a verb listed in OleVerbs
enumerationpublic void uiDeactivate()
Only OLE objects with active UI receive keyboard and mouse messages. The process have at most one UI active object.
public void uiActivate()
Only OLE objects with active UI receive keyboard and mouse messages. The process have at most one UI active object.
Invokes the doVerb(int)
method with OleVerbs.UIACTIVATE
parameter to activate the OLE object.
public Wnd getContainerWindow()
public Wnd getObjectWindow()
public boolean isPrintPreview()
public void inPlaceDeactivate()
public java.awt.Rectangle getContainerBounds()
public Size getOleObjectViewSize()
public void load(IStorage storage) throws java.io.IOException
storage
- an OLE storage to load an object from.
java.io.IOException
- if any exception occurspublic void load(java.io.InputStream stream) throws java.io.IOException
stream
- a stream to load an object from.
java.io.IOException
- if any exception occurspublic void load(byte[] data)
data
- the byte array to load an object from. This parameter cannot be null.public void save(java.io.OutputStream stream) throws java.io.IOException
stream
- a stream to save an object to.
java.io.IOException
- if any exception occurspublic byte[] save()
public PrintHandler getPrintDocumentHandler()
public void setPrintDocumentHandler(PrintHandler printDocumentHandler)
public FileOperationsHandler getFileOperationsHandler()
public void setFileOperationsHandler(FileOperationsHandler fileOperationsHandler)
public void setHandleUpdateAsSave(boolean handleUpdateAsSave)
handleUpdateAsSave
- true to handle update event, otherwise falsepublic boolean isHandleUpdateAsSave()
public Bitmap takeScreenshot()
protected java.awt.Container getParentContainer()
protected void drawBitmap(Bitmap bitmap)
bitmap
- bitmap to drawpublic int getActivationVerb()
public void setActivationVerb(int activationVerb)
activationVerb
- activation verbpublic void paint(java.awt.Graphics g)
protected boolean isComponentDisplayed()
protected void setComponentDisplayed(boolean componentDisplayed)
protected Wnd getActivatedWindow()
protected void setActivatedWindow(Wnd activatedWindow)
protected void disableFocusGainedIgnoreTimeout()
protected void enableFocusGainedIgnoreTimeout()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |