コード例 #1
0
    public Setting(Composite comp, String title) {
      final Composite settingComp = new Composite(comp, SWT.BORDER);
      settingComp.setLayout(new FillLayout(SWT.VERTICAL));

      final RowLayout infoLayout = new RowLayout();
      infoLayout.center = true;

      final Composite infoComp = new Composite(settingComp, SWT.NONE);
      infoComp.setLayout(infoLayout);

      final Label settingLabel = new Label(infoComp, SWT.CENTER);
      settingLabel.setText(title);

      settingValue = new Text(infoComp, SWT.BORDER | SWT.SINGLE);
      settingValue.setText("000");

      settingScale = new Scale(settingComp, SWT.BORDER);
      settingScale.setSize(200, 64);
      settingScale.setMaximum(50);
      settingScale.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event e) {
              settingValue.setText("" + settingScale.getSelection());
            }
          });
    }
コード例 #2
0
 ToolBar createToolbar(final MUIElement element, Composite intermediate) {
   int orientation = getOrientation(element);
   RowLayout layout =
       RowLayoutFactory.fillDefaults().wrap(false).spacing(0).type(orientation).create();
   layout.marginLeft = 3;
   layout.center = true;
   intermediate.setLayout(layout);
   ToolBar separatorToolBar =
       new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT);
   new ToolItem(separatorToolBar, SWT.SEPARATOR);
   return new ToolBar(intermediate, orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT);
 }
コード例 #3
0
  /**
   * Create a zoomable nodedisplay decorated with buttons to allow zooming.
   *
   * @param nodedisplay the decorated nodedisplay
   * @param parent parent composite for this new created nodedisplay
   */
  public NodedisplayViewZoomButtons(AbstractNodedisplayView nodedisplay, Composite parent) {

    super(nodedisplay, parent);

    north = new Composite(this, SWT.None);
    north.setLayoutData(new BorderData(BorderLayout.NFIELD));
    final RowLayout layout = new RowLayout();
    layout.spacing = 0;
    layout.center = true;
    north.setLayout(layout);

    font = new Font(Display.getCurrent(), "Monospaced", 12, SWT.BOLD); // $NON-NLS-1$
    // Make buttons as small as possible but identically sized
    minus = new Button(north, SWT.PUSH);
    minus.setText("-"); // $NON-NLS-1$
    minus.setFont(font);
    minus.pack();
    final int min = Math.min(minus.getSize().x, minus.getSize().y);

    addRectangleSizeComp();

    plus = new Button(north, SWT.PUSH);
    plus.setText("+"); // $NON-NLS-1$
    plus.setFont(font);
    plus.pack();
    final int min2 = Math.min(plus.getSize().x, plus.getSize().y);
    final int max = Math.max(min, min2);
    plus.setLayoutData(new RowData(max, max));
    minus.setLayoutData(new RowData(max, max));

    plus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            setRectangleSize(getRectangleSize() + 1);
          }
        });

    minus.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (getRectangleSize() > 1) {
              setRectangleSize(getRectangleSize() - 1);
            }
          }
        });
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createControl(Composite parent) {
    // adjust layout in order to produce space to the left
    Composite mainComposite = new Composite(parent, SWT.NONE);
    RowLayout layout = new RowLayout(SWT.FILL);
    layout.center = true;
    layout.marginLeft = 10;
    mainComposite.setLayout(layout);

    // create the check box button
    showToolTipButton = new Button(mainComposite, SWT.CHECK);
    showToolTipButton.setText(AndroidSnippetsNLS.TooltipDisplayConfigContriutionItem_ShowPreview);
    showToolTipButton.addSelectionListener(new TooltipSelectionListener());

    // set the selection persisted
    IEclipsePreferences preferences = getEclipsePreferences();
    boolean isTooltipDisplayed =
        preferences.getBoolean(DIALOG_SETTINGS__IS_TOOLTIP_DISPLAYED, true);
    showToolTipButton.setSelection(isTooltipDisplayed);
    performButtonSelection();

    return mainComposite;
  }
コード例 #5
0
    public AssertionComposite(
        final OrCondition orCondition,
        final Composite parent,
        final String attribute,
        final Type type) {
      // final fields
      super(parent, SWT.NONE);
      this.orCondition = orCondition;

      // widgets
      this.notCheck = createNotCheck();
      this.attributeText = createAttributeText(attribute);
      createFieldTypeLabel(type);
      this.assertionCombo = createAssertionCombo();
      this.valueText = createValueText();
      createRemoveButton();

      // layout
      final RowLayout layout = new RowLayout();
      layout.center = true;
      this.setLayout(layout);

      parent.notifyListeners(SWT.Resize, new org.eclipse.swt.widgets.Event());
    }
コード例 #6
0
ファイル: LoginPanel.java プロジェクト: sgewuhan/cpm
  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();
  }
コード例 #7
0
ファイル: PlayClient.java プロジェクト: kghost/PSP-NetParty
  public void createToolBar(final Composite parent, IAppWindow window) {
    GridLayout gridLayout;

    Composite container = new Composite(parent, SWT.NONE);
    gridLayout = new GridLayout(2, false);
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 3;
    gridLayout.marginHeight = 1;
    container.setLayout(gridLayout);

    ToolBar toolBar = new ToolBar(container, SWT.FLAT | SWT.RIGHT);
    toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    IAppWindow.Type type = window.getType();
    if (type != IAppWindow.Type.ARENA) {
      ToolItem arenaWindowItem = new ToolItem(toolBar, SWT.PUSH);
      arenaWindowItem.setText("アリーナ");
      arenaWindowItem.setToolTipText("部屋の検索やロビーのチャット");
      arenaWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_ARENA));
      arenaWindowItem.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event event) {
              arenaWindow.show();
            }
          });
    }
    if (type != IAppWindow.Type.ROOM) {
      ToolItem roomWindowItem = new ToolItem(toolBar, SWT.PUSH);
      roomWindowItem.setText("ルーム");
      roomWindowItem.setToolTipText("ルーム内で通信プレイができます");
      roomWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_ROOM));
      roomWindowItem.addListener(
          SWT.Selection,
          new Listener() {
            @Override
            public void handleEvent(Event event) {
              getRoomWindow().show();
            }
          });
    }

    ToolItem configWindowItem = new ToolItem(toolBar, SWT.PUSH);
    configWindowItem.setText("設定");
    configWindowItem.setToolTipText("アプリケーションの設定をします");
    configWindowItem.setImage(imageRegistry.get(ICON_TOOLBAR_CONFIG));
    configWindowItem.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            if (openConfigDialog(parent.getShell(), null)) {
              if (arenaWindow != null) arenaWindow.settingChanged();
              if (roomWindow != null) roomWindow.settingChanged();
            }
          }
        });

    ToolItem wikiItem = new ToolItem(toolBar, SWT.PUSH);
    wikiItem.setText("Wiki");
    wikiItem.setToolTipText(AppConstants.APP_NAME + "のWikiページを表示します");
    wikiItem.setImage(imageRegistry.get(ICON_TOOLBAR_WIKI));
    wikiItem.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            Program.launch("http://wiki.team-monketsu.net/");
          }
        });

    ToolItem exitItem = new ToolItem(toolBar, SWT.PUSH);
    exitItem.setText("終了");
    exitItem.setToolTipText(AppConstants.APP_NAME + "を終了します");
    exitItem.setImage(imageRegistry.get(ICON_TOOLBAR_EXIT));
    exitItem.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            if (openShutdownConfirmDialog(parent.getShell())) {
              isRunning = false;
            }
          }
        });

    Composite appVersionContainer = new Composite(container, SWT.NONE);
    appVersionContainer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    RowLayout rowLayout = new RowLayout();
    rowLayout.center = true;
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    rowLayout.marginLeft = 0;
    rowLayout.marginRight = 0;
    appVersionContainer.setLayout(rowLayout);

    Label statusApplicationVersionLabel = new Label(appVersionContainer, SWT.NONE);
    statusApplicationVersionLabel.setText("バージョン:");
    initControl(statusApplicationVersionLabel);

    Label statusApplicationVersionNumber = new Label(appVersionContainer, SWT.NONE);
    statusApplicationVersionNumber.setText(AppConstants.VERSION);
    statusApplicationVersionNumber.setForeground(colorRegistry.get(COLOR_APP_NUMBER));
    initControl(statusApplicationVersionNumber);

    Label statusApplicationProtocolLabel = new Label(appVersionContainer, SWT.NONE);
    statusApplicationProtocolLabel.setText("プロトコル:");
    initControl(statusApplicationProtocolLabel);

    Label statusApplicationProtocolNumber = new Label(appVersionContainer, SWT.NONE);
    statusApplicationProtocolNumber.setText(IProtocol.NUMBER);
    statusApplicationProtocolNumber.setForeground(colorRegistry.get(COLOR_APP_NUMBER));
    initControl(statusApplicationProtocolNumber);

    Label statusApplicationSsidLabel = new Label(appVersionContainer, SWT.NONE);
    statusApplicationSsidLabel.setText("SSID機能:");
    initControl(statusApplicationSsidLabel);

    Label statusApplicationSsidLibrary = new Label(appVersionContainer, SWT.NONE);
    toolbarSsidLibraryLabels.add(statusApplicationSsidLibrary);
    initControl(statusApplicationSsidLibrary);

    updateWlanLibraryStatus();
  }
コード例 #8
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();
  }
コード例 #9
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);
  }
コード例 #10
0
  private Composite createActions(
      final ChangeDetail changeDetail,
      final PatchSetDetail patchSetDetail,
      final PatchSetPublishDetail publishDetail,
      Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    RowLayout layout = new RowLayout();
    layout.center = true;
    layout.spacing = 10;
    buttonComposite.setLayout(layout);

    boolean canPublish =
        getTaskData()
            .getAttributeMapper()
            .getBooleanValue(
                getTaskData()
                    .getRoot()
                    .getAttribute(GerritTaskSchema.getDefault().CAN_PUBLISH.getKey()));
    boolean canSubmit = false;
    boolean canRebase = false;
    if (changeDetail.getCurrentActions() != null) {
      canSubmit = changeDetail.getCurrentActions().contains(ApprovalCategory.SUBMIT);
    } else if (changeDetail instanceof ChangeDetailX) {
      // Gerrit 2.2 and later
      canSubmit = ((ChangeDetailX) changeDetail).canSubmit();
      canRebase = ((ChangeDetailX) changeDetail).canRebase();
    }

    if (canPublish) {
      Button publishButton = toolkit.createButton(buttonComposite, "Publish Comments...", SWT.PUSH);
      publishButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doPublish(publishDetail);
            }
          });
    }

    Button fetchButton = toolkit.createButton(buttonComposite, "Fetch...", SWT.PUSH);
    fetchButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            doFetch(changeDetail, patchSetDetail);
          }
        });

    final Composite compareComposite = toolkit.createComposite(buttonComposite);
    GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(compareComposite);

    Button compareButton = toolkit.createButton(compareComposite, "Compare With Base", SWT.PUSH);
    compareButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            doCompareWith(changeDetail, null, patchSetDetail.getPatchSet());
          }
        });

    if (changeDetail.getPatchSets().size() > 1) {
      Button compareWithButton = toolkit.createButton(compareComposite, "", SWT.PUSH);
      GridDataFactory.fillDefaults().grab(false, true).applyTo(compareWithButton);
      compareWithButton.setImage(
          WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_BUTTON_MENU));
      compareWithButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              showCompareMenu(compareComposite, changeDetail, patchSetDetail);
            }

            private void showCompareMenu(
                Composite compareComposite,
                ChangeDetail changeDetail,
                PatchSetDetail patchSetDetail) {
              Menu menu = new Menu(compareComposite);
              Point p = compareComposite.getLocation();
              p.y = p.y + compareComposite.getSize().y;
              p = compareComposite.getParent().toDisplay(p);
              fillCompareWithMenu(changeDetail, patchSetDetail, menu);
              menu.setLocation(p);
              menu.setVisible(true);
            }
          });
    }

    if (canRebase) {
      Button rebaseButton = toolkit.createButton(buttonComposite, "Rebase", SWT.PUSH);
      rebaseButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doRebase(patchSetDetail.getPatchSet());
            }
          });
    }

    if (canSubmit) {
      Button submitButton = toolkit.createButton(buttonComposite, "Submit", SWT.PUSH);
      submitButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              doSubmit(patchSetDetail.getPatchSet());
            }
          });
    }

    if (changeDetail != null && changeDetail.isCurrentPatchSet(patchSetDetail)) {
      if (changeDetail.canAbandon()) {
        Button abondonButton = toolkit.createButton(buttonComposite, "Abandon...", SWT.PUSH);
        abondonButton.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                doAbandon(patchSetDetail.getPatchSet());
              }
            });
      } else if (changeDetail.canRestore()) {
        Button restoreButton = toolkit.createButton(buttonComposite, "Restore...", SWT.PUSH);
        restoreButton.addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                doRestore(patchSetDetail.getPatchSet());
              }
            });
      }
    }
    return buttonComposite;
  }