org.eclipse.swt.widgets.Combo#setLayoutData ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Combo#setLayoutData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: birt   文件: SelectVariableDialog.java
@Override
protected Control createDialogArea( Composite parent )
{
	Composite content = new Composite( parent, SWT.NONE );
	content.setLayoutData( GridDataFactory.swtDefaults( ).hint( 300,
			SWT.DEFAULT ).create( ) );
	content.setLayout( GridLayoutFactory.swtDefaults( )
			.numColumns( 2 )
			.margins( 15, 15 )
			.create( ) );
	new Label( content, SWT.NONE ).setText( Messages.getString("SelectVariableDialog.AvailableVariables") ); //$NON-NLS-1$
	variablesCombo = new Combo( content, SWT.READ_ONLY );
	variablesCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	variablesCombo.setVisibleItemCount( 30 );
	variablesCombo.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			validate( );
		}
	} );
	UIUtil.bindHelp( parent, IHelpContextIds.SELECT_VARIABLE_DIALOG_ID );
	return content;
}
 
protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) {
	GridData gd= new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 2, 1);
	gd.horizontalIndent= indent;

	Label labelControl= new Label(parent, SWT.LEFT);
	labelControl.setFont(JFaceResources.getDialogFont());
	labelControl.setText(label);
	labelControl.setLayoutData(gd);

	Combo comboBox= newComboControl(parent, key, values, valueLabels);
	comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

	fLabels.put(comboBox, labelControl);
	
	addHighlight(parent, labelControl, comboBox);

	return comboBox;
}
 
源代码3 项目: ermaster-b   文件: CompositeFactory.java
public static Combo createCombo(AbstractDialog dialog, Composite composite,
		String title, int span) {
	if (title != null) {
		Label label = new Label(composite, SWT.RIGHT);
		label.setText(ResourceString.getResourceString(title));
	}

	GridData gridData = new GridData();
	gridData.horizontalSpan = span;
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	Combo combo = new Combo(composite, SWT.NONE);
	combo.setLayoutData(gridData);

	ListenerAppender.addComboListener(combo, dialog, false);

	return combo;
}
 
源代码4 项目: nebula   文件: CompositeTableSnippet6.java
public AddressEditor(Composite parent, int style) {
	super(parent, style | SWT.BORDER);
	
	setLayout(new GridLayout(2, true));
	new Label(this, SWT.NULL).setText("Name:");
	new Label(this, SWT.NULL);
	
	name = new Text(this, SWT.BORDER);
	name.setLayoutData(spanGD());
	
	new Label(this, SWT.NULL).setText("Address:");
	new Label(this, SWT.NULL);
	
	address1 = new Text(this, SWT.BORDER);
	address1.setLayoutData(spanGD());
	address2 = new Text(this, SWT.BORDER);
	address2.setLayoutData(spanGD());
	
	new Label(this, SWT.NULL).setText("City:");
	new Label(this, SWT.NULL).setText("State:");
	
	city = new Text(this, SWT.BORDER);
	city.setLayoutData(fillGD());
	state = new Combo(this, SWT.BORDER);
	state.setLayoutData(fillGD());
	
	new Label(this, SWT.NULL).setText("Zip:");
	new Label(this, SWT.NULL);
	
	postalCode = new Text(this, SWT.BORDER);
	postalCode.setLayoutData(spanGD());
}
 
源代码5 项目: tmxeditor8   文件: CustomFilterDialog.java
/**
 * 初始化判断条件列表控件
 * @param isContain
 *            是否具有包含与不包含条件
 */
private void initConditions(boolean isContain) {
	conditions = new Combo(this, SWT.READ_ONLY);
	conditions.setLayoutData(new GridData(100, 35));

	if (isContain) {
		setComboData(conditions, conditionsData);
	} else {
		setComboData(conditions, equalsConditionsData);
	}
	conditions.select(0);

}
 
@Override
protected Control createDialogArea(Composite parent) {
	getShell().setText(fShellTitle);

	Composite composite = (Composite)super.createDialogArea(parent);
	Composite innerComposite = new Composite(composite, SWT.NONE);
	innerComposite.setLayoutData(new GridData());
	GridLayout gl= new GridLayout();
	gl.numColumns= 2;
	innerComposite.setLayout(gl);

	Label label= new Label(innerComposite, SWT.NONE);
	label.setText(fLabelText);
	label.setLayoutData(new GridData());

	final Combo combo= new Combo(innerComposite, SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(combo);
	for (int i = 0; i < fAllowedStrings.length; i++) {
		combo.add(fAllowedStrings[i]);
	}
	combo.select(fInitialSelectionIndex);
	fSelection= combo.getItem(combo.getSelectionIndex());
	GridData gd= new GridData();
	gd.widthHint= convertWidthInCharsToPixels(getMaxStringLength());
	combo.setLayoutData(gd);
	combo.addSelectionListener(new SelectionAdapter(){
		@Override
		public void widgetSelected(SelectionEvent e) {
			fSelection= combo.getItem(combo.getSelectionIndex());
		}
	});
	applyDialogFont(composite);
	return composite;
}
 
源代码7 项目: birt   文件: PreviewPreferencePage.java
protected Composite createBIDIChoice( Composite parent )
{
	// Composite composite = new Composite( parent, SWT.NONE );
	// composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	// GridLayout layout = new GridLayout( );
	// layout.numColumns = 2;
	// layout.marginWidth = 0;
	// layout.marginHeight = 0;
	// composite.setLayout( layout );

	Label lb = new Label( parent, SWT.NONE );
	lb.setText( Messages.getString( "designer.preview.preference.bidiOrientation.label" ) );
	bidiCombo = new Combo( parent, SWT.READ_ONLY );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	gd.minimumWidth = 100;
	bidiCombo.setLayoutData( gd );
	bidiCombo.setVisibleItemCount( 30 );
	bidiCombo.setItems( BIDI_CHOICE_DISPLAYNAMES );

	String bidiValue = ViewerPlugin.getDefault( )
			.getPluginPreferences( )
			.getString( WebViewer.BIDI_ORIENTATION );
	int index = Arrays.asList( BIDI_CHOICE_NAMES ).indexOf( bidiValue );
	index = index < 0 ? 0 : index;
	bidiCombo.select( index );
	return parent;
}
 
Composite addSuperClassConstructorChoices(Composite composite) {
	Label label= new Label(composite, SWT.NONE);
	label.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_sort_constructor_choices_label);
	GridData gd= new GridData(GridData.FILL_HORIZONTAL);
	label.setLayoutData(gd);

	BindingLabelProvider provider= new BindingLabelProvider();
	final Combo combo= new Combo(composite, SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(combo);
	for (int i= 0; i < fSuperConstructors.length; i++) {
		combo.add(provider.getText(fSuperConstructors[i]));
	}

	// TODO: Can we be a little more intelligent about guessing the super() ?
	combo.setText(combo.getItem(0));
	combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	combo.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			fSuperIndex= combo.getSelectionIndex();
			// Disable omit super checkbox unless default constructor
			fOmitSuperButton.setEnabled(getSuperConstructorChoice().getParameterTypes().length == 0);
			updateOKStatus();
		}
	});

	return composite;
}
 
源代码9 项目: tmxeditor8   文件: CustomMatchConditionDialog.java
/**
 * 初始化条件下拉框
 */
private void initConditions(String[] data) {
	conditions = new Combo(this, SWT.BORDER);
	conditions.setLayoutData(new GridData(100, 35));
	if (data == null || data.length == 0) {
		return;
	}
	setComboData(conditions, data);
	conditions.select(0);

}
 
private static Combo createProfileCombo(Composite composite, int span, int widthHint)
{
	final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = span;
	gd.widthHint = widthHint;

	final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
	combo.setFont(composite.getFont());
	combo.setLayoutData(gd);

	return combo;
}
 
源代码11 项目: birt   文件: ChartCombo.java
protected void placeComponents( int style )
{
	GridLayout gl = new GridLayout( 1, false );
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginLeft = 0;
	gl.marginRight = 0;
	gl.marginTop = 0;
	gl.marginWidth = 0;
	this.setLayout( gl );

	cmbItems = new Combo( this, style );
	GridData gd = new GridData( GridData.FILL_BOTH );
	cmbItems.setLayoutData( gd );
}
 
源代码12 项目: tmxeditor8   文件: ReverseConversionWizardPage.java
private void createPropertiesGroup(Composite contents) {
	Group langComposite = new Group(contents, SWT.NONE);
	langComposite.setText(Messages.getString("wizard.ReverseConversionWizardPage.langComposite")); //$NON-NLS-1$
	langComposite.setLayout(new GridLayout(2, false));
	langComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	Label tgtEncLabel = new Label(langComposite, SWT.NONE);
	tgtEncLabel.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncLabel")); //$NON-NLS-1$
	tgtEncCombo = new Combo(langComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
	tgtEncCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	tgtEncCombo.addSelectionListener(new SelectionAdapter() {
		@SuppressWarnings("unchecked")
		public void widgetSelected(SelectionEvent arg0) {
			ISelection selection = tableViewer.getSelection();
			if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
				IStructuredSelection structuredSelection = (IStructuredSelection) selection;
				Iterator<ConversionConfigBean> iter = structuredSelection.iterator();
				while (iter.hasNext()) {
					ConversionConfigBean bean = iter.next();
					bean.setTargetEncoding(tgtEncCombo.getText());
				}

				validate();
			}
		}
	});
}
 
源代码13 项目: ermasterr   文件: EditAllAttributesDialog.java
protected Combo createWordCombo(final NormalColumn targetColumn) {
    final GridData gridData = new GridData();
    gridData.widthHint = 100;

    final Combo wordCombo = new Combo(attributeTable, SWT.READ_ONLY);
    initializeWordCombo(wordCombo);
    wordCombo.setLayoutData(gridData);
    setWordValue(wordCombo, targetColumn);

    return wordCombo;
}
 
源代码14 项目: birt   文件: FormatSpecifierComposite.java
private void placeComponents( )
{
	GridLayout glDateStandard = new GridLayout( );
	glDateStandard.verticalSpacing = 5;
	glDateStandard.numColumns = 2;
	glDateStandard.marginHeight = 2;
	glDateStandard.marginWidth = 2;

	GridData gdGRPDateStandard = new GridData( GridData.FILL_BOTH );
	this.setLayoutData( gdGRPDateStandard );
	this.setLayout( glDateStandard );

	lblDateType = new Label( this, SWT.NONE );
	GridData gdLBLDateType = new GridData( );
	lblDateType.setLayoutData( gdLBLDateType );
	lblDateType.setText( Messages.getString( "FormatSpecifierComposite.Lbl.Type" ) ); //$NON-NLS-1$

	cmbDateType = new Combo( this, SWT.DROP_DOWN | SWT.READ_ONLY );
	GridData gdCMBDateType = new GridData( GridData.FILL_HORIZONTAL );
	cmbDateType.setLayoutData( gdCMBDateType );
	cmbDateType.addListener( SWT.Selection, this );

	lblDateDetails = new Label( this, SWT.NONE );
	GridData gdLBLDateDetails = new GridData( );
	lblDateDetails.setLayoutData( gdLBLDateDetails );
	lblDateDetails.setText( Messages.getString( "FormatSpecifierComposite.Lbl.Details" ) ); //$NON-NLS-1$

	cmbDateForm = new Combo( this, SWT.DROP_DOWN | SWT.READ_ONLY );
	GridData gdCMBDateForm = new GridData( GridData.FILL_HORIZONTAL );
	cmbDateForm.setLayoutData( gdCMBDateForm );
	cmbDateForm.addListener( SWT.Selection, this );
}
 
private static Combo addCombo(Composite formComposite, String labelText, boolean readOnly) {
  addLabel(formComposite, labelText);

  Combo combo = new Combo(formComposite,
      SWT.DROP_DOWN | (readOnly ? SWT.READ_ONLY : SWT.NULL));
  combo.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 2));
  return combo;
}
 
private void createAccessControl(Composite parent) throws JavaModelException {
	Composite access= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	access.setLayout(layout);

	final int[] availableVisibilities= getChangeMethodSignatureProcessor().getAvailableVisibilities();
	int currentVisibility= getChangeMethodSignatureProcessor().getVisibility();

	Label label= new Label(access, SWT.NONE);
	label.setText(RefactoringMessages.ChangeSignatureInputPage_access_modifier);

	final Combo combo= new Combo(access, SWT.DROP_DOWN | SWT.READ_ONLY);
	if (availableVisibilities.length == 0) {
		combo.setEnabled(false);
	} else {
		for (int i= 0; i < availableVisibilities.length; i++) {
			combo.add(getAccessModifierString(availableVisibilities[i]));
		}
		combo.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				int newVisibility= availableVisibilities[combo.getSelectionIndex()];
				getChangeMethodSignatureProcessor().setVisibility(newVisibility);
				update(true);
			}
		});
	}
	combo.setText(getAccessModifierString(currentVisibility));
	combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

	// ensure that "Access modifier:" and "Return type:" Labels are not too close:
	Dialog.applyDialogFont(access);
	access.pack();
	int minLabelWidth= label.getSize().x + 3 * layout.horizontalSpacing;
	if (minLabelWidth > combo.getSize().x)
		label.setLayoutData(new GridData(minLabelWidth, label.getSize().y));
}
 
源代码17 项目: birt   文件: DataSourceSelectionDialog.java
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );
	new Label( composite, SWT.NONE ).setText( Messages.getString( "dataset.editor.label.selectDataSource" ) ); //$NON-NLS-1$
	combo = new Combo( composite, SWT.BORDER | SWT.READ_ONLY );
	combo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	combo.setVisibleItemCount( 30 );
	combo.setItems( dataSourceNames );

	UIUtil.bindHelp( parent,
			IHelpContextIds.ADD_DATA_SOURCE_SELECTION_DIALOG_ID );
	return composite;
}
 
源代码18 项目: codewind-eclipse   文件: LogLevelSelectionDialog.java
protected Control createDialogArea(Composite parent) {
	setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER));
	setTitle(Messages.LogLevelDialogTitle);
	setMessage(Messages.LogLevelDialogMessage);
	
	final Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginHeight = 11;
	layout.marginWidth = 9;
	layout.horizontalSpacing = 5;
	layout.verticalSpacing = 7;
	layout.numColumns = 2;
	composite.setLayout(layout);
	GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = 200;
	composite.setLayoutData(data);
	composite.setFont(parent.getFont());
	
	Label label = new Label(composite, SWT.NONE);
	label.setText(Messages.LogLevelDialogLogLabel);
	
	initLevels();
	
	Combo logLevelCombo = new Combo(composite, SWT.READ_ONLY);
	logLevelCombo.setItems(levelLabels.toArray(new String[levelLabels.size()]));
	logLevelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	
	logLevelCombo.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent event) {
			int index = logLevelCombo.getSelectionIndex();
			if (index >= 0)
				selectedLevel = levelList.get(index);
		}
	});

	// Add Context Sensitive Help
	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CodewindUIPlugin.MAIN_CONTEXTID);
	
	if (currentLevel >= 0) {
		logLevelCombo.select(currentLevel);
	}
	
	logLevelCombo.setFocus();
	
	return composite;
}
 
源代码19 项目: arx   文件: EditorCriterionProfitability.java
@Override
protected Composite build(Composite parent) {
    
       // Create input group
       Composite group = new Composite(parent, SWT.NONE);
       group.setLayoutData(SWTUtil.createFillHorizontallyGridData());
       GridLayout groupInputGridLayout = new GridLayout();
       groupInputGridLayout.numColumns = 4;
       group.setLayout(groupInputGridLayout);
       
       // Attacker model
       Label labelAttackerModel = new Label(group, SWT.NONE);
       labelAttackerModel.setText(Resources.getMessage("CriterionDefinitionView.120"));

       comboAttackerModel = new Combo(group, SWT.READ_ONLY);
       comboAttackerModel.setLayoutData(SWTUtil.createFillHorizontallyGridData());
       comboAttackerModel.setItems(LABELS);
       comboAttackerModel.select(0);
       comboAttackerModel.addSelectionListener(new SelectionAdapter() {
           @Override
           public void widgetSelected(final SelectionEvent arg0) {
               if (comboAttackerModel.getSelectionIndex() != -1) {
                   model.setAttackerModel(MODELS[comboAttackerModel.getSelectionIndex()]);
               }
           }
       });
       
       // Allow attack
       Label labelAllowAttack = new Label(group, SWT.NONE);
       labelAllowAttack.setText(Resources.getMessage("CriterionDefinitionView.123"));

       checkboxAllowAttack = new Button(group, SWT.CHECK);
       checkboxAllowAttack.addSelectionListener(new SelectionAdapter() {
           @Override
           public void widgetSelected(SelectionEvent e) {
               model.setAllowAttacks(checkboxAllowAttack.getSelection());
           }
       });
       
       return group;
}
 
源代码20 项目: ldparteditor   文件: IntersectorDesign.java
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_specify = new Label(cmp_container, SWT.NONE);
    lbl_specify.setText(I18n.INTERSECTOR_Title);

    Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Label lbl_description = new Label(cmp_container, SWT.NONE);
    lbl_description.setText(I18n.INTERSECTOR_Description);
    
    NButton btn_hideOther = new NButton(cmp_container, SWT.CHECK);
    this.btn_hideOther[0] = btn_hideOther;
    btn_hideOther.setText(I18n.INTERSECTOR_HideOther);
    btn_hideOther.setSelection(ins.isHidingOther());
    
    Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_scope[0] = cmb_scope;
    cmb_scope.setItems(new String[] {I18n.INTERSECTOR_ScopeFile, I18n.INTERSECTOR_ScopeSelection});
    cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    cmb_scope.setText(cmb_scope.getItem(ins.getScope()));
    cmb_scope.select(ins.getScope());
    cmb_scope.setEnabled(false);

    {
        Combo cmb_colourise = new Combo(cmp_container, SWT.READ_ONLY);
        this.cmb_colourise[0] = cmb_colourise;
        cmb_colourise.setItems(new String[] {I18n.INTERSECTOR_NoMods, I18n.INTERSECTOR_ColourMods});
        cmb_colourise.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        cmb_colourise.setText(cmb_colourise.getItem(ins.isColourise() ? 1 : 0));
        cmb_colourise.select(ins.isColourise() ? 1 : 0);
    }

    cmp_container.pack();
    return cmp_container;
}