Java 类com.google.gwt.user.client.ui.TextBoxBase 实例源码

项目:unitimes    文件:UniTimeTable.java   
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;
}
项目:x-cure-chat    文件:TextBaseTranslitAndProgressBar.java   
/**
 * 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();
    }
}
项目:x-cure-chat    文件:Transliterator.java   
/**
 * 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() );
    }
}
项目:onecmdb    文件:NewTextFieldWidget.java   
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);
    }

}
项目:onecmdb    文件:NewTextAreaFieldWidget.java   
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);
    }

}
项目:firefly    文件:PagingPanel.java   
/**
 * 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);
}
项目:gerrit    文件:OnEditEnabler.java   
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);
}
项目:gerrit    文件:OnEditEnabler.java   
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);
              }
            }
          });
}
项目:unitime    文件:UniTimeTable.java   
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;
}
项目:qafe-platform    文件:QPagingOptions.java   
/**
 * 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);
}
项目:qafe-platform    文件:LabeledTextFieldWidget.java   
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);
                        }
                    }                       
                }                   
            }
        });
    }       
}
项目:qafe-platform    文件:SetPropertyHandler.java   
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);
    }
}
项目:OneCMDBwithMaven    文件:NewPasswordFieldWidget.java   
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);
    }

}
项目:OneCMDBwithMaven    文件:NewTextFieldWidget.java   
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);
    }

}
项目:OneCMDBwithMaven    文件:NewTextAreaFieldWidget.java   
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);
    }

}
项目:unitimes    文件:UniTimeTable.java   
public boolean focus() {
    if (getWidget() instanceof HasFocus) {
        return ((HasFocus)getWidget()).focus();
    } else if (getWidget() instanceof Focusable) {
        ((Focusable)getWidget()).setFocus(true);
        if (getWidget() instanceof TextBoxBase)
            ((TextBoxBase)getWidget()).selectAll();
        return true;
    }
    return false;
}
项目:document-management-system    文件:StringMinLengthValidator.java   
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);
}
项目:document-management-system    文件:StringMinLengthValidator.java   
public StringMinLengthValidator(TextBoxBase text, int min, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new IllegalArgumentException("text must not be null");
    this.text = text;
    setMin(min);
    this.setCustomMsgKey(customMsgKey);
}
项目:document-management-system    文件:StringGtValidator.java   
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);
}
项目:document-management-system    文件:StringGtValidator.java   
public StringGtValidator(TextBoxBase text, String value, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new IllegalArgumentException("text must not be null");
    this.text = text;
    setVAlue(value);
    this.setCustomMsgKey(customMsgKey);
}
项目:document-management-system    文件:StringLtValidator.java   
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);
}
项目:document-management-system    文件:StringLtValidator.java   
public StringLtValidator(TextBoxBase text, String value, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new IllegalArgumentException("text must not be null");
    this.text = text;
    setValue(value);
    this.setCustomMsgKey(customMsgKey);
}
项目:document-management-system    文件:IntegerMaxValidator.java   
public IntegerMaxValidator(TextBoxBase text, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new RuntimeException("text must not be null");
    this.text = text;
    this.setCustomMsgKey(customMsgKey);
}
项目:document-management-system    文件:StringMaxLengthValidator.java   
public StringMaxLengthValidator(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);
}
项目:document-management-system    文件:StringMaxLengthValidator.java   
public StringMaxLengthValidator(TextBoxBase text, int max, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new IllegalArgumentException("text must not be null");
    this.text = text;
    setMax(max);
    this.setCustomMsgKey(customMsgKey);
}
项目:document-management-system    文件:IntegerMinValidator.java   
public IntegerMinValidator(TextBoxBase text, boolean preventsPropagationOfValidationChain, String customMsgKey) {
    super();
    this.setPreventsPropagationOfValidationChain(preventsPropagationOfValidationChain);
    if (text == null)
        throw new RuntimeException("text must not be null");
    this.text = text;
    this.setCustomMsgKey(customMsgKey);
}
项目:x-cure-chat    文件:TextMaximumSizeProgress.java   
/**
 * Allows to bind and un-bind the progress bar to the
 * text box base with the provided maximum text capacity.
 * @param bind if true the un-binds the currently binded text box and binds
 *             the new one, if false the only unbinds the text object.
 * @param textObject the text object to bind or null
 * @param maxObjectCapacity the maximum capacity of the binded object or 0
 */
public void bindProgressBar(final boolean bind, final TextBoxBase textObject, final int maxObjectCapacity) {
    //Un-bind the old text box base object if any
    Iterator<HandlerRegistration> iter = handlerRegistrations.iterator();
    while( iter.hasNext() ) {
        iter.next().removeHandler();
    }
    handlerRegistrations.clear();
    if( this.textObject != null ) {
        this.textObject = null;
    }
    MAX_TEXT_OBJECT_SYMB_CAPACITY = 0;

    //Bind the parameters
    if( bind ) {
        //Bind the new elements
        this.textObject = textObject;
        //Register handlers and store their registrations
        handlerRegistrations.add( textObject.addKeyPressHandler( this ) );
        handlerRegistrations.add( textObject.addKeyUpHandler( this ) );
        handlerRegistrations.add( textObject.addKeyDownHandler( this ) );
        //Store the maximum capacity object
        MAX_TEXT_OBJECT_SYMB_CAPACITY = maxObjectCapacity;
        //Re-initialize the progress bar
        isProgressBarInitialized = false;
        forceProgressUpdate();
    }
}
项目:x-cure-chat    文件:TextBaseTranslitAndProgressBar.java   
/**
 * Allows to bind and unbind the progress bar from the text box base objects
 * @param bind if true then first unbinds the old object and then binds the new one
 *             if false then just unbinds the old object.
 * @param textObject the new text box base to bind the progress bar with or null for bind==false
 * @param maxObjectCapacity the maximum capacity of the provided text box base or 0 for bind==false
 * @param progressBarPanel the panel that will store the progress bar or null for bind==false
 * @param placeHolder the place holder that will be substituted with the progress bar or null for bind==false
 */
private static void bindProgressBar( final boolean bind, final TextBoxBase textObject,
                                     final int maxObjectCapacity,
                                     final VerticalPanel progressBarPanel,
                                     final SimplePanel placeHolder ) {
    //First remove the old bindings if any
    if( bondedProgressBarPanel != null ) {
        bondedProgressBarPanel.remove( progressBar );
        bondedProgressBarPanel.add( bindedProgBarPlaceHolder );
        bondedProgressBarPanel = null;
        bindedProgBarPlaceHolder = null;
    }

    //Do new bindings
    if( bind ) {
        if( progressBarPanel != null ) {
            progressBarPanel.remove( placeHolder );
            progressBarPanel.add( progressBar );
            /*Remove the panel from the tabulation sequence*/
            progressBar.setTabIndex(-1);
        } 
        bindedProgBarPlaceHolder = placeHolder;
        bondedProgressBarPanel = progressBarPanel;
    }

    //Then bind the new object or finish un-binding the old one
    progressBar.bindProgressBar(bind, textObject, maxObjectCapacity);
}
项目:onecmdb    文件:NewPasswordFieldWidget.java   
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);
    }

}
项目:onecmdb    文件:NewTextListFieldWidget.java   
public NewTextListFieldWidget(AttributeValue value) {
    super(value.getLabel());
    this.value = value;
    this.value.setWidget(this);

    field.addChangeListener(this);
    if (this.value.getCtrl() instanceof TextAttributeControl) {
        TextAttributeControl tCtrl =  (TextAttributeControl)this.value.getCtrl();
        List values = tCtrl.getAvailableValues();
        if (values != null) {
            for (Iterator iter = values.iterator(); iter.hasNext();) {
                Object enumValue = iter.next();
                addItem(enumValue.toString());
            }
            if (value.isNullValue()) {
                if (values.size() > 0) {
                    setSelectedValue(values.get(0).toString());
                    this.value.setValue(values.get(0).toString());
                }
            } else {
                setSelectedValue(value.getStringValue());
            }
    }

    }

    setRequired(value.getCtrl().isRequiered());
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }

}
项目:onecmdb    文件:NewDateTimeFieldWidget.java   
public NewDateTimeFieldWidget(AttributeValue value) {
    super(value.getLabel(), "####-##-##T##:##:##");
    this.value = value;
    addKeyboardListener(this);
    setText(value.getStringValue());
    setRequired(value.getCtrl().isRequiered());
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }

}
项目:onecmdb    文件:NewIntegerFieldWidget.java   
public NewIntegerFieldWidget(AttributeValue value) {
    super(value.getLabel());
    this.value = value;
    setText(value.getStringValue());
    setRequired(value.getCtrl().isRequiered());
    addKeyboardListener(this);
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }
}
项目:onecmdb    文件:NewDateFieldWidget.java   
public NewDateFieldWidget(AttributeValue value) {
    super(value.getLabel(), "####-##-##");
    this.value = value;
    setText(value.getStringValue());
    addKeyboardListener(this);
    setRequired(value.getCtrl().isRequiered());
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }

}
项目:firefly    文件:PagingOptions.java   
/**
* 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) {
                PagingOptions.this.imageGridPanel.getImageGrid().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);
}
项目:gerrit    文件:OnEditEnabler.java   
private void on(GwtEvent<?> e) {
  if (widget.isEnabled()
      || !(e.getSource() instanceof FocusWidget)
      || !((FocusWidget) e.getSource()).isEnabled()) {
    if (e.getSource() instanceof ValueBoxBase) {
      final TextBoxBase box = ((TextBoxBase) e.getSource());
      Scheduler.get()
          .scheduleDeferred(
              new ScheduledCommand() {
                @Override
                public void execute() {
                  if (box.getValue().trim().equals(originalValue)) {
                    widget.setEnabled(false);
                  }
                }
              });
    }
    return;
  }

  if (e.getSource() instanceof TextBoxBase) {
    onTextBoxBase((TextBoxBase) e.getSource());
  } else {
    // For many widgets, we can assume that a change is an edit. If
    // a widget does not work that way, it should be special cased
    // above.
    widget.setEnabled(true);
  }
}
项目:unitime    文件:UniTimeTable.java   
public boolean focus() {
    if (getWidget() instanceof HasFocus) {
        return ((HasFocus)getWidget()).focus();
    } else if (getWidget() instanceof Focusable) {
        ((Focusable)getWidget()).setFocus(true);
        if (getWidget() instanceof TextBoxBase)
            ((TextBoxBase)getWidget()).selectAll();
        return true;
    }
    return false;
}
项目:qafe-platform    文件:RegExpValidateHandler.java   
/**
 * 
 * @param validateGVO
 * @param sender
 * @param appId
 * @param windowId
 * @param eventSessionId
 * @param derivedBuiltIns
 * @return
 */
private BuiltInState handleValidate(RegExpValidateGVO validateGVO,
        UIObject sender, String appId, String windowId,
        String eventSessionId, Queue derivedBuiltIns) {
    for (BuiltInComponentGVO builtInComponentGVO : validateGVO
            .getComponents()) {
        String componentId = builtInComponentGVO.getComponentId();
        String componentUUID = generateId(componentId, windowId, appId,
                eventSessionId);
        List<UIObject> uiObjects = getUIObjects(componentUUID);
        if (uiObjects == null) {
            continue;
        }
        for (UIObject uiObject : uiObjects) {
            if (!(uiObject instanceof TextBoxBase)) {
                continue;
            }
            String textValue = ((TextBoxBase) uiObject).getText();
            if (textValue == null) {
                continue;
            }
            String expression = validateGVO.getRegExp();
            if (!matchExpression(textValue, expression)) {
                String message = validateGVO.getMessage();
                showMessage("Validation error", message);
                return BuiltInState.TERMINATE;
            }
        }
    }
    return BuiltInState.EXECUTED;
}
项目:qafe-platform    文件:RegExpValidateExecute.java   
public void execute(BuiltInFunctionGVO builtInFunction) {
    if (builtInFunction instanceof RegExpValidateGVO) {
        RegExpValidateGVO regExpValidate = (RegExpValidateGVO)builtInFunction;
        if (builtInFunction.getComponents() != null) {
            for (BuiltInComponentGVO builtInComponentGVO : builtInFunction.getComponents()) {


                String component = builtInComponentGVO.getComponentIdUUID();
                List<UIObject> uiObjects = null;
                if (component!=null){ 
                        uiObjects = RendererHelper.getComponent(component);                         
                } else {
                    uiObjects = RendererHelper.getNamedComponent(builtInComponentGVO.getComponentName());
                }
                if (uiObjects!=null){
                    for (UIObject uiObject : uiObjects) {


                    if (uiObject!=null && uiObject instanceof TextBoxBase){
                        String textValue=  ((TextBoxBase)uiObject).getText();
                        if (textValue!=null){

                            if (textValue.replaceFirst(regExpValidate.getRegExp(), "").length()>0){

                                 ClientApplicationContext.getInstance().log("Validation error", regExpValidate.getMessage(),true);
                            }

                        }
                    }
                    }
                }                   
            }
        }
    }
    FunctionsExecutor.setProcessedBuiltIn(true);

}
项目:OneCMDBwithMaven    文件:NewTextListFieldWidget.java   
public NewTextListFieldWidget(AttributeValue value) {
    super(value.getLabel());
    this.value = value;
    this.value.setWidget(this);

    field.addChangeListener(this);
    if (this.value.getCtrl() instanceof TextAttributeControl) {
        TextAttributeControl tCtrl =  (TextAttributeControl)this.value.getCtrl();
        List values = tCtrl.getAvailableValues();
        if (values != null) {
            for (Iterator iter = values.iterator(); iter.hasNext();) {
                Object enumValue = iter.next();
                addItem(enumValue.toString());
            }
            if (value.isNullValue()) {
                if (values.size() > 0) {
                    setSelectedValue(values.get(0).toString());
                    this.value.setValue(values.get(0).toString());
                }
            } else {
                setSelectedValue(value.getStringValue());
            }
    }

    }

    setRequired(value.getCtrl().isRequiered());
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }

}
项目:OneCMDBwithMaven    文件:NewDateTimeFieldWidget.java   
public NewDateTimeFieldWidget(AttributeValue value) {
    super(value.getLabel(), "####-##-##T##:##:##");
    this.value = value;
    addKeyboardListener(this);
    setText(value.getStringValue());
    setRequired(value.getCtrl().isRequiered());
    if (value.getCtrl().isReadonly()) {
        baseField.setStyleName("mdv-form-input-readonly");
        ((TextBoxBase)baseField).setReadOnly(true);
        setRequired(false);
    }

}