Class BasicBlockUI
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- com.inductiveautomation.ignition.designer.blockandconnector.blockui.BasicBlockUI
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public abstract class BasicBlockUI extends javax.swing.JPanelThis is the "reference" UI used by the alarm pipeline editor. Developers are free to create their own UI styles by following the interfaces defined on Block. If you'd like a block style that looks like the ones found in the alarm pipelines, using this UI will save a lot of effort.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classBasicBlockUI.InParamPanelprotected classBasicBlockUI.OutParamPanelprotected classBasicBlockUI.ParamPanel-
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
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.ColorbackgroundConnectedprotected java.awt.ColorbackgroundUnconnectedprotected Blockblockprotected java.awt.ColorborderConnectedprotected java.awt.ColorborderSelectedprotected java.awt.ColorborderUnconnectedprotected booleanconnectedIs this block "connected" meaning is there a path from the starting block to this one?protected javax.swing.JPanelheaderprotected booleanmirroredWhen mirrored, the inputs are positioned on the right, and the outputs on the left, which is opposite of standardprotected java.awt.ColorpinHoverprotected booleanselectedIs this block "selected" meaning it is highlighted for moving around and editing-
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
-
-
Constructor Summary
Constructors Constructor Description BasicBlockUI(Block block)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected BasicBlockUI.ParamPanelcreateEmpty(AnchorType ioType)java.util.List<AnchorPoint>getAnchorPoints()Returns the list of anchor points created by this block UI.protected abstract java.util.Collection<AnchorDescriptor>getAnchors()The inputs/outputs for the blockjava.awt.ColorgetBackgroundConnected()protected java.awt.ShapegetBackgroundShape(int w, int h)java.awt.ColorgetBackgroundUnconnected()BlockgetBlock()java.awt.ColorgetBorderConnected()java.awt.ColorgetBorderSelected()java.awt.ColorgetBorderUnconnected()protected abstract javax.swing.IcongetIcon()The small icon for the header of the blockjava.awt.ColorgetPinHover()protected abstract java.lang.StringgetTitle()The title for the header of the blockprotected voidinitDetailsPanel(javax.swing.JPanel details)Override this to add contents to the details panelprotected voidinitEmptyDetailsPanel(javax.swing.JPanel bottom)protected voidinitHeader(javax.swing.JPanel header)Initialize the header panel.voidinstall(BlockComponent parent)Install this block ui onto the BlockComponent.booleanisConnected()protected abstract booleanisDetailsPanelRequired()Returning true from this will turn on a details panel beneath the inputs and outputs.booleanisMirrored()booleanisSelected()protected voidpaintComponent(java.awt.Graphics graphics)voidrebuildUI()voidsetBackgroundConnected(java.awt.Color backgroundConnected)voidsetBackgroundUnconnected(java.awt.Color backgroundUnconnected)voidsetBorderConnected(java.awt.Color borderConnected)voidsetBorderSelected(java.awt.Color borderSelected)voidsetBorderUnconnected(java.awt.Color borderUnconnected)voidsetBounds(int x, int y, int width, int height)voidsetConnected(boolean connected)voidsetMirrored(boolean mirrored)voidsetPinHover(java.awt.Color pinHover)voidsetSelected(boolean selected)-
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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
backgroundUnconnected
protected java.awt.Color backgroundUnconnected
-
backgroundConnected
protected java.awt.Color backgroundConnected
-
borderConnected
protected java.awt.Color borderConnected
-
borderSelected
protected java.awt.Color borderSelected
-
borderUnconnected
protected java.awt.Color borderUnconnected
-
pinHover
protected java.awt.Color pinHover
-
header
protected javax.swing.JPanel header
-
connected
protected boolean connected
Is this block "connected" meaning is there a path from the starting block to this one?
-
selected
protected boolean selected
Is this block "selected" meaning it is highlighted for moving around and editing
-
mirrored
protected boolean mirrored
When mirrored, the inputs are positioned on the right, and the outputs on the left, which is opposite of standard
-
block
protected final Block block
-
-
Constructor Detail
-
BasicBlockUI
public BasicBlockUI(Block block)
-
-
Method Detail
-
getBlock
public Block getBlock()
-
install
public void install(BlockComponent parent)
Install this block ui onto the BlockComponent. Expected to be used duringBlock.initUI(BlockComponent)
-
setBounds
public void setBounds(int x, int y, int width, int height)- Overrides:
setBoundsin classjava.awt.Component
-
getAnchors
protected abstract java.util.Collection<AnchorDescriptor> getAnchors()
The inputs/outputs for the block
-
getTitle
protected abstract java.lang.String getTitle()
The title for the header of the block
-
getIcon
protected abstract javax.swing.Icon getIcon()
The small icon for the header of the block
-
isDetailsPanelRequired
protected abstract boolean isDetailsPanelRequired()
Returning true from this will turn on a details panel beneath the inputs and outputs. If you return true from this, you should also override and implementinitDetailsPanel(JPanel)
-
initDetailsPanel
protected void initDetailsPanel(javax.swing.JPanel details)
Override this to add contents to the details panel
-
getAnchorPoints
public java.util.List<AnchorPoint> getAnchorPoints()
Returns the list of anchor points created by this block UI. Intended to be used by
Blockimplementations as the return value forBlock.getAnchorPoints()WARNING These anchor points will be re-created when the UI changes (for example, due to a block structure change event). This means that you cannot hang onto them, e.g. in a
Connectionobject. Please useLookupConnectionto avoid this problem.
-
rebuildUI
public void rebuildUI()
-
getBackgroundShape
protected java.awt.Shape getBackgroundShape(int w, int h)
-
paintComponent
protected void paintComponent(java.awt.Graphics graphics)
- Overrides:
paintComponentin classjavax.swing.JComponent
-
isMirrored
public boolean isMirrored()
-
setMirrored
public void setMirrored(boolean mirrored)
-
setConnected
public void setConnected(boolean connected)
-
isConnected
public boolean isConnected()
-
setSelected
public void setSelected(boolean selected)
-
isSelected
public boolean isSelected()
-
initHeader
protected void initHeader(javax.swing.JPanel header)
Initialize the header panel. Default implementation adds icon and title label
-
getBackgroundUnconnected
public java.awt.Color getBackgroundUnconnected()
-
setBackgroundUnconnected
public void setBackgroundUnconnected(java.awt.Color backgroundUnconnected)
-
getBackgroundConnected
public java.awt.Color getBackgroundConnected()
-
setBackgroundConnected
public void setBackgroundConnected(java.awt.Color backgroundConnected)
-
getBorderConnected
public java.awt.Color getBorderConnected()
-
setBorderConnected
public void setBorderConnected(java.awt.Color borderConnected)
-
getBorderSelected
public java.awt.Color getBorderSelected()
-
setBorderSelected
public void setBorderSelected(java.awt.Color borderSelected)
-
getBorderUnconnected
public java.awt.Color getBorderUnconnected()
-
setBorderUnconnected
public void setBorderUnconnected(java.awt.Color borderUnconnected)
-
getPinHover
public java.awt.Color getPinHover()
-
setPinHover
public void setPinHover(java.awt.Color pinHover)
-
initEmptyDetailsPanel
protected void initEmptyDetailsPanel(javax.swing.JPanel bottom)
-
createEmpty
protected BasicBlockUI.ParamPanel createEmpty(AnchorType ioType)
-
-