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