Exemplo n.º 1
0
  private void createButtonBarComposite(Composite parent) {
    Composite buttonBarComposite = new Composite(parent, SWT.NONE);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.CENTER;
    buttonBarComposite.setLayoutData(gridData);

    RowLayout rowLayout = new RowLayout();
    rowLayout.pack = false;
    buttonBarComposite.setLayout(rowLayout);

    Button okButton = new Button(buttonBarComposite, SWT.PUSH);
    okButton.setText("OK");
    okButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            okPressed();
          }
        });

    this.shell.setDefaultButton(okButton);

    Button cancelButton = new Button(buttonBarComposite, SWT.PUSH);
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            cancelPressed();
          }
        });
  }
Exemplo n.º 2
0
  public TreeMapLegend(
      Composite parent,
      TreeMap<TaxonomyNode> treeMap,
      TaxonomyModel model,
      TaxonomyNodeRenderer renderer) {
    super(parent, SWT.NONE);

    this.model = model;
    this.renderer = renderer;

    setBackground(parent.getBackground());

    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.wrap = true;
    layout.pack = true;
    layout.justify = false;
    setLayout(layout);

    treeMap.addSelectionChangeListener(
        new ISelectionChangeListener<TaxonomyNode>() {
          @Override
          public void selectionChanged(
              ITreeModel<IRectangle<TaxonomyNode>> model,
              IRectangle<TaxonomyNode> rectangle,
              String label) {
            TreeMapLegend.this.selectionChanged(model);
          }
        });
  }
Exemplo n.º 3
0
  public PerspectiveSwitcherBuilder(final Composite parent, final String subSetId) {
    super(parent, subSetId);
    GridLayout glayout = new GridLayout();
    glayout.marginBottom = 0;
    glayout.marginHeight = 0;

    parent.setLayout(glayout);
    background = new Composite(parent, SWT.NONE);
    background.setData(RWT.CUSTOM_VARIANT, ICSSConstants.COMP_TRANS); // $NON-NLS-1$
    background.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 1, 1));
    RowLayout layout = new RowLayout();
    background.setLayout(layout);
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = false;
    perspectiveButtonMap = new HashMap<IPerspectiveDescriptor, Button>();
    buttonPerspectiveMap = new HashMap<Button, IPerspectiveDescriptor>();
    buttonList = new ArrayList<Button>();
    perspectiveList = new ArrayList<String>();
    // images
    bgActive = getImage(ILayoutSetConstants.PERSP_BG_ACTIVE);
  }
  /*
   * (non-Javadoc)
   *
   * @see net.refractions.udig.style.sld.SLDEditorPart#createPartControl(org.eclipse.swt.widgets.Composite)
   */
  protected Control createPartControl(Composite parent) {
    myparent = parent;
    RowLayout layout = new RowLayout();
    myparent.setLayout(layout);
    layout.pack = false;
    layout.wrap = true;
    layout.type = SWT.HORIZONTAL;

    /* Border Opacity */
    Group borderOpacityArea = new Group(myparent, SWT.NONE);
    borderOpacityArea.setLayout(new GridLayout(2, false));
    borderOpacityArea.setText("Raster Opacity"); // $NON-NLS-1$

    opacityScale = new Scale(borderOpacityArea, SWT.HORIZONTAL);
    opacityScale.setMinimum(0);
    opacityScale.setMaximum(100);
    opacityScale.setPageIncrement(10);
    opacityScale.setBounds(0, 0, 10, SWT.DEFAULT);
    opacityScale.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            opacityText.setText(String.valueOf(opacityScale.getSelection()) + "%"); // $NON-NLS-1$
            opacityText.pack(true);
          }
        });
    opacityScale.addSelectionListener(this);

    opacityText = new Text(borderOpacityArea, SWT.BORDER | SWT.READ_ONLY);
    opacityText.pack(true);

    return parent;
  }
Exemplo n.º 5
0
  /**
   * @param parent - the parent Composite of this group
   * @param name - the name of this group
   * @param tokenKind - the tokenkind which is represented by this group
   */
  private void createGroup(
      Composite parent, String name, int tokenKind, SelectionListener changeListener) {
    Group g = null;
    boolean first = true;

    for (int i = 0; i < this.tokentypes.length; i++) {
      if (this.tokentypes[i].getKind() == tokenKind) {
        if (first) {
          g = new Group(parent, SWT.NONE);
          g.setText(name);

          GridData gd = new GridData(SWT.FILL);
          gd.widthHint = 300;
          g.setLayoutData(gd);

          RowLayout layout = new RowLayout();
          layout.pack = false;
          g.setLayout(layout);
          first = false;
        }

        TokenTypesCheckBox t =
            new TokenTypesCheckBox(g, this.tokentypes[i].getType(), this.tokentypes[i].getName());

        t.addSelectionListener(changeListener);
        this.checkBoxes[i] = t;
      }
    }
  }
Exemplo n.º 6
0
  /** This method initializes compButtons */
  protected void createCompButtons() {
    compButton = new Composite(getShell(), SWT.NONE);
    compButton.setBounds(new Rectangle(100, 520, 700, 40));
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = false;
    rowLayout.pack = false;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.spacing = 0;
    compButton.setLayout(rowLayout);
    btnIedeaExport = new Button(compButton, SWT.NONE);
    btnIedeaExport.setText(Messages.getString("NewReports.button.export.iedea")); // $NON-NLS-1$
    btnIedeaExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnIedeaExport.setLayoutData(new RowData(200, 30));
    btnIedeaExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip.iedea")); // $NON-NLS-1$
    btnIedeaExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdIedeaExportsSelected();
          }
        });

    btnDataExport = new Button(compButton, SWT.NONE);
    btnDataExport.setText(Messages.getString("NewReports.button.export")); // $NON-NLS-1$
    btnDataExport.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataExport.setLayoutData(new RowData(200, 30));
    btnDataExport.setToolTipText(
        Messages.getString("NewReports.button.export.tooltip")); // $NON-NLS-1$
    btnDataExport.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataExportsSelected();
          }
        });

    btnDataQuality = new Button(compButton, SWT.NONE);
    btnDataQuality.setText(Messages.getString("NewReports.button.dataQuality")); // $NON-NLS-1$
    btnDataQuality.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    btnDataQuality.setLayoutData(new RowData(200, 30));
    btnDataQuality.setToolTipText(
        Messages.getString("NewReports.button.dataQuality.tooltip")); // $NON-NLS-1$
    btnDataQuality.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          @Override
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            cmdDataQualitySelected();
          }
        });
    compButton.layout();
  }
    protected void createButtonBar(Composite parent) {
      parent.setLayout(new GridLayout(1, true));

      Composite buttons = new Composite(parent, SWT.NONE);
      buttons.setBackground(parent.getBackground());

      GridData buttonsData = new GridData(GridData.FILL_BOTH);
      buttonsData.horizontalAlignment = SWT.RIGHT;
      buttons.setLayoutData(buttonsData);

      RowLayout rl = new RowLayout();
      rl.pack = false;
      rl.spacing = 5;
      buttons.setLayout(rl);

      final Button okButton = new Button(buttons, SWT.PUSH);
      okButton.setText("Ok");
      okButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              okPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });

      final Button cancelButton = new Button(buttons, SWT.PUSH);
      cancelButton.setText("Cancel");
      cancelButton.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              cancelPressed();
            }

            public void widgetDefaultSelected(SelectionEvent e) {}
          });
      if (Display.getCurrent().getDismissalAlignment() == SWT.RIGHT) {
        cancelButton.moveAbove(okButton);
      }
      this.getShell().setDefaultButton(okButton);
    }
  public Composite createPartControl(Composite parent) {
    content = new Composite(parent, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = true;
    rowLayout.fill = true;
    rowLayout.justify = false;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.marginLeft = 2;
    rowLayout.marginTop = 2;
    rowLayout.marginRight = 2;
    rowLayout.marginBottom = 2;
    rowLayout.spacing = 3;
    content.setLayout(rowLayout);

    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    themeManager.addPropertyChangeListener(themeChangeListener);
    ITheme theme = themeManager.getCurrentTheme();
    setTheme(theme);

    content.addMouseListener(mouseListener);

    return content;
  }
Exemplo n.º 9
0
  public LoginPanel(Shell page, Composite parent) {
    super(parent, SWT.NONE);
    this.shell = page;

    setLayout(new GridLayout());
    // ´´½¨µÇ¼ÇøÓòµÄÓû§±êÇ© Óû§ÃûÊäÈë¿ò ÃÜÂë±êÇ© ÃÜÂëÊäÈë¿ò µÇ¼°´Å¥
    Composite panelTop = new Composite(this, SWT.NONE);
    panelTop.setBackgroundMode(SWT.INHERIT_DEFAULT);

    RowLayout layout = new RowLayout();
    layout.spacing = 40;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = true;
    layout.center = true;

    panelTop.setLayout(layout);

    userText = new Text(panelTop, SWT.BORDER);
    RowData rd = new RowData();
    rd.width = 240;
    userText.setMessage("Õʺš¢Óû§Ãû»òÕßemail");
    userText.setLayoutData(rd);
    userText.setData(RWT.CUSTOM_VARIANT, "loginInput");
    userText.setFocus();

    passwordText = new Text(panelTop, SWT.BORDER | SWT.PASSWORD);
    rd = new RowData();
    rd.width = 220;
    passwordText.setMessage("ÊäÈëµÇ¼ÃÜÂë");
    passwordText.setLayoutData(rd);
    passwordText.setData(RWT.CUSTOM_VARIANT, "loginInput");

    okButton = new Button(panelTop, SWT.PUSH);
    okButton.setData(RWT.CUSTOM_VARIANT, "loginInput");
    rd = new RowData();
    rd.width = 50;
    rd.height = 50;
    okButton.setLayoutData(rd);
    page.setDefaultButton(okButton);
    okButton.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            buttonPressed();
          }
        });

    // ´´½¨±£´æÃÜÂë¹´Ñ¡¿òºÍ±£´æÓû§Ãû¹´Ñ¡¿ò
    Composite panelBottom = new Composite(this, SWT.NONE);

    layout = new RowLayout();
    layout.spacing = 4;
    layout.marginBottom = 0;
    layout.marginRight = 10;
    layout.marginTop = 0;
    layout.wrap = false;
    layout.pack = true;

    panelBottom.setLayout(layout);

    saveIdButton = new Button(panelBottom, SWT.CHECK);
    saveIdButton.setText("±£´æµÇ¼ÕʺÅ");
    saveIdButton.setData(RWT.CUSTOM_VARIANT, "loginCheck");

    savePassButton = new Button(panelBottom, SWT.CHECK);
    savePassButton.setText("±£´æµÇ¼ÃÜÂë");
    savePassButton.setData(RWT.CUSTOM_VARIANT, "loginCheck");

    // cookie save
    String uid = RWT.getSettingStore().getAttribute(COOKIE_UI_USERID);
    if (uid != null && uid.length() > 0) {
      userText.setText(uid);
      saveIdButton.setSelection(true);
    }
    // cookie save
    String psd = RWT.getSettingStore().getAttribute(COOKIE_UI_PASSWORD);
    if (psd != null && psd.length() > 0) {
      passwordText.setText(psd);
      savePassButton.setSelection(true);
    }

    panelTop.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false));
    panelBottom.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));

    createTooltips();
  }
Exemplo n.º 10
0
  private void initIcons(ApplicationFactory factory) {
    Composite center = null;
    if (Application.LICENSE == Install.PERSONAL) {
      center = new Composite(this, SWT.TRANSPARENCY_ALPHA);
      GridData gridData = new GridData(GridData.FILL_BOTH);
      center.setLayoutData(gridData);

      GridLayout gridLayout = new GridLayout(2, false);
      center.setLayout(gridLayout);

      Browser widget = null;

      //      ClientLog.getInstance().setMessage(getShell(), new Exception( "buoc 1 da chay vao day
      // roi " + widget.toString()));

      try {
        widget = new Browser(center, SWT.NONE);
        //        ClientLog.getInstance().setMessage(getShell(), new Exception( " da chay vao day
        // roi " + widget.toString()));
      } catch (Exception e) {
        widget = new Browser(center, SWT.NONE);
        ClientLog.getInstance().setException(null, e);
      }
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.verticalSpan = 2;
      widget.setLayoutData(gridData);
      if (Application.GROUPS.length > 0 && Application.GROUPS[0].equals("XML")) {
        widget.setUrl("http://vietspider.org/webextractor/");
        toolbar.setText("http://vietspider.org/webextractor/");
      } else {
        widget.setUrl("http://nik.vn/tin/");
        //      widget.setUrl("http://*****:*****@SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            BrowserWidget browser = workspace.getTab().createItem();
            browser.viewPage();
          }
        };
    browserImageLink.addHyperlinkListener(listener);
    //    browserLink.addHyperlinkListener(listener);

    composite = createItem(top);
    final ImageHyperlink creatorImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    creatorImageLink.setImage(factory.loadImage("large.createsource.png"));
    //    creatorImageLink.setBackground(getBackground());
    creatorImageLink.setToolTipText(factory.getLabel("creatorLink"));
    //    final Hyperlink creatorLink = createLink(composite);
    //    creatorLink.setText(factory.getLabel("creatorLink"));
    //    creatorLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        creatorLink.setUnderlined(false);
            try {
              ChannelWizard wizard =
                  (ChannelWizard)
                      workspace.getTab().createTool(ChannelWizard.class, false, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(null, exp);
            }
            //        try {
            //          Creator creator = (Creator)workspace.getTab().createTool(
            //              Creator.class, false,  SWT.CLOSE);
            //          creator.selectData(new Worker[0], null, null);
            //        } catch (Exception exp) {
            //          ClientLog.getInstance().setException(null, exp);
            //        }
          }
        };
    creatorImageLink.addHyperlinkListener(listener);
    //    creatorLink.addHyperlinkListener(listener);

    ////////////////////////////////////////////////////////////////////////////////////////////////

    Composite bottom = new Composite(center, SWT.TRANSPARENCY_ALPHA);
    if (Application.LICENSE == Install.PERSONAL) {
      gridData = new GridData();
      gridData.widthHint = 350;
    } else {
      gridData = new GridData(GridData.FILL_BOTH);
    }
    bottom.setLayoutData(gridData);
    //    bottom.setBackground(getBackground());

    rowLayout = new RowLayout();
    rowLayout.wrap = true;
    rowLayout.pack = true;
    rowLayout.justify = true;
    rowLayout.type = SWT.HORIZONTAL;
    rowLayout.marginLeft = 5;
    rowLayout.marginTop = 5;
    rowLayout.marginRight = 5;
    rowLayout.marginBottom = 5;
    rowLayout.spacing = 20;
    bottom.setLayout(rowLayout);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(top);
    } else {
      composite = createItem(bottom);
    }
    final ImageHyperlink crawlerImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    crawlerImageLink.setImage(factory.loadImage("large.crawler.png"));
    //    crawlerImageLink.setBackground(getBackground());
    crawlerImageLink.setToolTipText(factory.getLabel("crawlerLink"));
    //    final Hyperlink crawlerLink = createLink(composite);
    //    crawlerLink.setText(factory.getLabel("crawlerLink"));
    //    crawlerLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        crawlerLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Crawler.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(getShell(), exp);
            }
          }
        };
    crawlerImageLink.addHyperlinkListener(listener);
    //    crawlerLink.addHyperlinkListener(listener);

    if (Application.LICENSE != Install.PERSONAL) {
      composite = createItem(bottom);
      final ImageHyperlink monitorImageLink =
          new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
      monitorImageLink.setImage(factory.loadImage("large.log.png"));
      //      monitorImageLink.setBackground(getBackground());
      monitorImageLink.setToolTipText(factory.getLabel("logLink"));
      //      final Hyperlink monitorLink = createLink(composite);
      //      monitorLink.setText(factory.getLabel("monitorLink"));
      //      monitorLink.setForeground(color);
      listener =
          new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
              try {
                workspace.getTab().createTool(LogViewer2.class, true, SWT.CLOSE);
              } catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
      monitorImageLink.addHyperlinkListener(listener);
      //      monitorLink.addHyperlinkListener(listener);
    }

    /*if(Application.LICENSE  != Install.PERSONAL) {
          composite = createItem(bottom);
          final ImageHyperlink userImageLink =
            new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
          userImageLink.setImage(factory.loadImage("large.userfolder.png"));
    //      userImageLink.setBackground(getBackground());
          userImageLink.setToolTipText(factory.getLabel("userLink"));
    //      final Hyperlink userLink = createLink(composite);
    //      userLink.setText(factory.getLabel("userLink"));
    //      userLink.setForeground(color);
          listener = new HyperlinkAdapter() {
            @SuppressWarnings("unused")
            public void linkEntered(HyperlinkEvent e) {
    //          userLink.setUnderlined(true);
            }

            @SuppressWarnings("unused")
            public void linkExited(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
    //          userLink.setFont(UIDATA.FONT_9VB);
            }
            @SuppressWarnings("unused")
            public void linkActivated(HyperlinkEvent e) {
    //          userLink.setUnderlined(false);
              try {
                workspace.getTab().createTool(Organization.class, true,  SWT.CLOSE);
              }catch (Exception exp) {
                ClientLog.getInstance().setException(workspace.getShell(), exp);
              }
            }
          };
          userImageLink.addHyperlinkListener(listener);
    //      userLink.addHyperlinkListener(listener);
        }*/

    composite = createItem(bottom);

    final ImageHyperlink configImageLink =
        new ImageHyperlink(composite, SWT.CENTER | SWT.TRANSPARENCY_ALPHA);
    configImageLink.setImage(factory.loadImage("large.settingsfolder.png"));
    //    configImageLink.setBackground(getBackground());
    configImageLink.setToolTipText(factory.getLabel("configLink"));
    //    final Hyperlink configLink = createLink(composite);
    //    configLink.setText(factory.getLabel("configLink"));
    //    configLink.setForeground(color);
    listener =
        new HyperlinkAdapter() {
          @SuppressWarnings("unused")
          public void linkEntered(HyperlinkEvent e) {
            //        configLink.setUnderlined(true);
          }

          @SuppressWarnings("unused")
          public void linkExited(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
          }

          @SuppressWarnings("unused")
          public void linkActivated(HyperlinkEvent e) {
            //        configLink.setUnderlined(false);
            try {
              workspace.getTab().createTool(Config.class, true, SWT.CLOSE);
            } catch (Exception exp) {
              ClientLog.getInstance().setException(workspace.getShell(), exp);
            }
          }
        };
    configImageLink.addHyperlinkListener(listener);
  }
Exemplo n.º 11
0
  /**
   * Create contents of the wizard.
   *
   * @param parent the parent widget
   */
  @Override
  @SuppressWarnings("unused") // Don't warn about unassigned "new Label(.)": has side-effect
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    setControl(container);
    GridLayout glContainer = new GridLayout(2, false);
    glContainer.marginWidth = 0;
    glContainer.horizontalSpacing = 0;
    glContainer.marginHeight = 0;
    glContainer.verticalSpacing = 0;
    container.setLayout(glContainer);

    ScrolledComposite configurationScrollArea = new ScrolledComposite(container, SWT.V_SCROLL);
    configurationScrollArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
    configurationScrollArea.setExpandHorizontal(true);
    configurationScrollArea.setExpandVertical(true);

    mConfigurationArea = new Composite(configurationScrollArea, SWT.NONE);
    GridLayout glConfigurationArea = new GridLayout(3, false);
    glConfigurationArea.horizontalSpacing = 0;
    glConfigurationArea.marginRight = 15;
    glConfigurationArea.marginWidth = 0;
    glConfigurationArea.marginHeight = 0;
    mConfigurationArea.setLayout(glConfigurationArea);

    Label foregroundLabel = new Label(mConfigurationArea, SWT.NONE);
    foregroundLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    foregroundLabel.setText("Foreground:");

    Composite foregroundComposite = new Composite(mConfigurationArea, SWT.NONE);
    foregroundComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout glForegroundComposite = new GridLayout(5, false);
    glForegroundComposite.horizontalSpacing = 0;
    foregroundComposite.setLayout(glForegroundComposite);

    mImageRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mImageRadio.setSelection(false);
    mImageRadio.addSelectionListener(this);
    mImageRadio.setText("Image");

    mClipartRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mClipartRadio.setText("Clipart");
    mClipartRadio.addSelectionListener(this);

    mTextRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mTextRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    mTextRadio.setText("Text");
    mTextRadio.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    mForegroundArea = new Composite(mConfigurationArea, SWT.NONE);
    mForegroundArea.setLayout(new StackLayout());
    mForegroundArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

    mImageForm = new Composite(mForegroundArea, SWT.NONE);
    mImageForm.setLayout(new GridLayout(3, false));

    Label fileLabel = new Label(mImageForm, SWT.NONE);
    fileLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fileLabel.setText("Image File:");

    mImagePathText = new Text(mImageForm, SWT.BORDER);
    GridData pathLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    pathLayoutData.widthHint = 200;
    mImagePathText.setLayoutData(pathLayoutData);
    mImagePathText.addSelectionListener(this);
    mImagePathText.addModifyListener(this);

    mPickImageButton = new Button(mImageForm, SWT.FLAT);
    mPickImageButton.setText("Browse...");
    mPickImageButton.addSelectionListener(this);

    mClipartForm = new Composite(mForegroundArea, SWT.NONE);
    mClipartForm.setLayout(new GridLayout(2, false));

    mChooseClipart = new Button(mClipartForm, SWT.FLAT);
    mChooseClipart.setText("Choose...");
    mChooseClipart.addSelectionListener(this);

    mClipartPreviewPanel = new Composite(mClipartForm, SWT.NONE);
    RowLayout rlClipartPreviewPanel = new RowLayout(SWT.HORIZONTAL);
    rlClipartPreviewPanel.marginBottom = 0;
    rlClipartPreviewPanel.marginTop = 0;
    rlClipartPreviewPanel.center = true;
    mClipartPreviewPanel.setLayout(rlClipartPreviewPanel);
    mClipartPreviewPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    mTextForm = new Composite(mForegroundArea, SWT.NONE);
    mTextForm.setLayout(new GridLayout(2, false));

    Label textLabel = new Label(mTextForm, SWT.NONE);
    textLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    textLabel.setText("Text:");

    mText = new Text(mTextForm, SWT.BORDER);
    mText.setText("Aa");
    mText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    mText.addModifyListener(this);

    Label fontLabel = new Label(mTextForm, SWT.NONE);
    fontLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fontLabel.setText("Font:");

    mFontButton = new Button(mTextForm, SWT.FLAT);
    mFontButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    mFontButton.addSelectionListener(this);
    mFontButton.setText("Choose Font...");
    new Label(mConfigurationArea, SWT.NONE);

    mTrimCheckBox = new Button(mConfigurationArea, SWT.CHECK);
    mTrimCheckBox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mTrimCheckBox.setSelection(false);
    mTrimCheckBox.setText("Trim Surrounding Blank Space");
    mTrimCheckBox.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    Label paddingLabel = new Label(mConfigurationArea, SWT.NONE);
    paddingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    paddingLabel.setText("Additional Padding:");
    new Label(mConfigurationArea, SWT.NONE);

    mPaddingSlider = new Slider(mConfigurationArea, SWT.NONE);
    mPaddingSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    // This doesn't work right -- not sure why. For now just use a plain slider
    // and subtract 10 from it to get the real range.
    // mPaddingSlider.setValues(0, -10, 50, 0, 1, 10);
    mPaddingSlider.setSelection(10 + 15);
    mPaddingSlider.addSelectionListener(this);

    mPercentLabel = new Label(mConfigurationArea, SWT.NONE);
    mPercentLabel.setText("  15%"); // Enough available space for -10%

    mScalingLabel = new Label(mConfigurationArea, SWT.NONE);
    mScalingLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mScalingLabel.setText("Foreground Scaling:");

    mScalingComposite = new Composite(mConfigurationArea, SWT.NONE);
    mScalingComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mScalingComposite = new GridLayout(5, false);
    gl_mScalingComposite.horizontalSpacing = 0;
    mScalingComposite.setLayout(gl_mScalingComposite);

    mCropRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCropRadio.setSelection(true);
    mCropRadio.setText("Crop");
    mCropRadio.addSelectionListener(this);

    mCenterRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCenterRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCenterRadio.setText("Center");
    mCenterRadio.addSelectionListener(this);

    mShapeLabel = new Label(mConfigurationArea, SWT.NONE);
    mShapeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mShapeLabel.setText("Shape");

    mShapeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mShapeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mShapeComposite = new GridLayout(5, false);
    gl_mShapeComposite.horizontalSpacing = 0;
    mShapeComposite.setLayout(gl_mShapeComposite);

    mSquareRadio = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mSquareRadio.setSelection(true);
    mSquareRadio.setText("Square");
    mSquareRadio.addSelectionListener(this);

    mCircleButton = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mCircleButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCircleButton.setText("Circle");
    mCircleButton.addSelectionListener(this);

    mThemeLabel = new Label(mConfigurationArea, SWT.NONE);
    mThemeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mThemeLabel.setText("Theme");

    mThemeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mThemeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    GridLayout gl_mThemeComposite = new GridLayout(2, false);
    gl_mThemeComposite.horizontalSpacing = 0;
    mThemeComposite.setLayout(gl_mThemeComposite);

    mHoloLightRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloLightRadio.setText("Holo Light");
    mHoloLightRadio.setSelection(true);
    mHoloLightRadio.addSelectionListener(this);

    mHoloDarkRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloDarkRadio.setText("Holo Dark");
    mHoloDarkRadio.addSelectionListener(this);

    mBgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mBgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mBgColorLabel.setText("Background Color:");

    mBgButton = new Button(mConfigurationArea, SWT.FLAT);
    mBgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mBgButton.addSelectionListener(this);
    mBgButton.setAlignment(SWT.CENTER);

    mFgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mFgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mFgColorLabel.setText("Foreground Color:");

    mFgButton = new Button(mConfigurationArea, SWT.FLAT);
    mFgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mFgButton.setAlignment(SWT.CENTER);
    mFgButton.addSelectionListener(this);

    if (SUPPORT_LAUNCHER_ICON_TYPES) {
      mEffectsLabel = new Label(mConfigurationArea, SWT.NONE);
      mEffectsLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
      mEffectsLabel.setText("Foreground Effects:");

      mEffectsComposite = new Composite(mConfigurationArea, SWT.NONE);
      mEffectsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
      GridLayout gl_mEffectsComposite = new GridLayout(5, false);
      gl_mEffectsComposite.horizontalSpacing = 0;
      mEffectsComposite.setLayout(gl_mEffectsComposite);

      mSimpleRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mSimpleRadio.setSelection(true);
      mSimpleRadio.setText("Simple");
      mSimpleRadio.addSelectionListener(this);

      mFancyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mFancyRadio.setText("Fancy");
      mFancyRadio.addSelectionListener(this);

      mGlossyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mGlossyRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
      mGlossyRadio.setText("Glossy");
      mGlossyRadio.addSelectionListener(this);
    }

    configurationScrollArea.setContent(mConfigurationArea);
    configurationScrollArea.setMinSize(mConfigurationArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Label previewLabel = new Label(container, SWT.NONE);
    previewLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    previewLabel.setText("Preview:");

    mPreviewArea = new Composite(container, SWT.BORDER);

    RowLayout rlPreviewAreaPreviewArea = new RowLayout(SWT.HORIZONTAL);
    rlPreviewAreaPreviewArea.wrap = true;
    rlPreviewAreaPreviewArea.pack = true;
    rlPreviewAreaPreviewArea.center = true;
    rlPreviewAreaPreviewArea.spacing = 0;
    rlPreviewAreaPreviewArea.marginBottom = 0;
    rlPreviewAreaPreviewArea.marginTop = 0;
    rlPreviewAreaPreviewArea.marginRight = 0;
    rlPreviewAreaPreviewArea.marginLeft = 0;
    mPreviewArea.setLayout(rlPreviewAreaPreviewArea);
    GridData gdMPreviewArea = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
    gdMPreviewArea.widthHint = PREVIEW_AREA_WIDTH;
    mPreviewArea.setLayoutData(gdMPreviewArea);

    // Initial color
    Display display = parent.getDisplay();
    // updateColor(display, new RGB(0xa4, 0xc6, 0x39), true /*background*/);
    updateColor(display, new RGB(0xff, 0x00, 0x00), true /*background*/);
    updateColor(display, new RGB(0x00, 0x00, 0x00), false /*background*/);

    // Start out showing the image form
    // mImageRadio.setSelection(true);
    // chooseForegroundTab(mImageRadio, mImageForm);
    // No, start out showing the text, since the user doesn't have to enter anything
    // initially and we still get images
    mTextRadio.setSelection(true);
    chooseForegroundTab(mTextRadio, mTextForm);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);

    validatePage();
  }
Exemplo n.º 12
0
  @Override
  public void createPartControl(Composite parent) {

    super.createPartControl(parent);

    messages.traceTech("init the form...", getClass());

    toolkit = new FormToolkit(parent.getDisplay());
    parent.setLayout(new FillLayout());
    form = toolkit.createScrolledForm(parent);

    RowLayout layout = new RowLayout(SWT.VERTICAL);
    layout.center = false;
    layout.fill = false;
    layout.pack = true;
    layout.justify = false;
    form.getBody().setLayout(layout);

    form.getBody()
        .addControlListener(
            new ControlListener() {

              @Override
              public void controlResized(ControlEvent e) {
                manageResized();
              }

              @Override
              public void controlMoved(ControlEvent e) {}
            });

    labelIteration = toolkit.createLabel(form.getBody(), "not data displayed yet");
    // TODO separator toolkit.createSeparator(form.getBody(), );
    compositeCharts = toolkit.createComposite(form.getBody());
    compositeCharts.setLayoutData(new RowData());
    compositeCharts.setLayout(new GridLayout(1, false));

    // create the chart

    // create dataset
    dataset = new DefaultCategoryDataset();

    // create plot
    plot = new EnhancedSpiderWebPlot(dataset);
    plot.setMaxValue(1.0);
    plot.setWebFilled(true);
    plot.setInteriorGap(0.2D);
    plot.setBackgroundPaint(Color.WHITE);

    // create chart
    chart = new JFreeChart("1th Pareto front", TextTitle.DEFAULT_FONT, plot, false);
    LegendTitle legendtitle = new LegendTitle(plot);
    legendtitle.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(legendtitle);
    chart.getPlot().setBackgroundPaint(Color.white);
    chart.setBackgroundPaint(Color.WHITE);

    // create host composite
    chartComposites =
        new ChartComposite(
            compositeCharts, SWT.NONE, chart, true // use a buffer
            );
    chartComposites.setSize(preferedWidth, preferedHeight);
    chartComposites.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    chartComposites.setBackground(compositeCharts.getBackground());

    // update display
    form.getBody().layout(true);

    form.reflow(true);
  }
Exemplo n.º 13
0
  /** build the view */
  private void buildView() {
    GridLayout gridLayout = new GridLayout(2, false);
    final Composite comp = new Composite(shell, SWT.NONE);

    shell.setLayout(new FillLayout());

    comp.setLayout(gridLayout);

    GridData gridData = new GridData();

    dataList = new List(comp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
    gridData = new GridData();
    gridData.widthHint = 200;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalSpan = 2;
    dataList.setLayoutData(gridData);
    dataList.addListener(SWT.Selection, new ListListener());

    dataTable = new Table(comp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    dataTable.setLinesVisible(true);
    dataTable.setHeaderVisible(true);

    gridData = new GridData();
    gridData.verticalAlignment = SWT.FILL;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    dataTable.setLayoutData(gridData);

    final TableColumn column1 = new TableColumn(dataTable, SWT.NONE);
    final TableColumn column2 = new TableColumn(dataTable, SWT.NONE);

    column1.setText("Time");
    column2.setText("Value");
    column1.setWidth(180);
    column2.setWidth(270);

    Composite buttonsComp = new Composite(comp, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.heightHint = 40;
    buttonsComp.setLayoutData(gridData);
    RowLayout rowLayout = new RowLayout();
    rowLayout.type = SWT.HORIZONTAL;

    rowLayout.justify = true;
    rowLayout.pack = true;
    buttonsComp.setLayout(rowLayout);

    ButtonListener bl = new ButtonListener();

    Button refreshButton = new Button(buttonsComp, SWT.NONE);
    refreshButton.setText("Refresh");
    refreshButton.addSelectionListener(bl);

    Button exportButton = new Button(buttonsComp, SWT.NONE);
    exportButton.setText("Export");
    exportButton.addSelectionListener(bl);

    Button deleteButton = new Button(buttonsComp, SWT.NONE);
    deleteButton.setText("Delete Selection");
    deleteButton.addSelectionListener(bl);

    Button deleteallButton = new Button(buttonsComp, SWT.NONE);
    deleteallButton.setText("Delete all");
    deleteallButton.addSelectionListener(bl);
  }
Exemplo n.º 14
0
  /**
   * show one popup menu over the main window
   *
   * @param menu_entry actual entry which should be shown or disposed
   * @param move TRUE if the curser be moved over one entry, otherwise by clicking false
   */
  private void show(String menu_entry, boolean move) {
    Point abs;
    Group popup;
    Rectangle rect, popup_rect = new Rectangle(0, 0, 120, 100);
    TreeNodes node;
    RowLayout l;
    ArrayList<TreeNodes> nodes;
    ArrayList<Composite> comps;

    if (move && m_sMenu.equals("")) {
      return;
    }
    if (!m_sMenu.equals(menu_entry)) {
      if (m_popupShell != null) m_popupShell.dispose();
      popup = m_mRootEntrys.get(menu_entry);
      rect = popup.getBounds();
      m_popupShell = new Shell(m_oTopLevelShell, SWT.NO_TRIM);
      // popup_rect= m_popupShell.getClientArea();
      abs = LayoutLoader.getAbsoluteUseFieldPoint();
      popup_rect.x = m_oMenu.getBounds().x + abs.x + rect.x;
      popup_rect.y = abs.y + rect.y + rect.height;
      l = new RowLayout();
      l.type = SWT.VERTICAL;
      l.pack = false;
      l.marginBottom = 0;
      l.marginHeight = 0;
      l.marginLeft = 0;
      l.marginRight = 0;
      l.marginTop = 0;
      l.marginWidth = 0;
      l.spacing = 0;
      m_popupShell.setLayout(l);
      node = m_mRootNodes.get(menu_entry);
      nodes = node.getChilds();
      m_sMenu = menu_entry;
      if (nodes.size() == 0) {
        m_sMenu = "";
        return;
      }
      comps = new ArrayList<Composite>();
      for (TreeNodes subnode : nodes) {
        RowLayout layout = new RowLayout();
        Composite comp = new Group(m_popupShell, SWT.NONE);
        Label text = new Label(comp, SWT.NONE);
        HashMap<String, String> metablock = subnode.getMetaData();
        String popupspace = metablock.get("popupspace");
        final String entry;
        int space = 20;
        FontObject font = new FontObject();
        int popupsize = 0;
        boolean bold = false;
        boolean italic = false;
        String looks, ssize;
        MouseListener listener1, listener2;

        entry = m_sMenu + "/" + subnode.getName();
        ssize = metablock.get("popupfontsize");
        if (ssize != null) popupsize = Integer.parseInt(ssize);
        looks = metablock.get("popupstyle");
        if (looks != null) {
          String[] split;

          split = looks.split(",");
          for (int i = 0; i < split.length; ++i) {
            split[i] = split[i].trim().toLowerCase();
            if (split[i].equals("bold")) bold = true;
            else if (split[i].equals("italic")) italic = true;
          }
        }
        font.defineColor(popup, metablock.get("popupcolor"), colors.WIDGET, entry + " popup");
        font.defineColor(popup, metablock.get("popupfontcolor"), colors.TEXT, entry + " popup");
        font.defineFont(
            popup, metablock.get("popupfont"), popupsize, bold, italic, /*underline*/ false);
        text.setText(subnode.getTitle().trim());
        if (popupspace != null) space = Integer.parseInt(popupspace);
        layout.type = SWT.VERTICAL;
        layout.marginTop = space;
        layout.marginRight = space;
        layout.marginBottom = space;
        layout.marginLeft = space;
        comp.setLayout(layout);
        font.setDevice(comp);
        font.setDevice(text);
        font.dispose();
        comps.add(comp);
        text.addMouseListener(
            listener1 =
                new MouseAdapter() {
                  public void mouseDown(MouseEvent event) {
                    LayoutLoader loader;
                    Thread t = null;

                    if (HtmTags.lockDebug) {
                      t = Thread.currentThread();
                      System.out.println(t.getName() + " want to setActiveSideVisible of " + entry);
                    }
                    loader = LayoutLoader.instance();
                    loader.m_sAktFolder = entry;
                    synchronized (TreeNodes.m_DISPLAYLOCK) {
                      loader.setCurrentSideVisible(/*inform server by no body*/ true);
                    }
                    m_nPopup = m_popupShell.getBounds();
                    destroyPopupShell();
                    m_sMenu = "";
                  }
                });
        m_aPopupListeners.put(text, listener1);
        comp.addMouseListener(
            listener2 =
                new MouseAdapter() {
                  public void mouseDown(MouseEvent event) {
                    LayoutLoader loader;
                    Thread t = null;

                    if (HtmTags.lockDebug) {
                      t = Thread.currentThread();
                      System.out.println(t.getName() + " want to setActiveSideVisible of " + entry);
                    }
                    loader = LayoutLoader.instance();
                    loader.m_sAktFolder = entry;
                    synchronized (TreeNodes.m_DISPLAYLOCK) {
                      loader.setCurrentSideVisible(/*inform server by no body*/ true);
                    }
                    m_nPopup = m_popupShell.getBounds();
                    destroyPopupShell();
                    m_sMenu = "";
                  }
                });
        m_aPopupListeners.put(comp, listener2);
      }

      if (m_nPopup != null) popup_rect = m_nPopup;
      m_popupShell.setBounds(popup_rect);
      m_popupShell.setEnabled(false);
      m_popupShell.setVisible(false);
      m_popupShell.open();
      m_popupShell.pack();
      m_popupShell.setEnabled(true);
      m_popupShell.setVisible(true);

    } else if (!m_sMenu.equals("") && !move) { // actual popup is the same
      m_popupShell.dispose();
      m_sMenu = "";
    }
  }