NORSYS SOFTWARE © 2012 | NETICA API | JAVA   VERSION   5.04  |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--norsys.netica.gui.NodePanel
An abstract base class used for constucting classes that are different styles of NodePanel. Several extensions of this class are supplied in this toolkit. The style that are supplied are modeled after those available in Netica Application (TM). These are as depicted in the following diagram:
If you are familiar with Java SWING programming, you should find it easy to extend this class and create your own node styles. If you override any of the base methods, you will typically want to call the parent method in your overriding method so as to guarantee compatibility with the other NodePanels supplied in this toolkit.
Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
static java.awt.Color |
defaultBackgroundColor_ConstantNode
Background Color for newly constructed Constant nodes. |
static java.awt.Color |
defaultBackgroundColor_DecisionNode
Background Color for newly constructed Decision nodes. |
static java.awt.Color |
defaultBackgroundColor_NatureNode
Background Color for newly constructed Nature nodes. |
static java.awt.Color |
defaultBackgroundColor_UtilityNode
Background Color for newly constructed Utility nodes. |
static java.awt.Color |
defaultBorderColor
The color of any border displayed by this panel upon construction. |
static java.awt.Color |
defaultForegroundColor
The color of any foreground items, such as text. |
static javax.swing.border.Border |
defaultTitleBorder
The Border around any title text. |
static java.awt.Font |
defaultTitleFont
The Font of the title, if any. |
static int |
DISPLAY_MODE_GRAYED
Used to display this NodePanel as "grayed" or "inactive". |
static int |
DISPLAY_MODE_HILITED
Used to display this NodePanel as having been specially selected. |
static int |
DISPLAY_MODE_NORMAL
Used to display this NodePanel in normal fashion. |
static java.awt.Color |
grayedModeBGColor
A color to use for signaling that this NodePanel is in "grayed out" mode ( see |
static java.awt.Color |
hilitedModeBGColor
A color to use for signaling that this NodePanel is in "hilited" mode ( see |
static int |
NODE_STYLE_ABSENT
Display the node as empty space. |
static int |
NODE_STYLE_AUTO_SELECT
Display the node using a style that seems appropriate. |
static int |
NODE_STYLE_BELIEF_BARS
Display the node similar to the Belief Bars Style in Netica Application. |
static int |
NODE_STYLE_CIRCLE
Display the node as a circle or hexagon (Utility nodes). |
static int |
NODE_STYLE_LABELED_BOX
Display the node titles only, in rounded boxes. |
static int |
NODE_STYLE_TEXT
Display the node titles only. |
javax.swing.JLabel |
nodeTitleJLabel
The title Component, if this NodePanel displays a title, otherwise null. |
static int |
probabilitiesFormat
Used to control the format of any probabilities displayed by this NodePanel. |
static int |
PROBABILITY_FORMAT_1
Used to display probabilities with no decimal place and a trailing "%" symbol. |
static int |
PROBABILITY_FORMAT_2
Used to display probabilities as percentages, but without the "%" symbol, and with one decimal place. |
static int |
PROBABILITY_FORMAT_3
Used to display probabilities as floats between 0.0 and 1.0, with two decimal places. |
static int |
PROBABILITY_FORMAT_4
Used to display probabilities as floats between 0.00 and 1.00, with three decimal places. |
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
void |
addListenerToAllComponents(java.util.EventListener eventListener)
Add the given EventListener to this object and, if it is a Container, to all RecursingEventListeners it contains. |
static NodePanel |
createNodePanel(Node node,
int style)
Returns a NodePanel associated with node, of the given style. |
void |
eventOccurred(NeticaEvent event)
A call-back method that Netica will call to indicate an event occurred. |
int |
getDisplayMode()
Returns whether the node is grayed, normal, or hi-lited. |
Node |
getNode()
Returns the Node corresponding to this NodePanel. |
int |
getStyle()
Returns the display style of this NodePanel. |
void |
moveBy(int deltaX,
int deltaY)
Move this panel by a fixed displacement. |
void |
paintComponent(java.awt.Graphics g)
Overrides javax.swing.JComponent.paintComponent(). |
void |
refreshDataDisplayed()
Refresh all the data in this graphical Component, so that it correctly represents the current state of the Netica object it represents. |
void |
removeListenerFromAllComponents(java.util.EventListener eventListener)
Remove the given EventListener from this object and, if it is a Container, from all RecursingEventListeners it contains. |
void |
setDisplayMode(int displayMode)
Sets whether the node is displayed as grayed, normal, or hi-lited. |
protected void |
setupPanel()
Create subcomponents of this NodePanel and add them to this Container. |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUIClassID, paramString, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NODE_STYLE_AUTO_SELECT |
NetPanel.setNodeStyle
.
public static final int NODE_STYLE_LABELED_BOX |
NetPanel.setNodeStyle
.
public static final int NODE_STYLE_CIRCLE |
NetPanel.setNodeStyle
.
public static final int NODE_STYLE_ABSENT |
NetPanel.setNodeStyle
.
public static final int NODE_STYLE_BELIEF_BARS |
NetPanel.setNodeStyle
.
public static final int NODE_STYLE_TEXT |
NetPanel.setNodeStyle
.
public static final int DISPLAY_MODE_GRAYED |
setDisplayMode
.public static final int DISPLAY_MODE_NORMAL |
setDisplayMode
.public static final int DISPLAY_MODE_HILITED |
setDisplayMode
.public static final int PROBABILITY_FORMAT_1 |
probabilitiesFormat
.public static final int PROBABILITY_FORMAT_2 |
probabilitiesFormat
.public static final int PROBABILITY_FORMAT_3 |
probabilitiesFormat
.public static final int PROBABILITY_FORMAT_4 |
probabilitiesFormat
.public static java.awt.Color defaultBackgroundColor_NatureNode |
public static java.awt.Color defaultBackgroundColor_UtilityNode |
public static java.awt.Color defaultBackgroundColor_DecisionNode |
public static java.awt.Color defaultBackgroundColor_ConstantNode |
public static java.awt.Color defaultBorderColor |
public static java.awt.Color grayedModeBGColor |
setDisplayMode(DISPLAY_MODE_GRAYED)
). The default is gray.public static java.awt.Color hilitedModeBGColor |
setDisplayMode(DISPLAY_MODE_HILITED)
). The default is red.public static java.awt.Color defaultForegroundColor |
public static java.awt.Font defaultTitleFont |
public static javax.swing.border.Border defaultTitleBorder |
public static int probabilitiesFormat |
Can be set to one of:
PROBABILITY_FORMAT_1 | Percentage, with no decimal. Eg., 100%, 14%, 0%. | |
PROBABILITY_FORMAT_2 | Percentage, to one decimal place, and without the "%" symbol. Eg., 100.0, 14.0, 0.0. | |
PROBABILITY_FORMAT_3 | Real number, to two decimal places. Eg., 1.00, 0.14, 0.00. | |
PROBABILITY_FORMAT_4 | Real number, to three decimal places. Eg., 1.000, 0.144, 0.000. |
The probabilities displayed are rounded numbers.
For formats 2, 3, and 4, if the probability is non-zero, but would display as zero, then a "+" is appended to thedisplay. For example, with format 4, a probabibility of 0.00023 is displayed as 0.00+"
public javax.swing.JLabel nodeTitleJLabel |
Method Detail |
public static NodePanel createNodePanel ( |
| ) throws NeticaException |
For style, specify one of:
NODE_STYLE_AUTO_SELECT | Netica-J will choose an appropriate style from amongst the following. If the node's VisualNode style (see VisualNode.setStyle ) is set and can be sensibly mapped to one of the following styles, then that style will be used. Otherwise an appropriate default style will be used. | |
NODE_STYLE_LABELED_BOX | Node title/name in rounded box | |
NODE_STYLE_CIRCLE | Plain circle | |
NODE_STYLE_ABSENT | Empty 1-pixel x 1-pixel space. Links to/from it still appear, and the space can still receive mouse events. | |
NODE_STYLE_BELIEF_BARS | Netica (TM) style belief bars, a very popular style | |
NODE_STYLE_TEXT | Node title/name without a border |
Each of the above is depicted in the following diagram:
If you choose NODE_STYLE_AUTO_SELECT, then Netica will attempt to choose an appropriate style, depending on the type of node and the node's preferred display style (see VisualNode.setStyle
). Preference is given to the node's preferred display style, but if this style is not set, is not understood, or does not make sense for this particular node, then appropriate defaults are chosen as per the following table:
Node | node | The node associated with this graphical representation. | ||
int | style | The style of graphic; one of , NODE_STYLE_LABELED_BOX, NODE_STYLE_AUTO_SELECT, NODE_STYLE_LABELED_BOX, , ... |
NetPanel.setNodeStyle | Set the display style of all the nodes in a NetPanel. | |
NodePanel_BeliefBars.NodePanel_BeliefBars | Constructor for NodePanel_BeliefBars. | |
NodePanel_Circle.NodePanel_Circle | Constructor for NodePanel_Circle. | |
NodePanel_LabeledBox.NodePanel_LabeledBox | Constructor for NodePanel_LabeledBox. | |
NodePanel_Text.NodePanel_Text | Constructor for NodePanel_Text. |
public void addListenerToAllComponents ( |
| ) |
RecursingEventListener
EventListener | eventListener | The listener to be added to this component and to any of its children that are also RecursingEventListeners. |
removeListenerFromAllComponents | removes it instead |
addListenerToAllComponents
in interface RecursingEventListener
public void eventOccurred ( |
| ) |
NeticaEvent | event | An object with information about the event that occurred. |
eventOccurred
in interface NeticaListener
public int getDisplayMode ( ) |
Returns one of DISPLAY_MODE_GRAYED, DISPLAY_MODE_NORMAL, or DISPLAY_MODE_HILITED.
Version:
setDisplayMode | Sets it. |
public Node getNode ( ) throws NeticaException |
public int getStyle ( ) |
This is one of:
NODE_STYLE_AUTO_SELECT | Netica-J will choose an appropriate style for you from amongst the following. | |
NODE_STYLE_LABELED_BOX | Node title/name in rounded box | |
NODE_STYLE_CIRCLE | Plain circle | |
NODE_STYLE_ABSENT | Empty rectangular space (but links to/from it still appear, and the space can receive mouse events, etc.) | |
NODE_STYLE_BELIEF_BARS | Netica (TM) style belief bars, a very popular styl | |
NODE_STYLE_TEXT | Node title/name without a border |
Each of the above is depicted in the following diagram:
Version:
createNodePanel | Creates a NodePanel of a certain style. | |
NetPanel.setNodeStyle | Creates new NodePanels of a certain style for an entire net. |
public void moveBy ( |
| ) throws NeticaException |
deltaX is the change in the x (horizontal) direction.
deltaY is the change in the y (vertical) direction.
The VisualNode associated with this NodePanel is also displaced, by the same amounts.
Parameters:
int | deltaX | The change in the x (horizontal) direction. | ||
int | deltaY | The change in the y (vertical) direction. |
public void refreshDataDisplayed ( ) throws NeticaException |
DataDisplayer
If this is a Container object, then it should arrange to invoke the refreshDataDisplayed method of all the DataDisplayer objects it contains.
Version:
refreshDataDisplayed
in interface DataDisplayer
public void removeListenerFromAllComponents ( |
| ) |
RecursingEventListener
EventListener | eventListener | The listener to be removed from this component and from any of its children that are also RecursingEventListeners. |
addListenerToAllComponents | adds it instead |
removeListenerFromAllComponents
in interface RecursingEventListener
public void setDisplayMode ( |
| ) |
int | displayMode | One of DISPLAY_MODE_GRAYED, DISPLAY_MODE_NORMAL, or DISPLAY_MODE_HILITED. |
getDisplayMode | Retrieves it. |
protected void setupPanel ( ) throws Exception |
When you subclass NodePanel, you typically will want to override this method with your own method that builds the subcomponents of your particular NodePanel. Should you do this, we recommend that you call super.setupPanel() so that default NodePanel behavior (e.g., hi-liting logic) is retained.
Version:
public void paintComponent ( |
| ) |
NOTICE:If you override this method, you probably want to call super.paintComponent() in your method to ensure that the node correctly manages display modes.
Parameters:
java.awt.Graphics | g | The AWT/SWING Graphics context. |
paintComponent
in class javax.swing.JComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |