use of org.eclipse.swt.widgets.Spinner in project cubrid-manager by CUBRID.
the class RunSQLFileDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.runSQLDialogTitle);
setTitle(Messages.runSQLDialogTitle);
setMessage(Messages.runSQLDialogMessage);
Composite comp = new Composite(parent, SWT.BORDER);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(new GridLayout(6, false));
Composite sqlFileComp = new Composite(comp, SWT.BORDER);
GridData sqlFileCompGd = new GridData(GridData.FILL_BOTH);
sqlFileCompGd.horizontalSpan = 6;
sqlFileComp.setLayoutData(sqlFileCompGd);
sqlFileComp.setLayout(new GridLayout(2, false));
new Label(sqlFileComp, SWT.NONE).setText(Messages.runSQLDialogFilePathLabel);
Button sqlFileButton = new Button(sqlFileComp, SWT.NONE);
sqlFileButton.setText(Messages.btnAdd);
sqlFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.MULTI);
dialog.setFilterPath(PersistUtils.getPreferenceValue(CommonUIPlugin.PLUGIN_ID, SQLFILEPATH));
dialog.setText(Messages.runSQLSelectFiles);
dialog.setFilterExtensions(new String[] { "*.sql" });
dialog.setOverwrite(false);
String filePath = dialog.open();
if (filePath != null) {
String[] files = dialog.getFileNames();
for (int i = 0; i < files.length; i++) {
String fileName = dialog.getFilterPath() + File.separator + files[i];
if (!filesList.contains(fileName)) {
filesList.add(fileName);
}
}
PersistUtils.setPreferenceValue(CommonUIPlugin.PLUGIN_ID, SQLFILEPATH, filePath);
saveErrExcelPath.setText(dialog.getFilterPath());
sqlFileTableViewer.setInput(filesList);
}
}
});
Composite textComp = new Composite(sqlFileComp, SWT.NONE);
GridData textCompGd = new GridData(GridData.FILL_BOTH);
textCompGd.horizontalSpan = 2;
textCompGd.heightHint = 100;
textComp.setLayoutData(textCompGd);
textComp.setLayout(new GridLayout(1, true));
sqlFileTableViewer = new TableViewer(textComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
sqlFileTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
sqlFileTableViewer.getTable().setLinesVisible(true);
sqlFileTableViewer.getTable().setHeaderVisible(false);
final TableViewerColumn fileNameCol = new TableViewerColumn(sqlFileTableViewer, SWT.NONE);
fileNameCol.getColumn().setWidth(500);
fileNameCol.getColumn().setText("");
sqlFileTableViewer.setContentProvider(new SQLFileTableContentProvider());
sqlFileTableViewer.setLabelProvider(new SQLFileTableLabelProvider());
Composite databaseComp = new Composite(comp, SWT.BORDER);
GridData databaseCompGd = new GridData(GridData.FILL_BOTH);
databaseCompGd.horizontalSpan = 6;
databaseCompGd.heightHint = 100;
databaseComp.setLayoutData(databaseCompGd);
databaseComp.setLayout(new GridLayout(1, false));
new Label(databaseComp, SWT.NONE).setText(Messages.runSQLDialogDatabaseLabel);
databaseTableComp = new Composite(databaseComp, SWT.NONE);
GridData databaseTableCompGd = new GridData(GridData.FILL_BOTH);
databaseTableCompGd.horizontalSpan = 1;
databaseTableCompGd.heightHint = 100;
databaseTableComp.setLayoutData(databaseTableCompGd);
databaseTableComp.setLayout(new GridLayout(1, false));
databaseTableViewer = new TableViewer(databaseTableComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
databaseTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
databaseTableViewer.getTable().setLinesVisible(true);
databaseTableViewer.getTable().setHeaderVisible(false);
final TableViewerColumn databaseCol = new TableViewerColumn(databaseTableViewer, SWT.NONE);
databaseCol.getColumn().setWidth(500);
databaseCol.getColumn().setText("");
databaseTableViewer.setContentProvider(new DatabaseTableContentProvider());
databaseTableViewer.setLabelProvider(new DatabaseTableLabelProvider());
new Label(comp, SWT.NONE).setText(com.cubrid.common.ui.cubrid.table.Messages.lblFileCharset);
fileCharsetCombo = new Combo(comp, SWT.NONE);
{
GridData gridData = new GridData(GridData.BEGINNING);
fileCharsetCombo.setLayoutData(gridData);
fileCharsetCombo.setItems(QueryOptions.getAllCharset(null));
fileCharsetCombo.select(0);
}
Label threadCountLabel = new Label(comp, SWT.NONE);
threadCountLabel.setText(Messages.runSQLDialogLabelThreadCount);
threadCountLabel.setToolTipText(Messages.runSQLDialogLabelThreadCountTooltip);
threadCountSpinner = new Spinner(comp, SWT.BORDER | SWT.LEFT);
threadCountSpinner.setValues(1, 1, 50, 0, 1, 1);
threadCountSpinner.setToolTipText(Messages.runSQLDialogLabelThreadCountTooltip);
Label commitCountLabel = new Label(comp, SWT.NONE);
commitCountLabel.setText(Messages.runSQLDialogLabelCommitCount);
commitCountLabel.setToolTipText(Messages.runSQLDialogLabelCommitCountTooltip);
commitCountSpinner = new Spinner(comp, SWT.BORDER | SWT.LEFT);
commitCountSpinner.setValues(1000, 1, 10000, 0, 1, 1000);
commitCountSpinner.setToolTipText(Messages.runSQLDialogLabelCommitCountTooltip);
Composite autoSaveComp = new Composite(comp, SWT.BORDER);
GridData autoSaveCompGd = new GridData(GridData.FILL_BOTH);
autoSaveCompGd.horizontalSpan = 6;
autoSaveComp.setLayoutData(autoSaveCompGd);
autoSaveComp.setLayout(new GridLayout(3, false));
Composite autoSaveBtnComp = new Composite(autoSaveComp, SWT.NONE);
GridData autoSaveBtnCompGd = new GridData(GridData.FILL_BOTH);
autoSaveBtnCompGd.horizontalSpan = 3;
autoSaveBtnComp.setLayoutData(autoSaveBtnCompGd);
autoSaveBtnComp.setLayout(new GridLayout(2, false));
new Label(autoSaveBtnComp, SWT.NONE).setText(Messages.runSQLDialogCheckBtnDescription);
new Label(autoSaveComp, SWT.NONE).setText(Messages.runSQLDialogExcelPathLabel);
saveErrExcelPath = new Text(autoSaveComp, SWT.BORDER);
saveErrExcelPath.setLayoutData(new GridData(GridData.FILL_BOTH));
saveErrExcelPath.setEditable(false);
saveErrExcelBtn = new Button(autoSaveComp, SWT.NONE);
saveErrExcelBtn.setText(Messages.brokerLogTopMergeOpenBtn);
saveErrExcelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
DirectoryDialog dialog = new DirectoryDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
dialog.setFilterPath(saveErrExcelPath.getText());
String dir = dialog.open();
if (dir != null) {
if (!dir.endsWith(File.separator)) {
dir += File.separator;
}
saveErrExcelPath.setText(dir);
}
}
});
registerContextMenu();
setInput();
return parent;
}
use of org.eclipse.swt.widgets.Spinner in project cubrid-manager by CUBRID.
the class ShowDashboardDialog method createAutoRefreshTime.
private void createAutoRefreshTime(Composite comp) {
Label lblShowDashboard = new Label(comp, SWT.NONE);
lblShowDashboard.setText(Messages.lblAutoRefreshSecond);
timePinner = new Spinner(comp, SWT.BORDER | SWT.RIGHT);
{
final GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
timePinner.setLayoutData(gd);
}
timePinner.setValues(autoRefreshSecond, minTime, maxTime, 0, 1, 1);
timePinner.addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
public void keyPressed(org.eclipse.swt.events.KeyEvent event) {
if (timePinner.getText().trim().length() == 0) {
return;
}
int selectTimeValue = Integer.parseInt(timePinner.getText());
if (selectTimeValue < minTime || selectTimeValue > maxTime) {
String msg = Messages.bind(Messages.databaseDashboardAutoRefreshConfErrMsg, Integer.toString(minTime), Integer.toString(maxTime));
CommonUITool.openErrorBox(msg);
return;
}
}
});
Label lblUnit = new Label(comp, SWT.NONE);
lblUnit.setText(Messages.lblAutoRefreshSecondUnit);
}
use of org.eclipse.swt.widgets.Spinner in project cubrid-manager by CUBRID.
the class EditBackupPlanDialog method createOptionsGroup.
/**
* create the options group in the Dialog
*
* @param composite Composite
*/
private void createOptionsGroup(Composite composite) {
final Group optionsGroup = new Group(composite, SWT.NONE);
final GridData gdOptionsGroup = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
optionsGroup.setLayoutData(gdOptionsGroup);
GridLayout groupLayout = new GridLayout(1, true);
optionsGroup.setLayout(groupLayout);
final Group checkGroup = new Group(optionsGroup, SWT.NONE);
checkGroup.setText(Messages.optionGroupName);
checkGroup.setLayout(new GridLayout(2, true));
final GridData gdCheckGroup = new GridData(SWT.FILL, SWT.TOP, true, false);
checkGroup.setLayoutData(gdCheckGroup);
if (!isBkNumSupports) {
storeButton = new Button(checkGroup, SWT.CHECK);
storeButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
storeButton.setText(Messages.msgStroreBtn);
}
deleteButton = new Button(checkGroup, SWT.CHECK);
deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
deleteButton.setText(Messages.msgDeleteBtn);
updateButton = new Button(checkGroup, SWT.CHECK);
updateButton.setText(Messages.msgUpdateBtn);
checkingButton = new Button(checkGroup, SWT.CHECK);
checkingButton.setText(Messages.msgCheckingBtn);
useCompressButton = new Button(checkGroup, SWT.CHECK);
useCompressButton.setText(Messages.msgUseCompressBtn);
final Composite threadComposite = new Composite(checkGroup, SWT.NONE);
final GridData gdThreadComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdThreadComposite.minimumHeight = 1;
threadComposite.setLayoutData(gdThreadComposite);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
threadComposite.setLayout(gridLayout);
final Label numThreadLabel = new Label(threadComposite, SWT.NONE);
numThreadLabel.setText(Messages.msgNumThreadLbl);
numThreadspinner = new Spinner(threadComposite, SWT.BORDER);
numThreadspinner.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, true));
numThreadspinner.setMaximum(MAX_THREAD);
final Group radioGroup = new Group(optionsGroup, SWT.None);
radioGroup.setText(Messages.msgComboGroup);
final GridData gdComboGroup = new GridData(SWT.FILL, SWT.TOP, true, false);
radioGroup.setLayoutData(gdComboGroup);
radioGroup.setLayout(new GridLayout());
onlineButton = new Button(radioGroup, SWT.RADIO);
onlineButton.setText(Messages.msgOnlineBtn);
offlineButton = new Button(radioGroup, SWT.RADIO);
offlineButton.setText(Messages.msgOfflineBtn);
if (isBkNumSupports) {
final Composite bkNumComposite = new Composite(checkGroup, SWT.NONE);
final GridData gdBkNumComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdBkNumComposite.minimumHeight = 1;
bkNumComposite.setLayoutData(gdBkNumComposite);
final GridLayout bkNumGridLayout = new GridLayout();
bkNumGridLayout.numColumns = 2;
bkNumComposite.setLayout(bkNumGridLayout);
final Label lblNumKeepBackups = new Label(bkNumComposite, SWT.NONE);
lblNumKeepBackups.setText(Messages.msgBkNumLbl);
numKeepBackups = new Spinner(bkNumComposite, SWT.BORDER);
numKeepBackups.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, true));
numKeepBackups.setSelection(StringUtil.intValue(backupPlanInfo.getBknum(), 0));
numKeepBackups.setMaximum(255);
}
if (operation == AddEditType.EDIT) {
if (isBkNumSupports) {
String bkNum = backupPlanInfo.getBknum();
if (StringUtil.isEmpty(bkNum)) {
bkNum = "0";
}
} else {
storeButton.setSelection(CommonUITool.str2Boolean(backupPlanInfo.getStoreold()));
}
deleteButton.setSelection(CommonUITool.str2Boolean(backupPlanInfo.getArchivedel()));
updateButton.setSelection(CommonUITool.str2Boolean(backupPlanInfo.getUpdatestatus()));
checkingButton.setSelection(CommonUITool.str2Boolean(backupPlanInfo.getCheck()));
useCompressButton.setSelection(CommonUITool.str2Boolean(backupPlanInfo.getZip()));
numThreadspinner.setSelection(Integer.valueOf(backupPlanInfo.getMt()));
boolean originalOnline = CommonUITool.str2Boolean(backupPlanInfo.getOnoff());
if (originalOnline) {
onlineButton.setSelection(true);
offlineButton.setSelection(false);
if (database.getRunningType() == DbRunningType.STANDALONE) {
onlineButton.setEnabled(false);
}
} else {
onlineButton.setSelection(false);
offlineButton.setSelection(true);
}
} else {
// sets the status of onlineButton and offlineButton if
if (database.getRunningType() == DbRunningType.CS) {
onlineButton.setSelection(true);
offlineButton.setSelection(false);
} else {
onlineButton.setSelection(false);
offlineButton.setSelection(true);
onlineButton.setEnabled(false);
}
}
}
use of org.eclipse.swt.widgets.Spinner in project cubrid-manager by CUBRID.
the class DashboardPreferencePage method createContents.
/**
* Create contents of page.
*
* @param parent Composite
* @return the content.
*/
protected Control createContents(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Group changeFontGroup = new Group(composite, SWT.NONE);
changeFontGroup.setText(Messages.colorSettingsOfDB);
final GridData gdChangeFontGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
changeFontGroup.setLayoutData(gdChangeFontGroup);
changeFontGroup.setLayout(new GridLayout());
final Composite compositeSecond = new Composite(changeFontGroup, SWT.NONE);
compositeSecond.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final GridLayout gridLayoutFirst = new GridLayout();
gridLayoutFirst.numColumns = 3;
compositeSecond.setLayout(gridLayoutFirst);
for (DBStatusType dbt : DBStatusType.values()) {
Label lbl = new Label(compositeSecond, SWT.NONE);
lbl.setText(Messages.dbStatusType + " \"" + getDBStatusText(dbt) + "\"");
Label lblColor = new Label(compositeSecond, SWT.NONE);
lblColor.setText(COLOR_LABEL_TEXT);
lblColor.setBackground(PREFER.getColor(getDBStatusText(dbt)));
Button btn = new Button(compositeSecond, SWT.FLAT);
btn.setText(COLOR_BUTTON_TEXT);
btn.addSelectionListener(new ColorSelector(btn, lblColor));
colorSettings.put(getDBStatusText(dbt), lblColor);
}
// HA Monitoring Option
{
final Group monitoringGroup = new Group(composite, SWT.NONE);
monitoringGroup.setText(Messages.haMon);
final GridData gdMonitoringGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
monitoringGroup.setLayoutData(gdMonitoringGroup);
monitoringGroup.setLayout(new GridLayout());
final Composite compositeMonitoring = new Composite(monitoringGroup, SWT.NONE);
compositeMonitoring.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final GridLayout gridLayoutMonitoring = new GridLayout();
gridLayoutMonitoring.numColumns = 2;
compositeMonitoring.setLayout(gridLayoutMonitoring);
Label lbl = new Label(compositeMonitoring, SWT.NONE);
lbl.setText(Messages.haMonHertbeatTimeout);
monitoringSpinner = new Spinner(compositeMonitoring, SWT.BORDER);
monitoringSpinner.setMinimum(1);
monitoringSpinner.setMaximum(3600);
final GridData gdSpinner = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
gdSpinner.widthHint = 40;
monitoringSpinner.setLayoutData(gdSpinner);
haHeartBeatTimeout = PREFER.getHAHeartBeatTimeout();
if (haHeartBeatTimeout < 1000) {
haHeartBeatTimeout = 1000;
}
monitoringSpinner.setSelection(haHeartBeatTimeout / 1000);
monitoringSpinner.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent event) {
haHeartBeatTimeout = monitoringSpinner.getSelection() * 1000;
}
public void widgetDefaultSelected(SelectionEvent event) {
haHeartBeatTimeout = monitoringSpinner.getSelection() * 1000;
}
});
lbl = new Label(compositeMonitoring, SWT.NONE);
lbl.setText(Messages.haMonHertbeatTimeoutMsg);
lbl.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
}
return composite;
}
use of org.eclipse.swt.widgets.Spinner in project hale by halestudio.
the class CustomPropertyFunctionEntityEditor method createControls.
@Override
protected void createControls(Composite page) {
GridLayoutFactory.swtDefaults().numColumns(4).equalWidth(true).applyTo(page);
GridDataFactory labelStyle = GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).grab(false, false);
GridDataFactory fieldStyle = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false);
GridDataFactory longFieldStyle = fieldStyle.copy().span(3, 1);
GridDataFactory checkStyle = fieldStyle.copy().span(2, 1);
// name
Label nameLabel = new Label(page, SWT.NONE);
nameLabel.setText("Name:");
labelStyle.applyTo(nameLabel);
nameText = new Text(page, SWT.SINGLE | SWT.BORDER);
longFieldStyle.applyTo(nameText);
// binding / type
Label typeLabel = new Label(page, SWT.NONE);
typeLabel.setText("Type:");
labelStyle.applyTo(typeLabel);
bindingOrType = new BindingOrTypeEditor(page, SchemaSpaceID.SOURCE);
longFieldStyle.applyTo(bindingOrType.getControl());
// min
Label minLabel = new Label(page, SWT.NONE);
minLabel.setText("Min:");
labelStyle.applyTo(minLabel);
minSpinner = new Spinner(page, SWT.BORDER);
minSpinner.setValues(1, 0, 100, 0, 1, 10);
fieldStyle.applyTo(minSpinner);
// max
Label maxLabel = new Label(page, SWT.NONE);
maxLabel.setText("Max:");
labelStyle.applyTo(maxLabel);
maxSpinner = new Spinner(page, SWT.BORDER);
maxSpinner.setValues(1, 1, 100, 0, 1, 10);
fieldStyle.applyTo(maxSpinner);
// eager
eagerSelect = new Button(page, SWT.CHECK);
eagerSelect.setText("eager");
checkStyle.applyTo(eagerSelect);
// unbounded
unboundedSelect = new Button(page, SWT.CHECK);
unboundedSelect.setText("unbounded");
checkStyle.applyTo(unboundedSelect);
}
Aggregations