Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Control


        final Composite composite = new Composite(parent, SWT.NULL);
        composite.setFont(parent.getFont());
        composite.setLayout(new GridLayout(1, false));
        composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

        Control nameControl = nameGroup.createControl(composite);
        nameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Control locationControl = locationGroup.createControl(composite);
        locationControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Control jreControl = createJRESelectionControl(composite);
        jreControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Control layoutControl = layoutGroup.createControl(composite);
        layoutControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Control workingSetControl = createWorkingSetControl(composite);
        workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        Control infoControl = createInfoControl(composite);
        infoControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        setControl(composite);
    }
View Full Code Here


     * The menu appears when the Action/Icon is clicked.
     */
    public void runWithEvent(Event event) {
        if (event.widget instanceof ToolItem) {
            ToolItem toolItem= (ToolItem) event.widget;
            Control control= toolItem.getParent();
            Menu menu= getMenu(control);

            Rectangle bounds= toolItem.getBounds();
            Point topLeft= new Point(bounds.x, bounds.y + bounds.height);
            menu.setLocation(control.toDisplay(topLeft));
            menu.setVisible(true);
        }
    }
View Full Code Here

  @Test
  public void testAddGroupedListenerAddsFacadeComposite() {
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );

    Control facade = composite.getChildren()[ 0 ];
    String compositeId = WidgetUtil.getId( composite );
    Object data = facade.getData( "groupedEventComposite" );
    assertEquals( compositeId, data );
  }
View Full Code Here

  public void testAddGroupedListenerAddsListenerToFacade() {
    Listener listener = mock( Listener.class );

    decorator.addGroupedListener( SWT.Selection, listener );

    Control facade = composite.getChildren()[ 0 ];
    Listener[] listeners = facade.getListeners( SWT.Selection );
    assertEquals( 1, listeners.length );
    assertSame( listener, listeners[ 0 ] );
  }
View Full Code Here

    Listener listener = mock( Listener.class );
    decorator.addGroupedListener( SWT.Selection, listener );

    decorator.removeGroupedListener( SWT.Selection, listener );

    Control facade = composite.getChildren()[ 0 ];
    Listener[] listeners = facade.getListeners( SWT.Selection );
    assertEquals( 0, listeners.length );
  }
View Full Code Here

  @Test
  public void testFacadeAdoptsBoundsFromComposite() {
    composite.setBounds( 100, 100, 200, 200 );
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );
    Control facade = composite.getChildren()[ 0 ];

    Rectangle bounds = facade.getBounds();
    assertEquals( 0, bounds.x );
    assertEquals( 0, bounds.y );
    assertEquals( 200, bounds.width );
    assertEquals( 200, bounds.height );
  }
View Full Code Here

  @Test
  public void testFacadeAdoptsBoundsFromCompositeOnResize() {
    composite.setBounds( 100, 100, 200, 200 );
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );
    Control facade = composite.getChildren()[ 0 ];

    composite.setBounds( 200, 200, 300, 300 );

    Rectangle bounds = facade.getBounds();
    assertEquals( 0, bounds.x );
    assertEquals( 0, bounds.y );
    assertEquals( 300, bounds.width );
    assertEquals( 300, bounds.height );
  }
View Full Code Here

  }

  @Test
  public void testDisposingCompositeAlsoDisposesFacade() {
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );
    Control facade = composite.getChildren()[ 0 ];

    composite.dispose();

    assertTrue( facade.isDisposed() );
  }
View Full Code Here

  @Test
  public void testExcludesFacadeFromLayoutingWithGridLayout() {
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );

    Control facade = composite.getChildren()[ 0 ];
    GridData layoutData = ( GridData )facade.getLayoutData();
    assertTrue( layoutData.exclude );
  }
View Full Code Here

  }

  @Test
  public void testFacadeHasCustomVariantForTheming() {
    decorator.addGroupedListener( SWT.Selection, mock( Listener.class ) );
    Control facade = composite.getChildren()[ 0 ];

    Object variant = facade.getData( RWT.CUSTOM_VARIANT );

    assertEquals( "groupedEventComposite", variant );
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Control

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.