本文整理汇总了Java中com.google.gwt.user.client.ui.TextBoxBase类的典型用法代码示例。如果您正苦于以下问题:Java TextBoxBase类的具体用法?Java TextBoxBase怎么用?Java TextBoxBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextBoxBase类属于com.google.gwt.user.client.ui包,在下文中一共展示了TextBoxBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focus
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
private boolean focus(int row, int col) {
if (!getRowFormatter().isVisible(row) || col >= getCellCount(row)) return false;
Widget w = super.getWidget(row, col);
if (w == null || !w.isVisible()) return false;
if (w instanceof SmartTableCell) {
return ((SmartTableCell)w).focus();
} else if (w instanceof HasFocus) {
return ((HasFocus)w).focus();
} else if (w instanceof Focusable) {
((Focusable)w).setFocus(true);
if (w instanceof TextBoxBase)
((TextBoxBase)w).selectAll();
return true;
}
return false;
}
示例2: insertStringIntoTextBoxWrapper
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
/**
* This method should be basically called from the void addSmileStringToMessage( final String ); method of SmileSelectionDialogUI.SmileySelectionTarget
* @param stringToInsert the string to insert
* @param wrapper the wrapper object containing the text box base object into which we insert the smiley code
*/
public static void insertStringIntoTextBoxWrapper( final String stringToInsert, final TextBaseTranslitAndProgressBar wrapper ) {
final TextBoxBase textObj = wrapper.getWrappedTextBoxBaseObj();
//If the text box base is not null, is enabled and is not read-only
if( textObj != null && textObj.isEnabled() && ! textObj.isReadOnly() ) {
if( BrowserDetect.getBrowserDetect().isMSExplorer() ) {
//In IE8 if we work with the TextBox then the cursor position
//is set wrongly, unless the text object has focus in it.
textObj.setFocus(true);
}
final int currentCursorPos = textObj.getCursorPos();
final String currentMessageText = textObj.getText();
textObj.setText( currentMessageText.substring(0, currentCursorPos) + stringToInsert +
currentMessageText.substring(currentCursorPos, currentMessageText.length() ) );
textObj.setCursorPos( currentCursorPos + stringToInsert.length() );
//Force the progress bar update
wrapper.setFocusAndUpdate();
}
}
示例3: bindTransliterator
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
/**
* Allows to bind the transliterator to the TextBoxBase object
* @param bind if true then we want to bing the transliterator to the new textObject
* @param textObject to bind the transliterator to or null if bind==false
* @param progressBar the progress bar binded to this text box base element or null
*/
public static void bindTransliterator( final boolean bind, final TextBoxBase textObject,
final TextMaximumSizeProgress progressBar ) {
//First un-bind the old object if any
if( keyPressHandler != null ) {
keyPressHandler.removeHandler();
keyPressHandler = null;
}
if( Transliterator.textObject != null ) {
Transliterator.textObject = null;
}
bindedProgressBar = null;
//Now if we want to bind a new object then do it
if( bind ) {
bindedProgressBar = progressBar;
Transliterator.textObject = textObject;
keyPressHandler = Transliterator.textObject.addKeyPressHandler( new Transliterator() );
}
}
示例4: NewTextFieldWidget
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public NewTextFieldWidget(AttributeValue value) {
super(value.getLabel());
value.setWidget(this);
super.setText(value.getStringValue());
this.value = value;
setRequired(value.getCtrl().isRequiered());
addKeyboardListener(this);
setConvertToUpper(false);
if (value.getCtrl().isReadonly()) {
baseField.setStyleName("mdv-form-input-readonly");
((TextBoxBase)baseField).setReadOnly(true);
((TextBoxBase)baseField).setTitle(value.getStringValue());
setRequired(false);
}
}
示例5: NewTextAreaFieldWidget
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public NewTextAreaFieldWidget(AttributeValue value) {
super(value.getLabel());
this.value = value;
TextAttributeControl txtCtrl = (TextAttributeControl)this.value.getCtrl();
field.setVisibleLines(txtCtrl.getLines().intValue());
field.setText(this.value.getStringValue());
addKeyboardListener(this);
if (value.getCtrl().isReadonly()) {
baseField.setStyleName("mdv-form-input-readonly");
((TextBoxBase)baseField).setReadOnly(true);
((TextBoxBase)baseField).setTitle(value.getStringValue());
setRequired(false);
}
}
示例6: createCurPageBox
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
/**
* Create a box that holds the current page.
*/
private void createCurPageBox() {
// Setup the widget
curPageBox.setWidth("3em");
curPageBox.setText("1");
curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
// Disallow non-numeric pages
KeyPressHandler handler = new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
int keyCode = event.getNativeEvent().getKeyCode();
char charCode = event.getCharCode();
if (keyCode == KeyCodes.KEY_ENTER) {
PagingPanel.this.table.gotoPage(getPagingBoxValue(), false);
} else if (charCode != 0 && !Character.isDigit(charCode)) {
curPageBox.cancelKey();
}
}
};
// Add the handler
curPageBox.addKeyPressHandler(handler);
}
示例7: listenTo
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public void listenTo(TextBoxBase tb) {
strings.put(tb, tb.getText().trim());
tb.addKeyPressHandler(this);
// Is there another way to capture middle button X11 pastes in browsers
// which do not yet support ONPASTE events (Firefox)?
tb.addMouseUpHandler(this);
// Resetting the "original text" on focus ensures that we are
// up to date with non-user updates of the text (calls to
// setText()...) and also up to date with user changes which
// occurred after enabling "widget".
tb.addFocusHandler(
new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
strings.put(tb, tb.getText().trim());
}
});
// CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
// KeyDownEvents, the latter is better.
tb.addKeyDownHandler(this);
}
示例8: onTextBoxBase
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
private void onTextBoxBase(TextBoxBase tb) {
// The text appears to not get updated until the handlers complete.
Scheduler.get()
.scheduleDeferred(
new ScheduledCommand() {
@Override
public void execute() {
String orig = strings.get(tb);
if (orig == null) {
orig = "";
}
if (!orig.equals(tb.getText().trim())) {
widget.setEnabled(true);
}
}
});
}
示例9: createCurPageBox
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
/**
* Create a box that holds the current page.
*/
private void createCurPageBox() {
// Setup the widget
curPageBox.setWidth("3em");
curPageBox.setText("1");
curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
// Disallow non-numeric pages
KeyPressHandler handler = new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
char charCode = event.getCharCode();
if (charCode == KeyCodes.KEY_ENTER) {
QPagingOptions.this.table.gotoPage(getPagingBoxValue(), false);
} else if (!Character.isDigit(charCode) && (charCode != KeyCodes.KEY_TAB) && (charCode != KeyCodes.KEY_BACKSPACE) && (charCode != KeyCodes.KEY_DELETE) && (charCode != KeyCodes.KEY_ENTER) && (charCode != KeyCodes.KEY_HOME) && (charCode != KeyCodes.KEY_END) && (charCode != KeyCodes.KEY_LEFT) && (charCode != KeyCodes.KEY_UP) && (charCode != KeyCodes.KEY_RIGHT) && (charCode != KeyCodes.KEY_DOWN)) {
curPageBox.cancelKey();
}
}
};
// Add the handler
curPageBox.addKeyPressHandler(handler);
}
示例10: handleTypeAttribute
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
protected void handleTypeAttribute(UIObject uiObject, final String regExp, final String validationMessage, final String validationTitle) {
if (uiObject instanceof TextBox) {
TextBox textBox = (TextBox)uiObject;
textBox.addBlurHandler(new BlurHandler(){
public void onBlur(BlurEvent event) {
String textValue = ((TextBoxBase)event.getSource()).getText();
if ((textValue != null) && (regExp != null)) {
if (textValue.replaceFirst(regExp, "").length() > 0) {
if (validationTitle != null) {
ClientApplicationContext.getInstance().log(validationTitle, validationMessage,true);
} else {
ClientApplicationContext.getInstance().log("Validation error", validationMessage,true);
}
}
}
}
});
}
}
示例11: handleEditable
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
private void handleEditable(UIObject uiObject, String propertyValue) {
boolean editable = Boolean.valueOf(propertyValue).booleanValue();
HasEditable hasEditable = null;
if (uiObject instanceof HasEditable) {
hasEditable = (HasEditable)uiObject;
} else if (uiObject instanceof TextBoxBase) {
TextBoxBase textboxBase = (TextBoxBase)uiObject;
if (textboxBase.getParent() instanceof HasEditable) {
hasEditable = (HasEditable)textboxBase.getParent();
} else {
textboxBase.setReadOnly(!editable);
}
}
if (hasEditable != null) {
hasEditable.setEditable(editable);
}
}
示例12: NewPasswordFieldWidget
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public NewPasswordFieldWidget(AttributeValue value) {
super(value.getLabel());
setText(value.getStringValue());
this.value = value;
addKeyboardListener(this);
setRequired(value.getCtrl().isRequiered());
if (value.getCtrl().isReadonly()) {
baseField.setStyleName("mdv-form-input-readonly");
((TextBoxBase)baseField).setReadOnly(true);
setRequired(false);
}
}
示例13: StringMinLengthValidator
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public StringMinLengthValidator(TextBoxBase text, boolean preventsPropagationOfValidationChain, String customMsgKey) {
super();
this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
if (text == null)
throw new IllegalArgumentException("text must not be null");
this.text = text;
this.setCustomMsgKey(customMsgKey);
}
示例14: StringGtValidator
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public StringGtValidator(TextBoxBase text, boolean preventsPropagationOfValidationChain, String customMsgKey) {
super();
this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
if (text == null)
throw new IllegalArgumentException("text must not be null");
this.text = text;
this.setCustomMsgKey(customMsgKey);
}
示例15: StringLtValidator
import com.google.gwt.user.client.ui.TextBoxBase; //导入依赖的package包/类
public StringLtValidator(TextBoxBase text, boolean preventsPropagationOfValidationChain, String customMsgKey) {
super();
this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
if (text == null)
throw new IllegalArgumentException("text must not be null");
this.text = text;
this.setCustomMsgKey(customMsgKey);
}