Class DataContainerPanel<T extends DataContainer,M extends AbstractContainerManager>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.visualization.core.PaintablePanel
-
- adams.gui.visualization.container.DataContainerPanel<T,M>
-
- Type Parameters:
T
- the type of container to visualizeM
- the type of container manager to use
- All Implemented Interfaces:
CleanUpHandler
,StatusMessageHandler
,DatabaseConnectionHandler
,DatabaseConnectionProvider
,DatabaseConnectionUser
,DatabaseConnectionChangeListener
,DataChangeListener
,PaintListener
,ScriptingEngineHandler
,SendToActionSupporter
,ContainerListManager<M>
,PaintletManager
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
AbstractDataContainerZoomOverviewPanel
,DataContainerPanelWithSidePanel
public abstract class DataContainerPanel<T extends DataContainer,M extends AbstractContainerManager> extends PaintablePanel implements StatusMessageHandler, ScriptingEngineHandler, DatabaseConnectionHandler, DatabaseConnectionChangeListener, DataChangeListener, ContainerListManager<M>, CleanUpHandler, SendToActionSupporter
Special panel for displaying the DataContainer data.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDatabaseConnection
m_DatabaseConnection
the database connection.protected HashSet<DataChangeListener>
m_DataChangeListeners
the listeners for data changes.protected M
m_Manager
holds the data.protected static Hashtable<String,Properties>
m_PanelProperties
the setup for the panel.protected PlotPanel
m_PlotPanel
the content panel for drawing.protected BasePanel
m_PlotWrapperPanel
the wrapper panel for the plot panel.protected StatusMessageHandler
m_StatusMessageHandler
a status message handler for displaying status messages.protected String
m_Title
the titel of the panel.-
Fields inherited from class adams.gui.visualization.core.PaintablePanel
m_Paintlets
-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description DataContainerPanel()
Initializes the panel without title.DataContainerPanel(String title)
Initializes the panel with the given title.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.void
databaseConnectionStateChanged(DatabaseConnectionChangeEvent e)
A change in the database connection occurred.void
dataChanged(DataChangeEvent e)
Gets called if the data of the container panel has changed.protected void
finishInit()
Finishes up the initialization.Color
getBackgroundColor()
Returns the current background color in use.M
getContainerManager()
Returns the current container manager.abstract Paintlet
getContainerPaintlet()
Returns the paintlet used for painting the containers.AbstractDatabaseConnection
getDatabaseConnection()
Returns the currently used database connection object, can be null.protected abstract AbstractDatabaseConnection
getDefaultDatabaseConnection()
Returns the default database connection.Color
getForegroundColor()
Returns the current foreground color in use.PlotPanel
getPlot()
Returns the content panel, which is used for drawing.Properties
getProperties()
Returns the properties for this panel.abstract AbstractScriptingEngine
getScriptingEngine()
Returns the current scripting engine, can be null.Class[]
getSendToClasses()
Returns the classes that the supporter generates.Object
getSendToItem(Class[] cls)
Returns the object to send.StatusMessageHandler
getStatusMessageHandler()
Returns the currently set handler for status messages.String
getTitle()
Returns the title of border.boolean
hasSendToItem(Class[] cls)
Checks whether something to send is available.protected void
initGUI()
Initializes the GUI.protected void
initialize()
For initializing members.protected abstract M
newContainerManager()
Returns the container manager to use.protected void
reset()
Resets components, etc.void
setBackgroundColor(Color value)
Sets the background color to use.void
setContainerManager(M value)
Sets the manager for handling the containers.void
setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection object to use.void
setForegroundColor(Color value)
Sets the foreground color to use.void
setStatusMessageHandler(StatusMessageHandler value)
Sets the handler for status messages.void
setTitle(String value)
Sets the title for the border.void
showStatus(String msg)
Displays a message.-
Methods inherited from class adams.gui.visualization.core.PaintablePanel
addPaintlet, canHandleFixedLabels, canPaint, check, paint, painted, paintlets, performUpdate, postUpdate, prepareUpdate, printAll, removePaintlet, update
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_Title
protected String m_Title
the titel of the panel.
-
m_Manager
protected M extends AbstractContainerManager m_Manager
holds the data.
-
m_PlotPanel
protected PlotPanel m_PlotPanel
the content panel for drawing.
-
m_PlotWrapperPanel
protected BasePanel m_PlotWrapperPanel
the wrapper panel for the plot panel.
-
m_DataChangeListeners
protected HashSet<DataChangeListener> m_DataChangeListeners
the listeners for data changes.
-
m_StatusMessageHandler
protected StatusMessageHandler m_StatusMessageHandler
a status message handler for displaying status messages.
-
m_DatabaseConnection
protected AbstractDatabaseConnection m_DatabaseConnection
the database connection.
-
m_PanelProperties
protected static Hashtable<String,Properties> m_PanelProperties
the setup for the panel.
-
-
Constructor Detail
-
DataContainerPanel
public DataContainerPanel()
Initializes the panel without title.
-
DataContainerPanel
public DataContainerPanel(String title)
Initializes the panel with the given title.- Parameters:
title
- the title for the panel, use "null" for none
-
-
Method Detail
-
initialize
protected void initialize()
For initializing members.- Overrides:
initialize
in classPaintablePanel
-
finishInit
protected void finishInit()
Finishes up the initialization.- Overrides:
finishInit
in classBasePanel
-
getDefaultDatabaseConnection
protected abstract AbstractDatabaseConnection getDefaultDatabaseConnection()
Returns the default database connection.- Returns:
- the default database connection
-
getProperties
public Properties getProperties()
Returns the properties for this panel.- Returns:
- the properties file for this panel
-
newContainerManager
protected abstract M newContainerManager()
Returns the container manager to use.- Returns:
- the container manager
-
setContainerManager
public void setContainerManager(M value)
Sets the manager for handling the containers.- Specified by:
setContainerManager
in interfaceContainerListManager<T extends DataContainer>
- Parameters:
value
- the manager
-
getContainerManager
public M getContainerManager()
Returns the current container manager.- Specified by:
getContainerManager
in interfaceContainerListManager<T extends DataContainer>
- Returns:
- the manager
-
getContainerPaintlet
public abstract Paintlet getContainerPaintlet()
Returns the paintlet used for painting the containers.- Returns:
- the paintlet
-
setTitle
public void setTitle(String value)
Sets the title for the border.- Parameters:
value
- the title, use null for no title
-
getTitle
public String getTitle()
Returns the title of border.- Returns:
- the title, can be null
-
getPlot
public PlotPanel getPlot()
Returns the content panel, which is used for drawing.- Specified by:
getPlot
in classPaintablePanel
- Returns:
- the content panel
-
setForegroundColor
public void setForegroundColor(Color value)
Sets the foreground color to use.- Parameters:
value
- the color to use
-
getForegroundColor
public Color getForegroundColor()
Returns the current foreground color in use.- Returns:
- the color in use
-
setBackgroundColor
public void setBackgroundColor(Color value)
Sets the background color to use.- Parameters:
value
- the color to use
-
getBackgroundColor
public Color getBackgroundColor()
Returns the current background color in use.- Returns:
- the color in use
-
reset
protected void reset()
Resets components, etc. Default implementation does nothing.
-
dataChanged
public void dataChanged(DataChangeEvent e)
Gets called if the data of the container panel has changed.- Specified by:
dataChanged
in interfaceDataChangeListener
- Parameters:
e
- the event that the container panel sent
-
setStatusMessageHandler
public void setStatusMessageHandler(StatusMessageHandler value)
Sets the handler for status messages.- Parameters:
value
- the handler to use, can be null
-
getStatusMessageHandler
public StatusMessageHandler getStatusMessageHandler()
Returns the currently set handler for status messages.- Returns:
- the current handler, can be null
-
showStatus
public void showStatus(String msg)
Displays a message. If a status message handler is set, then this handler's showStatus method is called, otherwise the message is printed to stdout.- Specified by:
showStatus
in interfaceStatusMessageHandler
- Parameters:
msg
- the message to display
-
getScriptingEngine
public abstract AbstractScriptingEngine getScriptingEngine()
Returns the current scripting engine, can be null.- Specified by:
getScriptingEngine
in interfaceScriptingEngineHandler
- Returns:
- the current engine
-
getDatabaseConnection
public AbstractDatabaseConnection getDatabaseConnection()
Returns the currently used database connection object, can be null.- Specified by:
getDatabaseConnection
in interfaceDatabaseConnectionProvider
- Returns:
- the current object
-
setDatabaseConnection
public void setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection object to use.- Specified by:
setDatabaseConnection
in interfaceDatabaseConnectionHandler
- Parameters:
value
- the object to use
-
databaseConnectionStateChanged
public void databaseConnectionStateChanged(DatabaseConnectionChangeEvent e)
A change in the database connection occurred.- Specified by:
databaseConnectionStateChanged
in interfaceDatabaseConnectionChangeListener
- Parameters:
e
- the event
-
getSendToClasses
public Class[] getSendToClasses()
Returns the classes that the supporter generates.- Specified by:
getSendToClasses
in interfaceSendToActionSupporter
- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItem
in interfaceSendToActionSupporter
- Parameters:
cls
- the classes to retrieve an item for- Returns:
- true if an object is available for sending
-
getSendToItem
public Object getSendToItem(Class[] cls)
Returns the object to send.- Specified by:
getSendToItem
in interfaceSendToActionSupporter
- Parameters:
cls
- the classes to retrieve an item for- Returns:
- the item to send, null if nothing available at the moment
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-