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

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite#setAlwaysShowScrollBars() . 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: DetailsTabView.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public DetailsTabView() {
	super(SWT.NONE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);
	fillLayout.marginWidth = 5;
	fillLayout.marginHeight = 5;
	setLayout(fillLayout);
	
	scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
	scrolledComposite.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			ScrolledComposites.updateOnlyVerticalScrollableComposite(scrolledComposite);
		}
	});
	scrolledComposite.setAlwaysShowScrollBars(true);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
}
 
Example 2
Source File: DataColumnBindingDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Control createDialogArea( Composite parent )
{

	Composite composite = (Composite) super.createDialogArea( parent );
	ScrolledComposite sc = new ScrolledComposite( composite, SWT.V_SCROLL );
	sc.setAlwaysShowScrollBars( false );
	sc.setExpandHorizontal( true );
	sc.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	Composite content = new Composite( sc, SWT.NONE );
	sc.setContent( content );
	content.setLayout( new GridLayout( ) );

	// sc.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_BLACK ) );
	// content.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_BLUE ) );
	// composite.setBackground( Display.getCurrent( ).getSystemColor(
	// SWT.COLOR_RED ) );

	dialogHelper.setExpressionProvider( expressionProvider );
	dialogHelper.createContent( content );
	UIUtil.bindHelp( content, isTimePeriod || isEditTimePeriod()? IHelpContextIds.RELATIVE_TIME_PERIOD_DIALOG : IHelpContextIds.DATA_COLUMN_BINDING_DIALOG );
	return content;
}
 
Example 3
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 4
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 5
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 6
Source File: ApiDocumentationView.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 * 
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NONE);
	super.createPartControl(container);

	StackLayout layout = new StackLayout();
	getComposite().setLayout(layout);

	defaultMessageComposite = new Composite(getComposite(), SWT.NONE);
	defaultMessageComposite.setBackgroundMode(SWT.INHERIT_FORCE);
	defaultMessageComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	defaultMessageComposite.setLayout(new GridLayout(1, false));

	Label lblNewLabel = new Label(defaultMessageComposite, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setText("Results of API documentation and Q&&A posts will be shown here.");

	resultsScrolledComposite = new ScrolledComposite(getComposite(), SWT.BORDER | SWT.V_SCROLL);
	resultsScrolledComposite.setAlwaysShowScrollBars(true);
	resultsScrolledComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	resultsScrolledComposite.setExpandHorizontal(true);
	resultsScrolledComposite.setExpandVertical(true);

	resultsVerticalList = new VerticalList(resultsScrolledComposite, SWT.NONE);
	resultsVerticalList.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	resultsScrolledComposite.setContent(resultsVerticalList);
	resultsScrolledComposite.setMinSize(resultsVerticalList.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	layout.topControl = defaultMessageComposite;

	createActions();
	initializeToolBar();
	initializeMenu();
}
 
Example 7
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 8
Source File: FormatBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );
	ScrolledComposite scrollContent = new ScrolledComposite( composite,
			SWT.H_SCROLL | SWT.V_SCROLL );
	scrollContent.setAlwaysShowScrollBars( false );
	scrollContent.setExpandHorizontal( true );
	scrollContent.setLayout( new FillLayout( ) );
	scrollContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	switch ( type )
	{
		case STRING :
			page = new FormatStringPage( scrollContent,
					SWT.NONE,
					IFormatPage.PAGE_ALIGN_VIRTICAL,
					false );
			break;
		case NUMBER :
			page = new FormatNumberPage( scrollContent,
					SWT.NONE,
					IFormatPage.PAGE_ALIGN_VIRTICAL,
					false );
			break;
		case DATETIME :
		case DATE :
		case TIME :
			page = new FormatDateTimePage( scrollContent,
					type,
					SWT.NONE,
					IFormatPage.PAGE_ALIGN_VIRTICAL,
					false );
			break;
	}
	Point size = ( (Composite) page ).computeSize( SWT.DEFAULT, SWT.DEFAULT );
	( (Composite) page ).setSize( size );
	scrollContent.setContent( (Composite) page );
	UIUtil.bindHelp( composite, IHelpContextIds.FORMAT_BUILDER_ID );
	return composite;
}
 
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: TestDatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void buildListOfOutputForOneRowNCols(final ScrolledComposite scrolledComposite,final EMFDataBindingContext context) {
	if(scrolledComposite.getContent() != null){
		scrolledComposite.getContent().dispose();
		scrolledComposite.setContent(null);
	}
	final Composite oneRowNColsComposite = new Composite(scrolledComposite, SWT.NONE) ;
	oneRowNColsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ;
	oneRowNColsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).create());


	final ConnectorConfiguration configuration = getConnector().getConfiguration();
	final Expression scriptExpression = (Expression) getConnectorParameter(configuration, getInput(SCRIPT_KEY)).getExpression();
	final List<Operation> operations = getOuputOperationsFor(ONEROW_NCOL_RESULT_OUTPUT,scriptExpression);
	for(final Operation op : operations){
		final Label expressionLabel = new Label(oneRowNColsComposite, SWT.READ_ONLY);
		expressionLabel.setText(Messages.connectorExpressionViewerLabel);

		final Text columnText = new Text(oneRowNColsComposite,SWT.BORDER | SWT.READ_ONLY) ;
		columnText.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create());
		columnText.setText(op.getRightOperand().getName());
	}
	scrolledComposite.setMinSize(oneRowNColsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	scrolledComposite.setContent(oneRowNColsComposite);
}
 
Example 11
Source File: TmfRawEventViewer.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Create the text area and add listeners
 */
private void createTextArea(int style) {
    fScrolledComposite = new ScrolledComposite(this, style);
    fScrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fTextArea = new Composite(fScrolledComposite, SWT.NONE);
    fTextArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fScrolledComposite.setContent(fTextArea);
    fScrolledComposite.setExpandHorizontal(true);
    fScrolledComposite.setExpandVertical(true);
    fScrolledComposite.setAlwaysShowScrollBars(true);
    fScrolledComposite.setMinSize(fTextArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    fScrolledComposite.addControlListener(this);

    GridLayout textAreaGridLayout = new GridLayout();
    textAreaGridLayout.marginHeight = 0;
    textAreaGridLayout.marginWidth = 0;
    fTextArea.setLayout(textAreaGridLayout);

    fStyledText = new StyledText(fTextArea, SWT.READ_ONLY);
    fStyledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    initializeFonts();
    initializeColors();
    PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(this);

    fStyledText.addCaretListener(this);
    fStyledText.addMouseMoveListener(this);
    fStyledText.addMouseTrackListener(this);
    fStyledText.addMouseWheelListener(this);
    /* disable mouse scroll of horizontal scroll bar */
    fStyledText.addListener(SWT.MouseWheel, event -> event.doit = false);
    fStyledText.addKeyListener(this);

    fTextArea.setBackground(fStyledText.getBackground());
    fTextArea.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent e) {
            fTextArea.setFocus();
        }
    });
}
 
Example 12
Source File: ExportFilterSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Label filterNameLabel = new Label(composite, SWT.NONE);
	filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel"));

	filterNameText = new Text(composite, SWT.BORDER);
	filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Composite optionComposite = new Composite(container, SWT.NONE);
	optionComposite.setLayout(new GridLayout(2, false));
	optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	isAllCbtn = new Button(optionComposite, SWT.RADIO);
	isAllCbtn.setSize(152, 26);
	isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn"));
	isAllCbtn.setSelection(true);

	isAnyCbtn = new Button(optionComposite, SWT.RADIO);
	isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn"));

	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER);
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	dynaComposite = new Composite(scrolledComposite, SWT.NONE);
	dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE)));
	scrolledComposite.setContent(dynaComposite);
	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	GridLayout gl_dynaComposite = new GridLayout(1, false);
	dynaComposite.setLayout(gl_dynaComposite);

	ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType);
	exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	exportFilterComponent.setDeleteButtonEnabled(false);
	dynaComposite.setData("currentNumber", 1);

	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	initData();

	return container;
}
 
Example 13
Source File: ExportFilterSettingDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Label filterNameLabel = new Label(composite, SWT.NONE);
	filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel"));

	filterNameText = new Text(composite, SWT.BORDER);
	filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Composite optionComposite = new Composite(container, SWT.NONE);
	optionComposite.setLayout(new GridLayout(2, false));
	optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	isAllCbtn = new Button(optionComposite, SWT.RADIO);
	isAllCbtn.setSize(152, 26);
	isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn"));
	isAllCbtn.setSelection(true);

	isAnyCbtn = new Button(optionComposite, SWT.RADIO);
	isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn"));

	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER);
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	dynaComposite = new Composite(scrolledComposite, SWT.NONE);
	dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE)));
	scrolledComposite.setContent(dynaComposite);
	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	GridLayout gl_dynaComposite = new GridLayout(1, false);
	dynaComposite.setLayout(gl_dynaComposite);

	ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType);
	exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	exportFilterComponent.setDeleteButtonEnabled(false);
	dynaComposite.setData("currentNumber", 1);

	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	initData();

	return container;
}
 
Example 14
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 15
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 16
Source File: CustomChooserComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createDropDownComponent( int iXLoc, int iYLoc )
{
	if ( !bEnabled )
	{
		return;
	}

	int shellWidth = this.getSize( ).x;
	Shell shell = new Shell( this.getShell( ), SWT.NONE );
	shell.setLayout( new FillLayout( SWT.FILL ) );
	if ( ( getStyle( ) & SWT.RIGHT_TO_LEFT ) != 0 )
	{
		iXLoc -= shellWidth;
	}
	shell.setLocation( iXLoc, iYLoc );

	container = new ScrolledComposite( shell, SWT.V_SCROLL );
	container.setAlwaysShowScrollBars( false );
	container.setExpandHorizontal( true );

	cmpDropDown = new Composite( container, SWT.NONE );
	GridLayout gl = new GridLayout( );
	gl.horizontalSpacing = 0;
	gl.verticalSpacing = 0;
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	cmpDropDown.setLayout( gl );

	Listener listenerCmpDropDown = new Listener( ) {

		public void handleEvent( Event event )
		{
			handleEventCmpDropDown( event );
		}
	};

	cmpDropDown.addListener( SWT.KeyDown, listenerCmpDropDown );
	cmpDropDown.addListener( SWT.FocusOut, listenerCmpDropDown );

	popupCanvases = new ICustomChoice[this.items.length];

	for ( int iC = 0; iC < items.length; iC++ )
	{
		ICustomChoice cnv = createChoice( cmpDropDown, items[iC] );
		GridData gd = new GridData( GridData.FILL_HORIZONTAL );
		cnv.setLayoutData( gd );
		cnv.addListener( SWT.MouseDown, canvasListener );
		cnv.addListener( SWT.MouseEnter, canvasListener );
		cnv.addListener( SWT.KeyDown, canvasListener );

		popupCanvases[iC] = cnv;
		if ( cnvSelection.getValue( ).equals( cnv.getValue( ) ) )
		{
			cnv.notifyListeners( SWT.FocusIn, new Event( ) );
			popupSelection = cnv;
		}
	}

	int width = 0;
	int height = 0;

	int maxWidth = 0;
	Control[] children = container.getChildren( );
	for ( int i = 0; i < children.length; i++ )
	{
		Point point = children[i].computeSize( SWT.DEFAULT, SWT.DEFAULT );
		maxWidth = point.x > maxWidth ? point.x : maxWidth;
		height += point.y;
	}
	
	width = getSize( ).x > maxWidth ? getSize( ).x : maxWidth;
	height = 18 > height ? 18 : height;

	cmpDropDown.setBounds( 0, 0, width, height );

	container.setContent( cmpDropDown );

	if ( height >= 298 )
	{
		int containerWidth = maxWidth
				+ container.getVerticalBar( ).getSize( ).x;
		width = width > containerWidth ? getSize( ).x : containerWidth;
	}

	shell.setSize( width, height < 298 ? height + 2 : 300 );

	shell.layout( );
	shell.open( );
}
 
Example 17
Source File: DatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void buildListOfOutputForOneRowNCols(final ScrolledComposite scrolledComposite,
        final EMFDataBindingContext context) {
    if (scrolledComposite.getContent() != null) {
        scrolledComposite.getContent().dispose();
        scrolledComposite.setContent(null);
    }
    final Composite oneRowNColsComposite = new Composite(scrolledComposite, SWT.NONE);
    oneRowNColsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    oneRowNColsComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).create());

    final ConnectorConfiguration configuration = getConnector().getConfiguration();
    final Expression scriptExpression = (Expression) getConnectorParameter(configuration, getInput(SCRIPT_KEY))
            .getExpression();
    final List<Operation> operations = getOuputOperationsFor(ONEROW_NCOL_RESULT_OUTPUT, scriptExpression);
    for (final Operation op : operations) {
        final ReadOnlyExpressionViewer targetDataExpressionViewer = new ReadOnlyExpressionViewer(oneRowNColsComposite,
                SWT.BORDER, null, null, ExpressionPackage.Literals.OPERATION__LEFT_OPERAND);
        targetDataExpressionViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
        final IExpressionNatureProvider storageExpressionProvider = getStorageExpressionProvider();
        if (storageExpressionProvider != null) {
            targetDataExpressionViewer.setExpressionNatureProvider(storageExpressionProvider);
        }
        targetDataExpressionViewer.addFilter(leftFilter);
        targetDataExpressionViewer.setContext(getElementContainer());
        targetDataExpressionViewer.setInput(op);

        context.bindValue(ViewersObservables.observeSingleSelection(targetDataExpressionViewer),
                EMFObservables.observeValue(op, ExpressionPackage.Literals.OPERATION__LEFT_OPERAND));

        final Label takeValueOfLabel = new Label(oneRowNColsComposite, SWT.NONE);
        takeValueOfLabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).create());
        takeValueOfLabel.setText(Messages.takeValueOf);

        final Text columnText = new Text(oneRowNColsComposite, SWT.BORDER | SWT.READ_ONLY);
        columnText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
        columnText.setText(op.getRightOperand().getName());
    }
    scrolledComposite.setMinSize(oneRowNColsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setContent(oneRowNColsComposite);
}