Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.FormAttachment


    formLayout.marginWidth = 5;
    composite.setLayout(formLayout);

    Label label = new Label(composite, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    label.setLayoutData(data);

    toolBar = new ToolBar(composite, SWT.BORDER | SWT.FLAT | SWT.VERTICAL);
   

    data = new FormData();
    data.top = new FormAttachment(label, 0);
    data.left = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(100, 0);
    // data.height = 250;
    // data.width = 50;
    toolBar.setLayoutData(data);

    Composite composite1 = new Composite(composite, SWT.BORDER);
    data = new FormData();
    data.top = new FormAttachment(label, 0);
    data.left = new FormAttachment(toolBar, 0, SWT.DEFAULT);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    composite1.setLayoutData(data);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite1.setLayout(layout);
View Full Code Here


            tb.setSource(graph.getContents());
        }

        private void createZoomableCanvas(Composite parent) {
            FormData data = new FormData();
            data.top = new FormAttachment(100, -100);
            data.left = new FormAttachment(100, -100);
            data.right = new FormAttachment(100, 0);
            data.bottom = new FormAttachment(100, 0);

            thumbnail = new FigureCanvas(parent, SWT.NONE);
            thumbnail.setBackground(ColorConstants.white);
            thumbnail.setLayoutData(data);
View Full Code Here

            thumbnail.setContents(tb);
        }

        private void createContents(Control control) {
            FormData data = new FormData();
            data.top = new FormAttachment(0, 0);
            data.left = new FormAttachment(0, 0);
            data.right = new FormAttachment(100, 0);
            data.bottom = new FormAttachment(100, 0);
            control.setParent(this);
            control.setLayoutData(data);
        }
View Full Code Here

    super.createControls(parent, atabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    propertySheetPage = new HDFSPropertySheetPage();
    propertySheetPage.createControl(composite);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(100, 0);
    propertySheetPage.getControl().setLayoutData(data);
    propertySheetPage.getControl().addControlListener(new ControlAdapter() {
      public void controlResized(ControlEvent e) {
        atabbedPropertySheetPage.resizeScrolledComposite();
      }
View Full Code Here

        layout.marginWidth = 0;
        layout.spacing = 0;
        parent.setLayout(layout);
       
        FormData dLabel = new FormData(); // bind to left & text
        dLabel.left = new FormAttachment(0,5);
        dLabel.top = new FormAttachment(attributeCombo,2);
        dLabel.right = new FormAttachment(100,-5);
        featuresSelected.setLayoutData(dLabel);
       
        FormData dCombo = new FormData(); // bind to label and text
        dCombo.left = new FormAttachment(0,5);
        dCombo.top = new FormAttachment(0);
        dCombo.right = new FormAttachment(30, -5);
        attributeCombo.setLayoutData(dCombo);
       
        FormData dText = new FormData(); // bind to label and text
        dText.left = new FormAttachment(attributeCombo);
        dText.top = new FormAttachment(0);
        dText.right = new FormAttachment(95,-5);
        searchWidget.setLayoutData(dText);
       
        FormData dCheck = new FormData(); // bind to top, label, bbox
        dCheck.top = new FormAttachment(2);
        dCheck.left = new FormAttachment(searchWidget, 5);
        dCheck.right = new FormAttachment( 100,-5);
        selectAllCheck.setLayoutData(dCheck);
       
        FormData dContents = new FormData(100, 100); // text & bottom
        dContents.right = new FormAttachment(100); // bind to right of form
        dContents.left = new FormAttachment(0); // bind to left of form
        dContents.top = new FormAttachment(featuresSelected, 2); // attach with 2 pixel offset
        dContents.bottom = new FormAttachment(100); // bind to bottom of form       
        table.getControl().setLayoutData(dContents);
    }
View Full Code Here

        layout.marginWidth = 0;
        layout.spacing = 0;
        aParent.setLayout(layout);

        FormData dLabel = new FormData(); // bind to left & text
        dLabel.left = new FormAttachment(0);
        dLabel.top = new FormAttachment(text, 5, SWT.CENTER);
        label.setLayoutData(dLabel);

        FormData dText = new FormData(); // bind to top, label, bbox
        dText.top = new FormAttachment(1);
        dText.left = new FormAttachment(label, 5);
        dText.right = new FormAttachment(bbox, -5);
        text.setLayoutData(dText);

        FormData dBbox = new FormData(); // text & right
        dBbox.right = new FormAttachment(100);
        dBbox.top = new FormAttachment(text, 0, SWT.CENTER);
        bbox.setLayoutData(dBbox);

        FormData dsashForm = new FormData(100, 100); // text & bottom
        dsashForm.right = new FormAttachment(100); // bind to right of form
        dsashForm.left = new FormAttachment(0); // bind to left of form
        dsashForm.top = new FormAttachment(text, 2); // attach with 5 pixel offset
        dsashForm.bottom = new FormAttachment(100); // bind to bottom of form

        splitter.setWeights(new int[]{60,40});
        splitter.setLayoutData(dsashForm);
        createContextMenu();
    }
View Full Code Here

    private static final int limit = 20, percent = 80;
  public static void buildSplit(final Composite parent, Control c1, Control c2) {
      final Sash sash = new Sash(parent, SWT.VERTICAL);

      FormData c1Data = new FormData();
      c1Data.left = new FormAttachment(0, 0);
      c1Data.right = new FormAttachment(sash, 0);
      c1Data.top = new FormAttachment(0, 0);
      c1Data.bottom = new FormAttachment(100, 0);
      c1.setLayoutData(c1Data);

      final FormData sashData = new FormData();
      sashData.left = new FormAttachment(percent, 0);
      sashData.top = new FormAttachment(0, 0);
      sashData.bottom = new FormAttachment(100, 0);
      sash.setLayoutData(sashData);
      sash.addListener(SWT.Selection, new Listener() {
        @Override
    public void handleEvent(Event e) {
          Rectangle sashRect = sash.getBounds();
          Rectangle shellRect = parent.getClientArea();
          int right = shellRect.width - sashRect.width - limit;
          e.x = Math.max(Math.min(e.x, right), limit);
          if (e.x != sashRect.x) {
            sashData.left = new FormAttachment(0, e.x);
            parent.layout();
          }
        }
      });

      FormData c2Data = new FormData();
      c2Data.left = new FormAttachment(sash, 0);
      c2Data.right = new FormAttachment(100, 0);
      c2Data.top = new FormAttachment(0, 0);
      c2Data.bottom = new FormAttachment(100, 0);
      c2.setLayoutData(c2Data);
  }
View Full Code Here

    // Bottom Left
    Text textInput = new Text(sfLeft, SWT.SINGLE | SWT.BORDER);

    // Set the layout data
    FormData fd = new FormData();
    fd.top = new FormAttachment(0, 0);
    fd.bottom = new FormAttachment(textInput);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    mainTextArea.setLayoutData(fd);

    fd = new FormData();
    fd.height = TEXT_HEIGHT;
    fd.bottom = new FormAttachment(100, 0);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    textInput.setLayoutData(fd);

    // Top Right
    Text txtChannel = new Text(sfRight, SWT.NULL);
    txtChannel.setEditable(false);
    txtChannel.setText("Top Right");

    // Bottom Right
    Button btnBottom = new Button(sfRight, SWT.PUSH);
    btnBottom.setText("Bottom Right");

    // Set the layout data
    fd = new FormData();
    fd.top = new FormAttachment(0, 0);
    fd.height = TEXT_HEIGHT;
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    txtChannel.setLayoutData(fd);

    fd = new FormData();
    fd.top = new FormAttachment(txtChannel);
    fd.bottom = new FormAttachment(100, 0);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    btnBottom.setLayoutData(fd);
  }
View Full Code Here

            }
            else
            {
                parameterPositionOffset += heightForAParameter;
            }
            formData.top = new FormAttachment(0, parameterPositionOffset + 2);
            formData.right = new FormAttachment(labelWidth);
            label.setLayoutData(formData);
            label.setToolTipText(param.getDescription());
           
            formData = new FormData();
            formData.top = new FormAttachment(0, parameterPositionOffset);
            formData.left = new FormAttachment(label, 5);
            formData.right = new FormAttachment(valueWidth);
            // this will contain the list of items, if the list is to be made available to choose from
            // e.g. the list of exchanges
            String[] items = null;
            if (param.getName().equals(QUEUE))
            {
                List<String> qList = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
                // Customization for AMQQueueMBean method OPERATION_MOVE_MESSAGES
                if (_opData.getName().equals(OPERATION_MOVE_MESSAGES))
                {
                    qList.remove(_mbean.getName());   
                }
                // End of Customization
                items = qList.toArray(new String[0]);
            }
            else if (param.getName().equals(EXCHANGE))
            {
                items = ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_virtualHostName);
            }
            else if (param.getName().equals(EXCHANGE_TYPE))
            {
                items = DEFAULT_EXCHANGE_TYPE_VALUES.toArray(new String[DEFAULT_EXCHANGE_TYPE_VALUES.size()]);
            }
            else if (isUserListParameter(param))
            {
                List<String> list = ApplicationRegistry.getServerRegistry(_mbean).getUsernames();
                if (list != null && !list.isEmpty())
                {
                    items = list.toArray(new String[0]);
                }
            }
           
            if (items != null)
            {
                org.eclipse.swt.widgets.List _list = new org.eclipse.swt.widgets.List(_paramsComposite, SWT.BORDER | SWT.V_SCROLL);
                int listSize = _form.getClientArea().height * 2 / 3;
                int itemsHeight = items.length * (_list.getItemHeight() + 2);
                // Set a min height for the list widget (set it to min 4 items)
                if (items.length < 4)
                {
                    itemsHeight = 4 * (_list.getItemHeight() + 2);
                }
               
                listSize = (listSize > itemsHeight) ? itemsHeight : listSize;
                parameterPositionOffset = parameterPositionOffset + listSize;
                formData.bottom = new FormAttachment(0, parameterPositionOffset);
                _list.setLayoutData(formData);
                _list.setData(param);
                _list.setItems(items);
                _list.addSelectionListener(parameterSelectionListener);
                valueInCombo = true;
            }
            else if (param.isBoolean())
            {
                Button booleanButton = _toolkit.createButton(_paramsComposite, "", SWT.CHECK);
                booleanButton.setLayoutData(formData);
                booleanButton.setData(param);
                booleanButton.addSelectionListener(booleanSelectionListener);
                valueInCombo = true;               
            }
            else
            {
                int style = SWT.NONE;
                if (PASSWORD.equalsIgnoreCase(param.getName()))
                {
                    style = SWT.PASSWORD;
                }
                Text text = _toolkit.createText(_paramsComposite, "", style);
                formData = new FormData();
                formData.top = new FormAttachment(0, parameterPositionOffset);
                formData.left = new FormAttachment(label, 5);
                formData.right = new FormAttachment(valueWidth);
                text.setLayoutData(formData);
                // Listener to assign value to the parameter
                text.addKeyListener(keyListener);
                // Listener to verify if the entered key is valid
                text.addVerifyListener(verifyListener);
                text.setData(param);
            }
           
            // display the parameter data type next to the text field
            if (valueInCombo)
            {
                label = _toolkit.createLabel(_paramsComposite, "");
            }
            else if (PASSWORD.equalsIgnoreCase(param.getName()))
            {
                label = _toolkit.createLabel(_paramsComposite, "(String)");
            }
            else
            {
                String str = param.getType();
               
                if (param.getType().lastIndexOf(".") != -1)
                {
                    str = param.getType().substring(1 + param.getType().lastIndexOf("."));
                }
               
                label = _toolkit.createLabel(_paramsComposite, "(" + str + ")");
            }
            formData = new FormData();
            formData.top = new FormAttachment(0, parameterPositionOffset);
            formData.left = new FormAttachment(valueWidth, 5);
            label.setLayoutData(formData);
        }
    }
View Full Code Here

        List<ParameterData> params = _opData.getParameters();
        ParameterData param = params.get(0);
        // Queue selection widget
        Label label = _toolkit.createLabel(composite, ViewUtility.getDisplayText(param.getName()));
        FormData formData = new FormData();
        formData.top = new FormAttachment(0, 2);
        formData.right = new FormAttachment(labelWidth);
        label.setLayoutData(formData);
        label.setToolTipText(param.getDescription());
       
        formData = new FormData();
        formData.top = new FormAttachment(0);
        formData.left = new FormAttachment(label, 5);
        formData.right = new FormAttachment(valueWidth);

        Combo combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
        List<String> qList = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
        combo.setItems(qList.toArray(new String[0]));
        combo.add("Select Queue", 0);
        combo.select(0);
        combo.setLayoutData(formData);
        combo.setData(param);
        combo.addSelectionListener(parameterSelectionListener);

        // Binding creation widgets
        createARowForCreatingHeadersBinding(composite, 1);
        createARowForCreatingHeadersBinding(composite, 2);
        createARowForCreatingHeadersBinding(composite, 3);
        createARowForCreatingHeadersBinding(composite, 4);
        createARowForCreatingHeadersBinding(composite, 5);
        createARowForCreatingHeadersBinding(composite, 6);
        createARowForCreatingHeadersBinding(composite, 7);
        createARowForCreatingHeadersBinding(composite, 8);
       
        final Button addMoreButton = _toolkit.createButton(composite, "Add More", SWT.PUSH);
        formData = new FormData();
        formData.top = new FormAttachment(0, heightForAParameter);
        formData.left = new FormAttachment(70, 5);
        addMoreButton.setLayoutData(formData);
        addMoreButton.setData("rowCount", 8);
        addMoreButton.addSelectionListener(new SelectionAdapter()
            {
                public void widgetSelected(SelectionEvent e)
View Full Code Here

TOP

Related Classes of org.eclipse.swt.layout.FormAttachment

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.