Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.embl.ebi.escience.scuflui
Class ScuflDiagram  view ScuflDiagram download ScuflDiagram.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byorg.embl.ebi.escience.scuflui.ScuflDiagram
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, org.embl.ebi.escience.scufl.ScuflModelEventListener, ScuflUIComponent, java.io.Serializable

public class ScuflDiagram
extends javax.swing.JComponent
implements org.embl.ebi.escience.scufl.ScuflModelEventListener, ScuflUIComponent

A view on a ScuflModel that uses a native installation of the dot tool to generate a bitmap graphical representation on the fly, responding to model events appropriately


Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  org.embl.ebi.escience.scufl.view.DotView dot
           
private  boolean fitToWindow
           
private  java.awt.image.BufferedImage image
           
(package private)  int lastFrameHeight
           
(package private)  int lastFrameWidth
           
(package private)  int lastImageHeight
           
(package private)  int lastImageWidth
           
(package private)  double lastScaleFactor
           
private  org.embl.ebi.escience.scufl.ScuflModel model
           
(package private)  java.awt.Image rescaledImage
           
private  int updateStatus
           
 
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.Container
 
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
 
Constructor Summary
ScuflDiagram()
           
 
Method Summary
 void attachToModel(org.embl.ebi.escience.scufl.ScuflModel model)
          Directs the implementing component to bind to the specified ScuflModel instance, refresh its internal state from the model and commence listening to events, maintaining its state as these events dictate.
 void detachFromModel()
          Directs the implementing component to detach from the model, set its internal state to some suitable blank (i.e.
 java.awt.Dimension getMaximumSize()
          Get the component's maximum size.
 java.awt.Dimension getMinimumSize()
          Get the component's minimum size.
 java.lang.String getName()
          A name for this component
 java.awt.Dimension getPreferredSize()
          Get the component's preferred size.
 void paint(java.awt.Graphics g)
          Paint the component.
 void paintComponent(java.awt.Graphics g)
          Paint the component's body.
 void receiveModelEvent(org.embl.ebi.escience.scufl.ScuflModelEvent event)
           
 void setFitToWindow(boolean fitToWindow)
          Set whether the image should scale to the window or be displayed at its natural size with scrollbars
 void setPortDisplay(int portDisplayPolicy)
          Change the port display setting, the default is to show bound ports, but the other options from DotView can be applied as well.
private  void updateGraphic()
           
private  void updateGraphic2()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

private org.embl.ebi.escience.scufl.ScuflModel model

dot

private org.embl.ebi.escience.scufl.view.DotView dot

image

private java.awt.image.BufferedImage image

fitToWindow

private boolean fitToWindow

lastFrameHeight

int lastFrameHeight

lastFrameWidth

int lastFrameWidth

lastImageHeight

int lastImageHeight

lastImageWidth

int lastImageWidth

lastScaleFactor

double lastScaleFactor

rescaledImage

java.awt.Image rescaledImage

updateStatus

private int updateStatus
Constructor Detail

ScuflDiagram

public ScuflDiagram()
Method Detail

setFitToWindow

public void setFitToWindow(boolean fitToWindow)
Set whether the image should scale to the window or be displayed at its natural size with scrollbars


setPortDisplay

public void setPortDisplay(int portDisplayPolicy)
Change the port display setting, the default is to show bound ports, but the other options from DotView can be applied as well.


getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: javax.swing.JComponent
Get the component's minimum size. If the JComponent.minimumSize>JComponent.minimumSize 55 property has been explicitly set, it is returned. If the JComponent.minimumSize>JComponent.minimumSize 55 property has not been set but the JComponent.ui>JComponent.ui 55 property has been, the result of ComponentUI.getMinimumSize(javax.swing.JComponent)>ComponentUI.getMinimumSize(javax.swing.JComponent) 55 is returned. If neither property has been set, the result of Container.getMinimumSize()>Container.getMinimumSize() 55 is returned.


getMaximumSize

public java.awt.Dimension getMaximumSize()
Description copied from class: javax.swing.JComponent
Get the component's maximum size. If the JComponent.maximumSize>JComponent.maximumSize 55 property has been explicitly set, it is returned. If the JComponent.maximumSize>JComponent.maximumSize 55 property has not been set but the JComponent.ui>JComponent.ui 55 property has been, the result of ComponentUI.getMaximumSize(javax.swing.JComponent)>ComponentUI.getMaximumSize(javax.swing.JComponent) 55 is returned. If neither property has been set, the result of Container.getMaximumSize()>Container.getMaximumSize() 55 is returned.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: javax.swing.JComponent
Get the component's preferred size. If the JComponent.preferredSize>JComponent.preferredSize 55 property has been explicitly set, it is returned. If the JComponent.preferredSize>JComponent.preferredSize 55 property has not been set but the JComponent.ui>JComponent.ui 55 property has been, the result of ComponentUI.getPreferredSize(javax.swing.JComponent)>ComponentUI.getPreferredSize(javax.swing.JComponent) 55 is returned. If neither property has been set, the result of Container.getPreferredSize()>Container.getPreferredSize() 55 is returned.


paint

public void paint(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent

Paint the component. This is a delicate process, and should only be called from the repaint thread, under control of the javax.swing.RepaintManager. Client code should usually call Component.repaint()>Component.repaint() 55 to trigger painting.

The body of the paint call involves calling JComponent.paintComponent(java.awt.Graphics)>JComponent.paintComponent(java.awt.Graphics) 55 , JComponent.paintBorder(java.awt.Graphics)>JComponent.paintBorder(java.awt.Graphics) 55 , and JComponent.paintChildren(java.awt.Graphics)>JComponent.paintChildren(java.awt.Graphics) 55 in order. If you want to customize painting behavior, you should override one of these methods rather than paint.

For more details on the painting sequence, see this article.


paintComponent

public void paintComponent(java.awt.Graphics g)
Description copied from class: javax.swing.JComponent
Paint the component's body. This usually means calling ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)>ComponentUI.update(java.awt.Graphics, javax.swing.JComponent) 55 on the JComponent.ui>JComponent.ui 55 property of the component, if it is non-null. You may override this if you wish to customize the component's body-painting behavior. The component's body is painted first, before the border and children.


attachToModel

public void attachToModel(org.embl.ebi.escience.scufl.ScuflModel model)
Description copied from interface: ScuflUIComponent
Directs the implementing component to bind to the specified ScuflModel instance, refresh its internal state from the model and commence listening to events, maintaining its state as these events dictate.

Specified by:
attachToModel in interface ScuflUIComponent

detachFromModel

public void detachFromModel()
Description copied from interface: ScuflUIComponent
Directs the implementing component to detach from the model, set its internal state to some suitable blank (i.e. blank image, no text in a text field etc) and desist from listening to model events.

Specified by:
detachFromModel in interface ScuflUIComponent

updateGraphic2

private void updateGraphic2()

updateGraphic

private void updateGraphic()

receiveModelEvent

public void receiveModelEvent(org.embl.ebi.escience.scufl.ScuflModelEvent event)
Specified by:
receiveModelEvent in interface org.embl.ebi.escience.scufl.ScuflModelEventListener

getName

public java.lang.String getName()
A name for this component

Specified by:
getName in interface ScuflUIComponent