| 1 | /** |
| 2 | * |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.sensorframework.visualisation.views; |
| 5 | |
| 6 | import org.eclipse.jface.preference.PreferencePage; |
| 7 | import org.eclipse.swt.SWT; |
| 8 | import org.eclipse.swt.layout.GridData; |
| 9 | import org.eclipse.swt.layout.GridLayout; |
| 10 | import org.eclipse.swt.widgets.Composite; |
| 11 | import org.eclipse.swt.widgets.Control; |
| 12 | import org.eclipse.swt.widgets.Label; |
| 13 | |
| 14 | import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory; |
| 15 | |
| 16 | /** |
| 17 | * DAO Factory preference page implementation. |
| 18 | * |
| 19 | * @author Roman Andrej |
| 20 | */ |
| 21 | public class DAOFactoryPreferencePage extends PreferencePage { |
| 22 | |
| 23 | |
| 24 | IDAOFactory factory; |
| 25 | |
| 26 | /** |
| 27 | * @param factory |
| 28 | */ |
| 29 | public DAOFactoryPreferencePage(IDAOFactory factory) { |
| 30 | this.factory = factory; |
| 31 | } |
| 32 | |
| 33 | |
| 34 | /* (non-Javadoc) |
| 35 | * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) |
| 36 | */ |
| 37 | @Override |
| 38 | protected Control createContents(Composite parent) { |
| 39 | |
| 40 | final int width = 70; |
| 41 | final int heigth = 16; |
| 42 | |
| 43 | Composite container = new Composite(parent, SWT.NONE); |
| 44 | final GridLayout gridLayout = new GridLayout(); |
| 45 | gridLayout.numColumns = 2; |
| 46 | container.setLayout(gridLayout); |
| 47 | |
| 48 | // Name |
| 49 | final Label nameLabel = new Label(container, SWT.NONE); |
| 50 | final GridData gd_nameLabel = new GridData(width, heigth); |
| 51 | nameLabel.setLayoutData(gd_nameLabel); |
| 52 | nameLabel.setText("Name:"); |
| 53 | |
| 54 | final Label namevalueLabel = new Label(container, SWT.NONE); |
| 55 | final GridData gd_namevalueLabel = new GridData(SWT.FILL, SWT.CENTER, false, false); |
| 56 | gd_namevalueLabel.heightHint = heigth; |
| 57 | namevalueLabel.setLayoutData(gd_namevalueLabel); |
| 58 | namevalueLabel.setText(factory.getName()); |
| 59 | |
| 60 | // // Description |
| 61 | // final Label descriptionLabel = new Label(container, SWT.NONE); |
| 62 | // final GridData gd_descriptionLabel = new GridData(width, heigth); |
| 63 | // descriptionLabel.setLayoutData(gd_descriptionLabel); |
| 64 | // descriptionLabel.setText("Description:"); |
| 65 | // |
| 66 | // final Label descriptionvalueLabel = new Label(container, SWT.NONE); |
| 67 | // final GridData gd_descriptionvalueLabel = new GridData(SWT.FILL, SWT.CENTER, false, false); |
| 68 | // gd_descriptionLabel.heightHint = heigth; |
| 69 | // descriptionvalueLabel.setLayoutData(gd_descriptionvalueLabel); |
| 70 | // descriptionvalueLabel.setText(factory.getDescription()); |
| 71 | |
| 72 | // Persistent Info |
| 73 | final Label locationPathLabel = new Label(container, SWT.NONE); |
| 74 | final GridData gd_locationPathLabel = new GridData(width, heigth); |
| 75 | locationPathLabel.setLayoutData(gd_locationPathLabel); |
| 76 | locationPathLabel.setText("Location path:"); |
| 77 | |
| 78 | final Label pathValueLabel = new Label(container, SWT.NONE); |
| 79 | final GridData gd_pathValueLabel = new GridData(SWT.FILL, SWT.CENTER, false, false); |
| 80 | gd_pathValueLabel.heightHint = heigth; |
| 81 | pathValueLabel.setLayoutData(gd_pathValueLabel); |
| 82 | pathValueLabel.setText(factory.getPersistendInfo()); |
| 83 | |
| 84 | return container; |
| 85 | } |
| 86 | } |