Search in sources :

Example 6 with Filter

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

the class DateRangePanel method applyFilter.

protected void applyFilter() {
    Filter value = getValue();
    ValueChangeEvent.fire(this, value);
    filterToolBar.setRemoveFilterEnabled(value.isDateRestricted());
}
Also used : Filter(org.activityinfo.shared.command.Filter)

Example 7 with Filter

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

the class DateRangePanel method getValue.

@Override
public Filter getValue() {
    Filter filter = new Filter();
    filter.setMinDate(datefieldMinDate.getValue());
    filter.setMaxDate(datefieldMaxDate.getValue());
    return filter;
}
Also used : Filter(org.activityinfo.shared.command.Filter)

Example 8 with Filter

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

the class DataEntryPage method doNavigate.

private void doNavigate() {
    Filter filter = currentPlace.getFilter();
    gridPanel.load(currentPlace.getGrouping(), filter);
    groupingComboBox.setFilter(filter);
    filterPane.getSet().applyBaseFilter(filter);
    // currently the print form only does one activity
    Set<Integer> activities = filter.getRestrictions(DimensionType.Activity);
    toolBar.setActionEnabled(UIActions.PRINT, activities.size() == 1);
    // also embedding is only implemented for one activity
    toolBar.setActionEnabled("EMBED", activities.size() == 1);
    toolBar.setActionEnabled("IMPORT", activities.size() == 1);
    // adding is also only enabled for one activity, but we have to
    // lookup to see whether it possible for this activity
    toolBar.setActionEnabled(UIActions.ADD, false);
    if (activities.size() == 1) {
        enableToolbarButtons(activities.iterator().next());
    }
}
Also used : Filter(org.activityinfo.shared.command.Filter)

Example 9 with Filter

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

the class ReportJsonFactory method decodeFilter.

public Filter decodeFilter(JsonObject filter) {
    Filter elementFilter = new Filter();
    JsonElement jsonMinDate = filter.get("minDate");
    JsonElement jsonMaxDate = filter.get("maxDate");
    DateRange dateRange = new DateRange();
    if (jsonMinDate != null) {
        jsonMinDate.getAsLong();
        Date minDate = new Date(jsonMinDate.getAsLong());
        dateRange.setMinDate(minDate);
    }
    if (jsonMaxDate != null) {
        Date maxDate = new Date(jsonMaxDate.getAsLong());
        dateRange.setMaxDate(maxDate);
    }
    elementFilter.setDateRange(dateRange);
    JsonArray restrictions = (JsonArray) filter.get("restrictions");
    for (int i = 0; i < restrictions.size(); i++) {
        JsonObject rest = (JsonObject) restrictions.get(i);
        JsonArray arr = rest.get("set").getAsJsonArray();
        Set<Integer> set = new HashSet<Integer>();
        Iterator<JsonElement> it = arr.iterator();
        while (it.hasNext()) {
            set.add(it.next().getAsInt());
        }
        elementFilter.addRestriction(DimensionType.valueOf(rest.get("type").getAsString()), set);
    }
    return elementFilter;
}
Also used : JsonArray(com.google.gson.JsonArray) DateRange(org.activityinfo.shared.report.model.DateRange) Filter(org.activityinfo.shared.command.Filter) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) Date(java.util.Date) HashSet(java.util.HashSet)

Example 10 with Filter

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

the class EmbedEntryPoint method onModuleLoad.

/**
 * This is the entry point method.
 */
@Override
public void onModuleLoad() {
    Log.info("Application: onModuleLoad starting");
    Log.info("Application Permutation: " + GWT.getPermutationStrongName());
    if (Log.isErrorEnabled()) {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

            @Override
            public void onUncaughtException(Throwable e) {
                Log.error("Uncaught exception", e);
            }
        });
    }
    GXT.setDefaultTheme(Theme.BLUE, true);
    final EmbedInjector injector = GWT.create(EmbedInjector.class);
    if (!Strings.isNullOrEmpty(Location.getParameter("sites"))) {
        Filter filter = FilterUrlSerializer.fromQueryParameter(Location.getParameter("sites"));
        SiteGridPanel panel = new SiteGridPanel(injector.getDispatcher());
        panel.load(NullGroupingModel.INSTANCE, filter);
        addToRootPanel(panel);
    } else {
        Window.alert("The url is malformed");
    }
}
Also used : GWT(com.google.gwt.core.client.GWT) Filter(org.activityinfo.shared.command.Filter) SiteGridPanel(org.activityinfo.client.page.entry.SiteGridPanel)

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