Package org.eclipse.jface.layout

Examples of org.eclipse.jface.layout.GridDataFactory


    }

    @Override
    protected void createFormElements(Composite editArea)
    {
        GridDataFactory gdf = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false);

        List<Account> accounts = getModel().getClient().getAccounts();

        // account from
        Label label = new Label(editArea, SWT.NONE);
        label.setText(Messages.ColumnAccountFrom);
        ComboViewer comboFrom = new ComboViewer(editArea, SWT.READ_ONLY);
        comboFrom.setContentProvider(ArrayContentProvider.getInstance());
        comboFrom.setLabelProvider(new LabelProvider()
        {
            @Override
            public String getText(Object element)
            {
                return ((Account) element).getName();
            }
        });
        comboFrom.setInput(accounts);
        gdf.applyTo(comboFrom.getControl());
        final IViewerObservableValue observableFrom = ViewersObservables.observeSingleSelection(comboFrom);

        // account to
        label = new Label(editArea, SWT.NONE);
        label.setText(Messages.ColumnAccountTo);
        ComboViewer comboTo = new ComboViewer(editArea, SWT.READ_ONLY);
        comboTo.setContentProvider(ArrayContentProvider.getInstance());
        comboTo.setLabelProvider(new LabelProvider()
        {
            @Override
            public String getText(Object element)
            {
                return ((Account) element).getName();
            }
        });
        comboTo.setInput(accounts);
        gdf.applyTo(comboTo.getControl());
        final IViewerObservableValue observableTo = ViewersObservables.observeSingleSelection(comboTo);

        // amount
        bindings().bindMandatoryAmountInput(editArea, Messages.ColumnAmount, "amount"); //$NON-NLS-1$
View Full Code Here


    int numColumns = layoutData.numColumns;
    return layoutLastControl(lastControl, numColumns, true);
  }
 
  protected GridData layoutLastControl(Control lastControl, int numColumns, boolean expandLast) {
    GridDataFactory gdf = expandLast ?
        GridDataFactory.fillDefaults() :
        GridDataFactory.swtDefaults();
    GridData gridData = gdf.span(numColumns, 1).create();
    lastControl.setLayoutData(gridData);
    return gridData;
  }
View Full Code Here

      section.setText(UIPlugin.getLocalString("_UI_GeneralInformation_title")); //$NON-NLS-1$
      section.setDescription(UIPlugin.getLocalString("_UI_GeneralInformation_description")); //$NON-NLS-1$

      GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(section);
      GridDataFactory textGDFactory = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).indent(
        4, 0);

      Composite client = toolkit.createComposite(section);
      client.setLayout(new GridLayout(4, false));

      toolkit.createLabel(client, UIPlugin.getLocalString("_UI_Name_label")); //$NON-NLS-1$

      userText = toolkit.createText(client, null);
      userText.addVerifyListener(ownerCharsVerifier);
      userText.addModifyListener(nameAndUserListener);
      textGDFactory.applyTo(userText);

      toolkit.createLabel(client, "-"); //$NON-NLS-1$

      nameText = toolkit.createText(client, null);
      nameText.addVerifyListener(nameCharsVerifier);
      nameText.addModifyListener(nameAndUserListener);

      textGDFactory.applyTo(nameText);

      toolkit.createLabel(client, UIPlugin.getLocalString("_UI_Version_label")); //$NON-NLS-1$

      versionText = toolkit.createText(client, null);
      versionText.addVerifyListener(versionCharsVerifier);
      versionText.addModifyListener(new GuardedModifyListener() {
        @Override
        public void handleEvent(ModifyEvent e) {
          String version = versionText.getText();
          validateVersion(version, versionText);
          getModel().setVersion(version);
        }
      });

      // Rest is on a line of their own so they need to span 3 columns
      textGDFactory = textGDFactory.span(3, 1);
      textGDFactory.applyTo(versionText);

      toolkit.createLabel(client, UIPlugin.getLocalString("_UI_Author_label")); //$NON-NLS-1$

      authorText = toolkit.createText(client, null);
      authorText.addVerifyListener(defaultVerifier);
      authorText.addModifyListener(new GuardedModifyListener() {
        @Override
        public void handleEvent(ModifyEvent e) {
          getModel().setAuthor(authorText.getText());
        }
      });
      textGDFactory.applyTo(authorText);

      toolkit.createLabel(client, UIPlugin.getLocalString("_UI_License_label")); //$NON-NLS-1$

      licenseText = toolkit.createText(client, null);
      licenseText.addVerifyListener(defaultVerifier);
      licenseText.addModifyListener(new GuardedModifyListener() {
        @Override
        public void handleEvent(ModifyEvent e) {
          getModel().setLicense(licenseText.getText());
        }
      });
      textGDFactory.applyTo(licenseText);
      toolkit.paintBordersFor(client);
      section.setClient(client);
    }
View Full Code Here

    tv.setInput(options);
   
    if (fieldNameLabel!=null) {
      GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(fieldNameLabel);
    }
    GridDataFactory grab = GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150);
    grab.applyTo(field);
    grab.applyTo(tv.getTable());
   
    whenVisible(tv.getControl(), new Runnable() {
      public void run() {
        T preSelect = selection.selection.getValue();
        if (preSelect!=null) {
View Full Code Here

    treeviewer.expandAll();

    if (fieldNameLabel!=null) {
      GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(fieldNameLabel);
    }
    GridDataFactory grab = GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 150);
    grab.applyTo(field);
    grab.applyTo(treeviewer.getControl());

    whenVisible(treeviewer.getControl(), new Runnable() {
      public void run() {
        GSContent preSelect = selection.selection.getValue();
        if (preSelect!=null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.layout.GridDataFactory

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.