org.eclipse.swt.widgets.Composite#setVisible ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Composite#setVisible ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hop   文件: RadioTab.java
public Composite createContent( String radioText ) {
  Control[] existingButtons = radioGroup.getChildren();
  Button button = new Button( radioGroup, SWT.RADIO );
  button.setText( radioText );
  props.setLook( button );
  FormData fdButton = new FormData();
  fdButton.top = new FormAttachment( 0 );
  fdButton.left = existingButtons.length == 0
    ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[ existingButtons.length - 1 ], 40 );
  button.setLayoutData( fdButton );
  button.setSelection( existingButtons.length == 0 );
  Composite content = new Composite( contentArea, SWT.NONE );
  content.setVisible( existingButtons.length == 0 );
  props.setLook( content );
  content.setLayout( noMarginLayout );
  content.setLayoutData( fdMaximize );
  button.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
      for ( Control control : contentArea.getChildren() ) {
        control.setVisible( false );
      }
      content.setVisible( true );
    }
  } );
  return content;
}
 
源代码2 项目: gama   文件: ParameterExpandItem.java
/**
 * Sets the control that is shown when the item is expanded.
 *
 * @param control
 *            the new control (or null)
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
 *                <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 *                </ul>
 */
public void setControl(final Composite control) {
	if (control != null) {
		if (control.isDisposed()) {
			SWT.error(SWT.ERROR_INVALID_ARGUMENT);
		}
		if (control.getParent() != parent) {
			SWT.error(SWT.ERROR_INVALID_PARENT);
		}
	}
	this.control = control;
	if (control != null) {
		control.setVisible(expanded);
		final int headerHeight = parent.bandHeight;
		control.setBounds(x + BORDER, y + headerHeight, Math.max(0, width - 2 * BORDER),
				Math.max(0, height + BORDER));
		control.setBackground(IGamaColors.PARAMETERS_BACKGROUND.color());
	}
}
 
源代码3 项目: birt   文件: TaskSelectType.java
/**
 * This method initializes cmpSubTypes
 * 
 */
protected void createComposite( Vector<IChartSubType> vSubTypes )
{
	Label lblSubtypes = new Label( cmpRight, SWT.NO_FOCUS );
	{
		lblSubtypes.setText( Messages.getString( "TaskSelectType.Label.SelectSubtype" ) ); //$NON-NLS-1$
		GridData gd = new GridData( GridData.FILL_HORIZONTAL );
		gd.horizontalIndent = 5;
		lblSubtypes.setLayoutData( gd );
	}

	GridData gdTypes = new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_FILL );
	cmpSubTypes = new Composite( cmpRight, SWT.NONE );
	createSubtypeBtnGroups( vSubTypes );
	cmpSubTypes.setLayoutData( gdTypes );
	cmpSubTypes.setToolTipText( Messages.getString( "TaskSelectType.Label.ChartSubtypes" ) ); //$NON-NLS-1$
	cmpSubTypes.setLayout( new GridLayout( ) );
	cmpSubTypes.setVisible( true );
}
 
源代码4 项目: e4macs   文件: KbdMacroListEditor.java
/**
 * @see Dialog#createDialogArea(Composite)
 */
protected Control createDialogArea(Composite parent) {
	Composite result = new Composite(parent, SWT.NONE);
	result.setLayout(new GridLayout());
	result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	macList = new List(result, SWT.BORDER | SWT.MULTI );
	macList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	if (macroArray != null){
		for (int i=0; i< macroArray.size(); i++){
			macList.add(getLabel(macroArray.get(i)));
		}
		macList.pack(true);
		macList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
		macList.setVisible(true);
	} 
	result.setVisible(true);
	macList.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			macList = null;
		}
	});
	return result;
}
 
源代码5 项目: e4macs   文件: CommandCategoryEditor.java
/**
 * @see Dialog#createDialogArea(Composite)
 */
protected Control createDialogArea(Composite parent) {
	Composite result = new Composite(parent, SWT.NONE);
	result.setLayout(new GridLayout());
	result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	catList = new List(result, SWT.BORDER | SWT.MULTI );
	catList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	if (categoryArray != null){
		for (int i=0; i< categoryArray.size(); i++){
			catList.add(getLabel(categoryArray.get(i)));
		}
		catList.pack(true);
		catList.computeSize(SWT.DEFAULT, SWT.DEFAULT);
		catList.setVisible(true);
	} 
	result.setVisible(true);
	catList.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {
			catList = null;
		}
	});
	return result;
}
 
源代码6 项目: bonita-studio   文件: TabbedPropertySheetPage.java
/**
 * Helper method for creating property tab composites.
 *
 * @return the property tab composite.
 */
private Composite createTabComposite() {
	Composite result = widgetFactory.createComposite(
		tabbedPropertyComposite.getTabComposite(), SWT.NO_FOCUS);
	result.setVisible(false);
	result.setLayout(new FillLayout());
	FormData data = new FormData();
	if (hasTitleBar) {
		data.top = new FormAttachment(tabbedPropertyComposite.getTitle(), 0);
	} else {
		data.top = new FormAttachment(0, 0);
	}
	data.bottom = new FormAttachment(100, 0);
	data.left = new FormAttachment(0, 0);
	data.right = new FormAttachment(100, 0);
	result.setLayoutData(data);
	return result;
}
 
源代码7 项目: pentaho-kettle   文件: RadioTab.java
public Composite createContent( String radioText ) {
  Control[] existingButtons = radioGroup.getChildren();
  Button button = new Button( radioGroup, SWT.RADIO );
  button.setText( radioText );
  props.setLook( button );
  FormData fdButton = new FormData();
  fdButton.top = new FormAttachment( 0 );
  fdButton.left = existingButtons.length == 0
    ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[existingButtons.length - 1], 40 );
  button.setLayoutData( fdButton );
  button.setSelection( existingButtons.length == 0 );
  Composite content = new Composite( contentArea, SWT.NONE );
  content.setVisible( existingButtons.length == 0 );
  props.setLook( content );
  content.setLayout( noMarginLayout );
  content.setLayoutData( fdMaximize );
  button.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
      for ( Control control : contentArea.getChildren() ) {
        control.setVisible( false );
      }
      content.setVisible( true );
    }
  } );
  return content;
}
 
源代码8 项目: gama   文件: ParameterExpandBar.java
void showItem(final ParameterExpandItem item) {
	final Composite control = item.control;
	if (control != null && !control.isDisposed()) {
		item.setImage(item.expanded ? GamaIcons.create(IGamaIcons.SMALL_COLLAPSE).image()
				: GamaIcons.create(IGamaIcons.SMALL_EXPAND).image());
		control.setVisible(item.expanded);
	}
	item.redraw();
	final int index = indexOf(item);
	layoutItems(index + 1, true);
	final Event ev = new Event();
	ev.item = this;
	notifyListeners(SWT.Resize, ev);
}
 
源代码9 项目: birt   文件: AccordionPropertyList.java
private void resetSelectedItem( int index )
{
	Composite container = (Composite) elements[index].getData( );
	container.setLayoutData( null );
	container.setVisible( false );

	FormData formData = new FormData( );
	formData.height = getTabHeight( );
	formData.left = new FormAttachment( 0, 0 );
	formData.right = new FormAttachment( 100, 0 );
	formData.top = new FormAttachment( elements[index], 0 );

	if ( index + 1 < elements.length )
		elements[index + 1].setLayoutData( formData );
}
 
源代码10 项目: bonita-studio   文件: TabbedPropertySheetPage.java
/**
 * Shows the given tab.
 */
private void showTab(TabContents target) {
	if (target != null) {
		Composite tabComposite = tabToComposite.get(target);
		if (tabComposite != null) {
			/**
			 * the following method call order is important - do not
			 * change it or the widgets might be drawn incorrectly
			 */
			tabComposite.moveAbove(null);
			target.aboutToBeShown();
			tabComposite.setVisible(true);
		}
	}
}
 
源代码11 项目: bonita-studio   文件: TabbedPropertySheetPage.java
/**
 * Hides the given tab.
 */
private void hideTab(TabContents target) {
	if (target != null) {
		Composite tabComposite = tabToComposite.get(target);
		if (tabComposite != null) {
			target.aboutToBeHidden();
			tabComposite.setVisible(false);
		}
	}
}
 
源代码12 项目: BiglyBT   文件: BaseMdiEntry.java
public void show() {
	SelectedContentManager.clearCurrentlySelectedContent();

	UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
	if (uif != null) {
		//uif.refreshIconBar(); // needed?
		uif.refreshTorrentMenu();
	}



	SWTSkinObject skinObject = getSkinObjectMaster();
	if (skinObject == null) {
		return;
	}
	skinObject.setVisible(true);
	if (skinObject instanceof SWTSkinObjectContainer) {
		SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObject;
		Composite composite = container.getComposite();
		if (composite != null && !composite.isDisposed()) {
			composite.setVisible(true);
			composite.moveAbove(null);
			//composite.setFocus();
			//container.getParent().relayout();
			composite.getParent().layout();
		}
		// This causes double show because createSkinObject already calls show
		//container.triggerListeners(SWTSkinObjectListener.EVENT_SHOW);
	}

	Composite c = getComposite();
	if (c != null && !c.isDisposed()) {
		c.setData("BaseMDIEntry", this);
		c.setVisible(true);
		c.getParent().layout();
	}

	try {
		// In theory, c.setVisible() will trigger TYPE_SHOWN, but let's
		// call it anyway (it will be ignored if focus is already gained)
		triggerEvent(UISWTViewEvent.TYPE_SHOWN, null);
	} catch (Exception e) {
		Debug.out(e);
	}
	setToolbarVisibility(hasToolbarEnableers());
}
 
源代码13 项目: offspring   文件: UpdateDialog.java
@Override
protected Control createDialogArea(Composite parent) {
  Composite container = (Composite) super.createDialogArea(parent);

  GridLayout layout = new GridLayout(1, false);
  layout.horizontalSpacing = 15;
  layout.marginTop = 10;
  layout.marginLeft = 10;

  GridData gd = new GridData(GridData.FILL, GridData.FILL, false, true);
  gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);

  mainContainer = new Composite(container, SWT.NONE);
  mainContainer.setLayoutData(gd);
  mainContainer.setLayout(layout);

  messageLabel = new Label(mainContainer, SWT.WRAP);
  messageLabel.setText("...");
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false)
      .applyTo(messageLabel);

  installButton = new Button(mainContainer, SWT.PUSH);
  installButton.setText("Install Updates");
  installButton.setVisible(false);
  installButton.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      installUpdates = true;
      hideInstallButton();
    }
  });
  GridDataFactory.swtDefaults().exclude(true).applyTo(installButton);

  progressBarComposite = new Composite(mainContainer, SWT.NONE);
  progressBarComposite.setVisible(false);
  GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true)
      .exclude(true).applyTo(progressBarComposite);
  GridLayoutFactory.fillDefaults().numColumns(1)
      .applyTo(progressBarComposite);

  progressBar = new ProgressIndicator(progressBarComposite, SWT.SMOOTH);
  GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL)
      .applyTo(progressBar);

  mainContainer.layout();
  return container;
}
 
源代码14 项目: birt   文件: AccordionPropertyList.java
public void setElements( Map children )
{
	elementMap = children;
	if ( elements != ELEMENTS_EMPTY )
	{
		removeAll( );
	}
	elements = new ListElement[children.size( )];
	if ( children.size( ) == 0 )
	{
		widestLabelIndex = NONE;
	}
	else
	{
		widestLabelIndex = 0;
		for ( int i = 0; i < children.size( ); i++ )
		{
			elements[i] = new ListElement( this,
					(Tab) children.get( children.keySet( ).toArray( )[i] ),
					i );
			elements[i].setVisible( false );
			elements[i].setLayoutData( null );

			if ( i != widestLabelIndex )
			{
				String label = ( (Tab) children.get( children.keySet( )
						.toArray( )[i] ) ).getText( );
				if ( getTextDimension( label ).x > getTextDimension( ( (Tab) children.get( children.keySet( )
						.toArray( )[widestLabelIndex] ) ).getText( ) ).x )
				{
					widestLabelIndex = i;
				}
			}

			Composite container = new Composite( this, SWT.NONE );
			container.setVisible( false );
			container.setLayoutData( null );
			elements[i].setData( container );
		}
	}

	computeTopAndBottomTab( );
}
 
源代码15 项目: birt   文件: AccordionPropertyList.java
/**
 * Selects one for the elements in the list.
 */
public void select( int index, boolean reveal )
{
	if ( getSelectionIndex( ) == index )
	{
		/*
		 * this index is already selected.
		 */
		return;
	}
	if ( index >= 0 && index < elements.length )
	{
		int lastSelected = getSelectionIndex( );
		elements[index].setSelected( true );
		selectedElementIndex = index;
		if ( lastSelected != NONE )
		{
			elements[lastSelected].setSelected( false );

			resetSelectedItem( lastSelected );

			if ( getSelectionIndex( ) != elements.length - 1 )
			{
				/*
				 * redraw the next tab to fix the border by calling
				 * setSelected()
				 */
				elements[getSelectionIndex( ) + 1].setSelected( false );

				resetSelectedItem( getSelectionIndex( ) + 1 );
			}
		}

		FormData formData = new FormData( );
		formData.height = 0;
		formData.left = new FormAttachment( 0, 0 );
		formData.right = new FormAttachment( 100, 0 );
		formData.top = new FormAttachment( elements[index], 0 );

		Composite container = (Composite) elements[index].getData( );
		container.setLayoutData( formData );
		container.setVisible( true );

		formData = new FormData( );
		formData.height = getTabHeight( );
		formData.left = new FormAttachment( 0, 0 );
		formData.right = new FormAttachment( 100, 0 );
		formData.top = new FormAttachment( container, 0 );

		if ( index + 1 < elements.length )
		{
			elements[index + 1].setLayoutData( formData );
		}

		container.getParent( ).layout( );
	}

	notifyListeners( SWT.Selection, new Event( ) );
}
 
源代码16 项目: birt   文件: AccordionPropertyList.java
public void setSelection( String key, int index )
{
	if ( elementMap.containsKey( key ) )
		index = Arrays.asList( elementMap.keySet( ).toArray( ) )
				.indexOf( key );
	if ( getSelectionIndex( ) == index )
	{
		/*
		 * this index is already selected.
		 */
		return;
	}
	if ( index >= 0 && index < elements.length )
	{
		int lastSelected = getSelectionIndex( );
		elements[index].setSelected( true );
		selectedElementIndex = index;
		if ( lastSelected != NONE )
		{
			elements[lastSelected].setSelected( false );
			resetSelectedItem( lastSelected );
			if ( getSelectionIndex( ) != elements.length - 1 )
			{
				/*
				 * redraw the next tab to fix the border by calling
				 * setSelected()
				 */
				elements[getSelectionIndex( ) + 1].setSelected( false );
				resetSelectedItem( getSelectionIndex( ) + 1 );
			}
		}

		FormData formData = new FormData( );
		formData.height = 0;
		formData.left = new FormAttachment( 0, 0 );
		formData.right = new FormAttachment( 100, 0 );
		formData.top = new FormAttachment( elements[index], 0 );

		Composite container = (Composite) elements[index].getData( );
		container.setLayoutData( formData );
		container.setVisible( true );

		formData = new FormData( );
		formData.height = getTabHeight( );
		formData.left = new FormAttachment( 0, 0 );
		formData.right = new FormAttachment( 100, 0 );
		formData.top = new FormAttachment( container, 0 );

		if ( index + 1 < elements.length )
		{
			elements[index + 1].setLayoutData( formData );
		}

		container.getParent( ).layout( );
	}
}