Search in sources :

Example 36 with Filter

use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.

the class AttributeGroupFilterWidget method clear.

public void clear() {
    setValue(new Filter(), false);
    updateView();
}
Also used : Filter(org.activityinfo.shared.command.Filter)

Example 37 with Filter

use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.

the class FilterPanelSet method ensureHandlers.

private HandlerManager ensureHandlers() {
    if (manager == null) {
        manager = new HandlerManager(this);
        myRegistrations = new ArrayList<HandlerRegistration>();
        for (FilterPanel panel : panels) {
            HandlerRegistration registration = panel.addValueChangeHandler(new ValueChangeHandler<Filter>() {

                @Override
                public void onValueChange(ValueChangeEvent<Filter> event) {
                    // or indicator (reports) is selected
                    if (event.getSource() instanceof ActivityFilterPanel || event.getSource() instanceof IndicatorFilterPanel) {
                        clearAttributeAndPartnerFilters();
                    }
                    Filter value = composeFilter(new Filter(), null);
                    ValueChangeEvent.fire(FilterPanelSet.this, value);
                }
            });
            myRegistrations.add(registration);
        }
    }
    return manager;
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) ActivityFilterPanel(org.activityinfo.client.page.entry.ActivityFilterPanel) Filter(org.activityinfo.shared.command.Filter) HandlerManager(com.google.gwt.event.shared.HandlerManager) ActivityFilterPanel(org.activityinfo.client.page.entry.ActivityFilterPanel)

Example 38 with Filter

use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.

the class IndicatorFilterPanel method getValue.

@Override
public Filter getValue() {
    Filter filter = new Filter();
    filter.addRestriction(DimensionType.Indicator, getSelectedIds());
    return filter;
}
Also used : Filter(org.activityinfo.shared.command.Filter)

Example 39 with Filter

use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.

the class DataEntryPage method addFilterPane.

private void addFilterPane() {
    filterPane = new FilterPane(dispatcher);
    BorderLayoutData filterLayout = new BorderLayoutData(LayoutRegion.WEST);
    filterLayout.setCollapsible(true);
    filterLayout.setMargins(new Margins(0, 5, 0, 0));
    filterLayout.setSplit(true);
    add(filterPane, filterLayout);
    filterPane.getSet().addValueChangeHandler(new ValueChangeHandler<Filter>() {

        @Override
        public void onValueChange(ValueChangeEvent<Filter> event) {
            eventBus.fireEvent(new NavigationEvent(NavigationHandler.NAVIGATION_REQUESTED, currentPlace.copy().setFilter(event.getValue())));
        }
    });
}
Also used : NavigationEvent(org.activityinfo.client.event.NavigationEvent) Filter(org.activityinfo.shared.command.Filter) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) Margins(com.extjs.gxt.ui.client.util.Margins)

Example 40 with Filter

use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.

the class EmbedDialog method show.

public void show(final DataEntryPlace place) {
    final String url = "http://www.activityinfo.org/embed.html?sites=" + FilterUrlSerializer.toUrlFragment(place.getFilter());
    dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {

        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(SchemaDTO result) {
            Filter filter = place.getFilter();
            if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Activity)) {
                ActivityDTO singleActivity = result.getActivityById(filter.getRestrictedCategory(DimensionType.Activity));
                showPublished(singleActivity, url);
            } else if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Database)) {
                MessageBox.alert("foo", "not impl", null);
            }
        }
    });
}
Also used : Filter(org.activityinfo.shared.command.Filter) ActivityDTO(org.activityinfo.shared.dto.ActivityDTO) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Aggregations

Filter (org.activityinfo.shared.command.Filter)59 GetSites (org.activityinfo.shared.command.GetSites)8 Test (org.junit.Test)8 GetSchema (org.activityinfo.shared.command.GetSchema)5 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)5 DimensionType (org.activityinfo.shared.report.model.DimensionType)5 ArrayList (java.util.ArrayList)4 SiteDTO (org.activityinfo.shared.dto.SiteDTO)4 DateRange (org.activityinfo.shared.report.model.DateRange)4 StringWriter (java.io.StringWriter)3 Indicator (org.activityinfo.server.database.hibernate.entity.Indicator)3 SiteResult (org.activityinfo.shared.command.result.SiteResult)3 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)3 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)3 Margins (com.extjs.gxt.ui.client.util.Margins)2 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)2 JsonElement (com.google.gson.JsonElement)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 List (java.util.List)2