use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class ExportFilterComposite method createContent.
/** 创建控件 */
private void createContent() {
setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
GridLayout gridLayout = new GridLayout(5, false);
gridLayout.horizontalSpacing = 2;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
setLayout(gridLayout);
conditionComboViewer = new ComboViewer(this, SWT.NONE | SWT.READ_ONLY);
Combo conditionCombo = conditionComboViewer.getCombo();
GridData gdConditionCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gdConditionCombo.widthHint = 200;
conditionCombo.setLayoutData(gdConditionCombo);
conditionComboViewer.setContentProvider(new ArrayContentProvider());
conditionComboViewer.setInput(filterNames);
conditionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
if (sel.isEmpty()) {
return;
}
baseDataBean.setOptionName((String) sel.getFirstElement());
handlerFilterChangedEvent();
opratorComboViewer.setInput(baseDataBean.getCurrentFilterExpressions());
// 默认选中第一个
opratorComboViewer.getCombo().select(0);
baseDataBean.setCurrentExpression(opratorComboViewer.getCombo().getText());
}
});
opratorComboViewer = new ComboViewer(this, SWT.NONE | SWT.READ_ONLY);
Combo opratorCombo = opratorComboViewer.getCombo();
GridData gd_opratorCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd_opratorCombo.widthHint = 100;
opratorCombo.setLayoutData(gd_opratorCombo);
opratorComboViewer.setContentProvider(new ArrayContentProvider());
opratorComboViewer.setInput(this.baseDataBean.getCurrentFilterExpressions());
opratorComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
if (sel.isEmpty()) {
return;
}
baseDataBean.setCurrentExpression((String) sel.getFirstElement());
}
});
dynaComposite = new Composite(this, SWT.NONE);
dynaComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout gldynaComposite = new GridLayout(1, false);
gldynaComposite.marginWidth = 0;
gldynaComposite.marginHeight = 0;
dynaComposite.setLayout(gldynaComposite);
valueText = new Text(dynaComposite, SWT.BORDER);
valueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
addButton = new Button(this, SWT.NONE);
GridData gdAddButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gdAddButton.widthHint = 25;
addButton.setLayoutData(gdAddButton);
addButton.setText("+");
addButton.addListener(SWT.Selection, this);
deleteButton = new Button(this, SWT.NONE);
GridData gdDeletebutton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gdDeletebutton.widthHint = 25;
deleteButton.setLayoutData(gdDeletebutton);
deleteButton.setText("-");
deleteButton.addListener(SWT.Selection, this);
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class ExportFilterComposite method handlerFilterChangedEvent.
/**
* 处理过滤条件发生变化时动态创建组件 ;
*/
private void handlerFilterChangedEvent() {
String optionName = baseDataBean.getOptionName();
String value = baseDataBean.getFilterVlaue();
if (optionName.equals(Messages.getString("dialog.ExportFilterComposite.creationDate")) || optionName.equals(Messages.getString("dialog.ExportFilterComposite.changeDate"))) {
if (!valueText.isDisposed()) {
valueText.dispose();
}
DateTime valueTextDateTime = new DateTime(dynaComposite, SWT.DATE | SWT.BORDER);
if (value != null) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try {
Calendar c = Calendar.getInstance();
c.setTime(df.parse(value));
valueTextDateTime.setDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE));
} catch (Exception ex) {
ex.printStackTrace();
}
}
valueText = valueTextDateTime;
} else {
if (!valueText.isDisposed()) {
valueText.dispose();
}
valueText = new Text(dynaComposite, SWT.BORDER);
if (value != null) {
((Text) valueText).setText(value);
}
}
valueText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
dynaComposite.layout(true);
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class BrowserViewPart method createSearchArea.
private Composite createSearchArea(Composite parent) {
GridLayout gridLayout = new GridLayout(3, false);
parent.setLayout(gridLayout);
GridData gd_seachArea = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
parent.setLayoutData(gd_seachArea);
keyWordForSearch = new Text(parent, SWT.SEARCH);
GridData gd_keyWordForSearch = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_keyWordForSearch.heightHint = 20;
keyWordForSearch.setLayoutData(gd_keyWordForSearch);
keyWordForSearch.setText("");
font = keyWordForSearch.getFont();
FontData fontData = font.getFontData()[0];
fontData.setStyle(fontData.getStyle());
fontData.setHeight(12);
font = new Font(Display.getDefault(), fontData);
keyWordForSearch.setFont(font);
keyWordForSearch.addKeyListener(new KeyListener() {
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) {
refreshKeyWordSearch(true);
}
}
});
Button searchBtn = new Button(parent, SWT.NONE);
searchBtn.setText(Messages.getString("Websearch.browserViewPart.searchBtnLbl"));
searchBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
searchBtn.addSelectionListener(new SelectionAdapter() {
/**
* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
refreshKeyWordSearch(true);
}
});
Button settingBtn = new Button(parent, SWT.NONE);
settingBtn.setText(Messages.getString("Websearch.browserViewPart.settingBtnLbl"));
settingBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL));
settingBtn.addSelectionListener(new SelectionAdapter() {
/**
* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), WebSearchPreferencePage.ID);
}
});
return parent;
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class AddSearchEntryDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = SWT.DEFAULT;
gridData.widthHint = 450;
container.setLayoutData(gridData);
Composite nameSetArea = new Composite(container, SWT.NONE);
GridLayout gridLayout = new GridLayout(2, false);
nameSetArea.setLayout(gridLayout);
nameSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label nameLable = new Label(nameSetArea, SWT.NONE);
GridData gd_nameLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_nameLable.widthHint = 38;
nameLable.setLayoutData(gd_nameLable);
nameLable.setText(Messages.getString("Websearch.AddSearchEntryDialog.NameLable"));
nameText = new Text(nameSetArea, SWT.BORDER);
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (style == EDIT) {
nameText.setText(searEntry.getSearchName());
}
nameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setOkState();
}
});
Composite urlSetArea = new Composite(container, SWT.NONE);
GridLayout gridLayout2 = new GridLayout(2, false);
urlSetArea.setLayout(gridLayout2);
urlSetArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label urlLable = new Label(urlSetArea, SWT.NONE);
GridData gd_urlLable = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_urlLable.widthHint = 38;
urlLable.setLayoutData(gd_urlLable);
urlLable.setText("URL");
urlText = new Text(urlSetArea, SWT.BORDER);
if (style == EDIT) {
urlText.setText(searEntry.getSearchUrl());
}
urlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
urlText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setOkState();
}
});
Composite setArea = new Composite(container, SWT.NONE);
setArea.setLayout(new GridLayout(1, true));
setArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Group group = new Group(setArea, SWT.NONE);
group.setLayout(new GridLayout(2, true));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupTitle"));
btnYesRadioButton = new Button(group, SWT.RADIO);
btnYesRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupYes"));
btnYesRadioButton.setSelection(true);
btnYesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnNoRadioButton = new Button(group, SWT.RADIO);
btnNoRadioButton.setText(Messages.getString("Websearch.AddSearchEntryDialog.GroupNo"));
btnNoRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (style == EDIT) {
btnYesRadioButton.setSelection(searEntry.isChecked());
btnNoRadioButton.setSelection(!searEntry.isChecked());
}
return container;
}
use of org.eclipse.swt.widgets.Text in project translationstudio8 by heartsome.
the class CreateColumnGroupDialog method createInputPanel.
private Composite createInputPanel(final Composite composite) {
final Composite row = new Composite(composite, SWT.NONE);
row.setLayout(new GridLayout(2, false));
final Label createLabel = new Label(row, SWT.NONE);
createLabel.setText("G&roup Name:");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(createLabel);
groupNameText = new Text(row, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(groupNameText);
groupNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
createButton.setEnabled(groupNameText.getText().length() > 0);
}
});
groupNameText.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
if (createButton.isEnabled()) {
doColumnGrouping();
}
}
});
return row;
}
Aggregations