Java Code Examples for org.eclipse.swt.layout.GridData#FILL_BOTH

The following examples show how to use org.eclipse.swt.layout.GridData#FILL_BOTH . 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: RenameTypeWizardSimilarElementsPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeAndSourceViewer(Composite superComposite) {
	SashForm composite= new SashForm(superComposite, SWT.HORIZONTAL);
	initializeDialogUnits(superComposite);
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= convertHeightInCharsToPixels(20);
	gd.widthHint= convertWidthInCharsToPixels(10);
	composite.setLayoutData(gd);
	GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	composite.setLayout(layout);

	createSimilarElementTreeComposite(composite);
	createSourceViewerComposite(composite);
	composite.setWeights(new int[] { 50, 50 });
}
 
Example 2
Source File: XLFEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	initColors(parent);

	GridLayout glParent = new GridLayout(1, false);
	glParent.horizontalSpacing = 0;
	glParent.verticalSpacing = 0;
	glParent.marginHeight = 0;
	glParent.marginWidth = 0;
	parent.setLayout(glParent);
	GridData gdParent = new GridData(GridData.FILL_BOTH);
	gdParent.grabExcessVerticalSpace = true;
	gdParent.grabExcessHorizontalSpace = true;
	parent.setLayoutData(gdParent);

	createFilterPart(parent);
	createEditorPart(parent);
	parent.layout();
}
 
Example 3
Source File: FieldDialogImpl.java    From jenerate with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createFieldComposite(final Composite composite) {
    Composite fieldComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    fieldComposite.setLayout(layout);

    fieldViewer = CheckboxTableViewer.newCheckList(fieldComposite, SWT.MULTI | SWT.TOP | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.grabExcessHorizontalSpace = true;

    fieldViewer.getTable().setLayoutData(data);

    fieldViewer.setLabelProvider(new JavaElementLabelProvider());
    fieldViewer.setContentProvider(new ArrayContentProvider());
    fieldViewer.setInput(allFields);
    selectAllNonTransientFields();
    return fieldComposite;
}
 
Example 4
Source File: DifferenceDataDefinitionComponent.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createArea( Composite parent )
{
	cmpSeries = new Composite( parent, SWT.NONE );
	{
		GridData gridData = new GridData( GridData.FILL_BOTH );
		cmpSeries.setLayoutData( gridData );

		GridLayout gridLayout = new GridLayout( 2, false );
		gridLayout.marginWidth = 0;
		gridLayout.marginHeight = 0;
		cmpSeries.setLayout( gridLayout );
	}

	for ( int i = 0; i < dataComArray.length; i++ )
	{
		labelArray[i] = new Label( cmpSeries, SWT.NONE );
		labelArray[i].setText( ChartUIUtil.getDifferenceTitle( i ) + "*" ); //$NON-NLS-1$
		Composite cmpData = dataComArray[i].createArea( cmpSeries );
		cmpData.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
		( (BaseDataDefinitionComponent) dataComArray[i] ).bindAssociatedName( ChartUIUtil.getDifferenceTitle( i ) );
	}
	return cmpSeries;
}
 
Example 5
Source File: TimeGraphFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Label messageLabel = createMessageArea(composite);
    CheckboxTreeViewer treeViewer = createTreeViewer(composite);
    Control buttonComposite = createSelectionButtons(composite);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(fWidth);
    data.heightHint = convertHeightInCharsToPixels(fHeight);
    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(parent.getFont());
    if (fIsEmpty) {
        messageLabel.setEnabled(false);
        treeWidget.setEnabled(false);
        buttonComposite.setEnabled(false);
    }
    return composite;
}
 
Example 6
Source File: MeasureDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea( Composite parent )
{
	UIUtil.bindHelp( parent, IHelpContextIds.MEASURE_DIALOG );

	Composite area = (Composite) super.createDialogArea( parent );

       ScrolledComposite sc = new ScrolledComposite( area, SWT.V_SCROLL );
       sc.setAlwaysShowScrollBars( false );
       sc.setExpandHorizontal( true );
       sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );
       
	Composite contents = new Composite( sc, SWT.NONE);
       sc.setContent( contents );

       GridLayout layout = new GridLayout( );
       layout.verticalSpacing = 0;
       layout.marginWidth = 20;
       contents.setLayout( layout );

       GridData data = new GridData( GridData.FILL_BOTH );
       data.widthHint = convertWidthInCharsToPixels( 70 );
       contents.setLayoutData( data );
       
	createMeasureArea( contents );

	createVisibilityGroup( contents);

	WidgetUtil.createGridPlaceholder( contents, 1, true );

	initMeasureDialog( );

       // calculate the size explicitly as it is in scrollable composite
       Point size = contents.computeSize( SWT.DEFAULT, SWT.DEFAULT );
       contents.setSize( Math.max( size.x, 400 ), Math.max( size.y, 320 ) );

	return contents;
}
 
Example 7
Source File: ChartCheckbox.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void placeComponents( int styles )
{
	GridLayout gl = new GridLayout( );
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	gl.marginLeft = 2;
	gl.marginRight = 2;
	gl.marginTop = 2;
	gl.marginBottom = 2;
	setLayout( gl );
	button = new Button( this, SWT.CHECK | styles );
	GridData gd = new GridData( GridData.FILL_BOTH );
	button.setLayoutData( gd );
}
 
Example 8
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createSourceViewer(Composite parent) {
	Composite c= new Composite(parent, SWT.NONE);
	c.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout gl= new GridLayout();
	gl.marginHeight= 0;
	gl.marginWidth= 0;
	c.setLayout(gl);

	Label l= new Label(c, SWT.NONE);
	l.setText(NLSUIMessages.ExternalizeWizardPage_context);
	l.setLayoutData(new GridData());

	// source viewer
	JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
	int styles= SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	fSourceViewer= new JavaSourceViewer(c, null, null, false, styles, store);
	fSourceViewer.configure(new JavaSourceViewerConfiguration(tools.getColorManager(), store, null, null));
	fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));

	try {

		String contents= fCu.getBuffer().getContents();
		IDocument document= new Document(contents);
		tools.setupJavaDocumentPartitioner(document);

		fSourceViewer.setDocument(document);
		fSourceViewer.setEditable(false);

		GridData gd= new GridData(GridData.FILL_BOTH);
		gd.heightHint= convertHeightInCharsToPixels(10);
		gd.widthHint= convertWidthInCharsToPixels(40);
		fSourceViewer.getControl().setLayoutData(gd);

	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, NLSUIMessages.ExternalizeWizardPage_exception_title, NLSUIMessages.ExternalizeWizardPage_exception_message);
	}
}
 
Example 9
Source File: RuleConfigurationEditDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Composite createGeneralSection() {
  Composite generalSettings = new Composite(mMainTab, SWT.NULL);
  generalSettings.setLayoutData(new GridData(GridData.FILL_BOTH));
  GridLayout layout = new GridLayout(2, false);
  generalSettings.setLayout(layout);

  // Build severity
  Label lblSeverity = new Label(generalSettings, SWT.NULL);
  lblSeverity.setText(Messages.RuleConfigurationEditDialog_lblSeverity);
  lblSeverity.setLayoutData(new GridData());

  mSeverityCombo = new ComboViewer(generalSettings);
  mSeverityCombo.setContentProvider(new ArrayContentProvider());
  mSeverityCombo.setLabelProvider(new LabelProvider() {
    /**
     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
     */
    @Override
    public String getText(Object element) {
      return ((Severity) element).name();
    }
  });
  mSeverityCombo.getControl().setLayoutData(new GridData());

  Group properties = new Group(generalSettings, SWT.NULL);
  properties.setLayout(new GridLayout(3, false));
  properties.setText(Messages.RuleConfigurationEditDialog_lblProperties);
  GridData gd = new GridData(GridData.FILL_BOTH);
  gd.horizontalSpan = 2;
  properties.setLayoutData(gd);

  createConfigPropertyEntries(properties);

  if (mConfigPropertyWidgets == null || mConfigPropertyWidgets.length == 0) {

    properties.dispose();
  }
  return generalSettings;
}
 
Example 10
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Control createTable(Composite parent) {
	Composite c= new Composite(parent, SWT.NONE);
	GridLayout gl= new GridLayout();
	gl.numColumns= 2;
	gl.marginWidth= 0;
	gl.marginHeight= 0;
	c.setLayout(gl);


	fTable= new Table(c, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
	fTable.setFont(parent.getFont());

	GridData tableGD= new GridData(GridData.FILL_BOTH);
	tableGD.heightHint= SWTUtil.getTableHeightHint(fTable, ROW_COUNT);
	//tableGD.widthHint= 40;
	fTable.setLayoutData(tableGD);

	fTable.setLinesVisible(true);

	TableLayout layout= new TableLayout();
	fTable.setLayout(layout);
	fTable.setHeaderVisible(true);

	ColumnLayoutData[] columnLayoutData= new ColumnLayoutData[SIZE];
	columnLayoutData[STATE_PROP]= new ColumnPixelData(18, false, true);
	columnLayoutData[KEY_PROP]= new ColumnWeightData(40, true);
	columnLayoutData[VAL_PROP]= new ColumnWeightData(40, true);

	for (int i= 0; i < fgTitles.length; i++) {
		TableColumn tc= new TableColumn(fTable, SWT.NONE, i);
		tc.setText(fgTitles[i]);
		layout.addColumnData(columnLayoutData[i]);
		tc.setResizable(columnLayoutData[i].resizable);
	}

	createButtonComposite(c);
	return c;
}
 
Example 11
Source File: AbstractPropertyDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private final Composite createPropertyPane( Composite parent )
{
	// If the title is visible
	// create the title area.
	Composite propertyContainer = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	propertyContainer.setLayout( layout );

	Composite titleComposite = new Composite( propertyContainer, SWT.NONE );
	layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	layout.horizontalSpacing = 0;
	titleComposite.setLayout( layout );
	GridData titleLayoutData = new GridData( GridData.FILL_HORIZONTAL );
	titleLayoutData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	titleComposite.setLayoutData( titleLayoutData );

	if ( isTitleVisible( ) )
	{
		createTitleArea( titleComposite );

		Label separator = new Label( propertyContainer, SWT.HORIZONTAL
				| SWT.SEPARATOR );
		separator.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
				| GridData.GRAB_HORIZONTAL ) );
	}

	GridData data = new GridData( GridData.FILL_BOTH );
	propertyPane = new Composite( propertyContainer, SWT.NONE );
	propertyPane.setLayout( propertyPaneLayout );
	propertyPane.setLayoutData( data );
	return propertyContainer;
}
 
Example 12
Source File: MultipleSelectionCombo.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void initFloatShell() {
  Point p = displayText.getParent().toDisplay( displayText.getLocation() );
  Point size = displayText.getSize();
  Rectangle shellRect = new Rectangle( p.x, p.y + size.y, size.x, 0 );
  floatShell = new Shell( MultipleSelectionCombo.this.getShell(),
          SWT.NO_TRIM );

  GridLayout gl = new GridLayout();
  gl.marginBottom = 2;
  gl.marginTop = 2;
  gl.marginRight = 0;
  gl.marginLeft = 0;
  gl.marginWidth = 0;
  gl.marginHeight = 0;
  floatShell.setLayout( gl );

  list = new List( floatShell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL
          | SWT.V_SCROLL );
  for ( String value : comboItems ) {
    list.add( value );
  }

  GridData gd = new GridData( GridData.FILL_BOTH );
  list.setLayoutData( gd );
  floatShell.setSize( shellRect.width, 100 );
  floatShell.setLocation( shellRect.x, shellRect.y );
  list.addMouseListener( new MouseAdapter() {
    @Override
    public void mouseUp( MouseEvent event ) {
      super.mouseUp( event );
      comboSelection = list.getSelectionIndices();
      displayText();
    }
  } );

  floatShell.open();
}
 
Example 13
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NONE );
	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 );
	composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	applyDialogFont( composite );

	new Label( composite, SWT.NONE ).setText( Messages.getString( "InputParameterDialog.msg.requiredParam" ) ); //$NON-NLS-1$

	scrollPane = new ScrolledComposite( composite, SWT.H_SCROLL
			| SWT.V_SCROLL );
	scrollPane.setExpandHorizontal( true );
	scrollPane.setExpandVertical( true );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.widthHint = 400;
	gd.heightHint = 400;
	scrollPane.setLayoutData( gd );

	createParameters( );

	UIUtil.bindHelp( parent, IHelpContextIds.INPUT_PARAMETERS_DIALOG_ID );

	return composite;
}
 
Example 14
Source File: JointDataSetPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * create top composite for page
 * 
 * @param parent
 */
private void createTopComposite( Composite parent )
{
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	parent.setLayout( layout );

	GridData data = new GridData( GridData.FILL_BOTH );
	parent.setLayoutData( data );

	createLeftGroup( parent );
	createCenterGroup( parent );
	createRightGroup( parent );
}
 
Example 15
Source File: ConfigurationWizardDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    composite.setFont(parent.getFont());

    final Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    titleBarSeparator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());

    createPageChooserComposite(composite);

    // Build the Page container
    final Composite groupContainer = new Composite(composite, SWT.NONE);
    groupContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    groupContainer.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).create());
    group = new Group(groupContainer, SWT.NONE);
    group.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    group.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).create());
    pageContainer = createPageContainer(group);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = getInitialSize().x;
    gd.heightHint = getInitialSize().y;
    pageContainer.setLayoutData(gd);
    pageContainer.setFont(parent.getFont());

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 30).create());
    try {
        Field f = WizardDialog.class.getDeclaredField("pageContainer");
        f.setAccessible(true);
        f.set(this, pageContainer);
    } catch (Exception e) {
        BonitaStudioLog.error(e);
    }
    // Build the separator line
    Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());

    applyDialogFont(progressMonitorPart);

    return composite;

}
 
Example 16
Source File: LogLevelSelectionDialog.java    From codewind-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
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;
}
 
Example 17
Source File: AbstractDialog.java    From erflute with Apache License 2.0 4 votes vote down vote up
protected Object createLayoutData() {
    return new GridData(GridData.FILL_BOTH);
}
 
Example 18
Source File: AdvancePropertyDescriptor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createControl( Composite parent )
{
	container = new Composite( parent, SWT.NONE );
	GridLayout layout = UIUtil.createGridLayoutWithoutMargin( 1, false );
	layout.marginTop = 2;
	layout.marginWidth = layout.marginBottom = 1;
	container.setLayout( layout );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	initSortingType( );

	viewer = new CustomTreeViewer( container, SWT.FULL_SELECTION );

	tableTree = viewer.getTree( );
	GridData gd = new GridData( GridData.FILL_BOTH );
	tableTree.setLayoutData( gd );
	tableTree.setHeaderVisible( true );
	tableTree.setLinesVisible( true );

	viewer.setContentProvider( provider.getContentProvier( ) );

	TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY );
	tvc1.getColumn( ).setWidth( 300 );
	tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getNameLabelProvier( ) ) );

	TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE );
	tvc2.getColumn( ).setWidth( 400 );
	tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getValueLabelProvier( ) ) );

	AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( );
	sorter.setAscending( true );
	viewer.setSorter( sorter );

	hookControl( );

	// create a new table tree editor
	tableTreeEditor = new TreeEditor( tableTree );

	// create the editor listener
	createEditorListener( );

	MementoBuilder builder = new MementoBuilder( );
	if ( ( propertySheetMemento = builder.getRootMemento( )
			.getChild( IPageLayout.ID_PROP_SHEET ) ) == null )
	{
		propertySheetMemento = builder.getRootMemento( )
				.createChild( IPageLayout.ID_PROP_SHEET,
						MementoElement.Type_View );
	}

	if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null )
	{
		viewerMemento = propertySheetMemento.createChild( propertyViewerID,
				MementoElement.Type_Viewer );
	}

	return container;
}
 
Example 19
Source File: AggregationDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createSubTotalArea( Composite content )
{
	CLabel subTotalLabel = new CLabel( content, SWT.NONE );
	subTotalLabel.setText( Messages.getString( "AggregationDialog.Label.Sub" ) ); //$NON-NLS-1$
	if ( axis == ICrosstabConstants.ROW_AXIS_TYPE )
	{
		subTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.ROW_SUB_TOTAL_IMAGE ) );
	}
	else if ( axis == ICrosstabConstants.COLUMN_AXIS_TYPE )
	{
		subTotalLabel.setImage( CrosstabUIHelper.getImage( CrosstabUIHelper.COLUMN_SUB_TOTAL_IMAGE ) );
	}

	Table table = new Table( content, SWT.SINGLE
			| SWT.BORDER
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.FULL_SELECTION
			| SWT.CHECK );
	table.setLinesVisible( false );
	table.setHeaderVisible( true );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.minimumHeight = 200;
	table.setLayoutData( gd );

	subTableViewer = new CheckboxTableViewer( table );
	SubTotalProvider provider = new SubTotalProvider( subTableViewer,crosstab,axis );

	String[] columnNames = provider.getColumnNames( );
	int[] columnWidths = provider.columnWidths( );
	for ( int i = 0; i < columnNames.length; i++ )
	{
		TableColumn column = new TableColumn( table, SWT.LEFT );
		column.setText( columnNames[i] );
		column.setWidth( columnWidths[i] );
	}

	subTableViewer.setUseHashlookup( true );
	subTableViewer.setColumnProperties( provider.getColumnNames( ) );
	subTableViewer.setCellEditors( provider.getCellEditors( ) );
	subTableViewer.setContentProvider( provider );
	subTableViewer.setLabelProvider( provider );
	subTableViewer.setCellModifier( provider );

}
 
Example 20
Source File: LanguageCodesPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 构建界面显示控件
 * @param parent
 *            顶层容器 ;
 */
private Composite initContents(Composite parent) {

	final Composite page = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	page.setLayout(layout);

	// 不显示过滤文本框
	PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false);

	Group groupParent = new Group(page, SWT.None);
	groupParent.setLayout(new GridLayout());
	groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
	groupParent.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.groupParent"));

	HsImageLabel imageLabel = new HsImageLabel(
			Messages.getString("languagecode.LanguageCodesPreferencePage.imageLabel"),
			Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_LANG_CODE));
	Composite cmp = imageLabel.createControl(groupParent);
	cmp.setLayout(new GridLayout());
	Composite cmpTemp = (Composite) imageLabel.getControl();
	cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
	Composite cmpContent = new Composite(cmpTemp, SWT.None);
	cmpContent.setLayout(layout);
	GridData data = new GridData(GridData.FILL_BOTH);
	data.horizontalSpan = 2;
	cmpContent.setLayoutData(data);

	// 放置过滤文本框的容器
	createFilterControls(cmpContent);

	// 创建添加、删除按钮
	createLanguageControls(page);

	// 暂注释掉 创建与当前语言区域相关的数字、货币、时间、短日期、长日期的格式显示控件
	// createLocaleFormatControls(page);
	imageLabel.computeSize();
	// cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	return page;
}