View Javadoc

1   /*
2    * $Id: OWLLibraryBuilderPageThree.java,v 1.4 2005/05/31 21:57:12 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8    
9   package com.bbn.swede.ui.wizards;
10  
11  import java.util.Properties;
12  
13  import org.eclipse.jface.wizard.WizardPage;
14  import org.eclipse.swt.layout.GridData;
15  import org.eclipse.swt.layout.GridLayout;
16  import org.eclipse.swt.widgets.Composite;
17  import org.eclipse.swt.widgets.Group;
18  import org.eclipse.swt.widgets.Label;
19  import org.eclipse.swt.widgets.Text;
20  
21  /***
22   * The fourth and final page of the library creation and edit 
23   * wizards.
24   * 
25   * @author aperezlo
26   */
27  public class OWLLibraryBuilderPageThree extends WizardPage
28  {
29     
30     private Text _nameText;
31     private String _libraryName = "";
32     /***
33      * Contains library-level metadata created using the wizard.
34      */
35     protected Properties _properties;
36     
37     /***
38      * Default constructor.
39      */
40     public OWLLibraryBuilderPageThree()
41     {
42        super("page-three");
43        Properties defaults = new Properties();
44  
45        _properties = new Properties(defaults);
46        
47        setTitle("Library Metadata");
48        setMessage("Provide library-level metadata");
49     }
50     
51     /***
52      * Retrieves the library-level metadata specified on the page.
53      * @return A Properties object containing the library metadata
54      */
55     Properties getProperties()
56     {
57        return _properties;
58     }
59     
60     /***
61      * Retrieves the library name.
62      * @return The library name
63      */
64     String getLibraryName()
65     {
66        return _libraryName;
67     }
68     
69     /*
70      *  (non-Javadoc)
71      * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
72      */
73     public void createControl(Composite parent)
74     {
75        Composite me = new Composite(parent, parent.getStyle());
76        me.setFont(parent.getFont());
77        me.setLayout(new GridLayout());
78        
79        Group requiredGroup = new Group(me, me.getStyle());
80        requiredGroup.setFont(me.getFont());
81        GridLayout groupLayout = new GridLayout();
82        groupLayout.numColumns = 2;
83        groupLayout.makeColumnsEqualWidth = false;
84        requiredGroup.setLayout(groupLayout);
85        requiredGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
86        
87        Label nameLabel = new Label(requiredGroup, requiredGroup.getStyle());
88        nameLabel.setFont(requiredGroup.getFont());
89        nameLabel.setText("Enter in any additional metadata that should be associated with this library.");
90  //      
91  //      _nameText =  new Text(requiredGroup, requiredGroup.getStyle() | SWT.BORDER);
92  //      _nameText.setFont(requiredGroup.getFont());
93  //      _nameText.addModifyListener(new ModifyListener()
94  //      {
95  //         public void modifyText(ModifyEvent e)
96  //         {
97  //            _libraryName = _nameText.getText();
98  //            getContainer().updateButtons();
99  //         }
100 //      });
101       
102       Group additionalMetadataGroup = new Group(me, me.getStyle());
103       additionalMetadataGroup.setText("Additional Metadata");
104       additionalMetadataGroup.setFont(me.getFont());
105       additionalMetadataGroup.setLayout(new GridLayout());
106       additionalMetadataGroup
107          .setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
108             | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
109       PropertyEditor pe = new PropertyEditor(_properties);
110       pe.createControl(additionalMetadataGroup, additionalMetadataGroup
111          .getStyle());
112       pe.getControl().setLayoutData(
113          new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
114             | GridData.FILL_BOTH));
115       setControl(me);
116    }
117 
118    /*
119     *  (non-Javadoc)
120     * @see org.eclipse.jface.wizard.IWizardPage#isPageComplete()
121     */
122    public boolean isPageComplete()
123    {
124       boolean toReturn = true;
125 
126       return toReturn;
127    }
128    
129 }