Java Code Examples for org.eclipse.swt.widgets.Composite#setVisible()
The following examples show how to use
org.eclipse.swt.widgets.Composite#setVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadioTab.java From hop with Apache License 2.0 | 8 votes |
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; }
Example 2
Source File: ParameterExpandItem.java From gama with GNU General Public License v3.0 | 6 votes |
/** * 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()); } }
Example 3
Source File: TaskSelectType.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * 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 ); }
Example 4
Source File: KbdMacroListEditor.java From e4macs with Eclipse Public License 1.0 | 6 votes |
/** * @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; }
Example 5
Source File: CommandCategoryEditor.java From e4macs with Eclipse Public License 1.0 | 6 votes |
/** * @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; }
Example 6
Source File: TabbedPropertySheetPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 7
Source File: RadioTab.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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; }
Example 8
Source File: ParameterExpandBar.java From gama with GNU General Public License v3.0 | 5 votes |
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); }
Example 9
Source File: AccordionPropertyList.java From birt with Eclipse Public License 1.0 | 5 votes |
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 ); }
Example 10
Source File: TabbedPropertySheetPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * 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); } } }
Example 11
Source File: TabbedPropertySheetPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * 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); } } }
Example 12
Source File: BaseMdiEntry.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
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()); }
Example 13
Source File: UpdateDialog.java From offspring with MIT License | 4 votes |
@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; }
Example 14
Source File: AccordionPropertyList.java From birt with Eclipse Public License 1.0 | 4 votes |
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( ); }
Example 15
Source File: AccordionPropertyList.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * 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( ) ); }
Example 16
Source File: AccordionPropertyList.java From birt with Eclipse Public License 1.0 | 4 votes |
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( ); } }