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.qualogy.qafe.gwt.client.vo.handlers.BuiltinHandlerHelper.java

License:Apache License

private static void processNamedComponent(Widget widget, DataMap dataMap, final UIObject sender,
        String groupName) throws RequiredFieldException {
    UIObject uiObject = widget;
    if (widget instanceof TitledComponent) {
        uiObject = ((TitledComponent) widget).getDataComponent();
    }//from w w w  .  j a va  2s .  c  o m

    if (RendererHelper.isNamedComponent(uiObject)) {
        String name = RendererHelper.getNamedComponentName(uiObject);
        String value = null;
        boolean valueOnly = false;
        if (uiObject instanceof ListBox) {
            valueOnly = true;
        }

        DataContainerGVO data = new DataContainerGVO();

        Object valueObject = getValue(uiObject, sender, valueOnly, groupName);

        if (valueObject instanceof String) {
            value = String.valueOf(valueObject);
            if (uiObject instanceof QDatePicker) {
                data.setKind(DataContainerGVO.KIND_STRING);
                data.setStringDataType(DataContainerGVO.TYPE_DATE);
                data.setDateData(((QDatePicker) uiObject).getValue());
            } else {
                data.setKind(DataContainerGVO.KIND_STRING);
                data.setDataString(value);
                /**
                 * 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 for setting datacontainer gvo type. 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);
                if (TextFieldGVO.TYPE_DOUBLE.equals(type)) {
                    data.setStringDataType(DataContainerGVO.TYPE_DOUBLE);
                } else if (TextFieldGVO.TYPE_INTEGER.equals(type)) {
                    data.setStringDataType(DataContainerGVO.TYPE_INT);
                } else {
                    data.setStringDataType(DataContainerGVO.TYPE_STRING);
                }
            }
        } else if (valueObject instanceof DataContainerGVO) {
            data = (DataContainerGVO) valueObject;
        }

        if (dataMap.containsKey(name)) {
            // If value already exists, override the existing value when
            // null or new value is not null,
            // this case can occur when multiple components are added with
            // the same name, like TextArea
            Object oldData = dataMap.get(name);
            if ((oldData == null) || (data != null)) {
                dataMap.put(name, data);
            }
        } else {
            dataMap.put(name, data);
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.vo.handlers.ChangeStyleHandler.java

License:Apache License

private void changeStyle(ChangeStyleGVO changeStyleGVO, UIObject sender, String appId, String windowId,
        String eventSessionId) {//from  ww  w  . ja va  2s  .  com
    List<BuiltInComponentGVO> components = changeStyleGVO.getComponents();
    if (components == null) {
        return;
    }

    for (BuiltInComponentGVO builtInComponentGVO : components) {
        List<UIObject> uiObjects = getUIObjects(builtInComponentGVO, appId, windowId, eventSessionId);

        if (uiObjects == null) { // Components within a window are not found. Check for SDI.
            uiObjects = checkSDIMode(uiObjects);
        }

        if (uiObjects == null) {
            continue;
        }

        for (UIObject object : uiObjects) {
            if (object == null) {
                continue;
            }

            if (object instanceof QWindowPanel) {
                object = ((QWindowPanel) object).getQRootPanel();
            }
            Element element = object.getElement();
            if (element == null) {
                continue;
            }

            List<ChangeStyleActionGVO> actions = changeStyleGVO.getActions();
            if (actions == null) {
                continue;
            }

            handleChangeStyle(object, element, actions);
        }
    }
}

From source file:com.qualogy.qafe.gwt.client.vo.handlers.SetPropertyHandler.java

License:Apache License

private void handleEnabled(UIObject uiObject, String propertyValue, String propertyType) {
    boolean value = Boolean.valueOf(propertyValue).booleanValue();
    if (QAMLConstants.PROPERTY_DISABLED.equals(propertyType)) {
        value = !value;//ww  w . j a  v a 2 s.  co m
    }
    if (uiObject instanceof HasEnabled) {
        HasEnabled hasEnabled = (HasEnabled) uiObject;
        hasEnabled.setEnabled(value);
    } else if (uiObject instanceof HasWidgets) {
        SetMaskHelper.setMaskEnable(uiObject.getElement().getAttribute(QAMLConstants.PROPERTY_ID), value, true);
        DOM.setElementPropertyBoolean(uiObject.getElement(), QAMLConstants.PROPERTY_DISABLED, !value);
    } else if (uiObject instanceof QSuggestBox) {
        QSuggestBox suggestField = (QSuggestBox) uiObject;
        suggestField.getTextBox().setEnabled(value);
    } else if (uiObject instanceof SpreadsheetCell) {
        SpreadsheetCell cell = (SpreadsheetCell) uiObject;
        cell.setEditable(value);
    }
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static void setStyle(UIObject widget, String styleClass, String[][] inlineStyles) {
    List<UIObject> styleWidgets = getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        setStyle(styleWidget.getElement(), styleClass, inlineStyles);
    }/*  w  w w.j  av a  2s .c o m*/
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static void setStyle(UIObject widget, String attribute, String value) {
    List<UIObject> styleWidgets = getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        setStyle(styleWidget.getElement(), attribute, value);
    }/*from   w  w w. ja  v a  2s.  c om*/
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static void setStyle(UIObject widget, String style) {
    List<UIObject> styleWidgets = getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        setStyle(styleWidget.getElement(), style);
    }//from  w  ww  . j  ava 2  s.com
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static void addStyle(UIObject widget, String style) {
    List<UIObject> styleWidgets = getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        addStyle(styleWidget.getElement(), style);
    }/*from  w  w  w  .j  a v a2  s .c  om*/
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static void removeStyle(UIObject widget, String style) {
    List<UIObject> styleWidgets = getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        removeStyle(styleWidget.getElement(), style);
    }/*  w w  w. j  a v  a 2  s  .c  om*/
}

From source file:com.qualogy.qafe.mgwt.client.ui.component.ComponentHelper.java

License:Apache License

public static boolean isScrolledToBottom(UIObject source) {
    Element element = source.getElement();
    int pageClientHeight = element.getOwnerDocument().getClientHeight();
    int clientHeight = element.getClientHeight();
    if (clientHeight > pageClientHeight) {
        int delta = clientHeight - pageClientHeight;

        // When scrolling down the absoluteTop will be negative
        int absoluteTop = element.getAbsoluteTop() * -1;
        if (absoluteTop >= delta) {
            return true;
        }/*  w  ww  .  j  a  va2s  .  com*/
    }
    return false;
}

From source file:com.qualogy.qafe.mgwt.client.ui.renderer.AbstractEditableComponentRenderer.java

License:Apache License

protected void handleConditonalStyle(EditableComponentGVO component, UIObject widget, Object value) {
    ConditionalStyleRefGVO conditionalStyleRefGVO = component.getConditionalStyleRef();
    if (conditionalStyleRefGVO == null) {
        return;//from  w w w.  j  a  va  2s .  com
    }
    List<UIObject> styleWidgets = ComponentHelper.getStyleWidgets(widget);
    for (UIObject styleWidget : styleWidgets) {
        Element element = styleWidget.getElement();
        handleConditonalStyle(component, element, value);
    }
}