use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class PostgreConnectionPage method createControl.
@Override
public void createControl(Composite composite) {
//Composite group = new Composite(composite, SWT.NONE);
//group.setLayout(new GridLayout(1, true));
ModifyListener textListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (activated) {
saveSettings(site.getActiveDataSource());
site.updateButtons();
}
}
};
Composite addrGroup = UIUtils.createPlaceholder(composite, 4);
GridLayout gl = new GridLayout(4, false);
addrGroup.setLayout(gl);
GridData gd = new GridData(GridData.FILL_BOTH);
addrGroup.setLayoutData(gd);
Label hostLabel = UIUtils.createControlLabel(addrGroup, "Host");
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
hostText.addModifyListener(textListener);
Label portLabel = UIUtils.createControlLabel(addrGroup, "Port");
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
portLabel.setLayoutData(gd);
portText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
gd.widthHint = 40;
portText.setLayoutData(gd);
portText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
portText.addModifyListener(textListener);
Label dbLabel = UIUtils.createControlLabel(addrGroup, "Database");
dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
dbText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
dbText.setLayoutData(gd);
dbText.addModifyListener(textListener);
Label usernameLabel = UIUtils.createControlLabel(addrGroup, "User");
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
usernameText.setLayoutData(gd);
usernameText.addModifyListener(textListener);
Label passwordLabel = UIUtils.createControlLabel(addrGroup, "Password");
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(addrGroup, SWT.BORDER | SWT.PASSWORD);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
passwordText.setLayoutData(gd);
passwordText.addModifyListener(textListener);
{
Composite buttonsGroup = new Composite(addrGroup, SWT.NONE);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
buttonsGroup.setLayoutData(gd);
buttonsGroup.setLayout(new GridLayout(2, false));
homesSelector = new ClientHomesSelector(buttonsGroup, SWT.NONE, "Local Client");
gd = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING);
homesSelector.getPanel().setLayoutData(gd);
}
{
Group secureGroup = new Group(addrGroup, SWT.NONE);
secureGroup.setText("Settings");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
secureGroup.setLayoutData(gd);
secureGroup.setLayout(new GridLayout(2, false));
hideNonDefault = UIUtils.createLabelCheckbox(secureGroup, "Show non-default databases", true);
}
createDriverPanel(addrGroup);
setControl(addrGroup);
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class PostgreSSLConfigurator method createControl.
@Override
public void createControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.minimumHeight = 200;
composite.setLayoutData(gd);
{
Group certGroup = UIUtils.createControlGroup(composite, "Certificates", 2, GridData.FILL_HORIZONTAL, -1);
UIUtils.createControlLabel(certGroup, "Root certificate");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.minimumWidth = 130;
rootCertText = new TextWithOpenFile(certGroup, "CA Certificate", new String[] { "*.*", "*.crt", "*.cert", "*.pem", "*" });
rootCertText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createControlLabel(certGroup, "SSL certificate");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.minimumWidth = 130;
clientCertText = new TextWithOpenFile(certGroup, "SSL Certificate", new String[] { "*.*", "*.cert", "*.pem", "*" });
clientCertText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createControlLabel(certGroup, "SSL certificate key");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.minimumWidth = 130;
clientKeyText = new TextWithOpenFile(certGroup, "SSL Certificate", new String[] { "*.*", "*.cert", "*.pem", "*" });
clientKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
Group advGroup = UIUtils.createControlGroup(composite, "Advanced", 2, GridData.FILL_HORIZONTAL, -1);
sslModeCombo = UIUtils.createLabelCombo(advGroup, "SSL mode", SWT.READ_ONLY | SWT.DROP_DOWN);
sslModeCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
for (String mode : SSL_MODES) {
sslModeCombo.add(mode);
}
sslFactoryCombo = UIUtils.createLabelCombo(advGroup, "SSL Factory", SWT.DROP_DOWN);
}
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class WMIConnectionPage method createControl.
@Override
public void createControl(Composite composite) {
//Composite group = new Composite(composite, SWT.NONE);
//group.setLayout(new GridLayout(1, true));
setImageDescriptor(logoImage);
ModifyListener textListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
evaluateURL();
}
};
Composite addrGroup = new Composite(composite, SWT.NONE);
GridLayout gl = new GridLayout(4, false);
gl.marginHeight = 10;
gl.marginWidth = 10;
addrGroup.setLayout(gl);
GridData gd = new GridData(GridData.FILL_BOTH);
addrGroup.setLayoutData(gd);
Label hostLabel = UIUtils.createControlLabel(addrGroup, "Host");
hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
hostText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
hostText.setLayoutData(gd);
hostText.addModifyListener(textListener);
Label domainLabel = UIUtils.createControlLabel(addrGroup, "Domain");
domainLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
domainText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
domainText.setLayoutData(gd);
domainText.addModifyListener(textListener);
Label namespaceLabel = UIUtils.createControlLabel(addrGroup, "Namespace");
namespaceLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
namespaceCombo = new Combo(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
namespaceCombo.setLayoutData(gd);
namespaceCombo.addModifyListener(textListener);
Label divLabel = new Label(addrGroup, SWT.SEPARATOR | SWT.SHADOW_OUT | SWT.HORIZONTAL);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 4;
divLabel.setLayoutData(gd);
{
Label usernameLabel = UIUtils.createControlLabel(addrGroup, "User");
usernameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
usernameText = new Text(addrGroup, SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
usernameText.setLayoutData(gd);
usernameText.addModifyListener(textListener);
Label passwordLabel = UIUtils.createControlLabel(addrGroup, "Password");
passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
passwordText = new Text(addrGroup, SWT.BORDER | SWT.PASSWORD);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.grabExcessHorizontalSpace = true;
passwordText.setLayoutData(gd);
passwordText.addModifyListener(textListener);
}
setControl(addrGroup);
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class SQLQueryParameterBindDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText("Bind parameter(s)");
final Composite composite = (Composite) super.createDialogArea(parent);
Table paramTable = new Table(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
final GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 400;
gd.heightHint = 200;
paramTable.setLayoutData(gd);
paramTable.setHeaderVisible(true);
paramTable.setLinesVisible(true);
final TableColumn indexColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, "#");
indexColumn.setWidth(40);
final TableColumn nameColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, "Name");
nameColumn.setWidth(100);
final TableColumn valueColumn = UIUtils.createTableColumn(paramTable, SWT.LEFT, "Value");
valueColumn.setWidth(200);
for (SQLQueryParameter param : parameters) {
if (param.getPrevious() != null) {
// Skip duplicates
List<SQLQueryParameter> dups = dupParameters.get(param.getName());
if (dups == null) {
dups = new ArrayList<>();
dupParameters.put(param.getName(), dups);
}
dups.add(param);
continue;
}
TableItem item = new TableItem(paramTable, SWT.NONE);
item.setData(param);
item.setImage(DBeaverIcons.getImage(DBIcon.TREE_ATTRIBUTE));
item.setText(0, String.valueOf(param.getOrdinalPosition() + 1));
item.setText(1, param.getTitle());
item.setText(2, CommonUtils.notEmpty(param.getValue()));
}
final CustomTableEditor tableEditor = new CustomTableEditor(paramTable) {
{
firstTraverseIndex = 2;
lastTraverseIndex = 2;
editOnEnter = false;
}
@Override
protected Control createEditor(Table table, int index, TableItem item) {
if (index != 2) {
return null;
}
SQLQueryParameter param = (SQLQueryParameter) item.getData();
Text editor = new Text(table, SWT.BORDER);
editor.setText(CommonUtils.notEmpty(param.getValue()));
editor.selectAll();
return editor;
}
@Override
protected void saveEditorValue(Control control, int index, TableItem item) {
SQLQueryParameter param = (SQLQueryParameter) item.getData();
String newValue = ((Text) control).getText();
item.setText(2, newValue);
param.setValue(newValue);
if (param.isNamed()) {
final List<SQLQueryParameter> dups = dupParameters.get(param.getName());
if (dups != null) {
for (SQLQueryParameter dup : dups) {
dup.setValue(newValue);
}
}
}
savedParamValues.put(param.getName().toUpperCase(Locale.ENGLISH), new SQLQueryParameterRegistry.ParameterInfo(param.getName(), newValue));
}
};
if (!parameters.isEmpty()) {
paramTable.select(0);
tableEditor.showEditor(paramTable.getItem(0), 2);
}
updateStatus(GeneralUtils.makeInfoStatus("Use Tab to switch. String values must be quoted. You can use expressions in values"));
return composite;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class AboutBoxDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Color background = JFaceColors.getBannerBackground(parent.getDisplay());
//Color foreground = JFaceColors.getBannerForeground(parent.getDisplay());
parent.setBackground(background);
Composite group = new Composite(parent, SWT.NONE);
group.setBackground(background);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 20;
layout.marginWidth = 20;
group.setLayout(layout);
GridData gd;
IProduct product = Platform.getProduct();
{
Label nameLabel = new Label(group, SWT.NONE);
nameLabel.setBackground(background);
nameLabel.setFont(NAME_FONT);
nameLabel.setText(product.getName());
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
nameLabel.setLayoutData(gd);
}
Label titleLabel = new Label(group, SWT.NONE);
titleLabel.setBackground(background);
titleLabel.setFont(TITLE_FONT);
titleLabel.setText(product.getProperty(PRODUCT_PROP_SUB_TITLE));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
titleLabel.setLayoutData(gd);
titleLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
@Override
public void run() {
// Do not create InstallationDialog directly
// but execute "org.eclipse.ui.help.installationDialog" command
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IHandlerService service = workbenchWindow.getService(IHandlerService.class);
if (service != null) {
try {
//$NON-NLS-1$
service.executeCommand("org.eclipse.ui.help.installationDialog", null);
} catch (Exception e1) {
// just ignore error
}
}
}
});
}
});
Label imageLabel = new Label(group, SWT.NONE);
imageLabel.setBackground(background);
gd = new GridData();
gd.verticalAlignment = GridData.BEGINNING;
gd.horizontalAlignment = GridData.CENTER;
gd.grabExcessHorizontalSpace = true;
imageLabel.setLayoutData(gd);
imageLabel.setImage(ABOUT_IMAGE);
Label versionLabel = new Label(group, SWT.NONE);
versionLabel.setBackground(background);
versionLabel.setText(CoreMessages.dialog_about_label_version + GeneralUtils.getProductVersion().toString());
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
versionLabel.setLayoutData(gd);
Label releaseTimeLabel = new Label(group, SWT.NONE);
releaseTimeLabel.setBackground(background);
releaseTimeLabel.setText(DateFormat.getDateInstance(DateFormat.LONG).format(GeneralUtils.getProductReleaseDate()));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
releaseTimeLabel.setLayoutData(gd);
Label authorLabel = new Label(group, SWT.NONE);
authorLabel.setBackground(background);
authorLabel.setText(product.getProperty(PRODUCT_PROP_COPYRIGHT));
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment = GridData.CENTER;
authorLabel.setLayoutData(gd);
Link siteLink = UIUtils.createLink(group, UIUtils.makeAnchor(product.getProperty(PRODUCT_PROP_WEBSITE)), new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
UIUtils.launchProgram(e.text);
}
});
siteLink.setBackground(background);
gd = new GridData();
gd.horizontalAlignment = GridData.CENTER;
siteLink.setLayoutData(gd);
return parent;
}
Aggregations