use of org.rstudio.core.client.widget.SmallButton in project rstudio by rstudio.
the class CodeFilesList method createButton.
private SmallButton createButton(String caption) {
SmallButton button = new SmallButton(caption);
button.addStyleName(RES.styles().codeFilesListButton());
button.fillWidth();
return button;
}
use of org.rstudio.core.client.widget.SmallButton in project rstudio by rstudio.
the class SpellingCustomDictionariesWidget method createButton.
private SmallButton createButton(String caption) {
SmallButton button = new SmallButton(caption);
button.addStyleName(RES.styles().button());
button.fillWidth();
return button;
}
use of org.rstudio.core.client.widget.SmallButton in project rstudio by rstudio.
the class HelpPane method createSecondaryToolbar.
@Override
protected SecondaryToolbar createSecondaryToolbar() {
SecondaryToolbar toolbar = new SecondaryToolbar();
toolbar.addLeftPopupMenu(title_ = new Label(), history_.getMenu());
if (isFindSupported()) {
final SmallButton btnNext = new SmallButton(">", true);
btnNext.setTitle("Find next (Enter)");
btnNext.setVisible(false);
btnNext.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
findNext();
}
});
final SmallButton btnPrev = new SmallButton("<", true);
btnPrev.setTitle("Find previous");
btnPrev.setVisible(false);
btnPrev.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
findPrev();
}
});
findTextBox_ = new FindTextBox("Find in Topic");
findTextBox_.setOverrideWidth(90);
toolbar.addLeftWidget(findTextBox_);
findTextBox_.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(KeyUpEvent event) {
// ignore modifier key release
if (event.getNativeKeyCode() == KeyCodes.KEY_CTRL || event.getNativeKeyCode() == KeyCodes.KEY_ALT || event.getNativeKeyCode() == KeyCodes.KEY_SHIFT) {
return;
}
WindowEx contentWindow = getContentWindow();
if (contentWindow != null) {
// into the main content window
if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE || event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
event.preventDefault();
event.stopPropagation();
if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE)
clearTerm();
contentWindow.focus();
} else {
// minimizing or maximizing the help pane
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
event.preventDefault();
event.stopPropagation();
}
// check for term
String term = findTextBox_.getValue().trim();
int modifier = KeyboardShortcut.getModifierValue(event.getNativeEvent());
boolean isShift = modifier == KeyboardShortcut.SHIFT;
// if there is a term then search for it
if (term.length() > 0) {
// make buttons visible
setButtonVisibility(true);
// perform the find (check for incremental)
if (isIncrementalFindSupported()) {
boolean incremental = !event.isAnyModifierKeyDown() && (event.getNativeKeyCode() != KeyCodes.KEY_ENTER);
performFind(term, !isShift, incremental);
} else {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
performFind(term, !isShift, false);
}
} else // no term means clear term and remove selection
{
if (isIncrementalFindSupported()) {
clearTerm();
contentWindow.removeSelection();
}
}
}
}
}
private void clearTerm() {
findTextBox_.setValue("");
setButtonVisibility(false);
}
private void setButtonVisibility(final boolean visible) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
btnNext.setVisible(visible);
btnPrev.setVisible(visible);
}
});
}
});
findTextBox_.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
// from handling them
if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE || event.getNativeKeyCode() == KeyCodes.KEY_TAB || event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
event.preventDefault();
event.stopPropagation();
}
}
});
if (isIncrementalFindSupported()) {
btnPrev.getElement().getStyle().setMarginRight(3, Unit.PX);
toolbar.addLeftWidget(btnPrev);
toolbar.addLeftWidget(btnNext);
}
}
return toolbar;
}
Aggregations