cz.cuni.jagrlib.gui
Class CompositionGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by cz.cuni.jagrlib.gui.CompositionGUI
All Implemented Interfaces:
Undo, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
CompositionGUIBasic

public abstract class CompositionGUI
extends javax.swing.JPanel
implements Undo

Abstract class that cares about visual representation of composition.

See Also:
CompositionGUI.java, Serialized Form

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 int ACTION_CHANNEL_REMOVE
           
static int ACTION_MODULE_REMOVE
           
 boolean canDelete
          Flag for deleting modules.
protected  int countSelected
          Count of selected modules.
protected  UniqueId idChannel
          Numerical order for channels.
protected  UniqueId idModules
          Numerical order for modules and groups.
 InfoGroup info
          Info about Composition.
protected  InfoPlug plugFrom
          Active plug for new channel.
protected  InfoPlug plugTo
          Active plug for new channel.
 ActionsUndo undoReg
          Undo/Redo object.
protected  ZoomWindow zoom
          Zoom window.
 
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
 
Constructor Summary
CompositionGUI()
          Default constructor.
 
Method Summary
abstract  void connectWithOther(InfoModule infoM)
          Connects the given module with others..
abstract  void delete()
          Deletes the module.
protected  java.lang.Integer getChannelAtPoint(int x, int y)
          Get channel on [x,y].
abstract  void moveSelected(java.lang.Integer id, int nx, int ny)
          Moves all selected items.
protected  void moveToBack(ModuleGUI module)
          Moves module back.
protected  void moveToFront(ModuleGUI module)
          Moves module front.
abstract  void newGroup(InfoGroup _info)
          Adds a new group.
abstract  void newChannel(InfoChannel _info)
          Adds a new channel.
abstract  InfoChannel newChannelTemp()
          Creates new temporary channel.
abstract  void newModule(InfoModule _info)
          Adds a new module.
 void paintComponent(java.awt.Graphics g)
          Repaints the composition panel.
abstract  void paintItem(java.awt.Graphics g)
          Paint bonus graphics on panel.
 void paintLinks(java.awt.Graphics g)
          Paints links between modules-plugs composition-plugs.
 void readInfo()
          Reads composition and creates all it's components.
 void redo(ActionsUndoReg action)
          Redoes last undoed action.
 void removeChannel(java.lang.Integer key)
          Deletes the given channel.
 void removeChannels(java.lang.Integer key)
          Deletes channels connected to the given module.
 void removeModule(java.lang.Integer key)
          Deletes the given module.
 void repaintParent()
          Repaint the parent composition.
abstract  void replaceModule(InfoModule _info)
          Replaces module with new one.
 void selectAll(boolean _sel)
          [Un]selects all modules.
protected  void setCompositionSize()
          Sets bounds of Working space.
 void setGroup()
          Creates a new group.
 void setIDModule(InfoPlug plug)
          Sets active plug for a new channel.
protected  void setIDModuleFrom(InfoPlug plug)
          Sets starting plug for a new channel.
protected  void setIDModuleTo(InfoPlug plug)
          Sets ending plug for a new channel.
 void setSelectModule(java.lang.Object id, boolean sel)
          Changes selection-state of module or group.
 void undo(ActionsUndoReg action)
          Undo last action.
 void ungroup()
          Dismisses all selected groups.
 void unsetGroup(InfoGroup ig)
          Dismisses the existing group.
 
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, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, 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, checkImage, checkImage, 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
 

Field Detail

info

public InfoGroup info
Info about Composition.


idModules

protected UniqueId idModules
Numerical order for modules and groups.


idChannel

protected UniqueId idChannel
Numerical order for channels.


plugFrom

protected InfoPlug plugFrom
Active plug for new channel.


plugTo

protected InfoPlug plugTo
Active plug for new channel.


zoom

protected ZoomWindow zoom
Zoom window.


undoReg

public ActionsUndo undoReg
Undo/Redo object.


ACTION_MODULE_REMOVE

public static final int ACTION_MODULE_REMOVE
See Also:
Constant Field Values

ACTION_CHANNEL_REMOVE

public static final int ACTION_CHANNEL_REMOVE
See Also:
Constant Field Values

canDelete

public boolean canDelete
Flag for deleting modules.


countSelected

protected int countSelected
Count of selected modules.

Constructor Detail

CompositionGUI

public CompositionGUI()
Default constructor.

Method Detail

replaceModule

public abstract void replaceModule(InfoModule _info)
Replaces module with new one.

Parameters:
_info - Information about old module.

newModule

public abstract void newModule(InfoModule _info)
Adds a new module.

Parameters:
_info - Information about module.

newChannel

public abstract void newChannel(InfoChannel _info)
Adds a new channel.

Parameters:
_info - Information about channel.

newChannelTemp

public abstract InfoChannel newChannelTemp()
Creates new temporary channel.

Returns:
new temporary channel.

newGroup

public abstract void newGroup(InfoGroup _info)
Adds a new group.


readInfo

public void readInfo()
Reads composition and creates all it's components.


selectAll

public void selectAll(boolean _sel)
[Un]selects all modules.


setSelectModule

public void setSelectModule(java.lang.Object id,
                            boolean sel)
Changes selection-state of module or group.

Parameters:
id - Module key.
sel - New selection state.

setIDModule

public void setIDModule(InfoPlug plug)
Sets active plug for a new channel.

Parameters:
plug - Active plug.

setIDModuleFrom

protected void setIDModuleFrom(InfoPlug plug)
Sets starting plug for a new channel.

Parameters:
plug - Active plug.

setIDModuleTo

protected void setIDModuleTo(InfoPlug plug)
Sets ending plug for a new channel.

Parameters:
plug - Active plug.

getChannelAtPoint

protected java.lang.Integer getChannelAtPoint(int x,
                                              int y)
Get channel on [x,y].

Parameters:
x - X-coordinate.
y - Y-coordinate.
Returns:
Channel key or null if not found.

setGroup

public void setGroup()
Creates a new group.


unsetGroup

public void unsetGroup(InfoGroup ig)
Dismisses the existing group.


ungroup

public void ungroup()
Dismisses all selected groups.


connectWithOther

public abstract void connectWithOther(InfoModule infoM)
Connects the given module with others..


delete

public abstract void delete()
Deletes the module.


removeModule

public void removeModule(java.lang.Integer key)
Deletes the given module.

Parameters:
key - Key of module or group.

removeChannels

public void removeChannels(java.lang.Integer key)
Deletes channels connected to the given module.

Parameters:
key - Module key.

removeChannel

public void removeChannel(java.lang.Integer key)
Deletes the given channel.

Parameters:
key - Channel key.

moveSelected

public abstract void moveSelected(java.lang.Integer id,
                                  int nx,
                                  int ny)
Moves all selected items.

Parameters:
id - Key of item.
nx - Relative x coordinate.
ny - Relative y coordinate.

paintComponent

public void paintComponent(java.awt.Graphics g)
Repaints the composition panel.

Overrides:
paintComponent in class javax.swing.JComponent

paintLinks

public void paintLinks(java.awt.Graphics g)
Paints links between modules-plugs composition-plugs.


paintItem

public abstract void paintItem(java.awt.Graphics g)
Paint bonus graphics on panel.


setCompositionSize

protected void setCompositionSize()
Sets bounds of Working space.


undo

public void undo(ActionsUndoReg action)
Undo last action.

Specified by:
undo in interface Undo
Parameters:
action - Action to un-done.

redo

public void redo(ActionsUndoReg action)
Redoes last undoed action.

Specified by:
redo in interface Undo
Parameters:
action - Action to re-done.

repaintParent

public void repaintParent()
Repaint the parent composition.


moveToFront

protected void moveToFront(ModuleGUI module)
Moves module front.


moveToBack

protected void moveToBack(ModuleGUI module)
Moves module back.