Showing type for order's aggregated hours
This commit is contained in:
parent
568acf930b
commit
8a6a9fb41f
2 changed files with 32 additions and 0 deletions
|
|
@ -28,12 +28,15 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.orders.entities.AggregatedHoursGroup;
|
||||
import org.navalplanner.business.planner.entities.AggregateOfResourceAllocations;
|
||||
import org.navalplanner.business.planner.entities.CalculatedValue;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.Task;
|
||||
import org.navalplanner.business.resources.entities.ResourceEnum;
|
||||
import org.navalplanner.web.common.IMessagesForUser;
|
||||
import org.navalplanner.web.common.MessagesForUser;
|
||||
import org.navalplanner.web.common.Util;
|
||||
|
|
@ -81,6 +84,9 @@ import org.zkoss.zul.api.Window;
|
|||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class ResourceAllocationController extends GenericForwardComposer {
|
||||
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ResourceAllocationController.class);
|
||||
|
||||
private ViewSwitcher switcher;
|
||||
|
||||
private IResourceAllocationModel resourceAllocationModel;
|
||||
|
|
@ -203,6 +209,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
|
||||
public enum HoursRendererColumn {
|
||||
|
||||
|
||||
CRITERIONS {
|
||||
@Override
|
||||
public Component cell(HoursRendererColumn column,
|
||||
|
|
@ -210,6 +217,14 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
return new Label(data.getCriterionsJoinedByComma());
|
||||
}
|
||||
},
|
||||
RESOURCE_TYPE{
|
||||
|
||||
@Override
|
||||
public Component cell(HoursRendererColumn column,
|
||||
AggregatedHoursGroup data) {
|
||||
return new Label(asString(data.getResourceType()));
|
||||
}
|
||||
},
|
||||
HOURS {
|
||||
@Override
|
||||
public Component cell(HoursRendererColumn column,
|
||||
|
|
@ -220,6 +235,20 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
};
|
||||
|
||||
private static String asString(ResourceEnum resourceType) {
|
||||
switch (resourceType) {
|
||||
case RESOURCE:
|
||||
return _("Resource");
|
||||
case MACHINE:
|
||||
return _("Machine");
|
||||
case WORKER:
|
||||
return _("Worker");
|
||||
default:
|
||||
LOG.warn("no i18n for " + resourceType.name());
|
||||
return resourceType.name();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Component cell(HoursRendererColumn column,
|
||||
AggregatedHoursGroup data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,16 +98,19 @@
|
|||
<grid id="orderElementHoursGrid">
|
||||
<columns>
|
||||
<column width="200px" label="${i18n:_('Criteria')}"/>
|
||||
<column width="200px" label="${i18n:_('Type')}"/>
|
||||
<column label="${i18n:_('Hours')}" />
|
||||
</columns>
|
||||
</grid>
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="200px" />
|
||||
<column width="200px" />
|
||||
<column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label />
|
||||
<label value="${i18n:_('Total Estimated hours')}:" />
|
||||
<intbox value="@{allocationController.orderHours}" disabled="${true}" />
|
||||
</row>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue