Example usage for org.apache.wicket.extensions.markup.html.repeater.data.grid DataGridView DataGridView

List of usage examples for org.apache.wicket.extensions.markup.html.repeater.data.grid DataGridView DataGridView

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.markup.html.repeater.data.grid DataGridView DataGridView.

Prototype

public DataGridView(final String id, final List<? extends ICellPopulator<T>> populators,
        final IDataProvider<T> dataProvider) 

Source Link

Document

Constructor Notice cells are created in the same order as cell populators in the list

Usage

From source file:de.twenty11.skysail.client.osgimonitor.wicket.pages.bundles.dg.DataGridPage.java

License:Apache License

/**
 * constructor/*  w  w w  .  j  av a  2s  .  c o m*/
 */
public DataGridPage() {
    List<ICellPopulator<Bundle>> columns = new ArrayList<ICellPopulator<Bundle>>();

    columns.add(new PropertyPopulator<Bundle>("id"));
    columns.add(new PropertyPopulator<Bundle>("symboliName"));
    columns.add(new PropertyPopulator<Bundle>("lastName"));
    columns.add(new PropertyPopulator<Bundle>("homePhone"));
    columns.add(new PropertyPopulator<Bundle>("cellPhone"));

    add(new DataGridView<Bundle>("rows", columns, new SortableContactDataProvider()));
}

From source file:org.hippoecm.frontend.plugins.cms.admin.system.SystemInfoPanel.java

License:Apache License

public SystemInfoPanel(final String id, final IBreadCrumbModel breadCrumbModel) {
    super(id, breadCrumbModel);
    setOutputMarkupId(true);//w w w.jav a  2s.  c  o  m

    List<ICellPopulator> columns = new ArrayList<ICellPopulator>(2);
    columns.add(new PropertyPopulator("Key"));
    columns.add(new PropertyPopulator("Value"));
    add(new DataGridView("rows", columns, memoryInfo) {
        private static final long serialVersionUID = 1L;

        protected Item newRowItem(String id, int index, IModel model) {
            return new OddEvenItem(id, index, model);
        }
    });

    add(new AjaxLink("refresh") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            memoryInfo.refresh();
            target.add(SystemInfoPanel.this);
        }
    });

    add(new AjaxLink("gc") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            System.gc();
            memoryInfo.refresh();
            target.add(SystemInfoPanel.this);
        }
    });
}

From source file:org.hippoecm.frontend.plugins.console.menu.systeminfo.SystemInfoDialog.java

License:Apache License

public SystemInfoDialog() {
    add(new Label("label", getTitle()));

    List<ICellPopulator> columns = new ArrayList<>(2);
    columns.add(new PropertyPopulator("Key"));
    columns.add(new PropertyPopulator("Value"));
    add(new DataGridView("rows", columns, new SystemInfoDataProvider()) {
        private static final long serialVersionUID = 1L;

        protected Item newRowItem(String id, int index, IModel model) {
            return new OddEvenItem(id, index, model);
        }/*from  w  w w .ja va 2 s .  com*/
    });

    setCancelVisible(false);
    setOkLabel(new Model<>("Close"));
}

From source file:wickettree.TableTree.java

License:Apache License

/**
 * Constructor//from  w w w. jav  a2  s .c  om
 * 
 * @param id
 *            component id
 * @param columns
 *            list of column definitions
 * @param provider
 *            provider of the tree
 * @param itemsPerPage
 *            number of rows per page
 * @param state
 *            state of nodes
 */
public TableTree(String id, List<IColumn<T>> columns, ITreeProvider<T> provider, int itemsPerPage,
        IModel<Set<T>> state) {
    super(id, provider, state);

    if (columns == null || columns.isEmpty()) {
        throw new IllegalArgumentException("Argument `columns` cannot be null or empty");
    }
    for (IColumn<T> column : columns) {
        if (column instanceof ITreeColumn<?>) {
            ((ITreeColumn<T>) column).setTree(this);
        }
    }
    this.columns = columns;

    WebMarkupContainer body = newBodyContainer("body");
    add(body);

    datagrid = new DataGridView<T>("rows", columns, newDataProvider(provider)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected Item<ICellPopulator<T>> newCellItem(String id, int index, IModel<ICellPopulator<T>> model) {
            Item<ICellPopulator<T>> item = TableTree.this.newCellItem(id, index, model);

            final IColumn<?> column = TableTree.this.columns.get(index);
            if (column instanceof IStyledColumn<?>) {
                item.add(new AttributeAppender("class", Model.of(((IStyledColumn<?>) column).getCssClass()),
                        " "));
            }

            return item;
        }

        @Override
        protected Item<T> newRowItem(String id, int index, IModel<T> model) {
            Item<T> item = TableTree.this.newRowItem(id, index, model);

            // @see #updateNode(T, AjaxRequestTarget)
            item.setOutputMarkupId(true);

            return item;
        }
    };
    datagrid.setItemsPerPage(itemsPerPage);
    datagrid.setItemReuseStrategy(new IItemReuseStrategy() {
        private static final long serialVersionUID = 1L;

        public <S> Iterator<Item<S>> getItems(IItemFactory<S> factory, Iterator<IModel<S>> newModels,
                Iterator<Item<S>> existingItems) {
            return TableTree.this.getItemReuseStrategy().getItems(factory, newModels, existingItems);
        }
    });
    body.add(datagrid);

    topToolbars = new ToolbarsContainer("topToolbars");
    bottomToolbars = new ToolbarsContainer("bottomToolbars");
    add(topToolbars);
    add(bottomToolbars);
}