Cell colors for issueLog priority field added

This commit is contained in:
Misha 2015-12-03 19:09:21 +02:00
parent a66ba52b40
commit 22671e7641
3 changed files with 39 additions and 3 deletions

View file

@ -24,6 +24,7 @@ import static org.libreplan.web.I18nHelper._;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import org.apache.commons.logging.LogFactory;
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
@ -46,6 +47,9 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.*;
import javax.swing.*;
import javax.swing.table.TableCellEditor;
/**
* Controller for IssueLog CRUD actions
*
@ -182,10 +186,28 @@ public class IssueLogCRUDController extends BaseCRUDController<IssueLog> {
appendDate(row, issueLog.getDateResolved());
appendLabel(row, issueLog.getNotes());
appendOperations(row, issueLog);
setPriorityColor(row, issueLog.getPriority());
}
};
}
private void setPriorityColor(Row row, LowMediumHighEnum priority) {
if (priority == LowMediumHighEnum.LOW) {
Cell cell = (Cell) row.getChildren().get(5);
cell.setClass("Issuelog-priority-color-green");
}
if (priority == LowMediumHighEnum.MEDIUM) {
Cell cell = (Cell) row.getChildren().get(5);
cell.setClass("Issuelog-priority-color-yellow");
}
if (priority == LowMediumHighEnum.HIGH) {
Cell cell = (Cell) row.getChildren().get(5);
cell.setClass("Issuelog-priority-color-red");
}
}
/**
* Appends the specified <code>object</code> to the specified
* <code>row</code>
@ -210,7 +232,9 @@ public class IssueLogCRUDController extends BaseCRUDController<IssueLog> {
*/
private void appendLabel(final Row row, String value) {
Label label = new Label(value);
row.appendChild(label);
Cell cell = new Cell();
cell.appendChild(label);
row.appendChild(cell);
}
/**

View file

@ -1940,3 +1940,15 @@ select {
.z-menu-popup a:focus {
text-decoration: none !important;
}
.Issuelog-priority-color-red {
background: red !important;
}
.Issuelog-priority-color-yellow {
background: yellow !important;
}
.Issuelog-priority-color-green {
background: green !important;
}

View file

@ -21,9 +21,9 @@
pageSize="15" span="0" sizedByContent="false"
rowRenderer="@{issueLogController.issueLogsRowRenderer}">
<columns sizable="true">
<column label="${i18n:_('Code')}" sort="auto(lower(code))" />
<column label="${i18n:_('Code')}" sort="auto(lower(code))" id="code"/>
<column label="${i18n:_('Projectname')}" visible="@{logsController.projectNameVisibility}" sort="auto(lower(order))" />
<column label="${i18n:_('Type')}" sort="auto(lower(type))"/>
<column label="${i18n:_('Type')}" sort="auto(lower(type))" width="9%"/>
<column label="${i18n:_('Status')}" sort="auto(lower(status))"/>
<column label="${i18n:_('Description')}" sort="auto(lower(description))"/>
<column label="${i18n:_('Priority')}" sort="auto(lower(priority))"/>