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: TabWindowItem.java,v 1.13 2007/01/28 21:25:10 jesper Exp $
023: package net.infonode.docking.model;
024:
025: import net.infonode.docking.DockingWindow;
026: import net.infonode.docking.internal.WriteContext;
027: import net.infonode.docking.properties.TabWindowProperties;
028: import net.infonode.properties.propertymap.PropertyMap;
029:
030: import java.io.IOException;
031: import java.io.ObjectOutputStream;
032: import java.util.ArrayList;
033:
034: /**
035: * @author $Author: jesper $
036: * @version $Revision: 1.13 $
037: */
038: public class TabWindowItem extends AbstractTabWindowItem {
039: public static final TabWindowProperties emptyProperties = new TabWindowProperties();
040:
041: private TabWindowProperties tabWindowProperties;
042: private TabWindowProperties parentProperties = emptyProperties;
043:
044: public TabWindowItem() {
045: tabWindowProperties = new TabWindowProperties(emptyProperties);
046: }
047:
048: public TabWindowItem(TabWindowItem windowItem) {
049: super (windowItem);
050: tabWindowProperties = new TabWindowProperties(windowItem
051: .getTabWindowProperties().getMap().copy(true, true));
052: tabWindowProperties.getMap().replaceSuperMap(
053: windowItem.getParentTabWindowProperties().getMap(),
054: emptyProperties.getMap());
055: }
056:
057: protected DockingWindow createWindow(ViewReader viewReader,
058: ArrayList childWindows) {
059: return childWindows.size() == 0 ? null : viewReader
060: .createTabWindow(
061: (DockingWindow[]) childWindows
062: .toArray(new DockingWindow[childWindows
063: .size()]), this );
064: }
065:
066: public TabWindowProperties getTabWindowProperties() {
067: return tabWindowProperties;
068: }
069:
070: public void setTabWindowProperties(
071: TabWindowProperties tabWindowProperties) {
072: this .tabWindowProperties = tabWindowProperties;
073: }
074:
075: public TabWindowProperties getParentTabWindowProperties() {
076: return parentProperties;
077: }
078:
079: public void setParentTabWindowProperties(
080: TabWindowProperties parentProperties) {
081: tabWindowProperties.getMap().replaceSuperMap(
082: this .parentProperties.getMap(),
083: parentProperties.getMap());
084: this .parentProperties = parentProperties;
085: }
086:
087: public WindowItem copy() {
088: return new TabWindowItem(this );
089: }
090:
091: public void write(ObjectOutputStream out, WriteContext context,
092: ViewWriter viewWriter) throws IOException {
093: out.writeInt(WindowItemDecoder.TAB);
094: super .write(out, context, viewWriter);
095: }
096:
097: protected PropertyMap getPropertyObject() {
098: return getTabWindowProperties().getMap();
099: }
100:
101: public void clearWindows() {
102: // Do nothing
103: }
104:
105: public String toString() {
106: return "TabWindow: " + super.toString();
107: }
108:
109: }
|