| /******************************************************************************* |
| * Copyright (c) 2000, 2003 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.team.internal.ui.wizards; |
| |
| import org.eclipse.jface.dialogs.IDialogConstants; |
| import org.eclipse.jface.resource.ImageDescriptor; |
| import org.eclipse.jface.wizard.WizardPage; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.layout.GridLayout; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Label; |
| import org.eclipse.swt.widgets.Text; |
| |
| public abstract class TeamWizardPage extends WizardPage { |
| /** |
| * CVSWizardPage constructor comment. |
| * @param pageName the name of the page |
| * @param title the title of the page |
| * @param titleImage the image for the page |
| */ |
| public TeamWizardPage(String pageName, String title, ImageDescriptor titleImage) { |
| super(pageName, title, titleImage); |
| } |
| /** |
| * Creates composite control and sets the default layout data. |
| * |
| * @param parent the parent of the new composite |
| * @param numColumns the number of columns for the new composite |
| * @return the newly-created coposite |
| */ |
| protected Composite createComposite(Composite parent, int numColumns) { |
| Composite composite = new Composite(parent, SWT.NULL); |
| |
| // GridLayout |
| GridLayout layout = new GridLayout(); |
| layout.numColumns = numColumns; |
| composite.setLayout(layout); |
| |
| // GridData |
| GridData data = new GridData(); |
| data.verticalAlignment = GridData.FILL; |
| data.horizontalAlignment = GridData.FILL; |
| composite.setLayoutData(data); |
| return composite; |
| } |
| /** |
| * Utility method that creates a label instance |
| * and sets the default layout data. |
| * |
| * @param parent the parent for the new label |
| * @param text the text for the new label |
| * @return the new label |
| */ |
| protected Label createLabel(Composite parent, String text) { |
| return createIndentedLabel(parent, text, 0); |
| } |
| /** |
| * Utility method that creates a label instance indented by the specified |
| * number of pixels and sets the default layout data. |
| * |
| * @param parent the parent for the new label |
| * @param text the text for the new label |
| * @param indent the indent in pixels, or 0 for none |
| * @return the new label |
| */ |
| protected Label createIndentedLabel(Composite parent, String text, int indent) { |
| Label label = new Label(parent, SWT.LEFT); |
| label.setText(text); |
| GridData data = new GridData(); |
| data.horizontalSpan = 1; |
| data.horizontalAlignment = GridData.FILL; |
| data.horizontalIndent = indent; |
| label.setLayoutData(data); |
| return label; |
| } |
| /** |
| * Create a text field specific for this application |
| * |
| * @param parent the parent of the new text field |
| * @return the new text field |
| */ |
| protected Text createTextField(Composite parent) { |
| Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); |
| GridData data = new GridData(GridData.FILL_HORIZONTAL); |
| data.verticalAlignment = GridData.CENTER; |
| data.grabExcessVerticalSpace = false; |
| data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; |
| text.setLayoutData(data); |
| return text; |
| } |
| } |