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,HelpSupporter,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, HelpSupporter
Special panel for displaying the DataContainer data.- 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 AbstractDatabaseConnectionm_DatabaseConnectionthe database connection.protected HashSet<DataChangeListener>m_DataChangeListenersthe listeners for data changes.protected Mm_Managerholds the data.protected static Hashtable<String,Properties>m_PanelPropertiesthe setup for the panel.protected PlotPanelm_PlotPanelthe content panel for drawing.protected BasePanelm_PlotWrapperPanelthe wrapper panel for the plot panel.protected StatusMessageHandlerm_StatusMessageHandlera status message handler for displaying status messages.protected Stringm_Titlethe 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 voidcleanUp()Cleans up data structures, frees up memory.voidclearHelp()Clears any help information.voiddatabaseConnectionStateChanged(DatabaseConnectionChangeEvent e)A change in the database connection occurred.voiddataChanged(DataChangeEvent e)Gets called if the data of the container panel has changed.protected voidfinishInit()Finishes up the initialization.ColorgetBackgroundColor()Returns the current background color in use.MgetContainerManager()Returns the current container manager.abstract PaintletgetContainerPaintlet()Returns the paintlet used for painting the containers.AbstractDatabaseConnectiongetDatabaseConnection()Returns the currently used database connection object, can be null.protected abstract AbstractDatabaseConnectiongetDefaultDatabaseConnection()Returns the default database connection.ColorgetForegroundColor()Returns the current foreground color in use.StringgetHelp()Returns the help information if any.PlotPanelgetPlot()Returns the content panel, which is used for drawing.PropertiesgetProperties()Returns the properties for this panel.abstract AbstractScriptingEnginegetScriptingEngine()Returns the current scripting engine, can be null.Class[]getSendToClasses()Returns the classes that the supporter generates.ObjectgetSendToItem(Class[] cls)Returns the object to send.StatusMessageHandlergetStatusMessageHandler()Returns the currently set handler for status messages.StringgetTitle()Returns the title of border.booleanhasHelp()Returns whether any help information is available.booleanhasSendToItem(Class[] cls)Checks whether something to send is available.protected voidinitGUI()Initializes the GUI.protected voidinitialize()For initializing members.booleanisHelpHtml()Returns whether the help is html or plain text.protected abstract MnewContainerManager()Returns the container manager to use.protected voidreset()Resets components, etc.voidsetBackgroundColor(Color value)Sets the background color to use.voidsetContainerManager(M value)Sets the manager for handling the containers.voidsetDatabaseConnection(AbstractDatabaseConnection value)Sets the database connection object to use.voidsetForegroundColor(Color value)Sets the foreground color to use.voidsetHelp(String help, boolean isHtml)Sets the help information to offer.voidsetStatusMessageHandler(StatusMessageHandler value)Sets the handler for status messages.voidsetTitle(String value)Sets the title for the border.voidshowHelp()Displays the help.voidshowStatus(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:
initializein classPaintablePanel
-
finishInit
protected void finishInit()
Finishes up the initialization.- Overrides:
finishInitin 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:
setContainerManagerin interfaceContainerListManager<T extends DataContainer>- Parameters:
value- the manager
-
getContainerManager
public M getContainerManager()
Returns the current container manager.- Specified by:
getContainerManagerin 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:
getPlotin 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:
dataChangedin 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:
showStatusin interfaceStatusMessageHandler- Parameters:
msg- the message to display
-
getScriptingEngine
public abstract AbstractScriptingEngine getScriptingEngine()
Returns the current scripting engine, can be null.- Specified by:
getScriptingEnginein interfaceScriptingEngineHandler- Returns:
- the current engine
-
getDatabaseConnection
public AbstractDatabaseConnection getDatabaseConnection()
Returns the currently used database connection object, can be null.- Specified by:
getDatabaseConnectionin interfaceDatabaseConnectionProvider- Returns:
- the current object
-
setDatabaseConnection
public void setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection object to use.- Specified by:
setDatabaseConnectionin interfaceDatabaseConnectionHandler- Parameters:
value- the object to use
-
databaseConnectionStateChanged
public void databaseConnectionStateChanged(DatabaseConnectionChangeEvent e)
A change in the database connection occurred.- Specified by:
databaseConnectionStateChangedin interfaceDatabaseConnectionChangeListener- Parameters:
e- the event
-
getSendToClasses
public Class[] getSendToClasses()
Returns the classes that the supporter generates.- Specified by:
getSendToClassesin interfaceSendToActionSupporter- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItemin 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:
getSendToItemin interfaceSendToActionSupporter- Parameters:
cls- the classes to retrieve an item for- Returns:
- the item to send, null if nothing available at the moment
-
clearHelp
public void clearHelp()
Clears any help information.- Specified by:
clearHelpin interfaceHelpSupporter
-
hasHelp
public boolean hasHelp()
Returns whether any help information is available.- Specified by:
hasHelpin interfaceHelpSupporter- Returns:
- true if help available
-
setHelp
public void setHelp(String help, boolean isHtml)
Sets the help information to offer.- Specified by:
setHelpin interfaceHelpSupporter- Parameters:
help- the helpisHtml- whether html or plain text
-
getHelp
public String getHelp()
Returns the help information if any.- Specified by:
getHelpin interfaceHelpSupporter- Returns:
- the help information
-
isHelpHtml
public boolean isHelpHtml()
Returns whether the help is html or plain text.- Specified by:
isHelpHtmlin interfaceHelpSupporter- Returns:
- true if html
-
showHelp
public void showHelp()
Displays the help.- Specified by:
showHelpin interfaceHelpSupporter
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler
-
-