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

The following examples show how to use org.eclipse.swt.SWT#CHECK . These examples are extracted from open source projects. 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 Project: gama   File: FillViewer.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * TODO summary sentence for createControl ...
 *
 * @param parent
 * @param kListener
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener kListener) {
	final Composite part = SimpleConfigurator.subpart(parent, "Fill:");

	this.on = new Button(part, SWT.CHECK);
	this.on.addSelectionListener(this.sync);

	this.chooser = new StolenColorEditor(part, this.sync);

	this.percent = new Combo(part, SWT.DROP_DOWN);
	this.percent.setItems(new String[] { "0%", "25%", "50%", "75%", "100%" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
	this.percent.setTextLimit(4);
	this.percent.addKeyListener(kListener);
	this.percent.setToolTipText("Fill opacity");
	return part;
}
 
Example 2
protected void createDatePicker( int style )
{
	btnDate = new Button( this, SWT.CHECK );
	btnDate.addListener( SWT.Selection, this );

	pickerDate = new DateTime( this, SWT.DATE | style );
	pickerDate.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	pickerDate.addListener( SWT.Selection, this );

	btnTime = new Button( this, SWT.CHECK );
	btnTime.addListener( SWT.Selection, this );

	pickerTime = new DateTime( this, SWT.TIME | style );
	pickerTime.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	pickerTime.addListener( SWT.Selection, this );
}
 
Example 3
Source Project: ermasterr   File: IndexDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void setTableEditor(final NormalColumn normalColumn, final TableItem tableItem, final Boolean desc) {
    final Button descCheckButton = new Button(indexColumnList, SWT.CHECK);
    descCheckButton.pack();

    if (DBManagerFactory.getDBManager(table.getDiagram()).isSupported(DBManager.SUPPORT_DESC_INDEX)) {

        final TableEditor editor = new TableEditor(indexColumnList);

        editor.minimumWidth = descCheckButton.getSize().x;
        editor.horizontalAlignment = SWT.CENTER;
        editor.setEditor(descCheckButton, tableItem, 1);

        columnCheckMap.put(normalColumn, editor);
    }

    descCheckBoxMap.put(normalColumn, descCheckButton);
    descCheckButton.setSelection(desc.booleanValue());
}
 
Example 4
Source Project: erflute   File: IndexDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void createCheckComposite(Composite composite) {
    final GridData gridData2 = new GridData();
    gridData2.horizontalSpan = 2;
    gridData2.heightHint = 30;
    gridData2.horizontalAlignment = GridData.FILL;
    gridData2.grabExcessHorizontalSpace = true;
    final Composite checkComposite = new Composite(composite, SWT.NONE);
    checkComposite.setLayoutData(gridData2);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;
    checkComposite.setLayout(gridLayout);
    this.uniqueCheckBox = new Button(checkComposite, SWT.CHECK);
    uniqueCheckBox.setText(DisplayMessages.getMessage("label.index.unique"));
    final DBManager dbManager = DBManagerFactory.getDBManager(table.getDiagram());
    if (dbManager.isSupported(DBManager.SUPPORT_FULLTEXT_INDEX)) {
        this.fullTextCheckBox = new Button(checkComposite, SWT.CHECK);
        fullTextCheckBox.setText(DisplayMessages.getMessage("label.index.fulltext"));
    }
}
 
Example 5
private void createPageControls( Composite parent ) {
  cleanupButton = new Button( parent, SWT.CHECK );
  cleanupButton.setText( "Remove on-the-fly generated launch configurations when no longer needed" );
  cleanupButton.addListener( SWT.Selection, this::cleanupButtonSelected );
  cleanupTypesLabel = new Label( parent, SWT.NONE );
  cleanupTypesLabel.setText( "Select the launch configuration types to clean up" );
  cleanupTypesViewer = CheckboxTableViewer.newCheckList( parent, SWT.BORDER );
  cleanupTypesViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() );
  cleanupTypesViewer.setContentProvider( ArrayContentProvider.getInstance() );
  cleanupTypesViewer.setComparator( new WorkbenchViewerComparator() );
  cleanupTypesViewer.addFilter( new LaunchConfigTypeFilter() );
  cleanupTypesViewer.setInput( launchManager.getLaunchConfigurationTypes() );
  selectAllButton = new Button( parent, SWT.PUSH );
  selectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( true ) );
  selectAllButton.setText( "&Select All" );
  deselectAllButton = new Button( parent, SWT.PUSH );
  deselectAllButton.setText( "&Deselect All" );
  deselectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( false ) );
  notelabel = new Label( parent, SWT.WRAP );
  String text
    = "Note: Launch configurations are considered as on-the-fly generated if "
    + "they were created outside the Run Configurations dialog without further "
    + "manual changes. For example with Run As > JUnit Test";
  notelabel.setText( text );
}
 
Example 6
Source Project: n4js   File: FileTypeComponent.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new definition file component using model in container.
 *
 * @param model
 *            The model to bind it to
 * @param container
 *            The container to create it in
 */
public FileTypeComponent(DefinitionFileModel model, WizardComponentContainer container) {
	super(container);
	this.model = model;

	Composite parent = getParentComposite();

	Label definitionFileLabel = new Label(parent, SWT.NONE);
	definitionFileLabel.setLayoutData(fillLabelDefaults());
	definitionFileLabel.setText("File type:");

	definitionFileBox = new Button(parent, SWT.CHECK);
	definitionFileBox.setText("Definition file (.n4jsd)");
	definitionFileBox.setLayoutData(fillLabelDefaults());

	WizardComponentUtils.emptyGridCell(parent);

	setupBindings();
}
 
Example 7
Source Project: ermasterr   File: SearchDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void createWordCheckboxGroup(final Composite parent) {
    final GridData gridData = new GridData();
    gridData.verticalAlignment = SWT.TOP;
    gridData.horizontalSpan = NUM_COLUMNS - 1;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final GridLayout layout = new GridLayout();
    layout.numColumns = 4;

    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    physicalWordNameCheckBox = new Button(group, SWT.CHECK);
    physicalWordNameCheckBox.setText(ResourceString.getResourceString("search.result.row.name.28"));

    logicalWordNameCheckBox = new Button(group, SWT.CHECK);
    logicalWordNameCheckBox.setText(ResourceString.getResourceString("search.result.row.name.29"));

    wordTypeCheckBox = new Button(group, SWT.CHECK);
    wordTypeCheckBox.setText(ResourceString.getResourceString("search.result.row.name.30"));

    wordLengthCheckBox = new Button(group, SWT.CHECK);
    wordLengthCheckBox.setText(ResourceString.getResourceString("search.result.row.name.31"));

    wordDecimalCheckBox = new Button(group, SWT.CHECK);
    wordDecimalCheckBox.setText(ResourceString.getResourceString("search.result.row.name.32"));

    wordDescriptionCheckBox = new Button(group, SWT.CHECK);
    wordDescriptionCheckBox.setText(ResourceString.getResourceString("search.result.row.name.33"));
}
 
Example 8
private void createWordWarp(Composite composite) {
       // draw label
       Label comboLabel = new Label(composite,SWT.LEFT);
       comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
       comboLabel.setText(LogViewerPlugin.getResourceString("preferences.contenteditor.wordWrap.label.text")); //$NON-NLS-1$
       // draw checkbox
       wordWrap = new Button(composite,SWT.CHECK);
       wordWrap.setSelection(doGetPreferenceStore().getBoolean(ILogViewerConstants.PREF_WORD_WRAP));
}
 
Example 9
private Button createNotCheck ()
{
    final Button b = new Button ( this, SWT.CHECK );
    b.setText ( Messages.not );
    b.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    return b;
}
 
Example 10
@Override
public void createControl(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.verticalSpacing = 16;
	composite.setLayout(layout);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	composite.setFont(parent.getFont());

	Label label= new Label(composite, SWT.NONE);
	label.setText("Variable name:");
	label.setFont(composite.getFont());
	label.setLayoutData(new GridData());

	nameField= new Text(composite, SWT.BORDER);
	nameField.setText(refactoring.getVariableName());
	nameField.setFont(composite.getFont());
	nameField.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
	nameField.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			validatePage();
		}
	});
	nameField.selectAll();
	
	finalButton = new Button(composite, SWT.CHECK);
	finalButton.setText("Declare as final 'val'");
	finalButton.setFont(composite.getFont());
	finalButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 2, 1));
	finalButton.setSelection(refactoring.isFinal());
	setControl(composite);
	validatePage();
}
 
Example 11
private void createAlwaysBtnArea(Composite parent){
	Composite btnCmp = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().grab(true, true).applyTo(btnCmp);
	GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(1).applyTo(btnCmp);
	
	alwaysBtn = new Button(btnCmp, SWT.CHECK);
	alwaysBtn.setText(Messages.getString("dialog.FileCoverMsgDialog.alwaysBtn"));
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	alwaysBtn.setSelection(store.getBoolean(alwaysStoreKey));
	GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(alwaysBtn);
}
 
Example 12
Source Project: birt   File: ScriptSWTFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public static Button createCheckBox( Composite parent, String label )
{
	Button button = new Button( parent, SWT.CHECK );
	button.setFont( parent.getFont( ) );
	if ( label != null )
	{
		button.setText( label );
	}

	GridData gd = new GridData( );
	button.setLayoutData( gd );
	setButtonDimensionHint( button );
	return button;
}
 
Example 13
Source Project: ermasterr   File: CompositeFactory.java    License: Apache License 2.0 4 votes vote down vote up
public static TableEditor createCheckBoxTableEditor(final TableItem tableItem, final boolean selection, final int column) {
    final Table table = tableItem.getParent();

    final Button checkBox = new Button(table, SWT.CHECK);
    checkBox.pack();

    final TableEditor editor = new TableEditor(table);

    editor.minimumWidth = checkBox.getSize().x;
    editor.horizontalAlignment = SWT.CENTER;
    editor.setEditor(checkBox, tableItem, column);

    checkBox.setSelection(selection);

    return editor;
}
 
Example 14
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new GridLayout());

	final TextAssistContentProvider contentProvider = new TextAssistContentProvider() {

		private final String[] EUROZONE = new String[] { "Austria", "Belgium", "Cyprus", "Estonia", "Finland", "France", "Germany", "Greece", "Ireland", "Italy", "Luxembourg", "Malta", "Netherlands", "Portugal", "Slovakia", "Slovenia", "Spain" };

		@Override
		public List<String> getContent(final String entry) {
			final List<String> returnedList = new ArrayList<String>();

			for (final String country : EUROZONE) {
				if (country.toLowerCase().startsWith(entry.toLowerCase())) {
					returnedList.add(country);
				}
			}

			return returnedList;
		}
	};

	final Label lblTextAssist = new Label(shell, SWT.NONE);
	lblTextAssist.setText("Text field with text assist:");

	final TextAssist textAssist = new TextAssist(shell, SWT.SINGLE | SWT.BORDER, contentProvider);
	textAssist.setLayoutData(new GridData(150, SWT.DEFAULT));

	new Label(shell, SWT.NONE);
	final Label lblSimpleText = new Label(shell, SWT.NONE);
	lblSimpleText.setText("Simple Text field:");

	final Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
	text.setLayoutData(new GridData(150, SWT.DEFAULT));

	new Label(shell, SWT.NONE);
	final Button button = new Button(shell, SWT.PUSH);
	button.setText("Force focus on Text Assist Field");
	button.addListener(SWT.Selection, e -> textAssist.setFocus());

	new Label(shell, SWT.NONE);
	final Button singleClickButton = new Button(shell, SWT.CHECK);
	singleClickButton.setText("Use single click to select an entry");
	singleClickButton.addListener(SWT.Selection, e -> {
		useSingleClick = !useSingleClick;
		textAssist.setUseSingleClick(useSingleClick);
	});

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}
 
Example 15
private Composite createOptionsPanel(final Composite composite) {
	final Group optionsGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
	optionsGroup.setText(Messages.getString("dialog.FindReplaceDialog.optionsGroup"));
	final GridLayout gridLayout = new GridLayout(2, true);
	optionsGroup.setLayout(gridLayout);
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(optionsGroup);
	// optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	caseSensitiveButton = new Button(optionsGroup, SWT.CHECK);
	caseSensitiveButton.setText(Messages.getString("dialog.FindReplaceDialog.caseSensitiveButton"));
	GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(caseSensitiveButton);
	/** burke 修改find/replace界面框 注释 */
	/*
	 * wrapSearchButton = new Button(optionsGroup, SWT.CHECK); wrapSearchButton.setText("&Wrap Search");
	 * wrapSearchButton.setSelection(true); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false,
	 * false).applyTo(wrapSearchButton);
	 */

	wholeWordButton = new Button(optionsGroup, SWT.CHECK);
	wholeWordButton.setText(Messages.getString("dialog.FindReplaceDialog.wholeWordButton"));
	GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(wholeWordButton);
	/** burke 修改find/replace界面框 注释 */
	/*
	 * fuzzySearchButton = new Button(optionsGroup, SWT.CHECK); fuzzySearchButton.setText("Fu&zzy Search");
	 * GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(fuzzySearchButton);
	 */

	regExButton = new Button(optionsGroup, SWT.CHECK);
	regExButton.setText(Messages.getString("dialog.FindReplaceDialog.regExButton"));
	regExButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (regExButton.getSelection()) {
				wholeWordButton.setEnabled(false);
				/** burke 修改find/replace界面框 注释 */
				// fuzzySearchButton.setEnabled(false);
			} else {
				wholeWordButton.setEnabled(true);
				/** burke 修改find/replace界面框 注释 */
				// fuzzySearchButton.setEnabled(true);
			}
		}
	});
	GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).span(2, 1).applyTo(regExButton);

	return optionsGroup;
}
 
Example 16
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	setMessage(String.format("Passwort für User %s ändern", user.getId()));
	setTitle("Passwort ändern");
	Composite area = (Composite) super.createDialogArea(parent);
	Composite container = new Composite(area, SWT.NONE);
	container.setLayout(new GridLayout(2, false));
	container.setLayoutData(new GridData(GridData.FILL_BOTH));

	Label lblNewPassword = new Label(container, SWT.NONE);
	lblNewPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblNewPassword.setText("Neues Passwort");

	txtPassword1 = new Text(container, SWT.BORDER | SWT.PASSWORD);
	txtPassword1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	txtPassword1.addKeyListener(pcl);

	Label lblConfirm = new Label(container, SWT.NONE);
	lblConfirm.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblConfirm.setText("Bestätigen");

	txtPassword2 = new Text(container, SWT.BORDER | SWT.PASSWORD);
	txtPassword2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	txtPassword2.addKeyListener(pcl);
	new Label(container, SWT.NONE);
	new Label(container, SWT.NONE);

	Label lblHint = new Label(container, SWT.NONE);
	lblHint.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
	lblHint.setText("Tipp");

	Label lblHintText = new Label(container, SWT.NONE);
	lblHintText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblHintText.setText(
			"Denken Sie sich einen kompletten Satz mit einer Zahl.\nVerwenden Sie nun die Anfangsbuchstaben jedes Wortes, \nunter Berücksichtigung der Groß/Kleinschreibung.\n\nEin Beispiel:\nDer Satz „Vor kurzem wurde ich 42 Jahre alt.“ wird zum\nPasswort „Vkwi42Ja“.");
	new Label(container, SWT.NONE);

	Button btnDisableRules = new Button(container, SWT.CHECK);
	btnDisableRules.setText("Prüfregeln ignorieren (nicht empfohlen)");
	btnDisableRules.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			rulesDisabled = btnDisableRules.getSelection();
			update();
		}
	});

	return area;
}
 
Example 17
@Override
public void createControl(Composite parent) {
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 5, 0, 0).create());
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    
    final Label textArea = new Label(mainComposite,  SWT.WRAP );
    textArea.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).hint(600, SWT.DEFAULT).create());
    textArea.setText(Messages.bind(Messages.importWarningMessageContent, new Object[]{bosProductName}));
    
    final Composite captionComposite = new Composite(mainComposite,SWT.NONE);
    captionComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(10,15).create());
    captionComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    
    final CLabel noActionRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    noActionRequiredLabel.setText(Messages.noActionRequiredHelp);
    noActionRequiredLabel.setImage(Pics.getImage("valid.png",MigrationPlugin.getDefault()));
    noActionRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final CLabel reviewRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    reviewRequiredLabel.setText(Messages.reviewRequiredHelp);
    reviewRequiredLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK));
    reviewRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final CLabel actionRequiredLabel = new CLabel(captionComposite,SWT.WRAP);
    actionRequiredLabel.setText(Messages.actionRequiredHelp);
    actionRequiredLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
    actionRequiredLabel.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).create());
    
    final Label textArea2 = new Label(mainComposite,  SWT.WRAP );
    textArea2.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).hint(600, SWT.DEFAULT).create());
    textArea2.setText(Messages.importWarningMessageContentAfterPart);
    final Composite buttonComposite = new Composite(mainComposite,SWT.NONE);
    buttonComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());
    buttonComposite.setLayoutData(GridDataFactory.swtDefaults().grab(true, true).create());
    final Button displayCheckbox = new Button(buttonComposite, SWT.CHECK);
    displayCheckbox.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).indent(0, 10).align(SWT.BEGINNING, SWT.BOTTOM).create());
    displayCheckbox.setText(Messages.doNotDisplayAtNextImport);
    displayCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
        	MigrationPlugin.getDefault().getPreferenceStore().setValue(BarImporterPreferenceConstants.DISPLAY_MIGRATION_WARNING, !displayCheckbox.getSelection());
        }
    });
    displayCheckbox.setSelection(!MigrationPlugin.getDefault().getPreferenceStore().getBoolean(BarImporterPreferenceConstants.DISPLAY_MIGRATION_WARNING));

    setControl(mainComposite);
}
 
Example 18
Source Project: hop   File: SimpleMappingDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target transforms.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, false, lsMod, props, false
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, parameters.getVariable()[ i ] );
      tableItem.setText( 2, parameters.getInputField()[ i ] );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    changeList.add( new MappingParametersTab( wMappingParameters, wInheritAll, parameters ) );
  }
 
Example 19
@Override
protected CellEditor getCellEditor(Object element) {
	return new CheckboxCellEditor(null, SWT.CHECK);
}
 
Example 20
Source Project: pentaho-kettle   File: MappingDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "MappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "MappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "MappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target steps.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "MappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "MappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, lsMod, props
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, Const.NVL( parameters.getVariable()[ i ], "" ) );
      tableItem.setText( 2, Const.NVL( parameters.getInputField()[ i ], "" ) );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    parameterChanges = new MappingParametersTab( wMappingParameters, wInheritAll, parameters );
  }