use of org.zkoss.zul.Listcell in project adempiere by adempiere.
the class WBrowserListItemRenderer method getRowPosition.
/**
* Get the row index of the given <code>source</code> component.
*
* @param source The component for which the row index is to be found.
* @return The row index of the given component.
*/
protected int getRowPosition(Component source) {
Listcell cell;
ListItem item;
int row = -1;
cell = findListcell(source);
item = (ListItem) cell.getParent();
row = item.getIndex();
return row;
}
use of org.zkoss.zul.Listcell in project adempiere by adempiere.
the class GridTabListItemRenderer method getEditorCell.
private Listcell getEditorCell(GridField gridField, Object object, int i) {
Listcell cell = new Listcell("", null);
WEditor editor = editors.get(gridField);
if (editor != null) {
if (editor instanceof WButtonEditor) {
Object window = SessionManager.getAppDesktop().findWindow(windowNo);
if (window != null && window instanceof ADWindow) {
AbstractADWindowPanel windowPanel = ((ADWindow) window).getADWindowPanel();
((WButtonEditor) editor).addActionListener(windowPanel);
}
} else {
editor.addValueChangeListener(dataBinder);
}
cell.appendChild(editor.getComponent());
if (editor.getComponent() instanceof Checkbox || editor.getComponent() instanceof Image) {
cell.setStyle("text-align:center");
} else if (DisplayType.isNumeric(gridField.getDisplayType())) {
cell.setStyle("text-align:right");
}
gridField.addPropertyChangeListener(editor);
editor.setValue(gridField.getValue());
WEditorPopupMenu popupMenu = editor.getPopupMenu();
if (popupMenu != null) {
popupMenu.addMenuListener((ContextMenuListener) editor);
cell.appendChild(popupMenu);
}
//streach component to fill grid cell
editor.fillHorizontal();
}
return cell;
}
use of org.zkoss.zul.Listcell in project adempiere by adempiere.
the class WListItemRenderer method getColumnPosition.
/**
* Get the column index of the given <code>source</code> component.
*
* @param source The component for which the column index is to be found.
* @return The column index of the given component.
*/
protected int getColumnPosition(Component source) {
Listcell cell;
int col = -1;
cell = findListcell(source);
col = cell.getColumnIndex();
return col;
}
use of org.zkoss.zul.Listcell in project adempiere by adempiere.
the class WListItemRenderer method getRowPosition.
/**
* Get the row index of the given <code>source</code> component.
*
* @param source The component for which the row index is to be found.
* @return The row index of the given component.
*/
protected int getRowPosition(Component source) {
Listcell cell;
ListItem item;
int row = -1;
cell = findListcell(source);
item = (ListItem) cell.getParent();
row = item.getIndex();
return row;
}
use of org.zkoss.zul.Listcell in project adempiere by adempiere.
the class WListItemRenderer method render.
/**
* Renders the <code>data</code> to the specified <code>Listitem</code>.
*
* @param item the listitem to render the result.
* Note: when this method is called, the listitem has no child
* at all.
* @param data that is returned from {@link ListModel#getElementAt}
* @throws Exception
* @see {@link #render(Listitem, Object)}
*/
private void render(ListItem item, Object data) {
Listcell listcell = null;
int colIndex = 0;
int rowIndex = item.getIndex();
WListbox table = null;
if (item.getListbox() instanceof WListbox) {
table = (WListbox) item.getListbox();
}
int colorCode = 0;
if (table != null) {
colorCode = table.getColorCode(rowIndex);
if (colorCode < 0) {
// Color the row.
// TODO: do this with a class and CSS
item.setStyle("color: #FF0000; " + item.getStyle());
}
}
if (!(data instanceof List)) {
throw new IllegalArgumentException("A model element was not a list");
}
if (listBox == null || listBox != item.getListbox()) {
listBox = item.getListbox();
}
if (cellListener == null) {
cellListener = new CellListener();
}
for (Object field : (List<?>) data) {
listcell = getCellComponent(table, field, rowIndex, colIndex);
listcell.setParent(item);
listcell.addEventListener(Events.ON_DOUBLE_CLICK, cellListener);
listcell.setAttribute("zk_component_ID", "ListItem_R" + rowIndex + "_C" + colIndex);
colIndex++;
}
return;
}
Aggregations