001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032: package com.vividsolutions.jump.workbench.ui;
033:
034: import java.awt.BorderLayout;
035:
036: import javax.swing.JInternalFrame;
037: import javax.swing.JScrollPane;
038: import javax.swing.JSplitPane;
039:
040: import com.vividsolutions.jump.workbench.WorkbenchContext;
041: import com.vividsolutions.jump.workbench.model.LayerManager;
042: import com.vividsolutions.jump.workbench.model.Task;
043:
044: /**
045: * Provides the internal Frame in which Layer views are rendered.
046: */
047:
048: public class LayerViewFrame extends JInternalFrame {
049:
050: protected BorderLayout borderLayout = new BorderLayout();
051:
052: protected JScrollPane scrollPane = new JScrollPane();
053:
054: protected JSplitPane splitPane = new JSplitPane();
055:
056: protected int cloneIndex;
057:
058: protected InfoFrame infoFrame = null;
059:
060: protected LayerViewPanel layerViewPanel;
061:
062: protected Task task;
063:
064: protected WorkbenchContext workbenchContext;
065:
066: protected LayerManager layerManager;
067:
068: public LayerViewPanel getLayerViewPanel() {
069: return layerViewPanel;
070: }
071:
072: public Task getTask() {
073: return task;
074: }
075:
076: public LayerManager getLayerManager() {
077: return task.getLayerManager();
078: }
079:
080: protected int nextCloneIndex() {
081: String key = getClass().getName() + " - LAST_CLONE_INDEX";
082: task.getLayerManager().getBlackboard().put(key,
083: 1 + task.getLayerManager().getBlackboard().get(key, 0));
084:
085: return task.getLayerManager().getBlackboard().getInt(key);
086: }
087:
088: public SelectionManager getSelectionManager() {
089: return getLayerViewPanel().getSelectionManager();
090: }
091:
092: protected void updateTitle() {
093: String title = task.getName();
094:
095: if (cloneIndex > 0) {
096: title += (" (View " + (cloneIndex + 1) + ")");
097: }
098:
099: setTitle(title);
100: }
101:
102: public void taskNameChanged(String name) {
103: updateTitle();
104: }
105: }
|