Java Code Examples for org.eclipse.swt.custom.ScrolledComposite#setLayoutData()

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite#setLayoutData() . 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: 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 2
Source File: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void mainLayout( Class<?> PKG, String prefix, Image img ) {
  display = parent.getDisplay();
  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX );
  props.setLook( shell );
  shell.setImage( img );
  shell.setLayout( new FormLayout() );
  shell.setText( BaseMessages.getString( PKG, prefix + ".Shell.Title" ) );

  scContainer = new ScrolledComposite( shell, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL );
  scContainer.setLayout( new FormLayout() );
  FormData fd = new FormData();
  fd.top = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.bottom = new FormAttachment( 100, -Const.FORM_MARGIN );
  fd.left = new FormAttachment( 0, Const.FORM_MARGIN );
  fd.right = new FormAttachment( 100, -Const.FORM_MARGIN );
  scContainer.setLayoutData( fd );
  scContainer.setExpandHorizontal( true );
  scContainer.setExpandVertical( true );
  cContainer = new Composite( scContainer, SWT.NONE );
  scContainer.setContent( cContainer );
  cContainer.setLayout( new FormLayout() );
  cContainer.setBackground( shell.getBackground() );
  cContainer.setParent( scContainer );
}
 
Example 3
Source File: ArtikelDetailDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	ScrolledComposite ret = new ScrolledComposite(parent, SWT.V_SCROLL);
	Composite cnt = new Composite(ret, SWT.NONE);
	ret.setContent(cnt);
	ret.setExpandHorizontal(true);
	ret.setExpandVertical(true);
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	cnt.setLayout(new FillLayout());
	AutoForm tblArtikel = null;
	if (article instanceof Identifiable) {
		tblArtikel = new LabeledInputField.AutoForm(cnt,
			Artikeldetail.getModelFieldDefs(parent.getShell()));
	} else {
		tblArtikel =
			new LabeledInputField.AutoForm(cnt, Artikeldetail.getFieldDefs(parent.getShell()));
	}
	tblArtikel.reload(article);
	ret.setMinSize(cnt.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	return ret;
}
 
Example 4
Source File: TemplateSelectionPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a scrolled, plain-text, preview area for the template.
 * 
 * @param composite
 *            Parent composite.
 */
protected void createPreview(Composite composite)
{
	scroll = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	scroll.setLayout(new GridLayout());
	GridData gd = new GridData(GridData.FILL_BOTH);
	scroll.setLayoutData(gd);
	templatePreview = new Text(scroll, SWT.MULTI | SWT.READ_ONLY);
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	scroll.setContent(templatePreview);
}
 
Example 5
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return
 */
private ScrolledComposite createScrolledComposite() {
    final ScrolledComposite sc = new ScrolledComposite(tab, SWT.V_SCROLL);
    sc.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).create());
    sc.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, SWT.DEFAULT).create());
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    return sc;
}
 
Example 6
Source File: CSV2TMXConverterDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	tparent.setLayout(new GridLayout());
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(300, 250).grab(true, true).applyTo(tparent);

	ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL);
	cmpScrolled.setAlwaysShowScrollBars(false);
	cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmpScrolled.setExpandHorizontal(true);
	cmpScrolled.setShowFocusedControl(true);

	Composite cmpContent = new Composite(cmpScrolled, SWT.None);
	cmpScrolled.setContent(cmpContent);
	cmpContent.setLayout(new GridLayout(2, false));
	cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));

	arrCmbLangs = new Combo[size];
	for (int i = 0; i < size; i++) {
		createLabel(cmpContent, languages.get(i) + " : ");
		arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY);
		arrCmbLangs[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		arrCmbLangs[i].setItems(LocaleService.getLanguages());
		String name = LocaleService.getLanguage(languages.get(i));
		if (!name.equals(languages.get(i))) {
			arrCmbLangs[i].setText(name);
		}
	}

	cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	return tparent;
}
 
Example 7
Source File: CSV2TMXConverterDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	tparent.setLayout(new GridLayout());
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(300, 250).grab(true, true).applyTo(tparent);

	ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL);
	cmpScrolled.setAlwaysShowScrollBars(false);
	cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmpScrolled.setExpandHorizontal(true);
	cmpScrolled.setShowFocusedControl(true);

	Composite cmpContent = new Composite(cmpScrolled, SWT.None);
	cmpScrolled.setContent(cmpContent);
	cmpContent.setLayout(new GridLayout(2, false));
	cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH));

	arrCmbLangs = new Combo[size];
	for (int i = 0; i < size; i++) {
		createLabel(cmpContent, languages.get(i) + " : ");
		arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY);
		arrCmbLangs[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		arrCmbLangs[i].setItems(LocaleService.getLanguages());
		String name = LocaleService.getLanguage(languages.get(i));
		if (!name.equals(languages.get(i))) {
			arrCmbLangs[i].setText(name);
		}
	}

	cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	return tparent;
}
 
Example 8
Source File: PreviewPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void buildUI( Composite parent )
{
	container = new ScrolledComposite( parent, SWT.V_SCROLL | SWT.H_SCROLL );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	( (ScrolledComposite) container ).setExpandHorizontal( true );
	( (ScrolledComposite) container ).setExpandVertical( true );
	container.addControlListener( new ControlAdapter( ) {

		public void controlResized( ControlEvent e )
		{
			computeSize( );
		}
	} );

	composite = new Composite( container, SWT.NONE );
	composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	if ( sections == null )
		sections = new SortMap( );
	composite.setLayout( WidgetUtil.createGridLayout( 1 ) );

	previewSection = new PreviewSection( provider.getDisplayName( ),
			composite,
			true,
			isTabbed );
	previewSection.setPreview( preview );
	previewSection.setProvider( provider );
	previewSection.setHeight( 160 );
	previewSection.setFillPreview( true );
	addSection( PageSectionId.PREVIEW_PREVIEW, previewSection );

	createSections( );
	layoutSections( );

	( (ScrolledComposite) container ).setContent( composite );
}
 
Example 9
Source File: PopulationInspectView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private void createMenus(final Composite parent) {
	final ScrolledComposite scroll = new ScrolledComposite(parent, SWT.V_SCROLL);
	scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	attributesMenu = new Composite(scroll, SWT.NONE);
	scroll.setContent(attributesMenu);
	final GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.verticalSpacing = 1;
	attributesMenu.setLayout(layout);
	attributesMenu.setBackground(IGamaColors.WHITE.color());
	fillAttributeMenu();
}
 
Example 10
Source File: AbstractCubePropertyPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Control createPageControl( Composite parent )
{
	sComposite = new ScrolledComposite( parent, SWT.H_SCROLL
			| SWT.V_SCROLL );
	sComposite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	sComposite.setExpandHorizontal( true );
	sComposite.setExpandVertical( true );
	sComposite.addControlListener( new ControlAdapter( ) {

		public void controlResized( ControlEvent e )
		{
			computeSize( );
		}
	} );
	
	composite = new Composite( sComposite, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	composite.setLayout( layout );
	if ( getPageDescription( ) != null )
	{
		pageDescription = new Label( composite, SWT.NONE );
		pageDescription.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
		pageDescription.setText( getPageDescription( ) );
		pageDescription.setToolTipText( getPageDescription( ) );
	}
	GridData data = new GridData( GridData.FILL_BOTH );
	Control control = createContents( composite );
	control.setLayoutData( data );

	sComposite.setContent( composite );

	return sComposite;
}
 
Example 11
Source File: CustomXmlParserOutputWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout());

    sash = new SashForm(container, SWT.VERTICAL);
    sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_GRAY));

    outputsScrolledComposite = new ScrolledComposite(sash, SWT.V_SCROLL);
    outputsScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    outputsContainer = new Composite(outputsScrolledComposite, SWT.NONE);
    final GridLayout outputsLayout = new GridLayout(4, false);
    outputsLayout.marginHeight = 10;
    outputsLayout.marginWidth = 0;
    outputsContainer.setLayout(outputsLayout);
    outputsScrolledComposite.setContent(outputsContainer);
    outputsScrolledComposite.setExpandHorizontal(true);
    outputsScrolledComposite.setExpandVertical(true);

    outputsContainer.layout();

    outputsScrolledComposite.setMinSize(outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-5);

    tableContainer = new Composite(sash, SWT.NONE);
    final GridLayout tableLayout = new GridLayout();
    tableLayout.marginHeight = 0;
    tableLayout.marginWidth = 0;
    tableContainer.setLayout(tableLayout);
    previewTable = new TmfEventsTable(tableContainer, 0, CustomEventAspects.generateAspects(new CustomXmlTraceDefinition()));
    previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    if (wizard.definition != null) {
        loadDefinition(wizard.definition);
    }
    setControl(container);

}
 
Example 12
Source File: GenericSelectionComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = (Composite) super.createDialogArea(parent);
	ScrolledComposite sc = new ScrolledComposite(ret, SWT.H_SCROLL | SWT.V_SCROLL);
	
	Composite child = new Composite(sc, SWT.NONE);
	child.setLayout(new GridLayout());
	
	GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
	data.heightHint = 400;
	sc.setLayoutData(data);

	Label title = new Label(child, SWT.NONE);
	title.setText("Auswahl:");
	// create the UI
	for (Object object : input) {
		Button button = new Button(child, SWT.CHECK);
		button.setText(getLabel(object));
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e){
				if (button.getSelection()) {
					selection.add(object);
				} else {
					selection.remove(object);
				}
			}
		});
		buttonMap.put(object, button);
	}
	sc.setMinSize(child.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
    sc.setContent(child);

	updateSelectionUi();
	
	return ret;
}
 
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: FontAwesomeSnippet3.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setText("FontAwesome Snippet");
	shell.setSize(1000, 600);
	shell.setLayout(new GridLayout(2, false));

	fScrolledComposite = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
	fScrolledComposite.setAlwaysShowScrollBars(false);
	fScrolledComposite.setExpandHorizontal(true);
	fScrolledComposite.setExpandVertical(true);

	Composite composite = new Composite(fScrolledComposite, SWT.NONE);
	fScrolledComposite.setContent(composite);

	RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
	rowLayout.marginTop = 5;
	rowLayout.marginRight = 5;
	rowLayout.marginLeft = 5;
	rowLayout.marginBottom = 5;
	rowLayout.pack = false;
	composite.setLayout(rowLayout);
	buildComposite(composite);
	calcMinsize(composite);
	shell.layout(true, true);

	fFontLabel = new Label(shell, SWT.NONE);
	fFontLabel.setText("Font size (22)");


	fSlider = new Slider(shell, SWT.NONE);
	fSlider.addListener(SWT.MouseUp, e -> {
		shell.setRedraw(false);
		Arrays.asList(composite.getChildren()).forEach(c -> c.dispose());
		fFontSize = fSlider.getSelection();
		buildComposite(composite);
		fFontLabel.setText("Font size (" + fFontSize + ")");
		shell.setRedraw(true);

		shell.layout(true, true);
		calcMinsize(composite);
	});
	fSlider.setPageIncrement(1);
	fSlider.setMaximum(150);
	fSlider.setMinimum(4);
	fSlider.setSelection(22);
	fSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();

}
 
Example 15
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 16
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;
}
 
Example 17
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 18
Source File: ConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control doCreateControl(final Composite parent, final EMFDataBindingContext context) {
    final DefinitionResourceProvider messageProvider = getMessageProvider();
    final String outputsDescription = messageProvider.getOutputsDescription(getDefinition());

    scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
    scrolledComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create());
    scrolledComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    final AvailableExpressionTypeFilter leftFilter = new AvailableExpressionTypeFilter(new String[] {
            ExpressionConstants.VARIABLE_TYPE,
            ExpressionConstants.DOCUMENT_REF_TYPE });
    final AvailableExpressionTypeFilter rightFilter = new ConnectorOutputAvailableExpressionTypeFilter();

    final Composite mainComposite = new Composite(scrolledComposite, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(5, 5, 5, 0).create());

    if (!Strings.isNullOrEmpty(outputsDescription)) {
        final Link description = new Link(mainComposite, SWT.WRAP);
        description.setLayoutData(GridDataFactory.fillDefaults().grab(false, false).hint(400, SWT.DEFAULT).create());
        description.setText(outputsDescription);
        description.addSelectionListener(new SelectionAdapter() {

            /*
             * (non-Javadoc)
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
            @Override
            public void widgetSelected(SelectionEvent e) {
                IWebBrowser browser;
                try {
                    browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(HELP_BROWSER_ID);
                    browser.openURL(new URL(e.text));
                } catch (final PartInitException | MalformedURLException e1) {
                    BonitaStudioLog.error(e1);
                }

            }
        });
    }

    lineComposite = new WizardPageOperationsComposite(null, mainComposite, rightFilter, leftFilter, isPageFlowContext());
    lineComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 280).create());
    final IExpressionNatureProvider storageExpressionProvider = getStorageExpressionProvider();
    if (storageExpressionProvider != null) {
        lineComposite.setStorageExpressionNatureContentProvider(storageExpressionProvider);
    }
    lineComposite.setContext(context);
    lineComposite.setContext(getElementContainer());
    lineComposite.setEObject(getConnector());
    lineComposite.fillTable();

    scrolledComposite.setContent(mainComposite);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setMinSize(lineComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    return mainComposite;
}
 
Example 19
Source File: DatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createOneRowNColsOuputControl(final Composite parent,
        final EMFDataBindingContext context) {
    oneRowNColsscrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
    oneRowNColsscrolledComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    return oneRowNColsscrolledComposite;
}
 
Example 20
Source File: HyperlinkBuilder.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 );

	createSelectionArea( composite );
	new Label( composite, SWT.SEPARATOR | SWT.HORIZONTAL ).setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

	scrollContent = new ScrolledComposite( composite, SWT.H_SCROLL
			| SWT.V_SCROLL );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setExpandVertical( true );

	scrollContent.addControlListener( new ControlAdapter( ) {

		public void controlResized( ControlEvent e )
		{
			computeSize( );
		}
	} );

	Shell shell = PlatformUI.getWorkbench( )
			.getActiveWorkbenchWindow( )
			.getShell( );

	int height = shell.getBounds( ).height < 510 + 200 ? shell.getBounds( ).height - 200
			: 510;
	if ( !bTargetEnabled )
	{
		height -= 70;
	}
	if ( !bTooltipEnabled )
	{
		height -= 50;
	}

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.minimumWidth = 600;
	gd.minimumHeight = height;
	scrollContent.setLayoutData( gd );

	displayArea = new Composite( scrollContent, SWT.NONE );
	displayArea.setLayout( new GridLayout( 3, false ) );
	displayArea.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	scrollContent.setContent( displayArea );

	new Label( composite, SWT.SEPARATOR | SWT.HORIZONTAL ).setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

	UIUtil.bindHelp( parent, IHelpContextIds.HYPERLINK_BUILDER_ID );

	return composite;
}