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 LAMSADE-tools by LAntoine.
the class Win1 method initUI.
private void initUI(Display display) {
// Display display = new Display();
Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.CENTER);
Color col = new Color(display, 100, 220, 150);
shell.setBackground(col);
col.dispose();
GridLayout layout = new GridLayout(2, false);
shell.setLayout(layout);
Label lbl1 = new Label(shell, SWT.NONE);
Composite composite = new Composite(shell, SWT.FILL);
lbl1.setLayoutData(composite);
Color col1 = new Color(display, 255, 155, 10);
lbl1.setBackground(col1);
col1.dispose();
Text txtTest = new Text(composite, SWT.NONE);
txtTest.setText("Testing");
Text txtMoreTests = new Text(composite, SWT.NONE);
txtMoreTests.setText("Another test");
Button button = new Button(composite, SWT.PUSH);
button.setText("Press Me");
button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
switch(e.type) {
case SWT.Selection:
System.out.println("Button pressed");
break;
default:
break;
}
}
});
Label lbl3 = new Label(shell, SWT.NONE);
GridData gd3 = new GridData(SWT.FILL, SWT.FILL, true, true);
gd3.widthHint = 1000;
gd3.heightHint = 500;
gd3.horizontalSpan = 2;
lbl3.setLayoutData(gd3);
Color col3 = new Color(display, 100, 205, 200);
lbl3.setBackground(col3);
col3.dispose();
shell.setText("Grid");
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
use of org.eclipse.swt.widgets.Listener in project lwjgl by LWJGL.
the class LWJGLTestView method createPartControl.
/**
* {@inheritDoc}
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
String strVersion = getFeatureVersion("org.lwjgl");
this.setPartName("org.lwjgl " + strVersion);
IStatusLineManager statusLine = this.getViewSite().getActionBars().getStatusLineManager();
fpsstatuslineitem = new FpsStatusLineItem();
statusLine.add(fpsstatuslineitem);
GLData data = new GLData();
data.doubleBuffer = true;
canvas = new GLCanvas(parent, SWT.NONE, data);
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException e) {
e.printStackTrace();
}
canvas.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
Rectangle bounds = canvas.getBounds();
float fAspect = (float) bounds.width / (float) bounds.height;
canvas.setCurrent();
try {
GLContext.useContext(canvas);
} catch (LWJGLException e) {
e.printStackTrace();
}
GL11.glViewport(0, 0, bounds.width, bounds.height);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
}
});
GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glColor3f(1.0f, 0.0f, 0.0f);
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
GL11.glClearDepth(1.0);
GL11.glLineWidth(2);
GL11.glEnable(GL11.GL_DEPTH_TEST);
Display.getCurrent().asyncExec(initRunnable());
}
Aggregations