com.zwares.base.gui.panels
Class ETablePanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.zwares.base.gui.panels.ETablePanel
All Implemented Interfaces:
javax.accessibility.Accessible, EEventListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class ETablePanel
extends javax.swing.JPanel
implements java.awt.event.MouseListener, EEventListener

This class provides features like border, sorting, selecting, etc. It can be used instead of JTable. It return a panel with a title and a table.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  ETableModel dataTableModel
           
protected  EEventSourceObject multicaster
           
protected  java.lang.String name
           
protected  EPopupMenu popupMenu
           
protected  javax.swing.JScrollPane scrollPane
           
protected  com.zwares.base.gui.panels.ETablePanel.TableSorter sorterTableModel
           
protected  javax.swing.JTable table
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ETablePanel()
          Creates a new ETablePanel.
ETablePanel(java.lang.String n, ETableModel m)
          Creates a new ETableModel.
 
Method Summary
 void addEventListener(EEventListener el)
          Adds an ActionListener to the list of listners.
 void addRow(int index, java.lang.Object row)
          Adds a row to the table at the given index.
 void addRow(java.lang.Object row)
          Adds a row to the end of the table.
 void clearAll()
          Removes all the rows.
 void eventGenerated(EEvent e)
          Call back method for all the actions.
 void filter(java.lang.String st)
          Filters the table based on the given String st.
 EPopupMenu getPopupMenu()
          Method to return the popup menu for the table.
 int getRowCount()
          Returns the number of rows in the table.
 int getSelectedIndex()
          Returns the selected index from the table.
 java.lang.Object getSelectedObject()
          Returns the selected object from the table.
 javax.swing.JTable getTable()
          Returns the instance of table.
 java.lang.Object[] getTableData()
          Returns the table data.
 ETableModel getTableModel()
          Returns the table model.
protected  void init()
          Initialization method.
protected  void initPanel()
          Initializes the panel and sets its layout.
protected  void initTable()
          Initializes the table and adds it to a scroll pane.
 void initTableColumns()
          Selectes the first row.
protected  void initVariables()
          Creates instances of all the varaibles like table, scrollpane etc.
 void mouseClicked(java.awt.event.MouseEvent e)
          Implementing mouse listener events for any double clicks.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void notifyEventListeners(EEvent evt)
          Notifies all the registered listeners about the event evt.
 void removeEventListener(EEventListener el)
          Removes any listener added.
 void removePopupMenu()
          Method to remove the popup menu from the table.
 void removeRow(int index)
          Removes the row at the given index and selectes the first one.
 void removeSelectedRow()
          Removes the selectedRow and selectes the first one.
 void repaintTable()
          Repaints the table.
 void selectRow(int row)
          Selects a row.
 void selectRow(int rowIndex, int columnIndex, boolean toggle, boolean extend)
          Selects a row.
 void setPopupMenu(EPopupMenu m)
          Method to set the popup menu for the table.
 void setTable(javax.swing.JTable t)
          Returns the instance of table.
 void setTableData(java.lang.Object[] d)
          Sets the table data.
 void setTableModel(ETableModel m)
          Sets the table model.
 void setTableSize(int x, int y, boolean autoResizeMode)
          Sets the table size.
 void updateTable()
          Updates the table for any changes in data / property.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scrollPane

protected javax.swing.JScrollPane scrollPane

table

protected javax.swing.JTable table

dataTableModel

protected ETableModel dataTableModel

sorterTableModel

protected com.zwares.base.gui.panels.ETablePanel.TableSorter sorterTableModel

name

protected java.lang.String name

popupMenu

protected EPopupMenu popupMenu

multicaster

protected EEventSourceObject multicaster
Constructor Detail

ETablePanel

public ETablePanel()
Creates a new ETablePanel.


ETablePanel

public ETablePanel(java.lang.String n,
                   ETableModel m)
Creates a new ETableModel. Sets the name of the Table Panel.

Method Detail

init

protected void init()
Initialization method. Calls all the init methods.


initVariables

protected void initVariables()
Creates instances of all the varaibles like table, scrollpane etc.


initTable

protected void initTable()
Initializes the table and adds it to a scroll pane. It also sets the selection mode and size. It also adds a cell renderer to the table header


initPanel

protected void initPanel()
Initializes the panel and sets its layout.


initTableColumns

public void initTableColumns()
Selectes the first row.


setTable

public void setTable(javax.swing.JTable t)
Returns the instance of table.


getTable

public javax.swing.JTable getTable()
Returns the instance of table.


setTableSize

public void setTableSize(int x,
                         int y,
                         boolean autoResizeMode)
Sets the table size. Note: Avoid using this.


setTableModel

public void setTableModel(ETableModel m)
Sets the table model.


getTableModel

public ETableModel getTableModel()
Returns the table model.


setTableData

public void setTableData(java.lang.Object[] d)
Sets the table data.


getTableData

public java.lang.Object[] getTableData()
Returns the table data.


getRowCount

public int getRowCount()
Returns the number of rows in the table.


addRow

public void addRow(java.lang.Object row)
Adds a row to the end of the table.


addRow

public void addRow(int index,
                   java.lang.Object row)
Adds a row to the table at the given index.


removeRow

public void removeRow(int index)
Removes the row at the given index and selectes the first one.


removeSelectedRow

public void removeSelectedRow()
Removes the selectedRow and selectes the first one.


clearAll

public void clearAll()
Removes all the rows.


selectRow

public void selectRow(int row)
Selects a row.


selectRow

public void selectRow(int rowIndex,
                      int columnIndex,
                      boolean toggle,
                      boolean extend)
Selects a row. It calls the JTable.changeSelection method with the arguemnts


getSelectedIndex

public int getSelectedIndex()
Returns the selected index from the table.


getSelectedObject

public java.lang.Object getSelectedObject()
Returns the selected object from the table. If nothing is selected, it returns null


filter

public void filter(java.lang.String st)
Filters the table based on the given String st. It forwards all the calls to the table sorter filter method.


updateTable

public void updateTable()
Updates the table for any changes in data / property.


repaintTable

public void repaintTable()
Repaints the table.


setPopupMenu

public void setPopupMenu(EPopupMenu m)
Method to set the popup menu for the table.


getPopupMenu

public EPopupMenu getPopupMenu()
Method to return the popup menu for the table.


removePopupMenu

public void removePopupMenu()
Method to remove the popup menu from the table.


addEventListener

public void addEventListener(EEventListener el)
Adds an ActionListener to the list of listners.


removeEventListener

public void removeEventListener(EEventListener el)
Removes any listener added.


notifyEventListeners

public void notifyEventListeners(EEvent evt)
Notifies all the registered listeners about the event evt.


eventGenerated

public void eventGenerated(EEvent e)
Call back method for all the actions.

Specified by:
eventGenerated in interface EEventListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Implementing mouse listener events for any double clicks.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener