Search in sources :

Example 11 with AdminEntityDTO

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());
}
Also used : AdminEntity(org.activityinfo.server.database.hibernate.entity.AdminEntity) AdminLevel(org.activityinfo.server.database.hibernate.entity.AdminLevel) AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO) Bounds(org.activityinfo.server.database.hibernate.entity.Bounds) Test(org.junit.Test)

Example 12 with AdminEntityDTO

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;
}
Also used : AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO) ArrayList(java.util.ArrayList)

Example 13 with AdminEntityDTO

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);
}
Also used : Filter(org.activityinfo.shared.command.Filter) AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO)

Example 14 with AdminEntityDTO

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);
}
Also used : AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout)

Example 15 with AdminEntityDTO

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);
}
Also used : Filter(org.activityinfo.shared.command.Filter) AdminEntityDTO(org.activityinfo.shared.dto.AdminEntityDTO)

Aggregations

AdminEntityDTO (org.activityinfo.shared.dto.AdminEntityDTO)21 ArrayList (java.util.ArrayList)4 AdminEntityResult (org.activityinfo.shared.command.result.AdminEntityResult)4 SqlResultCallback (com.bedatadriven.rebar.sql.client.SqlResultCallback)3 SqlResultSet (com.bedatadriven.rebar.sql.client.SqlResultSet)3 SqlResultSetRow (com.bedatadriven.rebar.sql.client.SqlResultSetRow)3 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)3 GetAdminEntities (org.activityinfo.shared.command.GetAdminEntities)3 AdminLevelDTO (org.activityinfo.shared.dto.AdminLevelDTO)3 SiteDTO (org.activityinfo.shared.dto.SiteDTO)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 AdminEntity (org.activityinfo.server.database.hibernate.entity.AdminEntity)2 AdminLevel (org.activityinfo.server.database.hibernate.entity.AdminLevel)2 Filter (org.activityinfo.shared.command.Filter)2 LocationDTO (org.activityinfo.shared.dto.LocationDTO)2 SqlQuery (com.bedatadriven.rebar.sql.client.query.SqlQuery)1 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1