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

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite#setContent() . 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: 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 2
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 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: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void refreshCustomTab() {
    final ScrolledComposite sc = createScrolledComposite();
    final Control control = createCustomControl(sc);
    updatedScrolMinSize(control, sc);
    sc.setContent(control);
    customTab.setControl(sc);
}
 
Example 5
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 6
Source File: AccordionControl.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/** Toggles the visibility of the children of the given label */
private void toggle( AccordionLabel label, boolean performLayout,
		boolean autoClose )
{
	if ( autoClose )
	{
		collapseAll( true );
	}
	ScrolledComposite scrolledComposite = getContentArea( label );

	GridData scrollGridData = (GridData) scrolledComposite.getLayoutData( );
	boolean close = !scrollGridData.exclude;
	scrollGridData.exclude = close;
	scrolledComposite.setVisible( !close );
	updateIcon( label );

	if ( !scrollGridData.exclude && scrolledComposite.getContent( ) == null )
	{
		Composite composite = createChildContainer( scrolledComposite );
		Object header = getHeader( label );
		createChildren( composite, header );
		scrolledComposite.setContent( composite );
		scrolledComposite.setMinSize( composite.computeSize( SWT.DEFAULT,
				SWT.DEFAULT ) );
	}

	if ( performLayout )
	{
		layout( true );
	}

	Event event = new Event( );
	event.widget = this;
	notifyListeners( SWT.SELECTED, event );
}
 
Example 7
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void refreshMembershipTab() {
    final ScrolledComposite sc = createScrolledComposite();

    final Control control = createMembershipControl(sc);
    updatedScrolMinSize(control, sc);

    sc.setContent(control);
    memberShipTab.setControl(sc);
}
 
Example 8
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 9
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 10
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 11
Source File: PipelineExecutorDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFiles.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFiles.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFilesTarget );
    wlResultFilesTarget.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFilesTarget.Label" ) );
    FormData fdlResultFilesTarget = new FormData();
    fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
    fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

    wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFilesTarget );
    wResultFilesTarget.addModifyListener( lsMod );
    FormData fdResultFilesTarget = new FormData();
    fdResultFilesTarget.width = 250;
    fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
    fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultFilesTarget.setLayoutData( fdResultFilesTarget );

    // ResultFileNameField
    //
    wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFileNameField );
    wlResultFileNameField.setText( BaseMessages.getString( PKG, "PipelineExecutorDialog.ResultFileNameField.Label" ) );
    FormData fdlResultFileNameField = new FormData();
    fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
    fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFileNameField.setLayoutData( fdlResultFileNameField );

    wResultFileNameField = new TextVar( pipelineMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFileNameField );
    wResultFileNameField.addModifyListener( lsMod );
    FormData fdResultFileNameField = new FormData();
    fdResultFileNameField.width = 250;
    fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
    fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
    wResultFileNameField.setLayoutData( fdResultFileNameField );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 12
Source File: TimeGraphLegend.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Creates a states group
 *
 * @param composite
 *            the parent composite
 * @since 3.3
 */
private void addStateGroups(Composite composite) {

    StateItem[] stateTable = fProvider.getStateTable();
    if (stateTable == null) {
        return;
    }
    List<StateItem> stateItems = Arrays.asList(stateTable);
    Collection<StateItem> linkStates = Collections2.filter(stateItems, TimeGraphLegend::isLinkState);

    ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
    sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setLayout(GridLayoutFactory.swtDefaults().margins(200, 0).create());

    Composite innerComposite = new Composite(sc, SWT.NONE);
    fInnerComposite = innerComposite;
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    innerComposite.setLayoutData(gd);
    innerComposite.setLayout(new GridLayout());
    innerComposite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            /*
             * Find the highest number of columns that fits in the new width
             */
            Point size = innerComposite.getSize();
            List<GridLayout> gridLayouts = getGridLayouts(innerComposite);
            Point minSize = new Point(0, 0);
            for (int columns = 8; columns > 0; columns--) {
                final int numColumns = columns;
                gridLayouts.forEach(gl -> gl.numColumns = numColumns);
                minSize = innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                if (minSize.x <= size.x) {
                    break;
                }
            }
            sc.setMinSize(0, minSize.y);
        }
    });

    sc.setContent(innerComposite);

    createStatesGroup(innerComposite);
    createLinkGroup(linkStates, innerComposite);

    sc.setMinSize(0, innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
 
Example 13
Source File: GraphModelDialog.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 4 votes vote down vote up
private void addGraphTab() {

    CTabItem wGraphTab = new CTabItem( wTabs, SWT.NONE );
    wGraphTab.setText( "Graph" );

    ScrolledComposite wGraphSComp = new ScrolledComposite( wTabs, SWT.V_SCROLL | SWT.H_SCROLL );
    wGraphSComp.setLayout( new FillLayout() );

    Composite wGraphComp = new Composite( wGraphSComp, SWT.NONE );
    props.setLook( wGraphComp );

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 3;
    formLayout.marginHeight = 3;
    wGraphComp.setLayout( formLayout );

    Button wAuto = new Button( wGraphComp, SWT.PUSH );
    wAuto.setText( "Auto" );
    FormData fdAuto = new FormData();
    fdAuto.right = new FormAttachment( 100, 0 );
    fdAuto.bottom = new FormAttachment( 100, 0 );
    wAuto.setLayoutData( fdAuto );
    wAuto.addListener( SWT.Selection, this::autoModelLayout );

    // This is the canvas on which we draw the graph
    //
    wCanvas = new Canvas( wGraphComp, SWT.NONE );
    props.setLook( wCanvas );
    FormData fdCanvas = new FormData();
    fdCanvas.left = new FormAttachment( 0, 0 );
    fdCanvas.right = new FormAttachment( 100, 0 );
    fdCanvas.top = new FormAttachment( 0, 0 );
    fdCanvas.bottom = new FormAttachment( 100, 0 );
    wCanvas.setLayoutData( fdCanvas );
    wCanvas.addPaintListener( this::paintCanvas );
    wCanvas.addListener( SWT.MouseDown, this::graphMouseDown );
    wCanvas.addListener( SWT.MouseUp, this::graphMouseUp );
    wCanvas.addListener( SWT.MouseMove, this::moveGraphObject );
    wCanvas.addListener( SWT.MouseDoubleClick, this::editGraphObject );

    FormData fdGraphComp = new FormData();
    fdGraphComp.left = new FormAttachment( 0, 0 );
    fdGraphComp.top = new FormAttachment( 0, 0 );
    fdGraphComp.right = new FormAttachment( 100, 0 );
    fdGraphComp.bottom = new FormAttachment( wAuto, -margin );
    wGraphComp.setLayoutData( fdGraphComp );

    wGraphComp.pack();

    Rectangle bounds = wGraphComp.getBounds();

    wGraphSComp.setContent( wGraphComp );
    wGraphSComp.setExpandHorizontal( true );
    wGraphSComp.setExpandVertical( true );
    wGraphSComp.setMinWidth( bounds.width );
    wGraphSComp.setMinHeight( bounds.height );

    wGraphTab.setControl( wGraphSComp );
  }
 
Example 14
Source File: StarModelerPerspective.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void createTabForDomain(final StarDomain starDomain) throws Exception {
  SpoonPerspectiveManager.getInstance().activatePerspective(getClass());

  final XulTabAndPanel tabAndPanel = createTab();
  PropsUI props = PropsUI.getInstance();

  final Composite comp = (Composite) tabAndPanel.panel.getManagedObject();
  props.setLook(comp);
  comp.setLayout(new FillLayout());

  final ScrolledComposite scrolledComposite = new ScrolledComposite(comp, SWT.V_SCROLL | SWT.H_SCROLL);
  props.setLook(scrolledComposite);
  scrolledComposite.setLayout(new FillLayout());

  final Composite parentComposite = new Composite(scrolledComposite, SWT.NONE);
  props.setLook(parentComposite);

  int margin = Const.MARGIN;

  FormLayout formLayout = new FormLayout();
  formLayout.marginLeft=10;
  formLayout.marginRight=10;
  formLayout.marginTop=10;
  formLayout.marginBottom=10;
  formLayout.spacing=margin;
  parentComposite.setLayout(formLayout);

  Control lastControl = addModelsGroupToDomainTab(starDomain, tabAndPanel, parentComposite);
  lastControl = addSharedDimensionsGroupToDomainTab(starDomain, tabAndPanel, parentComposite, lastControl);
  lastControl = addPhysicalGroupToDomainTab(starDomain, tabAndPanel, parentComposite, lastControl);

  parentComposite.layout(true);
  parentComposite.pack();

  // What's the size:
  Rectangle bounds = parentComposite.getBounds();

  scrolledComposite.setContent(parentComposite);
  scrolledComposite.setExpandHorizontal(true);
  scrolledComposite.setExpandVertical(true);
  scrolledComposite.setMinWidth(bounds.width);
  scrolledComposite.setMinHeight(bounds.height);

  models.add(starDomain);

  setNameForTab(tabAndPanel.tab, starDomain.getDomain().getName(defaultLocale));
  setMetaForTab(tabAndPanel.tab, starDomain);
  setSelectedMeta(starDomain);
  setActive(true);

  comp.layout();

  Spoon.getInstance().enableMenus();
}
 
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: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFiles.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFiles.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFilesTarget );
    wlResultFilesTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFilesTarget.Label" ) );
    FormData fdlResultFilesTarget = new FormData();
    fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
    fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

    wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFilesTarget );
    wResultFilesTarget.addModifyListener( lsMod );
    FormData fdResultFilesTarget = new FormData();
    fdResultFilesTarget.width = 250;
    fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
    fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultFilesTarget.setLayoutData( fdResultFilesTarget );

    // ResultFileNameField
    //
    wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultFileNameField );
    wlResultFileNameField.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFileNameField.Label" ) );
    FormData fdlResultFileNameField = new FormData();
    fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
    fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultFileNameField.setLayoutData( fdlResultFileNameField );

    wResultFileNameField = new TextVar( transMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultFileNameField );
    wResultFileNameField.addModifyListener( lsMod );
    FormData fdResultFileNameField = new FormData();
    fdResultFileNameField.width = 250;
    fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
    fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
    wResultFileNameField.setLayoutData( fdResultFileNameField );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 17
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;
}
 
Example 18
Source File: TransExecutorDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.OutputRowsSource.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wOutputRowsSource = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wOutputRowsSource );
    wOutputRowsSource.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wOutputRowsSource.setLayoutData( fdResultRowsTarget );

    wlOutputFields = new Label( wInputComposite, SWT.NONE );
    wlOutputFields.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlOutputFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wOutputRowsSource, 10 );
    wlOutputFields.setLayoutData( fdlResultFields );

    int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 );

    ColumnInfo[] ciResultFields =
      new ColumnInfo[] {
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Field" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Type" ),
          ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Length" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ),
        new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Precision" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false ), };

    wOutputFields =
      new TableView( transMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlOutputFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wOutputFields.setLayoutData( fdResultFields );
    wOutputFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 19
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 20
Source File: FilterRegularDialog.java    From tmxeditor8 with GNU General Public License v2.0 votes vote down vote up
@Override
	protected Control createDialogArea(Composite parent) {
		Composite tParent = (Composite)super.createDialogArea(parent);
		GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true);
		parentData.widthHint = 650;
		parentData.heightHint = 400;
		tParent.setLayoutData(parentData);
		
		// 显示名称
		Composite nameCmp = new Composite(tParent, SWT.NONE);
		GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameCmp);
		GridLayoutFactory.swtDefaults().numColumns(2).applyTo(nameCmp);
		
		Label nameLbl = new Label(nameCmp, SWT.NONE);
		nameLbl.setText(Messages.getString("tmxeditor.filterRegularDialog.filterName"));
		
		nameTxt = new Text(nameCmp, SWT.BORDER);
		nameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		// 设置选项
		Composite radioCmp = new Composite(tParent, SWT.NONE);
		GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(radioCmp);
		GridLayoutFactory.swtDefaults().numColumns(2).applyTo(radioCmp);
		
		fitAllBtn = new Button(radioCmp, SWT.RADIO);
		fitAllBtn.setText(Messages.getString("tmxeditor.filterRegularDialog.fullFillAllCondition"));
		fitAllBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		fitAllBtn.setSelection(true);
		
		fitAnyoneBtn = new Button(radioCmp, SWT.RADIO);
		fitAnyoneBtn.setText(Messages.getString("tmxeditor.filterRegularDialog.fullfillOneCondition"));
		fitAnyoneBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		scroll = new ScrolledComposite(tParent, SWT.V_SCROLL);
		scroll.setLayoutData(new GridData(GridData.FILL_BOTH));
		scroll.setExpandHorizontal(true);
		scroll.setExpandVertical(true);
		
		regularParentCmp = new Composite(scroll, SWT.BORDER);
		GridDataFactory.fillDefaults().grab(true, false).applyTo(regularParentCmp);
		GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(1).applyTo(regularParentCmp);
		
		scroll.setContent(regularParentCmp);
		
		buttonData = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		buttonData.widthHint = 50;
		
		comboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		comboData.widthHint = 100;
		
		if (curBean == null) {
			createRegularCmp(regularParentCmp);
		}else {
			initRegularCmp();
		}
		
		return tParent;
	}