use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class UnsavedChangesDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// create cell table
targetsCellTable_ = new CellTable<UnsavedChangesTarget>(15, UnsavedChangesCellTableResources.INSTANCE, KEY_PROVIDER);
selectionModel_ = new MultiSelectionModel<UnsavedChangesTarget>(KEY_PROVIDER);
targetsCellTable_.setSelectionModel(selectionModel_, DefaultSelectionEventManager.<UnsavedChangesTarget>createCheckboxManager());
targetsCellTable_.setWidth("100%", true);
// add columns
addSelectionColumn();
addIconColumn();
addNameAndPathColumn();
// hook-up data provider
dataProvider_ = new ListDataProvider<UnsavedChangesTarget>();
dataProvider_.setList(targets_);
dataProvider_.addDataDisplay(targetsCellTable_);
targetsCellTable_.setPageSize(targets_.size());
// select all by default
for (UnsavedChangesTarget editingTarget : dataProvider_.getList()) selectionModel_.setSelected(editingTarget, true);
// enclose cell table in scroll panel
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setStylePrimaryName(RESOURCES.styles().targetScrollPanel());
scrollPanel.setWidget(targetsCellTable_);
if (dataProvider_.getList().size() > 4)
scrollPanel.setHeight("280px");
// always save check box (may not be shown)
chkAlwaysSave_ = new CheckBox(alwaysSaveOption_);
// main widget
VerticalPanel panel = new VerticalPanel();
Label captionLabel = new Label("The following files have unsaved changes:");
captionLabel.setStylePrimaryName(RESOURCES.styles().captionLabel());
panel.add(captionLabel);
panel.add(scrollPanel);
if (!StringUtil.isNullOrEmpty(alwaysSaveOption_)) {
panel.add(chkAlwaysSave_);
panel.setCellHeight(chkAlwaysSave_, "30px");
panel.setCellVerticalAlignment(chkAlwaysSave_, HasVerticalAlignment.ALIGN_MIDDLE);
}
return panel;
}
use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class PackageActionConfirmationDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
FlowPanel flowPanel = new FlowPanel();
String explanatoryText = getExplanatoryText();
if (explanatoryText.length() > 0) {
Label text = new Label(explanatoryText);
text.setStylePrimaryName(RESOURCES.styles().explanatoryText());
flowPanel.add(text);
}
actionsTable_ = new CellTable<PendingAction>(15, GWT.<PackagesCellTableResources>create(PackagesCellTableResources.class));
actionsTable_.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
actionsTable_.setSelectionModel(new NoSelectionModel<PendingAction>());
actionsTable_.setWidth("100%", true);
ActionColumn actionColumn = new ActionColumn();
actionsTable_.addColumn(actionColumn);
actionsTable_.setColumnWidth(actionColumn, 30, Unit.PX);
addTableColumns(actionsTable_);
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setWidget(actionsTable_);
scrollPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
flowPanel.add(scrollPanel);
// query for updates
actionsDS_.requestData(new SimpleRequestCallback<JsArray<T>>() {
@Override
public void onResponseReceived(JsArray<T> actions) {
if (actions != null && actions.length() > 0) {
ArrayList<PendingAction> pendingActions = new ArrayList<PendingAction>();
for (int i = 0; i < actions.length(); i++) pendingActions.add(new PendingAction(actions.get(i), false));
actionsTable_.setPageSize(pendingActions.size());
actionsDataProvider_ = new ListDataProvider<PendingAction>();
actionsDataProvider_.setList(pendingActions);
actionsDataProvider_.addDataDisplay(actionsTable_);
enableCancelButton(true);
selectAllButton_.setEnabled(true);
selectNoneButton_.setEnabled(true);
} else {
closeDialog();
showNoActionsRequired();
}
}
@Override
public void onError(ServerError error) {
closeDialog();
super.onError(error);
}
});
return flowPanel;
}
use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class ShowContentDialog method createMainWidget.
@Override
protected Widget createMainWidget() {
// main widget is scroll panel with embeddeed html
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setStylePrimaryName(styleName_);
HTML htmlContent = new HTML(content_);
if (isFixedFont_)
FontSizer.applyNormalFontSize(htmlContent);
scrollPanel.setWidget(htmlContent);
// if we don't have a preferred size then size based on content
Size size = preferredSize_;
if (size.isEmpty())
size = DomMetrics.measureHTML(content_, styleName_);
// compute the widget size and set it
Size minimumSize = new Size(300, 300);
size = DomMetrics.adjustedElementSize(size, minimumSize, // pad
70, // client margin
100);
scrollPanel.setSize(size.width + "px", size.height + "px");
// return it
return scrollPanel;
}
use of com.google.gwt.user.client.ui.ScrollPanel in project rstudio by rstudio.
the class ChunkConsolePage method init.
private void init(ChunkOutputStream stream) {
preview_ = new ChunkConsolePreview();
preview_.addText(stream.getAllConsoleText());
stream_ = stream;
panel_ = new ScrollPanel();
panel_.add(stream);
if (chunkOutputSize_ != ChunkOutputSize.Full) {
content_ = new FixedRatioWidget(panel_, ChunkOutputUi.OUTPUT_ASPECT, ChunkOutputUi.MAX_PLOT_WIDTH);
} else {
panel_.getElement().getStyle().setWidth(100, Unit.PCT);
content_ = panel_;
}
thumbnail_ = new ChunkOutputThumbnail("R Console", "", preview_, ChunkOutputWidget.getEditorColors());
}
use of com.google.gwt.user.client.ui.ScrollPanel in project perun by CESNET.
the class GroupRelationsTabItem method draw.
@Override
public Widget draw() {
titleWidget.setText(Utils.getStrippedStringWithEllipsis(group.getName()) + ": unions");
// main panel
VerticalPanel vp = new VerticalPanel();
vp.setSize("100%", "100%");
// if members group, hide
if (group.isCoreGroup()) {
vp.add(new HTML("<h2>Members group cannot have unions.</h2>"));
this.contentWidget.setWidget(vp);
return getWidget();
}
final GetGroupUnions unions = new GetGroupUnions(group, false);
// Events for reloading when group is created
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(unions);
// menu
TabMenu menu = new TabMenu();
final CheckBox subGroupsCheckBox = new CheckBox("Show sub-groups");
final ListBox reverseDropdown = new ListBox();
reverseDropdown.addItem("Normal");
reverseDropdown.addItem("Reverse");
reverseDropdown.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
switch(reverseDropdown.getSelectedIndex()) {
case 1:
unions.setReverseAndRefresh(true);
subGroupsCheckBox.setVisible(false);
break;
default:
unions.setReverseAndRefresh(false);
subGroupsCheckBox.setVisible(true);
}
}
});
menu.addWidget(UiElements.getRefreshButton(this));
CustomButton createButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addGroupUnion(), new ClickHandler() {
public void onClick(ClickEvent event) {
// creates a new form
session.getTabManager().addTabToCurrentTab(new AddGroupUnionTabItem(group), true);
}
});
if (!session.isGroupAdmin(groupId) && !session.isVoAdmin(group.getVoId())) {
createButton.setEnabled(false);
unions.setCheckable(false);
}
menu.addWidget(createButton);
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeGroupUnion());
removeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final ArrayList<Group> itemsToRemove = unions.getTableSelectedList();
String text = "Following group unions will be deleted.";
UiElements.showDeleteConfirm(itemsToRemove, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
RemoveGroupUnions request = new RemoveGroupUnions(JsonCallbackEvents.disableButtonEvents(removeButton, events));
if (unions.isReverse()) {
request.deleteGroupUnions(itemsToRemove, group);
} else {
request.deleteGroupUnions(group, itemsToRemove);
}
}
});
}
});
menu.addWidget(removeButton);
// filter box
final ExtendedSuggestBox box = new ExtendedSuggestBox(unions.getOracle());
menu.addFilterWidget(box, new PerunSearchEvent() {
public void searchFor(String text) {
unions.filterTable(text);
}
}, ButtonTranslation.INSTANCE.filterGroup());
subGroupsCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
unions.setShowSubgroupsAndRefresh(valueChangeEvent.getValue(), box.getSuggestBox().getText());
}
});
menu.addWidget(new HTML("<strong>Direction: </strong>"));
menu.addWidget(reverseDropdown);
menu.addWidget(subGroupsCheckBox);
// add menu to the main panel
vp.add(menu);
vp.setCellHeight(menu, "30px");
CellTable<Group> table = unions.getTable(new FieldUpdater<Group, String>() {
@Override
public void update(int arg0, Group group, String arg2) {
if (session.isGroupAdmin(group.getId()) || session.isVoAdmin(group.getId())) {
session.getTabManager().addTab(new GroupDetailTabItem(group.getId()));
} else {
UiElements.generateInfo("Not privileged", "You are not manager of selected group or its VO.");
}
}
});
removeButton.setEnabled(false);
if (session.isGroupAdmin(groupId) || session.isVoAdmin(group.getVoId()))
JsonUtils.addTableManagedButton(unions, table, removeButton);
// adds the table into the panel
table.addStyleName("perun-table");
ScrollPanel sp = new ScrollPanel(table);
sp.addStyleName("perun-tableScrollPanel");
vp.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
this.contentWidget.setWidget(vp);
return getWidget();
}
Aggregations