Package com.sun.star.container

Examples of com.sun.star.container.XNameContainer


                    UnoRuntime.queryInterface(XSingleServiceFactory.class, jobs);
                Object oNewJob = jobsFac.createInstance();
                XNameReplace xNewJobNR = (XNameReplace)
                    UnoRuntime.queryInterface(XNameReplace.class, oNewJob);
                xNewJobNR.replaceByName("Service", "test.Job");
                XNameContainer xJobsNC = (XNameContainer)
                    UnoRuntime.queryInterface(XNameContainer.class, jobs);
                xJobsNC.insertByName("TestJob", oNewJob);

                log.println("Adding configuration to Events  ...");
                XSingleServiceFactory eventsFac = (XSingleServiceFactory)
                    UnoRuntime.queryInterface(XSingleServiceFactory.class, events);
                Object oNewEvent = eventsFac.createInstance();

                XNameAccess xNewEventNA = (XNameAccess)
                    UnoRuntime.queryInterface(XNameAccess.class, oNewEvent);
                Object oJobList = xNewEventNA.getByName("JobList");
                XSingleServiceFactory jobListFac = (XSingleServiceFactory)
                    AnyConverter.toObject(new Type(XSingleServiceFactory.class),
                    oJobList);
                XNameContainer jobListNC = (XNameContainer)
                    AnyConverter.toObject(new Type(XNameContainer.class),
                    oJobList);
                log.println("\tAdding TimeStamps to Events ...");
                Object oNewJobTimeStamps = jobListFac.createInstance();
               
                jobListNC.insertByName("TestJob",  oNewJobTimeStamps);
               
               
                XNameContainer xEventsNC = (XNameContainer)
                    UnoRuntime.queryInterface(XNameContainer.class, events);
                xEventsNC.insertByName("TestEvent", oNewEvent);

                XChangesBatch xCB = (XChangesBatch)
                    UnoRuntime.queryInterface(XChangesBatch.class, oRootCfg);
                xCB.commitChanges();
View Full Code Here


       
        String hierarchicalElementName = "Labels['Avery A4']";
        String elementName = "Avery A4";

        XNameReplace xChangeView = null;
        XNameContainer xContainer = null;
        XHierarchicalNameAccess xHierachNameAccess = null;
        try {
            XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF())
                                                     .createInstance("com.sun.star.comp.configuration.ConfigurationProvider");
            XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(
View Full Code Here

            //obtain all style family names
            String[] styleFamiliesNames = StyleFamilies.getElementNames();
            String styleFamilyName = styleFamiliesNames[0];
            //obtain style family with name[0]
            Object objectStyle = StyleFamilies.getByName(styleFamilyName);
            XNameContainer xStyleFamilyName = (XNameContainer)
                UnoRuntime.queryInterface(XNameContainer.class, objectStyle);
            //creat new style
            Object SC = SOF.createInstance(xDrawDoc, "com.sun.star.style.Style");
            XStyle Style = (XStyle) UnoRuntime.queryInterface(XStyle.class,SC);
            //add new style to style familiy with name[0]
            xStyleFamilyName.insertByName(STYLE_NAME,Style);
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace(log) ;
            throw new StatusException("Can't create component.", e) ;
        }
View Full Code Here

    public void storeConfiguration()
    {
        try
        {
            // remove stored connection information
            XNameContainer xContainer = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/ConnectionList" );
            String[] pNames = xContainer.getElementNames();
            for( int i=0; i<pNames.length; i++ )
            {
                xContainer.removeByName( pNames[i] );
            }
           
            // store all connections
            XSingleServiceFactory xConnectionFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer );
            for ( int i=0; i< m_WikiConnections.size(); i++ )
            {
                Object oNewConnection = xConnectionFactory.createInstance();
                Hashtable ht = ( Hashtable ) m_WikiConnections.get( i );
                XNameReplace xNewConn = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewConnection );
               
                if ( xNewConn != null )
                    xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
                xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
            }
            // commit changes
            XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
            xBatch.commitChanges();
           
            // remove stored connection information
            XNameContainer xContainer2 = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/RecentDocs" );
            String[] pNames2 = xContainer2.getElementNames();
            for( int i=0; i<pNames2.length; i++ )
            {
                xContainer2.removeByName( pNames2[i] );
            }
            // store all Docs
            XSingleServiceFactory xDocListFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 );
            for ( int i=0; i< m_aWikiDocs.size(); i++ )
            {
                Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i );
               
                Object oNewDoc = xDocListFactory.createInstance();
                XNameReplace xNewDoc = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
               
                Enumeration e = ht.keys();
                while ( e.hasMoreElements() )
                {
                    String key = ( String ) e.nextElement();
                    xNewDoc.replaceByName( key, ht.get( key ) );
                }
               
                xContainer2.insertByName( "d" + i, xNewDoc );
            }
            // commit changes
            XChangesBatch xBatch2 = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer2 );
            xBatch2.commitChanges();
           
View Full Code Here


    protected static XNameContainer GetConfigNameContainer( XComponentContext xContext, String sNodepath )
        throws com.sun.star.uno.Exception
    {
        XNameContainer xContainer = ( XNameContainer ) UnoRuntime.queryInterface( XNameContainer.class, GetConfig( xContext, sNodepath, true ) );
        if ( xContainer == null )
            throw new com.sun.star.uno.RuntimeException();
       
        return xContainer;
    }
View Full Code Here

                } catch (java.lang.Exception e){
                    failed("could not get test object", CONTINUE);
                }
               
                xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oObj);
                XNameContainer xNC = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oObj);
                XNameReplace xNR = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, oObj);
                XFlushable xFlush = (XFlushable) UnoRuntime.queryInterface(XFlushable.class, oObj);

                instance = (Object[]) xNA.getByName(filterName);
                PropertyValue[] props = (PropertyValue[]) instance;
               
                printPropertyValues(props);
               
                boolean isMandatory = ((Boolean) getPropertyValueValue(props, "Mandatory")).booleanValue();
                boolean isFinalized = ((Boolean) getPropertyValueValue(props, "Finalized")).booleanValue();
               
                // memory if every state is available
                mandantoryTrue |= isMandatory;
                mandantoryFalse |= !isMandatory;
               
                finalizedTrue |= isFinalized;
                finalizedFalse |= !isFinalized;
               
                //change the filter
                setPropertyValueValue((PropertyValue[])instance, "UIName", "dummy");
               
                // 1a.) try to change the filter in the container
                try{
                    xNR.replaceByName(filterName, instance);
                }catch (IllegalArgumentException e){
                    failed("could not replace filter properties ('" + filterName + "')", CONTINUE);
                }
               
                // 1b.) try to wirte the changed filter to the configuration.
                // This must result in a exception if the filter is finalized.
                boolean flushError = false;
                try{
                    xFlush.flush();
                } catch (WrappedTargetRuntimeException e){
                    flushError = true;
                    assure("Unexpected exception wihle flushing changed filter '"+ filterName + "'", isFinalized,CONTINUE);
                }
                assure("Expected exception was not thorwn while flushing changed filter '"+ filterName + "' Finalized:" + isFinalized,
                        !(flushError ^ isFinalized), CONTINUE);
               
               
               
                // 2a.) try to remove the filter from the container
                try{
                    xNC.removeByName(filterName);
                }catch (NoSuchElementException e){
                    failed("could not remove filter from container ('" + filterName + "')", CONTINUE);
                }
                // 1b.) try to wirte the changed filter to the configuration.
                // This must result in a exception if the filter is mandatory
View Full Code Here

            XPropertySet.class, cancelButtonModel);
        buttonProps.setPropertyValue("Name", "Cancel");
        buttonProps.setPropertyValue("Label", "Cancel");
     
        // insert the control models into the dialog model
        XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(
            XNameContainer.class, dialogModel);

        xNameCont.insertByName("PromptLabel", label);
        xNameCont.insertByName("Ok", okButtonModel);
        xNameCont.insertByName("Cancel", cancelButtonModel);

        // create the dialog control and set the model
        Object dialog = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialog", xComponentContext);
        XControl xControl = (XControl) UnoRuntime.queryInterface(
View Full Code Here

            XPropertySet.class, cancelButtonModel);
        buttonProps.setPropertyValue("Name", "Cancel");
        buttonProps.setPropertyValue("Label", "Cancel");
     
        // insert the control models into the dialog model
        XNameContainer xNameCont = (XNameContainer)
            UnoRuntime.queryInterface(XNameContainer.class, dialogModel);

        xNameCont.insertByName("PromptLabel", label);
        xNameCont.insertByName("NameField", edit);
        xNameCont.insertByName("Ok", okButtonModel);
        xNameCont.insertByName("Cancel", cancelButtonModel);

        // create the dialog control and set the model
        Object dialog = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialog", xComponentContext);
        XControl xControl = (XControl) UnoRuntime.queryInterface(
View Full Code Here

            XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oQuery);

            String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery();
            xPSet.setPropertyValue("Command", s);

            XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQueryDefs);
            XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xQueryDefs);
            ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName);
            xNameCont.insertByName(_QueryName, oQuery);
            return true;
        }
        catch (WrappedTargetException exception)
        {
            SQLException sqlError = null;
View Full Code Here

        return curControlData;
    }

    public XNameContainer getDocumentForms()
    {
        XNameContainer xNamedForms = xFormsSupplier.getForms();
        return xNamedForms;
    }
View Full Code Here

TOP

Related Classes of com.sun.star.container.XNameContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.