public abstract class DisplayElement extends javax.swing.JPanel implements PropertyHolder
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponentaccessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
DisplayElement()
Instantiates the element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
disconnect()
This method is called when an element is removed, and should be used to
clean up any loose ends.
|
static java.lang.String |
getName(java.lang.Class<? extends DisplayElement> clazz) |
java.util.Map<java.lang.String,Property> |
getProperties()
Returns a mapping between every property name and the corresponding property.
|
java.awt.Point |
getSavedLocation()
Returns the point that the element was saved at or should save to.
|
java.awt.Dimension |
getSavedSize()
Returns the saved size of this element.
|
abstract void |
init()
Sets up and displays any internal subcomponents managed by this UI element.
|
boolean |
isObstruction()
Returns whether or not this element should be considered an "obstruction."
|
boolean |
isResizable()
Returns whether or not this element can be resized by the user dragging on an edge.
|
void |
setObstruction(boolean obstruction)
Sets whether or not this element is an "obstruction."
|
void |
setResizable(boolean resizable)
Sets whether or not this element can be resized by the user dragging on an edge.
|
void |
setSavedLocation(java.awt.Point p)
Sets the saved location for this element.
|
void |
setSavedSize(java.awt.Dimension d)
Sets the saved dimension for this element.
|
protected void |
update(Property property,
java.lang.Object defaultValue) |
boolean |
validatePropertyChange(Property property,
java.lang.Object value)
This method allows the
PropertyHolder to veto whether or not the
given Property should change to the given value. |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, 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, setVisible, unregisterKeyboardAction, updateadd, 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, validateTreeaction, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpropertyChangedpublic DisplayElement()
init() method.public abstract void init()
public void disconnect()
public boolean validatePropertyChange(Property property, java.lang.Object value)
PropertyHolderPropertyHolder to veto whether or not the
given Property should change to the given value.
It is called whenever setValue(...)
is called.
It is called only when the value if the value is acceptable.
In other words, it must not be null and it must correspond to
the type of element that the Property accepts. So if the given
Property is an IntegerProperty, then value will
be a non-null Integer object.
Note that this method will not be called when a property receives its value from a save file
validatePropertyChange in interface PropertyHolderproperty - the Propertyvalue - the value to change it topublic boolean isObstruction()
An obstruction is any object which the SmartDashboard should automatically
try to avoid when placing new DisplayElements.
Pretty much everything is an obstruction except for Images
because images will sometimes be used for background effect, in which case it is
fine if a new DisplayElement spawns over it.
public void setObstruction(boolean obstruction)
An obstruction is any object which the SmartDashboard should automatically
try to avoid when placing new DisplayElements.
Pretty much everything is an obstruction except for Images
because images will sometimes be used for background effect, in which case it is
fine if a new DisplayElement spawns over it.
obstruction - whether or not it should be an obstructionpublic java.util.Map<java.lang.String,Property> getProperties()
PropertyHoldergetProperties in interface PropertyHolderpublic java.awt.Point getSavedLocation()
public java.awt.Dimension getSavedSize()
public void setSavedLocation(java.awt.Point p)
p - the location that this element should save to a filepublic void setSavedSize(java.awt.Dimension d)
d - the dimensionpublic boolean isResizable()
public void setResizable(boolean resizable)
protected void update(Property property, java.lang.Object defaultValue)
public static java.lang.String getName(java.lang.Class<? extends DisplayElement> clazz)