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

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

源代码1 项目: birt   文件: ChartConfigurationBlock.java
protected Control createContents( Composite parent )
{
	fPixelConverter = new PixelConverter( parent );
	setShell( parent.getShell( ) );

	Composite mainComp = new Composite( parent, SWT.NONE );
	mainComp.setFont( parent.getFont( ) );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	mainComp.setLayout( layout );

	Composite othersComposite = createBuildPathTabContent( mainComp );
	GridData gridData = new GridData( GridData.FILL,
			GridData.FILL,
			true,
			true );
	gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels( 20 );
	othersComposite.setLayoutData( gridData );

	validateSettings( null, null, null );

	return mainComp;
}
 
源代码2 项目: lapse-plus   文件: LapseConfigurationDialog.java
protected Control createDialogArea(Composite parent) {
    Composite superComposite = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(superComposite, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    //createFiltersArea(composite);
    //new Label(composite, SWT.NONE); // Filler
    createMaxCallDepthArea(composite);
    new Label(composite, SWT.NONE); // Filler
    applyDialogFont(parent);
    updateUIFromFilter();
    return composite;
}
 
源代码3 项目: corrosion   文件: DebugPreferencePage.java
@Override
protected Control createContents(Composite parent) {
	parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	Composite container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(4, false));
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));

	gdbInput = new InputComponent(container, Messages.DebugPreferencePage_defaultGDB, e -> isPageValid());
	gdbInput.createComponent();
	gdbInput.createFileSelection();
	gdbInput.setValue(store.getString(CorrosionPreferenceInitializer.DEFAULT_GDB_PREFERENCE));

	Link gdbLink = new Link(container, SWT.NONE);
	gdbLink.setText(Messages.DebugPreferencePage_seeGDBPage);
	gdbLink.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
		IPreferencePageContainer prefContainer = getContainer();
		if (prefContainer instanceof IWorkbenchPreferenceContainer) {
			((IWorkbenchPreferenceContainer) prefContainer).openPage("org.eclipse.cdt.dsf.gdb.ui.preferences", //$NON-NLS-1$
					null);
		}
	}));
	gdbLink.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	return parent;
}
 
源代码4 项目: birt   文件: StringVariableSelectionDialog.java
/**
 * @param parent
 * @param font
 * @param columns
 * @param hspan
 * @param fill
 * @param marginwidth
 * @param marginheight
 * @return
 */
public static Composite createComposite( Composite parent, Font font,
		int columns, int hspan, int fill, int marginwidth, int marginheight )
{
	Composite g = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( columns, false );
	layout.marginWidth = marginwidth;
	layout.marginHeight = marginheight;
	g.setLayout( layout );
	g.setFont( font );
	GridData gd = new GridData( fill );
	gd.horizontalSpan = hspan;
	g.setLayoutData( gd );
	return g;
}
 
源代码5 项目: depan   文件: AbstractNewDocumentPage.java
/**
 * Utility method for derived classes to adding input part for the wizard.
 */
protected void addOptionPart(
    Composite container, NewWizardOptionPart part) {
  wizardParts.add(part);
  Composite widget = part.createPartControl(container);
  widget.setLayoutData(Widgets.buildHorzFillData());
}
 
源代码6 项目: Pydev   文件: PythonBreakpointPage.java
/**
 * Creates a fully configured composite with the given number of columns
 * @param parent
 * @param numColumns
 * @return the configured composite
 */
protected Composite createComposite(Composite parent, int numColumns) {
    Composite composit = new Composite(parent, SWT.NONE);
    composit.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = numColumns;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composit.setLayout(layout);
    composit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    return composit;
}
 
@Override
protected void doCreateControl(Composite composite) {
    super.doCreateControl(composite);
    final Composite saveComposite = new Composite(composite, SWT.NONE) ;
    saveComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create()) ;
    saveComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 10).create()) ;

    final Label nameLabel = new Label(saveComposite, SWT.NONE) ;
    nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END,SWT.CENTER).create()) ;
    nameLabel.setText(Messages.name +" *") ;

    final Text nameText = new Text(saveComposite, SWT.BORDER) ;
    nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()) ;

    final UpdateValueStrategy targetToModel = new UpdateValueStrategy() ;
    targetToModel.setBeforeSetValidator(new IValidator() {

        @Override
        public IStatus validate(Object newText) {
            if(newText == null || newText.toString().isEmpty()){
                return ValidationStatus.error(Messages.nameIsEmpty);
            }

            if(configurationStore.getChild(newText+"."+configurationStore.getCompatibleExtensions().iterator().next(), true) != null){
                return ValidationStatus.error(Messages.nameAlreadyExists) ;
            }
            return Status.OK_STATUS;
        }
    }) ;
    context.bindValue(SWTObservables.observeText(nameText, SWT.Modify), PojoProperties.value(SaveConnectorConfigurationWizardPage.class, "confName").observe(this), targetToModel, null) ;

}
 
源代码8 项目: CogniCrypt   文件: Reporter.java
@Override
protected Control createDialogArea(Composite parent) {

	Composite area = (Composite) super.createDialogArea(parent);
	Composite container = new Composite(area, SWT.NONE);
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	GridLayout layout = new GridLayout(1, false);
	container.setLayout(layout);

	txtTitle = new Text(container, SWT.BORDER);
	txtTitle.setMessage("Please enter issue title...");
	txtTitle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	txtIssue = new Text(container, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	txtIssue.setMessage("Please enter issue description...");
	txtIssue.setFocus();
	txtIssue.setLayoutData(new GridData(GridData.FILL_BOTH));

	Composite container2 = new Composite(container, SWT.NONE);
	GridLayout layout2 = new GridLayout(2, false);
	container2.setLayout(layout2);

	Label lbtInfo = new Label(container2, SWT.NONE);
	lbtInfo.setText("Additonaly, to the issue description CogniCrypt will send:");
	GridData dataGrid = new GridData();
	dataGrid.grabExcessHorizontalSpace = true;
	dataGrid.horizontalAlignment = GridData.FILL;

	combo = new Combo(container2, SWT.DROP_DOWN | SWT.READ_ONLY);
	String[] items = new String[] {fileName, "Method", "None"};
	combo.setItems(items);
	combo.setLayoutData(dataGrid);
	combo.select(1);

	return area;
}
 
源代码9 项目: tmxeditor8   文件: ConversionWizardPage.java
public void createControl(Composite parent) {
	Composite contents = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	contents.setLayout(layout);
	GridData gridData = new GridData();
	gridData.horizontalAlignment = SWT.FILL;
	gridData.grabExcessHorizontalSpace = true;
	contents.setLayoutData(gridData);

	createFilesGroup(contents); // 文件列表区域
	createPropertiesGroup(contents);// 源文件属性区域组
	createConversionOptionsGroup(contents); // 转换选项组
	createSegmentationGroup(contents); // 分段规则选择区域组

	bindValue(); // 数据绑定

	loadFiles(); // 加载文件列表

	filesTable.select(0); // 默认选中第一行数据
	filesTable.notifyListeners(SWT.Selection, null);

	Dialog.applyDialogFont(parent);

	Point defaultMargins = LayoutConstants.getMargins();
	GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y)
			.generateLayout(contents);

	setControl(contents);

	srxFile.setText(ConverterContext.defaultSrx);

	validate();
}
 
源代码10 项目: elexis-3-core   文件: ImportLabMapping.java
@Override
protected Control createDialogArea(Composite parent){
	getShell().setText(Messages.ImportLabMapping_shellTitle);
	setTitle(Messages.ImportLabMapping_title);
	setMessage(Messages.ImportLabMapping_message);
	
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayoutData(new GridData(GridData.FILL_BOTH));
	ret.setLayout(new GridLayout(2, false));
	
	filePath = new Text(ret, SWT.BORDER);
	filePath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	
	selectFilePath = new Button(ret, SWT.PUSH);
	selectFilePath.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
	selectFilePath.setText(Messages.ImportLabMapping_selectFile); //$NON-NLS-1$
	selectFilePath.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			FileDialog fileDialog = new FileDialog(getShell());
			String selected = fileDialog.open();
			filePath.setText(selected);
		}
	});
	
	return ret;
}
 
源代码11 项目: depan   文件: EdgeMatcherEditorControl.java
/**
 * return a {@link Control} for this widget, containing every useful buttons,
 * labels, table... necessary to use this component.
 *
 * @param parent the parent.
 * @return a {@link Control} containing this widget.
 */
public EdgeMatcherEditorControl(Composite parent) {
  super(parent, SWT.BORDER);
  setLayout(Widgets.buildContainerLayout(1));

  Composite allRels = setupAllRelsButtons(this);
  allRels.setLayoutData(Widgets.buildHorzFillData());

  editor = new EdgeMatcherTableControl(this);
  editor.setLayoutData(Widgets.buildGrabFillData());

  Composite toggles = setupRelationToggles(this);
  toggles.setLayoutData(Widgets.buildHorzFillData());
}
 
源代码12 项目: elexis-3-core   文件: CodingEditDialog.java
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayoutData(new GridData(GridData.FILL_BOTH));
	ret.setLayout(new FillLayout());
	codingComposite = new CodingComposite(ret, SWT.NONE);
	coding.ifPresent(c -> codingComposite.setCoding(c));
	return ret;
}
 
源代码13 项目: n4js   文件: AbstractN4JSPreferencePage.java
/** copied from PropertyAndPreferencePage */
@Override
protected Label createDescriptionLabel(Composite parent) {
	parentComposite = parent;
	if (isProjectPreferencePage()) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		GridLayout layout = new GridLayout();
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		IDialogFieldListener listener = new IDialogFieldListener() {
			@Override
			public void dialogFieldChanged(DialogField dialogField) {
				boolean enabled = ((SelectionButtonDialogField) dialogField).isSelected();
				enableProjectSpecificSettings(enabled);
				projectSpecificChanged = true;

				if (enabled && getData() != null) {
					applyData(getData());
				}
			}
		};

		useProjectSettings = new SelectionButtonDialogField(SWT.CHECK);
		useProjectSettings.setDialogFieldListener(listener);
		useProjectSettings
				.setLabelText(
						org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useprojectsettings_label);
		useProjectSettings.doFillIntoGrid(composite, 1);
		LayoutUtil.setHorizontalGrabbing(useProjectSettings.getSelectionButton(null));

		if (offerLink()) {
			changeWorkspaceSettings = createLink(composite,
					org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useworkspacesettings_change);
			changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
		} else {
			LayoutUtil.setHorizontalSpan(useProjectSettings.getSelectionButton(null), 2);
		}

		Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
		horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		horizontalLine.setFont(composite.getFont());
	} else if (supportsProjectSpecificOptions() && offerLink()) {
		changeWorkspaceSettings = createLink(
				parent,
				org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_showprojectspecificsettings_label);
		changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
	}

	return super.createDescriptionLabel(parent);
}
 
源代码14 项目: AndroidRobot   文件: SaveScreen.java
/**
 * Create contents of the dialog.
 */
private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(450, 415);
    shell.setText(getText());
    shell.setImage(SWTResourceManager.getImage(".\\icons\\title.png"));
    shell.setLayout(new GridLayout(1, false));
    display = getParent().getDisplay();

    Composite composite1 = new Composite(shell, SWT.NONE);
    GridData gd_composite1 = new GridData(435, 50);
    gd_composite1.verticalAlignment = SWT.CENTER;
    composite1.setLayoutData(gd_composite1);
    composite1.setLayout(new GridLayout(3, false));

    Label lbNewScript = new Label(composite1, SWT.CENTER);
    lbNewScript.setText("保存截图");
    lbNewScript.setFont(new Font(display, "宋体", 12, SWT.BOLD));
    new Label(composite1, SWT.NONE);
    new Label(composite1, SWT.NONE);

    lblError = new Label(composite1, SWT.NONE);
    GridData gd_lblError = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
    gd_lblError.widthHint = 207;
    lblError.setLayoutData(gd_lblError);
    lblError.setText("New Label");
    lblError.setVisible(false);
    /*
    Label abc1 = new Label(composite1,SWT.CENTER);
    abc1.setText("                                                                         ");
    abc1.setVisible(false);
    Label abc2 = new Label(composite1,SWT.CENTER);
    FileInputStream input;
    try {
    	input = new FileInputStream(new File(
    			".\\icons\\title.png"));
    	ImageData imageData = new ImageData(input);
    	abc2.setImage(new Image(Display.getDefault(), imageData));
    } catch (FileNotFoundException e) {
    	// TODO Auto-generated catch block
    	e.printStackTrace();
    }
    */

}
 
源代码15 项目: birt   文件: HyperlinkBuilder.java
private void switchToDrillthrough( )
{
	// new Label( displayArea, SWT.NONE ).setText( REQUIED_MARK +
	// LABEL_REPORT );
	// locationEditor = new Text( displayArea, SWT.BORDER | SWT.SINGLE );
	// locationEditor.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
	// ) );
	// locationEditor.addModifyListener( new ModifyListener( ) {
	//
	// public void modifyText( ModifyEvent e )
	// {
	// closeReport( );
	// initParamterBindings( );
	// initBookmarkList( reportHandle );
	// updateButtons( );
	// }
	//
	// } );
	// createBrowerButton( displayArea, locationEditor, false, true );
	//
	// UIUtil.createBlankLabel( displayArea );
	// messageLine = new CLabel( displayArea, SWT.NONE );
	// GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	// gd.horizontalSpan = 2;
	// messageLine.setLayoutData( gd );
	//
	// createBindingTable( displayArea );
	// createBookmarkBar( false );
	// createTargetBar( );
	// createFormatBar( );

	displayArea.setLayout( new GridLayout( ) );
	// final ScrolledComposite scrolledContainer = new ScrolledComposite(
	// displayArea,
	// SWT.NONE );

	final Composite container = new Composite( displayArea, SWT.NONE );
	container.setLayout( new GridLayout( ) );
	// scrolledContainer.setContent( container );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	messageLine = new CLabel( container, SWT.NONE );
	messageLine.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	createDrillthroughSelectTargetReport( container );
	createDrillthroughSelectTargetAnchor( container );
	createDrillthroughCreateLinkExpression( container );
	if ( bTargetEnabled )
	{
		createDrillthroughSelectShowTarget( container );
	}
	createDrillthroughSelectFormat( container );
	if ( bTooltipEnabled )
	{
		createDrillthroughTooltip( container );
	}

	container.setSize( container.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
}
 
源代码16 项目: birt   文件: ExternalizedTextEditorDialog.java
protected Control createDialogArea( Composite parent )
{
	GridLayout glContent = new GridLayout( );
	glContent.numColumns = 2;
	glContent.horizontalSpacing = 5;
	glContent.verticalSpacing = 16;
	glContent.marginHeight = 7;
	glContent.marginWidth = 7;

	Composite cmpContent = new Composite( parent, SWT.NONE );
	cmpContent.setLayout( glContent );
	cmpContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	cbExternalize = new Button( cmpContent, SWT.CHECK );
	GridData gdCBExternalize = new GridData( GridData.FILL_HORIZONTAL );
	gdCBExternalize.horizontalSpan = 2;
	cbExternalize.setLayoutData( gdCBExternalize );
	cbExternalize.setText( Messages.getString( "ExternalizedTextEditorDialog.Lbl.ExternalizeText" ) ); //$NON-NLS-1$
	cbExternalize.addSelectionListener( this );

	Label lblKey = new Label( cmpContent, SWT.NONE );
	GridData gdLBLKey = new GridData( );
	lblKey.setLayoutData( gdLBLKey );
	lblKey.setText( Messages.getString( "ExternalizedTextEditorDialog.Lbl.LookupKey" ) ); //$NON-NLS-1$

	cmbKeys = new Combo( cmpContent, SWT.DROP_DOWN | SWT.READ_ONLY );
	GridData gdCMBKeys = new GridData( GridData.FILL_HORIZONTAL );
	cmbKeys.setLayoutData( gdCMBKeys );
	cmbKeys.addSelectionListener( this );

	// Layout for Current Value composite
	GridLayout glCurrent = new GridLayout( );
	glCurrent.horizontalSpacing = 5;
	glCurrent.verticalSpacing = 5;
	glCurrent.marginHeight = 0;
	glCurrent.marginWidth = 0;

	Composite cmpCurrent = new Composite( cmpContent, SWT.NONE );
	GridData gdCMPCurrent = new GridData( GridData.FILL_BOTH );
	gdCMPCurrent.horizontalSpan = 2;
	cmpCurrent.setLayoutData( gdCMPCurrent );
	cmpCurrent.setLayout( glCurrent );

	Label lblValue = new Label( cmpCurrent, SWT.NONE );
	GridData gdLBLValue = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
	lblValue.setLayoutData( gdLBLValue );
	lblValue.setText( Messages.getString( "ExternalizedTextEditorDialog.Lbl.DefaultValue" ) ); //$NON-NLS-1$

	txtValue = new Text( cmpCurrent, SWT.BORDER
			| SWT.MULTI
			| SWT.WRAP
			| SWT.H_SCROLL
			| SWT.V_SCROLL );
	GridData gdTXTValue = new GridData( GridData.FILL_BOTH );
	gdTXTValue.widthHint = 280;
	gdTXTValue.heightHint = 40;
	txtValue.setLayoutData( gdTXTValue );

	// Layout for Current Value composite
	GridLayout glExtValue = new GridLayout( );
	glExtValue.horizontalSpacing = 5;
	glExtValue.verticalSpacing = 5;
	glExtValue.marginHeight = 0;
	glExtValue.marginWidth = 0;

	Composite cmpExtValue = new Composite( cmpContent, SWT.NONE );
	GridData gdCMPExtValue = new GridData( GridData.FILL_BOTH );
	gdCMPExtValue.horizontalSpan = 2;
	cmpExtValue.setLayoutData( gdCMPExtValue );
	cmpExtValue.setLayout( glExtValue );

	Label lblExtValue = new Label( cmpExtValue, SWT.NONE );
	GridData gdLBLExtValue = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
	lblExtValue.setLayoutData( gdLBLExtValue );
	lblExtValue.setText( Messages.getString( "ExternalizedTextEditorDialog.Lbl.ExternalizedValue" ) ); //$NON-NLS-1$

	txtCurrent = new Text( cmpExtValue, SWT.BORDER
			| SWT.MULTI
			| SWT.WRAP
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.READ_ONLY );
	GridData gdTXTCurrent = new GridData( GridData.FILL_BOTH );
	gdTXTCurrent.widthHint = 280;
	gdTXTCurrent.heightHint = 40;
	txtCurrent.setLayoutData( gdTXTCurrent );

	// Layout for button composite
	GridLayout glButtons = new GridLayout( );
	glButtons.numColumns = 2;
	glButtons.horizontalSpacing = 5;
	glButtons.verticalSpacing = 0;
	glButtons.marginWidth = 0;
	glButtons.marginHeight = 0;

	populateList( );

	return cmpContent;
}
 
源代码17 项目: nebula   文件: ChipsSnippet.java
private static void createCheckedChipsArea() {
	final Label lbl = new Label(shell, SWT.CENTER);
	lbl.setText("Checked chips : Skills");
	lbl.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	final Composite cmp = new Composite(shell, SWT.NONE);
	cmp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
	cmp.setLayout(new GridLayout(5, false));
	cmp.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));

	final Color bgColor = SWTGraphicUtil.getColorSafely(224, 224, 244);
	final Color checkColor = SWTGraphicUtil.getColorSafely(188, 188, 188);

	final Chips chip1 = new Chips(cmp, SWT.CHECK);
	chip1.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip1.setChipsBackground(bgColor);
	chip1.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip1.setPushedStateBackground(checkColor);
	chip1.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip1.setText("Java");
	chip1.setSelection(true);
	chip1.setLayoutData(new GridData(GridData.END, GridData.FILL, true, false));

	final Chips chip2 = new Chips(cmp, SWT.CHECK);
	chip2.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip2.setChipsBackground(bgColor);
	chip2.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip2.setPushedStateBackground(checkColor);
	chip2.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip2.setText("SWT");

	final Chips chip3 = new Chips(cmp, SWT.CHECK);
	chip3.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip3.setChipsBackground(bgColor);
	chip3.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip3.setPushedStateBackground(checkColor);
	chip3.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip3.setText("JFace");

	final Chips chip4 = new Chips(cmp, SWT.CHECK);
	chip4.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip4.setChipsBackground(bgColor);
	chip4.setPushedStateForeground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	chip4.setPushedStateBackground(checkColor);
	chip4.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	chip4.setText("EMF");
	chip4.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, true, false));

	final Listener listener = event -> {
		final Chips chip = (Chips) event.widget;
		System.out.println("Click on " + chip.getText());
	};

	chip1.addListener(SWT.Selection, listener);
	chip2.addListener(SWT.Selection, listener);
	chip3.addListener(SWT.Selection, listener);
	chip4.addListener(SWT.Selection, listener);

}
 
@Override
protected Control createButtonBar(Composite parent) {
	Composite buttonCmp = new Composite(parent, SWT.NONE);

	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	layout.makeColumnsEqualWidth = false;
	layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	buttonCmp.setLayout(layout);
	GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
	buttonCmp.setLayoutData(data);
	buttonCmp.setFont(parent.getFont());

	Composite leftCmp = new Composite(buttonCmp, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp);
	GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp);

	addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID,
			Messages.getString("dialogs.XmlConverterConfigurationDialog.addBtn"), false);
	editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID,
			Messages.getString("dialogs.XmlConverterConfigurationDialog.editBtn"), false);
	deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID,
			Messages.getString("dialogs.XmlConverterConfigurationDialog.deleteBtn"), false);

	Composite rightCmp = new Composite(buttonCmp, SWT.NONE);
	GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp);

	analysisBtn = createButton(rightCmp, IDialogConstants.CLIENT_ID,
			Messages.getString("dialogs.XmlConverterConfigurationDialog.analysisBtn"), false);

	Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR);
	GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl);
	
	createHelpToolItem(buttonCmp);
	
	Composite bottomCmp = new Composite(buttonCmp, SWT.NONE);
	GridDataFactory.fillDefaults().grab(false, false).align(SWT.RIGHT, SWT.CENTER).applyTo(bottomCmp);
	GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).applyTo(bottomCmp);

	createButton(bottomCmp, IDialogConstants.CANCEL_ID,
			Messages.getString("dialogs.XmlConverterConfigurationDialog.cancel"), true).setFocus();

	initListener();

	return buttonCmp;
}
 
源代码19 项目: nebula   文件: XViewerCustomizeDialog.java
@Override
protected Control createDialogArea(Composite parent) {
   if (getShell() != null) {
      getShell().setText(title);
   }
   parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

   Composite comp = new Composite(parent, SWT.NONE);
   GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
   gd.heightHint = 700;
   comp.setLayoutData(gd);
   GridLayout gridLayout_2 = new GridLayout();
   gridLayout_2.numColumns = 2;
   comp.setLayout(gridLayout_2);

   Label namespaceLabel = new Label(comp, SWT.NONE);
   GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
   gridData.horizontalSpan = 2;
   namespaceLabel.setLayoutData(gridData);
   namespaceLabel.setText(MessageFormat.format(XViewerText.get("namespace"), //$NON-NLS-1$
      xViewerToCustomize.getXViewerFactory().getNamespace()));

   createSelectCustomizationSection(comp);

   // Column Configuration
   Group configureColumnsGroup = new Group(comp, SWT.NONE);
   configureColumnsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
   configureColumnsGroup.setText(XViewerText.get("XViewerCustomizeDialog.text")); //$NON-NLS-1$
   GridLayout gridLayout = new GridLayout();
   gridLayout.marginWidth = 3;
   gridLayout.marginHeight = 3;
   gridLayout.numColumns = 3;
   configureColumnsGroup.setLayout(gridLayout);

   createHiddenButtonsComposition(configureColumnsGroup);
   createMoveButtons(configureColumnsGroup);
   createVisibleButtonsComposition(configureColumnsGroup);

   gridLayout.numColumns = 3;
   gridLayout.numColumns = 3;

   // Create Sorter and Filter Blocks
   final Composite composite_2 = new Composite(configureColumnsGroup, SWT.NONE);
   composite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));
   final GridLayout gridLayout_3 = new GridLayout();
   gridLayout_3.numColumns = 3;
   composite_2.setLayout(gridLayout_3);

   if (isShowSorterBlock) {
      createSorterTextBlock(composite_2);
   }
   if (isShowFilterTextBlock) {
      createFilterTextBlock(composite_2);
   }
   if (isShowColumnFilterTextBlock) {
      createColumnFilterTextBlock(composite_2);
   }

   createConfigCustomizationButtonBar(composite_2);

   try {
      loadCustomizeTable();
   } catch (Exception ex) {
      XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex);
   }
   updateButtonEnablements();

   return comp;
}
 
源代码20 项目: gama   文件: AbstractEditor.java
protected Composite createToolbar2() {
	final Composite t = new Composite(composite, SWT.NONE);
	final GridData d = new GridData(SWT.FILL, SWT.TOP, false, false);
	t.setLayoutData(d);
	t.setBackground(HOVERED_BACKGROUND);
	final GridLayout id =
			GridLayoutFactory.fillDefaults().equalWidth(false).extendedMargins(0, 0, 0, 0).spacing(0, 0).create();
	final GridData gd =
			GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).indent(0, -1).create();
	t.setLayout(id);
	final String unitText = computeUnitLabel();
	if (!unitText.isEmpty()) {
		unitItem = new Text(t, SWT.READ_ONLY | SWT.FLAT);
		unitItem.setText(unitText);
		unitItem.setBackground(HOVERED_BACKGROUND);
		unitItem.setEnabled(false);
	}
	if (isEditable) {
		final int[] codes = this.getToolItems();
		for (final int i : codes) {
			Button item = null;
			switch (i) {
				case REVERT:
					item = createItem(t, "Revert to original value", GamaIcons.create("small.revert").image());
					break;
				case PLUS:
					item = createPlusItem(t);
					break;
				case MINUS:
					item = createItem(t, "Decrement the parameter",
							GamaIcons.create(IGamaIcons.SMALL_MINUS).image());
					break;
				case EDIT:
					item = createItem(t, "Edit the parameter", GamaIcons.create("small.edit").image());
					break;
				case INSPECT:
					item = createItem(t, "Inspect the agent", GamaIcons.create("small.inspect").image());
					break;
				case BROWSE:
					item = createItem(t, "Browse the list of agents", GamaIcons.create("small.browse").image());
					break;
				case CHANGE:
					item = createItem(t, "Choose another agent", GamaIcons.create("small.change").image());
					break;
				case DEFINE:
					item = createItem(t, "Set the parameter to undefined",
							GamaIcons.create("small.undefine").image());
			}
			if (item != null) {
				items[i] = item;
				item.setBackground(HOVERED_BACKGROUND);
				item.setLayoutData(GridDataFactory.copyData(gd));
				;
				item.addSelectionListener(new ItemSelectionListener(i));

			}
		}
	}
	id.numColumns = t.getChildren().length;
	t.layout();
	t.pack();
	return t;

}