renderable
Class BlockLabel

java.lang.Object
  extended by renderable.BlockLabel
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
Direct Known Subclasses:
NameLabel, PageLabel, SocketLabel

public class BlockLabel
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener

BlockLabel is a region on a block in which text is displayed and possibly edited. The location and font of a BlockLabel is specified in BlockShape and the text displayed is specified by a Block, BlockLabel is the gateway for text to be rendered and modified. The key nature of a BlockLabel is that it is a JLabel when being viewed, and a JTextField when it is being edited. During mouse move, entered and exited events a white border is toggled around the label for particular blocks. This white border helps to suggest editable labels for blocks that have this enabled.


Nested Class Summary
static class BlockLabel.Type
          Enum for the differnt types of labels in codeblocks
 
Field Summary
static java.awt.Font blockFontLarge_Bold
           
static java.awt.Font blockFontLarge_Plain
           
static java.awt.Font blockFontMedium_Bold
           
static java.awt.Font blockFontMedium_Plain
           
static java.awt.Font blockFontSmall_Bold
           
static java.awt.Font blockFontSmall_Plain
           
 
Constructor Summary
BlockLabel(java.lang.String initLabelText, BlockLabel.Type labelType, boolean isEditable, java.awt.Color tooltipBackground)
          BlockLabel Constructor NOTE: A true boolean passed into the isEditable parameter does not necessarily make the label editable, but a false boolean will make the label uneditable.
BlockLabel(java.lang.String initLabelText, BlockLabel.Type labelType, boolean isEditable, long blockID, boolean hasComboPopup, java.awt.Color tooltipBackground)
           
 
Method Summary
protected  int descale(double x)
           
protected  int descale(int x)
           
protected  void dimensionsChanged(java.awt.Dimension value)
           
 boolean editingText()
           
protected  void genusChanged(java.lang.String genus)
           
 int getAbstractHeight()
           
 int getAbstractWidth()
           
(package private)  java.lang.Long getBlockID()
          returns the blockID for this BlockLabel
 javax.swing.JComponent getJComponent()
           
 int getPixelHeight()
           
 java.awt.Point getPixelLocation()
           
 int getPixelWidth()
           
 java.lang.String getText()
           
 void highlightText()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  int rescale(double x)
           
protected  int rescale(int x)
           
 void setEditable(boolean isEditable)
           
 void setEditingState(boolean editing)
           
 void setPixelLocation(int x, int y)
           
 void setText(boolean text)
           
 void setText(double text)
           
 void setText(java.lang.String text)
           
 void setToolTipText(java.lang.String text)
           
 void setZoomLevel(double newZoom)
           
 void showMenuIcon(boolean show)
           
protected  void textChanged(java.lang.String text)
           
protected  boolean textValid(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockFontSmall_Bold

public static final java.awt.Font blockFontSmall_Bold

blockFontMedium_Bold

public static final java.awt.Font blockFontMedium_Bold

blockFontLarge_Bold

public static final java.awt.Font blockFontLarge_Bold

blockFontSmall_Plain

public static final java.awt.Font blockFontSmall_Plain

blockFontMedium_Plain

public static final java.awt.Font blockFontMedium_Plain

blockFontLarge_Plain

public static final java.awt.Font blockFontLarge_Plain
Constructor Detail

BlockLabel

public BlockLabel(java.lang.String initLabelText,
                  BlockLabel.Type labelType,
                  boolean isEditable,
                  java.awt.Color tooltipBackground)
BlockLabel Constructor NOTE: A true boolean passed into the isEditable parameter does not necessarily make the label editable, but a false boolean will make the label uneditable.


BlockLabel

public BlockLabel(java.lang.String initLabelText,
                  BlockLabel.Type labelType,
                  boolean isEditable,
                  long blockID,
                  boolean hasComboPopup,
                  java.awt.Color tooltipBackground)
Method Detail

setZoomLevel

public void setZoomLevel(double newZoom)

getAbstractWidth

public int getAbstractWidth()

getAbstractHeight

public int getAbstractHeight()

getPixelWidth

public int getPixelWidth()

getPixelHeight

public int getPixelHeight()

getPixelLocation

public java.awt.Point getPixelLocation()

setEditable

public void setEditable(boolean isEditable)

editingText

public boolean editingText()

highlightText

public void highlightText()

setPixelLocation

public void setPixelLocation(int x,
                             int y)

getText

public java.lang.String getText()

setText

public void setText(java.lang.String text)

setText

public void setText(boolean text)

setText

public void setText(double text)

setToolTipText

public void setToolTipText(java.lang.String text)

showMenuIcon

public void showMenuIcon(boolean show)

getJComponent

public javax.swing.JComponent getJComponent()

setEditingState

public void setEditingState(boolean editing)

rescale

protected int rescale(int x)

rescale

protected int rescale(double x)

descale

protected int descale(int x)

descale

protected int descale(double x)

getBlockID

java.lang.Long getBlockID()
returns the blockID for this BlockLabel


textChanged

protected void textChanged(java.lang.String text)

genusChanged

protected void genusChanged(java.lang.String genus)

dimensionsChanged

protected void dimensionsChanged(java.awt.Dimension value)

textValid

protected boolean textValid(java.lang.String text)

mouseClicked

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

mousePressed

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

mouseReleased

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

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

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

keyPressed

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

keyReleased

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

keyTyped

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