Package com.sun.star.ucb

Examples of com.sun.star.ucb.Command


   
            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;
View Full Code Here


    public boolean _execute() {
        String[]commands = new String[] {"getCommandInfo", "getPropertySetInfo"};
        boolean returnVal = true;
        for (int j=0; j<commands.length; j++) {
            String commandName = commands[j];
            Command command = new Command(commandName, -1, null);

            Object result;

            log.println("executing command " + commandName);
            try {
View Full Code Here

    public boolean _abort() {
        //executeMethod("createCommandIdentifier()");

//        Command command = null;//(Command)tEnv.getObjRelation(
                //"XCommandProcessor.AbortCommand");
        Command command = new Command("getCommandInfo", -1, null);

        if (command == null) {
            String commandName = "globalTransfer";

            String srcURL = util.utils.getFullTestURL("solibrary.jar") ;
            String tmpURL = util.utils.getOfficeTemp(xMSF) ;
            log.println("Copying '" + srcURL + "' to '" + tmpURL) ;

            GlobalTransferCommandArgument arg = new
                GlobalTransferCommandArgument(
                    TransferCommandOperation.COPY, srcURL,
                        tmpURL, "", NameClash.OVERWRITE);

            command = new Command(commandName, -1, arg);
        }

        Thread aborter = new Thread() {
            public void run() {
                for (int i = 0; i < 10; i++) {
View Full Code Here

     * contains info about 'getCommandInfo' command and in the second
     * case an exception is thrown. <p>
     */
    public void _execute() {
        String commandName = "getCommandInfo";
        Command command = new Command(commandName, -1, null);

        Object result;

        log.println("executing command " + commandName);
        try {
            result = oObj.execute(command, 0, null);
        } catch (CommandAbortedException e) {
            log.println("The command aborted " + e.getMessage());
            e.printStackTrace(log);
            throw new StatusException("Unexpected exception", e);
        } catch (Exception e) {
            log.println("Unexpected exception " + e.getMessage());
            e.printStackTrace(log);
            throw new StatusException("Unexpected exception", e);
        }

        XCommandInfo xCmdInfo = (XCommandInfo)UnoRuntime.queryInterface(
                XCommandInfo.class, result);

        CommandInfo[] cmdInfo = xCmdInfo.getCommands();

        boolean found = false;

        for (int i = 0; i < cmdInfo.length; i++) {
            if (cmdInfo[i].Name.equals(commandName)) {
                found = true;
                break;
            }
        }

        log.println("testing execute with wrong command");

        Command badCommand = new Command("bad command", -1, null);

        try {
            oObj.execute(badCommand, 0, null);
        } catch (CommandAbortedException e) {
            log.println("CommandAbortedException thrown - OK");
View Full Code Here

     * </ul>
     */
    public void _abort() {
        executeMethod("createCommandIdentifier()");

        Command command = (Command)tEnv.getObjRelation(
                "XCommandProcessor.AbortCommand");

        if (command == null) {
            String commandName = "globalTransfer";

            String srcURL = util.utils.getFullTestURL("SwXTextEmbeddedObject.sdw") ;
            String tmpURL = util.utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF()) ;
            log.println("Copying '" + srcURL + "' to '" + tmpURL) ;

            GlobalTransferCommandArgument arg = new
                GlobalTransferCommandArgument(
                    TransferCommandOperation.COPY, srcURL,
                        tmpURL, "", NameClash.OVERWRITE);

            command = new Command(commandName, -1, arg);
        }

        Thread aborter = new Thread() {
            public void run() {
                for (int i = 0; i < 10; i++) {
View Full Code Here

                UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ;

            Property prop = new Property() ;
            prop.Name = "Title" ;

            Command cmd = new Command("open", -1, new OpenCommandArgument2
                (OpenMode.ALL, 10000, null, new Property[] {prop},
                 new NumberedSortingInfo[0])) ;

            XDynamicResultSet dynResSet = null;
            try {
View Full Code Here

                UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ;

            Property prop = new Property() ;
            prop.Name = "Title" ;

            Command cmd = new Command("open", -1, new OpenCommandArgument2
                (OpenMode.ALL, 10000, null, new Property[] {prop},
                 new NumberedSortingInfo[0])) ;

            XDynamicResultSet dynResSet = null;
            try {
View Full Code Here

                UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ;

            Property prop = new Property() ;
            prop.Name = "Title" ;

            Command cmd = new Command("open", -1, new OpenCommandArgument2
                (OpenMode.ALL, 10000, null, new Property[] {prop},
                 new NumberedSortingInfo[0])) ;

            dynResSet = null;
            try {
View Full Code Here

                UnoRuntime.queryInterface(XCommandProcessor.class, cnt) ;

            Property prop = new Property() ;
            prop.Name = "Title" ;

            Command cmd = new Command("open", -1, new OpenCommandArgument2
                (OpenMode.ALL, 10000, null, new Property[] {prop},
                 new NumberedSortingInfo[0])) ;

            XDynamicResultSet dynResSet = null;
            try {
View Full Code Here

            };

            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 )
View Full Code Here

TOP

Related Classes of com.sun.star.ucb.Command

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.