1 package org.apache.archiva.redback.integration.eXc.views;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.util.Iterator;
24 import org.extremecomponents.table.bean.Export;
25 import org.extremecomponents.table.core.TableModel;
26 import org.extremecomponents.table.view.html.BuilderConstants;
27 import org.extremecomponents.table.view.html.BuilderUtils;
28 import org.extremecomponents.table.view.html.StatusBarBuilder;
29 import org.extremecomponents.table.view.html.ToolbarBuilder;
30 import org.extremecomponents.table.view.html.TwoColumnRowLayout;
31 import org.extremecomponents.util.HtmlBuilder;
36 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
39 public class SecurityToolbar
40 extends TwoColumnRowLayout
42 public SecurityToolbar( HtmlBuilder html, TableModel model )
47 protected boolean showLayout( TableModel model )
49 boolean showStatusBar = BuilderUtils.showStatusBar( model );
50 boolean filterable = BuilderUtils.filterable( model );
51 boolean showExports = BuilderUtils.showExports( model );
52 boolean showPagination = BuilderUtils.showPagination( model );
53 boolean showTitle = BuilderUtils.showTitle( model );
54 if ( !showStatusBar && !filterable && !showExports && !showPagination && !showTitle )
62 protected void columnLeft( HtmlBuilder html, TableModel model )
64 boolean showStatusBar = BuilderUtils.showStatusBar( model );
70 html.td( 4 ).styleClass( BuilderConstants.STATUS_BAR_CSS ).close();
72 new StatusBarBuilder( html, model ).statusMessage();
77 @SuppressWarnings("unchecked")
78 protected void columnRight( HtmlBuilder html, TableModel model )
80 boolean filterable = BuilderUtils.filterable( model );
81 boolean showPagination = BuilderUtils.showPagination( model );
82 boolean showExports = BuilderUtils.showExports( model );
84 ToolbarBuilder toolbarBuilder = new ToolbarBuilder( html, model );
86 html.td( 4 ).styleClass( BuilderConstants.COMPACT_TOOLBAR_CSS ).align( "right" ).close();
88 html.table( 4 ).border( "0" ).cellPadding( "1" ).cellSpacing( "2" ).close();
94 html.append( "Navigation:" );
98 toolbarBuilder.firstPageItemAsImage();
101 html.td( 5 ).close();
102 toolbarBuilder.prevPageItemAsImage();
105 html.td( 5 ).close();
106 toolbarBuilder.nextPageItemAsImage();
109 html.td( 5 ).close();
110 toolbarBuilder.lastPageItemAsImage();
113 html.td( 5 ).close();
114 toolbarBuilder.separator();
117 html.td( 5 ).close();
118 html.append( "Display Rows:" );
121 html.td( 5 ).close();
122 toolbarBuilder.rowsDisplayedDroplist();
127 html.td( 5 ).close();
128 toolbarBuilder.separator();
135 Iterator iterator = model.getExportHandler().getExports().iterator();
136 for ( Iterator iter = iterator; iter.hasNext(); )
138 html.td( 5 ).close();
139 Export export = (Export) iter.next();
140 toolbarBuilder.exportItemAsImage( export );
147 if ( showExports || showPagination )
149 html.td( 5 ).close();
150 toolbarBuilder.separator();
154 html.td( 5 ).close();
155 toolbarBuilder.filterItemAsButton();
158 html.td( 5 ).close();
159 toolbarBuilder.clearItemAsButton();