Search in sources :

Example 1 with EnsureVisibleEvent

use of org.rstudio.core.client.events.EnsureVisibleEvent in project rstudio by rstudio.

the class NumericValueWidget method validateRange.

/**
    * Make sure field is a valid integer in the range [min, max). If min or max
    * are null, then 0 and infinity are assumed, respectively.
    */
public boolean validateRange(String fieldName, Integer min, Integer max) {
    String value = textBox_.getValue().trim();
    if (!value.matches("^\\d+$")) {
        fireEvent(new EnsureVisibleEvent());
        textBox_.getElement().focus();
        RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", fieldName + " must be a valid number.");
        return false;
    }
    if (min != null || max != null) {
        int intVal = Integer.parseInt(value);
        if (min != null && intVal < min) {
            RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", fieldName + " must be greater than or equal to " + min + ".");
            return false;
        }
        if (max != null && intVal >= max) {
            RStudioGinjector.INSTANCE.getGlobalDisplay().showErrorMessage("Error", fieldName + " must be less than " + max + ".");
            return false;
        }
    }
    return true;
}
Also used : EnsureVisibleEvent(org.rstudio.core.client.events.EnsureVisibleEvent)

Example 2 with EnsureVisibleEvent

use of org.rstudio.core.client.events.EnsureVisibleEvent in project rstudio by rstudio.

the class DelayLoadWorkbenchTab method initialize.

protected void initialize(final WorkbenchPane pane, Panel panel) {
    assert !initialized_;
    initialized_ = true;
    pane.ensureWidget();
    panel.add(pane);
    pane.addEnsureVisibleHandler(new EnsureVisibleHandler() {

        public void onEnsureVisible(EnsureVisibleEvent event) {
            ensureVisible(event.getActivate());
        }
    });
    pane.addEnsureHiddenHandler(new EnsureHiddenHandler() {

        @Override
        public void onEnsureHidden(EnsureHiddenEvent event) {
            ensureHidden();
        }
    });
    setInternalCallbacks(new InternalCallbacks() {

        public void onBeforeSelected() {
            pane.onBeforeSelected();
        }

        public void onSelected() {
            pane.onSelected();
        }
    });
    pane.onBeforeSelected();
    pane.onSelected();
}
Also used : EnsureVisibleHandler(org.rstudio.core.client.events.EnsureVisibleHandler) EnsureHiddenEvent(org.rstudio.core.client.events.EnsureHiddenEvent) EnsureVisibleEvent(org.rstudio.core.client.events.EnsureVisibleEvent) EnsureHiddenHandler(org.rstudio.core.client.events.EnsureHiddenHandler)

Example 3 with EnsureVisibleEvent

use of org.rstudio.core.client.events.EnsureVisibleEvent in project rstudio by rstudio.

the class SourceShim method onEnsureVisibleSourceWindow.

@Override
public void onEnsureVisibleSourceWindow(EnsureVisibleSourceWindowEvent e) {
    if (source_.getView().getTabCount() > 0) {
        fireEvent(new EnsureVisibleEvent());
        fireEvent(new EnsureHeightEvent(EnsureHeightEvent.NORMAL));
    }
}
Also used : EnsureHeightEvent(org.rstudio.core.client.events.EnsureHeightEvent) EnsureVisibleEvent(org.rstudio.core.client.events.EnsureVisibleEvent)

Example 4 with EnsureVisibleEvent

use of org.rstudio.core.client.events.EnsureVisibleEvent in project rstudio by rstudio.

the class SourceShim method onMaximizeSourceWindow.

@Override
public void onMaximizeSourceWindow(MaximizeSourceWindowEvent e) {
    fireEvent(new EnsureVisibleEvent());
    fireEvent(new EnsureHeightEvent(EnsureHeightEvent.MAXIMIZED));
}
Also used : EnsureHeightEvent(org.rstudio.core.client.events.EnsureHeightEvent) EnsureVisibleEvent(org.rstudio.core.client.events.EnsureVisibleEvent)

Aggregations

EnsureVisibleEvent (org.rstudio.core.client.events.EnsureVisibleEvent)4 EnsureHeightEvent (org.rstudio.core.client.events.EnsureHeightEvent)2 EnsureHiddenEvent (org.rstudio.core.client.events.EnsureHiddenEvent)1 EnsureHiddenHandler (org.rstudio.core.client.events.EnsureHiddenHandler)1 EnsureVisibleHandler (org.rstudio.core.client.events.EnsureVisibleHandler)1