Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.FormData


    Rectangle boundsLeft = skinObject.getControl().getBounds();
    Rectangle boundsRight = so2nd.getControl().getBounds();

    Rectangle clientArea = soGap.getControl().getParent().getClientArea();

    FormData fd = (FormData) soGap.getControl().getLayoutData();
    fd.width = clientArea.width - (boundsLeft.x + boundsLeft.width)
        - (boundsRight.width);
    if (fd.width < 0) {
      fd.width = 0;
    } else if (fd.width > 50) {
View Full Code Here


        templateID, soMain);
    if (so != null) {
      so.setTooltipID(item.getTooltipID());

      if (lastControl != null) {
        FormData fd = (FormData) so.getControl().getLayoutData();
        fd.left = new FormAttachment(lastControl);
      }

      so.setData("toolbaritem", item);
      SWTSkinButtonUtility btn = new SWTSkinButtonUtility(so,
View Full Code Here

  private void addSeperator(String id, SWTSkinObject soMain) {
    SWTSkinObject so = skin.createSkinObject("toolbar_sep" + Math.random(), id,
        soMain);
    if (so != null) {
      if (lastControl != null) {
        FormData fd = (FormData) so.getControl().getLayoutData();
        fd.left = new FormAttachment(lastControl, fd.left == null ? 0
            : fd.left.offset);
      }

      lastControl = so.getControl();
View Full Code Here

  private void addNonToolBar(String skinid, SWTSkinObject soMain) {
    SWTSkinObject so = skin.createSkinObject("toolbar_d" + Math.random(),
        skinid, soMain);
    if (so != null) {
      if (lastControl != null) {
        FormData fd = (FormData) so.getControl().getLayoutData();
        fd.left = new FormAttachment(lastControl, fd.left == null ? 0
            : fd.left.offset);
      }

      lastControl = so.getControl();
View Full Code Here

      SWTSkinObject skinObject;
      skinObject = skin.getSkinObject("search-text");
      if (skinObject != null) {
        Control control = skinObject.getControl();
        FormData fd = (FormData) control.getLayoutData();
        fd.top.offset = showText ? 6 : 5;
        fd.bottom.offset = showText ? -3 : -2;
      }
      skinObject = skin.getSkinObject("topgap");
      if (skinObject != null) {
        Control control = skinObject.getControl();
        FormData fd = (FormData) control.getLayoutData();
        fd.height = showText ? 6 : 2;
      }
      skinObject = skin.getSkinObject("tabbar");
      if (skinObject != null) {
        Control control = skinObject.getControl();
        FormData fd = (FormData) control.getLayoutData();
        fd.height = showText ? 50 : 32;
        //Utils.relayout(control);
        skinObject.switchSuffix(showText ? "" : "-small", 4, true);

        Shell shell = control.getShell();
View Full Code Here

    layout.marginBottom = 5;
    layout.marginTop = 5;
    layout.marginLeft = 5;
    layout.marginRight = 5;

    FormData data;
    shell.setLayout(layout);

    Label title = new Label(shell, SWT.WRAP);
    title.setText(MessageText.getString("ImageResizer.title"));

    data = new FormData();
    data.width = displayWidth;
    title.setLayoutData(data);

    canvas = new Canvas(shell, SWT.BORDER);
    canvas.setCursor(cursor);
    data = new FormData();
    data.width = displayWidth;
    data.height = displayHeight;
    data.top = new FormAttachment(title, 5);
    canvas.setLayoutData(data);

    canvas.addListener(SWT.MouseDown, moveImageListener);
    canvas.addListener(SWT.MouseUp, moveImageListener);
    canvas.addListener(SWT.MouseMove, moveImageListener);

    canvas.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent arg0) {
        drawCurrentImage();
      }
    });

    offset.x = (minWidth - currentImage.getBounds().width) / 2;
    offset.y = (minHeight - currentImage.getBounds().height) / 2;

    Label label = new Label(shell, SWT.WRAP);
    //The label text depends on the presence of the scale,
    //Thefore we delay the size computation as well as
    //Assiging any FormData (layout) to it see (1)

    //The Control to witch the Buttons OK and Cancel are going to be attached
    //Depends on the presence of the scale
    Control attach = label;

    if (minZoomRatio < 1) {
      scale = new Scale(shell, SWT.HORIZONTAL);
      data = new FormData();
      data.width = displayWidth;
      data.top = new FormAttachment(label, 5);
      scale.setLayoutData(data);
      scale.setMaximum((int) (RESIZE_STEPS * maxZoomRatio));
      scale.setMinimum((int) (RESIZE_STEPS * minZoomRatio));
      scale.setIncrement((int) ((maxZoomRatio - minZoomRatio) * RESIZE_STEPS / 10));
      scale.setPageIncrement((int) ((maxZoomRatio - minZoomRatio)
          * RESIZE_STEPS / 10));

      scale.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event arg0) {
          final long timestamp = SystemTime.getCurrentTime();
          lastUpdate = timestamp;

          final int position = scale.getSelection();

          AEThread t = new AEThread("") {
            public void runSupport() {
              try {
                Thread.sleep(150);
              } catch (Exception e) {
                e.printStackTrace();
              }

              if (timestamp == lastUpdate) {
                if (display != null && !display.isDisposed()) {
                  display.asyncExec(new Runnable() {
                    public void run() {
                      refreshCurrentImage(position);
                    }
                  });
                }
              }
            }
          };
          t.setDaemon(true);
          t.start();

        }
      });
      attach = scale;
      label.setText(MessageText.getString("ImageResizer.move.image.with.slider"));
    } else {
      label.setText(MessageText.getString("ImageResizer.move.image"));
    }

    // (1) Layout of the label, depending on the text in it
    int width = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    if (width > displayWidth) {
      width = displayWidth;
    }

    data = new FormData();
    data.width = width;
    data.top = new FormAttachment(canvas, 5);
    data.left = new FormAttachment(canvas, 0, SWT.CENTER);
    label.setLayoutData(data);

    Button btnCancel = new Button(shell, SWT.PUSH);
    btnCancel.setText("Cancel");
    data = new FormData();
    data.width = 70;
    data.top = new FormAttachment(attach, 10);
    data.right = new FormAttachment(100, -10);
    btnCancel.setLayoutData(data);
    btnCancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
        result = null;
        done = true;
        dispose();
        imageResizerListener.imageResized(result);
      }
    });

    Button btnOk = new Button(shell, SWT.PUSH);
    btnOk.setText("OK");
    data = new FormData();
    data.width = 70;
    data.top = new FormAttachment(attach, 10);
    data.right = new FormAttachment(btnCancel, -10);
    btnOk.setLayoutData(data);
    btnOk.addListener(SWT.Selection, new Listener() {
View Full Code Here

    install_area = new Composite(install_area_parent, SWT.NONE);

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = formLayout.marginHeight = 0;
    shell.setLayout(formLayout);
    FormData fd;

    fd = Utils.getFilledFormData();
    fd.bottom = new FormAttachment(checkITunes, -5);
    fd.top = new FormAttachment(0, 8);
    fd.left = new FormAttachment(0, 8);
    fd.right = new FormAttachment(100, -8);
    lblInfo.setLayoutData(fd);

    fd = Utils.getFilledFormData();
    fd.bottom = new FormAttachment(checkITunes, -5);
    fd.width = 550;
    fd.height = 490;
    browser.setLayoutData(fd);
   
    fd = new FormData();
    fd.bottom = new FormAttachment(100, -10);
    fd.right = new FormAttachment(100, -10);
    btnCancel.setLayoutData(fd);

    fd = new FormData();
    fd.bottom = new FormAttachment(100, -10);
    fd.right = new FormAttachment(btnCancel, -12);
    btnInstall.setLayoutData(fd);

    fd = new FormData();
    fd.bottom = new FormAttachment(checkQOS, -3);
    fd.left = new FormAttachment(0, 10);
    fd.right = new FormAttachment(btnInstall, -12);
    checkITunes.setLayoutData(fd);

    fd = new FormData();
    fd.bottom = new FormAttachment(100, -5);
    fd.left = new FormAttachment(0, 10);
    checkQOS.setLayoutData(fd);
   
    fd = new FormData();
    fd.top = new FormAttachment(checkQOS, 0, SWT.CENTER);
    fd.left = new FormAttachment(checkQOS, 5);
    lblLearnMore.setLayoutData(fd);
   
    fd = new FormData();
    fd.top = new FormAttachment(browser, 0);
    fd.bottom = new FormAttachment(100, 0);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    install_area_parent.setLayoutData(fd);

    fd = new FormData();
    fd.height = btnInstall.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    fd.bottom = new FormAttachment(100, -5);
    fd.left = new FormAttachment(0, 5);
    fd.right = new FormAttachment(100, -12);
    install_area.setLayoutData(fd);
View Full Code Here

    final Control control = skinObject.getControl();

    if (control != null && !control.isDisposed()) {
      Point size;
      if (visible) {
        final FormData fd = (FormData) control.getLayoutData();
        size = (Point) control.getData("v3.oldHeight");
        //System.out.println(control.getData("SkinID") + " oldHeight = " + size + ";v=" + control.getVisible() + ";s=" + control.getSize());
        if (size == null) {
          size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
          if (fd.height > 0) {
View Full Code Here

        return;
      }
      final Control control = skinObject.getControl();
      if (control != null && !control.isDisposed()) {
        if (visible) {
          FormData fd = (FormData) control.getLayoutData();
          fd.width = 0;
          fd.height = 0;
          control.setData("oldSize", new Point(0, 0));

          skinObject.setVisible(visible);

          // FormData should now be 0,0, but setVisible may have
          // explicitly changed it
          fd = (FormData) control.getLayoutData();
         
          if (fd.width != 0 || fd.height != 0) {
            return;
          }

          if (destSize != null) {
            if (fd != null
                && (fd.width != destSize.x || fd.height != destSize.y)) {
              if (fast) {
                fd.width = destSize.x;
                fd.height = destSize.y;
                control.setLayoutData(fd);
                Utils.relayout(control);
              } else {
                slide(skinObject, fd, destSize, runAfterSlide);
                runAfterSlide = null; // prevent calling again
              }
            }
          } else {
            if (fd.width == 0) {
              fd.width = SWT.DEFAULT;
            }
            if (fd.height == 0) {
              fd.height = SWT.DEFAULT;
            }
            control.setLayoutData(fd);
            Utils.relayout(control);
          }
          control.setData("v3.oldHeight", null);
        } else {
          final FormData fd = (FormData) control.getLayoutData();
          if (fd != null) {
            Point oldSize = new Point(fd.width, fd.height);
            if (oldSize.y <= 0) {
              oldSize = null;
            }
View Full Code Here

      SWTSkinObjectContainer soList = (SWTSkinObjectContainer) so;
     
      Composite parent = soList.getComposite();
     
      Canvas centerCanvas = new Canvas(parent, SWT.NONE);
      FormData fd = Utils.getFilledFormData();
      fd.bottom = null;
      fd.height = 0;
      centerCanvas.setLayoutData(fd);
     
     
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.