Improve the appearance of the new current row indicator.

This commit is contained in:
Heng Sin Low 2012-03-20 16:20:17 +08:00
parent 3e652da6a6
commit 2031119209
3 changed files with 22 additions and 17 deletions

View File

@ -267,8 +267,10 @@ public class GridPanel extends Borderlayout implements EventListener
frozen.setColumns(1); frozen.setColumns(1);
listbox.appendChild(frozen); listbox.appendChild(frozen);
org.zkoss.zul.Column indicator = new Column(); org.zkoss.zul.Column indicator = new Column();
indicator.setWidth("30px"); indicator.setWidth("10px");
try {
indicator.setSort("none");
} catch (Exception e) {}
columns.appendChild(indicator); columns.appendChild(indicator);
listbox.appendChild(columns); listbox.appendChild(columns);
columns.setSizable(true); columns.setSizable(true);

View File

@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.adempiere.util.GridRowCtx; import org.adempiere.util.GridRowCtx;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;
@ -47,6 +48,7 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Grid; import org.zkoss.zul.Grid;
import org.zkoss.zul.Paging; import org.zkoss.zul.Paging;
@ -368,12 +370,11 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
rowIndex = (paging.getActivePage() * paging.getPageSize()) + rowIndex; rowIndex = (paging.getActivePage() * paging.getPageSize()) + rowIndex;
} }
Div indicatorDiv = new Div(); Cell cell = new Cell();
indicatorDiv.setStyle("text-align: center; border: none; width: 100%; height: 100%;"); cell.setWidth("10px");
indicatorDiv.appendChild(new Label());
//TODO: checkbox for selection and batch action ( delete, export, complete, etc ) //TODO: checkbox for selection and batch action ( delete, export, complete, etc )
// indicatorDiv.appendChild(new Checkbox()); // cell.appendChild(new Checkbox());
row.appendChild(indicatorDiv); row.appendChild(cell);
int colIndex = -1; int colIndex = -1;
for (int i = 0; i < columnCount; i++) { for (int i = 0; i < columnCount; i++) {
@ -419,19 +420,16 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
*/ */
public void setCurrentRow(Row row) { public void setCurrentRow(Row row) {
if (currentRow != null && currentRow.getParent() != null && currentRow != row) { if (currentRow != null && currentRow.getParent() != null && currentRow != row) {
Div div = (Div) currentRow.getFirstChild(); Cell cell = (Cell) currentRow.getFirstChild();
if (div != null) { if (cell != null) {
Label label = (Label) div.getFirstChild(); cell.setStyle("background-color: transparent");
label.getChildren().clear(); cell.setSclass(null);
} }
} }
currentRow = row; currentRow = row;
Div div = (Div) currentRow.getFirstChild(); Cell cell = (Cell) currentRow.getFirstChild();
if (div != null) { if (cell != null) {
Label label = (Label) div.getFirstChild(); cell.setSclass("current-row-indicator");
label.getChildren().clear();
label.appendChild(new Text(">>"));
label.setStyle("color: darkblue; font-weight: bold; text-align: center");
} }
currentRowIndex = gridTab.getCurrentRow(); currentRowIndex = gridTab.getCurrentRow();

View File

@ -349,6 +349,11 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
border-right: 2px solid #9CBDFF; border-right: 2px solid #9CBDFF;
} }
.current-row-indicator {
background-color: #FA962F !important;
background-image: none !important;
}
<%-- status bar --%> <%-- status bar --%>
.status { .status {
width: 100%; width: 100%;