|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.cosylab.gui.displayers.AbstractDisplayerPanel
com.cosylab.gui.IconDisplayer
public class IconDisplayer
IconDisplayer is a displayer that displays icons associated with
different values.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_ICON_NAME_PROPERTY
|
static java.lang.String |
DEFAULT_ICON_PROPERTY
|
static java.lang.String |
ICONS_PROPERTY
|
| 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 com.cosylab.gui.displayers.Displayer |
|---|
C_EDITABLE, DATA_SOURCE |
| Fields inherited from interface com.cosylab.gui.displayers.CommonDisplayer |
|---|
C_BIT_DESCRIPTIONS, C_BIT_MASK, C_COLOR, C_CONDITION_WHEN_CLEARED, C_CONDITION_WHEN_SET, C_DESCRIPTION, C_DISPLAY_NAME, C_FORMAT, C_GRAPH_MAX, C_GRAPH_MIN, C_MAXIMUM, C_MIN_STEP, C_MINIMUM, C_POSITION, C_PROPERTY_TYPE, C_SEQUENCE_LENGTH, C_UNITS |
| Fields inherited from interface com.cosylab.gui.displayers.DataStateProvider |
|---|
DATA_STATE |
| Fields inherited from interface com.cosylab.gui.displayers.ConvertibleDisplayer |
|---|
CONVERTER_PROPERTY |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
IconDisplayer()
Creates new IconDisplayer. |
|
IconDisplayer(java.io.File file)
Creates a new IconDisplayer with the default icon loaded from a given file. |
|
IconDisplayer(javax.swing.Icon defaultIcon)
Creates new IconDisplayer and defines the default icon. |
|
IconDisplayer(java.lang.String defaultIcon)
Creates new IconDisplayer and new default icon. |
|
| Method Summary | ||
|---|---|---|
void |
addIcon(long value,
javax.swing.Icon icon)
Adds an icon. |
|
void |
addIcon(ValueIconPair pair)
Associates icon with value. |
|
void |
addIcons(ValueIconPair[] icons)
Associates icons with values. |
|
void |
cleanup()
Performs general cleanup of displayer resources. |
|
|
getDataConsumer(java.lang.Class<D> type)
Returns data consumer for requested data consumer type. |
|
javax.swing.Icon |
getDefaultIcon()
Returns default icon. |
|
java.lang.String |
getDefaultIconName()
Returns the path to the default icon. |
|
ValueIconPair[] |
getIcons()
Returns an array of all icons that were associated with values. |
|
InfoDialog |
getInfoDialog()
Returns the InfoDialog for this displayer. |
|
PopupManager |
getPopupManager()
Returns popup manager for adding popup actions. |
|
java.lang.Class[] |
getSupportedConsumerTypes()
Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class)
method. |
|
long |
getValue()
Gets the value displayed by the displayer. |
|
boolean |
isEditable()
Returns true if this displayer can interact with user and
fire value updates requested by user. |
|
boolean |
isKeepRatio()
Returns true if icons aspect ratio is kept when the icon is scaled to fit the component size or false if displayer's aspect ratio is used. |
|
boolean |
isScaleIcons()
Returns true if icons are scaled to fit the size of the component. |
|
static void |
main(java.lang.String[] args)
|
|
void |
removeIcon(ValueIconPair icon)
Removes icons. |
|
void |
removeIcons(ValueIconPair[] icons)
Removes icons. |
|
void |
setBackground(java.awt.Color bg)
|
|
void |
setCharacteristics(java.util.Map characteristics)
Sets new dynamic value characteristics to this data consumer. |
|
void |
setDefaultIcon(java.io.File file)
Creates and sets default icon from the given file. |
|
void |
setDefaultIcon(javax.swing.Icon newIcon)
Sets default icon. |
|
void |
setDefaultIconName(java.lang.String filename)
Creates and sets default icon from file name. |
|
void |
setForeground(java.awt.Color fg)
|
|
void |
setIcons(ValueIconPair[] icons)
Associates icons with values. |
|
void |
setKeepRatio(boolean keepRatio)
Sets whether the icons should keep the aspect ratio if it is scale to fit the component; |
|
void |
setScaleIcons(boolean scale)
Sets whether the icons should be scale to fit the size of the component. |
|
void |
setValue(long value)
Sets the value displayed by the displayer. |
|
protected void |
updateIcon()
|
|
void |
updateValue(long timestamp,
long value)
Notifys this consumer about new dynamic value update. |
|
| Methods inherited from class com.cosylab.gui.displayers.AbstractDisplayerPanel |
|---|
destroy, getConverter, getCustomizer, getDataSource, getDataState, getDefaultDataConsumer, getSupportedCharacteristics, getTitle, getTitleLabel, getTitleMaximumFontSize, getTitleMinimumFontSize, isPopupEnabled, isSuspended, isTitleVisible, resume, setConverter, setDataSource, setPopupEnabled, setTitle, setTitleMaximumFontSize, setTitleMinimumFontSize, setTitleVisible, suspend, updateDataState |
| 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, 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, 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, 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, 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, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.cosylab.gui.displayers.Displayer |
|---|
getDataSource, getTitle, setDataSource, setTitle |
| Methods inherited from interface com.cosylab.gui.displayers.CommonDisplayer |
|---|
isSuspended, resume, suspend |
| Methods inherited from interface com.cosylab.gui.displayers.DataStateProvider |
|---|
addPropertyChangeListener, addPropertyChangeListener, getDataState, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.cosylab.gui.displayers.DataConsumer |
|---|
getDefaultDataConsumer, getName, getSupportedCharacteristics, updateDataState |
| Field Detail |
|---|
public static final java.lang.String ICONS_PROPERTY
public static final java.lang.String DEFAULT_ICON_PROPERTY
public static final java.lang.String DEFAULT_ICON_NAME_PROPERTY
| Constructor Detail |
|---|
public IconDisplayer()
public IconDisplayer(javax.swing.Icon defaultIcon)
defaultIcon - Default icon to set.public IconDisplayer(java.lang.String defaultIcon)
defaultIcon - the name of default icon in classpath to usepublic IconDisplayer(java.io.File file)
file - the icon image file| Method Detail |
|---|
public ValueIconPair[] getIcons()
IconDisplayer
getIcons in interface IconDisplayerpublic void setIcons(ValueIconPair[] icons)
IconDisplayer
setIcons in interface IconDisplayerpublic void addIcons(ValueIconPair[] icons)
IconDisplayer
addIcons in interface IconDisplayerpublic void removeIcons(ValueIconPair[] icons)
IconDisplayer
removeIcons in interface IconDisplayerpublic void removeIcon(ValueIconPair icon)
IconDisplayer
removeIcon in interface IconDisplayer
public void addIcon(long value,
javax.swing.Icon icon)
addIcon(ValueIconPair) using
the new ValueIconPair(value, icon).
value - icon - public void addIcon(ValueIconPair pair)
IconDisplayer
addIcon in interface IconDisplayerpublic void setBackground(java.awt.Color bg)
setBackground in class AbstractDisplayerPanelpublic void setForeground(java.awt.Color fg)
setForeground in class AbstractDisplayerPanelpublic void setValue(long value)
IconDisplayer
setValue in interface IconDisplayervalue - new value to be displayedprotected void updateIcon()
public long getValue()
IconDisplayer
getValue in interface IconDisplayerpublic void setDefaultIconName(java.lang.String filename)
filename - public void setDefaultIcon(java.io.File file)
file - the image filepublic void setDefaultIcon(javax.swing.Icon newIcon)
setDefaultIcon in interface IconDisplayernewIcon - New icon to use. May be null.public java.lang.String getDefaultIconName()
public javax.swing.Icon getDefaultIcon()
getDefaultIcon in interface IconDisplayerpublic boolean isEditable()
Displayer
Returns true if this displayer can interact with user and
fire value updates requested by user. If displayer is editable, mus
implement DataSource interface.
Displayers, which does not support value editing will return allways
false. Displayers which support value editing MUST
implement also setter setEditable(booelan).
isEditable in interface Displayertrue if this displayer can receive value change
requestes by user
public void updateValue(long timestamp,
long value)
throws CommonException
LongConsumer
updateValue in interface LongConsumertimestamp - the time of dynamic value eventvalue - new value
CommonExceptionpublic void setCharacteristics(java.util.Map characteristics)
DataConsumer
setCharacteristics in interface DataConsumercharacteristics - the Map with attripublic java.lang.Class[] getSupportedConsumerTypes()
DataConsumergetDataCosnumer(Class)
method.
getSupportedConsumerTypes in interface DataConsumerpublic <D extends DataConsumer> D getDataConsumer(java.lang.Class<D> type)
DataConsumer
Returns data consumer for requested data consumer type. If this data
consumer does not support required data consumer, null is
returned.
If this data cosnumer does not support specific data consumer type, then it means, that it is not desirable to cast data of that type to any by this consumer supported data consumer types.
getDataConsumer in interface DataConsumertype - Class of specific data consumer (e.g. DoubleConsumer)
null if
not supportedpublic void cleanup()
CommonDisplayer
cleanup in interface CommonDisplayercleanup in class AbstractDisplayerPanelpublic InfoDialog getInfoDialog()
public PopupManager getPopupManager()
AbstractDisplayerPanel
getPopupManager in interface PopupManageablegetPopupManager in class AbstractDisplayerPanelPopupManageable.getPopupManager()public boolean isKeepRatio()
public void setKeepRatio(boolean keepRatio)
keepRatio - true if aspect ratio of the icons is keptpublic void setScaleIcons(boolean scale)
scale - true if icons are scaled to fitpublic boolean isScaleIcons()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||