Search in sources :

Example 1 with WTableModelEvent

use of org.adempiere.webui.event.WTableModelEvent in project adempiere by adempiere.

the class ListModelTable method setDataAt.

/**
	 * Set the cell value at <code>row</code> and <code>column</code>.
	 *
	 * @param aValue	The value to set
     * @param row    	the index of the row whose value is to be set
     * @param col		the index of the column whose value is to be set
	 */
public void setDataAt(Object aValue, int row, int col) {
    List<Object> vector;
    WTableModelEvent tcEvent;
    try {
        if (getElementAt(row) instanceof List) {
            vector = (List<Object>) getElementAt(row);
            try {
                vector.set(col, aValue);
                // create a new event and fire the event
                tcEvent = new WTableModelEvent(this, row, col);
                fireTableChange(tcEvent);
            } catch (ArrayIndexOutOfBoundsException exception) {
                throw new IllegalArgumentException("Attempted to access " + "nonexistent ListModelTable column at index " + col);
            }
        } else {
            throw new IllegalArgumentException("The ListModelTable cannot contain " + "anything other than object vectors as its row elements");
        }
    } catch (IndexOutOfBoundsException exception) {
        throw new IllegalArgumentException("Attempted to access " + "nonexistent ListModelTable row at index " + row);
    }
    return;
}
Also used : WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) ListModelList(org.zkoss.zul.ListModelList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with WTableModelEvent

use of org.adempiere.webui.event.WTableModelEvent in project adempiere by adempiere.

the class ListModelTable method sort.

/*
     * (non-Javadoc)
     * @see org.zkoss.zul.ListModelList#sort(java.util.Comparator, boolean)
     */
public void sort(Comparator cmpr, boolean ascending) {
    if (sorter != null)
        sorter.sort(cmpr, ascending);
    else
        Collections.sort(this.getInnerList(), cmpr);
    WTableModelEvent event = new WTableModelEvent(this, WTableModelEvent.ALL_ROWS, WTableModelEvent.ALL_COLUMNS);
    fireTableChange(event);
    return;
}
Also used : WTableModelEvent(org.adempiere.webui.event.WTableModelEvent)

Aggregations

WTableModelEvent (org.adempiere.webui.event.WTableModelEvent)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ListModelList (org.zkoss.zul.ListModelList)1