extra.inpro.synthesis.visual
Class SegmentPanel

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 extra.inpro.synthesis.visual.SegmentPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class SegmentPanel
extends javax.swing.JPanel

a Panel that displays and handles manipulation of a SegmentModel.

Author:
timo
See Also:
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
(package private)  java.awt.event.MouseListener activateSegmentOrPMOnMousePressed
          setup everything so that dragging works
private static java.awt.Color BORDER_COLOR
           
(package private)  javax.swing.Action changeSegmentAction
          the action handling the label-text change of a segment
(package private)  java.awt.event.MouseMotionListener cursorManipulator
          changes the mouse cursor depending on what can currently be done
(package private)  java.awt.event.MouseListener deactiveSegmentOrPMOnMouseReleased
          teardown after something has been dragged
(package private)  javax.swing.Action deletePitchMarkAction
          the action handling the deletion of a pitch mark
(package private)  javax.swing.Action deleteSegmentAction
          the action handling the deletion of a segment
private static int HEAD_ROOM
           
(package private)  javax.swing.Action insertPitchMarkAction
          the action handling the insertion of a pitch mark
(package private)  javax.swing.Action insertSegmentAction
          the action handling the insertion of a segment
(package private)  java.awt.event.MouseMotionListener mouseDragHandler
          handles dragging of segment boundaries and pitch marks
private static int PANEL_HEIGHT
           
private static int PITCH_AREA_HEIGHT
           
private static int PITCH_AREA_START
           
private static java.awt.Color PITCH_BACKGROUND_COLOR
           
private static java.awt.Color PITCH_COLOR
           
private static float PITCH_HOTSPOT_SIZE
           
(package private)  SegmentModel.PitchRange pitchRange
          the current pitch range, used for auto-scaling of pitch values
(package private)  java.awt.event.MouseListener popupHandler
          show the right popup which may trigger one of the following actions
(package private)  java.awt.Point popupPoint
          the point in which a popup event occurred
(package private)  SegmentModel segmentModel
          the underlying segment model
(package private)  javax.swing.JPopupMenu segmentPopup
           
(package private)  javax.swing.Action synthesisAction
          the action to be triggered when something has changed in the segment model that justifies resynthesizing the represented speech
private static int TEXT_BASELINE
           
private static java.awt.Color TEXT_COLOR
           
private  float zoom
          the zoom into the segment model
 
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
SegmentPanel(javax.swing.Action synAction, SegmentModel segmentModel)
           
 
Method Summary
(package private)  void callSynthesis()
           
private  int getCenter(SegmentModel.Segment l)
           
private  int getLeftBoundary(SegmentModel.Segment l)
           
private  SegmentModel.SegmentBoundPitchMark getPitchMarkAtPosition(java.awt.Point p1)
           
private  java.util.List<HotSpot<SegmentModel.SegmentBoundPitchMark>> getPitchPoints()
           
 java.awt.Dimension getPreferredSize()
           
private  int getRightBoundary(SegmentModel.Segment l)
           
private  SegmentModel.Segment getSegmentAtPosition(int mouseX)
           
(package private)  SegmentModel getSegmentModel()
           
private  boolean hasPitchMarkAtPosition(java.awt.Point p1)
           
private  boolean hasSegmentBoundaryAtPosition(int mouseX)
           
(package private)  boolean inSegmentArea(java.awt.event.MouseEvent e)
          determine whether we're in the segment area or in the pitchmark area
 void paintComponent(java.awt.Graphics g)
           
private  void paintPitchBackground(java.awt.Graphics g)
          paint the background
private  void paintPitchMarks(java.awt.Graphics g)
          handle painting of the pitchmark area
private  void paintSegments(java.awt.Graphics g)
          handle painting of the segment area
private  int pitchForPosition(int mouseY)
           
private  int positionAtTime(int time)
          convert time in ms to position in pixels
private  int positionForPitch(int pitch)
           
(package private)  void setSegmentModel(SegmentModel sm)
           
 void setZoom(float zoom)
           
private  int timeAtPosition(int mouseX)
          convert position in pixels to time in ms
 
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, 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, 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, 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
 

Field Detail

PANEL_HEIGHT

private static final int PANEL_HEIGHT
See Also:
Constant Field Values

TEXT_BASELINE

private static final int TEXT_BASELINE
See Also:
Constant Field Values

PITCH_AREA_START

private static final int PITCH_AREA_START
See Also:
Constant Field Values

PITCH_AREA_HEIGHT

private static final int PITCH_AREA_HEIGHT
See Also:
Constant Field Values

HEAD_ROOM

private static final int HEAD_ROOM
See Also:
Constant Field Values

TEXT_COLOR

private static final java.awt.Color TEXT_COLOR

BORDER_COLOR

private static final java.awt.Color BORDER_COLOR

PITCH_COLOR

private static final java.awt.Color PITCH_COLOR

PITCH_BACKGROUND_COLOR

private static final java.awt.Color PITCH_BACKGROUND_COLOR

PITCH_HOTSPOT_SIZE

private static final float PITCH_HOTSPOT_SIZE
See Also:
Constant Field Values

segmentModel

SegmentModel segmentModel
the underlying segment model


pitchRange

SegmentModel.PitchRange pitchRange
the current pitch range, used for auto-scaling of pitch values


segmentPopup

final javax.swing.JPopupMenu segmentPopup

popupPoint

java.awt.Point popupPoint
the point in which a popup event occurred


zoom

private float zoom
the zoom into the segment model


synthesisAction

javax.swing.Action synthesisAction
the action to be triggered when something has changed in the segment model that justifies resynthesizing the represented speech


cursorManipulator

java.awt.event.MouseMotionListener cursorManipulator
changes the mouse cursor depending on what can currently be done


activateSegmentOrPMOnMousePressed

java.awt.event.MouseListener activateSegmentOrPMOnMousePressed
setup everything so that dragging works


deactiveSegmentOrPMOnMouseReleased

java.awt.event.MouseListener deactiveSegmentOrPMOnMouseReleased
teardown after something has been dragged


mouseDragHandler

java.awt.event.MouseMotionListener mouseDragHandler
handles dragging of segment boundaries and pitch marks


popupHandler

java.awt.event.MouseListener popupHandler
show the right popup which may trigger one of the following actions


insertSegmentAction

javax.swing.Action insertSegmentAction
the action handling the insertion of a segment


changeSegmentAction

javax.swing.Action changeSegmentAction
the action handling the label-text change of a segment


deleteSegmentAction

javax.swing.Action deleteSegmentAction
the action handling the deletion of a segment


insertPitchMarkAction

javax.swing.Action insertPitchMarkAction
the action handling the insertion of a pitch mark


deletePitchMarkAction

javax.swing.Action deletePitchMarkAction
the action handling the deletion of a pitch mark

Constructor Detail

SegmentPanel

public SegmentPanel(javax.swing.Action synAction,
                    SegmentModel segmentModel)
Method Detail

inSegmentArea

boolean inSegmentArea(java.awt.event.MouseEvent e)
determine whether we're in the segment area or in the pitchmark area


callSynthesis

void callSynthesis()

setZoom

public void setZoom(float zoom)

getSegmentModel

SegmentModel getSegmentModel()

setSegmentModel

void setSegmentModel(SegmentModel sm)

getSegmentAtPosition

private SegmentModel.Segment getSegmentAtPosition(int mouseX)

hasSegmentBoundaryAtPosition

private boolean hasSegmentBoundaryAtPosition(int mouseX)

getPitchMarkAtPosition

private SegmentModel.SegmentBoundPitchMark getPitchMarkAtPosition(java.awt.Point p1)

hasPitchMarkAtPosition

private boolean hasPitchMarkAtPosition(java.awt.Point p1)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getPitchPoints

private java.util.List<HotSpot<SegmentModel.SegmentBoundPitchMark>> getPitchPoints()

paintPitchBackground

private void paintPitchBackground(java.awt.Graphics g)
paint the background


paintPitchMarks

private void paintPitchMarks(java.awt.Graphics g)
handle painting of the pitchmark area


paintSegments

private void paintSegments(java.awt.Graphics g)
handle painting of the segment area


paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

getLeftBoundary

private int getLeftBoundary(SegmentModel.Segment l)

getRightBoundary

private int getRightBoundary(SegmentModel.Segment l)

getCenter

private int getCenter(SegmentModel.Segment l)

timeAtPosition

private int timeAtPosition(int mouseX)
convert position in pixels to time in ms


positionAtTime

private int positionAtTime(int time)
convert time in ms to position in pixels


positionForPitch

private int positionForPitch(int pitch)

pitchForPosition

private int pitchForPosition(int mouseY)