Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.cdlflex.ui.markup.html.repeater.data.table.flex;
 
 import java.util.List;
 
A DataTable implementation that is optimized for the cdlflex EngineeringCockpit and its panels.

The main difference to Wicket's DataTable is how the toolbars are added to the markup. Top and bottom toolbars are no longer added to the <thead> and <tfoot> containers, but above and below the table in bootstrap row divs.

There is an additional header bar which is added to the <thead> container.

Parameters:
<T> The model object type
<S> the type of the sorting parameter
 
 public class FlexTable<T, S> extends DataTable<T, S> {
 
     private static final long serialVersionUID = 1L;
 
     private ToolbarsContainer tableHeaders;

    
Constructor.

Parameters:
id component id
skeleton a table skeleton
 
     public FlexTable(String idITableSkeleton<T, S> skeleton) {
         super(idskeleton);
         initHeaderContainer();
     }

    
Constructor.

Parameters:
id component id
columns list of columns
dataProvider data provider
rows number of rows per page
 
     public FlexTable(String idList<? extends IColumn<T, S>> columnsIDataProvider<T> dataProviderlong rows) {
         super(idcolumnsdataProviderrows);
         initHeaderContainer();
     }

    
Add the given toolbar as table header row.

Parameters:
toolbar the toolbar to add
 
     public void addTableHeader(final AbstractToolbar toolbar) {
         addToolbar(toolbar);
     }

    
Adds the given Toolbar to the given ToolbarsContainer.

Parameters:
toolbar the toolbar to add
container the container to add the toolbar to
 
     protected void addToolbar(final AbstractToolbar toolbarfinal ToolbarsContainer container) {
         Args.notNull(toolbar"toolbar");
 
         container.getRepeatingView().add(toolbar);
     }
 
     private void initHeaderContainer() {
          = new ToolbarsContainer("tableHeaders");
         add();
     }
 
     @Override
    protected void onComponentTag(ComponentTag tag) {
        super.onComponentTag(tag);
        tag.setName("div"); // this ugly hack is brought to you by WICKET-5534
    }

    
This class acts as a repeater that will contain the toolbar. It makes sure that the table row group (e.g. thead) tags are only visible when they contain rows in accordance with the HTML specification.

Copied from Wicket's DataTable as it is private there.

    protected static final class ToolbarsContainer extends WebMarkupContainer {
        private static final long serialVersionUID = 1L;
        private final RepeatingView toolbars;
        private ToolbarsContainer(final String id) {
            super(id);
             = new RepeatingView("toolbars");
            add();
        }

        
Returns the repeating view that holds the toolbars.

Returns:
toolbar container repeating view
        public RepeatingView getRepeatingView() {
            return ;
        }
        @Override
        public void onConfigure() {
            super.onConfigure();
            .configure();
            Boolean visible = .visitChildren(new IVisitor<ComponentBoolean>() {
                @Override
                public void component(Component objectIVisit<Booleanvisit) {
                    object.configure();
                    if (object.isVisible()) {
                        visit.stop(.);
                    } else {
                        visit.dontGoDeeper();
                    }
                }
            });
            if (visible == null) {
                visible = false;
            }
            setVisible(visible);
        }
    }
New to GrepCode? Check out our FAQ X