001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.logistics.ui.inventory.dialog;
028:
029: import java.util.*;
030:
031: import javax.swing.JFrame;
032: import javax.swing.JMenuBar;
033: import javax.swing.JMenu;
034: import javax.swing.JMenuItem;
035: import javax.swing.JButton;
036: import javax.swing.JTextArea;
037: import javax.swing.JPanel;
038: import javax.swing.JDialog;
039: import javax.swing.JTabbedPane;
040: import javax.swing.JOptionPane;
041: import javax.swing.BorderFactory;
042: import javax.swing.JScrollPane;
043: import javax.swing.Box;
044: import javax.swing.JFileChooser;
045: import javax.swing.SwingUtilities;
046: import javax.swing.event.MouseInputAdapter;
047:
048: import java.awt.Container;
049: import java.awt.BorderLayout;
050: import java.awt.Dimension;
051: import java.awt.Toolkit;
052: import java.awt.FlowLayout;
053: import java.awt.Cursor;
054: import java.awt.Component;
055: import java.awt.event.*;
056:
057: import java.io.File;
058: import java.io.FileWriter;
059: import java.io.FileReader;
060: import java.io.BufferedReader;
061: import java.io.IOException;
062:
063: import org.cougaar.util.log.Logging;
064: import org.cougaar.util.log.Logger;
065:
066: import org.cougaar.logistics.ui.inventory.data.InventoryPreferenceData;
067: import org.cougaar.logistics.ui.inventory.InventoryUIFrame;
068:
069: /**
070: * <pre>
071: *
072: * The InventoryPreferenceTab is an almost abstract superclass that all the tabs
073: * for the InventoryPreferenceDialog inherit from. It basically provides back
074: * pointers and common functionality to all the tabs going into the dialog
075: *
076: * @see InventoryPreferenceDialog
077: * @see InventoryPreferenceData
078: *
079: **/
080:
081: public abstract class PreferenceDialogTab extends JPanel implements
082: ItemListener {
083:
084: InventoryPreferenceData prefData;
085: InventoryPreferenceDialog parentDialog;
086: InventoryUIFrame parentFrame;
087:
088: Logger logger;
089:
090: boolean itemChange;
091:
092: public PreferenceDialogTab(InventoryUIFrame invUIFrame,
093: InventoryPreferenceDialog invUIDialog,
094: InventoryPreferenceData data) {
095: super ();
096: parentFrame = invUIFrame;
097: parentDialog = invUIDialog;
098: prefData = data;
099: itemChange = false;
100: initializePrefTab();
101: }
102:
103: protected void initializePrefTab() {
104:
105: logger = Logging.getLogger(this );
106: doTabLayout();
107: setVisible(true);
108: }
109:
110: protected abstract void doTabLayout();
111:
112: public void flushValuesToData() {
113: itemChange = false;
114: }
115:
116: public void itemStateChanged(ItemEvent e) {
117: itemChange = true;
118: }
119:
120: public boolean prefsChanged() {
121: return itemChange;
122: }
123: }
|