Updated psf files to reflect new names and additional project files.
[phpeclipse.git] / net.sourceforge.phpeclipse.wizards / src / net / sourceforge / phpeclipse / wizards / actions / metadata / CommonWizardUI.java
1 package net.sourceforge.phpeclipse.wizards.actions.metadata;
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 vertSpan, int alignment) {
57                 GridData gridData = new GridData();
58                 gridData.horizontalSpan = horzSpan;
59                 gridData.verticalSpan = vertSpan;
60                 gridData.horizontalAlignment = alignment;
61                 gridData.verticalAlignment = alignment;
62                 return gridData;
63         }
64         
65         /**
66          * Returns a List implementation of an array of string input
67          * @param columnNames
68          * @return java.util.List
69          */
70         protected java.util.List getColumnNamesAsList(String[] columnNames) {
71                 return Arrays.asList(columnNames);      
72         }
73 }