use of com.google.gwt.core.client.GWT 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;
}
Aggregations