Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 144381 Details for
Bug 286515
[CoolBar] Reparenting of item controls does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Snippet to reproduce
clipboard.txt (text/plain), 2.05 KB, created by
Ralf Sternberg
on 2009-08-13 09:30:51 EDT
(
hide
)
Description:
Snippet to reproduce
Filename:
MIME Type:
Creator:
Ralf Sternberg
Created:
2009-08-13 09:30:51 EDT
Size:
2.05 KB
patch
obsolete
>package org.eclipse.rap.snippets; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.SelectionAdapter; >import org.eclipse.swt.events.SelectionEvent; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.widgets.*; > > >public class CoolBarReparentingSnippet { > > public int createUI() { > Display display = new Display(); > Shell shell = new Shell( display ); > final CoolBar coolBar = new CoolBar( shell, SWT.HORIZONTAL | SWT.BORDER ); > Button button1 = new Button( coolBar, SWT.PUSH ); > button1.setText( "Button1" ); > Button button2 = new Button( coolBar, SWT.PUSH ); > button2.setText( "Button2" ); > createItem( coolBar, button1 ); > createItem( coolBar, button2 ); > coolBar.pack(); > Rectangle clientArea = shell.getClientArea(); > coolBar.setLocation( clientArea.x, clientArea.y ); > Button reparentButton = new Button( shell, SWT.PUSH ); > reparentButton.setText( "Reparent" ); > reparentButton.addSelectionListener( new SelectionAdapter() { > > public void widgetSelected( SelectionEvent e ) { > reparent( coolBar ); > } > > } ); > reparentButton.pack(); > reparentButton.setLocation( clientArea.x, clientArea.y + 50 ); > shell.setBounds( 20, 20, 200, 200 ); > shell.layout(); > shell.open(); > while( !shell.isDisposed() ) { > if( !display.readAndDispatch() ) { > display.sleep(); > } > } > return 0; > } > > private void reparent( CoolBar coolBar ) { > CoolItem item1 = coolBar.getItem( 0 ); > CoolItem item2 = coolBar.getItem( 1 ); > Control control1 = item1.getControl(); > Control control2 = item2.getControl(); > item1.dispose(); > item2.dispose(); > createItem( coolBar, control2 ); > createItem( coolBar, control1 ); > coolBar.pack(); > } > > private void createItem( CoolBar parent, Control control ) { > CoolItem item = new CoolItem( parent, SWT.NONE ); > Point size = control.computeSize( SWT.DEFAULT, SWT.DEFAULT ); > item.setPreferredSize( item.computeSize( size.x, size.y ) ); > item.setControl( control ); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 286515
: 144381 |
144404