Example usage for com.google.gwt.user.client.ui HasVisibility setVisible

List of usage examples for com.google.gwt.user.client.ui HasVisibility setVisible

Introduction

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

Prototype

void setVisible(boolean visible);

Source Link

Document

Sets whether this object is visible.

Usage

From source file:com.qualogy.qafe.mgwt.client.vo.functions.execute.SetPropertyExecute.java

License:Apache License

private void setProperty(SetPropertyGVO setPropertyGVO, UIObject widget) {
    if (widget == null) {
        return;/*from  w  ww  .  j av  a2 s  .c om*/
    }
    String propertyName = setPropertyGVO.getProperty();
    if (QAMLConstants.PROPERTY_VISIBLE.equals(propertyName)) {
        if (widget instanceof HasVisibility) {
            boolean visible = Boolean.valueOf(setPropertyGVO.getValue());
            HasVisibility hasVisibility = (HasVisibility) widget;
            hasVisibility.setVisible(visible);
        }
    } else if (QAMLConstants.PROPERTY_EDITABLE.equals(propertyName)) {
        if (widget instanceof IsEditable) {
            boolean editable = Boolean.valueOf(setPropertyGVO.getValue());
            IsEditable isEditable = (IsEditable) widget;
            isEditable.setEditable(editable);
        }
    } else if (QAMLConstants.PROPERTY_ENABLED.equals(propertyName)) {
        if (widget instanceof HasEnabled) {
            boolean enabled = Boolean.valueOf(setPropertyGVO.getValue());
            HasEnabled hasEnabled = (HasEnabled) widget;
            hasEnabled.setEnabled(enabled);
        }
    } else if (QAMLConstants.PROPERTY_HEIGHT.equals(propertyName)) {
        String height = setPropertyGVO.getValue();
        widget.setHeight(height);
    } else if (QAMLConstants.PROPERTY_WIDTH.equals(propertyName)) {
        String width = setPropertyGVO.getValue();
        widget.setWidth(width);
    } else if (QAMLConstants.PROPERTY_DISPLAYNAME.equals(propertyName)) {
        if (widget instanceof HasDisplayname) {
            HasDisplayname hasDisplayname = (HasDisplayname) widget;
            hasDisplayname.setDisplayname(setPropertyGVO.getValue());
        }
    } else if (QAMLConstants.PROPERTY_SELECTED.equals(propertyName)) {
        if (widget instanceof HasSelection) {
            HasSelection hasSelection = (HasSelection) widget;
            hasSelection.setSelected(setPropertyGVO.getValue());
        }
    } else if (QAMLConstants.PROPERTY_SELECTED_ROW.equals(propertyName)) {
        if (widget instanceof HasIndexSelection) {
            int selectedIndex = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasIndexSelection hasIndexSelection = (HasIndexSelection) widget;
            hasIndexSelection.setSelectedIndex(selectedIndex);
        }
    } else if (QAMLConstants.PROPERTY_CURRENT_PAGE.equals(propertyName)) {
        if (widget instanceof HasPaging) {
            int currentPage = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasPaging hasPaging = (HasPaging) widget;
            hasPaging.setCurrentPage(currentPage);
        }
    } else if (QAMLConstants.PROPERTY_PAGESIZE.equals(propertyName)) {
        if (widget instanceof HasPaging) {
            int pageSize = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasPaging hasPaging = (HasPaging) widget;
            hasPaging.setPageSize(pageSize);
        }
    } else if (QAMLConstants.PROPERTY_MIN_TICKS.equals(propertyName)) {
        if (widget instanceof HasRange) {
            int minValue = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasRange hasRange = (HasRange) widget;
            hasRange.setMinValue(minValue);
        }
    } else if (QAMLConstants.PROPERTY_MAX_TICKS.equals(propertyName)) {
        if (widget instanceof HasRange) {
            int maxValue = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasRange hasRange = (HasRange) widget;
            hasRange.setMaxValue(maxValue);
        }
    } else if (QAMLConstants.PROPERTY_TICKSIZE.equals(propertyName)) {
        if (widget instanceof HasRange) {
            int stepValue = QAMLUtil.toInteger(setPropertyGVO.getValue());
            HasRange hasRange = (HasRange) widget;
            hasRange.setStepValue(stepValue);
        }
    } else if (QAMLConstants.PROPERTY_TICK_LABELS.equals(propertyName)) {
        // Do nothing
    }
}

From source file:com.qualogy.qafe.mgwt.client.vo.functions.execute.ToggleExecute.java

License:Apache License

private void toggle(ToggleGVO toggleGVO, WindowActivity activity) {
    List<BuiltInComponentGVO> builtInComponents = toggleGVO.getComponents();
    if (builtInComponents == null) {
        return;//w  ww. j a v  a  2  s  . co  m
    }
    for (BuiltInComponentGVO builtInComponentGVO : builtInComponents) {
        List<UIObject> widgets = getWidgets(builtInComponentGVO, activity);
        if (QAMLUtil.isEmpty(widgets)) {
            continue;
        }
        for (UIObject widget : widgets) {
            if (widget instanceof HasVisibility) {
                HasVisibility hasVisibility = (HasVisibility) widget;
                boolean visible = hasVisibility.isVisible();
                hasVisibility.setVisible(!visible);
            }
        }
    }
}