use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class FindDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(3, false);
container.setLayout(layout);
Label label = new Label(container, SWT.CENTER);
final Text text = new Text(container, SWT.BORDER);
final Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
group.setText("Direction");
group.setLayout(new RowLayout(SWT.VERTICAL));
final Button forwardButton = new Button(group, SWT.RADIO);
forwardButton.setText("Forward");
forwardButton.setSelection(true);
final Button backwardButton = new Button(group, SWT.RADIO);
backwardButton.setText("Backward");
final Label tempLabel = new Label(container, SWT.NONE);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
selectionLoaction = 0;
tempLabel.setText("");
locationRecord.clear();
firstSearch = true;
}
});
forwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
backwardButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
tempLabel.setText("");
}
});
Button findButton = new Button(container, SWT.NONE);
findButton.setText("Find");
findButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (consoleText.getText().length() > 0) {
this.searchString(text.getText());
} else
tempLabel.setText("String not found");
}
private void searchString(String parameter) {
if (!parameter.equals("")) {
if (firstSearch == true) {
findAll(parameter);
firstSearch = false;
}
selectionLoaction = consoleText.getSelection().x;
boolean selected = false;
if (backwardButton.getSelection() == true) {
if (locationRecord.size() > 0) {
for (int i = locationRecord.size() - 1; i >= 0; i--) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() < selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
} else {
if (locationRecord.size() > 0) {
for (int i = 0; i < locationRecord.size(); i++) {
if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() > selectionLoaction) {
selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
selected = true;
break;
}
selected = false;
}
if (selected == false)
tempLabel.setText("String not found");
} else
tempLabel.setText("String not found");
}
}
}
private void findAll(String parameter) {
if (!parameter.equals("")) {
int location = -1;
do {
location = consoleText.getText().substring(selectionLoaction).indexOf(parameter);
if (location > -1) {
selectionLoaction = selectionLoaction + location + parameter.length();
locationRecord.add(selectionLoaction);
} else
break;
} while ((selectionLoaction + parameter.length()) <= consoleText.getText().length());
}
}
});
GridData data = new GridData(GridData.CENTER);
data.horizontalSpan = 1;
label.setText("Find: ");
label.setLayoutData(data);
GridData data1 = new GridData(GridData.CENTER);
data1.horizontalSpan = 2;
data1.widthHint = 180;
data1.grabExcessVerticalSpace = true;
text.setLayoutData(data1);
GridData data2 = new GridData(GridData.CENTER);
data2.horizontalSpan = 3;
data2.widthHint = 215;
data2.grabExcessVerticalSpace = true;
group.setLayoutData(data2);
GridData data3 = new GridData(GridData.CENTER);
data3.horizontalSpan = 2;
data3.widthHint = 150;
tempLabel.setLayoutData(data3);
GridData data4 = new GridData(GridData.CENTER);
data4.horizontalSpan = 1;
data4.widthHint = 65;
findButton.setLayoutData(data4);
return container;
}
use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.
the class ContextComposite method createControl.
private void createControl() {
Composite exportComposite = Form.startNewGridLayout(this, 2, true, SWT.CENTER, SWT.CENTER);
GC gc = new GC(exportComposite);
//$NON-NLS-1$
String displayStr = Messages.getString("ContextComposite.exportAsContext");
Point buttonSize = gc.stringExtent(displayStr);
exportContextBtn = new UtilsButton(exportComposite, displayStr, buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
exportContextBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
exportAsContext();
}
});
//$NON-NLS-1$
displayStr = Messages.getString("ContextComposite.revertContext");
buttonSize = gc.stringExtent(displayStr);
revertContextBtn = new UtilsButton(exportComposite, displayStr, buttonSize.x + 12, HEIGHT_BUTTON_PIXEL);
gc.dispose();
revertContextBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
revertContext();
}
});
RowLayout layout = (RowLayout) exportComposite.getLayout();
layout.spacing = 20;
exportComposite.setLayout(layout);
refreshContextBtn();
}
use of org.eclipse.swt.layout.RowLayout in project cubrid-manager by CUBRID.
the class DatabaseSelectionDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite newComp = new Composite(parentComp, SWT.NONE);
GridLayout dialogShellLayout = new GridLayout();
dialogShellLayout.makeColumnsEqualWidth = true;
newComp.setLayout(dialogShellLayout);
GridData compData = new GridData();
compData.grabExcessHorizontalSpace = true;
compData.grabExcessVerticalSpace = true;
compData.verticalAlignment = GridData.FILL;
compData.horizontalAlignment = GridData.FILL;
newComp.setLayoutData(compData);
try {
{
GridData dbTreeLData = new GridData();
dbTreeLData.grabExcessHorizontalSpace = true;
dbTreeLData.grabExcessVerticalSpace = true;
dbTreeLData.verticalAlignment = GridData.FILL;
dbTreeLData.horizontalAlignment = GridData.FILL;
dbTree = new Tree(newComp, SWT.BORDER | SWT.LINE_SOLID | SWT.MULTI | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL);
dbTree.setLayoutData(dbTreeLData);
}
{
buttonComp = new Composite(newComp, SWT.NONE);
RowLayout buttonCompLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL);
GridData buttonCompLData = new GridData();
buttonComp.setLayoutData(buttonCompLData);
buttonComp.setLayout(buttonCompLayout);
{
btnSelectAll = new Button(buttonComp, SWT.PUSH | SWT.CENTER);
RowData btnSelectAllLData = new RowData();
btnSelectAll.setLayoutData(btnSelectAllLData);
btnSelectAll.setText(Messages.lblSelectAll);
btnSelectAll.addSelectionListener(this);
btnSelectAll.setData(KEY_ID, TYPE.SELECT);
btnSelectAll.setData(KEY_VALUE, true);
btnSelectAll.setVisible(false);
}
{
btnUnSelectAll = new Button(buttonComp, SWT.PUSH | SWT.CENTER);
RowData btnUnSelectAllLData = new RowData();
btnUnSelectAll.setLayoutData(btnUnSelectAllLData);
btnUnSelectAll.setText(Messages.lblDeSelectAll);
// btnUnSelectAll.setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
btnUnSelectAll.addSelectionListener(this);
btnUnSelectAll.setData(KEY_ID, TYPE.SELECT);
btnUnSelectAll.setData(KEY_VALUE, false);
btnUnSelectAll.setVisible(false);
}
{
btnExpandAll = new Button(buttonComp, SWT.PUSH | SWT.CENTER);
RowData btnExpandAllLData = new RowData();
btnExpandAll.setLayoutData(btnExpandAllLData);
btnExpandAll.setText(Messages.lblExpandAll);
btnExpandAll.addSelectionListener(this);
btnExpandAll.setData(KEY_ID, TYPE.EXPAND);
btnExpandAll.setData(KEY_VALUE, true);
btnExpandAll.setVisible(false);
}
{
btnUnExpandAll = new Button(buttonComp, SWT.PUSH | SWT.CENTER);
RowData btnUnExpandAllLData = new RowData();
btnUnExpandAll.setLayoutData(btnUnExpandAllLData);
btnUnExpandAll.setText(Messages.lblUnExpandAll);
// btnUnExpandAll.setImage(CommonUIPlugin.getImage("icons/action/collapseall.gif"));
btnUnExpandAll.addSelectionListener(this);
btnUnExpandAll.setData(KEY_ID, TYPE.EXPAND);
btnUnExpandAll.setData(KEY_VALUE, false);
btnUnExpandAll.setVisible(false);
}
}
} catch (Exception e) {
e.printStackTrace();
}
dbTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TreeItem item = (TreeItem) e.item;
boolean checked = item.getChecked();
checkItems(item.getItems(), checked);
if (item.getParentItem() != null) {
if (checked)
item.getParentItem().setChecked(checked);
checkParentChecked(item.getParentItem(), checked);
}
}
private void checkItems(TreeItem[] items, boolean value) {
if (items == null || items.length == 0)
return;
for (TreeItem item : items) {
item.setChecked(value);
}
}
private void checkParentChecked(TreeItem pitem, boolean value) {
TreeItem[] items = pitem.getItems();
for (TreeItem item : items) {
if (item.getChecked() == value) {
continue;
} else {
return;
}
}
pitem.setChecked(value);
}
});
initTreeData();
if (this.lastSelectedDbs != null)
initSelection(this.lastSelectedDbs);
return parentComp;
}
use of org.eclipse.swt.layout.RowLayout in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method init.
public void init() {
/*Tool bar composite*/
Composite toolBarComposite = new Composite(this, SWT.NONE);
RowLayout rowLayout = new RowLayout();
toolBarComposite.setLayout(rowLayout);
toolBarComposite.setLayoutData(CommonUITool.createGridData(-1, -1, -1, 25));
dataTabButton = new Button(toolBarComposite, SWT.None);
dataTabButton.setText(Messages.tabTitleData);
dataTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(0);
}
});
ddlTabButton = new Button(toolBarComposite, SWT.None);
ddlTabButton.setText(Messages.tabTitleDDL);
ddlTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(1);
}
});
columnTabButton = new Button(toolBarComposite, SWT.None);
columnTabButton.setText(Messages.tabTitleColumn);
columnTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(2);
}
});
indexTabButton = new Button(toolBarComposite, SWT.None);
indexTabButton.setText(Messages.tabTitleIndex);
indexTabButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (objInfoFolder == null) {
return;
}
objInfoFolder.setSelection(3);
}
});
new Label(toolBarComposite, SWT.None).setText(" ");
/*Select * button*/
selectButton = new Button(toolBarComposite, SWT.None);
selectButton.setText(Messages.txtSelect);
selectButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processSelectAction();
}
});
/*Select column button*/
selectColumnButton = new Button(toolBarComposite, SWT.None);
selectColumnButton.setText(Messages.txtSelectColumn);
selectColumnButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processSelectColumnAction();
}
});
/*Insert Button*/
insertButton = new Button(toolBarComposite, SWT.None);
insertButton.setText(Messages.txtInsert);
insertButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processInsertAction();
}
});
/*Update button*/
updateButton = new Button(toolBarComposite, SWT.None);
updateButton.setText(Messages.txtUpdate);
updateButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processUpdateAction();
}
});
/*Delete button*/
deleteButton = new Button(toolBarComposite, SWT.None);
deleteButton.setText(Messages.txtDelete);
deleteButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
processDeleteAction();
}
});
/*Database object information*/
objInfoFolder = new CTabFolder(this, SWT.BOTTOM);
objInfoFolder.setSimple(false);
objInfoFolder.setUnselectedImageVisible(true);
objInfoFolder.setUnselectedCloseVisible(true);
objInfoFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
objInfoFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
objInfoFolder.setLayout(new GridLayout(1, true));
objInfoFolder.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, -1, -1, -1, -1));
/*Demo data tab item*/
initDataTabItem();
/*DDL tab item*/
initDDLTabItem();
/*Column tab item*/
initColumnTabItem();
/*If is table, create index tab item*/
if (isTable) {
initIndexTabItem();
}
/*Initial the data*/
TaskJobExecutor taskExec = new CommonTaskJobExec() {
public IStatus exec(IProgressMonitor monitor) {
IStatus status = super.exec(monitor);
if (Status.CANCEL_STATUS == status) {
return status;
}
return Status.OK_STATUS;
}
public void done(IJobChangeEvent event) {
getInfoDataTask = null;
}
};
GetInfoDataTask getInfoDataTask = new GetInfoDataTask(Messages.getInfoJobName, this, schemaNode, isTable);
taskExec.addTask(getInfoDataTask);
/*Get data job*/
TaskJob job = new TaskJob(Messages.bind(Messages.getInfoJobName, schemaNode.getName()), taskExec);
job.setPriority(Job.LONG);
job.setUser(false);
job.schedule();
}
use of org.eclipse.swt.layout.RowLayout in project cubrid-manager by CUBRID.
the class LongTextCellPopupDialog method createDialogArea.
/**
* Create dialog area
*
* @param parent Composite
* @return Control
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
Composite btnComposite = new Composite(composite, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.spacing = 5;
btnComposite.setLayout(rowLayout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalAlignment = GridData.BEGINNING;
gridData.horizontalSpan = 2;
btnComposite.setLayoutData(gridData);
setNullBtn = new Button(btnComposite, SWT.CHECK);
{
setNullBtn.setText(Messages.btnSetNull);
setNullBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
changeBtnStatus();
}
});
}
importBtn = new Button(btnComposite, SWT.PUSH);
importBtn.setText(Messages.btnImport);
importBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
File file = FileDialogUtils.getImportedFile(getShell(), new String[] { "*.txt", "*.sql", "*.csv" });
if (null != file && file.getName().length() > 0) {
final String charsetName = fileCharsetCombo.getText();
try {
"".getBytes(charsetName);
} catch (UnsupportedEncodingException e) {
CommonUITool.openErrorBox(Messages.errCharset);
return;
}
try {
String textValue = FileUtil.readData(file.getPath(), charsetName);
columnValueText.setText(textValue);
currValue = textValue;
} catch (IOException ex) {
CommonUITool.openErrorBox(ex.getMessage());
}
}
}
});
exportBtn = new Button(btnComposite, SWT.PUSH);
exportBtn.setText(Messages.btnExport);
exportBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (columnValueText.getText().length() == 0) {
CommonUITool.openWarningBox(Messages.noDataExport);
return;
}
String charsetName = fileCharsetCombo.getText();
try {
"".getBytes(charsetName);
} catch (UnsupportedEncodingException e) {
CommonUITool.openErrorBox(Messages.errCharset);
return;
}
File file = FileDialogUtils.getDataExportedFile(getShell(), new String[] { "*.*" }, new String[] { "*.*" }, null);
if (null != file && file.getName().length() > 0) {
exportData(file.getPath());
}
}
});
fileCharsetCombo = new Combo(btnComposite, SWT.NONE);
{
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
String charset = StringUtil.getDefaultCharset();
fileCharsetCombo.setText(charset);
}
columnValueText = new StyledText(composite, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
if (value.hasLoadAll()) {
CommonUITool.registerContextMenu(columnValueText, isEditable);
}
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 280;
gd.widthHint = 500;
columnValueText.setLayoutData(gd);
initValue();
return composite;
}
Aggregations