Update the entity before call the super method

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-04-12 13:42:57 +02:00
parent d91922dc04
commit 27e4b550f2

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.ui.artifacts.smtable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
@@ -24,6 +25,7 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.TableColumn;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
@@ -42,8 +44,6 @@ import com.vaadin.ui.UI;
/**
* Header of Software module table.
*
*
*
*/
@SpringComponent
@@ -129,6 +129,22 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
return artifactUploadState.isSwModuleTableMaximized();
}
@Override
protected SoftwareModule findEntityByTableValue(final Long entityTableId) {
return softwareManagement.findSoftwareModuleById(entityTableId);
}
@Override
protected ArtifactUploadState getManagmentEntityState() {
return artifactUploadState;
}
@Override
protected void publishEntityAfterValueChange(final SoftwareModule lastSoftwareModule) {
artifactUploadState.setSelectedBaseSoftwareModule(lastSoftwareModule);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
}
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SoftwareModuleEvent event) {
onBaseEntityEvent(event);
@@ -149,6 +165,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
}
select(baseEntity.getId());
return item;
}
@SuppressWarnings("unchecked")
@@ -162,6 +179,16 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
super.updateEntity(baseEntity, item);
}
@Override
protected List<TableColumn> getTableVisibleColumns() {
final List<TableColumn> columnList = super.getTableVisibleColumns();
if (!isMaximized()) {
return columnList;
}
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VENDOR, i18n.get("header.vendor"), 0.1F));
return columnList;
}
@Override
protected DropHandler getTableDropHandler() {
return new DropHandler() {
@@ -180,22 +207,6 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
};
}
@Override
protected SoftwareModule findEntityByTableValue(final Long entityTableId) {
return softwareManagement.findSoftwareModuleById(entityTableId);
}
@Override
protected ArtifactUploadState getManagmentEntityState() {
return artifactUploadState;
}
@Override
protected void publishEntityAfterValueChange(final SoftwareModule lastSoftwareModule) {
artifactUploadState.setSelectedBaseSoftwareModule(lastSoftwareModule);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.SELECTED_ENTITY, lastSoftwareModule));
}
@Override
protected void setDataAvailable(final boolean available) {
artifactUploadState.setNoDataAvilableSoftwareModule(!available);