Java'da openoffice karmaşık araç çubuğu oluşturmak için web üzerinde herhangi bir örnek var mı? Java hiçbir C örneklerini buldum ++ ama: http://wiki.services.openoffice.org/wiki/Framework/Article/Generic_UNO_Interfaces_for_complex_toolbar_controls i bir uygulayan bu yazıyı http://java.dzone.com/news/lets-extend-openofficeorg-java#comment-53245 bulunduopenoffice java içinde Karmaşık araç çubuğu
java karmaşık bir araç çubuğu kullanır inşa etmek ve OO addon nasıl bir makale veya öğretici ihtiyacı
java PopupMenuController. Aynı işlemi yapmayı denedim ama PopupMenuController yerine bir XToolbarController kullanıyordum. Ancak benim denetleyici addon işe yaramazdı. aşağıda benim controller.xcu ve denetleyici sınıfıdır. Neyi yanlış yaptığımı anlatabilir misin? teşekkürler.
benim Controller.xcu:
benim araç çubuğu denetleyicisi sınıfı<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="Controller" oor:package="org.openoffice.Office.UI">
<node oor:name="Registered">
<node oor:name="ToolBar">
<node oor:name="c10" oor:op="replace">
<prop oor:name="Command">
<value>.uno:CommandLineToolbar</value>
</prop>
<prop oor:name="Module">
<value></value>
</prop>
<prop oor:name="Controller">
<value>com.example.toolbar.Toolbar</value>
</prop>
</node>
</node>
</node>
</oor:component-data>
:
public final class Toolbar extends ComponentBase
implements com.sun.star.util.XUpdatable,
com.sun.star.frame.XToolbarController,
com.sun.star.frame.XStatusListener,
com.sun.star.lang.XServiceInfo,
com.sun.star.lang.XInitialization,
com.sun.star.frame.XSubToolbarController
{
private final XComponentContext m_xContext;
private static final String m_implementationName = Toolbar.class.getName();
private static final String[] m_serviceNames = {
"com.sun.star.frame.ToolbarController" };
private String msInternalName = "i do not now";
private XComponent mxDocument;
private XTextComponent fixedText;
private XComboBox cBox_xComboBox;
private XMultiComponentFactory mxMCF;
public XMultiServiceFactory mxMSF;
public Toolbar(XComponentContext context)
{
m_xContext = context;
};
public static XSingleComponentFactory __getComponentFactory(String sImplementationName) {
XSingleComponentFactory xFactory = null;
if (sImplementationName.equals(m_implementationName))
xFactory = Factory.createComponentFactory(Toolbar.class, m_serviceNames);
return xFactory;
}
public static boolean __writeRegistryServiceInfo(XRegistryKey xRegistryKey) {
return Factory.writeRegistryServiceInfo(m_implementationName,
m_serviceNames,
xRegistryKey);
}
// com.sun.star.util.XUpdatable:
public void update()
{
// TODO: Insert your implementation for "update" here.
}
// com.sun.star.frame.XToolbarController:
public void execute(short KeyModifier)
{
// TODO: Insert your implementation for "execute" here.
}
public void click()
{
// TODO: Insert your implementation for "click" here.
}
public void doubleClick()
{
// TODO: Insert your implementation for "doubleClick" here.
}
public com.sun.star.awt.XWindow createPopupWindow()
{
// TODO: Exchange the default return implementation for "createPopupWindow" !!!
// NOTE: Default initialized polymorphic structs can cause problems
// because of missing default initialization of primitive types of
// some C++ compilers or different Any initialization in Java and C++
// polymorphic structs.
return null;
}
public com.sun.star.awt.XWindow createItemWindow(com.sun.star.awt.XWindow Parent)
{
System.out.println("ToolbarCombobox createItemWindow start");
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
// xMSF is set by initialize(Object[])
try {
// get XWindowPeer
XWindowPeer xWinPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, Parent);
Object o = mxMSF.createInstance("com.sun.star.awt.Toolkit");
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, o);
// create WindowDescriptor
WindowDescriptor wd = new WindowDescriptor();
wd.Type = WindowClass.SIMPLE;
wd.Parent = xWinPeer;
wd.Bounds = new Rectangle(0, 0, 230, 23);
wd.ParentIndex = (short) -1;
wd.WindowAttributes = WindowAttribute.SHOW |VclWindowPeerAttribute .DROPDOWN;
wd.WindowServiceName = "combobox";
// create ComboBox
XWindowPeer cBox_xWinPeer = xToolkit.createWindow(wd);
cBox_xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, cBox_xWinPeer);
// Get Interface for manipulating the text in the combobox
fixedText = (XTextComponent)UnoRuntime.queryInterface(XTextComponent.class,cBox_xComboBox);
fixedText.setText("Enter Command Here");
XWindow cBox_xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, cBox_xWinPeer);
// add some elements
cBox_xComboBox.addItems(new String[] { "test", "foo", "bar", "test2", "foo2", "bar2" }, (short) 0);
// cBox_xComboBox.addItems(new String[] {""}, (short) 4);
cBox_xComboBox.setDropDownLineCount((short) 6);
//cBox_xWindow.addKeyListener(this);
System.out.println("ToolbarCombobox createItemWindow end");
return cBox_xWindow;
} catch (com.sun.star.uno.Exception e) {
System.out.println("ToolbarCombobox createItemWindow end not o.k.");
return null; }
}
// com.sun.star.lang.XEventListener:
public void disposing(com.sun.star.lang.EventObject Source)
{
// TODO: Insert your implementation for "disposing" here.
}
// com.sun.star.frame.XStatusListener:
public void statusChanged(com.sun.star.frame.FeatureStateEvent State)
{
// TODO: Insert your implementation for "statusChanged" here.
}
// com.sun.star.lang.XServiceInfo:
public String getImplementationName() {
return m_implementationName;
}
public boolean supportsService(String sService) {
int len = m_serviceNames.length;
for(int i=0; i < len; i++) {
if (sService.equals(m_serviceNames[i]))
return true;
}
return false;
}
public String[] getSupportedServiceNames() {
return m_serviceNames;
}
// com.sun.star.lang.XInitialization:
public void initialize(Object[] aArguments) throws com.sun.star.uno.Exception
{
if (aArguments.length > 0)
{
mxMCF = m_xContext.getServiceManager();
mxMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, mxMCF);
}
}
// com.sun.star.frame.XSubToolbarController:
public boolean opensSubToolbar()
{
// TODO: Exchange the default return implementation for "opensSubToolbar" !!!
// NOTE: Default initialized polymorphic structs can cause problems
// because of missing default initialization of primitive types of
// some C++ compilers or different Any initialization in Java and C++
// polymorphic structs.
return false;
}
public String getSubToolbarName()
{
// TODO: Exchange the default return implementation for "getSubToolbarName" !!!
// NOTE: Default initialized polymorphic structs can cause problems
// because of missing default initialization of primitive types of
// some C++ compilers or different Any initialization in Java and C++
// polymorphic structs.
return new String();
}
public void functionSelected(String aCommand)
{
// TODO: Insert your implementation for "functionSelected" here.
}
public void updateImage()
{
// TODO: Insert your implementation for "updateImage" here.
}
}
Bu iş parçacığı gördüm ama çok yararlı değil. başka bir şekilde yapıyor. ToolbarController için http://java.dzone.com/news/lets-extend-openofficeorg-java#comment-53245 – othman
adresinde yapıldığı gibi ToolbarController ile ilgilenmekteyim, controller.xcu ile ilgili olduğundan şüpheliyim . "Komuta" elemanı için ne koymak? ' com.example.toolbar: Araç Çubuğu ' –
othman