syntax.xml update from hudson build on Thu 28 Aug 2008 09:25:08 PM CDT
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / wizards / CommonWizardUI.java
1 package com.quantum.wizards;
2
3 import java.util.Arrays;
4
5 import org.eclipse.swt.SWT;
6 import org.eclipse.swt.layout.GridData;
7 import org.eclipse.swt.widgets.Composite;
8 import org.eclipse.swt.widgets.Table;
9 import org.eclipse.swt.widgets.TableColumn;
10
11 /**
12  * @author Elvin E. Ebora
13  */
14
15 public class CommonWizardUI {
16
17         /**
18          * constructor
19          */
20         public CommonWizardUI() {}
21         
22         /**
23          * Creates a standard Table UI for wizard implementation
24          * @param composite
25          * @return Table
26          */
27         protected Table createTablePage(Composite composite) {
28             int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
29                 Table table = new Table(composite, style);
30         table.setHeaderVisible(true);
31         table.setLinesVisible(true);
32         table.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
33         return table;
34         }
35         
36         /**
37          * Creates a standard TableColumn UI for wizard implementation
38          * @param table
39          * @param colName
40          * @param style
41          * @param pos
42          * @param width
43          */
44         protected void createTableColumn(Table table, String colName, int style, int pos, int width) {
45         TableColumn column = new TableColumn(table, style, pos);
46                 column.setText(colName);                
47                 column.setWidth(width);
48     }
49         
50         /**
51          * Creates a standard GridData UI for wizard implementation
52          * @param horzSpan
53          * @param alignment
54          * @return GridData
55          */
56         protected GridData createGridData(int horzSpan, int alignment) {
57                 GridData gridData = new GridData();
58                 gridData.horizontalSpan = horzSpan;             
59                 gridData.horizontalAlignment = alignment;
60                 gridData.verticalAlignment = alignment;
61                 return gridData;
62         }
63         
64         /**
65          * Returns a List implementation of an array of string input
66          * @param columnNames
67          * @return java.util.List
68          */
69         protected java.util.List getColumnNamesAsList(String[] columnNames) {
70                 return Arrays.asList(columnNames);      
71         }
72 }