Examples of XCommandProcessor


Examples of com.sun.star.ucb.XCommandProcessor

        command.Name = "open";
        command.Handle = -1;
        command.Argument = comArg;

        XCommandProcessor comProc = (XCommandProcessor)
            UnoRuntime.queryInterface(XCommandProcessor.class, content);

        XDynamicResultSet DynResSet = null;
        try {
            DynResSet = (XDynamicResultSet) AnyConverter.toObject(
                new Type(XDynamicResultSet.class),comProc.execute(command, 0, null));
        } catch(com.sun.star.ucb.CommandAbortedException e) {
            log.println("Couldn't execute command:" + e);
        } catch(com.sun.star.uno.Exception e) {
            log.println("Couldn't execute command:" + e);
        }
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

           

            XContent xCnt = xCntAccess.queryContent( xCntId );


            XCommandProcessor xCmd = ( XCommandProcessor )
                UnoRuntime.queryInterface( XCommandProcessor.class, xCnt );

   
            Property[] pArgs = new Property[ ] { new Property() };
            pArgs[ 0 ].Name = "DocumentModel";
            pArgs[ 0 ].Handle = -1;
   
            Command command = new Command();

            command.Handle = -1;
            command.Name = "getPropertyValues";
            command.Argument = pArgs;

            com.sun.star.ucb.XCommandEnvironment env = null ;
            Object result =  xCmd.execute( command, 0, env ) ;

            XRow values = ( XRow ) UnoRuntime.queryInterface( XRow.class,
                result );
   
            xModel = ( XModel UnoRuntime.queryInterface( XModel.class,
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

            Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );               
            XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB);
            XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, oUCB);
            XContentIdentifier xId = xIdFactory.createContentIdentifier(_sTDocUrl);
            XContent xContent = xProvider.queryContent(xId);     
            XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
            Property aProperty = new Property();
            aProperty.Name = _sPropertyName; // "DocumentModel";                //DocumentModel
            Command aCommand  = new Command();
            aCommand.Name = "getPropertyValues";
            aCommand.Handle = -1; // not available
            aCommand.Argument = new Property[]{aProperty};
            Object oAny = xCmdProcessor.execute(aCommand, 0, null);
            XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oAny);
            return xRow;
        }catch(Exception exception){
            exception.printStackTrace(System.out);
            return null;
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

        /////////////////////////////////////////////////////////////////////
        // Obtain command processor interface from given content.
        /////////////////////////////////////////////////////////////////////

        XCommandProcessor cmdProcessor
            = (XCommandProcessor)UnoRuntime.queryInterface(
                XCommandProcessor.class, ifc );

        /////////////////////////////////////////////////////////////////////
        // Assemble command to execute.
        /////////////////////////////////////////////////////////////////////

        Command command = new Command();
        command.Name     = commandName;
        command.Handle   = -1; // not available
        command.Argument = argument;

        // Note: throws CommandAbortedException, Exception
        return cmdProcessor.execute( command, 0, null );
    }
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

     * Effectively, this test case verifies the issues #i106574# and #i105235# did not creep back in.
     */
    public void checkDetailFormDefaults() throws Exception
    {
        CRMDatabase database = null;
        XCommandProcessor subComponentCommands = null;
        try
        {
            // create our standard CRM database document
            database = new CRMDatabase( m_orb, true );

            // create a form document therein
            XFormDocumentsSupplier formDocSupp = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, database.getDatabase().getModel() );
            XMultiServiceFactory formFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, formDocSupp.getFormDocuments() );
            NamedValue[] loadArgs = new NamedValue[] {
                new NamedValue( "ActiveConnection", database.getConnection().getXConnection() ),
                new NamedValue( "MediaType", "application/vnd.oasis.opendocument.text" )
            };

            subComponentCommands = UnoRuntime.queryInterface(
                XCommandProcessor.class,
                formFactory.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", loadArgs ) );
            Command command = new Command();
            command.Name = "openDesign";
            command.Argument = new Short( OpenMode.DOCUMENT );

            DocumentHelper subDocument = new DocumentHelper( m_orb,
                UnoRuntime.queryInterface( XComponent.class,
                    subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null )
                )
            );
            FormLayer formLayer = new FormLayer( subDocument );
            XPropertySet controlModel = formLayer.insertControlLine( "DatabaseNumericField", "ID",          "", 10 );
                                        formLayer.insertControlLine( "DatabaseTextField",    "Name",        "", 20 );
                                        formLayer.insertControlLine( "DatabaseTextField",    "Description", "", 30 );

            m_masterForm = (XPropertySet)dbfTools.getParent( controlModel, XPropertySet.class );
            m_masterForm.setPropertyValue( "Command", "categories" );
            m_masterForm.setPropertyValue( "CommandType", new Integer( CommandType.TABLE ) );

            // create a detail form
            m_detailForm = UnoRuntime.queryInterface( XPropertySet.class, subDocument.createSubForm( m_masterForm, "products" ) );
            m_detailForm.setPropertyValue( "Command", "SELECT \"ID\", \"Name\", \"CategoryID\" FROM \"products\"" );
            m_detailForm.setPropertyValue( "CommandType", new Integer( CommandType.COMMAND ) );
            m_detailForm.setPropertyValue( "MasterFields", new String[] { "ID" } );
            m_detailForm.setPropertyValue( "DetailFields", new String[] { "CategoryID" } );

            // create a grid control in the detail form, with some columns
            XPropertySet gridControlModel = formLayer.createControlAndShape( "GridControl", 20, 40, 130, 50, m_detailForm );
            gridControlModel.setPropertyValue( "Name", "product list" );
            XIndexContainer gridColumns = UnoRuntime.queryInterface( XIndexContainer.class, gridControlModel );
                                      impl_createGridColumn( gridColumns, "TextField", "ID" );
            XPropertySet nameColumn = impl_createGridColumn( gridColumns, "TextField", "Name" );
            nameColumn.setPropertyValue( "Width", new Integer( 600 ) ); // 6 cm
            nameColumn.setPropertyValue( "DefaultText", "default text" );

            // go live
            m_masterResult = new ResultSet( m_masterForm );
            m_detailResult = new ResultSet( m_detailForm );

            XLoadable loadDetail = UnoRuntime.queryInterface( XLoadable.class, m_detailForm );
            loadDetail.addLoadListener( this );

            subDocument.getCurrentView().toggleFormDesignMode();
            impl_waitForLoadedEvent();

            // now that we set up this, do the actual tests
            // First, http://www.openoffice.org/issues/show_bug.cgi?id=105235 described the problem
            // that default values in the sub form didn't work when the master form was navigated to a row
            // for which no detail records were present, and the default of the column/control is the same
            // as the last known value.

            // so, take the current value of the "Name" column, and set it as default value ...
            String defaultValue = m_detailResult.getString( 2 );
            nameColumn.setPropertyValue( "DefaultText", defaultValue );
            // ... then move to the second main form row ...
            m_masterResult.absolute( 2 );
            impl_waitForLoadedEvent();
            // ... which should result in an empty sub form ...
            assure( "test precondition not met: The second master form record is expected to have no detail records, " +
                "else the test becomes meaningless", impl_isNewRecord( m_detailForm ) );
            // ... and in the "Name" column having the proper text
            String actualValue = (String)nameColumn.getPropertyValue( "Text" );
            assureEquals( "#i105235#: default value in sub form not working (not propagated to column model)", defaultValue, actualValue );
            // However, checking the column model's value alone is not enough - we need to ensure it is properly
            // propagated to the control.
            XGridFieldDataSupplier gridData = (XGridFieldDataSupplier)subDocument.getCurrentView().getControl(
                gridControlModel, XGridFieldDataSupplier.class );
            actualValue = (String)(gridData.queryFieldData( 0, Type.STRING )[1]);
            assureEquals( "#i105235#: default value in sub form not working (not propagated to column)", defaultValue, actualValue );
        }
        finally
        {
            if ( subComponentCommands != null )
            {
                XComponentSupplier componentSupplier = UnoRuntime.queryInterface( XComponentSupplier.class, subComponentCommands );
                XModifiable modifySubComponent = UnoRuntime.queryInterface( XModifiable.class, componentSupplier.getComponent() );
                modifySubComponent.setModified( false );
                Command command = new Command();
                command.Name = "close";
                subComponentCommands.execute( command, subComponentCommands.createCommandIdentifier(), null );
            }

            if ( database != null )
                database.saveAndClose();

View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

        /////////////////////////////////////////////////////////////////////
        // Obtain command processor interface from given content.
        /////////////////////////////////////////////////////////////////////

        XCommandProcessor cmdProcessor
            = (XCommandProcessor)UnoRuntime.queryInterface(
                XCommandProcessor.class, ifc );

        /////////////////////////////////////////////////////////////////////
        // Assemble command to execute.
        /////////////////////////////////////////////////////////////////////

        Command command = new Command();
        command.Name     = commandName;
        command.Handle   = -1; // not available
        command.Argument = argument;

        // Note: throws CommandAbortedException, Exception
        return cmdProcessor.execute( command, 0, null );
    }
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

            Object oUCB = getXMultiComponentFactory().createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", keys, getXComponentContext() );               
            XContentIdentifierFactory xIdFactory = (XContentIdentifierFactory)UnoRuntime.queryInterface(XContentIdentifierFactory.class, oUCB);
            XContentProvider xProvider = (XContentProvider)UnoRuntime.queryInterface(XContentProvider.class, oUCB);
            XContentIdentifier xId = xIdFactory.createContentIdentifier(_sTDocUrl);
            XContent xContent = xProvider.queryContent(xId);     
            XCommandProcessor xCmdProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, xContent);
            Property aProperty = new Property();
            aProperty.Name = _sPropertyName; // "DocumentModel";                //DocumentModel
            Command aCommand  = new Command();
            aCommand.Name = "getPropertyValues";
            aCommand.Handle = -1; // not available
            aCommand.Argument = new Property[]{aProperty};
            Object oAny = xCmdProcessor.execute(aCommand, 0, null);
            XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oAny);
            return xRow;
        }catch(Exception exception){
            exception.printStackTrace(System.out);
            return null;
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

        {
            final Object aObj = xMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", args);
            final XPropertySet aDocumentDefinition = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aObj);
            m_aDocumentDefinition = aDocumentDefinition;

            final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, aObj);
            final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
            aCommand.Name = "openDesign";
            final com.sun.star.ucb.OpenCommandArgument2 aOpenCommand = new com.sun.star.ucb.OpenCommandArgument2();
            aOpenCommand.Mode = com.sun.star.ucb.OpenMode.DOCUMENT;

            PropertyValue args2[] = new PropertyValue[2];

            PropertyValue aPropOpenCommand = new PropertyValue();
            aPropOpenCommand.Name = "";
            aPropOpenCommand.Value = aOpenCommand;
            args2[0] = aPropOpenCommand;

            PropertyValue aAddField = new PropertyValue();
            aAddField.Name = "Mode";
            aAddField.Value = "remote";
            args2[1] = aAddField;

            aCommand.Argument = args2;
            // com.sun.star.usb.XCommandEnvironment xEnv = new com.sun.star.ucb.XCommandEnvironment();
            final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
            xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj2);
        }
        catch (com.sun.star.uno.Exception e)
        {
            ReportWizard.getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Problems with initialize the ReportDefinition" + e.getMessage());
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

            final XNameAccess aNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_aReportDocument);
            final String[] aNames = aNameAccess.getElementNames();

//            m_xReportDefinition.storeToStorage(m_xReportDefinition.getDocumentStorage(), m_xReportDefinition.getArgs());

            final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
            com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
            aCommand.Name = "storeOwn";

            final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);

            final XNameContainer aNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, m_aReportDocument);
//             aNameContainer.insertByName(Name, m_xReportDefinition);
            aNameContainer.insertByName(Name, m_aDocumentDefinition);
        }
View Full Code Here

Examples of com.sun.star.ucb.XCommandProcessor

//            aProperties[2] = new PropertyValue();
//            aProperties[2].Name = "Title"; // This name is 'Schall und Rauch'
//            aProperties[2].Value = Name;           

            final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
            com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
            aCommand.Name = "open";
            aCommand.Argument = aProperties;

            final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
            xComponents[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, aObj2);
        }
        catch (com.sun.star.uno.Exception e)
        {
            int dummy = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.