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 47321 Details for
Bug 152734
Nested GridLayout allows child to be larger than parent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Example of nested grid layout problem
NestedGridTitleDialog.java (text/plain), 5.02 KB, created by
Chris Merrill
on 2006-08-03 10:01:45 EDT
(
hide
)
Description:
Example of nested grid layout problem
Filename:
MIME Type:
Creator:
Chris Merrill
Created:
2006-08-03 10:01:45 EDT
Size:
5.02 KB
patch
obsolete
>package test; > >import org.eclipse.jface.dialogs.*; >import org.eclipse.jface.window.*; >import org.eclipse.swt.widgets.*; >import org.eclipse.swt.layout.*; >import org.eclipse.swt.*; >import org.eclipse.swt.events.*; > >/** > * @author Web Performance, Inc. > * <BR>Copyright 2006 > */ >public class NestedGridTitleDialog extends ApplicationWindow implements SelectionListener > { > public static void main(String[] args) > { > NestedGridTitleDialog window = new NestedGridTitleDialog(); > window.run(); > } > > public NestedGridTitleDialog() > { > super(null); > } > > public void run() > { > setBlockOnOpen(true); > open(); > Display.getCurrent().dispose(); > } > > protected Control createContents(Composite parent) > { > Button button = new Button(parent, SWT.PUSH); > button.setText("push me"); > button.addSelectionListener(this); > return button; > } > > public void widgetDefaultSelected(SelectionEvent e) { } > public void widgetSelected(SelectionEvent e) > { > MyDialog dialog = new MyDialog(getShell()); > dialog.open(); > } > } > >class MyDialog extends TitleAreaDialog > { > public MyDialog(Shell shell) > { > super(shell); > setShellStyle(getShellStyle() | SWT.RESIZE); > } > > protected Control createDialogArea(Composite parent) > { > setTitle("Title of the dialog"); > setMessage("Long message instrucing the user what to do.\nIt required two lines."); > > Composite background_area = new Composite(parent, SWT.NONE); > background_area.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); > FillLayout layout = new FillLayout(); > layout.marginHeight = 5; > layout.marginWidth = 5; > background_area.setLayout(layout); > GridData layout_data = new GridData(GridData.FILL_BOTH); > layout_data.widthHint=300; > background_area.setLayoutData(layout_data); > > _outer_panel = new OuterPanel(background_area, SWT.NONE); > > return background_area; > } > > OuterPanel _outer_panel; > public final static String LONG_STRING = "A;LKFDA;KLJWA;OEJI;WE;FOIJASDKJSALKDFJ;AEJFAWNELFIUAWBEFLIAUEHOI78OI3LU4HO349TY3Q098H3LIUFBOQ349H7TROQ398HRTQ9P328RBLQIURBLQ23IH8R2Q3NR982390RQ2V39082Q0938Y50Q987RYQ0923RYQ20N3980C2Q9R898FHAOWI8HRO8EF7AHWON9E7NY2Q093R8Q2039R8YQ2039R82QNY9R8Q29P83N9Q283A;LKFDA;KLJWA;OEJI;WE;FOIJASDKJSALKDFJ;AEJFAWNELFIUAWBEFLIAUEHOI78OI3LU4HO349TY3Q098H3LIUFBOQ349H7TROQ398HRTQ9P328RBLQIURBLQ23IH8R2Q3NR982390RQ2V39082Q0938Y50Q987RYQ0923RYQ20N3980C2Q9R898FHAOWI8HRO8EF7AHWON9E7NY2Q093R8Q2039R8YQ2039R82QNY9R8Q29P83N9Q283A;LKFDA;KLJWA;OEJI;WE;FOIJASDKJSALKDFJ;AEJFAWNELFIUAWBEFLIAUEHOI78OI3LU4HO349TY3Q098H3LIUFBOQ349H7TROQ398HRTQ9P328RBLQIURBLQ23IH8R2Q3NR982390RQ2V39082Q0938Y50Q987RYQ0923RYQ20N3980C2Q9R898FHAOWI8HRO8EF7AHWON9E7NY2Q093R8Q2039R8YQ2039R82QNY9R8Q29P83N9Q283"; > } > >class OuterPanel extends Composite implements SelectionListener > { > public OuterPanel(Composite parent, int style) > { > super(parent, style); > setLayout(new GridLayout(2, false)); > Label label1 = new Label(this, SWT.NONE); > label1.setText("label 1 in outer panel"); > Text text1 = new Text(this, SWT.BORDER); > text1.setText("some text goes in here."); > text1.setEditable(false); > text1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); > > Label label2 = new Label(this, SWT.NONE); > label2.setText("label 2 in outer panel"); > Text text2 = new Text(this, SWT.BORDER); > text2.setText("asdfasdf"); > text2.setEditable(false); > text2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); > > _inner_panel = new InnerPanel(this, SWT.NONE); > // use this line to see the bug > _inner_panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); > // use this line for it to work correctly. >// _inner_panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); > > Button button = new Button(this, SWT.PUSH); > button.setText("show sizes..."); > button.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 1, 1)); > button.addSelectionListener(this); > } > > public void widgetDefaultSelected(SelectionEvent e) { } > public void widgetSelected(SelectionEvent e) > { > System.out.println("OuterPanel width=" + getSize().x); > System.out.println("InnerPanel width=" + _inner_panel.getSize().x); > } > > InnerPanel _inner_panel; > } > >class InnerPanel extends Composite > { > public InnerPanel(Composite parent, int style) > { > super(parent, style); > setLayout(new GridLayout(2, false)); > setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_YELLOW)); > > Label label1 = new Label(this, SWT.NONE); > label1.setText("label 1 in inner panel"); > Text text1 = new Text(this, SWT.BORDER); > text1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); > text1.setText("really long string in here: " + MyDialog.LONG_STRING); > text1.setEnabled(false); > > Label label2 = new Label(this, SWT.NONE); > label2.setText("label 2 in inner panel"); > Text text2 = new Text(this, SWT.BORDER); > text2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); > } > }
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 152734
: 47321 |
47542