Java Code Examples for org.eclipse.nebula.widgets.tablecombo.TableCombo#setVisibleItemCount()

The following examples show how to use org.eclipse.nebula.widgets.tablecombo.TableCombo#setVisibleItemCount() . 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: TableComboExampleTab.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * {@inheritDoc}
 */
public Control createControl(Composite parent) {
	
	// set the style.
	int style = SWT.BORDER | SWT.READ_ONLY;
	if ( borderStyle.getSelection() ) {
		style |= SWT.BORDER;
	}
	if ( readOnlyStyle.getSelection() ) {
		style |= SWT.READ_ONLY;
	}
	if ( flatStyle.getSelection() ) {
		style |= SWT.FLAT;
	}
	
	// create table combo instance.
	tableCombo = new TableCombo(parent, style);

	// set options.
	tableCombo.setShowTableLines(showGrid.getSelection());
	tableCombo.setShowTableHeader(showHeader.getSelection());
	tableCombo.setDisplayColumnIndex(columnIndexToDisplayWhenSelected.getSelection() - 1);
	tableCombo.setShowImageWithinSelection(showImageInSelection.getSelection());
	tableCombo.setShowColorWithinSelection(showCustomFontInSelection.getSelection());
	tableCombo.setShowFontWithinSelection(showCustomFontInSelection.getSelection());
	tableCombo.setClosePopupAfterSelection(closePopupAfterSelection.getSelection());
	tableCombo.setTableWidthPercentage(tableWidthPct.getSelection());
	tableCombo.setVisibleItemCount(numOfRowsDisplayed.getSelection());
	
	// load the model and data.
	loadData(loadModel(), tableCombo);

	return tableCombo;
}
 
Example 2
Source File: QAInstalPage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
private void createTableCombo(TableComboViewer tCmbViewer){
	TableCombo tableCombo = tCmbViewer.getTableCombo();
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(2);	
	GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(tableCombo);
	
	tCmbViewer.setLabelProvider(new QATipsLabelProvider());
	tCmbViewer.setContentProvider(new ArrayContentProvider());
	tCmbViewer.setInput(CONSTANT_COMBOVALUE);
}
 
Example 3
Source File: ProjectSettingLanguagePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the preference page.
 * @param parent
 */
@Override
public Control createContents(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	// source language control
	Group sourceLanguageGrp = new Group(container, SWT.NONE);
	sourceLanguageGrp.setLayout(new GridLayout(1, false));
	sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	sourceLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp"));

	srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
	TableCombo tableCombo = srcLangComboViewer.getTableCombo();
	// set options.
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(20);

	srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
	srcLangComboViewer.setContentProvider(new ArrayContentProvider());
	srcLangComboViewer.setInput(languages);
	srcLangComboViewer.setComparer(elementComparer);
	initDataBindings();
	// end source language

	// target language control
	Group targetLanguageGrp = new Group(container, SWT.NONE);
	targetLanguageGrp.setLayout(new GridLayout(3, false));
	targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	targetLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.targetLanguageGrp"));
	targetLangControl.createControl(targetLanguageGrp);
	parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	return container;
}
 
Example 4
Source File: QAInstalPage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void createTableCombo(TableComboViewer tCmbViewer){
	TableCombo tableCombo = tCmbViewer.getTableCombo();
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(2);	
	GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(tableCombo);
	
	tCmbViewer.setLabelProvider(new QATipsLabelProvider());
	tCmbViewer.setContentProvider(new ArrayContentProvider());
	tCmbViewer.setInput(CONSTANT_COMBOVALUE);
}
 
Example 5
Source File: ProjectSettingLanguagePage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the preference page.
 * @param parent
 */
@Override
public Control createContents(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	// source language control
	Group sourceLanguageGrp = new Group(container, SWT.NONE);
	sourceLanguageGrp.setLayout(new GridLayout(1, false));
	sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	sourceLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp"));

	srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
	TableCombo tableCombo = srcLangComboViewer.getTableCombo();
	// set options.
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(20);

	srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
	srcLangComboViewer.setContentProvider(new ArrayContentProvider());
	srcLangComboViewer.setInput(languages);
	srcLangComboViewer.setComparer(elementComparer);
	initDataBindings();
	// end source language

	// target language control
	Group targetLanguageGrp = new Group(container, SWT.NONE);
	targetLanguageGrp.setLayout(new GridLayout(3, false));
	targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	targetLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.targetLanguageGrp"));
	targetLangControl.createControl(targetLanguageGrp);
	parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	return container;
}
 
Example 6
Source File: NewProjectWizardLanguagePage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the wizard.
 * @param parent
 */
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	// source language control
	Group sourceLanguageGrp = new Group(container, SWT.NONE);
	sourceLanguageGrp.setLayout(new GridLayout(1, false));
	sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	sourceLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.sourceLanguageGrp"));

	srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
	TableCombo tableCombo = srcLangComboViewer.getTableCombo();
	// set options.
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(20);
	srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
	srcLangComboViewer.setContentProvider(new ArrayContentProvider());
	srcLangComboViewer.setInput(languages);
	srcLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();
			srcLanguage = (Language) selection.getFirstElement();
			validator.update();
		}
	});
	// initialization remember value
	String rmSrcLangCode = ps.getString(IPreferenceConstants.NEW_PROJECT_SRC_LANG);
	if (rmSrcLangCode != null && !rmSrcLangCode.equals("")) {
		for (Language srcLang : languages) {
			if (srcLang.getCode().equals(rmSrcLangCode)) {
				srcLangComboViewer.setSelection(new StructuredSelection(srcLang));
				break;
			}
		}
	}

	// end source language

	// target language control
	Group targetLanguageGrp = new Group(container, SWT.NONE);
	targetLanguageGrp.setLayout(new GridLayout(3, false));
	targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	targetLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.targetLanguageGrp"));
	targetLangControl.createControl(targetLanguageGrp);
	// end Target language

	setControl(container);
	validator.update();
}
 
Example 7
Source File: NewProjectWizardLanguagePage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the wizard.
 * @param parent
 */
public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	// source language control
	Group sourceLanguageGrp = new Group(container, SWT.NONE);
	sourceLanguageGrp.setLayout(new GridLayout(1, false));
	sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	sourceLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.sourceLanguageGrp"));

	srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
	TableCombo tableCombo = srcLangComboViewer.getTableCombo();
	// set options.
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(20);
	srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
	srcLangComboViewer.setContentProvider(new ArrayContentProvider());
	srcLangComboViewer.setInput(languages);
	srcLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

		public void selectionChanged(SelectionChangedEvent event) {
			IStructuredSelection selection = (IStructuredSelection) event.getSelection();
			srcLanguage = (Language) selection.getFirstElement();
			validator.update();
		}
	});
	// initialization remember value
	String rmSrcLangCode = ps.getString(IPreferenceConstants.NEW_PROJECT_SRC_LANG);
	if (rmSrcLangCode != null && !rmSrcLangCode.equals("")) {
		for (Language srcLang : languages) {
			if (srcLang.getCode().equals(rmSrcLangCode)) {
				srcLangComboViewer.setSelection(new StructuredSelection(srcLang));
				break;
			}
		}
	}

	// end source language

	// target language control
	Group targetLanguageGrp = new Group(container, SWT.NONE);
	targetLanguageGrp.setLayout(new GridLayout(3, false));
	targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	targetLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.targetLanguageGrp"));
	targetLangControl.createControl(targetLanguageGrp);
	// end Target language

	setControl(container);
	validator.update();
}