01: /*
02: * Copyright (C) 2004 NNL Technology AB
03: * Visit www.infonode.net for information about InfoNode(R)
04: * products and how to contact NNL Technology AB.
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * of the License, or (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19: * MA 02111-1307, USA.
20: */
21:
22: // $Id: ViewItem.java,v 1.8 2005/06/19 20:56:31 jesper Exp $
23: package net.infonode.docking.model;
24:
25: import net.infonode.docking.DockingWindow;
26: import net.infonode.docking.View;
27: import net.infonode.docking.internal.ReadContext;
28: import net.infonode.docking.internal.WriteContext;
29: import net.infonode.docking.properties.ViewProperties;
30: import net.infonode.properties.propertymap.PropertyMap;
31:
32: import java.io.IOException;
33: import java.io.ObjectInputStream;
34: import java.io.ObjectOutputStream;
35: import java.util.ArrayList;
36:
37: /**
38: * @author $Author: jesper $
39: * @version $Revision: 1.8 $
40: */
41: public class ViewItem extends WindowItem {
42: private ViewProperties viewProperties = new ViewProperties();
43:
44: public ViewItem() {
45: }
46:
47: public ViewItem(ViewItem viewItem) {
48: super (viewItem);
49: }
50:
51: protected PropertyMap getPropertyObject() {
52: return viewProperties.getMap();
53: }
54:
55: protected DockingWindow createWindow(ViewReader viewReader,
56: ArrayList childWindows) {
57: return null;
58: }
59:
60: public ViewProperties getViewProperties() {
61: return viewProperties;
62: }
63:
64: public void write(ObjectOutputStream out, WriteContext context,
65: ViewWriter viewWriter) throws IOException {
66: out.writeInt(WindowItemDecoder.VIEW);
67: DockingWindow window = getConnectedWindow();
68: viewWriter.writeView((View) getConnectedWindow(), out, context);
69: out.writeBoolean(window != null && !window.isMinimized()
70: && !window.isUndocked()
71: && window.getRootWindow() != null);
72: }
73:
74: public DockingWindow read(ObjectInputStream in,
75: ReadContext context, ViewReader viewReader)
76: throws IOException {
77: return in.readBoolean() ? getConnectedWindow() : null;
78: }
79:
80: public WindowItem copy() {
81: return new ViewItem(this);
82: }
83:
84: }
|