|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.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
Represetns 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 |
addFocusListener(java.awt.event.FocusListener l)
|
void |
addNotify()
|
protected void |
configureSibling()
|
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. |
void |
doVerb(int verb)
Does the verb for OleObject. |
protected void |
draw()
Default method for drawning 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. |
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. |
PrintHandler |
getPrintDocumentHandler()
|
OleContainer.SizeMode |
getSizeMode()
Returns active size mode. |
void |
inPlaceDeactivate()
Performs in-place deactivation of the inserted OleObject. |
void |
insertObject(IOleObject oleObject)
Inserts an externally created OLE object. |
protected boolean |
isFocused()
|
boolean |
isHandleUpdateAsSave()
|
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. |
void |
open(java.io.File file)
Creates an OLE object from file. |
protected void |
processKeyEvent(java.awt.event.KeyEvent e)
|
void |
removeFocusListener(java.awt.event.FocusListener l)
|
void |
removeNotify()
|
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. |
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. |
void |
setFileOperationsHandler(FileOperationsHandler fileOperationsHandler)
|
protected void |
setFocused(boolean focused)
|
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. |
Bitmap |
takeScreenshot()
Takes a screenshot of an embedded component. |
void |
uiActivate()
Activates the OLE objects' UI. |
void |
uiDeactivate()
Deactivates the OLE object's UI. |
protected void |
updateClientSide()
|
Methods inherited from class java.awt.Canvas |
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, paint, update |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, 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, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, 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 void setFocused(boolean focused)
protected boolean isFocused()
public void setAutoActivateMode(OleContainer.AutoActivateMode value)
value
- new auto atctivation mode.public OleContainer.AutoActivateMode getAutoActivateMode()
protected void processKeyEvent(java.awt.event.KeyEvent e)
protected void draw()
oleDraw
OLE function.
public CLSID getCurrentDocumentType()
public void open(java.io.File file)
file
- public HResult save(java.io.File file)
file
- for saving
HResult.S_OK
,
HResult.S_FALSE
protected void activate()
public void addNotify()
protected void configureSibling()
public void removeNotify()
protected void updateClientSide()
public void createObject(CLSID clsid) throws ComException
clsid
-
ComException
public void createObject(java.lang.String oleClassName) throws ComException
oleClassName
-
ComException
public void createObject(java.io.File file) throws ComException
file
-
ComException
public 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
public void load(java.io.InputStream stream) throws java.io.IOException
stream
- a stream to load an object from.
java.io.IOException
public 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
public 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 void drawBitmap(Bitmap bitmap)
bitmap
- bitmap to drawpublic void addFocusListener(java.awt.event.FocusListener l)
public void removeFocusListener(java.awt.event.FocusListener l)
public int getActivationVerb()
public void setActivationVerb(int activationVerb)
activationVerb
- activation verb
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |