Java Code Examples for org.eclipse.swt.SWT#TRANSPARENT

The following examples show how to use org.eclipse.swt.SWT#TRANSPARENT . 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: RecentPanel.java    From Rel with Apache License 2.0 6 votes vote down vote up
private Composite obtainContent() {
	Composite content = new Composite(this, SWT.TRANSPARENT);
	
	RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
	rowLayout.wrap = true;
	rowLayout.pack = false;
	content.setLayout(rowLayout);
	
	if (DBrowser.hasLocalRel()) {
		createItem(content, "Create a new database", "large_database_create", null, e -> Core.newDatabase());
		createItem(content, "Create a new database\nfrom a backup", "large_database_restore", null, e -> Core.restoreDatabase());
		createItem(content, "Open a local database", "large_database_load", null, e -> Core.openLocalDatabase());
	}
	createItem(content, "Open a remote database", "large_database_load", null, e -> Core.openRemoteDatabase());
	for (String dbURL: Core.getRecentlyUsedDatabaseList()) {
		if (dbURL.startsWith("db:") && !DBrowser.hasLocalRel())
			continue;
		createItem(content,
				"Open " + dbURL, 
				"large_database_load",
				dbURL,
				e -> Core.openDatabase(dbURL));
	}
	
	return content;
}
 
Example 2
Source File: SuffixText.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates, configures and returns the suffix text control.
 */
private StyledText createSuffixText() {
	StyledText styledText = new StyledText(this, SWT.TRANSPARENT);
	styledText.setText("");
	styledText.setForeground(INACTIVE_COLOR);
	styledText.setBackground(getDisplay().getSystemColor(SWT.COLOR_TRANSPARENT));
	styledText.setEditable(false);
	styledText.setEnabled(false);
	styledText.setLeftMargin(0);

	return styledText;
}
 
Example 3
Source File: RecentPanel.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void createItem(Composite parent, String prompt, String iconName, String dbURL, Listener action) {
	boolean enabled = true;
	if (dbURL != null)
		enabled = Core.databaseMayExist(dbURL);

	Composite panel = new Composite(parent, SWT.TRANSPARENT);		
	panel.setLayout(new RowLayout(SWT.VERTICAL));
	
	Composite topPanel = new Composite(panel, SWT.TRANSPARENT);		
	topPanel.setLayout(new RowLayout(SWT.HORIZONTAL));
	
	Button icon = new Button(topPanel, SWT.FLAT);
	icon.setImage(IconLoader.loadIcon(iconName));
	icon.addListener(SWT.Selection, action);
	icon.setEnabled(enabled);
	
	if (dbURL != null) {
		Button removeButton = new Button(topPanel, SWT.NONE);
		removeButton.setText("X");
		removeButton.setToolTipText("Remove this entry from this list of recently-used databases." + ((enabled) ? " The database will not be deleted." : ""));
		removeButton.addListener(SWT.Selection, e -> {
			Core.removeFromRecentlyUsedDatabaseList(dbURL);
			((DbTabContentRecent)getParent()).redisplayed();
		});
	}

	Label urlButton = new Label(panel, SWT.NONE);
	urlButton.setText(prompt);
	urlButton.addListener(SWT.MouseUp, action);
	if (!enabled)
		urlButton.setForeground(getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
}
 
Example 4
Source File: RecentPanel.java    From Rel with Apache License 2.0 5 votes vote down vote up
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public RecentPanel(DbTabContentRecent parent, DbTab dbTab) {
	super(parent, SWT.V_SCROLL | SWT.TRANSPARENT);

	Composite content = obtainContent();

	setContent(content);
	setExpandVertical(true);
	setExpandHorizontal(true);

	addListener(SWT.Resize, e -> {
		Rectangle clientArea = getClientArea();
		setMinSize(content.computeSize(clientArea.width, SWT.DEFAULT));
	});
}
 
Example 5
Source File: DecisionTableWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param parent
 * @param image
 * @return
 */
public Canvas createImageButton(final Composite parent, final Image image) {
    final Canvas deleteButton = new Canvas(parent, SWT.TRANSPARENT);
    deleteButton.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(final PaintEvent e) {
            e.gc.drawImage(image, 0, 0, 16, 16, 0, 0, DELETE_SIZE, DELETE_SIZE);
        }
    });
    return deleteButton;
}
 
Example 6
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
private Button createItem(final Composite t, final String string, final Image image) {
	final Button i = new Button(t, SWT.FLAT | SWT.TRANSPARENT | SWT.PUSH);
	i.setToolTipText(string);
	i.setImage(image);
	return i;
}
 
Example 7
Source File: SearchControl.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
public SearchControl(Composite parent, int style) {
	super(parent, SWT.TRANSPARENT);
	this.backgroundColor = getDisplay().getSystemColor(SWT.COLOR_WHITE);
	initialize(style);
	addPaintListener(this);
}
 
Example 8
Source File: DeleteConfirmDialog.java    From Rel with Apache License 2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new FormLayout());

	Label image = new Label(container, SWT.TRANSPARENT);
	FormData fd_composite = new FormData();
	fd_composite.top = new FormAttachment(0, 10);
	fd_composite.left = new FormAttachment(0, 10);
	image.setLayoutData(fd_composite);
	Image question = IconLoader.loadIcon("question");
	image.setImage(question);
	image.setSize(question.getBounds().width, question.getBounds().height);

	Label lblPrompt = new Label(container, SWT.NONE);
	FormData fd_lblPrompt = new FormData();
	fd_lblPrompt.top = new FormAttachment(0, 10);
	fd_lblPrompt.left = new FormAttachment(image, 10);
	fd_lblPrompt.right = new FormAttachment(100, -10);
	lblPrompt.setLayoutData(fd_lblPrompt);
	if (count > 0)
		lblPrompt.setText("Press OK to delete " + count + " " + whatToDelete + ((count > 1) ? "s" : "")
				+ ".  Press Cancel to do nothing.");
	else
		lblPrompt.setText("No " + whatToDelete
				+ "s selected.  Press Ok to optionally confirm the checkbox below, or Cancel to do nothing.");

	Button btnNoAsk = new Button(container, SWT.CHECK);
	FormData fd_btnNoAsk = new FormData();
	fd_btnNoAsk.top = new FormAttachment(lblPrompt, 10);
	fd_btnNoAsk.bottom = new FormAttachment(100, -10);
	fd_btnNoAsk.right = new FormAttachment(100, -10);
	btnNoAsk.setLayoutData(fd_btnNoAsk);
	btnNoAsk.setSelection(noAskAgain);
	btnNoAsk.setText("Don't ask me again.");
	btnNoAsk.addListener(SWT.Selection, e -> {
		noAskAgain = btnNoAsk.getSelection();
	});

	container.pack();

	return container;
}
 
Example 9
Source File: BonitaPreferenceDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createDeploymentCategoryLine(final Composite menuComposite) {
    final Composite deploymentRow = createRow(menuComposite, null, Messages.BonitaPreferenceDialog_Deployment, 3);

    final ToolItem tltmUserxpSettings = createTool(deploymentRow, null,
            Pics.getImage(PicsConstants.preferenceLogin), Pics.getImage(PicsConstants.preferenceLogindisabled),
            SERVER_SETTINGS_PAGE_ID);
    final ToolItem tltmDBConnectors = createTool(deploymentRow, null,
            Pics.getImage(PicsConstants.preferenceAdvanced),
            Pics.getImage(PicsConstants.preferenceAdvanceddisabled), DB_CONNECTORS_PAGE_ID);

    if (PreferenceUtil.findNodeMatching(REMOTE_ENGINE_PAGE_ID) != null) {
        final ToolItem tltmRemoteEngine = createTool(deploymentRow, null,
                Pics.getImage(PicsConstants.preferenceRemote),
                Pics.getImage(PicsConstants.preferenceRemotedisabled), REMOTE_ENGINE_PAGE_ID);
        itemPerPreferenceNode.put(REMOTE_ENGINE_PAGE_ID, tltmRemoteEngine);
    } else {
        final ToolBar emptyToolbar = new ToolBar(deploymentRow, SWT.FLAT | SWT.TRANSPARENT);
        final GridData gd_toolBar_8 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
        gd_toolBar_8.verticalIndent = 5;
        emptyToolbar.setLayoutData(gd_toolBar_8);
        emptyToolbar.setVisible(false);
    }

    final Label lblUserxpSettings = createItemLabel(deploymentRow, null,
            Messages.BonitaPreferenceDialog_UserXP_Settings);

    itemPerPreferenceNode.put(SERVER_SETTINGS_PAGE_ID, tltmUserxpSettings);
    labelPerPreferenceNode.put(SERVER_SETTINGS_PAGE_ID, lblUserxpSettings);

    final Label lblDbConnectors = createItemLabel(deploymentRow, null,
            Messages.BonitaPreferenceDialog_DBConnectors);
    itemPerPreferenceNode.put(DB_CONNECTORS_PAGE_ID, tltmDBConnectors);
    labelPerPreferenceNode.put(DB_CONNECTORS_PAGE_ID, lblDbConnectors);

    if (PreferenceUtil.findNodeMatching(REMOTE_ENGINE_PAGE_ID) != null) {
        final Label lblRemoteEngine = createItemLabel(deploymentRow, null,
                Messages.BonitaPreferenceDialog_Remote_Engine);
        labelPerPreferenceNode.put(REMOTE_ENGINE_PAGE_ID, lblRemoteEngine);
    } else {
        new Label(deploymentRow, SWT.WRAP | SWT.CENTER);
    }
}