View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.gui.panels.matrices;
17  
18  import javax.swing.SwingConstants;
19  
20  import net.sf.jeppers.grid.JGrid;
21  import net.sf.jeppers.grid.JGridHeader;
22  
23  /**
24   * 
25   * Header implementation for {@link JGrid}. Implements numbering of rows and
26   * adds a prefix by initializing {@link GridHeaderModel} properly.
27   * 
28   * Created on January 14, 2007
29   * 
30   * @author Christina Bohk
31   * @author Roland Ewald
32   * 
33   */
34  public class GridHeader extends JGridHeader {
35  
36    /**
37     * Serialization ID.
38     */
39    private static final long serialVersionUID = 8687133380633075120L;
40  
41    /**
42     * Default constructor.
43     * 
44     * @param grid
45     *          the {@link JGrid} component
46     * @param pref
47     *          the desired prefix
48     * @param startWithOne
49     *          flag that determines if row/column enumeration starts with one
50     *          (true) or with zero (false)
51     * @param column
52     *          true iff this is a column header
53     */
54    public GridHeader(JGrid grid, String pref, boolean startWithOne,
55        boolean column) {
56      super(grid, column ? SwingConstants.HORIZONTAL : SwingConstants.VERTICAL);
57      this.setGridModel(new GridHeaderModel(column ? grid.getColumnModel() : grid
58          .getRowModel(), pref, startWithOne, column));
59    }
60  
61  }