|
|||||||||
| 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
cz.cuni.mff.mirovsky.trees.NGForestView
public class NGForestView
A base class for forest viewing (displaying on a screen, printing on a printer)
| Nested Class Summary |
|---|
| 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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int |
font_size
the size of the font used for labels of nodes |
protected NGForest |
forest
a forest to be viewed |
protected int |
forest_height
the height of the forest (in pixels) |
protected int |
forest_width
the width of the forest (in pixels) |
protected int |
horizontal_space
horizontal distance between trees in the forest |
protected java.lang.String |
kodovany
an auxiliary variable for printing strings |
protected int |
posunuti_textu_doleva
labels of nodes will be shifted this amount to the left in order to have their first character just below the node |
protected javax.swing.DefaultListModel |
reference_patterns
reference patterns |
protected boolean |
show_hidden_nodes
controls whether hidden nodes should be displayed |
protected NGTreeProperties |
tree_properties
viewing properties of forests |
| 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 | |
|---|---|
NGForestView(ShowMessagesAble mess)
Creates an object needed for viewing trees (on a screen or a printer) |
|
| Method Summary | |
|---|---|
void |
addTree(NGTree tree)
Adds a tree to be viewed. |
protected void |
debug(java.lang.String message)
Displays a debugging message. |
protected java.awt.Color |
determineColor(TNode node,
ReferencePattern pattern,
java.lang.String value_depend_value)
Sets the color for printing a reference. |
protected void |
drawDescription(java.awt.Graphics g,
java.lang.String description,
int x,
int y)
Draws one attribute as a part of a label of a node. |
protected void |
drawTree(NGTree tree,
TNode n,
TNode parent,
int otec_x,
int otec_y,
java.awt.Graphics2D g2)
Draws one tree of the forest. |
boolean |
getEmphasizeChosenNode()
Returns whether the selected node is set to be emphasized |
boolean |
getFlagForestChanged()
Says whether the forest has changed and coordinates of (some of) its trees and their nodes must be calculated. |
int |
getFontSize()
Returns the font size for labels at nodes. |
NGForest |
getForest()
Gets the forest to be viewed. |
int |
getForestHeight()
Returns the height of the forest (in pixels) |
int |
getForestWidth()
Returns the width of the forest (in pixels) |
java.awt.Rectangle |
getMatchingNodesRectangle()
Returns a rectangle that surrounds all matching nodes in the forest. |
javax.swing.DefaultListModel |
getReferencePatterns()
Returns a list of reference patterns |
boolean |
getShowHiddenNodes()
Returns whether the hidden nodes are set to be shown |
NGTreeProperties |
getTreeProperties()
Returns the properties of the tree. |
boolean |
changeReferenceStatus(int i)
Changes the state of (non-)displaying the i-th reference |
protected void |
inform(java.lang.String message)
Displays an informative message. |
void |
paintComponent(java.awt.Graphics g)
Paints the forest. |
void |
printChosen(java.awt.Graphics2D g,
NGTreeProperties properties)
Emphasizes the selected node. |
protected void |
printReferences(java.awt.Graphics2D g2)
Prints all references in the actual forest. |
void |
setEmphasizeChosenNode(boolean emphasize)
Sets whether the selected node should be emphasized |
void |
setFlagWholeForestChanged(boolean flag)
Signals whether the whole forest has changed and coordinates of all its trees and their nodes must be calculated. |
void |
setFontSize(int size)
Sets the font size for labels at nodes. |
void |
setForest(NGForest forest)
Sets a forest to be viewed. |
protected void |
setGlobalProperties()
Sets some global variables according to the actual tree propertis |
void |
setHorizontalSpace(int space)
Sets the horizontal space between trees in the forest. |
void |
setChosenNodeByDepthOrder(int order)
Marks a node with given order as selected, as well as the tree the node is from. |
void |
setReferencePatterns(javax.swing.DefaultListModel patterns)
Sets the reference patterns. |
void |
setShowHiddenNodes(boolean show)
Sets whether or not the hidden nodes should be shown |
void |
setTree(NGTree tree)
Sets a single tree to be viewed. |
void |
setTreeProperties(NGTreeProperties new_properties)
Sets properties of the tree. |
protected java.lang.String |
truncLemma(java.lang.String orig_lemma,
int trunc_type)
PDT-related function that truncates a lemma. |
void |
vypocti_nakresleni(java.awt.Graphics g)
It calculates coordinates of all nodes of all trees in the forest. |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printComponent, printChildren, 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, setVisible, unregisterKeyboardAction, update, updateUI |
| 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, 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, checkImage, checkImage, 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, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected NGForest forest
protected NGTreeProperties tree_properties
protected javax.swing.DefaultListModel reference_patterns
protected int forest_width
protected int forest_height
protected boolean show_hidden_nodes
protected java.lang.String kodovany
protected int posunuti_textu_doleva
protected int font_size
protected int horizontal_space
| Constructor Detail |
|---|
public NGForestView(ShowMessagesAble mess)
mess - an object capable of displaying messages| Method Detail |
|---|
protected void debug(java.lang.String message)
message - a message to be displayedprotected void inform(java.lang.String message)
message - a message to be displayedpublic int getForestWidth()
public int getForestHeight()
public void setHorizontalSpace(int space)
space - the horizontal space in pixelspublic java.awt.Rectangle getMatchingNodesRectangle()
protected void setGlobalProperties()
public void setReferencePatterns(javax.swing.DefaultListModel patterns)
patterns - a list of reference patternspublic javax.swing.DefaultListModel getReferencePatterns()
public void printChosen(java.awt.Graphics2D g,
NGTreeProperties properties)
g - Graphics2D object to draw toproperties - tree properties
protected java.lang.String truncLemma(java.lang.String orig_lemma,
int trunc_type)
orig_lemma - the original lemmatrunc_type - type of truncation:
protected void drawDescription(java.awt.Graphics g,
java.lang.String description,
int x,
int y)
g - a graphic object to draw todescription - a description to be drawnx - the x-coordinatey - the y-coordinate
protected void drawTree(NGTree tree,
TNode n,
TNode parent,
int otec_x,
int otec_y,
java.awt.Graphics2D g2)
tree - the tree to be drawnn - the root of the tree (or subtree - it is a recursive function)parent - the father of node notec_x - the x-coordinate of the fatherotec_y - the y-coordinate of the fatherg2 - a graphic object to draw topublic void vypocti_nakresleni(java.awt.Graphics g)
g - a graphic object to draw topublic void setFlagWholeForestChanged(boolean flag)
flag - value true signals that the coordinates need to be calculatedpublic boolean getFlagForestChanged()
public void setForest(NGForest forest)
forest - a forest to be viewedpublic NGForest getForest()
public void setTree(NGTree tree)
tree - a tree to be veiwedpublic void addTree(NGTree tree)
tree - a tree to be added at the end of the trees of the forestpublic void setTreeProperties(NGTreeProperties new_properties)
new_properties - properties of the treepublic NGTreeProperties getTreeProperties()
public void setShowHiddenNodes(boolean show)
show - true iff they should be shownpublic boolean getShowHiddenNodes()
public void setEmphasizeChosenNode(boolean emphasize)
emphasize - true iff it should be emphasizedpublic boolean getEmphasizeChosenNode()
public boolean changeReferenceStatus(int i)
i - the number of the reference, counted from zero
public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - a graphic object to paint topublic void setChosenNodeByDepthOrder(int order)
order - depth-first order of the node to be selectedprotected void printReferences(java.awt.Graphics2D g2)
g2 - a graphic object to draw to
protected java.awt.Color determineColor(TNode node,
ReferencePattern pattern,
java.lang.String value_depend_value)
node - pattern - a reference patternvalue_depend_value - the value of the attribute that may influence the color
public void setFontSize(int size)
size - the font sizepublic int getFontSize()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||