use of org.activityinfo.shared.dto.AdminEntityDTO in project activityinfo by bedatadriven.
the class AdminEntityMappingTest method testBounds.
@Test
public void testBounds() {
Bounds bounds = new Bounds();
bounds.setX1(1.0);
bounds.setY1(2.0);
bounds.setX2(3.0);
bounds.setY2(4.0);
AdminLevel level = new AdminLevel();
level.setId(81);
level.setName("My Level");
AdminEntity parent = new AdminEntity();
parent.setId(93);
AdminEntity entity = new AdminEntity();
entity.setLevel(level);
entity.setParent(parent);
entity.setBounds(bounds);
AdminEntityDTO dto = mapper.map(entity, AdminEntityDTO.class);
Assert.assertEquals("parentId", parent.getId(), dto.getParentId().intValue());
Assert.assertEquals("levelId", level.getId(), dto.getLevelId());
Assert.assertNotNull("bounds", dto.getBounds());
Assert.assertEquals("x1", bounds.getX1(), dto.getBounds().getMinLon());
Assert.assertEquals("y1", bounds.getY1(), dto.getBounds().getMinLat());
Assert.assertEquals("x2", bounds.getX2(), dto.getBounds().getMaxLon());
Assert.assertEquals("y2", bounds.getY2(), dto.getBounds().getMaxLat());
}
use of org.activityinfo.shared.dto.AdminEntityDTO in project activityinfo by bedatadriven.
the class AdminFilterPanel method getSelection.
/**
* @return the list of AdminEntityDTOs that user has selected with which the
* filter should be restricted
*/
public List<AdminEntityDTO> getSelection() {
List<AdminEntityDTO> checked = tree.getCheckedSelection();
List<AdminEntityDTO> selected = new ArrayList<AdminEntityDTO>();
for (AdminEntityDTO entity : checked) {
selected.add(entity);
}
return selected;
}
use of org.activityinfo.shared.dto.AdminEntityDTO in project activityinfo by bedatadriven.
the class AdminFilterPanel method removeFilter.
private void removeFilter() {
for (AdminEntityDTO entity : tree.getCheckedSelection()) {
tree.setChecked(entity, false);
}
value = new Filter();
ValueChangeEvent.fire(this, value);
filterToolBar.setRemoveFilterEnabled(false);
}
use of org.activityinfo.shared.dto.AdminEntityDTO in project activityinfo by bedatadriven.
the class AdminFilterPanel method initializeComponent.
private void initializeComponent() {
this.setLayout(new FitLayout());
this.setScrollMode(Style.Scroll.AUTO);
this.setHeading(I18N.CONSTANTS.filterByGeography());
this.setIcon(IconImageBundle.ICONS.filter());
loader = new AdminTreeLoader(dispatcher);
store = new TreeStore<AdminEntityDTO>(loader);
}
use of org.activityinfo.shared.dto.AdminEntityDTO in project activityinfo by bedatadriven.
the class AdminFilterPanel method applyFilter.
private void applyFilter() {
List<AdminEntityDTO> selection = getSelection();
value = new Filter();
for (AdminEntityDTO entity : selection) {
value.addRestriction(DimensionType.AdminLevel, entity.getId());
}
ValueChangeEvent.fire(this, value);
filterToolBar.setRemoveFilterEnabled(true);
}
Aggregations