Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.Section


        layout.maxNumColumns = MAX_COLS;
        layout.minNumColumns = MIN_COLS;
        form.getBody().setLayout(layout);
        toolkit.decorateFormHeading(form.getForm());
       
        final Section section = toolkit.createSection(form.getBody(), SECTION_STYLE);
        section.setText("Country Details");
        section.setDescription("Update country details below.");
        section.addExpansionListener(new ExpansionAdapter(){
            public void expansionStateChanged( ExpansionEvent e ) {
                // Nothing
            }
        });
        final Composite client = toolkit.createComposite(section, SWT.NONE);
        GridLayout sectionLayout = new GridLayout();
        sectionLayout.numColumns = 4;
        client.setLayout(sectionLayout);
        section.setClient(client);

        // SWT Widgets
        Label label = toolkit.createLabel(client, NAME_FORMA_LBL, LABEL_STYLE);
        FormTextCellEditor nameFormalEditor = new FormTextCellEditor(client, form.getMessageManager());
        nameFormal = (Text) nameFormalEditor.getControl();
        nameFormal.setData(NAME_FORMA_LBL);
        nameFormal.addKeyListener(this);
        GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        nameFormal.setLayoutData(layoutData);

        label = toolkit.createLabel(client, NAME_SORT_LBL, LABEL_STYLE);
        FormTextCellEditor nameSortEditor = new FormTextCellEditor(client, form.getMessageManager());
        nameSort = (Text) nameSortEditor.getControl();
        nameSort.setData(NAME_SORT_LBL);
        nameSort.addKeyListener(this);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        nameSort.setLayoutData(layoutData);

        label = toolkit.createLabel(client, POP_EST_LBL, LABEL_STYLE);
        FormTextCellEditor populationEditor = new FormTextCellEditor(client, form.getMessageManager());
        population = (Text) populationEditor.getControl();
        population.setData(POP_EST_LBL);
        population.addKeyListener(this);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        population.setLayoutData(layoutData);
       
        label = toolkit.createLabel(client, TYPE_LBL, LABEL_STYLE);
        FormComboBoxCellEditor typeEditor = new FormComboBoxCellEditor(client, TYPE_OPTS, form.getMessageManager());
        type = (CCombo) typeEditor.getControl();
        type.addSelectionListener(new SelectionAdapter(){
            @Override
            public void widgetSelected( SelectionEvent e ) {
                setEnabled(true);
            }
        });
        layoutData = new GridData();
        layoutData.horizontalSpan = 3;
        type.setLayoutData(layoutData);
       
        // JFace Viewer
        label = toolkit.createLabel(client, COLOR_MAP_LBL, LABEL_STYLE);
        FormComboBoxCellEditor colorEditor = new FormComboBoxCellEditor(client, new String[]{}, form.getMessageManager());
        CCombo colorCombo = (CCombo) colorEditor.getControl();
        colorMap = new ComboViewer(colorCombo);
        colorMap.addSelectionChangedListener(this);
        layoutData = new GridData();
        layoutData.horizontalSpan = 3;
        colorMap.getControl().setLayoutData(layoutData);

        // hook up to data
        colorMap.setContentProvider(new IStructuredContentProvider(){
            public Object[] getElements( Object inputElement ) {
                if (inputElement instanceof Object[]) {
                    return (Object[]) inputElement;
                }
                return null;
            }
            public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
                // For dynamic content we would register listeners here
            }
            public void dispose() {
                // Nothing
            }
        });
        colorMap.setLabelProvider(new LabelProvider(){
            public String getText( Object element ) {
                return " " + element + " color";
            }
        });
        colorMap.setInput(COLOR_MAP_OPTS);

        // Other sample section - to try out ColumnLayout
        final Section sectionOther = toolkit.createSection(form.getBody(), SECTION_STYLE);
        sectionOther.setText("Others");
        sectionOther
                .setDescription("Sample section to demo ColumnLayout, make the view width smaller to force it to relayout.");
        sectionOther.addExpansionListener(new ExpansionAdapter(){
            public void expansionStateChanged( ExpansionEvent e ) {
                // Nothing
            }
        });
        final Composite clientOther = toolkit.createComposite(sectionOther, SWT.NONE);
        sectionLayout = new GridLayout();
        sectionLayout.numColumns = 4;
        clientOther.setLayout(sectionLayout);
        sectionOther.setClient(clientOther);

        Label remarksLbl = toolkit.createLabel(clientOther, REMARKS_LBL, LABEL_STYLE);
        FormTextCellEditor remarksEditor = new FormTextCellEditor(clientOther, form.getMessageManager());
        Text remarks = (Text) remarksEditor.getControl();
        remarks.setData(REMARKS_LBL);
View Full Code Here


        layout.maxNumColumns = MAX_COLS;
        layout.minNumColumns = MIN_COLS;
        form.getBody().setLayout(layout);
        toolkit.decorateFormHeading(form.getForm());

        final Section section = toolkit.createSection(form.getBody(), SECTION_STYLE);
        section.setText("Country Details");
        section.setDescription("Update country details below.");
        section.addExpansionListener(new ExpansionAdapter(){
            public void expansionStateChanged( ExpansionEvent e ) {
                // Nothing
            }
        });
        final Composite client = toolkit.createComposite(section, SWT.NONE);
        GridLayout sectionLayout = new GridLayout();
        sectionLayout.numColumns = 4;
        client.setLayout(sectionLayout);
        section.setClient(client);

        // SWT Widgets
        Label label = toolkit.createLabel(client, NAME_FORMA_LBL, LABEL_STYLE);
        nameFormal = toolkit.createText(client, "", FIELD_STYLE);
        nameFormal.setData(NAME_FORMA_LBL);
        nameFormal.addFocusListener(this);
        nameFormal.addKeyListener(this);
        GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        nameFormal.setLayoutData(layoutData);

        label = toolkit.createLabel(client, NAME_SORT_LBL, LABEL_STYLE);
        nameSort = toolkit.createText(client, "", FIELD_STYLE);
        nameSort.setData(NAME_SORT_LBL);
        nameSort.addFocusListener(this);
        nameSort.addKeyListener(this);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        nameSort.setLayoutData(layoutData);

        label = toolkit.createLabel(client, POP_EST_LBL, LABEL_STYLE);
        population = toolkit.createText(client, "", FIELD_STYLE);
        population.setData(POP_EST_LBL);
        population.addFocusListener(this);
        population.addKeyListener(this);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        population.setLayoutData(layoutData);

        label = toolkit.createLabel(client, "", LABEL_STYLE);
        type = toolkit.createButton(client, TYPE_SOV_LBL, SWT.CHECK);
        type.addMouseListener(this);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
        type.setLayoutData(layoutData);
       
        // JFace Viewer
        label = toolkit.createLabel(client, "Color Map:", LABEL_STYLE);
        colorMap = new ComboViewer(client, FIELD_STYLE);
        colorMap.addSelectionChangedListener(this);
        layoutData = new GridData();
        layoutData.horizontalSpan = 3;
        colorMap.getControl().setLayoutData(layoutData);

        // hook up to data
        colorMap.setContentProvider(new IStructuredContentProvider(){
            public Object[] getElements( Object inputElement ) {
                if (inputElement instanceof Object[]) {
                    return (Object[]) inputElement;
                }
                return null;
            }
            public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
                // for dynamic content we would register listeners here
            }
            public void dispose() {
            }
        });
        colorMap.setLabelProvider(new LabelProvider(){
            public String getText( Object element ) {
                return " " + element + " color";
            }
        });
        colorMap.setInput(COLOR_MAP_OPTS);

        // Other sample section - to try out ColumnLayout
        final Section sectionOther = toolkit.createSection(form.getBody(), SECTION_STYLE);
        sectionOther.setText("Others");
        sectionOther
                .setDescription("Sample section to demo ColumnLayout, make the view width smaller to force it to relayout.");
        sectionOther.addExpansionListener(new ExpansionAdapter(){
            public void expansionStateChanged( ExpansionEvent e ) {
                // Nothing
            }
        });
        final Composite clientOther = toolkit.createComposite(sectionOther, SWT.NONE);
        sectionLayout = new GridLayout();
        sectionLayout.numColumns = 4;
        clientOther.setLayout(sectionLayout);
        sectionOther.setClient(clientOther);

        Label remarksLbl = toolkit.createLabel(clientOther, "Remarks:", LABEL_STYLE);
        Text remarks = toolkit.createText(clientOther, "", FIELD_STYLE);
        layoutData = new GridData(GridData.FILL_HORIZONTAL);
        layoutData.horizontalSpan = 3;
View Full Code Here

    public AttributesSection(MBeanInfoWrapper wrapper,
            final IManagedForm managedForm, Composite parent) {
        super(parent, managedForm.getToolkit(), Section.TITLE_BAR);

        FormToolkit toolkit = managedForm.getToolkit();
        Section section = getSection();
        section.marginWidth = 10;
        section.marginHeight = 5;
        section.setText(Messages.AttributesSection_title);
        Composite container = toolkit.createComposite(section, SWT.WRAP);
        section.setClient(container);
        GridLayout layout = new GridLayout();
        layout.marginWidth = 2;
        layout.marginHeight = 2;
        container.setLayout(layout);
View Full Code Here

        FontData fd[] = parent.getFont().getFontData();
        Font bold = new Font(parent.getDisplay(), fd[0].getName(), fd[0]
                .getHeight(), SWT.BOLD);

        Section section = toolkit.createSection(parent, Section.TITLE_BAR);
        section.marginWidth = 10;
        section.setText(Messages.AttributeDetails_title);
        section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

        Composite container = toolkit.createComposite(section);
        section.setClient(container);
        GridLayout glayout = new GridLayout();
        glayout.marginWidth = glayout.marginHeight = 0;
        glayout.numColumns = 2;
        glayout.makeColumnsEqualWidth = false;
        container.setLayout(glayout);
View Full Code Here

    public OperationsSection(MBeanInfoWrapper wrapper,
            final IManagedForm managedForm, Composite parent) {
        super(parent, managedForm.getToolkit(), Section.TITLE_BAR);

        FormToolkit toolkit = managedForm.getToolkit();
        Section section = getSection();
        section.marginWidth = 10;
        section.marginHeight = 5;
        section.setText(Messages.OperationsSection_title);
        Composite container = toolkit.createComposite(section, SWT.WRAP);
        section.setClient(container);
        GridLayout layout = new GridLayout();
        layout.marginWidth = 2;
        layout.marginHeight = 2;
        container.setLayout(layout);
View Full Code Here

        toolkit.createLabel(body, Messages.description);
        Text descriptionText = toolkit.createText(body, description, SWT.MULTI
                | SWT.WRAP | SWT.READ_ONLY);
        descriptionText.setLayoutData(defaultGridData.create());

        Section notifSection = toolkit.createSection(body, Section.TITLE_BAR
                | Section.TWISTIE | Section.TWISTIE);
        notifSection.setText(Messages.InfoPage_notificationsSectionTitle);
        GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(
                notifSection);
        if (wrapper.getMBeanNotificationInfoWrappers().length == 0) {
            notifSection.setEnabled(false);
            notifSection.setExpanded(false);
        } else {
            notifSection.setEnabled(true);
            notifSection.setExpanded(true);
        }

        Composite notificationContainer = toolkit.createComposite(notifSection);
        notifSection.setClient(notificationContainer);
        GridLayoutFactory.fillDefaults().generateLayout(notificationContainer);

        Tree notificationTree = toolkit.createTree(notificationContainer,
                SWT.BORDER);
        GridDataFactory.fillDefaults().hint(500, 150).applyTo(notificationTree);
View Full Code Here

   
    addEventListeners();
  }

  private void createStartSection(FormToolkit toolkit, Composite parent) {
    Section startSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    startSection.setText("Server start");   
    startSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    Composite startComposite = toolkit.createComposite(parent);
    startComposite.setLayout(new GridLayout(2, false));
    startComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
View Full Code Here

      }
    });     
  }
 
  private void createStatsSection(FormToolkit toolkit, Composite parent) {
    Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    section.setText("Server Stats");   
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new GridLayout());   
   
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));   
   
    clientCountLabel = toolkit.createLabel(sectionClient, NUMBER_OF_CLIENTS + ": 0");
    clientCountLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    isRunningLabel = toolkit.createLabel(sectionClient, IS_RUNNING + ": NO");
    isRunningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    section.setClient(sectionClient)
  }
View Full Code Here

   
    section.setClient(sectionClient)
  }
 
  private void createPlayersSection(FormToolkit toolkit, Composite parent) {
    Section playerSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    playerSection.setText("Players");   
    Composite sectionClient = toolkit.createComposite(playerSection);
    sectionClient.setLayout(new GridLayout());
   
    playerSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    Table clientTable = toolkit.createTable(sectionClient, SWT.NONE | SWT.SINGLE);
       
    clientTable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    clientTable.setLinesVisible(true);
   
      TableColumn tc1 = new TableColumn(clientTable, SWT.CENTER);
      TableColumn tc2 = new TableColumn(clientTable, SWT.CENTER);
     
      tc1.setText("Nickname");
      tc2.setText("Guid");
     
      tc1.setWidth(100);
      tc2.setWidth(100);
     
      clientTable.setHeaderVisible(true);

      clientTableViewer = new TableViewer(clientTable);
     
      clientTableViewer.setLabelProvider(new ITableLabelProvider () {

      public Image getColumnImage(Object element, int columnIndex) {
        return null;
      }

      public String getColumnText(Object element, int columnIndex) {
        if (element instanceof IPlayer) {
          IPlayer player = (IPlayer) element;
         
          switch(columnIndex) {
          case 0:
            return player.getNickName();
          case 1:
            return player.getGuid();
          }
        }
       
        return null;
      }

      public void addListener(ILabelProviderListener listener) {     
      }

      public void dispose() { 
      }

      public boolean isLabelProperty(Object element, String property) {
        return false;
      }

      public void removeListener(ILabelProviderListener listener) {
      }
      });
     
      clientTableViewer.setContentProvider(new IStructuredContentProvider() {

      public Object[] getElements(Object inputElement) {
        if (inputElement instanceof IPlayer[]) {
          return (IPlayer[]) inputElement;
        }
       
        return null;
      }

      public void dispose() { 
      }

      public void inputChanged(
          Viewer viewer,
          Object oldInput,
          Object newInput) {
      }
       
      });
     
      playerSection.setClient(sectionClient)
  }
View Full Code Here

    /**
     * Creates the display area for this composite
     */
    private void createDisplayArea(String title, String message) {
        Section section =
                SectionFactory.createSection(this, title, message);
        GridData data = new GridData(GridData.FILL_BOTH);
        section.setLayoutData(data);

        displayArea = new Composite(section, SWT.NONE);
        section.setClient(displayArea);

        GridLayout layout = new GridLayout();
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        displayArea.setLayout(layout);
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.Section

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.