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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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: DiskInfoTab.java   Source Code and License 6 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 20
Project: AppleCommander   File: DiskWindow.java   Source Code and License 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 21
Project: gw4e.project   File: ModelSearchResultPage.java   Source Code and License 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 22
Project: applecommander   File: DiskWindow.java   Source Code and License 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 23
Project: tap17-muggl-javaee   File: OptionsWindow.java   Source Code and License 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 24
Project: tap17-muggl-javaee   File: MethodParametersWindow.java   Source Code and License 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 25
Project: tap17-muggl-javaee   File: ArrayEntriesWindow.java   Source Code and License 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 26
Project: SWET   File: TipDayEx.java   Source Code and License 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 27
Project: SWET   File: TipDayEx.java   Source Code and License 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 28
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 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 29
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 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 30
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 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 31
Project: Hydrograph   File: FilterConditionsDialog.java   Source Code and License 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 32
Project: parabuild-ci   File: SWTBarChartDemo1.java   Source Code and License 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 33
Project: parabuild-ci   File: SWTMultipleAxisDemo1.java   Source Code and License 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 34
Project: parabuild-ci   File: SWTTimeSeriesDemo.java   Source Code and License 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 35
Project: Tarski   File: ContainerSelectionPage.java   Source Code and License 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 36
Project: Tarski   File: UntypedMarkerPage.java   Source Code and License 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 37
Project: BiglyBT   File: PieceDistributionView.java   Source Code and License 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 38
Project: BiglyBT   File: DHTOpsView.java   Source Code and License 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 39
Project: BiglyBT   File: ImageRepository.java   Source Code and License 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 40
Project: BiglyBT   File: SWTBGImagePainter.java   Source Code and License 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 41
Project: JTouchBar   File: JTouchBarSWTTest.java   Source Code and License 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();
}
 
Example 42
Project: n4js   File: SpecExportCodeSummaryPage.java   Source Code and License 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(new FillLayout());
	text = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

	setControl(composite);
}
 
Example 43
Project: neoscada   File: PageManager.java   Source Code and License 5 votes vote down vote up
private void activateNode ( final TreeNode node )
{
    final PageProvider provider = node.getProvider ();

    this.currentNode = node;
    this.currentPage = provider.createPage ();

    final Composite wrapper = new Composite ( this.mainArea, SWT.NONE );
    wrapper.setLayout ( new FillLayout () );

    this.currentPage.createContent ( wrapper );
    this.mainArea.layout ();

    this.pageName.setValue ( provider.getName () );
}
 
Example 44
Project: neoscada   File: MainEntryPoint.java   Source Code and License 5 votes vote down vote up
private Composite createMenu ( final Composite parent )
{
    final Composite menu = new Composite ( parent, SWT.NONE );

    menu.setLayout ( new FillLayout () );

    this.viewer = new TreeViewer ( menu, SWT.FULL_SELECTION );

    this.treeContentProvider = new ObservableListTreeContentProvider ( new FactoryImpl (), null );
    this.viewer.setContentProvider ( this.treeContentProvider );

    this.viewer.setLabelProvider ( new TreeNodeLabelProvider ( this.viewer,
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_NAME ),
            BeansObservables.observeMap ( this.treeContentProvider.getRealizedElements (), TreeNode.PROP_PROVIDER_SET )
            ) );

    this.viewer.setInput ( this.manager.getRootNode () );

    this.viewer.addSelectionChangedListener ( new ISelectionChangedListener () {

        @Override
        public void selectionChanged ( final SelectionChangedEvent event )
        {
            handleSelectionChanged ( event );
        }
    } );

    this.viewer.setAutoExpandLevel ( 2 );

    return menu;
}
 
Example 45
Project: neoscada   File: BooleanGeneratorPage.java   Source Code and License 5 votes vote down vote up
@Override
public void createPage ( final Composite parent )
{
    this.parent = parent;
    parent.setLayout ( new FillLayout ( SWT.VERTICAL ) );
    createTimedGroup ( parent );
    update ();
}
 
Example 46
Project: openaudible   File: SuperTable.java   Source Code and License 5 votes vote down vote up
@Override
public void handleEvent(Event event) {
    switch (event.type) {
        case SWT.Dispose:
        case SWT.KeyDown:
        case SWT.MouseMove: {
            if (tip == null)
                break;
            tip.dispose();
            tip = null;
            label = null;
            break;
        }
        case SWT.MouseHover: {
            TableItem item = table.getItem(new Point(event.x, event.y));
            if (item != null) {
                if (tip != null && !tip.isDisposed())
                    tip.dispose();
                Shell shell = table.getShell();
                Display display = table.getDisplay();
                tip = new Shell(shell, SWT.ON_TOP | SWT.TOOL);
                tip.setLayout(new FillLayout());
                label = new Label(tip, SWT.NONE);
                label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
                label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
                label.setData("_TABLEITEM", item);
                label.setText("tooltip " + item.getText());
                label.addListener(SWT.MouseExit, labelListener);
                label.addListener(SWT.MouseDown, labelListener);
                Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                Rectangle rect = item.getBounds(0);
                Point pt = table.toDisplay(rect.x, rect.y);
                tip.setBounds(pt.x, pt.y, size.x, size.y);
                tip.setVisible(true);
            }
        }
        break;
    }
}
 
Example 47
Project: neoscada   File: MonitorsViewTable.java   Source Code and License 5 votes vote down vote up
public MonitorsViewTable ( final Composite parent, final IViewSite viewSite, final int style, final WritableSet monitors, final List<ColumnProperties> columnSettings )
{
    super ( parent, style );

    this.monitors = monitors;

    final FillLayout layout = new FillLayout ();
    setLayout ( layout );

    this.tableViewer = new TableViewer ( this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI );
    this.tableRef.set ( this.tableViewer );
    createColumns ( this.tableViewer );
    applyColumSettings ( columnSettings );
    this.tableViewer.getTable ().setHeaderVisible ( true );
    this.tableViewer.getTable ().setLinesVisible ( true );
    this.tableViewer.setUseHashlookup ( true );
    this.tableViewer.setSorter ( new Sorter ( Columns.LAST_FAIL_TIMESTAMP, SWT.DOWN ) );
    this.tableViewer.getTable ().setSortDirection ( SWT.DOWN );

    hookContextMenu ( this.tableViewer.getControl (), this.tableViewer, viewSite );

    viewSite.setSelectionProvider ( this.tableViewer );

    final ObservableSetContentProvider contentProvider = new ObservableSetContentProvider ();
    this.tableViewer.setContentProvider ( contentProvider );
    this.tableViewer.setLabelProvider ( new MonitorTableLabelProvider ( Properties.observeEach ( contentProvider.getKnownElements (), BeanProperties.values ( new String[] { "id", "monitor" } ) ), Settings.getTimeZone () ) ); //$NON-NLS-1$ //$NON-NLS-2$
    this.tableViewer.setInput ( this.monitors );

    contentProvider.getRealizedElements ().addSetChangeListener ( new ISetChangeListener () {
        @Override
        public void handleSetChange ( final SetChangeEvent event )
        {
            if ( !MonitorsViewTable.this.scrollLock )
            {
                MonitorsViewTable.this.tableViewer.getTable ().setTopIndex ( 0 );
            }
        }
    } );
}
 
Example 48
Project: neoscada   File: DataItemDetailsDialog.java   Source Code and License 5 votes vote down vote up
@Override
protected Control createDialogArea ( final Composite parent )
{
    final Composite composite = (Composite)super.createDialogArea ( parent );
    getShell ().setMinimumSize ( 100, 360 );
    composite.setLayout ( new FillLayout () );
    this.view = new DetailsViewComposite ( composite, SWT.NONE );
    this.view.setDataItem ( this.item );

    return composite;
}
 
Example 49
Project: neoscada   File: ChartView.java   Source Code and License 5 votes vote down vote up
@Override
protected void activateView ()
{
    if ( this.chart != null )
    {
        return;
    }

    this.wrapper = new SashForm ( this.viewHolder, SWT.HORIZONTAL );
    this.wrapper.setLayout ( new FillLayout ( SWT.HORIZONTAL ) );

    final Composite subWrapper = new Composite ( this.wrapper, SWT.NONE );
    subWrapper.setLayout ( GridLayoutFactory.slimStack () );
    final Composite extensionSpace = new Composite ( subWrapper, SWT.NONE );
    extensionSpace.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
    extensionSpace.setLayout ( new RowLayout ( SWT.HORIZONTAL ) );

    this.chartArea = new ChartArea ( subWrapper, SWT.NONE );
    this.chartArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );

    this.configuration = ChartHelper.loadConfiguraton ( this.descriptor.getUri ().toString () );
    this.chart = new ChartViewer ( this.chartArea.getDisplay (), this.chartArea.getChartRenderer (), this.configuration, new CompositeExtensionSpace ( extensionSpace ), new ResetHandler () {

        @Override
        public void reset ()
        {
            reload ();
        }
    } );

    if ( this.showSelector )
    {
        this.selector = new ChartInputSelector ( this.wrapper, this.chart, true );
        this.wrapper.setWeights ( new int[] { 85, 15 } );
    }

    this.viewManagerContext.setSelectionProvider ( this.chart );
    this.chart.setFocus ();
}
 
Example 50
Project: neoscada   File: BlockControlImage.java   Source Code and License 5 votes vote down vote up
public BlockControlImage ( final ControlImage controlImage, final int style, final RegistrationManager registrationManager )
{
    super ( controlImage.getClientSpace (), style );

    this.controlImage = controlImage;

    this.registrationManager = registrationManager;

    setLayout ( new FillLayout () );

    this.icon = new Label ( this, SWT.NONE );
    this.icon.setImage ( getEmptyImage () );
    this.icon.addMouseListener ( new MouseAdapter () {
        @Override
        public void mouseUp ( final MouseEvent e )
        {
            toggleBlock ();
        }
    } );

    this.registrationManager.addListener ( this );

    final LocalResourceManager resources = new LocalResourceManager ( JFaceResources.getResources (), this.icon );

    this.boldFont = resources.createFont ( JFaceResources.getDefaultFontDescriptor ().withStyle ( SWT.BOLD ) );
    this.boldStyler = new Styler () {

        @Override
        public void applyStyles ( final TextStyle textStyle )
        {
            textStyle.font = BlockControlImage.this.boldFont;
        }
    };
}
 
Example 51
Project: neoscada   File: NativeTabProvider.java   Source Code and License 5 votes vote down vote up
@Override
public Folder createFolder ( final int i, final String label )
{
    final Composite wrapper = new Composite ( this.folder, SWT.NONE );
    wrapper.setLayout ( new FillLayout () );
    return new FolderImplementation ( this.folder, wrapper, i, label, this.mgr );
}
 
Example 52
Project: neoscada   File: EclipseTabProvider.java   Source Code and License 5 votes vote down vote up
@Override
public Folder createFolder ( final int index, final String label )
{
    final Composite wrapper = new Composite ( this.folder, SWT.NONE );
    wrapper.setLayout ( new FillLayout () );
    return new FolderImplementation ( this.folder, wrapper, index, label, this.mgr );
}
 
Example 53
Project: neoscada   File: DetailComponentImpl.java   Source Code and License 5 votes vote down vote up
private void createGroupGridEntry ( final Map<String, String> properties, final Composite childParent, final GroupGridEntry groupEntry )
{
    final VisibilityProvider provider = this.visibleFactory.createProvider ( groupEntry.getVisibility () );

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

        @Override
        public void create ()
        {
            final Group groupWidget = new Group ( childParent, SWT.NONE );

            groupWidget.setLayout ( new GridLayout ( 1, false ) );
            groupWidget.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );

            final String label = groupEntry.getLabel ();
            if ( label != null )
            {
                groupWidget.setText ( label );
            }

            for ( final Component child : groupEntry.getComponents () )
            {
                final DetailComponentImpl comp = new DetailComponentImpl ( child, DetailComponentImpl.this.viewContext );

                final Composite wrapper = new Composite ( groupWidget, SWT.NONE );
                wrapper.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
                wrapper.setLayout ( new FillLayout () );

                comp.init ( DetailComponentImpl.this.visibleFactory, wrapper, properties );

                trackSub ( comp );
            }

            trackControl ( groupWidget );
        }
    } );

    addComponent ( visibility );
}
 
Example 54
Project: neoscada   File: DetailComponentImpl.java   Source Code and License 5 votes vote down vote up
private void createSimpleGrid ( final Composite parent, final SimpleGridComponent 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 GridLayout ( component.getCols (), component.isEqually () ) );

            for ( final Component child : component.getChildren () )
            {
                final DetailComponentImpl comp = new DetailComponentImpl ( child, DetailComponentImpl.this.viewContext );
                trackSub ( comp );

                final Composite wrapper = new Composite ( childParent, SWT.NONE );
                wrapper.setLayout ( new FillLayout () );
                wrapper.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
                comp.init ( DetailComponentImpl.this.visibleFactory, wrapper, properties );
            }

            trackControl ( childParent );
        }
    } );

    addComponent ( visibility );
}
 
Example 55
Project: neoscada   File: QueryControlView.java   Source Code and License 5 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    parent.setLayout ( new FillLayout ( SWT.VERTICAL ) );
    createControls ( parent );

    // disable all
    for ( final Control control : this.controls )
    {
        control.setEnabled ( false );
    }

    addListener ();
}
 
Example 56
Project: neoscada   File: PreviewEditorImpl.java   Source Code and License 5 votes vote down vote up
@Override
public void createPartControl ( final Composite parent )
{
    final Composite wrapper = new Composite ( parent, SWT.NONE );
    final GridLayout layout = new GridLayout ( 1, false );
    layout.marginHeight = layout.marginWidth = 0;
    wrapper.setLayout ( layout );

    this.symbolArea = new Composite ( wrapper, SWT.NONE );
    this.symbolArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
    this.symbolArea.setLayout ( new FillLayout () );

    updateSymbol ();
}
 
Example 57
Project: convertigo-eclipse   File: NamedSourceSelectorEditorComposite.java   Source Code and License 5 votes vote down vote up
private void initialize() {
	setLayout(new FillLayout());
	viewer = new TreeViewer(this);
	viewer.setContentProvider(this);
	viewer.setLabelProvider(this);
	viewer.setInput(getInitalInput());
	viewer.expandAll();
	viewer.addSelectionChangedListener(this);
}
 
Example 58
Project: convertigo-eclipse   File: ScSourceEditorComposite.java   Source Code and License 5 votes vote down vote up
private void initialize() {
	setLayout(new FillLayout());
	screenClasses = new TreeViewer(this);
	screenClasses.setContentProvider(this);
	screenClasses.setLabelProvider(this);
	screenClasses.setInput(getInitalInput());
	screenClasses.expandAll();
	screenClasses.addSelectionChangedListener(this);

	screenClasses.collapseAll();
}
 
Example 59
Project: convertigo-eclipse   File: SWTX.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
    // create a shell...
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("KTable examples");

    // put a tab folder in it...
    TabFolder tabFolder = new TabFolder(shell, SWT.NONE);

    // Item 1: a Text Table
    TabItem item1 = new TabItem(tabFolder, SWT.NONE);
    item1.setText("Text Table");
    Composite comp1 = new Composite(tabFolder, SWT.NONE);
    item1.setControl(comp1);
    comp1.setLayout(new FillLayout());

    // put a table in tabItem1...
    KTable table = new KTable(comp1, SWT.V_SCROLL | SWT.H_SCROLL);
    table.setRowSelectionMode(true);
    //table.setMultiSelectionMode(true);
    table.setModel(new KTableModelExample());

    // display the shell...
    shell.setSize(600, 600);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
}
 
Example 60
Project: convertigo-eclipse   File: KTable.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
  // create a shell...
  Display display = new Display();
  Shell shell = new Shell(display);
  shell.setLayout(new FillLayout());
  shell.setText("KTable examples");

  // put a tab folder in it...
  TabFolder tabFolder = new TabFolder(shell, SWT.NONE);

  // Item 1: a Text Table
  TabItem item1 = new TabItem(tabFolder, SWT.NONE);
  item1.setText("Text Table");
  Composite comp1 = new Composite(tabFolder, SWT.NONE);
  item1.setControl(comp1);
  comp1.setLayout(new FillLayout());

  // put a table in tabItem1...
  KTable table = new KTable(comp1, SWT.V_SCROLL | SWT.H_SCROLL);
  table.setRowSelectionMode(true);
  //table.setMultiSelectionMode(true);
  table.setModel(new KTableModelExample());

  // display the shell...
  shell.setSize(600, 600);
  shell.open();
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
      display.sleep();
  }
  display.dispose();
}