|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
renderable.Comment
public class Comment
Comment stores and displays user-generated text that can be edited by the user. Comments begin in “editable” state. Comments are associated with a parent source of type JComponent. It should "tag" along with that component. Note, however, that this feature should be ensured by the parent source. The parent source can guarantee this by invoking the methods setPosition, translatePosition, and setParent when appropriate. text : String //the text stored in this Comment and edited by the user
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) static int |
DEFAULT_HEIGHT
|
(package private) static int |
DEFAULT_WIDTH
|
(package private) static int |
FONT_SIZE
|
(package private) static int |
MINIMUM_HEIGHT
|
(package private) static int |
MINIMUM_WIDTH
|
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 | |
---|---|
Comment(java.lang.String initText,
CommentSource source,
java.awt.Color borderColor,
double zoom)
Constructs a Comment with belonging to source, with text of initText, and initial zoom The comment's borders will have the color borderColor. |
Method Summary | |
---|---|
void |
delete()
Handle the removal of this comment from its comment source |
CommentArrow |
getArrow()
access to the comment arrow object |
(package private) java.awt.Color |
getBackgroundColor()
Returns the comment background color |
(package private) java.awt.Color |
getBorderColor()
Returns the borderColor of this comment |
(package private) CommentLabel |
getCommentLabel()
returns the commentLabel for this comment |
int |
getCommentLabelWidth()
Returns the width of the comment label for this comment |
(package private) CommentSource |
getCommentSource()
returns the CommentSource for this comment |
(package private) int |
getMargin()
|
(package private) int |
getMyHeight()
|
(package private) int |
getMyWidth()
|
java.lang.String |
getSaveString()
Returns the save String for this comment. |
java.lang.String |
getText()
|
boolean |
isConstrainComment()
returns whether this comment should be constrained to its parent's bounds |
(package private) boolean |
isPressed()
|
(package private) boolean |
isResizing()
|
static Comment |
loadComment(org.w3c.dom.NodeList commentChildren,
RenderableBlock rb)
Loads the comment from a NodeList of comment parts |
static void |
main(java.lang.String[] args)
Test application for comment. |
void |
paint(java.awt.Graphics g)
overrides javax.Swing.JPanel.paint() |
void |
reformComment()
Recalculate the shape of this comment |
void |
setConstrainComment(boolean constrainComment)
sets whether this comment should be constrained to its parent's bounds |
void |
setLocation(int x,
int y)
moves this to a new position at (x,y) but not outside of its parent Container |
void |
setLocation(java.awt.Point p)
moves this to a new position at (x,y) but not outside of its parent Container |
(package private) void |
setMargin(int margin)
|
(package private) void |
setMyHeight(int height)
|
(package private) void |
setMyWidth(int width)
|
void |
setParent(java.awt.Container newparent)
Moves this comment from it's old parent Container to a new Container. |
void |
setParent(java.awt.Container newparent,
java.lang.Object constraints)
Moves this comment from it's old parent Container to a new Container with given constrain. |
(package private) void |
setPressed(boolean pressed)
|
(package private) void |
setResizing(boolean resizing)
|
void |
setText(java.lang.String text)
|
void |
setVisible(boolean b)
Over rides the standard setVisible to make sure the arrow's visibility is also set. |
void |
setZoomLevel(double newZoom)
Set a new zoom level, changes font size, label size, location, shape of comment, and arrow for this comment |
void |
showOnTop()
Bumps the comment to top of ZOrder of parent if parent exists |
java.lang.String |
toString()
String representation of this |
void |
translatePosition(int dx,
int dy)
|
void |
update()
Updates the comment and commentLabel |
void |
update(boolean visibleState)
Sets the active state of the commentLabel and updates the comment and commentLabel |
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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, 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, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static int FONT_SIZE
static int MINIMUM_WIDTH
static int MINIMUM_HEIGHT
static int DEFAULT_WIDTH
static int DEFAULT_HEIGHT
Constructor Detail |
---|
public Comment(java.lang.String initText, CommentSource source, java.awt.Color borderColor, double zoom)
initText,
- initial text of commentsource,
- where the comment is linked to.borderColor
- the color that the border of the comment should bezoom
- initial zoomMethod Detail |
---|
public void delete()
CommentSource getCommentSource()
CommentLabel getCommentLabel()
public int getCommentLabelWidth()
public void update()
public void update(boolean visibleState)
visibleState
- public void setZoomLevel(double newZoom)
newZoom
- public void reformComment()
public java.lang.String getSaveString()
public static Comment loadComment(org.w3c.dom.NodeList commentChildren, RenderableBlock rb)
commentChildren
- rb
-
public void paint(java.awt.Graphics g)
paint
in class javax.swing.JComponent
public java.lang.String getText()
public void setText(java.lang.String text)
text
- public void setLocation(int x, int y)
setLocation
in class java.awt.Component
public void setLocation(java.awt.Point p)
setLocation
in class java.awt.Component
public void translatePosition(int dx, int dy)
dx
- dy
- public void setParent(java.awt.Container newparent)
newparent
- public void setVisible(boolean b)
setVisible
in class javax.swing.JComponent
public void setParent(java.awt.Container newparent, java.lang.Object constraints)
newparent
- public java.lang.String toString()
toString
in class java.awt.Component
public void showOnTop()
java.awt.Color getBackgroundColor()
java.awt.Color getBorderColor()
public CommentArrow getArrow()
int getMyWidth()
void setMyWidth(int width)
width
- the width to setint getMyHeight()
void setMyHeight(int height)
height
- the height to setint getMargin()
void setMargin(int margin)
margin
- the margin to setpublic static void main(java.lang.String[] args)
args
- boolean isPressed()
void setPressed(boolean pressed)
pressed
- true if this comment has been pressedboolean isResizing()
void setResizing(boolean resizing)
resizing
- true if this comment is being resizedpublic boolean isConstrainComment()
public void setConstrainComment(boolean constrainComment)
constrainComment
- the constrainComment to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |