Examples of XFastPropertySet


Examples of com.sun.star.beans.XFastPropertySet

    public void checkXFastPropertySet()
    {
        log.println("---- Testing the XFastPropertySet interface ----");

        // creating instances
        XFastPropertySet xFPS = (XFastPropertySet)
                UnoRuntime.queryInterface(XFastPropertySet.class, oObj);

        String name = null;
        // do for all properties
        for (int i = 0; i < props.length; i++) {
            try {
                Property property = props[i];
                name = property.Name;
                int handle = property.Handle;

                // get property name and initial value
                log.println("Test property with name: " + name);
                String val = (String)xFPS.getFastPropertyValue(handle);
                log.println("Property has initial value: '" + val + "'");

                // set to a new correct value
                String newVal = changeToCorrectValue(val);
                log.println("Try to change to correct value '" + newVal + "'");
                xFPS.setFastPropertyValue(handle, newVal);

                // check the change
                String checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value on property " + name + ".", checkVal.equals(newVal));

                newVal = changeToIncorrectValue(val);
                log.println("Try to change to incorrect value '" + newVal + "'");
                try {
                    xFPS.setFastPropertyValue(handle, newVal);
                }
                catch(com.sun.star.lang.IllegalArgumentException e) {
                    log.println("Correctly thrown Exception caught.");
                }

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Value did change on property " + name + " though it should not have.",
                                                                            !checkVal.equals(newVal));

                // set back to initial setting
                xFPS.setFastPropertyValue(handle, val);

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value back to original on property "
                                            + name, checkVal.equals(val));
                log.println("Test of property " + name + " finished\n");
            }
            catch(com.sun.star.uno.Exception e) {
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

            // disable QuickStarter
            try
            {
                Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
                XFastPropertySet fps = (XFastPropertySet) UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
                fps.setFastPropertyValue(0, false);
            }
            catch (com.sun.star.uno.Exception ex)
            {
                dbg("ERROR: Could not disable QuickStarter: " + ex.toString());
            }
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

    private boolean checkStringListProperty(Property property)
    {
        // creating instances
        boolean bResult = true;
        XFastPropertySet xFPS = UnoRuntime.queryInterface(XFastPropertySet.class, aPathSettings);

        String name = property.Name;
        int handle = property.Handle;
       
        Object oValue;
        try
        {
            oValue = xFPS.getFastPropertyValue(handle);
        }
        catch (UnknownPropertyException ex)
        {
            return false;
        }
        catch (WrappedTargetException ex)
        {
            return false;
        }

        if (!AnyConverter.isArray(oValue))
        {
            System.out.println(" Internal error, type wrong. PathSetting property with name:" + name + " should be an array.");
            return false;
        }

        String val;
        try
        {
            Object oValues = AnyConverter.toArray(oValue);


            final String[] aValues = (String[])oValues;

            // aNewValues contains a deep copy of aValues
            String[] aNewValues = new String[aValues.length];
            System.arraycopy(aValues, 0, aNewValues, 0, aValues.length);
            if (aValues.length > 0)
            {
                val = aValues[0];
            }
            else
            {
                val = null;
                aNewValues = new String[1]; // create a String list
            }
            System.out.println(" Property has initial value: '" + val + "'");

            // set to a new correct value
            String newVal = changeToCorrectValue(val);
            assertFalse("newVal must not equal val.", newVal.equals(val));

            System.out.println(" Try to change to a correct value '" + newVal + "'");
            aNewValues[0] = newVal;

            try
            {
                try
                {
                    xFPS.setFastPropertyValue(handle, aNewValues);
                }
                catch (com.sun.star.lang.WrappedTargetException e)
                {
                    System.out.println(" FAIL: setFastPropertyValue(handle:=" + handle + ", name:='" + name + "')" + e.getMessage());
                    bResult = false;
                }

                // Property_internal can't change we will not arrive bejond this line

                // check the change
                Object oObj = xFPS.getFastPropertyValue(handle);
                if (!checkPaths(oObj, aNewValues))
                {
                    System.out.println(" FAIL: Did not change value on property " + name + ".");
                    bResult = false;
                }

                // set back to initial setting
                System.out.println(" Try to check");
                try
                {
                    xFPS.setFastPropertyValue(handle, oValue);
                }
                catch (com.sun.star.beans.PropertyVetoException e)
                {
                    // should not occur
                    System.out.println(" FAIL: PropertyVetoException caught: " + e.getMessage());
                    bResult = false;
                }
            }
            catch (com.sun.star.beans.PropertyVetoException e)
            {
                if (!name.endsWith("_internal"))
                {
                    // should not occur
                   System.out.println(" FAIL: PropertyVetoException caught: " + e.getMessage());
                   bResult = false;
                }
                else
                {
                   System.out.println(" OK: PropertyVetoException caught: " + e.getMessage() + " it seems not allowed to change internal values.");
                }
            }

            // check if changed
            Object checkVal3 = xFPS.getFastPropertyValue(handle);
            if (!checkPaths(checkVal3, oValues))
            {
                System.out.println(" FAIL: Can't change value back to original on property " + name);
                bResult = false;
            }
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

    }

    private boolean checkStringProperty(Property property)
    {
        boolean bResult = true;
        XFastPropertySet xFPS = UnoRuntime.queryInterface(XFastPropertySet.class, aPathSettings);
        String name = property.Name;
        int handle = property.Handle;
        Object oValue;
        try
        {
            oValue = xFPS.getFastPropertyValue(handle);
        }
        catch (UnknownPropertyException ex)
        {
            return false;
        }
        catch (WrappedTargetException ex)
        {
            return false;
        }


        try
        {
            String val = "";
            val = AnyConverter.toString(oValue);
            System.out.println(" Property has initial value: '" + val + "'");

            // set to a new correct value
            String newVal = changeToCorrectValue(val);
            System.out.println(" Try to change to a correct value '" + newVal + "'");
            xFPS.setFastPropertyValue(handle, newVal);

            // check the change
            String checkVal = (String) xFPS.getFastPropertyValue(handle);
            if (!checkPaths(checkVal, newVal))
            {
                System.out.println("  FAIL: Did not change value on property " + name + ".");
                bResult = false;
            }
            newVal = changeToIncorrectValue(val);
            System.out.println(" Try to change to incorrect value '" + newVal + "'");
            try
            {
                xFPS.setFastPropertyValue(handle, newVal);
            }
            catch (com.sun.star.lang.IllegalArgumentException e)
            {
                System.out.println("  Correctly thrown Exception caught.");
            }

            // check if changed
            String checkVal2 = (String) xFPS.getFastPropertyValue(handle);
            if (!checkPaths(checkVal2, checkVal))
            {
                System.out.println("  FAIL: Value did change on property " + name + " though it should not have.");
                bResult = false;
            }
            else
            {
                System.out.println("  OK: Incorrect value was not set.");
            }
            // set back to initial setting
            System.out.println(" Set back to initial value.");
            try
            {
                xFPS.setFastPropertyValue(handle, val);
            }
            catch (com.sun.star.lang.IllegalArgumentException e)
            {
                System.out.println("  IllegalArgumentException caught: " + e.getMessage());
                bResult = false;
            }
            // check if changed
            String checkVal3 = (String) xFPS.getFastPropertyValue(handle);
            if (!checkVal3.equals(val))
            {
                if (!checkPaths(checkVal3, val))
                {
                    System.out.println("  FAIL: Can't change value back to original on property " + name);
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

            // disable QuickStarter
            try
            {
                Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
                XFastPropertySet fps = UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
                fps.setFastPropertyValue(0, false);
            }
            catch (com.sun.star.uno.Exception ex)
            {
                dbg("ERROR: Could not disable QuickStarter: " + ex.toString());
            }
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

            // disable QuickStarter
            try
            {
                Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
                XFastPropertySet fps = (XFastPropertySet) UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
                fps.setFastPropertyValue(0, false);
            }
            catch (com.sun.star.uno.Exception ex)
            {
                dbg("ERROR: Could not disable QuickStarter: " + ex.toString());
            }
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

    public void checkXFastPropertySet()
    {
        log.println("---- Testing the XFastPropertySet interface ----");

        // creating instances
        XFastPropertySet xFPS = (XFastPropertySet)
                UnoRuntime.queryInterface(XFastPropertySet.class, oObj);

        String name = null;
        // do for all properties
        for (int i = 0; i < props.length; i++) {
            try {
                Property property = props[i];
                name = property.Name;
                int handle = property.Handle;

                // get property name and initial value
                log.println("Test property with name: " + name);
                String val = (String)xFPS.getFastPropertyValue(handle);
                log.println("Property has initial value: '" + val + "'");

                // set to a new correct value
                String newVal = changeToCorrectValue(val);
                log.println("Try to change to correct value '" + newVal + "'");
                xFPS.setFastPropertyValue(handle, newVal);

                // check the change
                String checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value on property " + name + ".", checkVal.equals(newVal));

                newVal = changeToIncorrectValue(val);
                log.println("Try to change to incorrect value '" + newVal + "'");
                try {
                    xFPS.setFastPropertyValue(handle, newVal);
                }
                catch(com.sun.star.lang.IllegalArgumentException e) {
                    log.println("Correctly thrown Exception caught.");
                }

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Value did change on property " + name + " though it should not have.",
                                                                            !checkVal.equals(newVal));

                // set back to initial setting
                xFPS.setFastPropertyValue(handle, val);

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value back to original on property "
                                            + name, checkVal.equals(val));
                log.println("Test of property " + name + " finished\n");
            }
            catch(com.sun.star.uno.Exception e) {
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

        if (msf != null) {
           
            // disable QuickStarter
            try {
                Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
                XFastPropertySet fps = (XFastPropertySet) UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
                fps.setFastPropertyValue(0, false);
            } catch (com.sun.star.uno.Exception ex) {
                dbg("ERROR: Could not disable QuickStarter: " + ex.toString());
            }
           
            try {
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

    public void checkXFastPropertySet()
    {
        log.println("---- Testing the XFastPropertySet interface ----");

        // creating instances
        XFastPropertySet xFPS = (XFastPropertySet)
                UnoRuntime.queryInterface(XFastPropertySet.class, oObj);

        String name = null;
        // do for all properties
        for (int i = 0; i < props.length; i++) {
            try {
                Property property = props[i];
                name = property.Name;
                int handle = property.Handle;

                // get property name and initial value
                log.println("Test property with name: " + name);
                String val = (String)xFPS.getFastPropertyValue(handle);
                log.println("Property has initial value: '" + val + "'");

                // set to a new correct value
                String newVal = changeToCorrectValue(val);
                log.println("Try to change to correct value '" + newVal + "'");
                xFPS.setFastPropertyValue(handle, newVal);

                // check the change
                String checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value on property " + name + ".", checkVal.equals(newVal));

                newVal = changeToIncorrectValue(val);
                log.println("Try to change to incorrect value '" + newVal + "'");
                try {
                    xFPS.setFastPropertyValue(handle, newVal);
                }
                catch(com.sun.star.lang.IllegalArgumentException e) {
                    log.println("Correctly thrown Exception caught.");
                }

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Value did change on property " + name + " though it should not have.",
                                                                            !checkVal.equals(newVal));

                // set back to initial setting
                xFPS.setFastPropertyValue(handle, val);

                // check if changed
                checkVal = (String)xFPS.getFastPropertyValue(handle);
                assure("Did not change value back to original on property "
                                            + name, checkVal.equals(val));
                log.println("Test of property " + name + " finished\n");
            }
            catch(com.sun.star.uno.Exception e) {
View Full Code Here

Examples of com.sun.star.beans.XFastPropertySet

            // disable QuickStarter
            try
            {
                Object quickStarter = msf.createInstance("com.sun.star.office.Quickstart");
                XFastPropertySet fps = UnoRuntime.queryInterface(XFastPropertySet.class, quickStarter);
                fps.setFastPropertyValue(0, false);
            }
            catch (com.sun.star.uno.Exception ex)
            {
                dbg("ERROR: Could not disable QuickStarter: " + ex.toString());
            }
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.