Search in sources :

Example 1 with ListHead

use of org.adempiere.webui.component.ListHead in project adempiere by adempiere.

the class WBrowserTable method setData.

/**
	 * Set the data model and column header names for the Listbox.
	 *
	 * @param model        The data model to assign to the table
	 * @param columnNames  The names of the table columns
	 */
public void setData(ListModelTable model, List<? extends String> columnNames) {
    WBrowserListItemRenderer rowRenderer = null;
    int size = 0;
    if (columnNames != null)
        size = columnNames.size();
    //	
    if (size > 0) {
        //	 instantiate our custom row renderer
        rowRenderer = new WBrowserListItemRenderer(this);
        // add listener for listening to component changes
        rowRenderer.addTableValueChangeListener(this);
    }
    // assign the model and renderer
    this.setModel(model);
    if (rowRenderer != null) {
        getModel().setNoColumns(size);
        this.setItemRenderer(rowRenderer);
        //recreate listhead if needed
        ListHead head = super.getListHead();
        if (head != null) {
            head.getChildren().clear();
            rowRenderer.renderListHead(head);
        }
    }
    autoSize();
    if (isShowTotals())
        addTotals();
    // re-render
    this.repaint();
    return;
}
Also used : ListHead(org.adempiere.webui.component.ListHead)

Example 2 with ListHead

use of org.adempiere.webui.component.ListHead in project adempiere by adempiere.

the class WListItemRendererTest method testClearColumns.

/**
	 * Test method for {@link org.adempiere.webui.component.WListItemRenderer#clearColumns()}.
	 */
@Test
public final void testClearColumns() {
    ListHead head = new ListHead();
    m_renderer.clearColumns();
    assertEquals(0, m_renderer.getNoColumns());
    m_renderer.renderListHead(head);
    assertEquals(0, head.getChildren().size());
}
Also used : ListHead(org.adempiere.webui.component.ListHead) Test(org.junit.Test)

Example 3 with ListHead

use of org.adempiere.webui.component.ListHead in project adempiere by adempiere.

the class WListItemRendererTest method testUpdateColumn.

/**
	 * Test method for {@link org.adempiere.webui.component.WListItemRenderer#updateColumn(int, java.lang.String)}.
	 */
@Test
public final void testUpdateColumn() {
    ListHead head = new ListHead();
    ListHeader header;
    m_renderer.updateColumn(1, "Address");
    assertEquals(2, m_renderer.getNoColumns());
    m_renderer.renderListHead(head);
    header = (ListHeader) head.getChildren().get(1);
    assertEquals("Address", header.getLabel());
}
Also used : ListHead(org.adempiere.webui.component.ListHead) ListHeader(org.adempiere.webui.component.ListHeader) Test(org.junit.Test)

Example 4 with ListHead

use of org.adempiere.webui.component.ListHead in project adempiere by adempiere.

the class WListItemRendererTest method testRenderListHead.

/**
	 * Test method for {@link org.adempiere.webui.component.WListItemRenderer#renderListHead(org.adempiere.webui.component.ListHead)}.
	 */
@Test
public final void testRenderListHead() {
    ListHead head = new ListHead();
    Object header;
    m_renderer.renderListHead(head);
    assertEquals(2, head.getChildren().size());
    header = head.getChildren().get(1);
    assertTrue(header instanceof ListHeader);
    assertEquals("Age", ((ListHeader) header).getLabel());
}
Also used : ListHead(org.adempiere.webui.component.ListHead) ListHeader(org.adempiere.webui.component.ListHeader) Test(org.junit.Test)

Example 5 with ListHead

use of org.adempiere.webui.component.ListHead in project adempiere by adempiere.

the class WBrowserTable method initialiseHeader.

/**
	 * Create the listbox header by fetching it from the renderer and adding
	 * it to the Listbox.
	 *
	 */
private void initialiseHeader() {
    ListHead head = null;
    head = super.getListHead();
    //init only once
    if (head != null) {
        return;
    }
    head = new ListHead();
    // render list head
    if (this.getItemRenderer() instanceof WBrowserListItemRenderer) {
        ((WBrowserListItemRenderer) this.getItemRenderer()).renderListHead(head);
    } else {
        throw new ApplicationException("Rendering of the ListHead is unsupported for " + this.getItemRenderer().getClass().getSimpleName());
    }
    //attach the listhead
    head.setParent(this);
    return;
}
Also used : ApplicationException(org.adempiere.webui.exception.ApplicationException) ListHead(org.adempiere.webui.component.ListHead)

Aggregations

ListHead (org.adempiere.webui.component.ListHead)8 ListHeader (org.adempiere.webui.component.ListHeader)5 Test (org.junit.Test)3 Button (org.adempiere.webui.component.Button)2 Listbox (org.adempiere.webui.component.Listbox)2 ToolBarButton (org.adempiere.webui.component.ToolBarButton)2 Hbox (org.zkoss.zul.Hbox)2 Vbox (org.zkoss.zul.Vbox)2 SQLException (java.sql.SQLException)1 Checkbox (org.adempiere.webui.component.Checkbox)1 Combobox (org.adempiere.webui.component.Combobox)1 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)1 ListItem (org.adempiere.webui.component.ListItem)1 Panel (org.adempiere.webui.component.Panel)1 Tabpanel (org.adempiere.webui.component.Tabpanel)1 ToolBar (org.adempiere.webui.component.ToolBar)1 WAppsAction (org.adempiere.webui.component.WAppsAction)1 ApplicationException (org.adempiere.webui.exception.ApplicationException)1 Span (org.zkoss.zhtml.Span)1 AuFocus (org.zkoss.zk.au.out.AuFocus)1