Java Code Examples for org.eclipse.swt.SWT#RADIO

The following examples show how to use org.eclipse.swt.SWT#RADIO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadioTab.java    From hop with Apache License 2.0 8 votes vote down vote up
public Composite createContent( String radioText ) {
  Control[] existingButtons = radioGroup.getChildren();
  Button button = new Button( radioGroup, SWT.RADIO );
  button.setText( radioText );
  props.setLook( button );
  FormData fdButton = new FormData();
  fdButton.top = new FormAttachment( 0 );
  fdButton.left = existingButtons.length == 0
    ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[ existingButtons.length - 1 ], 40 );
  button.setLayoutData( fdButton );
  button.setSelection( existingButtons.length == 0 );
  Composite content = new Composite( contentArea, SWT.NONE );
  content.setVisible( existingButtons.length == 0 );
  props.setLook( content );
  content.setLayout( noMarginLayout );
  content.setLayoutData( fdMaximize );
  button.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
      for ( Control control : contentArea.getChildren() ) {
        control.setVisible( false );
      }
      content.setVisible( true );
    }
  } );
  return content;
}
 
Example 2
Source File: ModulaSearchPage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private ArrayList<Button> createGroup(Composite parent, int columns, String groupLabel, 
        String[] buttonLabels, int[] buttonData, int defaultSelected) 
{
    ArrayList<Button> buttons = new ArrayList<Button>();
    Group group = new Group(parent, SWT.NONE);
    group.setLayout(new GridLayout(columns, true));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    group.setText(groupLabel);
    for (int i = 0; i < buttonLabels.length; i++) {
        if (buttonLabels[i] != null) {
            Button b = new Button(group, SWT.RADIO);
            b.setData((Integer)buttonData[i]);
            b.setText(buttonLabels[i]);
            b.setSelection(i == defaultSelected);
            buttons.add(b);
        } else {
            new Label(group, SWT.NORMAL); // empty place
        }
    }
    return buttons;
}
 
Example 3
Source File: DocumentWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private Button createRadioButtonNone(final Composite compo) {
    final Button radioButtonNone = new Button(compo, SWT.RADIO);
    radioButtonNone.setLayoutData(GridDataFactory.swtDefaults().create());
    radioButtonNone.setText(Messages.initialValueButtonNone);
    radioButtonNone.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            super.widgetSelected(e);
            if (radioButtonNone.getSelection()) {
                updateStack(DocumentType.NONE);
                updateMimeTypeEnabled(false);
            }
        }

    });
    return radioButtonNone;
}
 
Example 4
Source File: PromptDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);

	Label label = new Label(container, SWT.NONE);
	label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	label.setText(Messages.getString("dialog.PromptDialog.label"));

	for (String toolId : toolIds) {
		final Button btn = new Button(container, SWT.RADIO);
		btn.setText(toolId);
		btn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		btn.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				if (btn.getSelection()) {
					choiceResult = btn.getText();
				}
			}
		});
	}

	return container;
}
 
Example 5
Source File: AssignChoicePage.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
public void createControl(Composite parent) {
	setTitle(Messages.getString("AssignChoicePage_title"));//$NON-NLS-1$
	setDescription(Messages.getString("AssignChoicePage_message"));//$NON-NLS-1$

	Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	
	newJob = new Button(composite, SWT.RADIO);
	newJob.setText(Messages.getString("AssignChoicePage_newJobLabel"));//$NON-NLS-1$
	
	assignJob = new Button(composite, SWT.RADIO);
	assignJob.setText(Messages.getString("AssignChoicePage_assignJobLabel"));//$NON-NLS-1$
	
	newJob.setSelection(true);
	
	setControl(composite);
}
 
Example 6
Source File: DocumentWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private Button createRadioButtonInternal(final Composite compo) {
    final Button radioButtonInternal = new Button(compo, SWT.RADIO);
    radioButtonInternal.setText(Messages.initialValueButtonInternal);
    final ControlDecoration infoBonita = new ControlDecoration(radioButtonInternal, SWT.RIGHT);
    infoBonita.show();
    infoBonita.setImage(Pics.getImage(PicsConstants.hint));
    infoBonita.setDescriptionText(Messages.initialValueButtonInternalToolTip);
    radioButtonInternal.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            super.widgetSelected(e);
            if (radioButtonInternal.getSelection()) {
                updateStack(DocumentType.INTERNAL);
                updateMimeTypeEnabled(true);
            }
        }

    });
    return radioButtonInternal;
}
 
Example 7
Source File: SWTFactory.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates and returns a new radio button with the given label.
 * 
 * @param parent
 *            parent control
 * @param label
 *            button label or <code>null</code>
 * @return a new radio button
 */
public static Button createRadioButtonNoLayoutData(Composite parent, String label)
{
	Button button = new Button(parent, SWT.RADIO);
	button.setFont(parent.getFont());
	if (label != null)
	{
		button.setText(label);
	}
	return button;
}
 
Example 8
Source File: SelectDatabaseOutputTypeWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected Button createScriptModeControl(Composite parent) {
    final Button scriptModeRadio = new Button(parent, SWT.RADIO);
    scriptModeRadio.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(15, 20).create());
    scriptModeRadio.setText(Messages.scriptMode);
    scriptModeRadio.setFont(BonitaStudioFontRegistry.getActiveFont());

    final Composite descriptionComposite = new Composite(parent, SWT.NONE);
    descriptionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(45, -5).create());
    descriptionComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());

    final Label scriptingDescriptionLabel = new Label(descriptionComposite, SWT.WRAP);
    scriptingDescriptionLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    scriptingDescriptionLabel.setText(Messages.scriptModeDescription);

    alwaysUseScriptCheckbox = new Button(descriptionComposite, SWT.CHECK);
    alwaysUseScriptCheckbox.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    alwaysUseScriptCheckbox.setText(Messages.alwaysUseScriptingMode);
    alwaysUseScriptCheckbox.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            preferenceStore.setValue(BonitaPreferenceConstants.ALWAYS_USE_SCRIPTING_MODE,
                    alwaysUseScriptCheckbox.getSelection());
        }
    });

    return scriptModeRadio;
}
 
Example 9
Source File: CorrosionPreferencePage.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(4, false));

	createCommandPathsPart(container);

	Label rlsLocationLabel = new Label(container, SWT.NONE);
	rlsLocationLabel.setText(Messages.CorrosionPreferencePage_rlsLocation);
	rlsLocationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));

	disableRadioButton = new Button(container, SWT.RADIO);
	disableRadioButton.setText(Messages.CorrosionPreferencePage_disableRustEdition);
	disableRadioButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	disableRadioButton.addSelectionListener(widgetSelectedAdapter(e -> {
		setRadioSelection(2);
	}));

	otherRadioButton = new Button(container, SWT.RADIO);
	otherRadioButton.setText(Messages.CorrosionPreferencePage_otherInstallation);
	otherRadioButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	otherRadioButton.addSelectionListener(widgetSelectedAdapter(e -> {
		setRadioSelection(1);
	}));
	createOtherPart(container);

	rustupRadioButton = new Button(container, SWT.RADIO);
	rustupRadioButton.setText(Messages.CorrosionPreferencePage_useRustup);
	rustupRadioButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	rustupRadioButton.addSelectionListener(widgetSelectedAdapter(e -> {
		setRadioSelection(0);
	}));

	createRustupPart(container);

	initializeContent();
	return container;
}
 
Example 10
Source File: PShelfExampleTab.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void createParameters(Composite parent) {
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(parent);

	Listener listenerRecreates = event -> {
		if (event.widget instanceof Button) {
			Button b = (Button) event.widget;
			if ((b.getStyle() & SWT.RADIO) != 0) {
				if (!b.getSelection())
					return;
			}
		}
		recreateExample();
	};

	Group styles = new Group(parent, SWT.NONE);
	styles.setText("Styles");
	GridLayoutFactory.swtDefaults().applyTo(styles);
	GridDataFactory.fillDefaults().applyTo(styles);

	border = ButtonFactory.create(styles, SWT.CHECK, "SWT.BORDER", listenerRecreates, false);
	simple = ButtonFactory.create(styles, SWT.CHECK, "SWT.SIMPLE", listenerRecreates, false);

	Group parms = new Group(parent, SWT.NONE);
	parms.setText("Other");
	GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(parms);

	new Label(parms, SWT.NONE).setText("Renderer:");

	rendererCombo = new Combo(parms, SWT.READ_ONLY);
	rendererCombo.setItems(new String[] { "PaletteShelfRenderer", "RedmondShelfRenderer" });
	rendererCombo.select(0);
	rendererCombo.addListener(SWT.Selection, listenerRecreates);

}
 
Example 11
Source File: ChoiceDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = (Composite) super.createDialogArea(parent);
	Label msg = new Label(ret, SWT.NONE);
	msg.setText(message);
	for (int i = 0; i < choices.length; i++) {
		buttons[i] = new Button(ret, SWT.RADIO);
		buttons[i].setText(choices[i]);
		buttons[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	}
	return ret;
}
 
Example 12
Source File: PageSettingDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void initDirectionGroup(Composite parent) {
	GridData gridData = new GridData();
	gridData.grabExcessHorizontalSpace = true;
	gridData.horizontalAlignment = GridData.FILL;

	Group directionGroup = new Group(parent, SWT.NONE);
	directionGroup.setLayoutData(gridData);
	directionGroup.setBackground(ColorConstants.white);
	directionGroup.setText(ResourceString
			.getResourceString("label.page.direction"));

	GridLayout directionGroupLayout = new GridLayout();
	directionGroupLayout.marginWidth = 20;
	directionGroupLayout.horizontalSpacing = 20;
	directionGroupLayout.numColumns = 4;

	directionGroup.setLayout(directionGroupLayout);

	Label vImage = new Label(directionGroup, SWT.NONE);
	vImage.setImage(Activator.getImage(ImageKey.PAGE_SETTING_V));

	vButton = new Button(directionGroup, SWT.RADIO);
	vButton.setBackground(ColorConstants.white);
	vButton.setText(ResourceString.getResourceString("label.page.direction.v"));

	Label hImage = new Label(directionGroup, SWT.NONE);
	hImage.setImage(Activator.getImage(ImageKey.PAGE_SETTING_H));

	hButton = new Button(directionGroup, SWT.RADIO);
	hButton.setBackground(ColorConstants.white);
	hButton.setText(ResourceString.getResourceString("label.page.direction.h"));
}
 
Example 13
Source File: AdvancedNewProjectPage.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Button Radio(Composite composite, Procedure1<? super Button> config) {
	Button button = new Button(composite, SWT.RADIO);
	button.setFont(button.getParent().getFont());
	button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	config.apply(button);
	return button;
}
 
Example 14
Source File: SearchDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private Composite createOptionsPanel(final Composite composite) {
	final Composite row = new Composite(composite, SWT.NONE);
	row.setLayout(new GridLayout(2,true));
	
	final Group directionGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(directionGroup);
	directionGroup.setText("Direction");
	final RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
	rowLayout.marginHeight = rowLayout.marginWidth = 3;
	directionGroup.setLayout(rowLayout);
	forwardButton = new Button(directionGroup, SWT.RADIO);
	forwardButton.setText("F&orward");
	forwardButton.setSelection(true);
	final Button backwardButton = new Button(directionGroup, SWT.RADIO);
	backwardButton.setText("&Backward");

	final Group optionsGroup = new Group(row, SWT.SHADOW_ETCHED_IN);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsGroup);
	optionsGroup.setText("Options");
	optionsGroup.setLayout(rowLayout);
	caseSensitiveButton = new Button(optionsGroup, SWT.CHECK);
	caseSensitiveButton.setText("&Case Sensitive");
	wrapSearchButton = new Button(optionsGroup, SWT.CHECK);
	wrapSearchButton.setText("&Wrap Search");
	wrapSearchButton.setSelection(true);
	
	return row;
}
 
Example 15
Source File: PreTranslationPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite tparent = new Composite(parent, SWT.NONE);
	tparent.setLayout(new GridLayout());
	tparent.setLayoutData(new GridData(GridData.FILL_BOTH));

	Group settingGroup = new Group(tparent, SWT.NONE);
	settingGroup.setLayout(new GridLayout());
	settingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	settingGroup.setText(Messages.getString("preference.PreTranslationPreferencePage.settingGroup"));
	HsImageLabel settingImageLabel = new HsImageLabel(
			Messages.getString("preference.PreTranslationPreferencePage.settingImageLabel"),
			Activator.getImageDescriptor("images/preference/trans_pre_32.png"));
	Composite settingComp = settingImageLabel.createControl(settingGroup);

	lockedFullMatchBtn = new Button(settingComp, SWT.CHECK);
	lockedFullMatchBtn.setText(Messages.getString("preference.PreTranslationPreferencePage.lockedFullMatchBtn"));
	lockedFullMatchBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	if (CommonFunction.checkEdition("U")) {
		lockedContextMatchBtn = new Button(settingComp, SWT.CHECK);
		lockedContextMatchBtn.setText(Messages
				.getString("preference.PreTranslationPreferencePage.lockedContextMatchBtn"));
		lockedContextMatchBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	}

	settingImageLabel.computeSize();

	Group matchGroup = new Group(tparent, SWT.NONE);
	matchGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	matchGroup.setLayout(new GridLayout());
	matchGroup.setText(Messages.getString("preference.PreTranslationPreferencePage.matchGroup"));

	// HsImageLabel imageLabel = new HsImageLabel("", null);
	// Composite matchComp = imageLabel.createControl(matchGroup);

	btnKeepNowMatch = new Button(matchGroup, SWT.RADIO);
	btnKeepNowMatch.setText(Messages.getString("preference.PreTranslationPreferencePage.btnKeepNowMatch"));
	btnKeepNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	btnOverwriteNowMatch = new Button(matchGroup, SWT.RADIO);
	btnOverwriteNowMatch
			.setText(Messages.getString("preference.PreTranslationPreferencePage.btnOverwriteNowMatch"));
	btnOverwriteNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	btnAlwaysOverwriteNowMatch = new Button(matchGroup, SWT.RADIO);
	btnAlwaysOverwriteNowMatch.setText(Messages
			.getString("preference.PreTranslationPreferencePage.btnAlwaysOverwriteNowMatch"));
	btnAlwaysOverwriteNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	// imageLabel.computeSize();

	setValues(false);
	return parent;
}
 
Example 16
Source File: ExtractConstantWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void addAccessModifierGroup(Composite result, RowLayouter layouter) {
	fAccessModifier= getExtractConstantRefactoring().getVisibility();
	if (getExtractConstantRefactoring().getTargetIsInterface())
		return;

	Label label= new Label(result, SWT.NONE);
	label.setText(RefactoringMessages.ExtractConstantInputPage_access_modifiers);

	Composite group= new Composite(result, SWT.NONE);
	group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	GridLayout layout= new GridLayout();
	layout.numColumns= 4; layout.marginWidth= 0;
	group.setLayout(layout);

	String[] labels= new String[] {
		RefactoringMessages.ExtractMethodInputPage_public,
		RefactoringMessages.ExtractMethodInputPage_protected,
		RefactoringMessages.ExtractMethodInputPage_default,
		RefactoringMessages.ExtractMethodInputPage_private
	};
	String[] data= new String[] { JdtFlags.VISIBILITY_STRING_PUBLIC,
								  JdtFlags.VISIBILITY_STRING_PROTECTED,
								  JdtFlags.VISIBILITY_STRING_PACKAGE,
								  JdtFlags.VISIBILITY_STRING_PRIVATE }; //

	updateContentAssistImage();
	for (int i= 0; i < labels.length; i++) {
		Button radio= new Button(group, SWT.RADIO);
		radio.setText(labels[i]);
		radio.setData(data[i]);
		if (data[i] == fAccessModifier)
			radio.setSelection(true);
		radio.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent event) {
				setAccessModifier((String)event.widget.getData());
			}
		});
	}
	layouter.perform(label, group, 1);
}
 
Example 17
Source File: StandardChartDataSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Composite createDataSelector( Composite parent )
{
	parentComposite = parent;
	// select the only data set
	if ( itemHandle.getDataBindingType( ) == ReportItemHandle.DATABINDING_TYPE_NONE
			&& itemHandle.getContainer( ) instanceof ModuleHandle )
	{
		DataSetInfo[] dataSets = dataProvider.getAllDataSets( );
		if ( dataProvider.getAllDataCubes( ).length == 0
				&& dataSets.length == 1 )
		{
			dataProvider.setDataSet( dataSets[0] );
		}
	}

	Composite cmpDataSet = ChartUIUtil.createCompositeWrapper( parent );
	{
		cmpDataSet.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	}

	Label label = new Label( cmpDataSet, SWT.NONE );
	{
		label.setText( Messages.getString( "StandardChartDataSheet.Label.SelectDataSet" ) ); //$NON-NLS-1$
		label.setFont( JFaceResources.getBannerFont( ) );
	}

	Composite cmpDetail = new Composite( cmpDataSet, SWT.NONE );
	{
		GridLayout gridLayout = new GridLayout( 2, false );
		gridLayout.marginWidth = 10;
		gridLayout.marginHeight = 0;
		cmpDetail.setLayout( gridLayout );
		cmpDetail.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	}

	Composite compRadios = ChartUIUtil.createCompositeWrapper( cmpDetail );
	{
		GridData gd = new GridData( );
		gd.verticalSpan = 2;
		compRadios.setLayoutData( gd );
	}

	btnInherit = new Button( compRadios, SWT.RADIO );
	btnInherit.setText( Messages.getString( "StandardChartDataSheet.Label.UseReportData" ) ); //$NON-NLS-1$
	btnInherit.addListener( SWT.Selection, this );

	btnUseData = new Button( compRadios, SWT.RADIO );
	btnUseData.setText( Messages.getString( "StandardChartDataSheet.Label.UseDataSet" ) ); //$NON-NLS-1$
	btnUseData.addListener( SWT.Selection, this );

	cmbInherit = new CCombo( cmpDetail, SWT.DROP_DOWN
			| SWT.READ_ONLY
			| SWT.BORDER );
	cmbInherit.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cmbInherit.addListener( SWT.Selection, this );

	cmbDataItems = new DataItemCombo( cmpDetail, SWT.DROP_DOWN
			| SWT.READ_ONLY
			| SWT.BORDER ) {

		@Override
		public boolean triggerSelection( int index )
		{
			int selectState = selectDataTypes.get( index ).intValue( );
			if ( selectState == SELECT_NEW_DATASET
					|| selectState == SELECT_NEW_DATACUBE )
			{
				return false;
			}
			return true;
		}

		@Override
		public boolean skipSelection( int index )
		{
			//skip out of boundary selection
			if(index>=0){
				int selectState = selectDataTypes.get( index ).intValue( );
				if ( selectState == SELECT_NEXT )
				{
					return true;
				}
			}
				
			return false;
		}
	};
	cmbDataItems.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cmbDataItems.addListener( SWT.Selection, this );
	cmbDataItems.setVisibleItemCount( 30 );

	initDataSelector( );
	updatePredefinedQueries( );
	checkDataBinding( );
	if ( dataProvider.checkState( IDataServiceProvider.IN_MULTI_VIEWS ) )
	{
		autoSelect( false );
	}
	return cmpDataSet;
}
 
Example 18
Source File: AddRemoteServiceDialog.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

  Composite composite = (Composite) super.createDialogArea(parent);
  
  Composite tc1 = new2ColumnComposite(composite);
  Label tempLabel;
  
  setTextAndTip(tempLabel = new Label(tc1, SWT.WRAP), "Service kind:", S_, SWT.BEGINNING, false);    
  aeOrCcCombo = wideCCombo(tc1, "Specify whether the Service is an Analysis Engine or a Cas Consumer",
          "AnalysisEngine", "CasConsumer");

  setTextAndTip(tempLabel = new Label(tc1, SWT.WRAP), "Protocol Service Type", S_, SWT.BEGINNING, false);
  serviceTypeCombo = wideCCombo(tc1, S_, "UIMA-AS JMS", "SOAP", "Vinci");

  setTextAndTip(uriLabel = new Label(tc1, SWT.NONE), "URI of service or JMS Broker:",
     "The URI for the service, e.g. localhost", SWT.BEGINNING, false);
  uriText = wideTextInput(tc1, S_, m_dialogModifyListener);

  setTextAndTip(endpointLabel = new Label(tc1, SWT.NONE), "Endpoint Name (JMS Service):",
  "For UIMA-AS JMS Services only, the endpoint name", SWT.BEGINNING, false);

  endpointText = wideTextInput(tc1, S_, m_dialogModifyListener);

  setTextAndTip(binarySerializationLabel = new Label(tc1, SWT.NONE), "Binary Serialization (JMS Service):",
      "For UIMA-AS JMS Services only, use binary serialzation (requires all type systems be identical)", 
      SWT.BEGINNING, false);

  binarySerializationCombo = wideCComboTF(tc1, S_);
  
  setTextAndTip(ignoreProcessErrorsLabel = new Label(tc1, SWT.NONE), "Ignore Process Errors (JMS Service):",
  "For UIMA-AS JMS Services only, ignore processing errors");
  ignoreProcessErrorsLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

  ignoreProcessErrorsCombo = wideCComboTF(tc1, S_);   

  setTextAndTip(tempLabel = new Label(tc1, SWT.NONE), "Key (a short mnemonic for this service):",
      "also used as part of the file name", SWT.BEGINNING, false);
  keyText = wideTextInput(tc1, S_, m_dialogModifyListener);
  keyText.addVerifyListener(new DialogVerifyListener());
  keyTextPrev = ".xml";

  createWideLabel(composite, "Where the generated remote descriptor file will be stored:");
  genFilePathUI = new Text(composite, SWT.BORDER | SWT.H_SCROLL);
  genFilePathUI.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  genFilePathUI.setText(rootPath + ".xml");

  createWideLabel(
          composite,
          "Timeouts, in milliseconds.  This is ignored for the Vinci protocol.  Specify 0 to wait forever. If not specified, a default timeout is used.");
  
  tc1 = new2ColumnComposite(composite);
  
  setTextAndTip(timeoutProcessLabel = new Label(tc1, SWT.NONE), "Timeout: Process:",
      "Timeout for processing a CAS", SWT.BEGINNING, false);   
  timeoutText = wideTextInput(tc1, S_);

  setTextAndTip(timeoutJmsGetmetaLabel = new Label(tc1, SWT.NONE), "Timeout: (JMS) GetMeta:",
  "Timeout for querying the metadata from a JMS service", SWT.BEGINNING, false);
  timeoutGetmetaText = wideTextInput(tc1, S_);

  setTextAndTip(timeoutJmsCpcLabel = new Label(tc1, SWT.NONE), "Timeout: (JMS) Collection Processing Complete:",
  "Timeout for Collection Processing Complete", SWT.BEGINNING, false);   
  timeoutJmsCpcText = wideTextInput(tc1, S_);
  createWideLabel(composite,
          "For the Vinci protocol, you can optionally specify the Host/Port for the Vinci Name Service");
  Composite tc = new2ColumnComposite(composite);
  setTextAndTip(vnsHostLabel = new Label(tc, SWT.NONE), "VNS HOST",
          "An IP name or address, e.g. localhost");
  vnsHostUI = newText(tc, SWT.NONE, "An IP name or address, e.g. localhost");
  setTextAndTip(vnsPortLabel = new Label(tc, SWT.NONE), "VNS PORT", "A port number, e.g. 9000");
  vnsPortUI = newText(tc, SWT.NONE, "A port number, e.g. 9000");

  newErrorMessage(composite);

  autoAddToFlowButton = new Button(composite, SWT.CHECK);
  autoAddToFlowButton.setText("Add to end of flow");
  autoAddToFlowButton.setSelection(true);

  new Label(composite, SWT.NONE).setText("");
  importByNameUI = new Button(composite, SWT.RADIO);
  importByNameUI.setText("Import by Name");
  importByNameUI
          .setToolTipText("Importing by name looks up the name on the classpath and datapath.");
  importByNameUI.setSelection(true);

  importByLocationUI = new Button(composite, SWT.RADIO);
  importByLocationUI.setText("Import By Location");
  importByLocationUI.setToolTipText("Importing by location requires a relative or absolute URL");

  String defaultBy = CDEpropertyPage.getImportByDefault(editor.getProject());
  if (defaultBy.equals("location")) {
    importByNameUI.setSelection(false);
    importByLocationUI.setSelection(true);
  } else {
    importByNameUI.setSelection(true);
    importByLocationUI.setSelection(false);
  }

  return composite;
}
 
Example 19
Source File: CronEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createDailyTab(TabFolder tablFolder) {
    final TabItem item = new TabItem(tablFolder, SWT.NONE);
    item.setText(Messages.daily);

    final Composite dailyContent = new Composite(tablFolder, SWT.NONE);
    dailyContent.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    dailyContent.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(15, 10).create());

    final Button everyRadio = new Button(dailyContent, SWT.RADIO);
    everyRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyRadio.setText(Messages.every);

    context.bindValue(SWTObservables.observeSelection(everyRadio),
            PojoProperties.value("useEveryDayForDaily").observe(cronExpression));

    final Composite everyComposite = new Composite(dailyContent, SWT.NONE);
    everyComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(-65, 0).create());
    everyComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).create());

    final Text dayText = new Text(everyComposite, SWT.BORDER | SWT.SINGLE);
    dayText.setLayoutData(GridDataFactory.fillDefaults().hint(70, SWT.DEFAULT).create());

    UpdateValueStrategy dayFrequencyStrategy = new UpdateValueStrategy();
    dayFrequencyStrategy.setAfterGetValidator(dotValidator);
    dayFrequencyStrategy.setConverter(StringToNumberConverter.toInteger(true));
    dayFrequencyStrategy.setBeforeSetValidator(new FrequencyValidator());
    context.bindValue(SWTObservables.observeText(dayText, SWT.Modify),
            PojoProperties.value("dayFrequencyForDaily").observe(cronExpression), dayFrequencyStrategy, null);

    final Label dayLabel = new Label(everyComposite, SWT.NONE);
    dayLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    dayLabel.setText(Messages.dayLabel);

    final Button everyWeekDayRadio = new Button(dailyContent, SWT.RADIO);
    everyWeekDayRadio.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).create());
    everyWeekDayRadio.setText(Messages.everyWeekDay);

    final Label filler = new Label(dailyContent, SWT.NONE);
    filler.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final IObservableValue hourObservable = PojoProperties.value("atHourInDay").observe(cronExpression);
    final IObservableValue minuteObservable = PojoProperties.value("atMinuteInDay").observe(cronExpression);
    final IObservableValue secondObservable = PojoProperties.value("atSecondInDay").observe(cronExpression);
    createStartTimeComposite(dailyContent, hourObservable, minuteObservable, secondObservable);

    item.setControl(dailyContent);
}
 
Example 20
Source File: MoveConnectorWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
private Button createRadioButton(final Composite radioGroup, final String label) {
    final Button radioButton = new Button(radioGroup, SWT.RADIO);
    radioButton.setLayoutData(GridDataFactory.fillDefaults().create());
    radioButton.setText(label);
    return radioButton;
}