use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.
the class BatchRunComposite method createTableGroup.
private void createTableGroup(Composite composite) {
final String[] columnNames = new String[] { "", com.cubrid.common.ui.query.Messages.msgBatchRunSqlFile, com.cubrid.common.ui.query.Messages.msgBatchRunMemo, com.cubrid.common.ui.query.Messages.msgBatchRunRegdate };
tv = (CheckboxTableViewer) CommonUITool.createCheckBoxTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
tv.setInput(listData);
TableLayout tableLayout = new TableLayout();
tv.getTable().setLayout(tableLayout);
tableLayout.addColumnData(new ColumnPixelData(30));
tableLayout.addColumnData(new ColumnPixelData(209));
tableLayout.addColumnData(new ColumnPixelData(272));
tableLayout.addColumnData(new ColumnPixelData(118));
editor = new TableEditor(tv.getTable());
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;
tv.getTable().addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if (event.button != 1) {
return;
}
validateCheck();
Point pt = new Point(event.x, event.y);
int newIndex = tv.getTable().getSelectionIndex();
if (tv.getTable().getItemCount() <= newIndex || newIndex < 0) {
return;
}
final TableItem item = tv.getTable().getItem(newIndex);
if (item == null) {
return;
}
Rectangle rect = item.getBounds(2);
if (rect.contains(pt)) {
focusCell(item, newIndex, 2);
}
}
});
}
use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.
the class FilterResultContrItem method createControl.
/**
* Create the content
*
* @param parent Composite
* @return Control
*/
protected Control createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
comp.setLayoutData(gridData);
final GridLayout gdLayout = new GridLayout(5, false);
gdLayout.marginHeight = 0;
gdLayout.marginWidth = 0;
gdLayout.horizontalSpacing = 0;
gdLayout.verticalSpacing = 0;
gdLayout.marginRight = 10;
comp.setLayout(gdLayout);
Label lbl = new Label(comp, SWT.NONE);
lbl.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
lbl.setText(" " + Messages.lblFilterSearch + " ");
text = new Text(comp, SWT.NONE | SWT.BORDER | SWT.LEFT);
text.setLayoutData(CommonUITool.createGridData(1, 1, 100, -1));
text.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
doFilter();
}
}
});
dropDownButton = new Button(comp, SWT.FLAT | SWT.DOWN);
dropDownButton.setText(Messages.lblFilterSearchOption);
dropDownButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
handleSelectionEvent();
}
});
Label lblLimit = new Label(comp, SWT.NONE);
lblLimit.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
lblLimit.setText(" " + Messages.lblSearchLimit + " ");
pageLimitCombo = new Combo(comp, SWT.READ_ONLY);
pageLimitCombo.setItems(new String[] { "1000", "5000", "10000" });
pageLimitCombo.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
pageLimitCombo.setText("" + pageLimit);
pageLimitCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
int limit = StringUtil.intValue(pageLimitCombo.getText());
ServerInfo serverInfo = qe.getDatabase().getServer().getServerInfo();
QueryOptions.setSearchUnitCount(serverInfo, limit);
}
});
loadMenuItems();
return comp;
}
use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.
the class AddQueryRecordDialog method createDialogArea.
/**
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
* @param parent The parent composite to contain the dialog area
* @return the dialog area 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.numColumns = 3;
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);
Label label1 = new Label(composite, SWT.LEFT);
label1.setText(Messages.lblQueryName);
label1.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
String queryPlanName = Messages.lblQueryTuningName + " ";
if (newFlag) {
queryPlanName += QueryRecord.DATE_FORMAT.format(new Date());
} else {
queryPlanName += queryRecord.getTimeStamp();
}
newText = new Text(composite, SWT.BORDER);
newText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
newText.setText(queryPlanName);
newText.selectAll();
newText.setFocus();
newText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
validate();
}
});
newText.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event e) {
if (e.type == SWT.KeyDown && e.character == SWT.CR) {
buttonPressed(IDialogConstants.OK_ID);
}
}
});
if (newFlag) {
setTitle(Messages.subTitleAddQueryRecord);
} else {
String msg = Messages.bind(Messages.subTitleRenameQueryRecord, queryRecord.getName());
setTitle(msg);
}
return parent;
}
use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.
the class JdbcOptionComposite method focusCell.
public void focusCell(final TableItem item, final int row, final int col) {
final StyledText text = new StyledText(jdbcInfoTv.getTable(), SWT.SINGLE);
Listener textListener = new TableItemEditor(text, item, row, col);
text.addListener(SWT.FocusOut, textListener);
text.addListener(SWT.Traverse, textListener);
text.addListener(SWT.FocusIn, textListener);
text.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
e.doit = false;
int newColumn = col == 0 ? 1 : 0;
focusCell(item, row, newColumn);
} else if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
addButton.setFocus();
}
}
});
text.setEditable(true);
editor.setEditor(text, item, col);
text.setText(item.getText(col));
text.selectAll();
try {
text.setFocus();
} catch (Exception e) {
}
}
use of org.eclipse.swt.widgets.Listener in project cubrid-manager by CUBRID.
the class UnifyHostConfigEditor method createBrokerConfTabItem.
/**
* create broker conf table
*/
public void createBrokerConfTabItem() {
Composite comp = new Composite(confTabFolder, SWT.NONE);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(new GridLayout(1, false));
brokerConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
brokerConfTableCTabItem.setText(BROKERCONFCONFIGFILENAME);
brokerConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
brokerConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
brokerConfTabTableViewer.getTable().setHeaderVisible(true);
brokerConfTabTableViewer.getTable().setLinesVisible(true);
brokerConfTabTableViewer.setUseHashlookup(true);
//create column
TableViewerColumn column = new TableViewerColumn(brokerConfTabTableViewer, SWT.LEFT);
column.getColumn().setWidth(0);
column.getColumn().setText("");
brokerConfTabTableViewer.setContentProvider(new UnifyHostCubridBrokerTableContentProvider());
brokerConfTabTableViewer.setLabelProvider(new UnifyHostCubridBrokerTableLabelProvider());
brokerConfTabTableViewer.setSorter(new BrokerConfTableViewerSorter());
//use to mark click point, the right click menu use this point
brokerConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
cubridBrokerTableClickPoint = new Point(event.x, event.y);
cubridBrokerTableClickPointTiming = System.currentTimeMillis();
}
});
registerCubridBrokerTableContextMenu();
brokerConfTableCTabItem.setControl(comp);
if (confTabFolder.getSelection() == null) {
confTabFolder.setSelection(brokerConfTableCTabItem);
}
}
Aggregations