View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: TemplatePropertiesPageComposite.java
13   * Created: 2009-09-29
14   * Author: entrop
15   * $Id$
16   */
17  
18  package pl.edu.agh.cast.importer.wizard.page;
19  
20  import org.eclipse.swt.SWT;
21  import org.eclipse.swt.layout.GridData;
22  import org.eclipse.swt.layout.GridLayout;
23  import org.eclipse.swt.widgets.Composite;
24  import org.eclipse.swt.widgets.Label;
25  import org.eclipse.swt.widgets.Text;
26  
27  import pl.edu.agh.cast.importer.wizard.util.Messages;
28  
29  /**
30   * Composite use as main control of {@link TemplatePropertiesPage}.
31   *
32   * @author AGH CAST Team
33   */
34  public class TemplatePropertiesPageComposite extends Composite {
35  
36  	private TemplatePropertiesPage mediator;
37  
38  	private Label nameLbl;
39  
40  	private Label descLbl;
41  
42  	private Text descTxt;
43  
44  	private Text nameTxt;
45  
46  	/**
47  	 * The default constructor.
48  	 *
49  	 * @param parent
50  	 *            parent composite
51  	 * @param style
52  	 *            SWT style
53  	 * @param mediator
54  	 *            template properties page
55  	 */
56  	public TemplatePropertiesPageComposite(Composite parent, int style, TemplatePropertiesPage mediator) {
57  		super(parent, style);
58  		this.mediator = mediator;
59  		initGUI();
60  	}
61  
62  	private void initGUI() {
63  		GridLayout thisLayout = new GridLayout();
64  		thisLayout.numColumns = 2;
65  		this.setLayout(thisLayout);
66  		this.setSize(669, 216);
67  
68  		nameLbl = new Label(this, SWT.NONE);
69  		nameLbl.setText(Messages.TemplatePropertiesPageComposite_TemplateName);
70  		GridData nameLblLData = new GridData();
71  		nameLblLData.verticalAlignment = GridData.BEGINNING;
72  		nameLbl.setLayoutData(nameLblLData);
73  
74  		GridData nameTxtLData = new GridData();
75  		nameTxtLData.verticalAlignment = GridData.BEGINNING;
76  		nameTxtLData.heightHint = 13;
77  		nameTxtLData.horizontalAlignment = GridData.FILL;
78  		nameTxtLData.minimumHeight = 20;
79  		nameTxt = new Text(this, SWT.BORDER);
80  		nameTxt.setLayoutData(nameTxtLData);
81  		nameTxt.setSize(194, 13);
82  
83  		descLbl = new Label(this, SWT.NONE);
84  		GridData descLblLData = new GridData();
85  		descLblLData.verticalAlignment = GridData.BEGINNING;
86  		descLbl.setLayoutData(descLblLData);
87  		descLbl.setText(Messages.TemplatePropertiesPageComposite_TemplateDesc);
88  
89  		GridData descTxtLData = new GridData();
90  		descTxtLData.grabExcessHorizontalSpace = true;
91  		descTxtLData.grabExcessVerticalSpace = true;
92  		descTxtLData.verticalAlignment = GridData.BEGINNING;
93  		descTxtLData.heightHint = 65;
94  		descTxtLData.horizontalAlignment = GridData.FILL;
95  		descTxt = new Text(this, SWT.MULTI | SWT.WRAP | SWT.BORDER);
96  		descTxt.setLayoutData(descTxtLData);
97  		descTxt.setSize(194, 65);
98  
99  	}
100 
101 	public String getTemplateName() {
102 		return nameTxt.getText();
103 	}
104 
105 	public String getTemplateDescription() {
106 		return descTxt.getText();
107 	}
108 
109 	/**
110 	 * Sets the template name value in template name text field.
111 	 *
112 	 * @param name
113 	 *            template name to set
114 	 */
115 	public void setTemplateName(String name) {
116 		nameTxt.setText(name);
117 	}
118 
119 }