Documentation of 'CH.ifa.draw.standard.StandardDrawingView' Java class
StandardDrawingView
CH.ifa.draw.standard

Class StandardDrawingView

  • All Implemented Interfaces:
    DrawingChangeListener, DrawingView, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
    Direct Known Subclasses:
    JooneStandardDrawingView


    public class StandardDrawingView
    extends javax.swing.JPanel
    implements DrawingView, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener
    The standard implementation of DrawingView.
    See Also:
    DrawingView, Painter, Tool, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Figure add(Figure figure)
      Adds a figure to the drawing.
      void addAll(java.util.Vector figures)
      Adds a vector of figures to the drawing.
      void addBackground(Painter painter)
      Adds a background.
      void addForeground(Painter painter)
      Adds a foreground.
      void addToSelection(Figure figure)
      Adds a figure to the current selection.
      void addToSelectionAll(java.util.Vector figures)
      Adds a vector of figures to the current selection.
      void checkDamage()
      Refreshes the drawing if there is some accumulated damage
      void clearSelection()
      Clears the current selection.
      void drawAll(java.awt.Graphics g)
      Draws the contents of the drawing view.
      void drawBackground(java.awt.Graphics g)
      Draws the background.
      void drawDrawing(java.awt.Graphics g)
      Draws the drawing.
      void drawHandles(java.awt.Graphics g)
      Draws the currently active handles.
      Drawing drawing()
      Gets the drawing.
      void drawingInvalidated(DrawingChangeEvent e)
      Sent when an area is invalid
      void drawingRequestUpdate(DrawingChangeEvent e)
      Sent when the drawing wants to be refreshed
      DrawingEditor editor()
      Gets the editor.
      Handle findHandle(int x, int y)
      Finds a handle at the given coordinates.
      void freezeView()
      Freezes the view by acquiring the drawing lock.
      PointConstrainer getConstrainer()
      Gets the current constrainer.
      FigureSelection getFigureSelection()
      Gets the current selection as a FigureSelection.
      java.awt.Dimension getMinimumSize()
      Gets the minimum dimension of the drawing.
      java.awt.Dimension getPreferredSize()
      Gets the preferred dimension of the drawing..
      boolean isFocusTraversable() 
      void keyPressed(java.awt.event.KeyEvent e)
      Handles key down events.
      void keyReleased(java.awt.event.KeyEvent e) 
      void keyTyped(java.awt.event.KeyEvent e) 
      java.awt.Point lastClick()
      Gets the position of the last click inside the view.
      void mouseClicked(java.awt.event.MouseEvent e) 
      void mouseDragged(java.awt.event.MouseEvent e)
      Handles mouse drag events.
      void mouseEntered(java.awt.event.MouseEvent e) 
      void mouseExited(java.awt.event.MouseEvent e) 
      void mouseMoved(java.awt.event.MouseEvent e)
      Handles mouse move events.
      void mousePressed(java.awt.event.MouseEvent e)
      Handles mouse down events.
      void mouseReleased(java.awt.event.MouseEvent e)
      Handles mouse up events.
      void paint(java.awt.Graphics g)
      Paints the drawing view.
      Figure remove(Figure figure)
      Removes a figure from the drawing.
      void removeBackground(Painter painter)
      Removes a background.
      void removeForeground(Painter painter)
      Removes a foreground.
      void removeFromSelection(Figure figure)
      Removes a figure from the selection.
      void repairDamage()
      Repair the damaged area
      java.util.Vector selection()
      Gets the currently selected figures.
      int selectionCount()
      Gets the number of selected figures.
      FigureEnumeration selectionElements()
      Gets an enumeration over the currently selected figures.
      java.util.Vector selectionZOrdered()
      Gets the currently selected figures in Z order.
      void setConstrainer(PointConstrainer c)
      Sets the grid spacing that is used to constrain points.
      void setDisplayUpdate(Painter updateStrategy)
      Sets the current display update strategy.
      void setDisplayUpdate1(Painter updateStrategy)
      Sets the current display update strategy.
      void setDrawing(Drawing d)
      Sets and installs another drawing in the view.
      void setEditor(DrawingEditor editor)
      Sets the view's editor.
      void toggleSelection(Figure figure)
      If a figure isn't selected it is added to the selection.
      Tool tool()
      Gets the current tool.
      void unfreezeView()
      Unfreezes the view by releasing the drawing lock.
      void update(java.awt.Graphics g)
      Updates the drawing view.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, 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, 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

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.image.ImageObserver

        imageUpdate
    • Constructor Detail

      • StandardDrawingView

        public StandardDrawingView(DrawingEditor editor,
                                   int width,
                                   int height)
        Constructs the view.
    • Method Detail

      • tool

        public Tool tool()
        Gets the current tool.
        Specified by:
        tool in interface DrawingView
      • setDrawing

        public void setDrawing(Drawing d)
        Sets and installs another drawing in the view.
        Specified by:
        setDrawing in interface DrawingView
      • add

        public Figure add(Figure figure)
        Adds a figure to the drawing.
        Specified by:
        add in interface DrawingView
        Returns:
        the added figure.
      • remove

        public Figure remove(Figure figure)
        Removes a figure from the drawing.
        Specified by:
        remove in interface DrawingView
        Returns:
        the removed figure
      • addAll

        public void addAll(java.util.Vector figures)
        Adds a vector of figures to the drawing.
        Specified by:
        addAll in interface DrawingView
      • getMinimumSize

        public java.awt.Dimension getMinimumSize()
        Gets the minimum dimension of the drawing.
        Specified by:
        getMinimumSize in interface DrawingView
        Overrides:
        getMinimumSize in class javax.swing.JComponent
      • getPreferredSize

        public java.awt.Dimension getPreferredSize()
        Gets the preferred dimension of the drawing..
        Specified by:
        getPreferredSize in interface DrawingView
        Overrides:
        getPreferredSize in class javax.swing.JComponent
      • setDisplayUpdate1

        public void setDisplayUpdate1(Painter updateStrategy)
        Sets the current display update strategy.
        See Also:
        Painter
      • selection

        public java.util.Vector selection()
        Gets the currently selected figures.
        Specified by:
        selection in interface DrawingView
        Returns:
        a vector with the selected figures. The vector is a copy of the current selection.
      • selectionZOrdered

        public java.util.Vector selectionZOrdered()
        Gets the currently selected figures in Z order.
        Specified by:
        selectionZOrdered in interface DrawingView
        Returns:
        a vector with the selected figures. The vector is a copy of the current selection.
        See Also:
        selection()
      • selectionCount

        public int selectionCount()
        Gets the number of selected figures.
        Specified by:
        selectionCount in interface DrawingView
      • addToSelection

        public void addToSelection(Figure figure)
        Adds a figure to the current selection.
        Specified by:
        addToSelection in interface DrawingView
      • addToSelectionAll

        public void addToSelectionAll(java.util.Vector figures)
        Adds a vector of figures to the current selection.
        Specified by:
        addToSelectionAll in interface DrawingView
      • toggleSelection

        public void toggleSelection(Figure figure)
        If a figure isn't selected it is added to the selection. Otherwise it is removed from the selection.
        Specified by:
        toggleSelection in interface DrawingView
      • clearSelection

        public void clearSelection()
        Clears the current selection.
        Specified by:
        clearSelection in interface DrawingView
      • getFigureSelection

        public FigureSelection getFigureSelection()
        Gets the current selection as a FigureSelection. A FigureSelection can be cut, copied, pasted.
        Specified by:
        getFigureSelection in interface DrawingView
      • findHandle

        public Handle findHandle(int x,
                                 int y)
        Finds a handle at the given coordinates.
        Specified by:
        findHandle in interface DrawingView
        Returns:
        the hit handle, null if no handle is found.
      • lastClick

        public java.awt.Point lastClick()
        Gets the position of the last click inside the view.
        Specified by:
        lastClick in interface DrawingView
      • mousePressed

        public void mousePressed(java.awt.event.MouseEvent e)
        Handles mouse down events. The event is delegated to the currently active tool.
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseDragged

        public void mouseDragged(java.awt.event.MouseEvent e)
        Handles mouse drag events. The event is delegated to the currently active tool.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
      • mouseMoved

        public void mouseMoved(java.awt.event.MouseEvent e)
        Handles mouse move events. The event is delegated to the currently active tool.
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
      • mouseReleased

        public void mouseReleased(java.awt.event.MouseEvent e)
        Handles mouse up events. The event is delegated to the currently active tool.
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • keyPressed

        public void keyPressed(java.awt.event.KeyEvent e)
        Handles key down events. Cursor keys are handled by the view the other key events are delegated to the currently active tool.
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • checkDamage

        public void checkDamage()
        Refreshes the drawing if there is some accumulated damage
        Specified by:
        checkDamage in interface DrawingView
      • update

        public void update(java.awt.Graphics g)
        Updates the drawing view.
        Overrides:
        update in class javax.swing.JComponent
      • paint

        public void paint(java.awt.Graphics g)
        Paints the drawing view. The actual drawing is delegated to the current update strategy.
        Specified by:
        paint in interface DrawingView
        Overrides:
        paint in class javax.swing.JComponent
        See Also:
        Painter
      • drawAll

        public void drawAll(java.awt.Graphics g)
        Draws the contents of the drawing view. The view has three layers: background, drawing, handles. The layers are drawn in back to front order.
        Specified by:
        drawAll in interface DrawingView
      • drawHandles

        public void drawHandles(java.awt.Graphics g)
        Draws the currently active handles.
        Specified by:
        drawHandles in interface DrawingView
      • drawDrawing

        public void drawDrawing(java.awt.Graphics g)
        Draws the drawing.
        Specified by:
        drawDrawing in interface DrawingView
      • drawBackground

        public void drawBackground(java.awt.Graphics g)
        Draws the background. If a background pattern is set it is used to fill the background. Otherwise the background is filled in the background color.
        Specified by:
        drawBackground in interface DrawingView
      • addBackground

        public void addBackground(Painter painter)
        Adds a background.
      • removeBackground

        public void removeBackground(Painter painter)
        Removes a background.
      • removeForeground

        public void removeForeground(Painter painter)
        Removes a foreground.
      • addForeground

        public void addForeground(Painter painter)
        Adds a foreground.
      • isFocusTraversable

        public boolean isFocusTraversable()
        Overrides:
        isFocusTraversable in class java.awt.Component
      • mouseEntered

        public void mouseEntered(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mouseClicked

        public void mouseClicked(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • keyTyped

        public void keyTyped(java.awt.event.KeyEvent e)
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • keyReleased

        public void keyReleased(java.awt.event.KeyEvent e)
        Specified by:
        keyReleased in interface java.awt.event.KeyListener

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.