/*******************************************************************************
* Copyright 2011 Adrian Cristian Ionescu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package ro.zg.opengroups.gwt.client.views;
import java.util.List;
import ro.zg.opengroups.gwt.client.views.support.VerticalPaneGwtView;
import ro.zg.opengroups.gwt.shared.constants.ViewsTypes;
import ro.zg.opengroups.gwt.shared.vo.Entity;
import ro.zg.opengroups.gwt.shared.vo.EntityList;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class SimpleEntitiesListView extends VerticalPaneGwtView<EntityList>{
@Override
public Widget construct() {
return getContainer();
}
@Override
public void update(EntityList entityList) {
List<Entity> itemsList = entityList.getItemsList();
if(itemsList == null || itemsList.size()==0) {
displayListEmptyMessage();
}
VerticalPanel container = getContainer();
container.clear();
for(Entity entity : itemsList) {
EntityDataSummaryView summaryView = (EntityDataSummaryView)createViewForType(ViewsTypes.ENTITY_DATA_SUMMARY_VIEW, this);
summaryView.update(entity);
container.add(summaryView.construct());
}
}
private void displayListEmptyMessage() {
}
}