use of cz.metacentrum.perun.webgui.json.extSourcesManager.LoadExtSourcesDefinitions in project perun by CESNET.
the class ExtSourcesTabItem method draw.
public Widget draw() {
// create main panel for content
VerticalPanel mainPage = new VerticalPanel();
mainPage.setWidth("100%");
// create new instance for jsonCall getExtSources
final GetExtSources getExtSources = new GetExtSources();
getExtSources.setCheckable(false);
// menu
TabMenu menu = new TabMenu();
menu.addWidget(UiElements.getRefreshButton(this));
menu.addFilterWidget(new ExtendedSuggestBox(getExtSources.getOracle()), new PerunSearchEvent() {
@Override
public void searchFor(String text) {
getExtSources.filterTable(text);
}
}, "Filter external sources by name or type");
final CustomButton loadButton = new CustomButton("Load ext sources", "Load ext sources definitions from a local file.", SmallIcons.INSTANCE.worldIcon());
loadButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
LoadExtSourcesDefinitions loadCall = new LoadExtSourcesDefinitions(JsonCallbackEvents.disableButtonEvents(loadButton, JsonCallbackEvents.refreshTableEvents(getExtSources)));
loadCall.retrieveData();
}
});
menu.addWidget(loadButton);
// get CellTable from jsonCall
CellTable<ExtSource> extSourcesTable = getExtSources.getTable();
extSourcesTable.setStyleName("perun-table");
ScrollPanel scrollTable = new ScrollPanel(extSourcesTable);
scrollTable.addStyleName("perun-tableScrollPanel");
// put page into scroll panel
mainPage.add(menu);
mainPage.setCellHeight(menu, "30px");
mainPage.add(scrollTable);
session.getUiElements().resizePerunTable(scrollTable, 350, this);
this.contentWidget.setWidget(mainPage);
return getWidget();
}
Aggregations