Example usage for com.vaadin.client.communication StateChangeEvent hasPropertyChanged

List of usage examples for com.vaadin.client.communication StateChangeEvent hasPropertyChanged

Introduction

In this page you can find the example usage for com.vaadin.client.communication StateChangeEvent hasPropertyChanged.

Prototype

public boolean hasPropertyChanged(String property) 

Source Link

Document

Checks whether the give property has changed.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.button.CubaButtonConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    stopResponsePending();/*  w w w.  j  a v a2 s .  co  m*/

    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("caption")) {
        String text = getState().caption;
        if (text == null || "".equals(text)) {
            getWidget().addStyleDependentName("empty-caption");
        } else {
            getWidget().removeStyleDependentName("empty-caption");
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.colorpicker.CubaColorPickerConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("tabIndex")) {
        getWidget().setTabIndex(getState().tabIndex);
    }//ww w. j  a va2 s .  c om
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgroup.CubaFieldGroupConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("borderVisible")) {
        getWidget().setBorderVisible(getState().borderVisible);
    }//from   w ww . j a  v a 2  s .  com
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.groupbox.CubaGroupBoxConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    CubaGroupBoxWidget widget = getWidget();

    if (!widgetInitialized) {
        widget.init();/*w w  w.  j a v  a  2s.  c  om*/
        if (!getState().showAsPanel) {
            LayoutManager layoutManager = getLayoutManager();
            layoutManager.registerDependency(this, widget.captionStartDeco);
            layoutManager.registerDependency(this, widget.captionEndDeco);
            layoutManager.registerDependency(this, widget.captionTextNode);
        }

        widgetInitialized = true;
    }

    widget.setCollapsable(getState().collapsable);
    widget.setExpanded(getState().expanded);
    widget.setShowAsPanel(getState().showAsPanel);
    if (!getState().showAsPanel) {
        widget.setOuterMargin(new MarginInfo(getState().outerMarginsBitmask));
    }

    if (stateChangeEvent.hasPropertyChanged("caption")) {
        widget.captionNode.getStyle().clearWidth();
        getLayoutManager().setNeedsMeasure(this);
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.image.CubaImageConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("scaleMode")) {
        getWidget().applyScaling(getState().scaleMode);
    }/*from   w  w  w .ja v a2 s.c  om*/
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.jqueryfileupload.CubaFileUploadConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("caption")
            || stateChangeEvent.hasPropertyChanged("captionAsHtml")) {
        VCaption.setCaptionText(getWidget().submitButton.captionElement, getState());

        if ("".equals(getState().caption) || getState().caption == null) {
            getWidget().submitButton.addStyleDependentName("empty-caption");
        } else {/*from  w  ww  .  ja v  a2 s  . co  m*/
            getWidget().submitButton.removeStyleDependentName("empty-caption");
        }
    }

    if (stateChangeEvent.hasPropertyChanged("resources")) {
        if (getWidget().submitButton.icon != null) {
            getWidget().submitButton.wrapper.removeChild(getWidget().submitButton.icon.getElement());
            getWidget().submitButton.icon = null;
        }
        Icon icon = getIcon();
        if (icon != null) {
            getWidget().submitButton.icon = icon;
            if (getState().iconAltText != null) {
                icon.setAlternateText(getState().iconAltText);
            } else {
                icon.setAlternateText("");
            }

            getWidget().submitButton.wrapper.insertBefore(icon.getElement(),
                    getWidget().submitButton.captionElement);
        }
    }

    if (stateChangeEvent.hasPropertyChanged("multiSelect")) {
        getWidget().setMultiSelect(getState().multiSelect);
    }

    if (stateChangeEvent.hasPropertyChanged("iconAltText")) {
        if (getWidget().submitButton.icon != null) {
            Icon icon = getWidget().submitButton.icon;
            if (getState().iconAltText != null) {
                icon.setAlternateText(getState().iconAltText);
            } else {
                icon.setAlternateText("");
            }
        }
    }

    if (stateChangeEvent.hasPropertyChanged("progressWindowCaption")) {
        getWidget().progressWindowCaption = getState().progressWindowCaption;
    }

    if (stateChangeEvent.hasPropertyChanged("cancelButtonCaption")) {
        getWidget().cancelButtonCaption = getState().cancelButtonCaption;
    }

    if (stateChangeEvent.hasPropertyChanged("unableToUploadFileMessage")) {
        getWidget().unableToUploadFileMessage = getState().unableToUploadFileMessage;
    }

    if (stateChangeEvent.hasPropertyChanged("accept")) {
        getWidget().setAccept(getState().accept);
    }

    if (stateChangeEvent.hasPropertyChanged("fileSizeLimit")) {
        getWidget().fileSizeLimit = getState().fileSizeLimit;
    }

    if (stateChangeEvent.hasPropertyChanged("permittedExtensions")) {
        getWidget().permittedExtensions = getState().permittedExtensions;
    }

    if (stateChangeEvent.hasPropertyChanged("dropZone")) {
        ComponentConnector dropZone = (ComponentConnector) getState().dropZone;

        getWidget().setDropZone(dropZone != null ? dropZone.getWidget() : null, getState().dropZonePrompt);
    }

    if (stateChangeEvent.hasPropertyChanged("pasteZone")) {
        ComponentConnector pasteZone = (ComponentConnector) getState().pasteZone;

        getWidget().setPasteZone(pasteZone != null ? pasteZone.getWidget() : null);
    }

    if (!isEnabled() || isReadOnly()) {
        getWidget().disableUpload();
    } else {
        getWidget().enableUpload();
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.link.CubaLinkConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("rel")) {
        getWidget().setRel(getState().rel);
    }/*  w w  w  . j a  v a  2 s.  co  m*/
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.multiupload.CubaMultiUploadConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("buttonEnabled")) {
        getWidget().setButtonEnabled(getState().buttonEnabled);
    }//from  ww w .  j  av  a 2s.  c om
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.optiongroup.CubaOptionGroupConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("orientation")) {
        if (getState().orientation == OptionGroupOrientation.VERTICAL)
            getWidget().removeStyleDependentName("horizontal");
        else//from  w w w.j  av  a 2 s .c  om
            getWidget().addStyleDependentName(HORIZONTAL_ORIENTAION_STYLE);
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.popupbutton.CubaPopupButtonConnector.java

License:Apache License

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("customLayout")) {
        getWidget().customLayout = getState().customLayout;
    }/*from   ww w .  j a v  a2 s  .  co m*/
}