use of com.google.gwt.view.client.ListDataProvider 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.view.client.ListDataProvider in project kie-wb-common by kiegroup.
the class ReassignmentWidgetViewImplTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
GwtMockito.initMocks(this);
ListDataProvider temp = new ListDataProvider();
dataProvider = spy(temp);
doNothing().when(dataProvider).addDataDisplay(any(HasData.class));
doNothing().when(dataProvider).flush();
doNothing().when(dataProvider).refresh();
setFieldValue(reassignmentWidgetViewImpl, "modal", modal);
setFieldValue(reassignmentWidgetViewImpl, "table", table);
setFieldValue(reassignmentWidgetViewImpl, "dataProvider", dataProvider);
doCallRealMethod().when(reassignmentWidgetViewImpl).init(any(ReassignmentWidgetView.Presenter.class), anyList());
doCallRealMethod().when(reassignmentWidgetViewImpl).delete(any(ReassignmentRow.class));
doCallRealMethod().when(reassignmentWidgetViewImpl).hide();
doCallRealMethod().when(reassignmentWidgetViewImpl).ok();
doCallRealMethod().when(reassignmentWidgetViewImpl).onSubscription(any(ReassignmentEvent.class));
doCallRealMethod().when(reassignmentWidgetViewImpl).addOrEdit(any(ReassignmentRow.class));
doNothing().when(reassignmentWidgetViewImpl).initTable();
when(reassignmentWidgetViewImpl.getParent()).thenReturn(reassignmentWidgetViewImpl);
doCallRealMethod().when(dataProvider).addDataDisplay(table);
doCallRealMethod().when(dataProvider).getList();
doCallRealMethod().when(dataProvider).setList(anyList());
doCallRealMethod().when(dataProvider).flush();
doCallRealMethod().when(dataProvider).refresh();
doCallRealMethod().when(reassignmentEditorWidget).createOrEdit(any(ReassignmentWidgetView.class), any(ReassignmentRow.class));
doCallRealMethod().when(presenter).getValue();
doCallRealMethod().when(presenter).ok();
doCallRealMethod().when(presenter).hide();
doCallRealMethod().when(presenter).setValue(anyList());
doCallRealMethod().when(presenter).setValue(anyList(), any(boolean.class));
doCallRealMethod().when(presenter).setCallback(any(ReassignmentsEditorWidget.GetReassignmentsCallback.class));
}
use of com.google.gwt.view.client.ListDataProvider in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
GwtMockito.initMocks(this);
ListDataProvider temp = new ListDataProvider();
dataProvider = spy(temp);
doNothing().when(dataProvider).addDataDisplay(any(HasData.class));
doNothing().when(dataProvider).flush();
doNothing().when(dataProvider).refresh();
setFieldValue(notificationWidgetViewImpl, "modal", modal);
setFieldValue(notificationWidgetViewImpl, "table", table);
setFieldValue(notificationWidgetViewImpl, "dataProvider", dataProvider);
doCallRealMethod().when(notificationWidgetViewImpl).init(any(NotificationWidgetView.Presenter.class), anyList());
doCallRealMethod().when(notificationWidgetViewImpl).delete(any(NotificationRow.class));
doCallRealMethod().when(notificationWidgetViewImpl).hide();
doCallRealMethod().when(notificationWidgetViewImpl).ok();
doCallRealMethod().when(notificationWidgetViewImpl).onSubscription(any(NotificationEvent.class));
doCallRealMethod().when(notificationWidgetViewImpl).addOrEdit(any(NotificationRow.class));
doNothing().when(notificationWidgetViewImpl).initTable();
when(notificationWidgetViewImpl.getParent()).thenReturn(notificationWidgetViewImpl);
doCallRealMethod().when(dataProvider).addDataDisplay(table);
doCallRealMethod().when(dataProvider).getList();
doCallRealMethod().when(dataProvider).setList(anyList());
doCallRealMethod().when(dataProvider).flush();
doCallRealMethod().when(dataProvider).refresh();
doCallRealMethod().when(notificationEditorWidget).createOrEdit(any(NotificationWidgetView.class), any(NotificationRow.class));
doCallRealMethod().when(presenter).getValue();
doCallRealMethod().when(presenter).ok();
doCallRealMethod().when(presenter).hide();
doCallRealMethod().when(presenter).setValue(anyList());
doCallRealMethod().when(presenter).setValue(anyList(), any(boolean.class));
doCallRealMethod().when(presenter).setCallback(any(NotificationsEditorWidget.GetNotificationsCallback.class));
}
use of com.google.gwt.view.client.ListDataProvider in project kie-wb-common by kiegroup.
the class ValidationPopupViewImpl method setValidationMessages.
@Override
public void setValidationMessages(List<ValidationMessage> messages) {
ListDataProvider<ValidationMessage> listDataProvider = (ListDataProvider<ValidationMessage>) this.validationTable.getDataProvider();
listDataProvider.getList().clear();
listDataProvider.getList().addAll(messages);
validationTable.setVisibleRangeAndClearData(new Range(0, 5), true);
}
use of com.google.gwt.view.client.ListDataProvider in project ovirt-engine by oVirt.
the class HostNetworkInterfaceBondedListViewItem method createSlavesContainer.
private Container createSlavesContainer() {
Row content = new Row();
Column gridColumn = new Column(ColumnSize.SM_12);
content.add(gridColumn);
Container container = createItemContainerPanel(content);
CellTable<HostInterface> slavesTable = new CellTable<>(MAX_SLAVES, (Resources) GWT.create(CellTablePopupTableResources.class));
slavesTable.getElement().addClassName(Styles.TABLE);
slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
ListDataProvider<HostInterface> logicalNetworkDataProvider = new ListDataProvider<>();
logicalNetworkDataProvider.addDataDisplay(slavesTable);
logicalNetworkDataProvider.setList(getEntity().getInterfaces());
// Setup columns
TextColumn<HostInterface> name = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return hostInterface.getName();
}
};
slavesTable.addColumn(name, constants.macInterface());
TextColumn<HostInterface> macAddress = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return hostInterface.getInterface().getMacAddress() != null ? hostInterface.getInterface().getMacAddress() : constants.unAvailablePropertyLabel();
}
};
slavesTable.addColumn(macAddress, constants.macInterface());
TextColumn<HostInterface> speed = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return hostInterface.getInterface().hasSpeed() ? String.valueOf(hostInterface.getInterface().getSpeed()) : constants.unAvailablePropertyLabel();
}
};
slavesTable.addColumn(speed, constants.speedInterface());
TextColumn<HostInterface> rxRate = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return rateRenderer.render(new Double[] { hostInterface.getRxRate(), hostInterface.getSpeed().doubleValue() });
}
};
slavesTable.addColumn(rxRate, templates.sub(constants.rxRate(), constants.mbps()));
TextColumn<HostInterface> txRate = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return rateRenderer.render(new Double[] { hostInterface.getTxRate(), hostInterface.getSpeed().doubleValue() });
}
};
slavesTable.addColumn(txRate, templates.sub(constants.txRate(), constants.mbps()));
TextColumn<HostInterface> rxTotal = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return totalRenderer.render(hostInterface.getRxTotal());
}
};
slavesTable.addColumn(rxTotal, templates.sub(constants.rxTotal(), constants.mbps()));
TextColumn<HostInterface> txTotal = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return totalRenderer.render(hostInterface.getTxTotal());
}
};
slavesTable.addColumn(txTotal, templates.sub(constants.txTotal(), constants.mbps()));
TextColumn<HostInterface> dropRate = new TextColumn<HostInterface>() {
@Override
public String getValue(HostInterface hostInterface) {
return String.valueOf(hostInterface.getRxDrop() + hostInterface.getTxDrop());
}
};
slavesTable.addColumn(dropRate, templates.sub(constants.dropsInterface(), constants.pkts()));
gridColumn.add(slavesTable);
return container;
}
Aggregations