Example usage for com.google.gwt.dom.client InputElement setMaxLength

List of usage examples for com.google.gwt.dom.client InputElement setMaxLength

Introduction

In this page you can find the example usage for com.google.gwt.dom.client InputElement setMaxLength.

Prototype

public void setMaxLength(int maxLength) 

Source Link

Document

Maximum number of characters for text fields, when type has the value "text" or "password".

Usage

From source file:com.cgxlib.xq.client.plugins.widgets.TextBoxBaseWidgetFactory.java

License:Apache License

protected void copyAttributes(Element src, Element dest) {
    InputElement source = src.cast();/*  w  ww.jav  a  2 s .  c o m*/
    InputElement destination = dest.cast();

    destination.setAccessKey(source.getAccessKey());
    destination.setDefaultValue(source.getDefaultValue());
    destination.setDisabled(source.isDisabled());
    if (source.getMaxLength() > 0)
        destination.setMaxLength(source.getMaxLength());
    destination.setReadOnly(source.isReadOnly());
    destination.setSize(source.getSize());
    destination.setName(source.getName());
    destination.setValue(source.getValue());
}

From source file:gwtquery.plugins.enhance.client.gwt.TextBoxBaseWidgetFactory.java

License:Apache License

protected void copyAttributes(Element src, Element dest) {
    InputElement source = src.cast();//from  w w w .ja  v a  2  s . c o m
    InputElement destination = dest.cast();

    destination.setAccessKey(source.getAccessKey());
    destination.setDefaultValue(source.getDefaultValue());
    destination.setDisabled(source.isDisabled());
    if (source.getMaxLength() > 0)
        destination.setMaxLength(source.getMaxLength());
    destination.setReadOnly(source.isReadOnly());
    destination.setSize(source.getSize());
    destination.setName(source.getName());
    destination.setValue(source.getValue());

}

From source file:org.kino.client.ComboBoxWithClearBut.java

public ComboBoxWithClearBut(List<String> items) {

    ListStore<String> store = new ListStore<String>(new ModelKeyProvider<String>() {
        @Override//  www.j  ava 2  s .  c o m
        public String getKey(String item) {
            return item;
        }
    });
    store.addAll(items);

    ComboBoxCell<String> cell = new ComboBoxCell<String>(store, new StringLabelProvider<String>()) {
        @Override
        protected String selectByValue(String value) {
            String item = super.selectByValue(value);
            if (item != null)
                return item;
            return value;
        }

    };

    combo = new ComboBox<String>(cell) {

        @Override
        protected void onAfterFirstAttach() {
            super.onAfterFirstAttach();
            InputElement ie = this.getInputEl().cast();
            ie_ell = ie;
            ie.setMaxLength(30);
        }

    };
    combo.setQueryDelay(1000);

    combo.setTriggerAction(ComboBoxCell.TriggerAction.ALL);//disable annoying filter
    cont = new HBoxLayoutContainer();
    BoxLayoutContainer.BoxLayoutData flex = new BoxLayoutContainer.BoxLayoutData();
    flex.setFlex(1);
    cont.add(combo, flex);
    TextButton but_clear = new TextButton("", Resources.INSTANCE.cross_white());
    but_clear.setToolTip("? ");
    but_clear.setIconAlign(ButtonCell.IconAlign.RIGHT);
    cont.add(but_clear);

    but_clear.addSelectHandler(new SelectEvent.SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
            /// Combobox clear bug worckaround!!!!   
            clear();

        }
    });
}