/******************************************************************* Copyright (c) 2001-2010 Apprisant Technologies Inc. All rights reserved. Apprisant Technologies permits non-exclusive royalty free use, copying and modification of this demo program source code for the purposes of evaluating the Apprisant Toolkit or building applications that use it. This software and documentation is provided "AS IS". APPRISANT TECHNOLOGIES DISCLAIMS ANY REPRESENTATIONS AND WARRANTIES, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY AND FITNESS OF THIS PRODUCT FOR ANY PARTICULAR PURPOSE. APPRISANT TECHNOLOGIES SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY ANY PARTY, INCLUDING LOST PROFITS, ARISING FROM THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ITS DERIVATIONS. ********************************************************************/ package show; import java.awt.Dimension; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; import apprisant.diagram.event.*; import apprisant.diagram.data.*; /* This class configures and manages a JTable as a JavaBean. */ public class ShowTable extends JTable { private TableModel tableModel; public ShowTable() { super(); super.getSelectionModel().setSelectionMode (ListSelectionModel.SINGLE_SELECTION); } /* In a JavaBeans environment we may not know the table model until the first event arrives. */ public void processTableModelEvent(TableModelEvent ev) { if (ev.getSource() != tableModel) { tableModel = (TableModel) ev.getSource(); super.setModel(tableModel); } super.tableChanged(ev); } /* ListSelectionListener support for the TableModelAdapter. */ public void addListSelectionListener(ListSelectionListener ls) { getSelectionModel().addListSelectionListener(ls); } public void removeListSelectionListener(ListSelectionListener ls) { getSelectionModel().removeListSelectionListener(ls); } /* Accepts Apprisant selection events from the TableModelAdapter and updates the JTable. updateTableSelection is a support method provided by the TableModelAdapter. */ public void processAGSelectionEvent(AGSelectionEvent ev) { TableModelAdapter.updateTableSelection(this, ev); } }