Search in sources :

Example 1 with LoadExtSourcesDefinitions

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();
}
Also used : PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) GetExtSources(cz.metacentrum.perun.webgui.json.extSourcesManager.GetExtSources) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) LoadExtSourcesDefinitions(cz.metacentrum.perun.webgui.json.extSourcesManager.LoadExtSourcesDefinitions) ExtSource(cz.metacentrum.perun.webgui.model.ExtSource)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)1 GetExtSources (cz.metacentrum.perun.webgui.json.extSourcesManager.GetExtSources)1 LoadExtSourcesDefinitions (cz.metacentrum.perun.webgui.json.extSourcesManager.LoadExtSourcesDefinitions)1 ExtSource (cz.metacentrum.perun.webgui.model.ExtSource)1 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)1 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)1 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)1