org.eclipse.swt.custom.ScrolledComposite Java Examples

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite. 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: 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 #2
Source File: MainView.java    From mappwidget with Apache License 2.0 6 votes vote down vote up
private void fillTop(Composite top, ScrolledComposite scrolledComposite)
{
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;

	GridData data = new GridData();
	data.grabExcessHorizontalSpace = true;
	data.horizontalAlignment = GridData.FILL;

	top.setLayoutData(data);
	top.setLayout(layout);

	scrolledComposite.setMinSize(500, 250);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	scrolledComposite.setContent(top);
}
 
Example #3
Source File: SwtUtil.java    From AppleCommander with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Setup some sensible paging information.
 */
public static void setupPagingInformation(ScrolledComposite composite) {
	GC gc = new GC(composite);
	FontMetrics fontMetrics = gc.getFontMetrics();
	gc.dispose();
	int fontHeight = fontMetrics.getHeight();
	int fontWidth = fontMetrics.getAverageCharWidth();
	Rectangle clientArea = composite.getClientArea();
	int lines = clientArea.height / fontHeight;
	int pageHeight = lines * fontHeight;
	int pageWidth = clientArea.width - fontWidth; 
	composite.getVerticalBar().setIncrement(fontHeight);
	composite.getVerticalBar().setPageIncrement(pageHeight);
	composite.getHorizontalBar().setIncrement(fontWidth);
	composite.getHorizontalBar().setPageIncrement(pageWidth);
}
 
Example #4
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 #5
Source File: PipelineArgumentsTabTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
public void testScrollbar(PipelineArgumentsTab pipelineArgumentsTab) {
  Composite composite = pipelineArgumentsTab.internalComposite;
  assertNotNull(composite);
  Composite parent = pipelineArgumentsTab.internalComposite.getParent();
  if (parent instanceof ScrolledComposite) {
    pipelineArgumentsTab.handleLayoutChange();
    Point compositeSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    ScrolledComposite scrollComposite = (ScrolledComposite) parent;
    Point scrollSize = new Point(scrollComposite.getMinWidth(), scrollComposite.getMinHeight());
    if (compositeSize.equals(scrollSize)) {
      return;
    }
    fail("Scrollbar is not working");
  }
  fail("Did not find the Scroll composite");
}
 
Example #6
Source File: PipelineArgumentsTab.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
void handleLayoutChange() {
  if (internalComposite != null && !internalComposite.isDisposed()) {
    Composite parent = internalComposite.getParent();
    while (parent != null) {
      if (parent instanceof ScrolledComposite) {
        ((ScrolledComposite) parent)
            .setMinSize(internalComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        parent.layout();
        return;
      }
      parent = parent.getParent();
    }
  }
  updateLaunchConfigurationDialog();
}
 
Example #7
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 #8
Source File: ErrorView.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected ParameterExpandItem createItem(final Composite parent, final GamaRuntimeException data,
		final boolean expanded, final GamaUIColor color) {
	createViewer(parent);
	if (getViewer() == null) { return null; }
	final ScrolledComposite control = createItemContentsFor(data);
	ParameterExpandItem item;
	if (expanded) {
		createStackTrace(control, data);
		item = createItem(parent, data, control, expanded, color);
	} else {
		item = createItem(parent, data, control, expanded, color);
		item.onExpand(() -> createStackTrace(control, data));
	}
	return item;
}
 
Example #9
Source File: ParameterExpandItem.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the expanded state of the receiver.
 *
 * @param expanded
 *            the new expanded state
 *
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 *                </ul>
 */
public void setExpanded(final boolean expanded) {
	if (parent == null) { return; }
	// checkWidget();
	this.expanded = expanded;
	if (onExpandBlock != null) {
		if (expanded) {
			onExpandBlock.run();
			setHeight(control.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
		} else {
			for (final Control c : control.getChildren()) {
				c.dispose();
			}
			if (control instanceof ScrolledComposite) {
				((ScrolledComposite) control).setContent(null);
			}
		}
	}
	parent.showItem(this);
}
 
Example #10
Source File: UpdaterDialog.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
private void createFeatureListTab(TabFolder tabFolder, ActiveTab type) {
	TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
	if (type == ActiveTab.ALL_FEATURES) {
		tabItem.setText(ALL_FEATURES_TAB_TITLE);
	} else {
		tabItem.setText(UPDATES_TAB_TITLE);
	}
	ScrolledComposite scroll = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
	scroll.setLayout(new GridLayout());
	scroll.setLayoutData(new GridData());

	Group group = new Group(scroll, SWT.NONE);
	group.setLayout(new GridLayout());
	group.setLayoutData(new GridData());
	listFeatures(group, type);
	scroll.setContent(group);
	scroll.setExpandHorizontal(true);
	scroll.setExpandVertical(true);
	scroll.setMinSize(group.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	tabItem.setControl(scroll);
}
 
Example #11
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 #12
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 #13
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	GridLayout gridLayout = new GridLayout( );
	gridLayout.marginWidth = gridLayout.marginHeight = 5;
	parent.setLayout( gridLayout );

	this.scroller = new ScrolledComposite( parent, SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.BORDER );
	this.scroller.setExpandHorizontal( true );
	this.scroller.setExpandVertical( true );

	scroller.setLayoutData( new GridData( GridData.FILL_BOTH
			| GridData.GRAB_HORIZONTAL
			| GridData.GRAB_VERTICAL ) );

	createParameters( );

	return super.createDialogArea( parent );
}
 
Example #14
Source File: BeginnerTaskQuestionPage.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {

	final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
	sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	this.container = new Composite(sc, SWT.NONE);
	//		this.container.setBounds(10, 10, 450, 200);
	// Updated the number of columns to order the questions vertically.
	final GridLayout layout = new GridLayout(1, false);

	// To display the Help view after clicking the help icon
	this.container.setLayout(layout);
	// If legacy JSON files are in effect.
	if (this.page == null) {
		createQuestionControl(this.container, this.quest);
		Activator.getDefault().logError("Outdated json file is used for task " + this.task.getDescription() + ". Please update.");
	} else {
		// loop through the questions that are to be displayed on the page.
		for (final Question question : this.page.getContent()) {
			createQuestionControl(this.container, question);
		}
		//setting focus to the first field on the page
		this.container.getChildren()[0].setFocus();
	}
	sc.setContent(this.container);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	sc.setMinSize(sc.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	setControl(sc);
}
 
Example #15
Source File: UIUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Updates the page scroll increment for given composite.
 * 
 * @param scomp
 */
public static void updatePageIncrement( ScrolledComposite scomp )
{
	ScrollBar vbar = scomp.getVerticalBar( );
	if ( vbar != null )
	{
		Rectangle clientArea = scomp.getClientArea( );
		int increment = clientArea.height - 5;
		vbar.setPageIncrement( increment );
	}
}
 
Example #16
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 #17
Source File: WelcomeTab.java    From Rel with Apache License 2.0 5 votes vote down vote up
public WelcomeTab(RelPanel parent, DbTreeItem item) {
	super(parent, item);
	this.parent = parent;
	connection = parent.getConnection();
	scrollPanel = new ScrolledComposite(parent.getTabFolder(), SWT.V_SCROLL | SWT.H_SCROLL);
	refresh();
    setControl(scrollPanel);
    ready();
}
 
Example #18
Source File: BindingPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void computeSize( )
{
	Point size = composite.computeSize( SWT.DEFAULT, SWT.DEFAULT );
	( (ScrolledComposite) container ).setMinSize( size.x, size.y + 10 );
	container.layout( );

}
 
Example #19
Source File: OutputPropertyDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void dealParentLayout( Composite container )
{
	if ( container == null )
		return;
	if ( !( container instanceof ScrolledComposite ) )
	{
		dealParentLayout( container.getParent( ) );
		return;
	}
	ScrolledComposite composite = (ScrolledComposite) container;
	Composite control = (Composite) composite.getContent( );
	composite.setMinSize( control.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
	control.layout( );
}
 
Example #20
Source File: BitwiseFlagsPicker.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
/**
 * Create the scrolled area of the dialog that will contain the checkBoxes. 
 * @param parent
 * @return
 */
private ScrolledComposite createScrolledComposite(Composite parent){
    ScrolledComposite composite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    composite.setLayout(new GridLayout());
    GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    data.widthHint = SCROLLED_COMPOSITE_WIDTH;
    data.heightHint = SCROLLED_COMPOSITE_HEIGHT;
    data.horizontalSpan = 2;
    composite.setLayoutData(data);
    composite.setExpandHorizontal(true);
    composite.setExpandVertical(true);
    return composite;
}
 
Example #21
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 #22
Source File: ErrorView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ScrolledComposite createItemContentsFor(final GamaRuntimeException exception) {
	final ScrolledComposite compo = new ScrolledComposite(getViewer(), SWT.H_SCROLL);
	final GridLayout layout = new GridLayout(1, false);
	layout.verticalSpacing = 5;
	compo.setLayout(layout);
	createStackTrace(compo, exception);
	return compo;
}
 
Example #23
Source File: PrintViewer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructs a PrintPreview with the given parent and style.
 *
 * @param parent
 *            the parent component of the scroll pane.
 * @param style
 *            the style of the scroll pane.
 */
public PrintViewer(Composite parent, int style) {
	sc = new ScrolledComposite(parent, style | SWT.V_SCROLL | SWT.H_SCROLL);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	sc.addListener(SWT.Resize, event -> {
		if (sc.getClientArea().width != canvasWidth)
			updateCanvas();
	});
	canvas = new PrintPieceCanvas(sc, SWT.DOUBLE_BUFFERED);
	sc.setContent(canvas);
}
 
Example #24
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void refreshGeneralTab() {
    final ScrolledComposite sc = createScrolledComposite();
    final Control control = createGeneralControl(sc);
    updatedScrolMinSize(control, sc);

    sc.setContent(control);
    generalTab.setControl(sc);
}
 
Example #25
Source File: SeriesSheetImpl.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Convert current type of series to other.
 * 
 * @param series
 *            specified series.
 * @param typeName
 *            other type of series.
 */
private void convertSeriesType( Series series, String typeName )
{
	Series newSeries = getNewSeries( typeName, series );
	ChartAdapter.beginIgnoreNotifications( );
	SeriesDefinition[] seriesDefns = ChartUIUtil.getOrthogonalSeriesDefinitions( getChart( ),
			axisIndex )
			.toArray( new SeriesDefinition[]{} );
	if ( !newSeries.canBeStacked( ) )
	{
		for ( int i = 0; i < seriesDefns.length; i++ )
		{
			if ( ( seriesDefns[i] ).getDesignTimeSeries( ).isStacked( ) )
			{
				( seriesDefns[i] ).getDesignTimeSeries( )
						.setStacked( false );
			}
		}
	}
	ChartAdapter.endIgnoreNotifications( );

	newSeries.eAdapters( ).addAll( seriesDefn.eAdapters( ) );
	seriesDefn.getSeries( ).set( 0, newSeries );

	createSeriesOptions( (ScrolledComposite) cmpList.getParent( ) );

	cmpList.layout( );
}
 
Example #26
Source File: CustomTxtParserOutputWizardPage.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 CustomTxtTraceDefinition()));
    previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

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

}
 
Example #27
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 #28
Source File: TmfAbstractToolTipHandler.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Point create() {
    Composite parent = getParent();
    Table<ToolTipString, ToolTipString, ToolTipString> model = getModel();
    if (parent == null || model.size() == 0) {
        // avoid displaying empty tool tips.
        return null;
    }
    setupControl(parent);
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    setupControl(scrolledComposite);

    Composite composite = new Composite(scrolledComposite, SWT.NONE);
    fComposite = composite;
    composite.setLayout(new GridLayout(3, false));
    setupControl(composite);
    Set<ToolTipString> rowKeySet = model.rowKeySet();
    for (ToolTipString row : rowKeySet) {
        Set<Entry<ToolTipString, ToolTipString>> entrySet = model.row(row).entrySet();
        for (Entry<ToolTipString, ToolTipString> entry : entrySet) {
            Label nameLabel = new Label(composite, SWT.NO_FOCUS);
            nameLabel.setText(entry.getKey().toString());
            setupControl(nameLabel);
            Label separator = new Label(composite, SWT.NO_FOCUS | SWT.SEPARATOR | SWT.VERTICAL);
            GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
            gd.heightHint = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            separator.setLayoutData(gd);
            setupControl(separator);
            Label valueLabel = new Label(composite, SWT.NO_FOCUS);
            valueLabel.setText(entry.getValue().toString());
            setupControl(valueLabel);
        }
    }
    scrolledComposite.setContent(composite);
    Point preferredSize = computePreferredSize();
    scrolledComposite.setMinSize(preferredSize.x, preferredSize.y);
    return preferredSize;
}
 
Example #29
Source File: ClassPathsPageHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void createPageCustomControl( Composite parent )
{	
	this.parent = parent;
	ScrolledComposite sComposite = new ScrolledComposite( parent,
			SWT.H_SCROLL | SWT.V_SCROLL );
	sComposite.setLayout( new GridLayout( ) );
	sComposite.setMinWidth( 560 );
	sComposite.setExpandHorizontal( true );
	sComposite.setMinHeight( 400 );
	sComposite.setExpandVertical( true );

	Composite composite = new Composite( sComposite, SWT.NONE );
	GridLayout layout = new GridLayout( 1, false );
	layout.horizontalSpacing = 10;
	composite.setLayout( layout );
	
	createTabFolderArea( composite );
	
	createCheckboxArea( composite );

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

	sComposite.setContent( composite );

	HelpUtil.setSystemHelp( parent, HelpUtil.CONEXT_ID_DATASOURCE_POJO );
	
}
 
Example #30
Source File: ExportFilterComposite.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void handleEvent(Event event) {
	Composite parent = this.getParent();
	Composite topParent = parent.getParent();
	if (event.widget == addButton) { // add button
		ExportFilterComponentBean bean = new ExportFilterComponentBean(this.ruleType);
		bean.setOptionName(this.baseDataBean.getOptionName());
		bean.setCurrentExpression(this.baseDataBean.getCurrentExpression());

		addComponent(parent, bean);

	} else if (event.widget == deleteButton) { // delete button
		this.dispose();
		Integer number = (Integer) parent.getData("currentNumber") - 1;
		parent.setData("currentNumber", number);
		if (number == 1) {
			Control c = parent.getChildren()[0];
			if (c instanceof ExportFilterComposite) {
				ExportFilterComposite temp = (ExportFilterComposite) c;
				temp.setDeleteButtonEnabled(false);
			}
		}
	}

	if (topParent instanceof ScrolledComposite) {
		((ScrolledComposite) topParent).setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	}
	parent.layout(true);
}