本文整理匯總了Java中org.eclipse.swt.events.FocusAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java FocusAdapter類的具體用法?Java FocusAdapter怎麽用?Java FocusAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FocusAdapter類屬於org.eclipse.swt.events包,在下文中一共展示了FocusAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: open
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* Activates the editor at the given position.
*
* @param row
* @param col
* @param rect
*/
public void open(KTable table, int col, int row, Rectangle rect) {
m_Table = table;
m_Model = table.getModel();
m_Rect = rect;
m_Row = row;
m_Col = col;
if (m_Control == null) {
m_Control = createControl();
m_Control.setToolTipText(toolTip);
m_Control.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent arg0) {
close(true);
}
});
}
setBounds(m_Rect);
GC gc = new GC(m_Table);
m_Table.drawCell(gc, m_Col, m_Row);
gc.dispose();
}
示例2: edit
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
final Text text = new Text(table, SWT.NONE);
text.setText(item.getText(targetColumn));
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(final FocusEvent e) {
item.setText(targetColumn, text.getText());
text.dispose();
}
});
tableEditor.setEditor(text, item, targetColumn);
text.setFocus();
text.selectAll();
}
示例3: edit
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
final Text text = new Text(table, SWT.NONE);
text.setText(item.getText(targetColumn));
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
item.setText(targetColumn, text.getText());
text.dispose();
}
});
tableEditor.setEditor(text, item, targetColumn);
text.setFocus();
text.selectAll();
}
示例4: setupProperties
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* In a future world, this might provide access to a complete set
* of {@code ResourceDocument} properties.
*/
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
Composite result = Widgets.buildGridContainer(parent, 2);
Label label = Widgets.buildCompactLabel(result, "&Name:");
relSetName = new Text(result, SWT.BORDER | SWT.SINGLE);
relSetName.setLayoutData(Widgets.buildHorzFillData());
relSetName.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (propInfo.getName().equals(relSetName.getText())) {
return;
}
setDirtyState(true);
handleDocumentChange();
}
});
return result;
}
示例5: setupProperties
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* In a future world, this might provide access to a complete set
* of {@code ResourceDocument} properties.
*/
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
Composite result = Widgets.buildGridContainer(parent, 2);
Label label = Widgets.buildCompactLabel(result, "&Name:");
matcherName = new Text(result, SWT.BORDER | SWT.SINGLE);
matcherName.setLayoutData(Widgets.buildHorzFillData());
if (null != matcherInfo) {
matcherName.setText(matcherInfo.getName());
}
matcherName.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (matcherInfo.getName().equals(matcherName.getText())) {
return;
}
setDirtyState(true);
handleDocumentChange();
}
});
return result;
}
示例6: setupProperties
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* In a future world, this might provide access to a complete set
* of {@code ResourceDocument} properties.
* @return
*/
@SuppressWarnings("unused")
private Composite setupProperties(Composite parent) {
Composite result = Widgets.buildGridContainer(parent, 2);
Label label = Widgets.buildCompactLabel(result, "&Name:");
relSetName = new Text(result, SWT.BORDER | SWT.SINGLE);
relSetName.setLayoutData(Widgets.buildHorzFillData());
relSetName.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (relSetInfo.getName().equals(relSetName.getText())) {
return;
}
setDirtyState(true);
handleDocumentChange();
}
});
return result;
}
示例7: createDescription
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
private void createDescription(String text, Composite comp, StyleRange[] styles) {
final StyledText descLabel = new StyledText(comp, SWT.MULTI | SWT.WRAP);
descLabel.setRightMargin(10);
descLabel.setEditable(false);
descLabel.setText(text);
descLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
descLabel.addMouseListener(compositeMouseAction);
if (styles != null && styles.length > 0)
descLabel.setStyleRanges(styles);
descLabel.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setScrolledFocus();
descLabel.setSelection(0, 0);
}
});
}
示例8: edit
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
private void edit(final TableItem item, final TableEditor tableEditor) {
final Text text = new Text(table, SWT.NONE);
text.setText(item.getText(targetColumn));
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
item.setText(targetColumn, text.getText());
text.dispose();
}
});
tableEditor.setEditor(text, item, targetColumn);
text.setFocus();
text.selectAll();
}
示例9: AutoComplete
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
public AutoComplete(final ComboViewer comboViewer) {
_comboViewer = comboViewer;
final Combo combo = comboViewer.getCombo();
combo.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(final KeyEvent e) {
if (e.keyCode == SWT.DEL)
setSelection(null);
autoCompleteKeyUp(e);
}
});
combo.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(final FocusEvent arg0) {
autoCompleteLeave();
}
});
}
示例10: validEquiTxt
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* 驗證用戶輸入的加權係數的正確性
* @param equiTxt
*/
private void validEquiTxt(final Text equiTxt){
final String defaultStr = "0.50";
equiTxt.setText(defaultStr);
equiTxt.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
String textStr = equiTxt.getText().trim();
if (textStr == null || textStr.trim().length() == 0) {
equiTxt.setText(defaultStr);
}else {
String regular = "1\\.(0){0,2}|0\\.\\d{0,2}";
if (!textStr.matches(regular)) {
MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"),
Messages.getString("preference.EquivalentPage.msg5"));
equiTxt.setText(defaultStr);
}
}
}
});
}
示例11: createDialogArea
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
protected Control createDialogArea(Composite parent) {
text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP
| SWT.NO_FOCUS);
// Use the compact margins employed by PopupDialog.
GridData gd = new GridData(GridData.BEGINNING
| GridData.FILL_BOTH);
gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
text.setLayoutData(gd);
text.setText(contents);
// since SWT.NO_FOCUS is only a hint...
text.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent event) {
ContentProposalPopup.this.close();
}
});
return text;
}
示例12: buildTableLine
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* @param factory
* factory to use.
*/
protected void buildTableLine(final PluginWidgetFactory factory) {
final Control topControl = this.wConnection;
this.wlTable = factory.createRightLabel(BaseMessages.getString(PKG, "TeraFastDialog.TargetTable.Label"));
this.props.setLook(this.wlTable);
this.wlTable.setLayoutData(factory.createLabelLayoutData(topControl));
this.wTable = factory.createSingleTextVarLeft();
this.props.setLook(this.wTable);
this.wTable.setLayoutData(factory.createControlLayoutData(topControl));
this.wTable.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(final FocusEvent event) {
setTableFieldCombo();
}
});
}
示例13: createContainer
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
public Composite createContainer(Composite parent, ICallback h){
handler = h;
etf = new EnhancedTextField(parent);
etf.text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e){
if (bSaveOnFocusLost) {
if (handler != null) {
handler.save();
}
}
}
});
ike = new ExternalLink();
ike.connect(etf);
etf.setText(StringTool.leer);
return etf;
}
示例14: buildTableLine
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
/**
* @param factory
* factory to use.
*/
protected void buildTableLine( final PluginWidgetFactory factory ) {
final Control topControl = this.wConnection;
this.wlTable = factory.createRightLabel( BaseMessages.getString( PKG, "TeraFastDialog.TargetTable.Label" ) );
this.props.setLook( this.wlTable );
this.wlTable.setLayoutData( factory.createLabelLayoutData( topControl ) );
this.wTable = factory.createSingleTextVarLeft();
this.props.setLook( this.wTable );
this.wTable.setLayoutData( factory.createControlLayoutData( topControl ) );
this.wTable.addFocusListener( new FocusAdapter() {
@Override
public void focusLost( final FocusEvent event ) {
setTableFieldCombo();
}
} );
}
示例15: createValueTextarea
import org.eclipse.swt.events.FocusAdapter; //導入依賴的package包/類
protected Composite createValueTextarea(Composite parent) {
Label valueLabel = createDescription(parent, MetamodelViewsRepository.Query.Properties.value, MetamodelMessages.QueryPropertiesEditionPart_ValueLabel);
GridData valueLabelData = new GridData(GridData.FILL_HORIZONTAL);
valueLabelData.horizontalSpan = 3;
valueLabel.setLayoutData(valueLabelData);
value = SWTUtils.createScrollableText(parent, SWT.BORDER | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL);
GridData valueData = new GridData(GridData.FILL_HORIZONTAL);
valueData.horizontalSpan = 2;
valueData.heightHint = 80;
valueData.widthHint = 200;
value.setLayoutData(valueData);
value.addFocusListener(new FocusAdapter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt.events.FocusEvent)
*
*/
public void focusLost(FocusEvent e) {
if (propertiesEditionComponent != null)
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(QueryPropertiesEditionPartImpl.this, MetamodelViewsRepository.Query.Properties.value, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, value.getText()));
}
});
EditingUtils.setID(value, MetamodelViewsRepository.Query.Properties.value);
EditingUtils.setEEFtype(value, "eef::Textarea"); //$NON-NLS-1$
SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(MetamodelViewsRepository.Query.Properties.value, MetamodelViewsRepository.SWT_KIND), null); //$NON-NLS-1$
// Start of user code for createValueTextArea
// End of user code
return parent;
}