Package com.sun.star.comp.beans

Examples of com.sun.star.comp.beans.OOoBean


    {
        WriterFrame f = null;
        try
        {
            f = new WriterFrame(100, 100, 500, 300, false);
            OOoBean b = f.getBean();
            for (int i = 0; i < 100; i++)
            {
                b.releaseSystemWindow();
                b.aquireSystemWindow();
            }
            if (f.checkUnoFramePosition() == false)
                failed("Sizing error.", true);
        }
        finally
View Full Code Here


     */
    public void test6() throws Exception
    {
        for (int j = 0; j < 10; j++)
        {
            final OOoBean bean = new OOoBean();
            java.awt.Frame frame = null;
            bean.setOOoCallTimeOut(10000);
            try {
                frame = new java.awt.Frame("OpenOffice.org Demo");
                frame.add(bean, BorderLayout.CENTER);
                frame.pack();
                frame.setSize(600,300);
                frame.show();
                bean.loadFromURL("private:factory/swriter", null);
                // #1
                Thread.sleep(1000);
               
                StringBuffer buf = new StringBuffer(1000);
                for (int i = 0; i < 1; i++)
                {
//                    Thread.sleep(1000);
                    bean.releaseSystemWindow();
                    frame.remove(bean);
//                    frame.validate();
//                    Thread.sleep(1000);
                    frame.add(bean, BorderLayout.CENTER);
                    bean.aquireSystemWindow();
//                    frame.validate();
                }
               
                if (isWindows() == false)
                    Thread.sleep(5000);

                Robot roby = new Robot();
                roby.keyPress(KeyEvent.VK_H);
                roby.keyRelease(KeyEvent.VK_H);
                buf.append("h");
               
                String s = getText(bean);
                if ( ! s.equals(buf.toString()))
                {
                    failed("Focus error: After removing and adding the bean, the" +
                           "office window does not receive keyboard input.\n" +
                           "Try typing in the window, you've got 30s!!! This " +
                           "test may not work with Linux/Solaris", true);
                    Thread.sleep(30000);
                    break;
                }
                else
                {
                    Thread.sleep(2000);
                }
           
            } finally {
                bean.stopOOoConnection();
                frame.dispose();
            }
        }  
    }
View Full Code Here

     */
    public void test6a() throws Exception
    {
        for (int j = 0; j < 50; j++)
        {
            final OOoBean bean = new OOoBean();
            final java.awt.Frame frame = new Frame("Openoffice.org");
            bean.setOOoCallTimeOut(10000);

            try {
                frame.add(bean, BorderLayout.CENTER);
                frame.pack();
                frame.setSize(600,400);
                frame.show();
                bean.loadFromURL("private:factory/swriter", null);
                frame.validate();
                // #1
                Thread.sleep(1000);
                StringBuffer buf = new StringBuffer(1000);
                int i = 0;
               
                for (; i < 1; i++)
                {
                EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
                q.invokeAndWait( new Runnable() {
                        public void run() {
                            try {

                            bean.releaseSystemWindow();
                            frame.remove(bean);
                            frame.validate();

                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                           
                            }
                        });
                // #2
                Thread.sleep(1000);
                q.invokeAndWait( new Runnable() {
                        public void run() {
                            try {

                            frame.add(bean, BorderLayout.CENTER);
                            bean.aquireSystemWindow();
                            frame.validate();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            }
                        });
                   
                // #3
                Thread.sleep(1000);
                }
               
                if (isWindows() == false)
                    Thread.sleep(5000);

                Robot roby = new Robot();
                roby.mouseMove(300, 200);
                roby.waitForIdle();
                roby.mousePress(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.mouseRelease(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.keyPress(KeyEvent.VK_H);
                roby.waitForIdle();
                roby.keyRelease(KeyEvent.VK_H);
                roby.waitForIdle();

                buf.append("h");
                Thread.sleep(1000);               
                String s = getText(bean);
                System.out.println(" getText: " + s);
                if ( ! s.equals(buf.toString()))
                {
                    roby.mousePress(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.mouseRelease(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.keyPress(KeyEvent.VK_H);
                    roby.waitForIdle();
                    roby.keyRelease(KeyEvent.VK_H);
                    roby.waitForIdle();

                    String sH = "h";
                    Thread.sleep(1000);               
                    String s2 = getText(bean);

                    if ( ! sH.equals(s2))
                    {
                        failed("Focus error: After removing and adding the bean, the" +
                               "office window does not receive keyboard input.\n" +
                               "Try typing in the window, you've got 30s!!! This " +
                               "test may not work with Linux/Solaris", true);
                        System.out.println("j: " + j + "   i: " + i);
                        Thread.sleep(30000);
                        break;
                    }
                }
                else
                {
                    //                   Thread.sleep(2000);
                }
           
            } finally {
                bean.stopOOoConnection();
                frame.dispose();
            }
        }
    }
View Full Code Here

    /** Using multiple instances of OOoBean at the same time
     */
    public void test8() throws Exception
    {
        OOoBean bean1 = new OOoBean();
        BeanPanel bp1 = new BeanPanel(bean1);
        OOoBean bean2 = new OOoBean();
        BeanPanel bp2 = new BeanPanel(bean2);
        OOoBean bean3 = new OOoBean();
        BeanPanel bp3 = new BeanPanel(bean3);
        OOoBean bean4 = new OOoBean();
        BeanPanel bp4 = new BeanPanel(bean4);

        try
        {
            Frame f = new Frame("OOoBean example with several instances");
            f.setLayout(new GridBagLayout());
            GridBagConstraints c = new GridBagConstraints();
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 0.5;

            c.insets = new Insets(0, 0, 0, 10);
            c.gridx = 0;
            c.gridy = 0;
            f.add(bp1, c);
           
            c.gridx = 1;
            c.insets = new Insets(0, 0, 0, 0);
            f.add(bp2, c);

            c.gridx = 0;
            c.gridy = 1;
            c.insets = new Insets(10, 0, 0, 10);
            f.add(bp3, c);

            c.gridx = 1;
            c.gridy = 1;
            c.insets = new Insets(10, 0, 0, 0);
            f.add(bp4, c);

            f.pack();
            f.setBounds(0, 0, 1000, 600);
            f.setVisible(true);
            try {
            bean1.loadFromURL("private:factory/swriter", null);
            bean2.loadFromURL("private:factory/swriter", null);
            bean3.loadFromURL("private:factory/swriter", null);
            bean4.loadFromURL("private:factory/swriter", null);
            } catch( Exception e)
            {
                e.printStackTrace();
            }
            f.validate();

            Thread.sleep(10000);
        }
        finally
        {
            bean1.stopOOoConnection();
            bean2.stopOOoConnection();
            bean3.stopOOoConnection();
            bean4.stopOOoConnection();
        }
    }
View Full Code Here

    public static void main(String [] args)
    {
        try {
        Frame f = new Frame();
        final OOoBean b = new OOoBean();
        f.add(b, BorderLayout.CENTER);
        f.pack();
        f.setSize(500, 400);
        f.setVisible(true);
        b.loadFromURL("private:factory/swriter", null);
        f.validate();

        f.addWindowListener(new WindowAdapter() {
                public void windowClosing( java.awt.event.WindowEvent e){
                    b.stopOOoConnection();
                    System.exit(0);
                   
                }});
        }
        catch (Exception e)
View Full Code Here

    {
        WriterFrame f = null;
        try
        {
            f = new WriterFrame(100, 100, 500, 300, false);
            OOoBean b = f.getBean();
            for (int i = 0; i < 100; i++)
            {
                b.releaseSystemWindow();
                b.aquireSystemWindow();
            }
            if (f.checkUnoFramePosition() == false)
                failed("Sizing error.", true);
        }
        finally
View Full Code Here

     */
    public void test6() throws Exception
    {
        for (int j = 0; j < 10; j++)
        {
            final OOoBean bean = new OOoBean();
            java.awt.Frame frame = null;
            bean.setOOoCallTimeOut(10000);
            try {
                frame = new java.awt.Frame("OpenOffice.org Demo");
                frame.add(bean, BorderLayout.CENTER);
                frame.pack();
                frame.setSize(600,300);
                frame.show();
                bean.loadFromURL("private:factory/swriter", null);
                // #1
                Thread.sleep(1000);
               
                StringBuffer buf = new StringBuffer(1000);
                for (int i = 0; i < 1; i++)
                {
//                    Thread.sleep(1000);
                    bean.releaseSystemWindow();
                    frame.remove(bean);
//                    frame.validate();
//                    Thread.sleep(1000);
                    frame.add(bean, BorderLayout.CENTER);
                    bean.aquireSystemWindow();
//                    frame.validate();
                }
               
                if (isWindows() == false)
                    Thread.sleep(5000);

                Robot roby = new Robot();
                roby.keyPress(KeyEvent.VK_H);
                roby.keyRelease(KeyEvent.VK_H);
                buf.append("h");
               
                String s = getText(bean);
                if ( ! s.equals(buf.toString()))
                {
                    failed("Focus error: After removing and adding the bean, the" +
                           "office window does not receive keyboard input.\n" +
                           "Try typing in the window, you've got 30s!!! This " +
                           "test may not work with Linux/Solaris", true);
                    Thread.sleep(30000);
                    break;
                }
                else
                {
                    Thread.sleep(2000);
                }
           
            } finally {
                bean.stopOOoConnection();
                frame.dispose();
            }
        }  
    }
View Full Code Here

     */
    public void test6a() throws Exception
    {
        for (int j = 0; j < 50; j++)
        {
            final OOoBean bean = new OOoBean();
            final java.awt.Frame frame = new Frame("Openoffice.org");
            bean.setOOoCallTimeOut(10000);

            try {
                frame.add(bean, BorderLayout.CENTER);
                frame.pack();
                frame.setSize(600,400);
                frame.show();
                bean.loadFromURL("private:factory/swriter", null);
                frame.validate();
                // #1
                Thread.sleep(1000);
                StringBuffer buf = new StringBuffer(1000);
                int i = 0;
               
                for (; i < 1; i++)
                {
                EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
                q.invokeAndWait( new Runnable() {
                        public void run() {
                            try {

                            bean.releaseSystemWindow();
                            frame.remove(bean);
                            frame.validate();

                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                           
                            }
                        });
                // #2
                Thread.sleep(1000);
                q.invokeAndWait( new Runnable() {
                        public void run() {
                            try {

                            frame.add(bean, BorderLayout.CENTER);
                            bean.aquireSystemWindow();
                            frame.validate();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            }
                        });
                   
                // #3
                Thread.sleep(1000);
                }
               
                if (isWindows() == false)
                    Thread.sleep(5000);

                Robot roby = new Robot();
                roby.mouseMove(300, 200);
                roby.waitForIdle();
                roby.mousePress(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.mouseRelease(InputEvent.BUTTON1_MASK);
                roby.waitForIdle();
                roby.keyPress(KeyEvent.VK_H);
                roby.waitForIdle();
                roby.keyRelease(KeyEvent.VK_H);
                roby.waitForIdle();

                buf.append("h");
                Thread.sleep(1000);               
                String s = getText(bean);
                System.out.println(" getText: " + s);
                if ( ! s.equals(buf.toString()))
                {
                    roby.mousePress(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.mouseRelease(InputEvent.BUTTON1_MASK);
                    roby.waitForIdle();
                    roby.keyPress(KeyEvent.VK_H);
                    roby.waitForIdle();
                    roby.keyRelease(KeyEvent.VK_H);
                    roby.waitForIdle();

                    String sH = "h";
                    Thread.sleep(1000);               
                    String s2 = getText(bean);

                    if ( ! sH.equals(s2))
                    {
                        failed("Focus error: After removing and adding the bean, the" +
                               "office window does not receive keyboard input.\n" +
                               "Try typing in the window, you've got 30s!!! This " +
                               "test may not work with Linux/Solaris", true);
                        System.out.println("j: " + j + "   i: " + i);
                        Thread.sleep(30000);
                        break;
                    }
                }
                else
                {
                    //                   Thread.sleep(2000);
                }
           
            } finally {
                bean.stopOOoConnection();
                frame.dispose();
            }
        }
    }
View Full Code Here

    public static void main(String [] args)
    {
        try {
        Frame f = new Frame();
        final OOoBean b = new OOoBean();
        f.add(b, BorderLayout.CENTER);
        f.pack();
        f.setSize(500, 400);
        f.setVisible(true);
        b.loadFromURL("private:factory/swriter", null);
        f.validate();

        f.addWindowListener(new WindowAdapter() {
                public void windowClosing( java.awt.event.WindowEvent e){
                    b.stopOOoConnection();
                    System.exit(0);
                   
                }});
        }
        catch (Exception e)
View Full Code Here

    {
        WriterFrame f = null;
        try
        {
            f = new WriterFrame(100, 100, 500, 300, false, connection.getComponentContext());
            OOoBean b = f.getBean();
            for (int i = 0; i < 100; i++)
            {
                b.releaseSystemWindow();
                b.aquireSystemWindow();
            }
            if (f.checkUnoFramePosition() == false)
            {
                fail("Sizing error.");
            }
View Full Code Here

TOP

Related Classes of com.sun.star.comp.beans.OOoBean

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.