diff options
author | Carolyn MacLeod <carolyn> | 2006-02-06 22:21:27 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2006-02-06 22:21:27 +0000 |
commit | 19fa42390348d68dcb1846f52c639ab7a6bd4391 (patch) | |
tree | 2ff8d2c91dc6d0ae114441a03e787ca9dbc099ce | |
parent | 2721d5c3ce4fdf0ee112c8af5b85ec8c08e58ec9 (diff) | |
download | eclipse.platform.swt-19fa42390348d68dcb1846f52c639ab7a6bd4391.tar.gz eclipse.platform.swt-19fa42390348d68dcb1846f52c639ab7a6bd4391.tar.xz eclipse.platform.swt-19fa42390348d68dcb1846f52c639ab7a6bd4391.zip |
Let user choose whether or not to have column header images and sub images.
Also, reorder all 'Other' choices to be more user-friendly.
2 files changed, 52 insertions, 40 deletions
diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java index 6e4fbed690..a73b4c6466 100755 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TableTab.java @@ -26,7 +26,7 @@ class TableTab extends ScrollableTab { Button checkButton, fullSelectionButton, hideSelectionButton; /* Other widgets added to the "Other" group */ - Button multipleColumns, moveableColumns, headerVisibleButton, linesVisibleButton; + Button multipleColumns, moveableColumns, headerVisibleButton, headerImagesButton, linesVisibleButton, subImagesButton; /* Controls and resources added to the "Colors and Fonts" group */ Button itemForegroundButton, itemBackgroundButton, itemFontButton; @@ -158,21 +158,24 @@ class TableTab extends ScrollableTab { super.createOtherGroup (); /* Create display controls specific to this example */ - headerVisibleButton = new Button (otherGroup, SWT.CHECK); - headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible")); + linesVisibleButton = new Button (otherGroup, SWT.CHECK); + linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible")); multipleColumns = new Button (otherGroup, SWT.CHECK); multipleColumns.setText (ControlExample.getResourceString("Multiple_Columns")); multipleColumns.setSelection(true); + headerVisibleButton = new Button (otherGroup, SWT.CHECK); + headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible")); moveableColumns = new Button (otherGroup, SWT.CHECK); moveableColumns.setText (ControlExample.getResourceString("Moveable_Columns")); - moveableColumns.setSelection(false); - linesVisibleButton = new Button (otherGroup, SWT.CHECK); - linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible")); - + headerImagesButton = new Button (otherGroup, SWT.CHECK); + headerImagesButton.setText (ControlExample.getResourceString("Header_Images")); + subImagesButton = new Button (otherGroup, SWT.CHECK); + subImagesButton.setText (ControlExample.getResourceString("Sub_Images")); + /* Add the listeners */ - headerVisibleButton.addSelectionListener (new SelectionAdapter () { + linesVisibleButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - setWidgetHeaderVisible (); + setWidgetLinesVisible (); } }); multipleColumns.addSelectionListener (new SelectionAdapter () { @@ -180,14 +183,24 @@ class TableTab extends ScrollableTab { recreateExampleWidgets (); } }); + headerVisibleButton.addSelectionListener (new SelectionAdapter () { + public void widgetSelected (SelectionEvent event) { + setWidgetHeaderVisible (); + } + }); moveableColumns.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { setColumnsMoveable (); } }); - linesVisibleButton.addSelectionListener (new SelectionAdapter () { + headerImagesButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - setWidgetLinesVisible (); + recreateExampleWidgets (); + } + }); + subImagesButton.addSelectionListener (new SelectionAdapter () { + public void widgetSelected (SelectionEvent event) { + recreateExampleWidgets (); } }); } @@ -224,19 +237,19 @@ class TableTab extends ScrollableTab { table1 = new Table (tableGroup, style); /* Fill the table with data */ - boolean multi = multipleColumns.getSelection(); - if (multi) { + boolean multiColumn = multipleColumns.getSelection(); + if (multiColumn) { for (int i = 0; i < columnTitles.length; i++) { TableColumn tableColumn = new TableColumn(table1, SWT.NONE); tableColumn.setText(columnTitles[i]); tableColumn.setToolTipText(ControlExample.getResourceString("Tooltip", new String [] {columnTitles[i]})); - tableColumn.setImage(instance.images [i % 3]); + if (headerImagesButton.getSelection()) tableColumn.setImage(instance.images [i % 3]); } table1.setSortColumn(table1.getColumn(0)); } for (int i=0; i<16; i++) { TableItem item = new TableItem (table1, SWT.NONE); - if (multi) { + if (multiColumn && subImagesButton.getSelection()) { for (int j = 0; j < columnTitles.length; j++) { item.setImage(j, instance.images [i % 3]); } diff --git a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java index 733d1b3401..50c0a3e941 100755 --- a/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java +++ b/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/TreeTab.java @@ -159,49 +159,48 @@ class TreeTab extends ScrollableTab { super.createOtherGroup (); /* Create display controls specific to this example */ + linesVisibleButton = new Button (otherGroup, SWT.CHECK); + linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible")); + multipleColumns = new Button (otherGroup, SWT.CHECK); + multipleColumns.setText (ControlExample.getResourceString("Multiple_Columns")); headerVisibleButton = new Button (otherGroup, SWT.CHECK); headerVisibleButton.setText (ControlExample.getResourceString("Header_Visible")); + moveableColumns = new Button (otherGroup, SWT.CHECK); + moveableColumns.setText (ControlExample.getResourceString("Moveable_Columns")); headerImagesButton = new Button (otherGroup, SWT.CHECK); headerImagesButton.setText (ControlExample.getResourceString("Header_Images")); subImagesButton = new Button (otherGroup, SWT.CHECK); subImagesButton.setText (ControlExample.getResourceString("Sub_Images")); - multipleColumns = new Button (otherGroup, SWT.CHECK); - multipleColumns.setText (ControlExample.getResourceString("Multiple_Columns")); - moveableColumns = new Button (otherGroup, SWT.CHECK); - moveableColumns.setText (ControlExample.getResourceString("Moveable_Columns")); - moveableColumns.setSelection(false); - linesVisibleButton = new Button (otherGroup, SWT.CHECK); - linesVisibleButton.setText (ControlExample.getResourceString("Lines_Visible")); /* Add the listeners */ - headerVisibleButton.addSelectionListener (new SelectionAdapter () { + linesVisibleButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - setWidgetHeaderVisible (); + setWidgetLinesVisible (); } }); - headerImagesButton.addSelectionListener (new SelectionAdapter () { + multipleColumns.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { recreateExampleWidgets (); } }); - subImagesButton.addSelectionListener (new SelectionAdapter () { + headerVisibleButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - recreateExampleWidgets (); + setWidgetHeaderVisible (); } }); - multipleColumns.addSelectionListener (new SelectionAdapter () { + moveableColumns.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - recreateExampleWidgets (); + setColumnsMoveable (); } }); - moveableColumns.addSelectionListener (new SelectionAdapter () { + headerImagesButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - setColumnsMoveable (); + recreateExampleWidgets (); } }); - linesVisibleButton.addSelectionListener (new SelectionAdapter () { + subImagesButton.addSelectionListener (new SelectionAdapter () { public void widgetSelected (SelectionEvent event) { - setWidgetLinesVisible (); + recreateExampleWidgets (); } }); } @@ -239,8 +238,8 @@ class TreeTab extends ScrollableTab { /* Create the text tree */ tree1 = new Tree (treeGroup, style); - boolean multi = multipleColumns.getSelection(); - if (multi) { + boolean multiColumn = multipleColumns.getSelection(); + if (multiColumn) { for (int i = 0; i < columnTitles.length; i++) { TreeColumn treeColumn = new TreeColumn(tree1, SWT.NONE); treeColumn.setText(columnTitles[i]); @@ -267,7 +266,7 @@ class TreeTab extends ScrollableTab { /* Create the image tree */ tree2 = new Tree (imageTreeGroup, style); Image image = instance.images[ControlExample.ciClosedFolder]; - if (multi) { + if (multiColumn) { for (int i = 0; i < columnTitles.length; i++) { TreeColumn treeColumn = new TreeColumn(tree2, SWT.NONE); treeColumn.setText(columnTitles[i]); @@ -278,7 +277,7 @@ class TreeTab extends ScrollableTab { for (int i = 0; i < 4; i++) { item = new TreeItem (tree2, SWT.NONE); setItemText(item, i, ControlExample.getResourceString("Node_" + (i + 1))); - if (multi && subImagesButton.getSelection()) { + if (multiColumn && subImagesButton.getSelection()) { for (int j = 0; j < columnTitles.length; j++) { item.setImage(j, image); } @@ -288,7 +287,7 @@ class TreeTab extends ScrollableTab { if (i < 3) { TreeItem subitem = new TreeItem (item, SWT.NONE); setItemText(subitem, i, ControlExample.getResourceString("Node_" + (i + 1) + "_1")); - if (multi) { + if (multiColumn) { for (int j = 0; j < columnTitles.length; j++) { subitem.setImage(j, image); } @@ -300,7 +299,7 @@ class TreeTab extends ScrollableTab { treeRoots = tree2.getItems (); item = new TreeItem (treeRoots[1], SWT.NONE); setItemText(item, 1, ControlExample.getResourceString("Node_2_2")); - if (multi) { + if (multiColumn) { for (int j = 0; j < columnTitles.length; j++) { item.setImage(j, image); } @@ -309,7 +308,7 @@ class TreeTab extends ScrollableTab { } item = new TreeItem (item, SWT.NONE); setItemText(item, 1, ControlExample.getResourceString("Node_2_2_1")); - if (multi) { + if (multiColumn) { for (int j = 0; j < columnTitles.length; j++) { item.setImage(j, image); } |