use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class TimelineSection method createSection.
/**
* Creates the section.
*
* @param parent The parent composite
* @param group The attribute group
*/
private void createSection(Composite parent, IMonitoredMXBeanGroup group) {
if (parent.isDisposed()) {
return;
}
ExpandableComposite section = getWidgetFactory().createSection(parent, ExpandableComposite.TITLE_BAR);
section.setText(group.getName());
section.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite flatFormComposite = getWidgetFactory().createFlatFormComposite(section);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 0;
formLayout.marginWidth = 0;
flatFormComposite.setLayout(formLayout);
TimelineChart chart = new TimelineChart(flatFormComposite, section, group, SWT.NONE, toString() + getJvm().getPid());
charts.add(chart);
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
chart.setLayoutData(data);
section.setClient(flatFormComposite);
List<Action> actions = new ArrayList<Action>();
for (IMonitoredMXBeanAttribute attribute : group.getAttributes()) {
if (attribute.getAttributeName().startsWith("HeapMemoryUsage")) {
//$NON-NLS-1$
actions.add(garbageCollectorAction);
break;
}
}
actions.add(new ConfigureChartAction(chart, this));
addSectionActions(section, actions);
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class AbstractRuntimeGraphcsComposite method initGraphcs.
private void initGraphcs() {
// messagePage = createMessagePage(parent);
contentPage = new Composite(this, SWT.NULL);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
contentPage.setLayout(formLayout);
FormData pageData = new FormData();
pageData.top = new FormAttachment(0, 0);
pageData.bottom = new FormAttachment(100, 0);
pageData.left = new FormAttachment(0, 0);
pageData.right = new FormAttachment(100, 0);
contentPage.setLayoutData(pageData);
createControls(contentPage);
contentPage.layout();
contentPage.setVisible(true);
JvmModel.getInstance().addJvmModelChangeListener(this);
suspendRefresh = false;
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class LoginAgreementPage method createControl.
@Override
public void createControl(Composite parentCtrl) {
Composite container = new Composite(parentCtrl, SWT.NONE);
container.setLayout(new FormLayout());
Label titleLabel = new Label(container, SWT.WRAP);
titleLabel.setFont(LoginDialogV2.fixedFont);
//$NON-NLS-1$
titleLabel.setText(Messages.getString("LoginAgreementPage.title"));
FormData titleLabelFormData = new FormData();
titleLabelFormData.left = new FormAttachment(0, 0);
titleLabelFormData.top = new FormAttachment(0, 0);
titleLabel.setLayoutData(titleLabelFormData);
acceptButton = new Button(container, SWT.CENTER);
acceptButton.setBackground(backgroundColor);
acceptButton.setFont(LoginDialogV2.fixedFont);
//$NON-NLS-1$
acceptButton.setText(Messages.getString("LoginAgreementPage.accept"));
FormData acceptButtonFormLayoutData = new FormData();
acceptButtonFormLayoutData.bottom = new FormAttachment(100, 0);
acceptButtonFormLayoutData.right = new FormAttachment(100, 0);
acceptButtonFormLayoutData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(acceptButton).x);
acceptButton.setLayoutData(acceptButtonFormLayoutData);
boolean haveHtmlDesc = false;
FileInputStream licenseInputStream = null;
String licenseFileBasePath = Platform.getInstallLocation().getURL().getPath();
if (Boolean.parseBoolean(System.getProperty("USE_BROWSER"))) {
//$NON-NLS-1$
File htmlFile = new File(licenseFileBasePath + LICENSE_FILE_PATH_HTML);
if (htmlFile.exists()) {
try {
licenseInputStream = new FileInputStream(htmlFile);
if (licenseInputStream != null) {
haveHtmlDesc = true;
}
} catch (FileNotFoundException e) {
CommonExceptionHandler.process(e);
}
}
}
if (licenseInputStream == null) {
try {
licenseInputStream = new FileInputStream(licenseFileBasePath + LICENSE_FILE_PATH);
} catch (FileNotFoundException e) {
CommonExceptionHandler.process(e);
}
}
FormData clufLayoutData = new FormData();
clufLayoutData.top = new FormAttachment(titleLabel, LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.BOTTOM);
clufLayoutData.left = new FormAttachment(0, 0);
clufLayoutData.right = new FormAttachment(100, 0);
clufLayoutData.bottom = new FormAttachment(acceptButton, -1 * LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
if (haveHtmlDesc) {
clufBrowser = new Browser(container, SWT.BORDER);
clufBrowser.setText(getLicense(licenseInputStream));
clufBrowser.setLayoutData(clufLayoutData);
} else {
clufText = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL | SWT.LEFT | SWT.BORDER);
clufText.setBackground(new Color(null, 255, 255, 255));
//$NON-NLS-1$
Font font = new Font(DisplayUtils.getDisplay(), "courier", 10, SWT.NONE);
clufText.setFont(font);
clufText.setEditable(false);
clufText.setText(getLicense(licenseInputStream));
clufText.setLayoutData(clufLayoutData);
}
}
use of org.eclipse.swt.layout.FormLayout in project tdi-studio-se by Talend.
the class AbstractJobSettingsPage method createContents.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite composite = widgetFactory.createComposite(parent, SWT.NONE);
composite.setLayout(new FormLayout());
FormData data = createFormData();
composite.setLayoutData(data);
//
checkSettingExisted();
elem = checkAndCreateElement();
if (getParametersType() != null) {
ElementParameter2ParameterType.loadElementParameters(elem, getParametersType(), getPropertyTypeName());
}
// update connection from repository if needed
updateProjectSetting();
mComposite = new ProjectSettingMultipleThreadDynamicComposite(composite, SWT.V_SCROLL | SWT.BORDER, getCategory(), elem, true, getRepositoryPropertyName());
mComposite.setLayoutData(createFormData());
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
composite.setEnabled(false);
}
return composite;
}
use of org.eclipse.swt.layout.FormLayout in project cubrid-manager by CUBRID.
the class ExportSettingForLoadDBPage method createControl.
/**
* Create the page content
*
* @param parent Composite
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FormLayout());
Composite leftComposite = new Composite(container, SWT.NONE);
leftComposite.setLayout(new GridLayout());
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 5);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 5);
leftData.right = new FormAttachment(45, 0);
leftComposite.setLayoutData(leftData);
Composite rightComposite = new Composite(container, SWT.NONE);
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 5);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(45, 0);
rightData.right = new FormAttachment(100, -5);
rightComposite.setLayoutData(rightData);
GridLayout rightCompositeLayout = new GridLayout();
rightCompositeLayout.verticalSpacing = 10;
rightComposite.setLayout(rightCompositeLayout);
Label tableInfoLabel = new Label(leftComposite, SWT.None);
tableInfoLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
tableInfoLabel.setText(Messages.exportWizardSourceTableLable);
ctv = new CheckboxTreeViewer(leftComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
ctv.getTree().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
ctv.setContentProvider(new FilterTreeContentProvider());
ctv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateDialogStatus();
}
});
final TreeViewerColumn dbObjectCol = new TreeViewerColumn(ctv, SWT.NONE);
dbObjectCol.setLabelProvider(new ExportObjectLabelProvider());
final TreeViewerColumn whereCnd = new TreeViewerColumn(ctv, SWT.NONE);
whereCnd.setLabelProvider(new ExportObjectLabelProvider());
whereCnd.setEditingSupport(new EditingSupport(ctv) {
TextCellEditor textCellEditor;
protected boolean canEdit(Object element) {
if (element instanceof ICubridNode) {
ICubridNode node = (ICubridNode) element;
if (node.getType() == NodeType.TABLE_COLUMN_FOLDER) {
return true;
}
}
return false;
}
protected CellEditor getCellEditor(Object element) {
if (textCellEditor == null) {
textCellEditor = new TextCellEditor(ctv.getTree());
}
return textCellEditor;
}
protected Object getValue(Object element) {
final ICubridNode node = (ICubridNode) element;
String condition = (String) node.getData(ExportObjectLabelProvider.CONDITION);
if (condition == null) {
return "";
} else {
return condition;
}
}
protected void setValue(Object element, Object value) {
final ICubridNode node = (ICubridNode) element;
node.setData(ExportObjectLabelProvider.CONDITION, value);
ctv.refresh();
}
});
dbObjectCol.getColumn().setWidth(160);
dbObjectCol.getColumn().setText(Messages.tableLabel);
whereCnd.getColumn().setWidth(120);
whereCnd.getColumn().setText(Messages.conditionLabel);
final Button selectAllBtn = new Button(leftComposite, SWT.CHECK);
{
selectAllBtn.setText(Messages.btnSelectAll);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalIndent = 0;
gridData.horizontalSpan = 3;
selectAllBtn.setLayoutData(gridData);
}
selectAllBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean selection = selectAllBtn.getSelection();
for (ICubridNode node : tablesOrViewLst) {
ctv.setGrayed(node, false);
ctv.setChecked(node, selection);
}
updateDialogStatus();
}
});
Group fileOptionGroup = new Group(rightComposite, SWT.None);
fileOptionGroup.setText(Messages.exportWizardWhereExport);
fileOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
fileOptionGroup.setLayout(new GridLayout(3, false));
schemaButton = new Button(fileOptionGroup, SWT.CHECK);
schemaButton.setText("Schema");
schemaButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
schemaButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (schemaButton.getSelection()) {
schemaPathText.setEnabled(true);
schemaBrowseButton.setEnabled(true);
startValueButton.setEnabled(true);
} else {
schemaPathText.setEnabled(false);
schemaBrowseButton.setEnabled(false);
startValueButton.setEnabled(false);
}
updateDialogStatus();
}
});
schemaPathText = new Text(fileOptionGroup, SWT.BORDER);
schemaPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
schemaPathText.setEnabled(true);
schemaPathText.setEditable(false);
schemaPathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateDialogStatus();
}
});
schemaBrowseButton = new Button(fileOptionGroup, SWT.None);
schemaBrowseButton.setText(Messages.btnBrowse);
schemaBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
schemaBrowseButton.setEnabled(true);
schemaBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
String databaseName = databaseInfo.getDbName();
String fileNameForLoaddbSchema = databaseName + "_schema";
File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbSchema, null, null);
if (savedFile != null) {
schemaPathText.setText(savedFile.getAbsolutePath());
}
updateDialogStatus();
}
});
indexButton = new Button(fileOptionGroup, SWT.CHECK);
indexButton.setText("Index");
indexButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
indexButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (indexButton.getSelection()) {
indexPathText.setEnabled(true);
indexBrowseButton.setEnabled(true);
} else {
indexPathText.setEnabled(false);
indexBrowseButton.setEnabled(false);
}
updateDialogStatus();
}
});
indexPathText = new Text(fileOptionGroup, SWT.BORDER);
indexPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
indexPathText.setEnabled(true);
indexPathText.setEditable(false);
indexPathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateDialogStatus();
}
});
indexBrowseButton = new Button(fileOptionGroup, SWT.None);
indexBrowseButton.setText(Messages.btnBrowse);
indexBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
indexBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
String databaseName = databaseInfo.getDbName();
String fileNameForLoaddbIndex = databaseName + "_indexes";
File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbIndex, null, null);
if (savedFile != null) {
indexPathText.setText(savedFile.getAbsolutePath());
}
updateDialogStatus();
}
});
dataButton = new Button(fileOptionGroup, SWT.CHECK);
dataButton.setText("Data");
dataButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
dataButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (dataButton.getSelection()) {
dataPathText.setEnabled(true);
dataBrowseButton.setEnabled(true);
} else {
dataPathText.setEnabled(false);
dataBrowseButton.setEnabled(false);
}
updateDialogStatus();
}
});
dataPathText = new Text(fileOptionGroup, SWT.BORDER);
dataPathText.setEditable(false);
dataPathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
dataPathText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateDialogStatus();
}
});
dataBrowseButton = new Button(fileOptionGroup, SWT.None);
dataBrowseButton.setText(Messages.btnBrowse);
dataBrowseButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
dataBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
DatabaseInfo databaseInfo = getDatabase().getDatabaseInfo();
String databaseName = databaseInfo.getDbName();
String fileNameForLoaddbData = databaseName + "_objects";
File savedFile = TableUtil.getSavedFile(getShell(), new String[] { "*.*" }, new String[] { "All Files" }, fileNameForLoaddbData, null, null);
if (savedFile != null) {
dataPathText.setText(savedFile.getAbsolutePath());
}
updateDialogStatus();
}
});
Group enCodingOptionGroup = new Group(rightComposite, SWT.None);
enCodingOptionGroup.setText(Messages.exportWizardDataOption);
enCodingOptionGroup.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
enCodingOptionGroup.setLayout(new GridLayout(4, false));
Label dbCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
dbCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
dbCharsetLabel.setText(Messages.lblJDBCCharset);
dbCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
dbCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
dbCharsetCombo.setItems(QueryOptions.getAllCharset(null));
dbCharsetCombo.setEnabled(false);
Label fileCharsetLabel = new Label(enCodingOptionGroup, SWT.None);
fileCharsetLabel.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
fileCharsetLabel.setText(Messages.lblFileCharset);
fileCharsetCombo = new Combo(enCodingOptionGroup, SWT.BORDER);
fileCharsetCombo.setLayoutData(CommonUITool.createGridData(1, 1, 50, 21));
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
fileCharsetCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
updateDialogStatus();
}
});
startValueButton = new Button(enCodingOptionGroup, SWT.CHECK);
startValueButton.setText(Messages.lblExportTargetStartValue);
startValueButton.setLayoutData(CommonUITool.createGridData(4, 1, -1, -1));
startValueButton.setToolTipText(Messages.tipExportTargetStartValue);
setControl(container);
}
Aggregations