Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java168
1 files changed, 84 insertions, 84 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
index 29f1d16a4e..d278ca273b 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/manualJUnit/MJ_Tree.java
@@ -305,23 +305,23 @@ public class MJ_Tree extends MJ_root {
shell.setSize(SWIDTH, SHEIGHT);
shell.setLayout(new FillLayout());
- final Tree tt = new Tree(shell, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
- tt.setLinesVisible(true);
- tt.setHeaderVisible(true);
-
- for (int i = 0; i < 10; i++) {
- TreeColumn tc = new TreeColumn(tt, SWT.NONE);
- tc.setWidth(100);
- System.out.println(tc.getWidth());
- tc.setWidth(tc.getWidth());
- tc.setText("Column " + i);
- }
-
- for (int i = 0; i < 100; i++) {
- new TreeItem(tt, SWT.NONE);
- }
-
- shell.open();
+ final Tree tt = new Tree(shell, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
+ tt.setLinesVisible(true);
+ tt.setHeaderVisible(true);
+
+ for (int i = 0; i < 10; i++) {
+ TreeColumn tc = new TreeColumn(tt, SWT.NONE);
+ tc.setWidth(100);
+ System.out.println(tc.getWidth());
+ tc.setWidth(tc.getWidth());
+ tc.setText("Column " + i);
+ }
+
+ for (int i = 0; i < 100; i++) {
+ new TreeItem(tt, SWT.NONE);
+ }
+
+ shell.open();
mainLoop(shell);
}
@@ -334,74 +334,74 @@ public class MJ_Tree extends MJ_root {
Shell shell = mkShell("column SetGet Width : Make shell smaller and bigger. If you don't see COL_SIZE_ERROR in console, all is well.");
shell.setSize(SWIDTH, SHEIGHT);
shell.setLayout(new FillLayout());
- StringBuffer sbBuffer = new StringBuffer();
-
- final Composite comp = new Composite(shell, SWT.NONE);
- final Tree tree = new Tree(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
- tree.setHeaderVisible(true);
- tree.setLinesVisible(true);
- final TreeColumn column1 = new TreeColumn(tree, SWT.NONE);
- column1.setText("Column 1");
- column1.setResizable(false);
- final TreeColumn column2 = new TreeColumn(tree, SWT.NONE);
- column2.setText("Column 2");
- column2.setResizable(false);
- for (int i = 0; i < 60; i++) {
- TreeItem item = new TreeItem(tree, SWT.NONE);
- sbBuffer.append("M");
- item.setText(new String[] { "item 0 " + sbBuffer.toString() + " " + i, "item 1 " + i });
- }
-
- Consumer<Integer> setColumnWidths = (width) -> {
- int c1w = (int)(width * 0.9);
- column1.setWidth(c1w);
- int c1wPost = column1.getWidth();
- if (c1w != c1wPost)
- System.err.println("COL_SIZE_ERROR 1 Expected:" + c1w + " actual:" + c1wPost);
-
- int c2w = width - column1.getWidth();
- column2.setWidth(c2w);
- int c2wPost = column2.getWidth();
- if (c2w != c2wPost)
- System.err.println("COL_SIZE_ERROR 2 Expected:" + c2w + " actual:" + column2.getWidth());
- };
-
- comp.addControlListener(new ControlAdapter()
- {
- @Override
+ StringBuffer sbBuffer = new StringBuffer();
+
+ final Composite comp = new Composite(shell, SWT.NONE);
+ final Tree tree = new Tree(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+ final TreeColumn column1 = new TreeColumn(tree, SWT.NONE);
+ column1.setText("Column 1");
+ column1.setResizable(false);
+ final TreeColumn column2 = new TreeColumn(tree, SWT.NONE);
+ column2.setText("Column 2");
+ column2.setResizable(false);
+ for (int i = 0; i < 60; i++) {
+ TreeItem item = new TreeItem(tree, SWT.NONE);
+ sbBuffer.append("M");
+ item.setText(new String[] { "item 0 " + sbBuffer.toString() + " " + i, "item 1 " + i });
+ }
+
+ Consumer<Integer> setColumnWidths = (width) -> {
+ int c1w = (int)(width * 0.9);
+ column1.setWidth(c1w);
+ int c1wPost = column1.getWidth();
+ if (c1w != c1wPost)
+ System.err.println("COL_SIZE_ERROR 1 Expected:" + c1w + " actual:" + c1wPost);
+
+ int c2w = width - column1.getWidth();
+ column2.setWidth(c2w);
+ int c2wPost = column2.getWidth();
+ if (c2w != c2wPost)
+ System.err.println("COL_SIZE_ERROR 2 Expected:" + c2w + " actual:" + column2.getWidth());
+ };
+
+ comp.addControlListener(new ControlAdapter()
+ {
+ @Override
public void controlResized(ControlEvent e)
- {
- Rectangle area = tree.getParent().getClientArea();
- Point preferredSize = tree.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int width = area.width - 2 * tree.getBorderWidth();
- if (preferredSize.y > area.height)
- {
- // Subtract the scrollbar width from the total column width
- // if a vertical scrollbar will be required
- Point vBarSize = tree.getVerticalBar().getSize();
- width -= vBarSize.x;
- }
- Point oldSize = tree.getSize();
- if (oldSize.x > area.width)
- {
- // tree is getting smaller so make the columns
- // smaller first and then resize the tree to
- // match the client area width
- setColumnWidths.accept(width);
- tree.setSize(area.width, area.height);
- }
- else
- {
- // tree is getting bigger so make the tree
- // bigger first and then make the columns wider
- // to match the client area width
- tree.setSize(area.width, area.height);
- setColumnWidths.accept(width);
- }
- }
- });
- shell.open();
- mainLoop(shell);
+ {
+ Rectangle area = tree.getParent().getClientArea();
+ Point preferredSize = tree.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int width = area.width - 2 * tree.getBorderWidth();
+ if (preferredSize.y > area.height)
+ {
+ // Subtract the scrollbar width from the total column width
+ // if a vertical scrollbar will be required
+ Point vBarSize = tree.getVerticalBar().getSize();
+ width -= vBarSize.x;
+ }
+ Point oldSize = tree.getSize();
+ if (oldSize.x > area.width)
+ {
+ // tree is getting smaller so make the columns
+ // smaller first and then resize the tree to
+ // match the client area width
+ setColumnWidths.accept(width);
+ tree.setSize(area.width, area.height);
+ }
+ else
+ {
+ // tree is getting bigger so make the tree
+ // bigger first and then make the columns wider
+ // to match the client area width
+ tree.setSize(area.width, area.height);
+ setColumnWidths.accept(width);
+ }
+ }
+ });
+ shell.open();
+ mainLoop(shell);
}
@Test

Back to the top