Class QuickViewBase<T>

    • Constructor Detail

      • QuickViewBase

        public QuickViewBase​(String id,
                             IDataProvider<T> dataProvider,
                             IQuickReuseStrategy reuseStrategy)
        Parameters:
        id - component id
        dataProvider - dataprovider of objects
        reuseStrategy - children are created again on render
      • QuickViewBase

        public QuickViewBase​(String id,
                             IDataProvider<T> dataProvider,
                             IQuickReuseStrategy reuseStrategy,
                             Component start,
                             Component end)
        Parameters:
        id - component id
        dataProvider - dataprovider of objects
        reuseStrategy - children are created again on render
        start - start of view
        end - end of view
    • Method Detail

      • initializeAddAtStartStoreIfRequired

        protected void initializeAddAtStartStoreIfRequired()
      • getItemsPerRequest

        public int getItemsPerRequest()
      • setItemsPerRequest

        public void setItemsPerRequest​(int items)
      • getStart

        public final Component getStart()
        represents start of view ,can be any component it's position in the markup should be just before view this is done so that the new children doesn't get mixedup with the other markup or another components specified in immediate parent
        Returns:
        component using as start boundary
      • getEnd

        public final Component getEnd()
        represents end of view ,can be any component it's position in the markup should be just after the view this is done so that the new children doesn't get mixedup with the other markup or another components specified in immediate parent
        Returns:
        component used as end boundary
      • buildItem

        public Item<T> buildItem​(String id,
                                 int index,
                                 T object)
        use in stateless environment as there is no state ,it's user's responsiblity to give unique id and index
        Parameters:
        id -
        index -
        object -
        Returns:
        item
      • buildItem

        protected Item buildItem​(int index,
                                 IModel<T> model)
      • isAjax

        public boolean isAjax()
      • simpleAdd

        public MarkupContainer simpleAdd​(Component... components)
        it's a simple add,new item is not drawn just added,no js fired
        Parameters:
        components - component to be added
        Returns:
        this
      • simpleRemove

        public MarkupContainer simpleRemove​(Component c)
        it's a simple remove,the item is just removed from quickview ,no js fired
        Parameters:
        c -
        Returns:
        this
      • getItems

        public Iterator<Component> getItems()
        iterator which iterates through the items in the order they are rendered in view ie. first items added using addAtStart(*) are fetched and then items added using add(*)
        Returns:
        items iterator
      • addItemsForPage

        public List<Item<T>> addItemsForPage​(long page)
        Description copied from interface: IQuickView
        create and draw children for the provided page ,number of children created are smaller than equal to getItemsPerRequest()
        Specified by:
        addItemsForPage in interface IQuickView<T>
        Returns:
        list of components created
      • newModels

        protected Iterator<IModel<T>> newModels​(long offset,
                                                long count)
      • createChildren

        protected void createChildren​(Iterator<Item<T>> iterator)
      • buildItemsList

        protected List<Item<T>> buildItemsList​(int index,
                                               Iterator<? extends T> iterator)
      • buildItemsList

        protected List<Item<T>> buildItemsList​(Iterator<? extends T> iterator)
      • getItemsCount

        public final long getItemsCount()
        same as dataprovider size but cached for request to improve performance in case of multiple call to avoid unnecessary expensive call of IDataProvider.size()
        Returns:
        dataprovider's size
      • getRowsCount

        public final long getRowsCount()
        same as getItemsCount() but takes into account hierarchy so if the view is not visible in hierarchy the returned value is zero else return the getItemsCount() value
        Returns:
        items count visible
      • getPageCount

        public final long getPageCount()
        calculates the number of pages
        Specified by:
        getPageCount in interface IPageable
        Returns:
        number of pages
      • _getPageCount

        protected long _getPageCount()
        don't override ,it's used for testing purpose
        Returns:
        number of pages
      • _getCurrentPage

        protected long _getCurrentPage()
        don't override,it's for internal use
      • _setCurrentPage

        protected void _setCurrentPage​(long page)
        don't override,it's for internal use
      • populate

        protected abstract void populate​(Item<T> item)
      • _getParent

        protected MarkupContainer _getParent()
        don't override,it's for internal use
      • _contributeAddAtEndScripts

        protected void _contributeAddAtEndScripts​(Component... components)
      • addNewItems

        public MarkupContainer addNewItems​(T... objects)
        this does 2 steps

        1)creates children ,children will get the model object after iterating over objects passed as argument 2)adds children to View using add(org.apache.wicket.Component...)

        Parameters:
        objects - iterator of model objects for children
        Returns:
        this
      • addNewItemsAtStart

        public MarkupContainer addNewItemsAtStart​(T... objects)
        this does 2 steps

        1)creates children ,children will get the model object after iterating over objects passed as argument 2)adds children to View using addAtStart(org.apache.wicket.Component...)

        the respective items for objects will be displayed at start of the view in the order of passed objects

        Parameters:
        objects - iterator of model objects for children
        Returns:
        this
      • _contributeAddAtStartScripts

        protected void _contributeAddAtStartScripts​(Component... components)
      • scrollToBottom

        public void scrollToBottom()
        when called on ajax event ,this method moves navigation-bar to bottom, this works when parent has scroll specified in css by defining overflow-y property
      • scrollToTop

        public void scrollToTop()
        when called on ajax event, this method moves navigation-bar to top , this works when parent has scroll specified in css by defining overflow-y property
      • scrollTo

        public void scrollTo​(int height)
        when called on ajax event, this method moves navigation-bar to height passed in method , this works when parent has scroll specified in css by defining overflow-y property
      • register

        public void register​(Class<? extends IPartialPageRequestHandler> requestHandler)
        register partial page request handler class,for eg. for websocket register(IWebSocketRequestHandler.class) ,

        NO need to register AjaxRequestTarget quickview is already aware of that

        Parameters:
        requestHandler -
      • getSynchronizer

        public Synchronizer getSynchronizer()
        Synchronizer basically adds components(repeater's items) and scripts to the associated IPartialPageRequestHandler after checking parent is not added to AjaxRequestTarget. If parent is added scripts and items are not added to the requesthandler
      • _setRequestMetaData

        protected <T> void _setRequestMetaData​(MetaDataKey<T> key,
                                               T value)
      • _getRequestMetaData

        protected <T> T _getRequestMetaData​(MetaDataKey<T> key)
      • nonARTSynchronizer

        public Synchronizer nonARTSynchronizer()