Java Code Examples for org.eclipse.swt.widgets.Composite#computeSize()

The following examples show how to use org.eclipse.swt.widgets.Composite#computeSize() . 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: Trees.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
public static TreeViewer createViewer(
		Composite parent, String[] headers, IBaseLabelProvider label) {
	TreeViewer viewer = new TreeViewer(parent,
			SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI);
	Tree tree = viewer.getTree();
	boolean hasColumns = headers != null && headers.length > 0;
	tree.setLinesVisible(hasColumns);
	tree.setHeaderVisible(hasColumns);
	if (hasColumns) {
		createColumns(viewer, headers, label);
	}
	if (label != null) {
		viewer.setLabelProvider(label);
	}
	GridData data = UI.gridData(tree, true, true);
	data.minimumHeight = 120;
	Point p = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	data.heightHint = p.y < 120 ? 120 : p.y;
	return viewer;
}
 
Example 2
Source File: FieldEditorOverlayPage.java    From cppcheclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Must be called for each composite after some fieldeditors are added,
 * because each field editor resets the parent's layout manager in
 * FieldEditor::createControl
 * 
 * @param composite
 */
protected void setCompositeLayout(Composite composite) {

	Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	composite.setSize(size);
	composite.setFont(getFieldEditorParent().getFont());

	GridLayout layout = new GridLayout(2, false);
	/*
	 * layout.numColumns = 1; layout.marginLeft = 40; layout.marginHeight =
	 * 10;
	 */
	layout.horizontalSpacing = 8;
	composite.setLayout(layout);

	GridData gd = new GridData();
	gd.horizontalSpan = 2;
	composite.setLayoutData(gd);
}
 
Example 3
Source File: SelectableControlList.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Do layout. Several magic #s in here...
 * 
 * @param scrolledComposite
 */
private void setupScrolledComposite() {
  setAlwaysShowScrollBars(true);

  scrolledCanvas = new Composite(this, SWT.NONE);
  GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(scrolledCanvas);

  setMinWidth(100);
  setMinHeight(100);
  setExpandHorizontal(true);
  setExpandVertical(true);
  setMinHeight(1);

  Point size = scrolledCanvas.computeSize(getParent().getSize().x,
      SWT.DEFAULT, true);
  scrolledCanvas.setSize(size);

  addControlListener(new ControlAdapter() {
    @Override
    public void controlResized(ControlEvent e) {
      doUpdateContentSize();
      updateScrollIncrements();
    }
  });
  setContent(scrolledCanvas);
}
 
Example 4
Source File: MongoDBDataSourcePageHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createPageControls( Composite parent )
{
	ScrolledComposite scrolledComposite = new ScrolledComposite( parent,
			SWT.V_SCROLL | SWT.H_SCROLL );
	scrolledComposite.setAlwaysShowScrollBars( false );
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	scrolledComposite.setLayout( new FillLayout( ) );
	Composite composite = new Composite( scrolledComposite, SWT.NONE );
	composite.setLayout( new GridLayout( ) );

	createURIRadioButtonsArea( composite );

	createClientSettingsArea( composite );
	
	createKerberosSettingsArea( composite );
	Point size = composite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	scrolledComposite.setMinWidth( size.x + 250 );
	scrolledComposite.setMinHeight( size.y + 20 );
	scrolledComposite.setContent( composite );
	return composite;

}
 
Example 5
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	ScrolledPageContent scrolled= new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	scrolled.setExpandHorizontal(true);
	scrolled.setExpandVertical(true);

	Composite control= new Composite(scrolled, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	control.setLayout(layout);

	createFavoriteList(control);

	initialize();

	scrolled.setContent(control);
	final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	scrolled.setMinSize(size.x, size.y);

	Dialog.applyDialogFont(scrolled);

	return scrolled;
}
 
Example 6
Source File: JavaEditorAppearanceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates page for appearance preferences.
 *
 * @param parent the parent composite
 * @return the control for the preference page
 */
public Control createControl(Composite parent) {
	initializeDialogUnits(parent);

	ScrolledPageContent scrolled= new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	scrolled.setExpandHorizontal(true);
	scrolled.setExpandVertical(true);


	Composite composite= new Composite(scrolled, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	composite.setLayout(layout);

	createHeader(composite);
	createAppearancePage(composite);

	scrolled.setContent(composite);
	final Point size= composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	scrolled.setMinSize(size.x, size.y);
	return scrolled;

}
 
Example 7
Source File: TaskSelectType.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createBottomTypeArea( Composite parent )
{
	ScrolledComposite sc = new ScrolledComposite( parent, SWT.V_SCROLL
			| SWT.H_SCROLL );
	{
		GridLayout layout = new GridLayout( );
		sc.setLayout( layout );
		GridData gridData = new GridData( GridData.FILL_BOTH );
		sc.setLayoutData( gridData );
		sc.setExpandHorizontal( true );
		sc.setExpandVertical( true );
	}

	cmpType = new Composite( sc, SWT.NONE );
	cmpType.setLayout( new GridLayout( 2, false ) );
	cmpType.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	sc.setContent( cmpType );

	createLeftTypeTable( cmpType );
	populateChartTypes( );

	createRightDetails( cmpType );

	Point size = cmpType.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	sc.setMinSize( size );
}
 
Example 8
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 9
Source File: ParameterDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	setMessage( Messages.getString( "ParameterDialog.message" ) ); //$NON-NLS-1$
	ScrolledComposite scrollContent = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	scrollContent.setAlwaysShowScrollBars( false );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setMinWidth( 600 );
	scrollContent.setLayout( new FillLayout( ) );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	displayArea = new Composite( scrollContent, SWT.NONE );

	Composite topComposite = new Composite( displayArea, SWT.NONE );
	topComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	topComposite.setLayout( new GridLayout( 2, false ) );

	createPropertiesSection( topComposite );
	createDisplayOptionsSection( topComposite );
	createValuesDefineSection( displayArea );
	displayArea.setLayout( new GridLayout( ) );

	Point size = displayArea.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	displayArea.setSize( size );

	scrollContent.setContent( displayArea );

	UIUtil.bindHelp( parent, IHelpContextIds.PARAMETER_DIALOG_ID );
	return scrollContent;
}
 
Example 10
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 11
Source File: DataWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleValueChange(final ValueChangeEvent event) {
    final DataType newType = (DataType) event.diff.getNewValue();
    if (newType instanceof JavaType && !(data instanceof JavaObjectData)) {
        final JavaObjectData javaData = ProcessFactory.eINSTANCE.createJavaObjectData();
        javaData.setDataType(newType);
        javaData.setClassName(List.class.getName());
        copyDataFeature(javaData);
        data = javaData;
        updateDatabinding();
    } else if (newType instanceof XMLType && !(data instanceof XMLData)) {
        final XMLData xmlData = ProcessFactory.eINSTANCE.createXMLData();
        xmlData.setDataType(newType);
        copyDataFeature(xmlData);
        data = xmlData;
    } else {
        if (!data.eClass().equals(ProcessPackage.Literals.DATA)) {
            Data simpleData = ProcessFactory.eINSTANCE.createData();
            simpleData.setDataType(newType);
            copyDataFeature(simpleData);
            data = simpleData;
        } else {
            data.setDataType(newType);
        }
    }

    updateMoreSection(newType);
    updateBrowseXMLButton(newType);
    if (mainComposite != null && !mainComposite.isDisposed()) {
        final Composite parent = mainComposite.getParent();
        final Point defaultSize = parent.getSize();
        final Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        parent.setSize(defaultSize.x, size.y);
        parent.layout(true, true);
    }
    updateDatabinding();
}
 
Example 12
Source File: ModelCheckBoxTree.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public void drawOn(Composite comp, FormToolkit tk) {
	tree = new CheckboxTreeViewer(comp,
			SWT.VIRTUAL | SWT.MULTI | SWT.BORDER);
	tree.setUseHashlookup(true);
	tree.setContentProvider(new NavigationContentProvider());
	tree.setLabelProvider(new NavigationLabelProvider(false));
	tree.setComparator(new NavigationComparator());
	tree.addFilter(new ModelTypeFilter(types));
	tree.addCheckStateListener(this);
	ColumnViewerToolTipSupport.enableFor(tree);
	if (tk != null) {
		tk.adapt(tree.getTree());
	}

	// compute a height hint
	GridData data = UI.gridData(tree.getTree(), true, true);
	data.minimumHeight = 120;
	Point p = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	data.heightHint = p.y < 120 ? 120 : p.y;

	if (types == null || types.length == 0)
		return;
	if (types.length == 1) {
		tree.setInput(Navigator.findElement(types[0]));
	} else {
		List<INavigationElement<?>> elems = Arrays.stream(types)
				.map(type -> Navigator.findElement(type))
				.filter(elem -> !elem.getChildren().isEmpty())
				.collect(Collectors.toList());
		tree.setInput(elems);
	}
	tree.expandToLevel(2);
}
 
Example 13
Source File: SmartTypingConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates page for mark occurrences preferences.
 *
 * @param parent the parent composite
 * @return the control for the preference page
 */
public Control createControl(Composite parent) {
	ScrolledPageContent scrolled= new ScrolledPageContent(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	scrolled.setExpandHorizontal(true);
	scrolled.setExpandVertical(true);

	Composite control= new Composite(scrolled, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	control.setLayout(layout);

	addSmartInsertModeMessage(control);

	Composite composite;

	composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_autoclose_title);
	addAutoclosingSection(composite);

	composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_automove_title);
	addAutopositionSection(composite);

	composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_indentation_title);
	addIndentationSection(composite);

	composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_pasting_title);
	addPasteSection(composite);

	composite= createSubsection(control, null, PreferencesMessages.SmartTypingConfigurationBlock_strings_title);
	addStringsSection(composite);

	scrolled.setContent(control);
	final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	scrolled.setMinSize(size.x, size.y);
	return scrolled;
}
 
Example 14
Source File: WizardPageOperationsComposite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void refresh() {
       final Composite shell = parent.getShell();
       final Point compositesize = parent.getSize();
       final Point newcompositesize = computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
       final Point defaultSize = shell.getSize();
       final Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
       if (compositesize.x < newcompositesize.x) {
           shell.setSize(size.x, defaultSize.y);
       }
       shell.layout(true, true);

       if (parent.getParent() instanceof ScrolledComposite) {
           final ScrolledComposite scrolledComposite = (ScrolledComposite) parent.getParent();
           scrolledComposite.setMinSize(computeSize(SWT.DEFAULT, SWT.DEFAULT));
           Display.getDefault().asyncExec(new Runnable() {

               @Override
               public void run() {
                   scrolledComposite.getVerticalBar().setSelection(scrolledComposite.getVerticalBar().getMaximum());
               }
           });

       }
	if (tabbedPropertySheetPage != null) {
		tabbedPropertySheetPage.resizeScrolledComposite();
	}
}
 
Example 15
Source File: HistogramView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
public PackedScrolledComposite(Composite parent, int style) {
    super(parent, style);
    Composite composite = new Composite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    composite.setSize(1, 1);
    fScrollBarSize = composite.computeSize(0, 0);
    composite.dispose();
}
 
Example 16
Source File: AbstractBindingDialogHelper.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void setContentSize( Composite composite )
{
	Point size = composite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	composite.setSize( Math.max( size.x, 400 ), Math.max( size.y,
			isAggregate( ) ? 320 : 50 ) );
}
 
Example 17
Source File: AddTermToTBDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridLayoutFactory.swtDefaults().extendedMargins(5, 5, 10, 0).numColumns(2).equalWidth(true).applyTo(tparent);
	GridData parentData = new GridData(GridData.FILL_BOTH);
	tparent.setLayoutData(parentData);

	Composite cmpTerm = new Composite(tparent, SWT.NONE);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpTerm);
	GridDataFactory.swtDefaults().applyTo(cmpTerm);
	Label lblSource = new Label(cmpTerm, SWT.NONE);
	lblSource.setText(Messages.getString("dialog.AddTermToTBDialog.lblSource"));
	GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSource);
	txtSrc = new Text(cmpTerm, SWT.BORDER);
	GridData txtData = new GridData();
	// 解决在 Windows 下文本框高度太小的问题
	txtData.widthHint = 290;
	txtSrc.setLayoutData(txtData);
	Label lblTarget = new Label(cmpTerm, SWT.NONE);
	lblTarget.setText(Messages.getString("dialog.AddTermToTBDialog.lblTarget"));
	GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTarget);
	txtTgt = new Text(cmpTerm, SWT.BORDER);
	txtTgt.setLayoutData(txtData);

	Composite cmpLang = new Composite(tparent, SWT.NONE);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpLang);
	GridDataFactory.fillDefaults().applyTo(cmpLang);
	Label lblSrcLang = new Label(cmpLang, SWT.NONE);
	lblSrcLang.setText(Messages.getString("dialog.AddTermToTBDialog.lblSrcLang"));
	GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSrcLang);
	cmbSrcLang = new TableComboViewer(cmpLang, SWT.READ_ONLY | SWT.BORDER);
	cmbSrcLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	cmbSrcLang.setContentProvider(new ArrayContentProvider());

	Label lblTgtLang = new Label(cmpLang, SWT.NONE);
	lblTgtLang.setText(Messages.getString("dialog.AddTermToTBDialog.lblTgtLang"));
	GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTgtLang);
	cmbTgtLang = new TableComboViewer(cmpLang, SWT.READ_ONLY | SWT.BORDER);
	cmbTgtLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	cmbTgtLang.setContentProvider(new ArrayContentProvider());
	Composite cmpProperty = new Composite(tparent, SWT.None);
	GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpProperty);
	GridDataFactory.fillDefaults().span(2, 1).applyTo(cmpProperty);
	Label lblProperty = new Label(cmpProperty, SWT.None);
	lblProperty.setText(Messages.getString("dialog.AddTermToTBDialog.lblProperty"));
	GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblProperty);
	txtProperty = new Text(cmpProperty, SWT.BORDER);
	txtProperty.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	initProperty();
	tparent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	return tparent;
}
 
Example 18
Source File: MongoDBDataSetWizardPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void createPageCustomControl( Composite parent )
{
	sComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
	sComposite.setLayout( new GridLayout( ) );
	sComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	sComposite.setMinWidth( 600 );
	sComposite.setExpandHorizontal( true );

	Composite mainComposite = new Composite( sComposite, SWT.NONE );
	mainComposite.setLayout( new GridLayout( 1, false ) );
	GridData gridData = new GridData( GridData.FILL_BOTH );
	mainComposite.setLayoutData( gridData );

	createTopArea( mainComposite );

	createFieldsSelectionArea( mainComposite );

	createBottomArea( mainComposite );

	Point size = mainComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	mainComposite.setSize( size.x, size.y );

	sComposite.setContent( mainComposite );
	setControl( sComposite );
	setPageComplete( false );

	try
	{
		initPageInfos( );
	}
	catch ( final OdaException e )
	{
		initializeControl( );
		Display.getDefault( ).asyncExec( new Runnable( ) {

			public void run( )
			{
				String errorMsg = UIHelper.getUserErrorMessage( "MongoDBDataSetWizardPage.MessageDialog.ErrorMessage.InitPage", e ); //$NON-NLS-1$
				ExceptionHandler.showException( sComposite.getShell( ),
						Messages.getString( "MongoDBDataSetWizardPage.MessageDialog.title.GeneralError" ), //$NON-NLS-1$
						errorMsg,
						e );
			}
		} );

		return;
	}

	initializeControl( );

	resetLabelWidth( );

	modelChanged = false;

	UIHelper.setSystemHelp( getControl( ),
			IHelpConstants.CONTEXT_ID_WIZARD_DATASET_MONGODB );
}
 
Example 19
Source File: GroupDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Assert.isNotNull( dataSetList );

	if ( sytleChoicesAll == null )
	{
		sytleChoicesAll = getAllStyleChoices( );
	}

	// Composite topComposite = (Composite) super.createDialogArea( parent
	// );

	ScrolledComposite scrollContent = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	scrollContent.setAlwaysShowScrollBars( false );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setMinWidth( 600 );
	scrollContent.setLayout( new FillLayout( ) );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	applyDialogFont( scrollContent );

	Composite topComposite = new Composite( scrollContent, 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 );
	topComposite.setLayout( layout );

	createTitleArea( topComposite );

	Composite composite = new Composite( topComposite, SWT.NONE );
	composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	composite.setLayout( new GridLayout( 2, true ) );
	createFieldArea( composite );
	createGroupArea( composite );
	createBookmarkArea( topComposite );
	createTOCArea( topComposite );
	createFilterSortingArea( topComposite );
	UIUtil.bindHelp( parent, IHelpContextIds.GROUP_DIALOG_ID );

	Point size = topComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	topComposite.setSize( size.x, size.y );

	scrollContent.setContent( topComposite );

	return scrollContent;
}
 
Example 20
Source File: CascadingParametersDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Composite composite = (Composite) super.createDialogArea( parent );

	ScrolledComposite sc = new ScrolledComposite( (Composite) super.createDialogArea( parent ),
			SWT.H_SCROLL | SWT.V_SCROLL );
	sc.setLayout( new FillLayout( ) );
	sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	applyDialogFont( sc );

	mainContent = new Composite( sc, 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 );
	mainContent.setLayout( layout );

	UIUtil.bindHelp( parent, IHelpContextIds.CASCADING_PARAMETER_DIALOG_ID );

	GridData data = new GridData( GridData.FILL_BOTH );

	maxStrLengthProperty = getMaxStrLength( PROPERTY_LABEL_STRING,
			mainContent );

	maxStrLengthOption = getMaxStrLength( OPTION_LABEL_STRING, mainContent );

	mainContent.setLayoutData( data );

	createGeneralPart( mainContent );

	createChoicePart( mainContent );

	createDynamicParamsPart( mainContent );

	createPropertiesPart( mainContent );

	createSortingArea( mainContent );

	createOptionsPart( mainContent );

	createLabel( mainContent, null );
	errorMessageLine = new CLabel( mainContent, SWT.NONE );
	GridData msgLineGridData = new GridData( GridData.FILL_HORIZONTAL );
	msgLineGridData.horizontalSpan = 2;
	errorMessageLine.setLayoutData( msgLineGridData );

	sc.setContent( mainContent );
	sc.setExpandHorizontal( true );
	// sc.setExpandVertical( true );
	sc.setMinWidth( 500 );
	// sc.setMinHeight( 570 );

	Point size = mainContent.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	mainContent.setSize( size );

	return sc;
}