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

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

Introduction

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

Prototype

public boolean isInitialStateChange() 

Source Link

Document

Checks if the state change event is the first one for the given connector.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgrouplayout.CubaFieldGroupLayoutConnector.java

License:Apache License

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

    if (getState().useInlineCaption) {
        updateCaptionSizes();//www.j  a  v  a2 s  .c  om
    }

    if (stateChangeEvent.isInitialStateChange()) {
        this.initialStateChangePerformed = true;
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.sourcecodeeditor.CubaSourceCodeEditorConnector.java

License:Apache License

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

    if (stateChangeEvent.hasPropertyChanged("handleTabKey")) {
        getWidget().setHandleTabKey(getState().handleTabKey);
    }/*from w  ww  .  j  av a2 s.c  om*/
    if (stateChangeEvent.hasPropertyChanged("printMarginColumn")) {
        getWidget().setPrintMarginColumn(getState().printMarginColumn);
    }

    if (stateChangeEvent.isInitialStateChange()) {
        getWidget().resetEditHistory();
    }
}

From source file:org.tltv.gantt.client.GanttConnector.java

License:Apache License

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

    locale = getState().locale;// w ww .j av a  2  s.  c  o m
    timeZoneOffset = (getState().timeZoneOffset != null ? getState().timeZoneOffset : 0);
    if (stateChangeEvent.hasPropertyChanged("locale")) {
        dateTimeService = null;
    }

    final boolean changeHasInpactToSteps = stateChangeEvent.hasPropertyChanged("resolution")
            || stateChangeEvent.hasPropertyChanged("startDate")
            || stateChangeEvent.hasPropertyChanged("endDate");

    if (stateChangeEvent.hasPropertyChanged("monthRowVisible")
            || stateChangeEvent.hasPropertyChanged("yearRowVisible")
            || stateChangeEvent.hasPropertyChanged("monthFormat")
            || stateChangeEvent.hasPropertyChanged("yearFormat")
            || stateChangeEvent.hasPropertyChanged("weekFormat")
            || stateChangeEvent.hasPropertyChanged("dayFormat")) {
        notifyHeight = !stateChangeEvent.isInitialStateChange();
        getWidget().setForceUpdateTimeline();
    }
    if (!notifyHeight && stateChangeEvent.hasPropertyChanged("resolution")) {
        notifyHeight = !stateChangeEvent.isInitialStateChange();
    }

    if (stateChangeEvent.hasPropertyChanged("readOnly")) {
        getWidget().setMovableSteps(!getState().readOnly && getState().movableSteps);
        getWidget().setResizableSteps(!getState().readOnly && getState().resizableSteps);
        for (StepWidget s : getSteps()) {
            s.setReadOnly(getState().readOnly);
        }
    }

    if (stateChangeEvent.hasPropertyChanged("verticalScrollDelegateTarget")) {
        handleVerticalScrollDelegateTargetChange();
    }

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            getWidget().update(getSteps());
            if (notifyHeight) {
                getWidget().notifyHeightChanged(previousHeight);
            }
            if (changeHasInpactToSteps) {
                updateAllStepsPredecessors();
            }
            updateVerticalScrollDelegation();
            adjustDelegateTargetHeightLazily();
        }
    });
}

From source file:org.vaadin.alump.gridstack.client.GridStackLayoutConnector.java

License:Apache License

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

    Duration duration = new Duration();
    clickEventHandler.handleEventHandlerRegistration();

    if (event.isInitialStateChange() || event.hasPropertyChanged("gridStackOptions")) {
        getWidget().setOptions(getState().gridStackOptions.width, getState().gridStackOptions.height,
                getState().gridStackOptions);
    }//from   www  . j a va  2 s  .com

    LOGGER.info("onStateChange so far " + duration.elapsedMillis() + "ms");

    if (getWidget().isInitialized() && event.hasPropertyChanged("childOptions")) {
        getWidget().batchUpdate();
        for (Connector connector : getChildConnectorsInCoordinateOrder()) {
            Widget widget = ((ComponentConnector) connector).getWidget();
            getWidget().updateChild(widget, getState().childOptions.get(connector));
        }
        getWidget().commit();
    }

    LOGGER.info("onStateChange took " + duration.elapsedMillis() + "ms");
}