use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class RmdTemplateOptionsWidget method addFormatOptions.
private void addFormatOptions(RmdTemplateFormat format) {
if (format.getNotes().length() > 0 && allowFormatChange_) {
labelFormatNotes_.setText(format.getNotes());
labelFormatNotes_.setVisible(true);
} else {
labelFormatNotes_.setVisible(false);
}
optionWidgets_ = new ArrayList<RmdFormatOption>();
JsArrayString options = format.getOptions();
for (int i = 0; i < options.length(); i++) {
RmdFormatOption optionWidget;
RmdTemplateFormatOption option = findOption(format.getName(), options.get(i));
if (option == null)
continue;
String initialValue = option.getDefaultValue();
// check to see whether a value for this format and option were
// specified in the front matter
String frontMatterValue = getFrontMatterDefault(format.getName(), option.getName());
if (frontMatterValue != null)
initialValue = frontMatterValue;
optionWidget = createWidgetForOption(option, initialValue);
if (optionWidget == null)
continue;
optionWidget.asWidget().addStyleName(style.optionWidget());
FlowPanel panel = null;
String category = option.getCategory();
if (tabs_.containsKey(category)) {
panel = tabs_.get(category);
} else {
ScrollPanel scrollPanel = new ScrollPanel();
panel = new FlowPanel();
scrollPanel.add(panel);
optionsTabs_.add(scrollPanel, new Label(category));
tabs_.put(category, panel);
}
panel.add(optionWidget);
optionWidgets_.add(optionWidget);
}
// we need to center the tabs and overlay them on the top edge of the
// content; to do this, it is necessary to nuke a couple of the inline
// styles used by the default GWT tab panel.
Element tabOuter = (Element) optionsTabs_.getElement().getChild(1);
tabOuter.getStyle().setOverflow(Overflow.VISIBLE);
Element tabInner = (Element) tabOuter.getFirstChild();
tabInner.getStyle().clearWidth();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class FindOutputPane method createMainWidget.
@Override
protected Widget createMainWidget() {
context_ = new FindResultContext();
FindOutputResources resources = GWT.create(FindOutputResources.class);
resources.styles().ensureInjected();
table_ = new FastSelectTable<FindResult, CodeNavigationTarget, Object>(new FindOutputCodec(resources), resources.styles().selectedRow(), true, false);
FontSizer.applyNormalFontSize(table_);
table_.addStyleName(resources.styles().findOutput());
table_.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_LEFT)
return;
if (dblClick_.checkForDoubleClick(event.getNativeEvent()))
fireSelectionCommitted();
}
private final DoubleClickState dblClick_ = new DoubleClickState();
});
table_.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
fireSelectionCommitted();
event.stopPropagation();
event.preventDefault();
}
});
container_ = new SimplePanel();
container_.setSize("100%", "100%");
statusPanel_ = new StatusPanel();
statusPanel_.setSize("100%", "100%");
scrollPanel_ = new ScrollPanel(table_);
scrollPanel_.setSize("100%", "100%");
container_.setWidget(scrollPanel_);
return container_;
}
use of com.google.gwt.user.client.ui.ScrollPanel in project perun by CESNET.
the class SelfSponsoredUsersTabItem method draw.
@Override
public Widget draw() {
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
if (user.isSponsoredUser()) {
// SERVICE TYPE user
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(user.getFullNameWithTitles().trim()) + ": Sponsors");
// request
final GetUsersBySpecificUser request = new GetUsersBySpecificUser(userId);
// menu
TabMenu menu = new TabMenu();
vp.add(menu);
vp.setCellHeight(menu, "30px");
menu.addWidget(UiElements.getRefreshButton(this));
// table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = request.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new SelfDetailTabItem(user));
}
});
} else {
table = request.getTable();
}
table.addStyleName("perun-table");
table.setWidth("100%");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
} else {
// PERSON TYPE user
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(user.getFullNameWithTitles().trim()) + ": Sponsored users");
// request
final GetSpecificUsersByUser request = new GetSpecificUsersByUser(userId);
request.setHideService(true);
// menu
TabMenu menu = new TabMenu();
vp.add(menu);
vp.setCellHeight(menu, "30px");
menu.addWidget(UiElements.getRefreshButton(this));
// table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = request.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new SelfDetailTabItem(user));
}
});
} else {
table = request.getTable();
}
table.addStyleName("perun-table");
table.setWidth("100%");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
}
contentWidget.setWidget(vp);
return getWidget();
}
use of com.google.gwt.user.client.ui.ScrollPanel in project gerrit by GerritCodeReview.
the class NavigationTable method scrollIntoView.
protected void scrollIntoView(final Element tr) {
if (!computedScrollType) {
parentScrollPanel = null;
Widget w = getParent();
while (w != null) {
if (w instanceof ScrollPanel) {
parentScrollPanel = (ScrollPanel) w;
break;
}
w = w.getParent();
}
computedScrollType = true;
}
if (parentScrollPanel != null) {
parentScrollPanel.ensureVisible(new UIObject() {
{
setElement(tr);
}
});
} else {
int rt = tr.getAbsoluteTop();
int rl = tr.getAbsoluteLeft();
int rb = tr.getAbsoluteBottom();
int wt = Window.getScrollTop();
int wl = Window.getScrollLeft();
int wh = Window.getClientHeight();
int ww = Window.getClientWidth();
int wb = wt + wh;
// wb < rb: Row bottom is below bottom of window.
if (rl < wl || rt < wt || wb < rt || wb < rb) {
if (rl < wl) {
// If the row fully fits in the window, set 0.
if (tr.getAbsoluteRight() < ww) {
wl = 0;
} else {
wl = Math.max(tr.getAbsoluteLeft() - 5, 0);
}
}
// Vertically center the row in the window.
int h = (wh - (rb - rt)) / 2;
Window.scrollTo(wl, Math.max(rt - h, 0));
}
}
}
Aggregations