本文整理汇总了Java中com.sun.star.awt.XWindowPeer类的典型用法代码示例。如果您正苦于以下问题:Java XWindowPeer类的具体用法?Java XWindowPeer怎么用?Java XWindowPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XWindowPeer类属于com.sun.star.awt包,在下文中一共展示了XWindowPeer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMessageBox
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
public static void showMessageBox(XComponentContext context, XDialog dialog, MessageBoxType type, String sTitle, String sMessage) {
XToolkit xToolkit;
try {
xToolkit = UnoRuntime.queryInterface(XToolkit.class,
context.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", context));
} catch (Exception e) {
return;
}
XMessageBoxFactory xMessageBoxFactory = UnoRuntime.queryInterface(XMessageBoxFactory.class, xToolkit);
XWindowPeer xParentWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, dialog);
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(xParentWindowPeer, type,
com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, sTitle, sMessage);
if (xMessageBox == null)
return;
xMessageBox.execute();
}
示例2: createWindow
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Erzeugt ein Fenster ohne Dekorationen. Das Fenster kann als Inhalt eines
* Sidebar-Panels verwendet werden.
*
* @param toolkit
* @param parentWindow
* @return
*/
public static XWindowPeer createWindow(XToolkit toolkit, XWindowPeer parentWindow)
{
WindowDescriptor aWindow = new WindowDescriptor();
aWindow.Type = WindowClass.CONTAINER;
aWindow.WindowServiceName = "";
aWindow.Parent = parentWindow;
aWindow.ParentIndex = -1;
aWindow.Bounds = new Rectangle(0, 0, 10, 10);
aWindow.WindowAttributes =
WindowAttribute.SIZEABLE | WindowAttribute.MOVEABLE
| WindowAttribute.NODECORATION;
return toolkit.createWindow(aWindow);
}
示例3: createButton
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Erzeugt einen Button mit Label und ActionListener.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param label
* @param listener
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createButton(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String label, XActionListener listener, Rectangle size)
throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlButton", null, null, size);
XButton button = UnoRuntime.queryInterface(XButton.class, buttonCtrl);
button.setLabel(label);
button.addActionListener(listener);
return buttonCtrl;
}
示例4: createTextfield
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Erzeugt ein Texteingabefeld.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param text
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createTextfield(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String text, Rectangle size) throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlEdit", null, null, size);
XTextComponent txt = UnoRuntime.queryInterface(XTextComponent.class, buttonCtrl);
txt.setText(text);
return buttonCtrl;
}
示例5: createTree
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Erzeugt ein Baum-Steuerelement mit einem vorgegebenen Datenmodell.
* Das Datenmodel kann mit {@link #createTreeModel(XMultiComponentFactory, XComponentContext)}
* erzeugt werden.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param dataModel
* @return
* @throws Exception
*/
public static XControl createTree(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer, XMutableTreeDataModel dataModel) throws Exception
{
XControl treeCtrl =
GuiFactory.createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.tree.TreeControl", null, null, new Rectangle(0, 0,
400, 400));
XPropertySet props =
UnoRuntime.queryInterface(XPropertySet.class, treeCtrl.getModel());
props.setPropertyValue("DataModel", dataModel);
return treeCtrl;
}
示例6: createCombobox
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
public static XControl createCombobox(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer, String text, Rectangle size)
{
XControl ctrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlComboBox", null, null, size);
XTextComponent tf = UnoRuntime.queryInterface(XTextComponent.class, ctrl);
tf.setText(text);
XComboBox cmb = UnoRuntime.queryInterface(XComboBox.class, ctrl);
cmb.setDropDownLineCount((short) 10);
try
{
XControlModel model = ctrl.getModel();
// UnoRuntime.queryInterface(XControlModel.class,
// xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlComboBoxModel", context));
XPropertySet props =
UnoRuntime.queryInterface(XPropertySet.class, model);
props.setPropertyValue("Dropdown", Boolean.TRUE);
//props.setPropertyValue("ReadOnly", Boolean.TRUE);
props.setPropertyValue("Autocomplete", Boolean.FALSE);
props.setPropertyValue("HideInactiveSelection", Boolean.TRUE);
ctrl.setModel(model);
ctrl.getPeer().invalidate(InvalidateStyle.UPDATE);
}
catch (Exception e)
{
Logger.error(e);
}
return ctrl;
}
示例7: getOfficeFrame
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Returns OpenOffice.org frame integrated into the submitted Java SWT container.
*
* @param container java SWT container
*
* @return OpenOffice.org frame integrated into the submitted Java SWT container
*
* @author Thorsten Behrens
*/
public XFrame getOfficeFrame(final Composite container) {
if(officeConnection != null) {
try {
//TODO needs to be changed in later version as the dispose listener can be used.
if(!isConnected())
openConnection();
if(LOGGER.isLoggable(Level.FINEST))
LOGGER.finest("Creating local office window.");
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(
XToolkit.class, getXMultiServiceFactory().createInstance(
"com.sun.star.awt.Toolkit"));
// initialise le xChildFactory
XSystemChildFactory xChildFactory = (XSystemChildFactory) UnoRuntime
.queryInterface(XSystemChildFactory.class, xToolkit);
long handle = container.handle;
byte[] procID = new byte[0];
XWindowPeer xWindowPeer = xChildFactory.createSystemChild(
(Object) handle, procID, SystemDependent.SYSTEM_WIN32);
XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
xWindowPeer);
Object object = getXMultiServiceFactory().createInstance(
"com.sun.star.frame.Task"); //$NON-NLS-1$
if(object == null)
object = getXMultiServiceFactory().createInstance(
"com.sun.star.frame.Frame"); //$NON-NLS-1$
if(LOGGER.isLoggable(Level.FINEST))
LOGGER.finest("Creating UNO XFrame interface.");
XFrame xFrame = (XFrame) UnoRuntime
.queryInterface(XFrame.class, object);
xFrame.getContainerWindow();
xFrame.initialize(xWindow);
xFrame.setName(xFrame.toString());
if(LOGGER.isLoggable(Level.FINEST))
LOGGER.finest("Creating desktop service.");
Object desktop = getXMultiServiceFactory().createInstance(
"com.sun.star.frame.Desktop"); //$NON-NLS-1$
com.sun.star.frame.XFrames xFrames = ((com.sun.star.frame.XFramesSupplier) UnoRuntime
.queryInterface(com.sun.star.frame.XFramesSupplier.class, desktop))
.getFrames();
xFrames.append(xFrame);
return xFrame;
}
catch(Exception exception) {
LOGGER.throwing(this.getClass().getName(), "getOfficeFrame", exception);
//exception.printStackTrace();
return null;
}
}
else {
return null;
}
}
示例8: createControl
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Eine allgemeine Hilfsfunktion, mit der UNO-Steuerelemente erzeugt werden.
*
* @param xMCF
* @param xContext
* @param toolkit
* @param windowPeer
* @param type Klasse des Steuerelements, das erzeugt werden soll.
* @param propNames
* @param propValues
* @param rectangle
* @return
*/
public static XControl createControl(XMultiComponentFactory xMCF,
XComponentContext xContext, XToolkit toolkit, XWindowPeer windowPeer,
String type, String[] propNames, Object[] propValues, Rectangle rectangle)
{
try
{
XControl control =
UnoRuntime.queryInterface(XControl.class,
xMCF.createInstanceWithContext(type, xContext));
XControlModel controlModel =
UnoRuntime.queryInterface(XControlModel.class,
xMCF.createInstanceWithContext(type + "Model", xContext));
control.setModel(controlModel);
XMultiPropertySet properties =
UnoRuntime.queryInterface(XMultiPropertySet.class, control.getModel());
SortedMap<String, Object> props = new TreeMap<String, Object>();
if (type.equals("com.sun.star.awt.UnoControlImageControl"))
{
props.put("Border", (short) 0);
}
else if (type.equals("com.sun.star.awt.UnoControlEdit"))
{
props.put("MultiLine", false);
props.put("ReadOnly", false);
props.put("VScroll", false);
}
if (propNames != null)
{
for (int i = 0; i < propNames.length; i++)
{
props.put(propNames[i], propValues[i]);
}
}
if (props.size() > 0)
{
properties.setPropertyValues(
props.keySet().toArray(new String[props.size()]),
props.values().toArray(new Object[props.size()]));
}
control.createPeer(toolkit, windowPeer);
XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, control);
setWindowPosSize(controlWindow, rectangle);
return control;
}
catch (com.sun.star.uno.Exception ex)
{
Logger.debug(ex);
return null;
}
}
示例9: createSenderbox
import com.sun.star.awt.XWindowPeer; //导入依赖的package包/类
/**
* Erzeugt die Senderbox für die WollMux-Sidebar.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param label
* @param listener
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createSenderbox(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String label, XActionListener listener, Rectangle size)
throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createButton(xMCF, context, toolkit, windowPeer, label, listener, size);
XControlModel model = buttonCtrl.getModel();
XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, model);
props.setPropertyValue("FocusOnClick", false);
return buttonCtrl;
}