KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > wizards > TeamWizardPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ui.wizards;
12
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.jface.resource.ImageDescriptor;
15 import org.eclipse.jface.wizard.WizardPage;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.layout.GridData;
18 import org.eclipse.swt.layout.GridLayout;
19 import org.eclipse.swt.widgets.Combo;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.swt.widgets.Label;
22 import org.eclipse.swt.widgets.Text;
23
24 public abstract class TeamWizardPage extends WizardPage {
25     /**
26      * CVSWizardPage constructor comment.
27      * @param pageName the name of the page
28      * @param title the title of the page
29      * @param titleImage the image for the page
30      */

31     public TeamWizardPage(String JavaDoc pageName, String JavaDoc title, ImageDescriptor titleImage) {
32         super(pageName, title, titleImage);
33     }
34     /**
35      * Creates composite control and sets the default layout data.
36      *
37      * @param parent the parent of the new composite
38      * @param numColumns the number of columns for the new composite
39      * @return the newly-created coposite
40      */

41     protected Composite createComposite(Composite parent, int numColumns) {
42         Composite composite = new Composite(parent, SWT.NULL);
43     
44         // GridLayout
45
GridLayout layout = new GridLayout();
46         layout.numColumns = numColumns;
47         composite.setLayout(layout);
48     
49         // GridData
50
GridData data = new GridData();
51         data.verticalAlignment = GridData.FILL;
52         data.horizontalAlignment = GridData.FILL;
53         composite.setLayoutData(data);
54         return composite;
55     }
56     /**
57      * Utility method that creates a label instance
58      * and sets the default layout data.
59      *
60      * @param parent the parent for the new label
61      * @param text the text for the new label
62      * @return the new label
63      */

64     protected Label createLabel(Composite parent, String JavaDoc text) {
65         return createIndentedLabel(parent, text, 0);
66     }
67     /**
68      * Utility method that creates a label instance indented by the specified
69      * number of pixels and sets the default layout data.
70      *
71      * @param parent the parent for the new label
72      * @param text the text for the new label
73      * @param indent the indent in pixels, or 0 for none
74      * @return the new label
75      */

76     protected Label createIndentedLabel(Composite parent, String JavaDoc text, int indent) {
77         Label label = new Label(parent, SWT.LEFT);
78         label.setText(text);
79         GridData data = new GridData();
80         data.horizontalSpan = 1;
81         data.horizontalAlignment = GridData.FILL;
82         data.horizontalIndent = indent;
83         label.setLayoutData(data);
84         return label;
85     }
86     /**
87      * Create a text field specific for this application
88      *
89      * @param parent the parent of the new text field
90      * @return the new text field
91      */

92     protected Text createTextField(Composite parent) {
93         Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
94         GridData data = new GridData(GridData.FILL_HORIZONTAL);
95         data.verticalAlignment = GridData.CENTER;
96         data.grabExcessVerticalSpace = false;
97         data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
98         text.setLayoutData(data);
99         return text;
100     }
101
102     /**
103      * Create a drop-down combo box specific for this application
104      *
105      * @param parent the parent of the new combo box
106      * @return the new combo box
107      */

108     protected Combo createDropDownCombo(Composite parent) {
109         Combo combo = new Combo(parent, SWT.DROP_DOWN);
110         GridData comboData = new GridData(GridData.FILL_HORIZONTAL);
111         comboData.verticalAlignment = GridData.CENTER;
112         comboData.grabExcessVerticalSpace = false;
113         comboData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
114         combo.setLayoutData(comboData);
115         return combo;
116     }
117 }
118
Popular Tags