Example usage for com.google.gwt.user.client.ui UIObject getElement

List of usage examples for com.google.gwt.user.client.ui UIObject getElement

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui UIObject getElement.

Prototype

public Element getElement() 

Source Link

Document

Gets a handle to the object's underlying DOM element.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.suggestionfield.menu.SuggestionsContainer.java

License:Apache License

public void clearItems() {
    selectItem(null);//from   w  w w.  j a  v a 2  s.  c om

    container.removeAllChildren();

    for (UIObject item : suggestions) {
        item.getElement().setPropertyInt("colSpan", 1);
        ((SuggestionItem) item).setSuggestionsContainer(null);
    }

    suggestions.clear();
}

From source file:com.kk_electronic.kkportal.core.util.FadeIn.java

License:Open Source License

@Override
public void onAnimationComplete() {
    for (UIObject uiObject : uiObjects) {
        DOM.setStyleAttribute(uiObject.getElement(), "opacity", "1.0");
    }//from   ww  w  . ja v a2 s .com
}

From source file:com.kk_electronic.kkportal.core.util.FadeIn.java

License:Open Source License

@Override
public void onLayout(Layer layer, double progress) {
    for (UIObject uiObject : uiObjects) {
        DOM.setStyleAttribute(uiObject.getElement(), "opacity", String.valueOf(progress));
    }// ww w . ja  va2s  .c o m
}

From source file:com.qualogy.qafe.gwt.client.component.CellRendererHelper.java

License:Apache License

private static void handleSetModifiedForValueChangeEvent(final HasDataGridMethods parentWidget,
        final DataContainerGVO rowValue, final ColumnDefinition<DataContainerGVO, String> columnDef,
        final UIObject uiObject, GwtEvent event) {
    Object value = null;/*from   w  w w  . ja  v  a2 s .co  m*/

    // TODO
    if (event instanceof ValueChangeEvent) {
        ValueChangeEvent valueChangeEvent = (ValueChangeEvent) event;
        value = valueChangeEvent.getValue();
    }

    Object source = event.getSource();
    if (source instanceof CheckBox) {
        CheckBox checkBox = (CheckBox) source;
        if ((Boolean) value) {
            String attributeValue = DOM.getElementAttribute(checkBox.getElement(),
                    CheckBoxGVO.CHECKED_VALUE_ATTRIBUTE_TAG);
            if (attributeValue != null && attributeValue.length() > 0) {
                value = attributeValue;
            }
        } else {
            String attributeValue = DOM.getElementAttribute(checkBox.getElement(),
                    CheckBoxGVO.UNCHECKED_VALUE_ATTRIBUTE_TAG);
            if (attributeValue != null && attributeValue.length() > 0) {
                value = attributeValue;
            }
        }
    } else if (source instanceof QTextField) {
        /**
         * When database column type is NUMBER(5,2) type which is accepting decimal values, If we pass string type with decimal value to the jdbc template it is giving exception.
         * So the type of the textfield should be considered.
         * This is now applicable only for textfield, same issue can come in any inputfield. But we dont have an option to set type to other components now.
         */
        String type = DOM.getElementAttribute(uiObject.getElement(), TextFieldGVO.REGEXPTYPE);
        QTextField textField = (QTextField) source;
        if (TextFieldGVO.TYPE_DOUBLE.equals(type)) {
            value = new Double(value.toString());
        } else if (TextFieldGVO.TYPE_INTEGER.equals(type)) {
            try {
                value = new Integer(value.toString());
            } catch (Exception e) {
                value = new Double(value.toString());
            }
        }
    }
    if (value == null) {
        if (source instanceof HasText) {
            HasText hasText = (HasText) source;
            value = hasText.getText();
        } else if (source instanceof HasData) {
            HasData hasData = (HasData) source;
            value = hasData.getData();
        }
    }
    handleSetModified(parentWidget, rowValue, columnDef, uiObject, value);
}

From source file:com.qualogy.qafe.gwt.client.component.ComponentRendererHelper.java

License:Apache License

private static void resetInlineStyleToOrigin(UIObject uiObject) {
    String originInlineStyle = DOM.getElementAttribute(uiObject.getElement(),
            RendererHelper.ATTRIBUTE_ORIGIN_STYLE);
    if ((originInlineStyle != null) && (originInlineStyle.length() > 0)) {
        if (originInlineStyle.equals(RendererHelper.EMPTY_VALUE)) {
            DOM.removeElementAttribute(uiObject.getElement(), RendererHelper.ATTRIBUTE_STYLE);
        } else {//  w w w. j a  v  a2s  . c  o  m
            DOM.setElementAttribute(uiObject.getElement(), RendererHelper.ATTRIBUTE_STYLE, originInlineStyle);
        }
    } else {
        originInlineStyle = DOM.getElementAttribute(uiObject.getElement(), RendererHelper.ATTRIBUTE_STYLE);
        if ((originInlineStyle == null) || (originInlineStyle.length() == 0)) {
            originInlineStyle = RendererHelper.EMPTY_VALUE;
        }
        DOM.setElementAttribute(uiObject.getElement(), RendererHelper.ATTRIBUTE_ORIGIN_STYLE,
                originInlineStyle);
    }
}

From source file:com.qualogy.qafe.gwt.client.component.ComponentRendererHelper.java

License:Apache License

private static void processConditionalInlineStyle(EditableComponentGVO component, UIObject uiObject,
        ConditionGVO condition, boolean matched, StringBuffer appliedInlineStyles) {
    if (matched && (condition.getStyle() != null)) {
        appliedInlineStyles.append(condition.getStyle() + ";");
        DOM.setElementAttribute(uiObject.getElement(), RendererHelper.ATTRIBUTE_STYLE,
                appliedInlineStyles.toString());
    }/*from   ww  w  . ja  v a2 s. c o m*/
}

From source file:com.qualogy.qafe.gwt.client.component.QRadioButton.java

License:Apache License

public String getText() {
    String returnValue = null;//w ww .j a  va 2 s.  c  om
    String key = DOM.getElementAttribute(getElement(), "id");
    List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
    if (components != null) {
        for (UIObject object : components) {
            String selected = DOM.getElementAttribute(object.getElement(), "isSelected");
            if ("true".equalsIgnoreCase(selected)) {
                returnValue = DOM.getElementAttribute(object.getElement(), "value");
            }
        }
    }
    return returnValue;
}

From source file:com.qualogy.qafe.gwt.client.component.QRadioButton.java

License:Apache License

public void setValue(String text) {
    String key = DOM.getElementAttribute(getElement(), "id");
    List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
    if (components != null) {
        for (UIObject object : components) {
            if (text != null) {
                if (text.equals(DOM.getElementAttribute(object.getElement(), "value"))) {
                    DOM.setElementAttribute(object.getElement(), "isSelected", "true");
                    if (object instanceof QRadioButton) {
                        ((QRadioButton) object).setValue(true);
                    }//from  w w  w. ja va  2  s .  com
                }
            }
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.component.QRadioButton.java

License:Apache License

public void reset() {
    setValue(false);/*from   w  w w . j a va 2 s . c  o  m*/
    String key = DOM.getElementAttribute(getElement(), "id");
    List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
    if (components == null) {
        return;
    }
    for (UIObject object : components) {
        DOM.setElementAttribute(object.getElement(), "isSelected", "false");
        if (object instanceof RadioButton) {
            RadioButton rb = (RadioButton) object;
            rb.setChecked(false);
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.component.QRadioButton.java

License:Apache License

public void onClick(ClickEvent event) {
    // Save current instance - you could just save the text to save
    // memory, but you might well want to add getters for other
    // attributes of the current instance

    if (event.getSource() instanceof RadioButton) {
        RadioButton rb = (RadioButton) event.getSource();
        String key = DOM.getElementAttribute(rb.getElement(), "id");
        if (key != null && key.length() > 0) {
            List<UIObject> components = ComponentRepository.getInstance().getComponent(key);
            for (UIObject object : components) {
                if (object == rb) {
                    DOM.setElementAttribute(object.getElement(), "isSelected", "true");
                } else {
                    DOM.setElementAttribute(object.getElement(), "isSelected", "false");
                }//  ww  w  . j av  a 2s  .  c o m
            }
        }
    }
}