Java Code Examples for com.vaadin.client.communication.StateChangeEvent#isInitialStateChange()

The following examples show how to use com.vaadin.client.communication.StateChangeEvent#isInitialStateChange() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaUIConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.isInitialStateChange()) {
        // check mode of required indicator icon/hidden
        // performed on page open or full refresh
        CubaTooltip.checkRequiredIndicatorMode();
    }
}
 
Example 2
Source File: CubaFieldGroupLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (getState().useInlineCaption) {
        updateCaptionSizes();
        updateCaptionAlignments();
    }

    if (stateChangeEvent.isInitialStateChange()) {
        this.initialStateChangePerformed = true;
    }
}
 
Example 3
Source File: CubaSourceCodeEditorConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    if (stateChangeEvent.hasPropertyChanged("handleTabKey")) {
        getWidget().setHandleTabKey(getState().handleTabKey);
    }
    if (stateChangeEvent.hasPropertyChanged("printMarginColumn")) {
        getWidget().setPrintMarginColumn(getState().printMarginColumn);
    }

    if (stateChangeEvent.isInitialStateChange()) {
        getWidget().resetEditHistory();
    }
}
 
Example 4
Source File: GanttConnector.java    From gantt with Apache License 2.0 4 votes vote down vote up
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    super.onStateChanged(stateChangeEvent);

    locale = getState().locale;
    timeZoneId = getState().timeZoneId;
    if (stateChangeEvent.hasPropertyChanged("locale")) {
        dateTimeService = null;
    }
    if (stateChangeEvent.hasPropertyChanged("timeZoneId")) {
        if (getState().timeZoneJson != null) {
            timeZone = TimeZone.createTimeZone(getState().timeZoneJson);
        } else {
            timeZone = TimeZone.createTimeZone(0);
        }
    }

    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")
            || stateChangeEvent.hasPropertyChanged("hourFormat")) {
        notifyHeight = !stateChangeEvent.isInitialStateChange();
        getWidget().setForceUpdateTimeline();
    }
    if (!notifyHeight && stateChangeEvent.hasPropertyChanged("resolution")) {
        notifyHeight = !stateChangeEvent.isInitialStateChange();
    }
    if (stateChangeEvent.hasPropertyChanged("movableSteps")
            || stateChangeEvent.hasPropertyChanged("resizableSteps")) {
        getWidget().resetListeners();
    }

    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();
        }
    });
}