Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.FormData


    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

        int parameterPositionOffset = 0;
        for (ParameterData param : params)
        {           
            boolean valueInCombo = false;
            Label label = _toolkit.createLabel(_paramsComposite, ViewUtility.getDisplayText(param.getName()));
            FormData formData = new FormData();
            if (params.indexOf(param) == 0)
            {
                parameterPositionOffset = 0;
            }
            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()
View Full Code Here

     * @param rowCount - row number
     */
    private void createARowForCreatingHeadersBinding(Composite parent, int rowCount)
    { 
        Label key = _toolkit.createLabel(parent, "Name");
        FormData formData = new FormData();
        formData.top = new FormAttachment(0, rowCount * heightForAParameter + 2);
        formData.right = new FormAttachment(15);
        key.setLayoutData(formData);
       
        Text keyText = _toolkit.createText(parent, "", SWT.NONE);
        formData = new FormData();
        formData.top = new FormAttachment(0, rowCount * heightForAParameter);
        formData.left = new FormAttachment(key, 5);
        formData.right = new FormAttachment(40);
        keyText.setLayoutData(formData);
        keyText.addKeyListener(headerBindingListener);
       
        Label value = _toolkit.createLabel(parent, "Value");
        formData = new FormData();
        formData.top = new FormAttachment(0, rowCount * heightForAParameter + 2);
        formData.right = new FormAttachment(45);
        value.setLayoutData(formData);
       
        Text valueText = _toolkit.createText(parent, "", SWT.NONE);
        formData = new FormData();
        formData.top = new FormAttachment(0, rowCount * heightForAParameter);
        formData.left = new FormAttachment(value, 5);
        formData.right = new FormAttachment(70);
        valueText.setLayoutData(formData);
        valueText.addKeyListener(headerBindingListener);
View Full Code Here

        composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        composite.setLayout(new FormLayout());
       
        Label label = _toolkit.createLabel(composite, "Select the notification to subscribe or unsubscribe");
        label.setFont(ApplicationRegistry.getFont(FONT_BOLD));
        FormData formData = new FormData();
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        label.setLayoutData(formData);
       
        _notificationNameCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
        formData = new FormData();
        formData.top = new FormAttachment(label, 10);
        formData.left = new FormAttachment(0, 10);
        formData.right = new FormAttachment(40);
        _notificationNameCombo.setLayoutData(formData);
        _notificationNameCombo.addSelectionListener(comboListener);
       
        _typesCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
        formData = new FormData();
        formData.top = new FormAttachment(label, 10);
        formData.left = new FormAttachment(_notificationNameCombo, 5);
        formData.right = new FormAttachment(65);
        _typesCombo.setLayoutData(formData);
        _typesCombo.addSelectionListener(comboListener);
       
        _subscribeButton = new Button(composite, SWT.PUSH | SWT.CENTER);
        _subscribeButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
        _subscribeButton.setText(SUBSCRIBE_BUTTON);
        formData = new FormData();
        formData.top = new FormAttachment(label, 10);
        formData.left = new FormAttachment(65, 10);
        formData.width = 80;
        _subscribeButton.setLayoutData(formData);
        _subscribeButton.addSelectionListener(selectionListener);
       
        _unsubscribeButton = new Button(composite, SWT.PUSH | SWT.CENTER);
        _unsubscribeButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
        _unsubscribeButton.setText(UNSUBSCRIBE_BUTTON);
        formData = new FormData();
        formData.top = new FormAttachment(label, 10);
        formData.left = new FormAttachment(_subscribeButton, 10);
        formData.width = 80;
        _unsubscribeButton.setLayoutData(formData);
        _unsubscribeButton.addSelectionListener(selectionListener);
       
        Label fixedLabel = _toolkit.createLabel(composite, "");
        formData = new FormData();
        formData.top = new FormAttachment(_notificationNameCombo, 5);
        formData.left = new FormAttachment(0, 10);
        fixedLabel.setLayoutData(formData);
        fixedLabel.setText(DESCRIPTION + " : ");
        fixedLabel.setFont(ApplicationRegistry.getFont(FONT_BOLD));
       
        _descriptionLabel = _toolkit.createLabel(composite, "");
        formData = new FormData();
        formData.top = new FormAttachment(_notificationNameCombo, 5);
        formData.left = new FormAttachment(fixedLabel, 10);
        formData.right = new FormAttachment(100);
        _descriptionLabel.setLayoutData(formData);
        _descriptionLabel.setText("      ");
View Full Code Here

   
   
    private void createNotificationsTabFolder()
    {
        _notificationTabFolder = new TabFolder(_form.getBody(), SWT.NONE);
        FormData layoutData = new FormData();
        layoutData.left = new FormAttachment(0);
        layoutData.top = new FormAttachment(0);
        layoutData.right = new FormAttachment(100);
        layoutData.bottom = new FormAttachment(100);
        _notificationTabFolder.setLayoutData(layoutData);
View Full Code Here

    }

    public static TabFolder generateMBeanTabFolder(final Composite parent, final JMXManagedObject mbean, final MBeanServerConnection mbsc)
    {
        TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
        FormData layoutData = new FormData();
        layoutData.left = new FormAttachment(0);
        layoutData.top = new FormAttachment(0);
        layoutData.right = new FormAttachment(100);
        layoutData.bottom = new FormAttachment(100);
        tabFolder.setLayoutData(layoutData);
View Full Code Here

     * Creates TabFolder and tabs for all mbeantype (Connection, Queue, and Exchange)
     */
    public static TabFolder generateMBeanTypeTabFolder(final Composite parent, ManagedServer server, String virtualHost)
    {
        TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
        FormData layoutData = new FormData();
        layoutData.left = new FormAttachment(0);
        layoutData.top = new FormAttachment(0);
        layoutData.right = new FormAttachment(100);
        layoutData.bottom = new FormAttachment(100);
        tabFolder.setLayoutData(layoutData);
View Full Code Here

     * Creates TabFolder and tab for the Connection selection view
     */
    public static TabFolder generateConnectionTypeTabFolder(final Composite parent, ManagedServer server, String virtualHost)
    {
        TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
        FormData layoutData = new FormData();
        layoutData.left = new FormAttachment(0);
        layoutData.top = new FormAttachment(0);
        layoutData.right = new FormAttachment(100);
        layoutData.bottom = new FormAttachment(100);
        tabFolder.setLayoutData(layoutData);
View Full Code Here

TOP

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

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.