Examples of XIndexContainer


Examples of com.sun.star.container.XIndexContainer

            tRes.tested("setViewData()", newView.equals(myview));
        }
    }
   
    private void setViewID(XIndexAccess xAccess, String value) {
        XIndexContainer xIndexContainer = (XIndexContainer)UnoRuntime.queryInterface(XIndexContainer.class, xAccess);
        int count = xAccess.getCount();
        try {
            if (count > 0) {
                oldProps = (PropertyValue[])xAccess.getByIndex(0);
                newProps = new PropertyValue[oldProps.length];
                for (int j=0; j<oldProps.length; j++) {
//                    log.println("Name: " + oldProps[j].Name);
//                    log.println("Value: " + oldProps[j].Value.toString());
                    newProps[j] = new PropertyValue();
                    newProps[j].Name = oldProps[j].Name;
                    newProps[j].Handle = oldProps[j].Handle;
                    newProps[j].State = oldProps[j].State;
                    if (oldProps[j].Name.equals("ViewId")) {
                        newProps[j].Value = value;
                    }

                }
                xIndexContainer.insertByIndex(0, newProps);
            }
        }
        catch(Exception e) {
            e.printStackTrace((java.io.PrintWriter)log);
        }
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

        } catch (com.sun.star.lang.IllegalArgumentException e) {
            e.printStackTrace(log);
            throw new StatusException("Couldn't get by index", e);
        }

        XIndexContainer aIContainer = (XIndexContainer)
            UnoRuntime.queryInterface(XIndexContainer.class,oInstance);

        try {
            aIContainer.insertByIndex(0, oDrawPage);
        } catch (com.sun.star.lang.WrappedTargetException e){
            e.printStackTrace(log);
            throw new StatusException("Could't insert DrawPage", e);
        } catch (com.sun.star.lang.IllegalArgumentException e){
            e.printStackTrace(log);
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

     */
    public void _ImageMap() {
        boolean result = true;

        try {
            XIndexContainer imgMap = (XIndexContainer) UnoRuntime.queryInterface(
                                             XIndexContainer.class,
                                             oObj.getPropertyValue("ImageMap"));
            int previous = imgMap.getCount();
            log.println("Count (previous) " + previous);

            Object im = tEnv.getObjRelation("IMGMAP");
            imgMap.insertByIndex(0, im);
            oObj.setPropertyValue("ImageMap", imgMap);
            imgMap = (XIndexContainer) UnoRuntime.queryInterface(
                             XIndexContainer.class,
                             oObj.getPropertyValue("ImageMap"));

            int after = imgMap.getCount();
            log.println("Count (after) " + after);
            result = previous < after;
        } catch (Exception ex) {
            result = false;
        }
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

    public ContextMenuInterceptorAction notifyContextMenuExecute(
            com.sun.star.ui.ContextMenuExecuteEvent aEvent ) throws RuntimeException {
        try {
            // Retrieve context menu container and query for service factory to
            // create sub menus, menu entries and separators
            XIndexContainer xContextMenu = aEvent.ActionTriggerContainer;
            XMultiServiceFactory xMenuElementFactory =
                    (XMultiServiceFactory)UnoRuntime.queryInterface(
                    XMultiServiceFactory.class, xContextMenu );
           
            if ( xMenuElementFactory != null ) {
               
                // create root menu entry for sub menu and sub menu
                XPropertySet xRootMenuEntry =
                        (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class,
                        xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" ));
               
                // create a line separator for our new help sub menu
                XPropertySet xSeparator =
                        (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class,
                        xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerSeparator" ) );
                Short aSeparatorType = new Short( ActionTriggerSeparatorType.LINE );
                xSeparator.setPropertyValue( "SeparatorType", (Object)aSeparatorType );
               
                // query sub menu for index container to get access
                XIndexContainer xSubMenuContainer =
                        (XIndexContainer)UnoRuntime.queryInterface(
                        XIndexContainer.class,
                        xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerContainer" ));
               
                // intialize root menu entry "Help"
                xRootMenuEntry.setPropertyValue( "Text", new String( "Help" ));
                xRootMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5410" ));
                xRootMenuEntry.setPropertyValue( "HelpURL", new String( "5410" ));
                xRootMenuEntry.setPropertyValue( "SubContainer", (Object)xSubMenuContainer );
               
                // create menu entries for the new sub menu
                // intialize help/content menu entry
                // entry "Content"
                XPropertySet xMenuEntry = (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class, xMenuElementFactory.createInstance(
                        "com.sun.star.ui.ActionTrigger" ));
                xMenuEntry.setPropertyValue( "Text", new String( "Content" ));
                xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5401" ));
                xMenuEntry.setPropertyValue( "HelpURL", new String( "5401" ));
               
                // insert menu entry to sub menu
                xSubMenuContainer.insertByIndex( 0, (Object)xMenuEntry );
               
                // intialize help/help agent
                // entry "Help Agent"
                xMenuEntry = (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class,
                        xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" ));
                xMenuEntry.setPropertyValue( "Text", new String( "Help Agent" ));
                xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5962" ));
                xMenuEntry.setPropertyValue( "HelpURL", new String( "5962" ));
               
                // insert menu entry to sub menu
                xSubMenuContainer.insertByIndex( 1, (Object)xMenuEntry );
                // intialize help/tips
                // entry "Tips"
                xMenuEntry = (XPropertySet)UnoRuntime.queryInterface(
                        XPropertySet.class,
                        xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" ));
                xMenuEntry.setPropertyValue( "Text", new String( "Tips" ));
                xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5404" ));
                xMenuEntry.setPropertyValue( "HelpURL", new String( "5404" ));
               
                // insert menu entry to sub menu
                xSubMenuContainer.insertByIndex( 2, (Object)xMenuEntry );
               
                // add separator into the given context menu
                xContextMenu.insertByIndex( 1, (Object)xSeparator );
               
                // add new sub menu into the given context menu
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

*/
public class CheckIndexedPropertyValues {
    @Test public void checkIndexedPropertyValues()
        throws com.sun.star.uno.Exception
    {
        XIndexContainer xCont = UnoRuntime.queryInterface(
            XIndexContainer.class,
            (connection.getComponentContext().getServiceManager().
             createInstanceWithContext(
                 "com.sun.star.document.IndexedPropertyValues",
                 connection.getComponentContext())));

        assertNotNull("XIndexContainer was queried but returned null.", xCont);
        PropertyValue[] prop1 = new PropertyValue[1];
        prop1[0] = new PropertyValue();
        prop1[0].Name  = "Jupp";
        prop1[0].Value = "GoodGuy";

        PropertyValue[] prop2 = new PropertyValue[1];
        prop2[0] = new PropertyValue();
        prop2[0].Name  = "Horst";
        prop2[0].Value = "BadGuy";

        Type t = xCont.getElementType();
        assertEquals("Initial container is not empty", 0, xCont.getCount());
        xCont.insertByIndex(0, prop1);
        PropertyValue[]ret = (PropertyValue[])xCont.getByIndex(0);
        assertEquals(prop1[0].Name, ret[0].Name);
        assertEquals(prop1[0].Value, ret[0].Value);
        xCont.replaceByIndex(0, prop2);
        ret = (PropertyValue[])xCont.getByIndex(0);
        assertEquals(prop2[0].Name, ret[0].Name);
        assertEquals(prop2[0].Value, ret[0].Value);
        xCont.removeByIndex(0);
        assertTrue("Could not remove PropertyValue.",
                   !xCont.hasElements() && xCont.getCount()==0);
        xCont.insertByIndex(0, prop1);
        xCont.insertByIndex(1, prop2);
        assertTrue("Did not insert PropertyValue.",
                   xCont.hasElements() && xCont.getCount()==2);

        try {
            xCont.insertByIndex(25, prop2);
            fail("IllegalArgumentException was not thrown.");
        }
        catch(com.sun.star.lang.IndexOutOfBoundsException e) {
        }

        try {
            xCont.removeByIndex(25);
            fail("IndexOutOfBoundsException was not thrown.");
        }
        catch(com.sun.star.lang.IndexOutOfBoundsException e) {
        }

        try {
            xCont.insertByIndex(2, "Example String");
            fail("IllegalArgumentException was not thrown.");
        }
        catch(com.sun.star.lang.IllegalArgumentException e) {
        }
    }
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

    /** sets the focus to the first control
    */
    protected void grabControlFocus( ) throws java.lang.Exception
    {
        // the forms container of our document
        XIndexContainer xForms = UNO.queryIndexContainer( m_document.getFormComponentTreeRoot( ) );
        // the first form
        XIndexContainer xForm = UNO.queryIndexContainer( xForms.getByIndex( 0 ) );

        // the first control model which is no FixedText (FixedText's can't have the focus)
        for ( int i = 0; i<xForm.getCount(); ++i )
        {
            XPropertySet xControlProps = UNO.queryPropertySet( xForm.getByIndex( i ) );
            if ( FormComponentType.FIXEDTEXT != ((Short)xControlProps.getPropertyValue( "ClassId" )).shortValue() )
            {
                XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
                    XControlModel.class, xControlProps );
                // set the focus to this control
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

      XNameContainer xNameContainer = xCustPresSupplier.getCustomPresentations();
      XSingleServiceFactory xFactory = (XSingleServiceFactory)
        UnoRuntime.queryInterface( XSingleServiceFactory.class, xNameContainer );

      Object      xObj;
      XIndexContainer xContainer;

      /* instanciate an IndexContainer that will take
         a list of draw pages for the first custom show */
      xObj = xFactory.createInstance();
        xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
      for ( i = 5; i < 10; i++ )
        xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
      xNameContainer.insertByName( "ShortVersion", xContainer );

      /* instanciate an IndexContainer that will take
         a list of draw page for the second custom show */
      xObj = xFactory.createInstance();
        xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
      for ( i = 1; i < 10; i++ )
        xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
      xNameContainer.insertByName( "LongVersion", xContainer );

      /* which custom show is to use
         can been set in the presentation settings */

 
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

      xConnectorPropSet.setPropertyValue( "EndShape", xShape2 );
      xConnectorPropSet.setPropertyValue( "EndGluePointIndex",
                                                new Integer( nEndIndex ) );

      XGluePointsSupplier  xGluePointsSupplier;
      XIndexContainer     xIndexContainer;
      XIdentifierContainer xIdentifierContainer;

      GluePoint2 aGluePoint = new GluePoint2();
      aGluePoint.IsRelative = false;
      aGluePoint.PositionAlignment = Alignment.CENTER;
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

  */
  XPropertySet createGridColumn( Object aGridModel, String sColumnService, String sDataField, int nWidth )
    throws com.sun.star.uno.Exception
  {
    // the container to insert columns into
    XIndexContainer xColumnContainer = UNO.queryIndexContainer( aGridModel );
    // the factory for creating column models
    XGridColumnFactory xColumnFactory = (XGridColumnFactory)UnoRuntime.queryInterface(
      XGridColumnFactory.class, aGridModel );

    // (let) create the new col
    XInterface xNewCol = (XInterface)xColumnFactory.createColumn( sColumnService );
    XPropertySet xColProps = UNO.queryPropertySet( xNewCol );

    // some props
    // the field the column is bound to
    xColProps.setPropertyValue( "DataField", sDataField );
    // the "display name" of the column
    xColProps.setPropertyValue( "Label", sDataField );
    // the name of the column within it's parent
    xColProps.setPropertyValue( "Name", sDataField );

    if ( nWidth > 0 )
      xColProps.setPropertyValue( "Width", new Integer( nWidth * 10 ) );

    // insert
    xColumnContainer.insertByIndex( xColumnContainer.getCount(), xNewCol );

    // outta here
    return xColProps;
  }
View Full Code Here

Examples of com.sun.star.container.XIndexContainer

        // --------------------------------------------------------------
    // create a sub for for the sales

    // for this, first create a sub form and bind it to the SALES table
    XIndexContainer xSalesForm = m_document.createSubForm( m_xMasterForm, "Sales" );
    XPropertySet xSalesFormProps = UNO.queryPropertySet( xSalesForm );

    xSalesFormProps.setPropertyValue( "DataSourceName", m_database.getDocumentURL() );
    xSalesFormProps.setPropertyValue( "CommandType", new Integer( CommandType.COMMAND ) );

    String sCommand = new String( "SELECT * FROM " );
    sCommand += s_tableNameSales;
    sCommand += " WHERE " + s_tableNameSales + ".SNR = :salesmen";
    xSalesFormProps.setPropertyValue( "Command", sCommand );

    // the master-details connection
    String[] aMasterFields = new String[] { "SNR" };    // the field in the master form
    String[] aDetailFields = new String[] { "salesmen" }// the name in the detail form
    xSalesFormProps.setPropertyValue( "MasterFields", aMasterFields );
    xSalesFormProps.setPropertyValue( "DetailFields", aDetailFields );

    // the create thr grid model
        XPropertySet xSalesGridModel = m_formLayer.createControlAndShape( "GridControl", 2, 80, 162, 40, xSalesForm );
    xSalesGridModel.setPropertyValue( "Name", "SalesTable" );
    XPropertySet xKeyColumn     =  createGridColumn( xSalesGridModel, "NumericField", "SALENR", 12 );
    XPropertySet xCustomerColumn =  createGridColumn( xSalesGridModel, "ListBox", "COS_NR", 40 );
    XPropertySet xSalesNameColumn =  createGridColumn( xSalesGridModel, "TextField", "NAME", 25 );
                    createGridColumn( xSalesGridModel, "DateField", "SALEDATE", 24 );
                    createGridColumn( xSalesGridModel, "CurrencyField", "PRICE", 16 );

      // please note that a better solution for the SALEDATE field would have been to use
      // a FormattedField. But we want to demonstrate some effects with DateFields here ...

    m_aSalesNameValidator = new GridFieldValidator( m_xCtx, xSalesNameColumn );
    m_aSalesNameValidator.enableColumnWatch( m_bAllowEmptySales );

    xKeyColumn.setPropertyValue( "DecimalAccuracy", new Short( (short)0 ) );

    // init the list box which is for choosing the customer a sale belongs to
    xCustomerColumn.setPropertyValue( "BoundColumn", new Short( (short)1 ) );
    xCustomerColumn.setPropertyValue( "Label", "Customer" );
    xCustomerColumn.setPropertyValue( "ListSourceType", ListSourceType.SQL );

    String sListSource = "SELECT LASTNAME, COS_NR FROM ";
    sListSource += s_tableNameCustomers;
    String[] aListSource = new String[] { sListSource };
    xCustomerColumn.setPropertyValue( "ListSource", aListSource );

    // We want to demonstrate how to reset fields to NULL, we do this with the SALEDATE field
    // above. For this, we add as reset listener to the form
    XReset xFormReset = UNO.queryReset( xSalesForm );
    xFormReset.addResetListener( this );


        // --------------------------------------------------------------
    // the option for filtering the sales form
    XIndexContainer xSalesFilterForm = m_document.createSiblingForm( xSalesForm, "SalesFilter" );
    XPropertySet xSFFProps = UNO.queryPropertySet( xSalesFilterForm );
        XPropertySet xLabel = m_formLayer.createControlAndShape( "FixedText", 2, 125, 35, 6, xSalesFilterForm );
    xLabel.setPropertyValue( "Label", "show only sales since" );
    xLabel.setPropertyValue( "Name", "FilterLabel" );

        XPropertySet xFilterSelection = m_formLayer.createControlAndShape( "ListBox", 40, 125, 59, 6, xSalesFilterForm );
    xFilterSelection.setPropertyValue( "Name", "FilterList" );
    xFilterSelection.setPropertyValue( "LabelControl", xLabel );
        XPropertySet xManualFilter = m_formLayer.createControlAndShape( "DateField", 104, 125, 30, 6, xSalesFilterForm );
    xManualFilter.setPropertyValue( "Name", "ManualFilter" );
        XPropertySet xApplyFilter = m_formLayer.createControlAndShape( "CommandButton", 139, 125, 25, 6, xSalesFilterForm );
    xApplyFilter.setPropertyValue( "Name", "ApplyFilter" );
    xApplyFilter.setPropertyValue( "DefaultButton", new Boolean( true ) );
    m_aSalesFilter = new SalesFilter( m_document, xSalesFormProps, xFilterSelection,
      xManualFilter, xApplyFilter );


        // --------------------------------------------------------------
    // the options section
    // for this, we need a form which is a sibling of our master form (don't want to interfere
    // the controls which represent options only with the controls which are used for data access)

    XIndexContainer xOptionsForm = m_document.createSiblingForm( m_xMasterForm, "Options" );

        xLabel = m_formLayer.createControlAndShape( "GroupBox", 98, 0, 66, 62, xOptionsForm );
    xLabel.setPropertyValue( "Name", "Options" );
    xLabel.setPropertyValue( "Label", "Options" );

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.