renderable
Class BlockLabel
java.lang.Object
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 |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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)
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