Java Code Examples for org.eclipse.swt.layout.GridData#VERTICAL_ALIGN_BEGINNING

The following examples show how to use org.eclipse.swt.layout.GridData#VERTICAL_ALIGN_BEGINNING . 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: StatusWidget.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected void createControls() {
	setLayout(new GridLayout(2, false));

	imageLabel = new Label(this, SWT.NONE);
	imageLabel.setText("   ");
	GridData imgLabelLayoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
	imgLabelLayoutData.widthHint = 20;
	imageLabel.setLayoutData(imgLabelLayoutData);

	link = new Link(this, SWT.NONE);
	GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL);
	linkLayoutData.heightHint = 40;
	link.setLayoutData(linkLayoutData);
	link.setFont(getFont());
	link.setText("\n\n\n");
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			super.widgetSelected(e);
			quickFix.apply();
		}
	});
}
 
Example 2
Source File: ExpressionSection.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Label getLabelControl( Composite parent )
{
	Label label = super.getLabelControl( parent );
	if ( multi )
	{
		GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_BEGINNING
				| GridData.VERTICAL_ALIGN_BEGINNING );
		gd.horizontalSpan = 2;
		label.setLayoutData( gd );
	}
	return label;
}
 
Example 3
Source File: DerbyPropertiesPage.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
protected GridData getSeperatorLabelGridData() {

    GridData gridData = new GridData(GridData.BEGINNING |
                            GridData.HORIZONTAL_ALIGN_FILL |
                            GridData.GRAB_VERTICAL |
                            GridData.BEGINNING |
                            GridData.VERTICAL_ALIGN_BEGINNING |
                            GridData.VERTICAL_ALIGN_FILL) ;
    gridData.horizontalSpan = 2;
    gridData.grabExcessVerticalSpace  = false;
    gridData.grabExcessHorizontalSpace = true;
    return gridData;

}
 
Example 4
Source File: BidiPropertiesConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createBuildPathTabContent( Composite parent )
{
	String[] bidiValues = new String[]{
			TRUE, FALSE
	};

	Composite pageContent = new Composite( parent, SWT.NONE );

	GridData data = new GridData( GridData.FILL_HORIZONTAL
			| GridData.FILL_VERTICAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	data.grabExcessHorizontalSpace = true;
	pageContent.setLayoutData( data );

	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 3;
	pageContent.setLayout( layout );

	addComboBox( pageContent,
			DEFAULT_DIRECTION,
			PREF_LTR_BIDI_DIRECTION,
			bidiValues,
			new String[]{
					LTR_DIRECTION, RTL_DIRECTION
			},
			0 );

	return pageContent;
}
 
Example 5
Source File: SignalTab.java    From ProtocolAnalyzer with GNU General Public License v3.0 5 votes vote down vote up
public SignalTab(RawProtocolMessage message, CTabFolder chartFolder) {
    // Check what kind of data we have, if it is only pulses, then just generate
    // the pulse series and if we have samples, then generate the sampleSeries as well
    if (messageHasOnlyPulseData(message)) {
        signalSeriesCollection = createPlotDataFromPulsesOnly(message.m_PulseLengths);
    } else {
        signalSeriesCollection = createPlotDataFromSamplesAndPulses(message);
    }
    selectedPulseSeries = new XYSeries("Selected Pulses", false);
    signalSeriesCollection.addSeries(selectedPulseSeries);

    // Create tab for signal
    CTabItem signalTab = new CTabItem(chartFolder, SWT.NONE);
    signalTab.setText("Signal");

    // Create a Chart and a panel for signal
    JFreeChart chart = ChartFactory.createXYLineChart("Signal", "ms", "Amplitude", signalSeriesCollection, PlotOrientation.VERTICAL, true, false, false);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(700, 290));
    RawSignalWindow.configurePanelLooks(chart, 2);

    // Create a ChartComposite on our window
    ChartComposite frame = new ChartComposite(chartFolder, SWT.NONE, chart, true);
    frame.setHorizontalAxisTrace(false);
    frame.setVerticalAxisTrace(false);
    frame.setDisplayToolTips(true);
    GridData gridDatap = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    gridDatap.grabExcessHorizontalSpace = true;
    gridDatap.grabExcessVerticalSpace = false;
    //gridDatap.heightHint = 270;
    frame.setLayoutData(gridDatap);
    signalTab.setControl(frame);
}
 
Example 6
Source File: MessageWizardPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite result = new Composite(parent, SWT.NONE);
    setControl(result);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2;
    layout.numColumns = 2;
    result.setLayout(layout);

    Image image = getMessageImage();
    if (image != null) {
        Label label = new Label(result, SWT.NULL);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }

    String message = getMessageString();
    if (message != null) {
        Label messageLabel = new Label(result, SWT.WRAP);
        messageLabel.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.VERTICAL_ALIGN_BEGINNING);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageLabel.setLayoutData(data);
        messageLabel.setFont(result.getFont());
    }
    Dialog.applyDialogFont(result);
}
 
Example 7
Source File: ReportExamples.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	Composite container = (Composite) super.createDialogArea( parent );
	setTitle( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$
	setMessage( Messages.getString( "ReportExamples.ContributeSamples.messages" ) ); //$NON-NLS-1$	
	super.getShell( ).setText( Messages.getString( "ReportExamples.ContributeSamples.title" ) ); //$NON-NLS-1$

	Composite composite = new Composite( container, SWT.NONE );
	GridData gd = new GridData( GridData.FILL_BOTH
			| GridData.VERTICAL_ALIGN_BEGINNING );
	gd.widthHint = 380;
	gd.heightHint = 200;
	gd.horizontalIndent = 10;
	composite.setLayoutData( gd );
	composite.setLayout( new GridLayout( ) );
	new Label( composite, SWT.NONE );
	Link link = new Link( composite, SWT.WRAP );
	link.setLayoutData( new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING ) );
	String[] arguments = new String[2];
	arguments[0] = "<a>"; //$NON-NLS-1$
	arguments[1] = "</a>"; //$NON-NLS-1$
	String linkText = Messages.getFormattedString( "ReportExamples.ContributeSamples.description", arguments ); //$NON-NLS-1$
	link.setText( linkText );
	link.addListener( SWT.Selection, new Listener( ) {

		public void handleEvent( Event event )
		{
			openLink( "https://bugs.eclipse.org/bugs/enter_bug.cgi?product=BIRT&bug_severity=enhancement" ); //$NON-NLS-1$				
		}
	} );
	link.setSize( 300, 50 );
	return container;

}
 
Example 8
Source File: RawSignalWindow.java    From ProtocolAnalyzer with GNU General Public License v3.0 5 votes vote down vote up
private CTabFolder createTabFolder(Shell shell1) {
    CTabFolder chartFolder = new CTabFolder(shell1, SWT.NONE);
    GridData folderGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    folderGridData.grabExcessHorizontalSpace = true;
    folderGridData.grabExcessVerticalSpace = false;
    folderGridData.heightHint = 280;
    chartFolder.setLayoutData(folderGridData);
    return chartFolder;
}
 
Example 9
Source File: ChartConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Composite createBuildPathTabContent( Composite parent )
{

	Composite pageContent = new Composite( parent, SWT.NONE );

	GridData data = new GridData( GridData.FILL_HORIZONTAL
			| GridData.FILL_VERTICAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	data.grabExcessHorizontalSpace = true;
	pageContent.setLayoutData( data );

	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 3;
	pageContent.setLayout( layout );

	String[] enableDisableValues = new String[]{
			ENABLED, DISABLED
	};

	addCheckBox( pageContent,
			ENABLE_BUTTON,
			PREF_ENALBE_LIVE,
			enableDisableValues,
			0 );
	addTextField( pageContent,
			Messages.getString( "ChartPreferencePage.Label.MaxRowNumber" ), //$NON-NLS-1$
			PREF_MAX_ROW,
			0,
			0 );
	return pageContent;
}
 
Example 10
Source File: MessageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void createControl(Composite parent) {
	initializeDialogUnits(parent);
	Composite result= new Composite(parent, SWT.NONE);
	setControl(result);
	GridLayout layout= new GridLayout();
	layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN) * 3 / 2;
	layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.verticalSpacing= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING) * 2;
	layout.numColumns= 2;
	result.setLayout(layout);

	Image image= getMessageImage();
	if (image != null) {
		Label label= new Label(result, SWT.NULL);
		image.setBackground(label.getBackground());
		label.setImage(image);
		label.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
	}

	String message= getMessageString();
	if (message != null) {
		Label messageLabel= new Label(result, SWT.WRAP);
		messageLabel.setText(message);
		GridData data= new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
		data.widthHint= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
		messageLabel.setLayoutData(data);
		messageLabel.setFont(result.getFont());
	}
	Dialog.applyDialogFont(result);
}
 
Example 11
Source File: DerbyPropertiesPage.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
protected GridData getSeperatorLabelGridData() {

    GridData gridData = new GridData(GridData.BEGINNING |
                            GridData.HORIZONTAL_ALIGN_FILL |
                            GridData.GRAB_VERTICAL |
                            GridData.BEGINNING |
                            GridData.VERTICAL_ALIGN_BEGINNING |
                            GridData.VERTICAL_ALIGN_FILL) ;
    gridData.horizontalSpan = 2;
    gridData.grabExcessVerticalSpace  = false;
    gridData.grabExcessHorizontalSpace = true;
    return gridData;

}
 
Example 12
Source File: GeneralPropertiesChartSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Composite getComponent( Composite parent )
{
	cmpContent = new Composite( parent, SWT.NONE );
	{
		GridLayout glContent = new GridLayout( );
		glContent.horizontalSpacing = 5;
		glContent.verticalSpacing = 5;
		glContent.marginHeight = 7;
		glContent.marginWidth = 7;
		cmpContent.setLayout( glContent );
	}

	// Layout for General composite
	GridLayout glGeneral = new GridLayout( );
	glGeneral.numColumns = 3;
	glGeneral.horizontalSpacing = 5;
	glGeneral.verticalSpacing = 5;
	glGeneral.marginHeight = 7;
	glGeneral.marginWidth = 7;

	createDescriptionArea( cmpContent );

	Group grpGeneral = new Group( cmpContent, SWT.NONE );
	GridData gdGRPGeneral = new GridData( GridData.VERTICAL_ALIGN_BEGINNING
			| GridData.FILL_HORIZONTAL );
	grpGeneral.setLayoutData( gdGRPGeneral );
	grpGeneral.setLayout( glGeneral );
	grpGeneral.setText( Messages.getString( "AttributeSheetImpl.Lbl.ChartProperties" ) ); //$NON-NLS-1$

	Label lblType = new Label( grpGeneral, SWT.NONE );
	GridData gdLBLType = new GridData( );
	gdLBLType.horizontalIndent = 1;
	lblType.setLayoutData( gdLBLType );
	lblType.setText( Messages.getString( "AttributeSheetImpl.Lbl.Type" ) ); //$NON-NLS-1$

	txtType = new Text( grpGeneral, SWT.BORDER | SWT.READ_ONLY );
	GridData gdTXTType = new GridData( GridData.FILL_HORIZONTAL );
	gdTXTType.horizontalSpan = 2;
	txtType.setLayoutData( gdTXTType );
	txtType.setText( getContext( ).getChartType( ).getDisplayName( ) );

	Label lblSubType = new Label( grpGeneral, SWT.NONE );
	GridData gdLBLSubType = new GridData( );
	gdLBLSubType.horizontalIndent = 1;
	lblSubType.setLayoutData( gdLBLSubType );
	lblSubType.setText( Messages.getString( "AttributeSheetImpl.Lbl.Subtype" ) ); //$NON-NLS-1$

	txtSubType = new Text( grpGeneral, SWT.BORDER | SWT.READ_ONLY );
	GridData gdTXTSubType = new GridData( GridData.FILL_HORIZONTAL );
	gdTXTSubType.horizontalSpan = 2;
	txtSubType.setLayoutData( gdTXTSubType );
	txtSubType.setText( "" );//$NON-NLS-1$

	Orientation orientation = Orientation.VERTICAL_LITERAL;
	if ( getChart( ) instanceof ChartWithAxes )
	{
		orientation = ( (ChartWithAxes) getChart( ) ).getOrientation( );
	}
	Vector<IChartSubType> vSubType = (Vector<IChartSubType>) getContext( ).getChartType( )
			.getChartSubtypes( getChart( ).getDimension( ).getName( ),
					orientation );
	Iterator<IChartSubType> iter = vSubType.iterator( );
	while ( iter.hasNext( ) )
	{
		IChartSubType cSubType = iter.next( );
		if ( cSubType.getName( ).equals( getChart( ).getSubType( ) ) )
		{
			txtSubType.setText( cSubType.getDisplayName( ) );
			break;
		}
	}

	createMisc( grpGeneral );

	return cmpContent;
}
 
Example 13
Source File: GeneralPropertiesChartSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createDescriptionArea( Composite parent )
{
	Composite cmpDesp = new Composite( parent, SWT.NONE );
	{
		cmpDesp.setLayout( new GridLayout( 2, false ) );
		GridData griddata = new GridData( );
		griddata.horizontalAlignment = SWT.FILL;
		griddata.widthHint = 300;
		cmpDesp.setLayoutData( griddata );
	}

	List<String> keys = null;
	if ( getContext( ).getUIServiceProvider( ) != null )
	{
		keys = getContext( ).getUIServiceProvider( ).getRegisteredKeys( );
	}

	Label lblDescription = new Label( cmpDesp, SWT.NONE );
	GridData gdLBLDescription = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
	gdLBLDescription.horizontalIndent = 2;
	gdLBLDescription.grabExcessHorizontalSpace = false;
	lblDescription.setLayoutData( gdLBLDescription );
	lblDescription.setText( Messages.getString( "GeneralSheetImpl.Lbl.Description" ) ); //$NON-NLS-1$

	String sDescription = ""; //$NON-NLS-1$
	if ( getChart( ).getDescription( ) != null )
	{
		sDescription = getChart( ).getDescription( ).getValue( );
	}
	txtDescription = new ExternalizedTextEditorComposite( cmpDesp,
			SWT.BORDER | SWT.MULTI | SWT.WRAP,
			65,
			-1,
			keys,
			getContext( ).getUIServiceProvider( ),
			sDescription );
	GridData gdTXTDescription = new GridData( GridData.FILL_HORIZONTAL );
	gdTXTDescription.heightHint = 65;
	txtDescription.setLayoutData( gdTXTDescription );
	txtDescription.addListener( this );
}
 
Example 14
Source File: AxisTitleSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Composite getComponent( Composite parent )
{
	cmpContent = new Composite( parent, SWT.NONE );
	{
		GridLayout glMain = new GridLayout( );
		glMain.marginHeight = 7;
		glMain.marginWidth = 7;
		cmpContent.setLayout( glMain );
	}

	lacTitle = new LabelAttributesComposite( cmpContent,
			SWT.NONE,
			getContext( ),
			getLabelAttributesContext( ),
			Messages.getString( "BaseAxisLabelAttributeSheetImpl.Lbl.Title" ),//$NON-NLS-1$
			getAxisForProcessing( ),
			"titlePosition", //$NON-NLS-1$
			"title", //$NON-NLS-1$
			defAxis,
			getChart( ).getUnits( ),
			getPositionScope( ) );
	if ( axisType == AngleType.Z )
	{
		lacTitle.setDefaultLabelValue( DefaultValueProvider.defAncillaryAxis( )
				.getTitle( ) );
	}
	else
	{
		if ( axisType == AngleType.X )
		{
			lacTitle.setDefaultLabelValue( DefaultValueProvider.defBaseAxis( )
					.getTitle( ) );
		}
		else
		{
			lacTitle.setDefaultLabelValue( DefaultValueProvider.defOrthogonalAxis( )
					.getTitle( ) );
		}
	}
	GridData gdLACTitle = new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	lacTitle.setLayoutData( gdLACTitle );
	lacTitle.addListener( this );

	return cmpContent;
}
 
Example 15
Source File: TitleTextSheet.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Composite getComponent( Composite parent )
{
	ChartUIUtil.bindHelp( parent,
			ChartHelpContextIds.POPUP_TITLE_TEXT);

	// Layout for the content composite
	GridLayout glContent = new GridLayout( );
	glContent.numColumns = 2;
	glContent.horizontalSpacing = 5;
	glContent.verticalSpacing = 5;
	glContent.marginHeight = 7;
	glContent.marginWidth = 7;

	// Sheet content composite
	cmpContent = new Composite( parent, SWT.NONE );
	cmpContent.setLayout( glContent );

	// Layout for general composite
	GridLayout glLabel = new GridLayout( );
	glLabel.numColumns = 2;
	glLabel.horizontalSpacing = 5;
	glLabel.verticalSpacing = 5;
	glLabel.marginHeight = 0;
	glLabel.marginWidth = 0;

	cmpLabel = new Composite( cmpContent, SWT.NONE );
	GridData gdCMPLabel = new GridData( GridData.VERTICAL_ALIGN_BEGINNING
			| GridData.FILL_HORIZONTAL );
	cmpLabel.setLayoutData( gdCMPLabel );
	cmpLabel.setLayout( glLabel );

	LabelAttributesContext attributesContext = new LabelAttributesContext( );
	attributesContext.isVisibilityEnabled = false;
	attributesContext.isPositionEnabled = false;
	attributesContext.isFontEnabled = false;
	lacLabel = new LabelAttributesComposite( cmpLabel,
			SWT.NONE,
			getContext( ),
			attributesContext,
			Messages.getString( "TitlePropertiesSheet.Label.Text" ), //$NON-NLS-1$
			getBlockForProcessing( ),
			null,
			"label", //$NON-NLS-1$
			ChartDefaultValueUtil.getDefaultTitle( getChart( ) ),
			getChart( ).getUnits( ) );
	GridData gdLACLabel = new GridData( GridData.FILL_HORIZONTAL );
	gdLACLabel.horizontalSpan = 2;
	lacLabel.setLayoutData( gdLACLabel );
	lacLabel.addListener( this );
	lacLabel.setDefaultLabelValue( DefaultValueProvider.defTitleBlock( ).getLabel( ) );

	return cmpContent;
}
 
Example 16
Source File: LinkGroupsPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createContents( Composite parent )
{
	Composite contents = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.verticalSpacing = 0;
	layout.marginWidth = 10;
	layout.marginTop = 10;
	layout.numColumns = 2;
	contents.setLayout( layout );
	GridData data = new GridData( GridData.FILL_BOTH );
	contents.setLayoutData( data );

	createCubeArea( contents );

	filterButton = new Button( contents, SWT.PUSH );
	filterButton.setText( Messages.getString( "DatasetPage.Button.Filter" ) ); //$NON-NLS-1$
	GridData gd = new GridData( );
	gd.widthHint = Math.max( 60, filterButton.computeSize( SWT.DEFAULT,
			SWT.DEFAULT ).x );
	gd.grabExcessVerticalSpace = true;
	gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
	filterButton.setLayoutData( gd );
	filterButton.setEnabled( false );
	filterButton.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			EditPart editPart = (EditPart) viewer.getSelectedEditParts( )
					.get( 0 );
			CommandStack stack = SessionHandleAdapter.getInstance( )
					.getCommandStack( );
			stack.startTrans( "" ); //$NON-NLS-1$

			FilterHandleProvider provider = (FilterHandleProvider) ElementAdapterManager.getAdapter( builder,
					FilterHandleProvider.class );
			if ( provider == null )
				provider = new FilterHandleProvider( );

			FilterListDialog dialog = new FilterListDialog( provider );
			if ( editPart instanceof DatasetNodeEditPart )
				dialog.setInput( (ReportElementHandle) ( editPart.getParent( ).getModel( ) ) );
			else if ( editPart instanceof HierarchyNodeEditPart )
				dialog.setInput( (ReportElementHandle) ( editPart.getModel( ) ) );
			if ( dialog.open( ) == Window.OK )
			{
				stack.commit( );
			}
			else
				stack.rollback( );
		}

	} );
	return contents;
}
 
Example 17
Source File: ColumnBindingDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Adds buttons in Button area.
 * 
 * @param cmp
 *            parent composite
 * @param table
 *            the Table widget affected by Buttons
 * @return the number of added buttons
 */
protected int addButtons( Composite cmp, final Table table )
{
	btnRefresh = new Button( cmp, SWT.PUSH );
	btnRefresh.setText( MSG_REFRESH );
	GridData data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
	data.widthHint = Math.max( 60, btnRefresh.computeSize( SWT.DEFAULT,
			SWT.DEFAULT,
			true ).x );
	btnRefresh.setLayoutData( data );
	btnRefresh.addListener( SWT.Selection, new Listener( ) {

		public void handleEvent( Event event )
		{
			if ( inputElement != null )
			{
				DataSetHandle datasetHandle = inputElement.getDataSet( );
				if ( datasetHandle != null )
				{
					try
					{
						CachedMetaDataHandle cmdh = DataSetUIUtil.getCachedMetaDataHandle( datasetHandle );
						for ( Iterator iter = cmdh.getResultSet( )
								.iterator( ); iter.hasNext( ); )
						{
							ResultSetColumnHandle element = (ResultSetColumnHandle) iter.next( );
							ComputedColumn bindingColumn = StructureFactory.newComputedColumn( inputElement,
									element.getColumnName( ) );
							bindingColumn.setDataType( element.getDataType( ) );
							ExpressionUtility.setBindingColumnExpression( element,
									bindingColumn);

							inputElement.addColumnBinding( bindingColumn,
									false );

						}
					}
					catch ( SemanticException e )
					{
						ExceptionHandler.handle( e );
					}
					refreshBindingTable( );
					updateButtons( );
				}
			}
		}
	} );
	return 1;
}
 
Example 18
Source File: GroupDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the group area
 * 
 * @param parent
 *            the parent composite
 */
private void createGroupArea( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NONE );
	GridData layoutData = new GridData( GridData.FILL_HORIZONTAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	layoutData.verticalSpan = 2;
	composite.setLayoutData( layoutData );
	composite.setLayout( new GridLayout( ) );

	sortingGroup = new Group( composite, SWT.NONE );
	sortingGroup.setText( SORT_GROUP_TITLE );
	sortingGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	sortingGroup.setLayout( new FillLayout( SWT.VERTICAL ) );

	Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE );
	sortingGroupComposite.setLayout( new GridLayout( ) );

	ascending = new Button( sortingGroupComposite, SWT.RADIO );
	// ascending.setText( sortByAscending.getDisplayName( ) );
	ascending.setText( Messages.getString( "GroupDialog.Button.Ascending" ) ); //$NON-NLS-1$
	descending = new Button( sortingGroupComposite, SWT.RADIO );
	// descending.setText( sortByDescending.getDisplayName( ) );
	descending.setText( Messages.getString( "GroupDialog.Button.Descending" ) ); //$NON-NLS-1$

	Group pagebreakGroup = new Group( composite, SWT.NONE );

	pagebreakGroup.setText( Messages.getString( "GroupDialog.PageBreak" ) ); //$NON-NLS-1$
	pagebreakGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	pagebreakGroup.setLayout( layout );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakBefore" ) ); //$NON-NLS-1$
	pagebreakBeforeCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakBeforeChoicesAll.length; i++ )
	{
		pagebreakBeforeCombo.add( pagebreakBeforeChoicesAll[i].getDisplayName( ) );
	}
	pagebreakBeforeCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	pagebreakBeforeCombo.setVisibleItemCount( 30 );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );
	pagebreakBeforeCombo.setData( pagebreakBeforeChoicesAll );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakAfter" ) ); //$NON-NLS-1$
	pagebreakAfterCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakAfterChoicesAll.length; i++ )
	{
		pagebreakAfterCombo.add( pagebreakAfterChoicesAll[i].getDisplayName( ) );
	}
	pagebreakAfterCombo.setVisibleItemCount( 30 );
	pagebreakAfterCombo.setData( pagebreakAfterChoicesAll );
	pagebreakAfterCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakInside" ) ); //$NON-NLS-1$
	pagebreakInsideCombo = new Combo( pagebreakGroup, SWT.READ_ONLY
			| SWT.DROP_DOWN );
	for ( int i = 0; i < pagebreakInsideChoicesAll.length; i++ )
	{
		pagebreakInsideCombo.add( pagebreakInsideChoicesAll[i].getDisplayName( ) );
	}
	pagebreakInsideCombo.setVisibleItemCount( 30 );
	pagebreakInsideCombo.setData( pagebreakInsideChoicesAll );
	pagebreakInsideCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true );

	repeatHeaderButton = new Button( pagebreakGroup, SWT.CHECK );
	repeatHeaderButton.setText( Messages.getString( "GroupDialog.RepeatHeader" ) ); //$NON-NLS-1$
	GridData data = new GridData( );
	data.horizontalSpan = 3;
	repeatHeaderButton.setLayoutData( data );

	PropertyHandle propertyHandle = inputGroup.getPropertyHandle( TableHandle.SORT_PROP );
	if ( propertyHandle.iterator( ).hasNext( ) )
	{
		ascending.setEnabled( false );
		descending.setEnabled( false );
	}
}
 
Example 19
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void initControlLabelLayout( )
{
	GridData labelLayout = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
	controlLabel.setLayoutData( labelLayout );
}
 
Example 20
Source File: ExpressionBuilderConfigurationBlock.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private Composite createBuildPathTabContent( Composite parent )
{
	IExpressionSupport[] supports = ExpressionSupportManager.getExpressionSupports( );
	String[] supportDisplayNames = new String[supports.length];
	String[] supportNames = new String[supports.length];
	for ( int i = 0; i < supports.length; i++ )
	{
		supportDisplayNames[i] = supports[i].getDisplayName( );
		supportNames[i] = supports[i].getName( );
	}

	Composite pageContent = new Composite( parent, SWT.NONE );

	GridData data = new GridData( GridData.FILL_HORIZONTAL
			| GridData.FILL_VERTICAL
			| GridData.VERTICAL_ALIGN_BEGINNING );
	data.grabExcessHorizontalSpace = true;
	pageContent.setLayoutData( data );

	GridLayout layout = new GridLayout( );
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 3;
	pageContent.setLayout( layout );

	addComboBox( pageContent,
			DEFAULT_UNIT,
			PREF_DEFAULT_UNIT,
			supportNames,
			supportDisplayNames,
			0 );
	
	new Label( pageContent, SWT.NONE );
	
	this.addLabelledTextField( pageContent,
			DEFAULT_FISCAL_START,
			PREF_FISCAL_START,
			10,
			0,
			false );

	return pageContent;
}