示例#1
0
  /** Creates the "Control" group. */
  void createControlGroup() {
    /*
     * Create the "Control" group.  This is the group on the
     * right half of each example tab.  It consists of the
     * style group, the display group and the size group.
     */
    controlGroup = new Group(tabFolderPage, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    controlGroup.setLayout(gridLayout);
    gridLayout.numColumns = 2;
    gridLayout.makeColumnsEqualWidth = true;
    controlGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    controlGroup.setText(ControlExample.getResourceString("Parameters"));

    /*
     * Create a group to hold the dialog style combo box and
     * create dialog button.
     */
    dialogStyleGroup = new Group(controlGroup, SWT.NONE);
    dialogStyleGroup.setLayout(new GridLayout());
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    gridData.horizontalSpan = 2;
    dialogStyleGroup.setLayoutData(gridData);
    dialogStyleGroup.setText(ControlExample.getResourceString("Dialog_Type"));
  }
示例#2
0
  /** Creates the "Example" group. */
  void createExampleGroup() {
    super.createExampleGroup();
    exampleGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    /*
     * Create a group for the text widget to display
     * the results returned by the example dialogs.
     */
    resultGroup = new Group(exampleGroup, SWT.NONE);
    resultGroup.setLayout(new GridLayout());
    resultGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    resultGroup.setText(ControlExample.getResourceString("Dialog_Result"));
  }
示例#3
0
  /** Creates the "Control" widget children. */
  void createControlWidgets() {

    /* Create the combo */
    String[] strings = {
      ControlExample.getResourceString("ColorDialog"),
      ControlExample.getResourceString("DirectoryDialog"),
      ControlExample.getResourceString("FileDialog"),
      ControlExample.getResourceString("FontDialog"),
      ControlExample.getResourceString("PrintDialog"),
      ControlExample.getResourceString("MessageBox"),
    };
    dialogCombo = new Combo(dialogStyleGroup, SWT.READ_ONLY);
    dialogCombo.setItems(strings);
    dialogCombo.setText(strings[0]);
    dialogCombo.setVisibleItemCount(strings.length);

    /* Create the create dialog button */
    createButton = new Button(dialogStyleGroup, SWT.NONE);
    createButton.setText(ControlExample.getResourceString("Create_Dialog"));
    createButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));

    /* Create a group for the various dialog button style controls */
    Group buttonStyleGroup = new Group(controlGroup, SWT.NONE);
    buttonStyleGroup.setLayout(new GridLayout());
    buttonStyleGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    buttonStyleGroup.setText(ControlExample.getResourceString("Button_Styles"));

    /* Create the button style buttons */
    okButton = new Button(buttonStyleGroup, SWT.CHECK);
    okButton.setText("SWT.OK");
    cancelButton = new Button(buttonStyleGroup, SWT.CHECK);
    cancelButton.setText("SWT.CANCEL");
    yesButton = new Button(buttonStyleGroup, SWT.CHECK);
    yesButton.setText("SWT.YES");
    noButton = new Button(buttonStyleGroup, SWT.CHECK);
    noButton.setText("SWT.NO");
    retryButton = new Button(buttonStyleGroup, SWT.CHECK);
    retryButton.setText("SWT.RETRY");
    abortButton = new Button(buttonStyleGroup, SWT.CHECK);
    abortButton.setText("SWT.ABORT");
    ignoreButton = new Button(buttonStyleGroup, SWT.CHECK);
    ignoreButton.setText("SWT.IGNORE");

    /* Create a group for the icon style controls */
    Group iconStyleGroup = new Group(controlGroup, SWT.NONE);
    iconStyleGroup.setLayout(new GridLayout());
    iconStyleGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    iconStyleGroup.setText(ControlExample.getResourceString("Icon_Styles"));

    /* Create the icon style buttons */
    iconErrorButton = new Button(iconStyleGroup, SWT.RADIO);
    iconErrorButton.setText("SWT.ICON_ERROR");
    iconInformationButton = new Button(iconStyleGroup, SWT.RADIO);
    iconInformationButton.setText("SWT.ICON_INFORMATION");
    iconQuestionButton = new Button(iconStyleGroup, SWT.RADIO);
    iconQuestionButton.setText("SWT.ICON_QUESTION");
    iconWarningButton = new Button(iconStyleGroup, SWT.RADIO);
    iconWarningButton.setText("SWT.ICON_WARNING");
    iconWorkingButton = new Button(iconStyleGroup, SWT.RADIO);
    iconWorkingButton.setText("SWT.ICON_WORKING");
    noIconButton = new Button(iconStyleGroup, SWT.RADIO);
    noIconButton.setText(ControlExample.getResourceString("No_Icon"));

    /* Create a group for the modal style controls */
    Group modalStyleGroup = new Group(controlGroup, SWT.NONE);
    modalStyleGroup.setLayout(new GridLayout());
    modalStyleGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    modalStyleGroup.setText(ControlExample.getResourceString("Modal_Styles"));

    /* Create the modal style buttons */
    primaryModalButton = new Button(modalStyleGroup, SWT.RADIO);
    primaryModalButton.setText("SWT.PRIMARY_MODAL");
    applicationModalButton = new Button(modalStyleGroup, SWT.RADIO);
    applicationModalButton.setText("SWT.APPLICATION_MODAL");
    systemModalButton = new Button(modalStyleGroup, SWT.RADIO);
    systemModalButton.setText("SWT.SYSTEM_MODAL");

    /* Create a group for the file dialog style controls */
    Group fileDialogStyleGroup = new Group(controlGroup, SWT.NONE);
    fileDialogStyleGroup.setLayout(new GridLayout());
    fileDialogStyleGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    fileDialogStyleGroup.setText(ControlExample.getResourceString("File_Dialog_Styles"));

    /* Create the file dialog style buttons */
    openButton = new Button(fileDialogStyleGroup, SWT.RADIO);
    openButton.setText("SWT.OPEN");
    saveButton = new Button(fileDialogStyleGroup, SWT.RADIO);
    saveButton.setText("SWT.SAVE");
    multiButton = new Button(fileDialogStyleGroup, SWT.CHECK);
    multiButton.setText("SWT.MULTI");

    /* Create the orientation group */
    if (RTL_SUPPORT_ENABLE) {
      createOrientationGroup();
    }

    /* Add the listeners */
    dialogCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            dialogSelected(event);
          }
        });
    createButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            createButtonSelected(event);
          }
        });
    SelectionListener buttonStyleListener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            buttonStyleSelected(event);
          }
        };
    okButton.addSelectionListener(buttonStyleListener);
    cancelButton.addSelectionListener(buttonStyleListener);
    yesButton.addSelectionListener(buttonStyleListener);
    noButton.addSelectionListener(buttonStyleListener);
    retryButton.addSelectionListener(buttonStyleListener);
    abortButton.addSelectionListener(buttonStyleListener);
    ignoreButton.addSelectionListener(buttonStyleListener);

    /* Set default values for style buttons */
    okButton.setEnabled(false);
    cancelButton.setEnabled(false);
    yesButton.setEnabled(false);
    noButton.setEnabled(false);
    retryButton.setEnabled(false);
    abortButton.setEnabled(false);
    ignoreButton.setEnabled(false);
    iconErrorButton.setEnabled(false);
    iconInformationButton.setEnabled(false);
    iconQuestionButton.setEnabled(false);
    iconWarningButton.setEnabled(false);
    iconWorkingButton.setEnabled(false);
    noIconButton.setEnabled(false);
    saveButton.setEnabled(false);
    openButton.setEnabled(false);
    openButton.setSelection(true);
    multiButton.setEnabled(false);
    noIconButton.setSelection(true);
  }