Java Code Examples for org.eclipse.swt.layout.FillLayout

The following are top voted examples for showing how to use org.eclipse.swt.layout.FillLayout. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: neoscada   File: ChartConfiguratorView.java   View source code 8 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    this.container = parent;
    createEditingDomain ();

    parent.setLayout ( new FillLayout () );
    this.viewer = new TreeViewer ( parent );
    this.viewer.setAutoExpandLevel ( 2 );

    this.viewer.setContentProvider ( new AdapterFactoryContentProvider ( this.factory ) );
    this.viewer.setLabelProvider ( new AdapterFactoryLabelProvider ( this.factory ) );

    createContextMenuFor ( this.viewer );

    new AdapterFactoryTreeEditor ( this.viewer.getTree (), this.factory );
    getViewSite ().setSelectionProvider ( this.viewer );

    attachSelectionService ();

    getViewSite ().getActionBars ().getMenuManager ().add ( new Separator ( "additions" ) );

    this.actionBarContributor.init ( getViewSite ().getActionBars () );
    this.actionBarContributor.setViewPart ( this );
}
 
Example 2
Project: parabuild-ci   File: SWTPieChartDemo1.java   View source code 7 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main( String[] args ) 
{
    JFreeChart chart = createChart(createDataset());
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 400);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    //frame.setDisplayToolTips(false);
    frame.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example 3
Project: openaudible   File: AudibleBrowser.java   View source code 7 votes vote down vote up
public AudibleBrowser(Composite parent, String url) {
    this.parent = parent;
    try {
        browser = new Browser(parent, SWT.BORDER);
        browser.addTitleListener(event -> getShell().setText(event.title));
    } catch (SWTError e) {
        error = e;
        /* Browser widget could not be instantiated */
        parent.setLayout(new FillLayout());
        Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
        label.setText(getResourceString("BrowserNotCreated"));
        // label.requestLayout();
        return;
    }
    initResources();
    if (url.length() > 0)
        browser.setUrl(getResourceString(url));

    if (true)
        show(false, null, null, true, true, true, true);
    else
        show(false, null, null, false, false, false, false);

}
 
Example 4
Project: n4js   File: DashboardComposite.java   View source code 6 votes vote down vote up
/** {@code key} defines which data source will be used for display. */
public DashboardComposite(String key, Composite parent, int style) {
	super(parent, style);
	this.key = key;

	this.setLayout(new FillLayout());

	final SashForm sf = new SashForm(this, SWT.HORIZONTAL);
	sf.setLayout(new FillLayout());

	this.canvas = new VisualisationCanvas(sf, SWT.NONE);

	this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
	text.setText("");

	createVisualisationControls(sf);
	sf.setWeights(new int[] { 45, 45, 10 });
}
 
Example 5
Project: n4js   File: N4MFWizardTestedProjectPage.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void createControl(Composite parent) {
	Composite listComposite = new Composite(parent, NONE);
	listComposite.setLayout(new FillLayout());

	ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI);
	projectListViewer.setContentProvider(ArrayContentProvider.getInstance());
	projectListViewer.setInput(getNonTestProjects());

	// Data binding
	DataBindingContext databindingContext = new DataBindingContext();
	parent.addDisposeListener(e -> databindingContext.dispose());

	databindingContext.bindList(ViewersObservables.observeMultiSelection(projectListViewer),
			PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME)
					.observe(projectInfo));

	setControl(listComposite);
}
 
Example 6
Project: neoscada   File: GeneratorView.java   View source code 6 votes vote down vote up
private void createTabFolder ( final Composite parent )
{
    this.tabFolder = new CTabFolder ( parent, SWT.TOP );
    this.tabFolder.setLayoutData ( new GridData ( GridData.FILL, GridData.FILL, true, true ) );

    for ( final GeneratorPageInformation page : this.pages )
    {
        final CTabItem tabItem = new CTabItem ( this.tabFolder, SWT.NONE );
        final Composite tabComposite = new Composite ( this.tabFolder, SWT.NONE );
        tabComposite.setLayout ( new FillLayout () );
        page.getGeneratorPage ().createPage ( tabComposite );
        tabItem.setText ( page.getLabel () );
        tabItem.setControl ( tabComposite );
        page.getGeneratorPage ().setTarget ( this );
    }

    this.tabFolder.setSelection ( 0 );
}
 
Example 7
Project: neoscada   File: AbstractChartView.java   View source code 6 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    parent.setLayout ( new FillLayout () );

    this.wrapper = new Composite ( parent, SWT.NONE );
    this.wrapper.setLayout ( GridLayoutFactory.slimStack () );

    this.shell = parent.getShell ();

    PlatformUI.getWorkbench ().getHelpSystem ().setHelp ( this.wrapper, "org.eclipse.scada.ui.chart.view.chartView" ); //$NON-NLS-1$

    fillMenu ( getViewSite ().getActionBars ().getMenuManager () );
    fillToolbar ( getViewSite ().getActionBars ().getToolBarManager () );

    createChartControl ( parent );
}
 
Example 8
Project: neoscada   File: FilterFreeFormComposite.java   View source code 6 votes vote down vote up
private void createComponents ()
{
    final FillLayout layout = new FillLayout ( SWT.VERTICAL );
    layout.marginHeight = 12;
    layout.marginWidth = 12;
    setLayout ( layout );

    final Text filterTextField = new Text ( this, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL );
    filterTextField.setText ( this.filter );
    filterTextField.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            verifyFilter ( filterTextField.getText () );
        }
    } );
}
 
Example 9
Project: neoscada   File: TrendControlImage.java   View source code 6 votes vote down vote up
public TrendControlImage ( final Composite parent, final int style, final String connectionId, final String itemId, final String queryString )
{
    super ( parent, style );

    this.connectionId = connectionId;
    this.itemId = itemId;
    this.queryString = queryString;

    setLayout ( new FillLayout () );

    final Button button = new Button ( parent, SWT.PUSH | SWT.FLAT );
    button.setImage ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getImageRegistry ().get ( org.eclipse.scada.vi.details.swt.Activator.IMG_TREND ) );
    button.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            startHdView ();
        }
    } );
}
 
Example 10
Project: neoscada   File: DescriptorLabel.java   View source code 6 votes vote down vote up
public DescriptorLabel ( final Composite parent, final int style, final String text, final DataItemDescriptor descriptor )
{
    super ( parent, SWT.NONE );

    setLayout ( new FillLayout () );
    Label label = new Label ( this, style );

    if ( text != null )
    {
        label.setText ( text );
    }

    // TODO: make properties
    if ( SessionManager.getDefault ().hasRole ( "developer" ) ) //$NON-NLS-1$
    {
        label.setToolTipText ( String.format ( "%s", descriptor ) ); //$NON-NLS-1$
    }

}
 
Example 11
Project: neoscada   File: LabelComposite.java   View source code 6 votes vote down vote up
public LabelComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format )
{
    super ( parent, style, null, null );

    setLayout ( new FillLayout () );
    this.label = new Label ( this, SWT.NONE );

    this.format = format;
    if ( descriptor != null )
    {
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
    else
    {
        this.label.setText ( format );
    }

}
 
Example 12
Project: neoscada   File: DetailComponentImpl.java   View source code 6 votes vote down vote up
private void createFillLayout ( final Composite parent, final FillLayoutComponent component, final Map<String, String> properties )
{
    final VisibilityProvider provider = this.visibleFactory.createProvider ( component.getVisibility () );

    final ComponentVisibility visibility = new ComponentVisibility ( provider, new SubTrackingVisibleComponent () {

        @Override
        public void create ()
        {

            final Composite childParent = new Composite ( parent, SWT.NONE );
            childParent.setLayout ( new FillLayout ( SWT.VERTICAL ) );

            for ( final Component child : component.getChildren () )
            {
                final DetailComponentImpl comp = new DetailComponentImpl ( child, DetailComponentImpl.this.viewContext );
                comp.init ( DetailComponentImpl.this.visibleFactory, childParent, properties );
                trackSub ( comp );
            }
            trackControl ( childParent );
        }

    } );

    addComponent ( visibility );
}
 
Example 13
Project: neoscada   File: QueryDataView.java   View source code 6 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    addListener ();

    parent.setLayout ( new FillLayout () );
    this.table = new Table ( parent, SWT.FULL_SELECTION );
    this.table.setHeaderVisible ( true );

    this.indexCol = new TableColumn ( this.table, SWT.NONE );
    this.indexCol.setText ( Messages.QueryDataView_ColIndex );
    this.indexCol.setWidth ( 50 );

    this.qualityCol = new TableColumn ( this.table, SWT.NONE );
    this.qualityCol.setText ( Messages.QueryDataView_ColQuality );
    this.qualityCol.setWidth ( 75 );

    this.manualCol = new TableColumn ( this.table, SWT.NONE );
    this.manualCol.setText ( Messages.QueryDataView_ColManual );
    this.manualCol.setWidth ( 75 );

    this.invalidColor = JFaceColors.getErrorBackground ( getDisplay () );
}
 
Example 14
Project: neoscada   File: ShowDetailDialog.java   View source code 6 votes vote down vote up
protected void openWithWaitShell ( final Shell parentShell, final String detailViewId, final Map<String, String> parameters )
{

    final Shell waitShell = new Shell ( parentShell, SWT.PRIMARY_MODAL | SWT.BORDER );
    waitShell.setLayout ( new FillLayout () );
    final Label label = new Label ( waitShell, SWT.NONE );
    label.setText ( "Opening view…" );

    waitShell.pack ();
    waitShell.open ();

    // make sure the text is visible
    waitShell.getDisplay ().update ();

    try
    {
        open ( parentShell, detailViewId, parameters );
    }
    finally
    {
        // close the wait shell
        waitShell.close ();
    }

}
 
Example 15
Project: neoscada   File: ServersViewer.java   View source code 6 votes vote down vote up
public ServersViewer ( final Composite parent )
{
    parent.setLayout ( new FillLayout () );
    this.viewer = new TreeViewer ( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );

    this.contentProvider = new ObservableSetTreeContentProvider ( new ObservableFactoryImpl (), null );
    this.viewer.setContentProvider ( this.contentProvider );
    this.labelProvider = new ServerLabelProvider ( this.contentProvider.getKnownElements () );
    this.viewer.setLabelProvider ( this.labelProvider );

    this.viewer.setInput ( HivesPlugin.getDefault ().getServerManager () );
    this.viewer.getControl ().addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            handleDispose ();
        }
    } );

    ColumnViewerToolTipSupport.enableFor ( this.viewer );
}
 
Example 16
Project: convertigo-eclipse   File: ToggleButton.java   View source code 6 votes vote down vote up
public ToggleButton(Composite parent, int style) {
	super(parent, style);
	
	if (colorOn == null) {
		colorOn = getDisplay().getSystemColor(SWT.COLOR_GREEN);
		colorOff = getDisplay().getSystemColor(SWT.COLOR_RED);
	}
	
	FillLayout layout = new FillLayout();
	layout.marginHeight = layout.marginWidth =  2;
	setLayout(layout);
	button = new Button(this, SWT.TOGGLE);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			updateColor();
		}
	});
}
 
Example 17
Project: convertigo-eclipse   File: ConnectorEditorPart.java   View source code 6 votes vote down vote up
/**
 * This method initializes compositeXml
 * 
 */
private void createCompositeXml() {
	compositeXml = new Composite(sashForm, SWT.NONE);
	compositeXml.setLayout(new FillLayout());

	xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL);
	xmlView.setEditable(false);

	colorManager = new ColorManager();
	xmlView.configure(new XMLConfiguration(colorManager));

	Document document = new Document(
			"Click on the XML generation button to view the XML document generated by Convertigo.");
	IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] {
			XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT, });
	partitioner.connect(document);
	document.setDocumentPartitioner(partitioner);
	xmlView.setDocument(document);
}
 
Example 18
Project: convertigo-eclipse   File: SequenceEditorPart.java   View source code 6 votes vote down vote up
/**
 * This method initializes compositeXml	
 *
 */
private void createCompositeXml() {
	compositeXml = new Composite(sashForm, SWT.NONE);
	compositeXml.setLayout(new FillLayout());
	
	xmlView = new StructuredTextViewer(compositeXml, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL);
	xmlView.setEditable(false);

	colorManager = new ColorManager();
	xmlView.configure(new XMLConfiguration(colorManager));

	Document document = new Document("Click on the XML generation button to view the XML document generated by Convertigo.");
	IDocumentPartitioner partitioner =
		new FastPartitioner(
			new XMLPartitionScanner(),
			new String[] { 
				XMLPartitionScanner.XML_TAG,
				XMLPartitionScanner.XML_COMMENT,
			}
		);
	partitioner.connect(document);
	document.setDocumentPartitioner(partitioner);
	xmlView.setDocument(document);
}
 
Example 19
Project: AppleCommander   File: DiskWindow.java   View source code 6 votes vote down vote up
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
	shell = new Shell(parentShell, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout());
	shell.setImage(imageManager.get(ImageManager.ICON_DISK));
	setStandardWindowTitle();
	shell.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent event) {
				dispose(event);
			}
		});
		
	CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
	new DiskExplorerTab(tabFolder, disks, imageManager, this);
	diskMapTabs = new DiskMapTab[disks.length];
	for (int i=0; i<disks.length; i++) {
		if (disks[i].supportsDiskMap()) {
			diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
		}
	}
	diskInfoTab = new DiskInfoTab(tabFolder, disks);
	tabFolder.setSelection(tabFolder.getItems()[0]);
	
	
	shell.open();
}
 
Example 20
Project: gw4e.project   File: ModelSearchResultPage.java   View source code 6 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public void createControl(Composite parent) {
	fRootControl = new Composite(parent, SWT.NULL);
	fRootControl.setLayout(new FillLayout(SWT.HORIZONTAL));

	 
	viewer = new TreeViewer(fRootControl, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(new ViewContentProvider());
	viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ViewLabelProvider(createImageDescriptor())));
	viewer.addDoubleClickListener(new IDoubleClickListener () {

		@Override
		public void doubleClick(DoubleClickEvent evt) {
			TreeSelection sel = (TreeSelection) evt.getSelection();
			IFile file = (IFile) sel.getFirstElement();
			if (isModelFile(file)) {
				JDTManager.openEditor(file, "org.gw4e.eclipse.studio.editor.GW4EEditor", null);	
				return;
			}
			JDTManager.openEditor(file, null); 
		}
		
	});
	files = new ArrayList<IFile>();
}
 
Example 21
Project: applecommander   File: DiskWindow.java   View source code 6 votes vote down vote up
/**
 * Setup the Disk window and display (open) it.
 */
public void open() {
	shell = new Shell(parentShell, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout());
	shell.setImage(imageManager.get(ImageManager.ICON_DISK));
	setStandardWindowTitle();
	shell.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent event) {
				dispose(event);
			}
		});
		
	CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
	new DiskExplorerTab(tabFolder, disks, imageManager, this);
	diskMapTabs = new DiskMapTab[disks.length];
	for (int i=0; i<disks.length; i++) {
		if (disks[i].supportsDiskMap()) {
			diskMapTabs[i] = new DiskMapTab(tabFolder, disks[i]);
		}
	}
	diskInfoTab = new DiskInfoTab(tabFolder, disks);
	tabFolder.setSelection(tabFolder.getItems()[0]);
	
	
	shell.open();
}
 
Example 22
Project: tap17-muggl-javaee   File: OptionsWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parentShell The parent windows' Shell.
 * @param classLoader The system MugglClassLoader.
 */
private void createShell(Shell parentShell, MugglClassLoader classLoader) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Options");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));
	
	final Image small = new Image(shell.getDisplay(),
	        OptionsWindow.class.getResourceAsStream("/images/tray_small.png"));
	final Image large = new Image(shell.getDisplay(),
			OptionsWindow.class.getResourceAsStream("/images/tray_large.png"));
	this.shell.setImages(new Image[] { small, large });
	
	// No need to read it later, so it is not assigned to a variable.
	new OptionsComposite(this, this.shell, SWT.NONE, classLoader);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 23
Project: tap17-muggl-javaee   File: MethodParametersWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param parent The Composite which this Window is invoked by.
 * @param method The Method thats' parameters will be defined in this Window.
 */
private void createShell(FileSelectionComposite parent, Method method) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(
			Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR
			+ "Method Parameters and Variable Generators for " + method.getFullNameWithParameterTypesAndNames());
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	new MethodParametersComposite(parent, this, this.shell, this.display, SWT.NONE, method);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parent.getShell());
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 24
Project: tap17-muggl-javaee   File: ArrayEntriesWindow.java   View source code 6 votes vote down vote up
/**
 * Create the Shell, setting up any elements that are not set up by the main Composite.
 * @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
 * @param myDimension The dimension of a probably multidimensional array this Window represents.
 * @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
 */
private void createShell(ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
	this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
	this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Array Entries");
	this.shell.setLayout(new FillLayout(SWT.VERTICAL));

	// Initialize the composite.
	new ArrayEntriesComposite(this, this.shell, this.display, SWT.NONE, arrayModificationHandler, myDimension, dimensionsIndexes);

	// Compute the needed size.
	Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	point.x += 2;
	point.y += 2;
	int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, this.parent.getShell());
	this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
 
Example 25
Project: SWET   File: TipDayEx.java   View source code 6 votes vote down vote up
private void buildLeftColumn() {
	final Composite composite = new Composite(this.shell, SWT.NONE);
	final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
			true, 1, 1);
	composite.setLayoutData(gd);
	final FillLayout compositeLayout = new FillLayout();
	compositeLayout.marginWidth = 2;
	composite.setLayout(compositeLayout);
	final Label label = new Label(composite, SWT.NONE);
	if (this.image == null) {
		this.image = new Image(display, this.getClass().getClassLoader()
				.getResourceAsStream("images/document_wrench_color.png"));
		shell.addListener(SWT.Close, new Listener() {
			@Override
			public void handleEvent(Event event) {
				image.dispose();
			}
		});

	}
	label.setImage(this.image);
}
 
Example 26
Project: SWET   File: TipDayEx.java   View source code 6 votes vote down vote up
private void buildLeftColumn() {
	final Composite composite = new Composite(this.shell, SWT.NONE);
	final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, false,
			true, 1, 1);
	composite.setLayoutData(gd);
	final FillLayout compositeLayout = new FillLayout();
	compositeLayout.marginWidth = 2;
	composite.setLayout(compositeLayout);
	final Label label = new Label(composite, SWT.NONE);
	if (this.image == null) {
		this.image = new Image(display, this.getClass().getClassLoader()
				.getResourceAsStream("images/light1.png"));
		shell.addListener(SWT.Close, new Listener() {
			@Override
			public void handleEvent(Event event) {
				image.dispose();
			}
		});

	}
	label.setImage(this.image);
}
 
Example 27
Project: Hydrograph   File: FilterConditionsDialog.java   View source code 6 votes vote down vote up
private Text addTextBoxInTable(TableViewer tableViewer, TableItem tableItem, String textBoxName, 
		String valueTextPane, String editorName, int columnIndex, Listener listener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Text text = new Text(buttonPane, SWT.NONE);
	text.addListener(SWT.Modify, listener);
	text.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(textBoxName, text);
	tableItem.setData(valueTextPane, buttonPane);
	//text.addModifyListener(FilterHelper.INSTANCE.getTextModifyListener());
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	text.setData(editorName, editor);
	return text;
}
 
Example 28
Project: Hydrograph   File: FilterConditionsDialog.java   View source code 6 votes vote down vote up
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName, 
		String editorName, int columnIndex,	String[] relationalOperators, SelectionListener dropDownSelectionListener,
		ModifyListener modifyListener,FocusListener focusListener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final CCombo combo = new CCombo(buttonPane, SWT.NONE);
	combo.setItems(relationalOperators);
	combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(comboName, combo);
	tableItem.setData(comboPaneName, buttonPane);
	combo.addSelectionListener(dropDownSelectionListener);
	combo.addModifyListener(modifyListener);
	combo.addFocusListener(focusListener);
	new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	combo.setData(editorName, editor);
	return combo;
}
 
Example 29
Project: Hydrograph   File: FilterConditionsDialog.java   View source code 6 votes vote down vote up
private void addButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, 
		String buttonPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener,
		ImagePathConstant imagePath) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Button button = new Button(buttonPane, SWT.NONE);
	//button.setText(columnName);
	button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	tableItem.setData(columnName, button);
	tableItem.setData(buttonPaneName, buttonPane);
	button.addSelectionListener(buttonSelectionListener);
	button.setImage(imagePath.getImageFromRegistry());
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	button.setData(editorName, editor);
}
 
Example 30
Project: Hydrograph   File: FilterConditionsDialog.java   View source code 6 votes vote down vote up
private void addCheckButtonInTable(TableViewer tableViewer, TableItem tableItem, String columnName, 
		String groupPaneName, String editorName, int columnIndex, SelectionListener buttonSelectionListener) {
	final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
	buttonPane.setLayout(new FillLayout());
	final Button button = new Button(buttonPane, SWT.CHECK);
	button.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
	if(null != buttonSelectionListener){
		button.addSelectionListener(buttonSelectionListener);
	}
	tableItem.setData(columnName, button);
	tableItem.setData(groupPaneName, buttonPane);
	
	final TableEditor editor = new TableEditor(tableViewer.getTable());
	editor.grabHorizontal = true;
	editor.grabVertical = true;
	editor.setEditor(buttonPane, tableItem, columnIndex);
	editor.layout();
	button.setData(editorName, editor);
}
 
Example 31
Project: parabuild-ci   File: SWTBarChartDemo1.java   View source code 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main( String[] args ) 
{
    JFreeChart chart = createChart(createDataset());
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart,
            true);
    frame.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example 32
Project: parabuild-ci   File: SWTMultipleAxisDemo1.java   View source code 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main( String[] args ) 
{
    final JFreeChart chart = createChart();
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    frame.setDisplayToolTips(false);
    frame.setHorizontalAxisTrace(true);
    frame.setVerticalAxisTrace(true);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example 33
Project: parabuild-ci   File: SWTTimeSeriesDemo.java   View source code 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(String[] args) {
    final JFreeChart chart = createChart(createDataset());
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Time series demo for jfreechart running with SWT");
    ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    frame.setDisplayToolTips(true);
    frame.setHorizontalAxisTrace(false);
    frame.setVerticalAxisTrace(false);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example 34
Project: Tarski   File: ContainerSelectionPage.java   View source code 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new SigTypeLabelProvider());
  treeViewer.setContentProvider(new SigTypeContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        selection = event.getSelection();
        ContainerSelectionPage.this.setPageComplete(true);
      } else {
        ContainerSelectionPage.this.setPageComplete(false);
      }
    }
  });
}
 
Example 35
Project: Tarski   File: UntypedMarkerPage.java   View source code 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NONE);
  this.setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER);
  treeViewer.setUseHashlookup(true);
  treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
  treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
  treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
  treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});

  treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

    @Override
    public void selectionChanged(SelectionChangedEvent event) {
      if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
        UntypedMarkerPage.this.selection = event.getSelection();
        UntypedMarkerPage.this.setPageComplete(true);
      } else {
        UntypedMarkerPage.this.setPageComplete(false);
      }
    }
  });
}
 
Example 36
Project: BiglyBT   File: PieceDistributionView.java   View source code 6 votes vote down vote up
private void createPieceDistPanel() {
	comp.setLayout(new FillLayout());
	//pieceDistComposite = new Composite(parent, SWT.NONE);
	pieceDistCanvas = new Canvas(comp,SWT.NO_BACKGROUND);
	pieceDistCanvas.addListener(SWT.Paint, new Listener() {
		@Override
		public void handleEvent(Event event) {
			if ( pem==null || pem.isDestroyed()){
				event.gc.fillRectangle(event.x, event.y, event.width, event.height);
			}else{
				if (imgToPaint != null && !imgToPaint.isDisposed()) {
					event.gc.drawImage(imgToPaint, 0, 0);
				}
			}
		}
	});
}
 
Example 37
Project: BiglyBT   File: DHTOpsView.java   View source code 6 votes vote down vote up
public void initialize(Composite composite) {
	if ( autoDHT ){
		CoreFactory.addCoreRunningListener(new CoreRunningListener() {

			@Override
			public void coreRunning(Core core) {
				DHTOpsView.this.core = core;
				init(core);
			}
		});
	}

	panel = new Composite(composite,SWT.NULL);
	panel.setLayout(new FillLayout());
	drawPanel = new DHTOpsPanel(panel);
	drawPanel.setAutoAlpha(autoAlpha);
}
 
Example 38
Project: BiglyBT   File: ImageRepository.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout(SWT.VERTICAL));

	final Label label = new Label(shell, SWT.BORDER);

	final Text text = new Text(shell, SWT.BORDER);
	text.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			Image pathIcon = getPathIcon(text.getText(), false, false);
			label.setImage(pathIcon);
		}
	});

	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 39
Project: BiglyBT   File: SWTBGImagePainter.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
	Display display = Display.getDefault();
	Shell shell = new Shell(display, SWT.DIALOG_TRIM);
	shell.setLayout(new FillLayout());

	Composite c = new Composite(shell, SWT.BORDER);
	c.setLayout(new FillLayout());
	c.addPaintListener(new PaintListener() {
		@Override
		public void paintControl(PaintEvent e) {
			e.gc.drawLine(0, 0, 100, 50);
		}
	});

	Label lbl = new Label(c, SWT.NONE);
	lbl.setText("text");

	shell.open();

	while (!shell.isDisposed()) {
		if (display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 40
Project: JTouchBar   File: JTouchBarSWTTest.java   View source code 6 votes vote down vote up
@Test
public void test() {
	JTouchBar jTouchBar = JTouchBarTestUtils.constructTouchBar();
	assertNotNull(jTouchBar);
	
	Display display = Display.getCurrent();

       Shell shell = new Shell(display);
       shell.setLayout(new FillLayout());

       shell.open();
       
       jTouchBar.show( shell );
       
       while (!shell.isDisposed()) {
           if (!display.readAndDispatch()) {
               display.sleep();
               break;
           }
       }
       
       display.dispose();
}