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());
}
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;
}
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());
}
}
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;
}
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");
}
}
Aggregations