com.jstatcom.table
Class JSCCellRendererTypes
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLabel
-
- com.jstatcom.table.JSCCellRendererTypes
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants, javax.swing.table.TableCellRenderer
public class JSCCellRendererTypes extends javax.swing.JLabel implements javax.swing.table.TableCellRendererThe class defines differentJSCCellRenderersfor theJSCAbstractDataTable, which can be used in different modeling contexts, for example to display coefficients matrizes or subset matrizes. It is possible to extend this enumeration to provide special renderers for different contexts.The class implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21). If you compare
JSCCellRendererTypes, always use the==operator. This is save, because they are Singletons (Gamma et al., 1995).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field and Description static JSCCellRendererTypesCOEFF_DEFAULTDefaultTableCellRendererfor coefficients.static JSCCellRendererTypesCOEFF_SCIENTIFICScientificTableCellRendererfor coefficients.static JSCCellRendererTypesDEFAULTDefaultTableCellRenderer.static JSCCellRendererTypesDIAG_01M1NEGINFATableCellRendererfor the A and B matrizes of an SVAR model.static JSCCellRendererTypesDIAGONAL_01ATableCellRendererfor the special subset matrizes.static JSCCellRendererTypesEQUATION_NAMESEquation StringTableCellRenderer.static JSCCellRendererTypesSCIENTIFICTableCellRendererwith scientific notation, for example 1.23E-2.static JSCCellRendererTypesSUBSET_01ATableCellRendererfor the subset matrizes.static JSCCellRendererTypesSUBSET_01_GRAYATableCellRendererfor the non editable subset matrizes with a gray background.static JSCCellRendererTypesSUBSET_012ATableCellRendererfor subset matrizes.static JSCCellRendererTypesSUBSET_01M1NEGINFATableCellRendererfor the A and B matrizes of an SVAR model.static JSCCellRendererTypesVARIABLE_NAMESStringTableCellRendererfor variable names.-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object o)Override prevention method to enforcea.equals(b)if and onlyif a==b.java.lang.StringgetName()Gets the name of this type.java.awt.ComponentgetTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int col)Defines how the cell is painted.inthashCode()Override prevention method invokes super method.java.lang.StringtoString()Gets a string representing this type, do not use for comparisons.-
Methods inherited from class javax.swing.JLabel
getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
DEFAULT
public static final JSCCellRendererTypes DEFAULT
DefaultTableCellRenderer. It displays doubles as they appear with a given precision set by the underlying table, using the default number format.
-
SCIENTIFIC
public static final JSCCellRendererTypes SCIENTIFIC
TableCellRendererwith scientific notation, for example 1.23E-2. It also takes the precision into account.
-
COEFF_DEFAULT
public static final JSCCellRendererTypes COEFF_DEFAULT
DefaultTableCellRendererfor coefficients. It displays doubles as they appear with a given precision set by the underlying table. If an element is restricted by the underlying restricion matrix, it is displayed as "---". This is also true for values that are exactly 0.
-
COEFF_SCIENTIFIC
public static final JSCCellRendererTypes COEFF_SCIENTIFIC
ScientificTableCellRendererfor coefficients. It displays doubles as they appear with a given precision set by the underlying table. If an element is restricted by the underlying restricion matrix, it is displayed as "---"
-
SUBSET_01
public static final JSCCellRendererTypes SUBSET_01
ATableCellRendererfor the subset matrizes. It displays "0" for 0, "*" for 1 and "---" for all other values. If a subset restriction is set in the coefficients table, the corresponding element is set toDouble.NaNand displayed as "---".
-
SUBSET_01_GRAY
public static final JSCCellRendererTypes SUBSET_01_GRAY
ATableCellRendererfor the non editable subset matrizes with a gray background. It displays "0" for 0, "*" for 1 and "---" for all other values. If a subset restriction is set in the coefficients table, the corresponding element is set toDouble.NaNand displayed as "---".
-
SUBSET_012
public static final JSCCellRendererTypes SUBSET_012
ATableCellRendererfor subset matrizes. It displays "0" for 0, "*" for 1 and "!" for 2. All other values are displayed as "---". If a subset restriction is set in the underlying coefficients table, the corresponding element is set toDouble.NaNand displayed as "---".
-
DIAGONAL_01
public static final JSCCellRendererTypes DIAGONAL_01
ATableCellRendererfor the special subset matrizes. It displays "0" for 0, "*" for 1 and "---" for all other values. The diagonal elements are rendered with a gray background, because they are usually not editable. If a subset restriction is set in the coefficients table, the corresponding element is set toDouble.NaNand displayed as "---". This renderer might be used for the matrix of structural coefficients.
-
EQUATION_NAMES
public static final JSCCellRendererTypes EQUATION_NAMES
Equation StringTableCellRenderer. It is used as a left hand side equation description.
-
VARIABLE_NAMES
public static final JSCCellRendererTypes VARIABLE_NAMES
StringTableCellRendererfor variable names. It displays an index if it is set for aVarNamesVectorandisShowingIndexis true.
-
DIAG_01M1NEGINF
public static final JSCCellRendererTypes DIAG_01M1NEGINF
ATableCellRendererfor the A and B matrizes of an SVAR model. It displays "0" for 0, "*" for-INF, "1" for 1, "-1" for -1 and all other values "as is". The diagonal elements are rendered with a gray background, because they are usually not editable.
-
SUBSET_01M1NEGINF
public static final JSCCellRendererTypes SUBSET_01M1NEGINF
ATableCellRendererfor the A and B matrizes of an SVAR model. It displays "0" for 0, "*" for-INF, "1" for 1, "-1" for -1 and all other values "as is".
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object o)
Override prevention method to enforcea.equals(b)if and onlyif a==b.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object to compare with- Returns:
trueif equal,falseotherwise
-
getName
public final java.lang.String getName()
Gets the name of this type.- Overrides:
getNamein classjava.awt.Component- Returns:
- a descriptive name
-
getTableCellRendererComponent
public final java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int col)Defines how the cell is painted. It is a template method here, because thesetandgetmethods can be redefined by subclasses ofJSCDataTableRendererTypeswithout changing the general structure of the algorithm. The ordering of calls is the following:setFirst(always)getDoubleValue(if data table contains number types)setDoubleValue(if data table contains number types)getStringValue(if data table containsStringtypes)setStringValue(if data table containsStringtypes)setValue(if data table contains other types)
- Specified by:
getTableCellRendererComponentin interfacejavax.swing.table.TableCellRenderer- Parameters:
table- the table to rendervalue- the value to displayisSelected-trueif cell is selectedhasFocus-trueif cell has focusrow- index for rowcol- index for column- Returns:
- the assembled renderer component
-
hashCode
public final int hashCode()
Override prevention method invokes super method.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hash code
-
toString
public final java.lang.String toString()
Gets a string representing this type, do not use for comparisons.- Overrides:
toStringin classjava.awt.Component- Returns:
- string representation
-
-
DMelt 3.0 © DataMelt by jWork.ORG