Class EditCanvas

All Implemented Interfaces:
ActionListener, FocusListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
StationModelCanvas, TestCanvas

See Also:
  • Field Details

  • Constructor Details

    • EditCanvas

      public EditCanvas()
      _more_
  • Method Details

    • setDefaultCursor

      public void setDefaultCursor()
      _more_
    • okToPaintHighlight

      public boolean okToPaintHighlight()
      _more_
      Returns:
      _more_
    • paint

      public void paint(Graphics g)
      Called from the base class. It calls the parent to paint the list of Glyphs and then it tells any highlighted glyph to paint. And then it tells the currentCommand to paint.
      Overrides:
      paint in class DisplayCanvas
      Parameters:
      g -
    • haveCommand

      public boolean haveCommand()
      _more_
      Returns:
      _more_
    • getHaveChanged

      public boolean getHaveChanged()
      _more_
      Returns:
      _more_
    • setHaveChanged

      public void setHaveChanged(boolean v)
      _more_
      Parameters:
      v -
    • setCommand

      public void setCommand(CanvasCommand newCommand)
      _more_
      Parameters:
      newCommand -
    • notifyGlyphMoved

      public void notifyGlyphMoved(Glyph theGlyph)
      We have these hooks here so that derived classes can do things based on glyph events (e.g., tell the whiteboard server that a Glyph moved
      Overrides:
      notifyGlyphMoved in class DisplayCanvas
      Parameters:
      theGlyph -
    • notifyGlyphMoveComplete

      public void notifyGlyphMoveComplete(Glyph theGlyph)
      _more_
      Overrides:
      notifyGlyphMoveComplete in class DisplayCanvas
      Parameters:
      theGlyph -
    • notifyGlyphChanged

      public void notifyGlyphChanged(Glyph theGlyph, String attr)
      _more_
      Parameters:
      theGlyph -
      attr -
    • notifyGlyphChangeDone

      public void notifyGlyphChangeDone(Glyph theGlyph, String attr)
      _more_
      Parameters:
      theGlyph -
      attr -
    • notifyGlyphCreateComplete

      public void notifyGlyphCreateComplete(Glyph g, boolean diddleSelection, boolean fromPaste)
      _more_
      Overrides:
      notifyGlyphCreateComplete in class DisplayCanvas
      Parameters:
      g -
      diddleSelection -
      fromPaste -
    • focusGained

      public void focusGained(FocusEvent e)
      _more_
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e -
    • focusLost

      public void focusLost(FocusEvent e)
      _more_
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e -
    • keyReleased

      public void keyReleased(KeyEvent e)
      _more_
      Specified by:
      keyReleased in interface KeyListener
      Parameters:
      e -
    • keyTyped

      public void keyTyped(KeyEvent evt)
      _more_
      Specified by:
      keyTyped in interface KeyListener
      Parameters:
      evt -
    • keyPressed

      public void keyPressed(KeyEvent evt)
      _more_
      Specified by:
      keyPressed in interface KeyListener
      Parameters:
      evt -
    • makeSelectionMenuItem

      protected JMenuItem makeSelectionMenuItem(String label, char mnem, String command, boolean enabled)
      _more_
      Parameters:
      label -
      mnem -
      command -
      enabled -
      Returns:
      _more_
    • makeMenuItem

      protected JMenuItem makeMenuItem(String label, char mnem, String command)
      _more_
      Parameters:
      label -
      mnem -
      command -
      Returns:
      _more_
    • makeMenuItem

      protected JMenuItem makeMenuItem(String label, String command)
      _more_
      Parameters:
      label -
      command -
      Returns:
      _more_
    • makeEditMenu

      public JMenu makeEditMenu()
      _more_
      Returns:
      _more_
    • makeViewMenu

      public JMenu makeViewMenu()
      _more_
      Returns:
      _more_
    • selectionChanged

      public void selectionChanged()
      _more_
      Overrides:
      selectionChanged in class DisplayCanvas
    • makeEditMenu

      public JMenu makeEditMenu(JMenu editMenu)
      _more_
      Parameters:
      editMenu -
      Returns:
      _more_
    • makeViewMenu

      public JMenu makeViewMenu(JMenu viewMenu)
      _more_
      Parameters:
      viewMenu -
      Returns:
      _more_
    • doGroup

      public boolean doGroup()
    • doZoomIn

      protected void doZoomIn()
      zoom in
    • doZoomOut

      protected void doZoomOut()
      zoom out
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      _more_
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event -
    • group

      public void group()
      _more_
    • unGroup

      public void unGroup()
      _more_
    • doPaste

      public void doPaste(List l, int x, int y)
      Paste the given vector of glyphs. We find the upper left point of the set of glyphs to get an offset from the given x,y coords.
      Parameters:
      l -
      x -
      y -
    • doPaste

      public void doPaste()
      _more_
    • cloneGlyphs

      public List cloneGlyphs(List from)
      _more_
      Parameters:
      from -
      Returns:
      _more_
    • doToFront

      public void doToFront()
      _more_
    • doToBack

      public void doToBack()
      _more_
    • doCopy

      public void doCopy()
      _more_
    • doCut

      public void doCut()
      _more_
    • selectAll

      public void selectAll()
      _more_
    • spaceH

      public void spaceH()
    • spaceV

      public void spaceV()
    • doAlign

      public void doAlign(String cmd)
      Align the set of selected glyphs with the given command (e.g., align.top, align.bottom, etc.)
      Parameters:
      cmd -
    • snapToGrid

      public void snapToGrid()
    • doMakeMenuItems

      public List doMakeMenuItems(Glyph g, List l)
      /** _more_
      Parameters:
      g -
      l -
      Returns:
      _more_
    • setColor

      public void setColor(Glyph g, boolean foreground)
      Set the color of the glyph from a color chooser dialog.
      Parameters:
      g - Glyph to color.
      foreground - true if the color is for the foreground
    • setColor

      public void setColor(Glyph g, boolean foreground, Color newColor)
      Set the color of the glyph from a color chooser dialog.
      Parameters:
      g - Glyph to color.
      foreground - true if the color is for the foreground
      newColor - new Color for this Glyph
    • mouseClicked

      public void mouseClicked(MouseEvent event)
      Handle mouse click events.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      event - MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Handle mouse entered events. NO-OP in this implementation.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseExited

      public void mouseExited(MouseEvent e)
      Handle mouse exited events. NO-OP in this implementation.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      e - MouseEvent
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Handle mouse moved events.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      e - MouseEvent
    • getShapeDescriptors

      public List getShapeDescriptors()
      _more_
      Returns:
      _more_
    • getMenuBar

      public JMenuBar getMenuBar()
      _more_
      Returns:
      _more_
    • doMakeContents

      protected Component doMakeContents()
      _more_
      Overrides:
      doMakeContents in class DisplayCanvas
      Returns:
      _more_
    • getLabelComponent

      protected JComponent getLabelComponent()
      _more_
      Returns:
      _more_
    • initMenuBar

      public void initMenuBar(JMenuBar menuBar)
      _more_
      Parameters:
      menuBar -
    • togglePressed

      public void togglePressed(JToggleButton pressed)
      _more_
      Parameters:
      pressed -
    • doMakeToolbar

      public JToolBar doMakeToolbar(JToolBar toolbar)
      _more_
      Parameters:
      toolbar -
      Returns:
      _more_
    • doMakePalette

      public Component doMakePalette()
      Create the Glyph creation palette
      Returns:
      _more_
    • showTextInPalette

      public boolean showTextInPalette()
      _more_
      Returns:
      _more_
    • mousePressed

      public void mousePressed(MouseEvent e)
      _more_
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e -
    • doDoubleClick

      protected void doDoubleClick(Glyph nearestGlyph)
      _more_
      Parameters:
      nearestGlyph - _more_
    • mousePressedInner

      public boolean mousePressedInner(MouseEvent e)
      _more_
      Parameters:
      e -
      Returns:
      _more_
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      _more_
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      e -
    • loadXml

      public void loadXml(Element root)
      _more_
      Parameters:
      root -
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      _more_
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      e -
    • makeDescriptor

      public EditCanvas.ShapeDescriptor makeDescriptor(String className, String name, String iconName, String attrs)
      _more_
      Parameters:
      className - _more_
      name - _more_
      iconName - _more_
      attrs - _more_
      Returns:
      _more_