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

The following examples show how to use org.eclipse.swt.custom.ScrolledComposite#setExpandHorizontal() . 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: 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: ArtikelDetailDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	ScrolledComposite ret = new ScrolledComposite(parent, SWT.V_SCROLL);
	Composite cnt = new Composite(ret, SWT.NONE);
	ret.setContent(cnt);
	ret.setExpandHorizontal(true);
	ret.setExpandVertical(true);
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	cnt.setLayout(new FillLayout());
	AutoForm tblArtikel = null;
	if (article instanceof Identifiable) {
		tblArtikel = new LabeledInputField.AutoForm(cnt,
			Artikeldetail.getModelFieldDefs(parent.getShell()));
	} else {
		tblArtikel =
			new LabeledInputField.AutoForm(cnt, Artikeldetail.getFieldDefs(parent.getShell()));
	}
	tblArtikel.reload(article);
	ret.setMinSize(cnt.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	return ret;
}
 
Example 4
Source File: UsersWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return
 */
private ScrolledComposite createScrolledComposite() {
    final ScrolledComposite sc = new ScrolledComposite(tab, SWT.V_SCROLL);
    sc.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 5).create());
    sc.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, SWT.DEFAULT).create());
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    return sc;
}
 
Example 5
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 6
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 7
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 8
Source File: DiskInfoTab.java    From AppleCommander with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the DISK INFO tab.
 */
public DiskInfoTab(CTabFolder tabFolder, FormattedDisk[] disks) {
	this.formattedDisks = disks;
	
	CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
	ctabitem.setText(textBundle.get("DiskInfoTab.Title")); //$NON-NLS-1$
	
	tabFolder.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			getInfoTable().removeAll();
			buildDiskInfoTable(getFormattedDisk(0));	// FIXME!
		}
	});
	
	ScrolledComposite scrolledComposite = new ScrolledComposite(
		tabFolder, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);
	ctabitem.setControl(scrolledComposite);
	
	composite = new Composite(scrolledComposite, SWT.NONE);
	createDiskInfoTable();
	if (disks.length > 1) {
		RowLayout layout = new RowLayout(SWT.VERTICAL);
		layout.wrap = false;
		composite.setLayout(layout);
		for (int i=0; i<disks.length; i++) {
			Label label = new Label(composite, SWT.NULL);
			label.setText(disks[i].getDiskName());
			buildDiskInfoTable(disks[i]);
		}
	} else {
		composite.setLayout(new FillLayout());
		buildDiskInfoTable(disks[0]);
	}
	composite.pack();
	scrolledComposite.setContent(composite);
	scrolledComposite.setMinSize(
		composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
 
Example 9
Source File: CustomXmlParserOutputWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createControl(final Composite parent) {
    container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout());

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

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

    outputsContainer.layout();

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

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

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

}
 
Example 10
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 11
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 12
Source File: VisualizeTxtUMLPage.java    From txtUML with Eclipse Public License 1.0 4 votes vote down vote up
private void createPage(Composite parent, IProgressMonitor monitor) {
	if (monitor != null)
		monitor.beginTask("Discovering diagram descriptions...", 100);

	sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	container = new Composite(sc, SWT.NONE);

	GridLayout layout = new GridLayout(4, false);
	container.setLayout(layout);

	final Label label = new Label(container, SWT.TOP);
	label.setText("txtUML Diagrams: ");

	addInitialLayoutFields();

	// diagram descriptions tree
	ScrolledComposite treeComposite = new ScrolledComposite(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	tree = getDiagramTreeViewer(treeComposite, monitor);
	tree.addDoubleClickListener(new IDoubleClickListener() {
		@Override
		public void doubleClick(DoubleClickEvent event) {
			ISelection selection = event.getSelection();
			Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator();
			if (selectedElements.hasNext()) {
				Object selectedElement = selectedElements.next();
				if (selectedElement instanceof IJavaProject) {
					List<Object> expandedElements = new ArrayList<>(Arrays.asList(tree.getExpandedElements()));
					if (expandedElements.contains(selectedElement)) {
						expandedElements.remove(selectedElement);
					} else {
						expandedElements.add(selectedElement);
					}
					tree.setExpandedElements(expandedElements.toArray());
				} else if (selectedElement instanceof IType) {
					List<Object> checkedElements = new ArrayList<>(Arrays.asList(tree.getCheckedElements()));
					boolean isChecked = checkedElements.contains(selectedElement);
					tree.setChecked(selectedElement, !isChecked);
					IType selectedType = (IType) selectedElement;
					if (!isChecked && !txtUMLLayout.contains(selectedType)) {
						txtUMLLayout.add(selectedType);
					} else {
						txtUMLLayout.remove(selectedType);
					}
					selectElementsInDiagramTree(txtUMLLayout.toArray(), true);
				}
			}
		}
	});

	selectElementsInDiagramTree(txtUMLLayout.toArray(), false);
	setExpandedLayouts(txtUMLLayout);

	GridData treeGd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
	treeGd.heightHint = 200;
	treeGd.widthHint = 150;
	GridData labelGd = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
	labelGd.verticalIndent = 5;
	label.setLayoutData(labelGd);
	treeComposite.setLayoutData(treeGd);

	treeComposite.setContent(tree.getControl());
	treeComposite.setExpandHorizontal(true);
	treeComposite.setExpandVertical(true);
	sc.setContent(container);
	sc.setExpandHorizontal(true);
	sc.setExpandVertical(true);
	container.setSize(container.computeSize(450, 300, true));
	sc.setMinSize(container.getSize());
	sc.setSize(container.getSize());

	setControl(parent);
	setPageComplete(true);
	if (monitor != null)
		monitor.done();
}
 
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: 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 15
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 16
Source File: CascadingParametersDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	// Composite composite = (Composite) super.createDialogArea( parent );

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

	mainContent = new Composite( sc, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
	layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
	layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
	layout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
	mainContent.setLayout( layout );

	UIUtil.bindHelp( parent, IHelpContextIds.CASCADING_PARAMETER_DIALOG_ID );

	GridData data = new GridData( GridData.FILL_BOTH );

	maxStrLengthProperty = getMaxStrLength( PROPERTY_LABEL_STRING,
			mainContent );

	maxStrLengthOption = getMaxStrLength( OPTION_LABEL_STRING, mainContent );

	mainContent.setLayoutData( data );

	createGeneralPart( mainContent );

	createChoicePart( mainContent );

	createDynamicParamsPart( mainContent );

	createPropertiesPart( mainContent );

	createSortingArea( mainContent );

	createOptionsPart( mainContent );

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

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

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

	return sc;
}
 
Example 17
Source File: GanttTester.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public GanttTester() {
    final Display display = Display.getDefault(); //new Display();
    final Monitor m = display.getMonitors()[0];
    final Shell shell = new Shell(display);
    shell.setText("GanttChart Test Application");
    shell.setLayout(new FillLayout());

    final SashForm sfVSplit = new SashForm(shell, SWT.VERTICAL);
    final SashForm sfHSplit = new SashForm(sfVSplit, SWT.HORIZONTAL);

    final ViewForm vfBottom = new ViewForm(sfVSplit, SWT.NONE);
    _vfChart = new ViewForm(sfHSplit, SWT.NONE);
    final ViewForm rightForm = new ViewForm(sfHSplit, SWT.NONE);

    final ScrolledComposite sc = new ScrolledComposite(rightForm, SWT.V_SCROLL | SWT.H_SCROLL);
    rightForm.setContent(sc);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.getVerticalBar().setPageIncrement(150);

    final Composite rightComposite = new Composite(sc, SWT.NONE);
    final GridLayout gl = new GridLayout();
    gl.marginLeft = 0;
    gl.marginTop = 0;
    gl.horizontalSpacing = 0;
    gl.verticalSpacing = 0;
    gl.marginBottom = 0;
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    rightComposite.setLayout(gl);

    sc.setContent(rightComposite);

    rightComposite.addListener(SWT.Resize, new Listener() {

        public void handleEvent(final Event event) {
            sc.setMinSize(rightComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }

    });

    sfVSplit.setWeights(new int[] { 91, 9 });
    sfHSplit.setWeights(new int[] { 70, 30 });

    // top left side
    _ganttChart = new GanttChart(_vfChart, SWT.MULTI);
    _vfChart.setContent(_ganttChart);
    _ganttComposite = _ganttChart.getGanttComposite();

    final TabFolder tfRight = new TabFolder(rightComposite, SWT.BORDER);
    final TabItem tiGeneral = new TabItem(tfRight, SWT.NONE);
    tiGeneral.setText("Creation");

    final TabItem tiAdvanced = new TabItem(tfRight, SWT.NONE);
    tiAdvanced.setText("Advanced");

    final TabItem tiEventLog = new TabItem(tfRight, SWT.NONE);
    tiEventLog.setText("Event Log");

    final Composite bottom = new Composite(rightComposite, SWT.NONE);
    bottom.setLayout(new GridLayout());
    createCreateButtons(bottom);

    vfBottom.setContent(createBottom(vfBottom));
    tiGeneral.setControl(createCreationTab(tfRight)); // NOPMD
    tiAdvanced.setControl(createAdvancedTab(tfRight));
    tiEventLog.setControl(createEventLogTab(tfRight));

    shell.setMaximized(true);
    // uncomment to put on right-hand-side monitor
    shell.setLocation(new Point(m.getClientArea().x, 0));

    sc.setMinSize(rightComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    shell.open();

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.removeListener(SWT.KeyDown, _undoRedoListener);

    shell.dispose();
}
 
Example 18
Source File: WorkflowExecutorDialog.java    From hop 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, "JobExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.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, "JobExecutorDialog.ResultRowsTarget.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 );

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

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

    int nrRows = ( workflowExecutorMeta.getResultRowsField() != null ? workflowExecutorMeta.getResultRowsField().length : 1 );

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

    wResultRowsFields =
      new TableView( pipelineMeta, 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( wlResultFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wResultRowsFields.setLayoutData( fdResultFields );
    wResultRowsFields.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: 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 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;
	}