Package com.sun.star.container

Examples of com.sun.star.container.ContainerEvent


        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here


            case 7: someValue = UnoRuntime.queryInterface( XIdentifierAccess.class, new DummyIdentifierAccess() ); break;
            case 8: someValue = UnoRuntime.queryInterface( XElementAccess.class, new DummyElementAccess() ); break;
            case 9: someValue = new com.sun.star.uno.Exception(); break;
            case 10: someValue = new com.sun.star.uno.RuntimeException(); break;
            case 11: someValue = new EventObject(); break;
            case 12: someValue = new ContainerEvent(); break;
            case 13: someValue = new Locale(); break;   // just use *any* value which does not conflict with the others
            default:
                failed( "internal error: wrong position for getSomeValue" );
        }
        return someValue;
View Full Code Here

        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here

            case 7: someValue = UnoRuntime.queryInterface( XIdentifierAccess.class, new DummyIdentifierAccess() ); break;
            case 8: someValue = UnoRuntime.queryInterface( XElementAccess.class, new DummyElementAccess() ); break;
            case 9: someValue = new com.sun.star.uno.Exception(); break;
            case 10: someValue = new com.sun.star.uno.RuntimeException(); break;
            case 11: someValue = new EventObject(); break;
            case 12: someValue = new ContainerEvent(); break;
            case 13: someValue = new Locale(); break;   // just use *any* value which does not conflict with the others
            default:
                fail( "internal error: wrong position for getSomeValue" );
        }
        return someValue;
View Full Code Here

        List< ContainerEvent > events = listener.assertExclusiveInsertionEvents();
        listener.reset();
        assertEquals( "wrong number of events fired by setDefaulColumns", defaultColumnsCount, events.size() );
        for ( int i=0; i<defaultColumnsCount; ++i )
        {
            final ContainerEvent event = events.get(i);
            final int index = impl_assertInteger( event.Accessor );
            assertEquals( "unexpected Accessor value in insert notification", i, index );
            assertTrue( "wrong column object notified in insert notification",
                impl_areSameInterface( event.Element, m_columnModel.getColumn(i) ) );
        }

        // insert some more default columns, ensure that all previously existing columns are removed
        final int moreDefaultColumnsCount = 5;
        m_columnModel.setDefaultColumns( moreDefaultColumnsCount );
        impl_assertColumnModelConsistency();
        assertEquals( "setting default columns is expected to remove all previously existing columns",
            moreDefaultColumnsCount, m_columnModel.getColumnCount() );

        // in this situation, both removal and insertion events have been notified
        final List< ContainerEvent > removalEvents = listener.getRemovalEvents();
        final List< ContainerEvent > insertionEvents = listener.getInsertionEvents();
        listener.reset();

        // for the removal events, check the indexes
        assertEquals( "wrong number of columns removed (or notified) upon setting default columns",
            defaultColumnsCount, removalEvents.size() );
        for ( int i=0; i<removalEvents.size(); ++i )
        {
            final ContainerEvent event = removalEvents.get(i);
            final int removedIndex = impl_assertInteger( event.Accessor );

            // The implementation is allowed to remove the columns from the beginning, in which case the
            // index of the removed column must always be 0, since e.g. the second column has index 0
            // after the first column (which previously had index 0) had been removed.
            // Alternatively, the implementation is allowed to remove columns from the end, which means
            // that the column index given in the event is steadily increasing.
            assertTrue( "unexpected column removal event column index",
                ( removedIndex == 0 ) || ( removedIndex == removalEvents.size() - 1 - i ) );
        }

        // for the insertion events, check the indexes as well
        assertEquals( "wrong number of insertion events when setting default columns over existing columns",
            moreDefaultColumnsCount, insertionEvents.size() );
        for ( int i=0; i<insertionEvents.size(); ++i )
        {
            final ContainerEvent event = insertionEvents.get(i);
            final int index = impl_assertInteger( event.Accessor );
            assertEquals( i, index );
        }

        // okay, remove all those columns
        while ( m_columnModel.getColumnCount() != 0 )
        {
            final int columnCount = m_columnModel.getColumnCount();
            final int removeColumnIndex = m_randomGenerator.nextInt( columnCount );
            m_columnModel.removeColumn( removeColumnIndex );
            events = listener.assertExclusiveRemovalEvents();
            listener.reset();
            assertEquals( "removing a single column should notify a single event", 1, events.size() );
            final ContainerEvent event = events.get(0);
            final int removalIndex = impl_assertInteger( event.Accessor );
            assertEquals( "removing an arbitrary column does not notify the proper accessor",
                removeColumnIndex, removalIndex );
        }
View Full Code Here

        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here

        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here

            case 7: someValue = UnoRuntime.queryInterface( XIdentifierAccess.class, new DummyIdentifierAccess() ); break;
            case 8: someValue = UnoRuntime.queryInterface( XElementAccess.class, new DummyElementAccess() ); break;
            case 9: someValue = new com.sun.star.uno.Exception(); break;
            case 10: someValue = new com.sun.star.uno.RuntimeException(); break;
            case 11: someValue = new EventObject(); break;
            case 12: someValue = new ContainerEvent(); break;
            case 13: someValue = new Locale(); break;   // just use *any* value which does not conflict with the others
            default:
                failed( "internal error: wrong position for getSomeValue" );
        }
        return someValue;
View Full Code Here

        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here

        if (container.containsKey(fName)) {
            container.remove(fName);
        }
        container.put(fName, args);
        if (listener != null) {
            ContainerEvent event = new ContainerEvent();
            event.Element = fName;
            for (int i=0; i<listener.length; i++){
                if (listener[i] != null) {
                    listener[i].elementInserted(event);
                }
View Full Code Here

TOP

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

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.