Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Composite


       
    // encoder section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Remote Actions");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
        prefSize.widthHint = 50;
       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);   
       
        // create Table for remote actions
        _tblRemoteActions = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
        _tblRemoteActions.setHeaderVisible(true);         
        GridData tblLayoutData = new GridData(GridData.FILL_BOTH);
View Full Code Here


   
    // general section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("General");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 2;
        GridData fillH = new GridData(GridData.FILL_HORIZONTAL);
       
        sectionLayout.numColumns = 3;
        sectionClient.setLayout(sectionLayout);
       
       
        _lblDirectory = factory.createLabel(sectionClient, "Directory", "designDirectory");       
        _lblDirectory.setLayoutData(fillHSpan);
       
//      _lblDesignKey = factory.createLabel(sectionClient, "Design key:", "designKey");
//      _lblDesignKey.setLayoutData(fillHSpan);
     
      _txtInitScript= factory.createText(sectionClient, "Initialisation script:", "initScript");
      _txtInitScript.setLayoutData(fillH);
      registerField("initScript", _txtInitScript);
     
      _btnBrowseInitScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseInitScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseInitScript();
      }
    });
     
      _txtConnectionScript= factory.createText(sectionClient, "Connection script:", "connectionScript");
      _txtConnectionScript.setLayoutData(fillH);
      registerField("connectionScript", _txtConnectionScript);
     
      _btnBrowseConnectionScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseConnectionScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseConnectionScript();
      }
    });
     
      _txtDisconnectionScript= factory.createText(sectionClient, "Disconnection script:", "disconnectionScript");
      _txtDisconnectionScript.setLayoutData(fillH);
      registerField("disconnectionScript", _txtDisconnectionScript);
           
      _btnBrowseDisconnectionScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseDisconnectionScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseDisconnectionScript();
      }
    });     
      _txtDisconnectionScript.addPaintListener(new PaintListener() {

      public void paintControl(PaintEvent e) {
        _btnBrowseDisconnectionScript.setEnabled(_txtDisconnectionScript.isEnabled());       
      }
       
      });

     
      _comboDefaultAccessLevel = factory.createCombo(sectionClient, "Default access level:", "defaultAccessLevel");
      factory.addFiller(sectionClient);
      registerField("defaultAccessLevel", _comboDefaultAccessLevel);
         
      _comboAnonymousAccessLevel = factory.createCombo(sectionClient, "Anonymous access level:", "anonymousAccessLevel");
      factory.addFiller(sectionClient);
      registerField("anonymousAccessLevel", _comboAnonymousAccessLevel);
     
      _comboVersionCompliance = factory.createCombo(sectionClient, "Developed for WGA version:", "versionCompliance");
      factory.addFiller(sectionClient)
      registerField("versionCompliance", _comboVersionCompliance);     
     
      // libraries section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
    section.setText("Libraries");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 3;
        sectionClient.setLayout(sectionLayout);
     
        _chkStaticClasspath = factory.createCheckBox(sectionClient, "Prevent reloading of java libraries", "Enabled", "staticClasspath");
      registerField("staticClasspath", _chkStaticClasspath);
       
        GridData fillBoth = new GridData(GridData.FILL_BOTH);
        fillBoth.minimumHeight = 100;
        fillBoth.verticalSpan = 2;
        fillBoth.horizontalSpan = 2;
        _lstLibraries = new List(sectionClient, SWT.BORDER|SWT.MULTI);
        _lstLibraries.setLayoutData(fillBoth);
        _lstLibraries.setItems(_model.getLibraryNames());
       
        _btnAddLibrary = toolkit.createButton(sectionClient, "add...", SWT.PUSH);
        _btnAddLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddLibrary();
      }
    });
       
        GridData btnLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false);
        _btnAddLibrary.setLayoutData(btnLayout);
       
        //factory.addFiller(sectionClient);
       
        _btnRemoveLibrary = toolkit.createButton(sectionClient, "remove...", SWT.PUSH);
       
        _btnRemoveLibrary.setLayoutData(btnLayout);       
        _btnRemoveLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemoveLibrary();
      }
    });
       

       
       
        // publishing section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Publishing");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);
       
      _txtHomePage= factory.createText(sectionClient, "Home Page:", "homePage");
      _txtHomePage.setLayoutData(fillH);
      registerField("homePage", _txtHomePage);
     
      _loginPage= factory.createText(sectionClient, "Login Page:", "loginPage");
      _loginPage.setLayoutData(fillH)
      registerField("loginPage", _loginPage);
     
//      _defaultMediaKey= factory.createText(sectionClient, "Default Media Key:", "defaultMediaKey");
//      _defaultMediaKey.setLayoutData(fillH);
//      registerField("defaultMediaKey", _defaultMediaKey);
     
      _comboDefaultTMLOutputEncoding = factory.createCombo(sectionClient, "Default WebTML Output Encoding:", "defaultItemEncoding");
      registerField("defaultItemEncoding", _comboDefaultTMLOutputEncoding);
     
      _comboDesignEncoding = factory.createCombo(sectionClient, "Design encoding:", "designEncoding");
      registerField("designEncoding", _comboDesignEncoding);
     
      HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());     
      factory.addFiller(sectionClient);
      ImageHyperlink linkEnforceEncoding = new ImageHyperlink(sectionClient, SWT.None);
      linkEnforceEncoding.setText("Enforce design encoding");
      final Shell fShell = getSite().getShell();
      linkEnforceEncoding.addHyperlinkListener(new HyperlinkAdapter() {
View Full Code Here

  @Override
  protected Control createDialogArea(Composite parent) {

    // prefsString.split(" ")[1].equals("0");

    Composite composite = new Composite(parent, SWT.None);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);

    GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
    data.horizontalSpan = 2;

    GridData txtStyle = new GridData(GridData.FILL_HORIZONTAL);
View Full Code Here

       
    // encoder section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Job Definitions");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
        prefSize.widthHint = 50;
       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);   
       
        // create Table for remote actions
        _tblJobDefinitions = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
        _tblJobDefinitions.setHeaderVisible(true);         
        GridData tblLayoutData = new GridData(GridData.FILL_BOTH);
View Full Code Here

       
    }
   
    @SuppressWarnings("unchecked")
    private void switchToSubform(String subformKey, Object bean) {
        Composite composite = _subforms.get(subformKey);
        for (Composite control : _subforms.values()) {
            if (control == composite) {               
                control.setVisible(true);
                GenesisBoundObject model = _subformModels.get(subformKey);
                model.setBean(bean);
View Full Code Here

  public WGADesignMetadataPropertyPage() {
  }

  @Override
  protected Control createContents(Composite parent) {   
    Composite composite = new Composite(parent, SWT.FILL);
    composite.setLayout(new GridLayout(2, false));

    if (getDesignRoot() == null) {
      Label label = new Label(composite, SWT.None);
      label.setText("Note:");
      label = new Label(composite, SWT.None);
View Full Code Here

  private void init(ScrolledForm form, FormToolkit toolkit, IEditorPart editor) { 
    // exporting section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Exporting");   
       
    final Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();                                     
        sectionLayout.numColumns = 1;
        sectionClient.setLayout(sectionLayout);
       
        final HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());
       
        final IEditorPart fEditor = editor;
       
    IMenuService ms = (IMenuService)editor.getSite().getService(IMenuService.class);
    ContributionManager manager = new ContributionManager() {
View Full Code Here

        }
        else if (getElement() instanceof IProject) {
            _selectedProject = (IProject) getElement();
        }

        Composite container = new Composite(parent, SWT.NONE);
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        layout.horizontalSpacing = 0;
        layout.verticalSpacing = 0;
        container.setLayout(layout);

        _specificHeaderCheckbox = new Button(container, SWT.CHECK);
        GridData specificHeaderCheckboxLayout = new GridData();
        specificHeaderCheckboxLayout.horizontalSpan = 3;
        _specificHeaderCheckbox.setLayoutData(specificHeaderCheckboxLayout);
        _specificHeaderCheckbox.setText("Use specific Header for this project");
        _specificHeaderCheckbox.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                if (_specificHeaderCheckbox.getSelection()) {
                    readAllForProject(_selectedProject);
                    for (String current : _headerFileMap.keySet()) {
                        _headerTabTextMap.get(current).setText(_headerFileMap.get(current).getSpecificHeader(_selectedProject));
                        _headerTabTextMap.get(current).setEnabled(true);
                        _importButton.setEnabled(true);
                        _exportButton.setEnabled(true);
                    }
                }
                else {
                    for (String current : _headerFileMap.keySet()) {
                        _headerTabTextMap.get(current).setText(_headerFileMap.get(current).getDefaultHeader());
                        _headerTabTextMap.get(current).setEnabled(false);
                        _importButton.setEnabled(false);
                        _exportButton.setEnabled(false);
                    }
                }
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        _specificHeaderCheckbox.setSelection(Plugin.getDefault().getProjectPreferences(_selectedProject).getBoolean("useSpecificHeader", false));

       
        _headerTabFolder = new TabFolder(container, SWT.NONE);
       

       
        Composite buttonContainer = new Composite(container, SWT.NONE);
        GridLayout buttonLayout = new GridLayout();
        buttonLayout.numColumns = 1;
        buttonLayout.marginHeight = 0;
        buttonLayout.marginWidth = 0;            
  
        buttonContainer.setLayout(buttonLayout);
        buttonContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
       
       
       
       
       
       
        _importButton = new Button(buttonContainer, SWT.NONE);
        _importButton.setText("Import");
        _importButton.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                handleImport();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });

        _exportButton = new Button(buttonContainer, SWT.NONE);
        _exportButton.setText("Export");
        _exportButton.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                handleExport();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });

       

        GridData tabFolderLayout = new GridData(GridData.FILL_BOTH);
        tabFolderLayout.horizontalSpan = 1;
        _headerTabFolder.setLayoutData(tabFolderLayout);
        for (String current : _headerFileMap.keySet()) {
            String titel = _headerFileMap.get(current).getTitle();
            TabItem tabItem = new TabItem(_headerTabFolder, SWT.FILL);
            Composite tabItemContainer = new Composite(_headerTabFolder, SWT.NONE);
            layout = new GridLayout();
            layout.numColumns = 1;
            layout.marginWidth = 0;
            layout.marginHeight = 0;
            layout.horizontalSpacing = 0;
            layout.verticalSpacing = 0;
            tabItemContainer.setLayout(layout);
            tabItem.setText(titel);

            Text headerTabText = new Text(tabItemContainer, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
            headerTabText.setData(current);
View Full Code Here

        _detailSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
        _detailSection.setText("Details");
        _detailSection.setLayoutData(new GridData(GridData.FILL_BOTH));     

        // content type subform
        Composite subform = toolkit.createComposite(_detailSection);          
        GridLayout subformLayout = new GridLayout();       
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);              
        Text txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");

        Label lblActions = new Label(subform, SWT.NONE);
        lblActions.setText("Actions:");
        HyperlinkGroup actionGroup = new HyperlinkGroup(Display.getCurrent());
        Hyperlink defineMetas = new Hyperlink(subform, SWT.NONE);
        defineMetas.setText("add properties...");
        defineMetas.addHyperlinkListener(new IHyperlinkListener() {           
            public void linkExited(HyperlinkEvent e) {
            }
           
            public void linkEntered(HyperlinkEvent e) {              
            }
           
            public void linkActivated(HyperlinkEvent e) {
                handleAddMetaDataDefinition();               
            }
        });
        actionGroup.add(defineMetas);
       
        Label lbl = new Label(subform, SWT.NONE);
        Hyperlink defineItems = new Hyperlink(subform, SWT.NONE);
        defineItems.setText("add item definition...");
        defineItems.addHyperlinkListener(new IHyperlinkListener() {
           
            public void linkExited(HyperlinkEvent e) {
            }
           
            public void linkEntered(HyperlinkEvent e) {
            }
           
            public void linkActivated(HyperlinkEvent e) {
                handleAddItemDefinition();               
            }
        });
        actionGroup.add(defineItems);
       
        WGContentTypeDefinitionModel contentTypeDefinitionModel = new WGContentTypeDefinitionModel();
        contentTypeDefinitionModel.addListener(new BeanChangedListener<WGContentTypeDefinition>() {
            public void changed(WGContentTypeDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });               
        _subforms.put(SUBFORM_CONTENT_TYPE_DEFINITION, subform);
        _subformModels.put(SUBFORM_CONTENT_TYPE_DEFINITION, contentTypeDefinitionModel);
       
        // area subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);             
        txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");

        WGAreaDefinitionModel areaDefintionModel = new WGAreaDefinitionModel();
        areaDefintionModel.addListener(new BeanChangedListener<WGAreaDefinition>() {
            public void changed(WGAreaDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });
        _subforms.put(SUBFORM_AREA_DEFINITION, subform);
        _subformModels.put(SUBFORM_AREA_DEFINITION, areaDefintionModel);
       
        // language subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);             
        txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");
       
        WGLanguageDefinitionModel languageDefinitionModel = new WGLanguageDefinitionModel();
        languageDefinitionModel.addListener(new BeanChangedListener<WGLanguageDefinition>() {
            public void changed(WGLanguageDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });
        _subforms.put(SUBFORM_LANGUAGE_DEFINITION, subform);
        _subformModels.put(SUBFORM_LANGUAGE_DEFINITION, languageDefinitionModel);

        // item subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
       
        Group parentGroup = createParentInformationGroup(subform);
        GridData parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Itemname:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        Combo itemTypeCombo = factory.createCombo(subform, "Type:", "type");       
        _chkItemList = factory.createCheckBox(subform, "List:", "Enabled", "list");

        _lblInitialValues = new Label(subform, SWT.NONE);
        _lblInitialValues.setText("Initial values:");
        _lblInitialValues.setLayoutData(new GridData(SWT.NONE, SWT.BEGINNING, false, false));
       
        _initialValuesSection = toolkit.createSection(subform, Section.EXPANDED | Section.NO_TITLE);
       
        GridData initialValuesSectionLayoutData = new GridData(GridData.FILL_BOTH);
        _initialValuesSection.setLayoutData(initialValuesSectionLayoutData);

        // item subform - text values
        _initialTextValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialTextValuesSectionClient.setLayout(new FillLayout());
        _tblItemTextValues = new EditableTableControl<PrimitiveTypeBean<String>>(_initialTextValuesSectionClient, SWT.NONE);
        _itemTextValuesModel = new PrimitiveTypeBeanListTableModel<String>(true);
        _itemTextValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemTextValues.init(new String[] {"#", "Value"}, _itemTextValuesModel);
        CellEditor[] cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new TextCellEditor(_tblItemTextValues.getTable());
        _tblItemTextValues.getTableViewer().setCellEditors(cellEditors);
       
        _tblItemTextValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemTextValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemTextValues, "");
            }
        });

        _tblItemTextValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemTextValues);
            }
        });
       
       
        // item subform - boolean values
        _initialBooleanValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialBooleanValuesSectionClient.setLayout(new FillLayout());
        _tblItemBooleanValues = new EditableTableControl<PrimitiveTypeBean<Boolean>>(_initialBooleanValuesSectionClient, SWT.NONE);
        _itemBooleanValuesModel = new PrimitiveTypeBeanListTableModel<Boolean>(true);
        _itemBooleanValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemBooleanValues.init(new String[] {"#", "Value"}, _itemBooleanValuesModel);
        cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new CheckboxCellEditor(_tblItemBooleanValues.getTable());
        _tblItemBooleanValues.getTableViewer().setCellEditors(cellEditors);       
       
        _tblItemBooleanValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemBooleanValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemBooleanValues, false);               
            }
        });

        _tblItemBooleanValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemBooleanValues);
            }
        });
       
       
        // item subform - number values
        _initialNumberValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialNumberValuesSectionClient.setLayout(new FillLayout());
        _tblItemNumberValues = new EditableTableControl<PrimitiveTypeBean<Number>>(_initialNumberValuesSectionClient, SWT.NONE);        
        _itemNumberValuesModel = new PrimitiveTypeBeanListTableModel<Number>(true);
        _itemNumberValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemNumberValues.init(new String[] {"#", "Value"}, _itemNumberValuesModel);
        cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new DoubleValueCellEditor(_tblItemNumberValues.getTable());

        _tblItemNumberValues.getTableViewer().setCellEditors(cellEditors);
       
        _tblItemNumberValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemNumberValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemNumberValues, 0);               
            }
        });

        _tblItemNumberValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemNumberValues);
            }
        });
       
       
       
        itemTypeCombo.addModifyListener(new ModifyListener() {
           
            public void modifyText(ModifyEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                WGContentItemDefinition.Type type = model.getType().getKey();
                if (type.equals(WGContentItemDefinition.Type.TEXT)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemTextValuesModel.bind(model.getInitialValues());
                    _initialTextValuesSectionClient.setVisible(true);
                    _initialBooleanValuesSectionClient.setVisible(false);
                    _initialNumberValuesSectionClient.setVisible(false);
                    _initialValuesSection.setClient(_initialTextValuesSectionClient);
                    _initialValuesSection.layout();
                } else if (type.equals(WGContentItemDefinition.Type.BOOLEAN)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemBooleanValuesModel.bind(model.getInitialValues());
                    _initialBooleanValuesSectionClient.setVisible(true);
                    _initialTextValuesSectionClient.setVisible(false);
                    _initialNumberValuesSectionClient.setVisible(false);
                    _initialValuesSection.setClient(_initialBooleanValuesSectionClient);
                    _initialValuesSection.layout();
                } else if (type.equals(WGContentItemDefinition.Type.NUMBER)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemNumberValuesModel.bind(model.getInitialValues());
                    _initialNumberValuesSectionClient.setVisible(true);
                    _initialBooleanValuesSectionClient.setVisible(false);
                    _initialTextValuesSectionClient.setVisible(false);     
                    _initialValuesSection.setClient(_initialNumberValuesSectionClient);
                    _initialValuesSection.layout();
                } else {
                    _initialValuesSection.setVisible(false);
                    _lblInitialValues.setVisible(false);
                }
               
            }
        });
       
        WGContentItemDefinitionModel contentItemDefinitionModel = new WGContentItemDefinitionModel(_model);       
        contentItemDefinitionModel.addListener(new BeanChangedListener<WGContentItemDefinition>() {
            public void changed(WGContentItemDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });

       
        _subforms.put(SUBFORM_CONTENT_ITEM_DEFINITION, subform);
        _subformModels.put(SUBFORM_CONTENT_ITEM_DEFINITION, contentItemDefinitionModel);

        // content type meta data subforms
        // subform for description
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);       

        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        Text txtValue = factory.createTextArea(subform, "Description", "description");       
        GridData txtValueLayoutData = new GridData(GridData.FILL_BOTH);
        txtValueLayoutData.minimumHeight = 200;
        txtValue.setLayoutData(txtValueLayoutData)
       
        WGDescriptionMetaFieldDefinitionModel descriptionMetaFieldDefinitionModel = new WGDescriptionMetaFieldDefinitionModel(_model);
        descriptionMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });
       
        _subforms.put(SUBFORM_META_DESCRIPTION, subform);
        _subformModels.put(SUBFORM_META_DESCRIPTION, descriptionMetaFieldDefinitionModel);
       
        // subform for event scripts
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);       

        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        txtValue = factory.createTextArea(subform, "Scriptcode:", "code");       
        txtValueLayoutData = new GridData(GridData.FILL_BOTH);
        txtValueLayoutData.minimumHeight = 200;
        txtValue.setLayoutData(txtValueLayoutData)
       
        WGEventScriptMetaFieldDefinitionModel eventScriptMetaFieldDefinitionModel = new WGEventScriptMetaFieldDefinitionModel(_model);
        eventScriptMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_EVENTSCRIPT, subform);
        _subformModels.put(SUBFORM_META_EVENTSCRIPT, eventScriptMetaFieldDefinitionModel);
       
        // subform for layouts
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 3;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 3;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        factory.addFiller(subform);
        txtValue = factory.createText(subform, "Module:", "layout");              
        txtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        final Text fTxtLayout = txtValue;
        Button btnBrowseLayout = new Button(subform, SWT.PUSH);
        btnBrowseLayout.setText("browse ...");
        btnBrowseLayout.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                handleBrowserLayout(fTxtLayout)
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {                            
            }
        });
        WGLayoutMetaFieldDefinitionModel layoutMetaFieldDefinitionModel = new WGLayoutMetaFieldDefinitionModel(_model);
        layoutMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_LAYOUT, subform);
        _subformModels.put(SUBFORM_META_LAYOUT, layoutMetaFieldDefinitionModel);
       
        // subform for allowed positions
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        Combo comboPositioning = factory.createCombo(subform, "Positions:", "positioning");              
        comboPositioning.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        factory.addFiller(subform);
        _tblAllowedPositions = new EditableTableControl<PrimitiveTypeBean<String>>(subform, SWT.NONE);
        _allowedPositionsModel = new PrimitiveTypeBeanListTableModel<String>();
        _allowedPositionsModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblAllowedPositions.init(new String[] {"Name"}, _allowedPositionsModel);
        GridData tblLayoutData = new GridData(GridData.FILL_BOTH);
        tblLayoutData.minimumHeight = 200;
        _tblAllowedPositions.setLayoutData(tblLayoutData);
        cellEditors = new CellEditor[1];
        cellEditors[0] = new TextCellEditor(_tblAllowedPositions.getTable());
        _tblAllowedPositions.getTableViewer().setCellEditors(cellEditors);
       
        comboPositioning.addModifyListener(new ModifyListener() {
           
            public void modifyText(ModifyEvent e) {
                WGPositioningMetaFieldDefinitionModel model = (WGPositioningMetaFieldDefinitionModel)_subformModels.get(SUBFORM_META_POSITIONING);
                if (model.getPositioning().getKey().equals(WGContentType.POSITIONING_FIXEDPARENTS) || model.getPositioning().getKey().equals(WGContentType.POSITIONING_FIXEDPARENTTYPES)) {
                    _tblAllowedPositions.setVisible(true);
                    WGContentTypeDefinition cTypeDefinition = _model.findContentTypeDefinition(model.getBean());                   
                    ((PrimitiveTypeBeanListTableModel<String>)_tblAllowedPositions.getModel()).bind(model.getAllowedPositions(cTypeDefinition));
                } else {
                    _tblAllowedPositions.setVisible(false);
                }
            }
        });

        _tblAllowedPositions.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleAdd(_tblAllowedPositions, "<value>");
            }
        });

        _tblAllowedPositions.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblAllowedPositions);
            }
        });
       
           
        WGPositioningMetaFieldDefinitionModel positioningMetaFieldDefinitionModel = new WGPositioningMetaFieldDefinitionModel(_model);
        positioningMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_POSITIONING, subform);
        _subformModels.put(SUBFORM_META_POSITIONING, positioningMetaFieldDefinitionModel);
       
       
        // subform for editors
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
View Full Code Here

  }

  @Override
  protected Control createContents(Composite parent) {

    _container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Composite

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.