/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.models;
import java.util.List;
import de.innovationgate.wga.config.Domain;
import de.innovationgate.wga.config.WGAConfiguration;
import de.innovationgate.wga.model.BeanListTableModel;
public class WebApplicationsModel extends BeanListTableModel<WebApplication> {
private WGAConfiguration _config;
public WebApplicationsModel(List<WebApplication> beans, WGAConfiguration config) {
super(beans);
_config = config;
}
@Override
public int getColumnCount() {
return 4;
}
@Override
public String getColumnText(WebApplication bean, int column) {
if (column == 0) {
return bean.getContentStore().getKey();
} else if (column == 1) {
return bean.getContentStore().getTitle();
} else if (column == 2) {
if (_config != null) {
Domain domain = (Domain) _config.getByUid(bean.getContentStore().getDomain());
return domain.getName();
} else {
return bean.getContentStore().getDomain();
}
} else if (column == 3) {
if (bean.getContentStore().getDesign() != null) {
return bean.getContentStore().getDesign().getName();
}
}
return null;
}
@Override
public Object getColumnValue(WebApplication bean, int column) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isColumnEditable(WebApplication bean, int column) {
return false;
}
@Override
public void setColumnValue(WebApplication bean, int column, Object value) {
}
}