001: /*
002: * Copyright (C) 2004 NNL Technology AB
003: * Visit www.infonode.net for information about InfoNode(R)
004: * products and how to contact NNL Technology AB.
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
019: * MA 02111-1307, USA.
020: */
021:
022: // $Id: TabData.java,v 1.3 2005/12/04 13:46:05 jesper Exp $
023: package net.infonode.tabbedpanel.theme.internal.laftheme;
024:
025: import net.infonode.gui.DimensionUtil;
026: import net.infonode.tabbedpanel.Tab;
027: import net.infonode.tabbedpanel.TabbedPanel;
028: import net.infonode.util.Direction;
029:
030: import java.awt.*;
031: import java.util.ArrayList;
032:
033: class TabData {
034: private ArrayList tabList = new ArrayList();
035:
036: private ArrayList visibleTabRects = new ArrayList();
037:
038: private TabbedPanel tabbedPanel;
039:
040: private Direction areaOrientation;
041:
042: private int tabAreaHeight;
043:
044: private int tabAreaWidth;
045:
046: private int selectedTabPainterIndex;
047:
048: private Dimension tpInternalSize;
049:
050: private Tab preTab;;
051: private Tab postTab;
052:
053: public TabData() {
054: reset();
055: }
056:
057: public void reset() {
058: tabList.clear();
059: visibleTabRects.clear();
060: tabbedPanel = null;
061: areaOrientation = null;
062: tabAreaHeight = 0;
063: tabAreaWidth = 0;
064: selectedTabPainterIndex = -1;
065: tpInternalSize = null;
066: preTab = null;
067: postTab = null;
068: }
069:
070: public ArrayList getTabList() {
071: return tabList;
072: }
073:
074: public ArrayList getVisibleTabRects() {
075: return visibleTabRects;
076: }
077:
078: public Direction getAreaOrientation() {
079: return areaOrientation;
080: }
081:
082: public TabbedPanel getTabbedPanel() {
083: return tabbedPanel;
084: }
085:
086: public void initialize(TabbedPanel tabbedPanel) {
087: this .tabbedPanel = tabbedPanel;
088: areaOrientation = tabbedPanel.getProperties()
089: .getTabAreaOrientation();
090: tpInternalSize = DimensionUtil.getInnerDimension(tabbedPanel
091: .getSize(), tabbedPanel.getInsets());
092: }
093:
094: public Dimension getTabbedPanelSize() {
095: return tpInternalSize;
096: }
097:
098: public int getTabbedPanelWidth() {
099: return tpInternalSize.width;
100: }
101:
102: public int getTabbedPanelHeight() {
103: return tpInternalSize.height;
104: }
105:
106: public boolean isHorizontalLayout() {
107: return !areaOrientation.isHorizontal();
108: }
109:
110: public int getSelectedTabPainterIndex() {
111: return selectedTabPainterIndex;
112: }
113:
114: public void setSelectedTabPainterIndex(int selectedTabPainterIndex) {
115: this .selectedTabPainterIndex = selectedTabPainterIndex;
116: }
117:
118: public int getTabCount() {
119: return tabList.size();
120: }
121:
122: public int getTabAreaHeight() {
123: return tabAreaHeight;
124: }
125:
126: public void setTabAreaHeight(int tabAreaHeight) {
127: this .tabAreaHeight = tabAreaHeight;
128: }
129:
130: public int getTabAreaWidth() {
131: return tabAreaWidth;
132: }
133:
134: public void setTabAreaWidth(int tabAreaWidth) {
135: this .tabAreaWidth = tabAreaWidth;
136: }
137:
138: public Tab getPostTab() {
139: return postTab;
140: }
141:
142: public void setPostTab(Tab postTab) {
143: this .postTab = postTab;
144: }
145:
146: public Tab getPreTab() {
147: return preTab;
148: }
149:
150: public void setPreTab(Tab preTab) {
151: this.preTab = preTab;
152: }
153: }
|