input
stringlengths
10
828
output
stringlengths
5
107
public void set horizontal boolean horizontal flag horizontal horizontal flag
sets the direction for the arrangement
public void set short flag boolean short flag use shortest short flag
sets the short flag
public n get focus node return focus node
get the current focus node
public void arrange graph n e graph dimension dim get size int margin get margin int x span dim width 2 margin int y span dim height 2 margin int x step condensed x span graph order spacing int y step condensed y span graph order spacing int x pos margin x step 2 int y pos margin y step 2 for n node graph get node set point loc new point x pos y pos set node location node loc x pos x step y pos y step
arranges the specified graph
public void set focus node n node this focus node node
set the current focus node
public boolean is condensed return condensed
determines whether the arrangement should be condensed or not
public void set condensed boolean condensed flag condensed condensed flag
sets a flag which determines whether to use a condensed format in which
public void arrange graph n e graph throws arrangement exception n focus get focus node if focus null graph contains focus try to automatically determine focus focus on most connected graph tree n cluster graph utils find span tree graph focus arrange cluster
arranges the specified graph
public void arrange graph n e graph dimension dim get size min of h w int radius dim width dim height dim height 2 dim width 2 radius get margin radius 0 9 double ang 0 double theta math pi 2 0 graph order int x center dim width 2 int y center dim height 2 for n node graph get node set point loc new point int math round radius math cos ang x center int math round radius math sin ang y center set node location node loc ang theta
arranges the specified graph
public int get radius step return radius step
get the radius step which is the distance between successive tiers of
public void set center point center point center center point
set the center point for the arrangement
protected void invalidate node locs clear
invalidate this arrangement
public void set radius step int step radius step step
set the radius step for the arrangement
public void set margin int new margin margin new margin
sets a uniform margin around arrangement
protected void set node location n node point loc node locs put node loc
set the location for the node in this arrangement
public void set size dimension dim width dim width height dim height
sets size of working area
public void set size int wide int high width wide height high
sets size of working area
public void arrange tree n root throws arrangement exception dimension dim get size int margin get margin int x span dim width margin 2 int y span dim height margin 2 n node root get data set node location node new point dim width 2 margin rectangle extent new rectangle margin margin gap 2 x span y span gap 2 if horizontal arrange horizontal root extent else arrange vertical root extent
arranges the graph starting at the specified node
public void add time bar time bar bar bar set time span span events add bar add bar
adds a time bar to the display
public void set time ruler time span widget new ruler if ruler null remove ruler get component ruler new ruler put ruler at the top add ruler get component 0 set time span ruler get displayed span
adds a time span widget
public void add item listener item listener listener enable events mouse event mouse clicked listeners add listener
adds a listener which will receive any item selected events
protected void fire item state changed item event event for item listener listener listeners listener item state changed event
notifies all listeners that have registered interest for notification on
public void set time span time span time span todo fix what happens when there s a time ruler set span time span for time bar bar events bar set time span span
specifically sets the timespan for this time line canvas
public void remove item listener item listener listener listeners remove listener if listeners is empty disable events mouse event mouse clicked
removes the item listener from the list of listeners receiving the node
protected void select item d obj if dataset contains obj selected contains obj selected add obj
programatically sets the currently selected data object
public void set dataset collection d data if data null throw new null pointer exception null dataset dataset data
set the dataset to be displayed
public void animate double step inc 1 double steps used to remember how long animation takes long start new date get time for anim step 0 anim step 1 0 anim step step inc display step try thread sleep sleep time catch interrupted exception exc ignored long stop new date get time long anim time stop start sleep time animation time anim time steps if sleep time 0 sleep time 0 anim step 1 0 display step repaint
animate this canvas
public void set max siblings int max if max 1 max siblings max
sets the maximum siblings arranged in a row or column for a particular
public void add hover listener hover listener listener enable events mouse event mouse moved hovers add listener
adds a listener which will receive any item selected events
private void display step graphics g buffer get graphics g clear rect 0 0 get width get height node renderer node ren get node renderer if node ren instanceof animatable animatable node anim animatable node ren node anim set animation step anim step for n node get graph get node set point loc get animated location node node ren draw node g node loc get graphics draw image buffer 0 0 this
set the animation step
private point get animated location n node point loc get arrangement get node location node point prev prev locs get node point interp prev null anim step 1 anim flag animation move loc new point int loc x prev x anim step prev x int loc y prev y anim step prev y return interp
calculates the intermediate animation step
protected void fire hover state changed hover event event for hover listener listener hovers listener hover item changed event
notifies all listeners that have registered interest for notification on
public animation get animation flag return anim flag
returns the animation type flag
public double get animation step return anim step
returns the fractional step along the animation
public e get selected edge if my graph null throw new illegal state exception graph has not been set must check to make sure the edge hasn t been removed eventually add listener to the graph if sel edge null my graph contains edge sel edge sel edge null return sel edge
gets the current selected edge
public n get selected node if my graph null throw new illegal state exception graph has not been set must check to make sure the node hasn t been removed eventually add listener to the graph if sel node null my graph contains sel node sel node null return sel node
gets the current selected node
protected boolean is edge displayable e edge return true
returns whether the edge should be displayed
private void select picked component picked if node comps values contains picked for n node node comps key set component comp node comps get node if comp equals picked select node node else if edge comps values contains picked for e edge edge comps key set component comp edge comps get edge if comp equals picked select edge edge else select node null select edge null
select the picked component
public boolean is edge selectable return select edges
returns whether the edges are selectable
public void set component class class extends component cmp class comp class cmp class
set the component class used to display the cells of the matrix
protected boolean is highlighted object obj return obj null false obj equals sel node obj equals sel edge
returns whether the object should be highlighted
public void set show labels boolean show flag show labels show flag square set visible show flag top label pane set visible show flag left pane set visible show flag
set whether the node labels are displayed
protected boolean is node displayable n node return true
returns whether the node should be displayed
public void set animation flag animation flag anim flag flag node renderer node ren get node renderer if node ren instanceof animatable animatable node ren set animation flag flag
sets a flag indicating the type of transformation
public void update graph update gui
update the currently displayed graph
public void set animation step double animation step anim step animation step node renderer node ren get node renderer if node ren instanceof animatable animatable node ren set animation step animation step
sets the fractional step along the animation
public void remove hover listener hover listener listener hovers remove listener if hovers is empty disable events mouse event mouse moved
removes the item listener from the list of listeners receiving the node
private void update gui nodes new array list n get graph get node set update grid pane update label panes
update the user interface for this display
public void set animation time long millis scale number of steps appropriately steps int steps millis animation time if steps 0 steps 1 animation time millis sleep time 0
sets the ideal animation time for the time to animate the change of
public void clear svg clear
clear the current svg graphics object and document
public edge renderer get edge renderer return edge render
get the edge renderer
public void arrange throws arrangement exception graph n e graph get graph arranger arrange graph
arrange the graph
public string get svg return svg get svg
get the svg content of this renderer
public void select node n node if node null node equals sel node if sel node null fire item state changed new item event this item event item state changed sel node item event deselected n old node sel node sel node node redraw node old node if sel node null fire item state changed new item event this item event item state changed sel node item event selected redraw node sel node
programatically sets the currently selected node
private void render subtree tree n tree point parent loc tree arrange get node location tree get data for tree n child tree get child trees point child loc tree arrange get node location child get data svg draw line parent loc x parent loc y child loc x child loc y render subtree child node render draw node svg tree get data parent loc
render the specified subtree into svg
public void render svg tree tree n tree tree arrange set size width height svg clear svg set size width height try tree arrange arrange tree render subtree tree catch arrangement exception exc throw new runtime exception cannot arrange properly in svg renderer exc
render the specified tree into svg
public void set edge selectable boolean edge select select edges edge select
sets whether the edges are selectable
public void set height int hgt height hgt
set the working height
public void set graph graph n e graph if graph null throw new null pointer exception null graph this my graph graph
set the graph to be displayed
public void set width int wid width wid
set the width
public void add item listener item listener listener listeners add listener
adds a listener which will receive any item selected events
public void write svg writer writer svg write svg writer
write svg to the provided writer
public void remove item listener item listener listener listeners remove listener
removes the item listener from the list of listeners receiving the node
protected void redraw edge e edge graphics g graph segment n e seg get graph get edge segment edge if seg null n orig seg get origin point orig loc arranger get node location orig n dest seg get destination point dest loc arranger get node location dest if is highlighted edge edge renderer highlight edge g edge orig loc dest loc else if is edge displayable edge edge renderer draw edge g edge orig loc dest loc
redraws an individual edge
public void select node n node tree n tree node root find child node tree node path model get path to root tree node reverse the path tree path tree path new tree path path j tree set selection path tree path
programatically sets the currently selected node
public void set tree tree n new tree root new tree model set root root j tree set model model
set the tree to be displayed
public void update tree enumeration expand enum j tree get expanded descendants new tree path root model reload if expand enum null while expand enum has more elements j tree expand path tree path expand enum next element
update the tree display
public void set tree tree n new tree my tree new tree tree graph null
set the tree displayed on this canvas
public n get selected node fill tree pane n sel pane get selected pane return sel pane null sel pane get tree get data null
get the currently selected node
protected void redraw node n node graphics g if is visible point loc arranger get node location node if loc null if is highlighted node node renderer highlight node g node loc else if is node displayable node node renderer draw node g node loc
redraws an individual node
public void update tree tree graph null repaint
update the tree displayed
protected float calc edge width weighted edge double wt edge get weight return wt 0 0 float math log wt
calculate the line width used to draw the edge
protected void render graph graphics g remove all color col g get color graph n e graph get graph for e edge graph get edge set redraw edge edge g for n node graph get node set redraw node node g for e edge graph get edge set if is highlighted edge redraw edge edge g for n node graph get node set if is highlighted node redraw node node g g set color col
draws the graph on the canvas
protected void draw animation step graphics g object node point loc if anim flag animation rotate right anim flag animation move rotate right anim flag animation rotate left anim flag animation move rotate left draw rotate step g node loc else int size get node size node int width size 2 int height int math round width aspect int top loc y height 2 g set color get node color node g fill3 drect loc x size top width height true
draws the intermediate animation step
public void set tree tree n new tree my node new tree n obj new tree get data remove all if obj instanceof jcomponent add jcomponent obj border layout north else string name obj to string jlabel label new jlabel name add label border layout north child pane remove all add child pane for tree n child new tree get child trees child pane add new fill tree pane n child horizontal invalidate revalidate
set the root node for this fill tree pane
public void set graph arrangement graph arrangement n e arrangement if arrangement null throw new null pointer exception null arrangement arranger arrangement insets insets get insets arranger set size get width get height arranger set margin insets top 10 graph n e graph get graph if graph null get width 0 get height 0 try arranger arrange graph needs arranging false catch arrangement exception e repaint
set the current graph arrangement
public void update graph try arranger arrange get graph catch arrangement exception exc needs arranging true repaint
update the currently displayed graph
protected void validate arrangement insets insets get insets if get size equals arranger get size needs arranging true graph n e graph get graph if needs arranging arranger set size get width get height arranger set margin insets top 10 try arranger arrange graph needs arranging false catch exception e
validates the arrangement immediately prior to drawing
public void draw node graphics g object node point loc draw node g node loc false
render the node with the current shape
public void draw edge graphics g object edge point orig loc point dest loc if orig loc null dest loc null color tmp color g get color g set color get edge color edge g draw line orig loc x orig loc y dest loc x dest loc y g set color tmp color
draws the edge into the graphics context
protected color get edge color object edge return color
get the color used for the edge
public color get highlight return hilite
gets the highlight color for the renderer
public void set color color edge color color edge color
sets the color for the edge renderer
public void set highlight color highlight hilite highlight
sets the highlight color for the edge renderer
private color calc color return new color int sub color get red fade color get red anim step fade color get red int sub color get green fade color get green anim step fade color get green int sub color get blue fade color get blue anim step fade color get blue int sub color get alpha fade color get alpha anim step fade color get alpha
returns a color interpolated between two colors for animation purposes
public void draw node graphics g object node point loc color interp calc color sub render set color interp sub render draw node g node loc sub render set color sub color
draws the node into the graphics context
public animation get animation flag return animation transform
get the animation flag
public color get color return sub render get color
get the color for this node renderer
public rectangle get node bounds object node point loc return sub render get node bounds node loc
gets the node bounds
public void highlight node graphics g object node point loc sub render highlight node g node loc
highlight a node
public boolean pick node object node point node loc point pick point return sub render pick node node node loc pick point
checks whether the specified pickpoint is within the drawn area for the
public rectangle get node bounds object node point loc return new rectangle loc x 25 loc y 15 50 30
returns the bounding box for the node using this renderer
public void set animation flag animation flag ignored
set the animation flag
public void set animation step double frac anim step frac
set the animation step
public void set color color color sub render set color color sub color color
set the color
protected color get node color object node return color
get the color used for the node
protected node shape get node shape object node return shape
get the shape for a particular node
public node shape get shape return shape
get the current shape
public double get animation step return anim frac
returns the fractional step along the animation
public void draw node graphics g object node point loc jcomponent comp components get node if comp null comp create component node if use swing colors comp set background node color dimension dim comp get preferred size if dim null loc null int x loc x dim width 2 int y loc y dim height 2 comp set bounds x y dim width dim height cont add comp components put node comp
draws the node into the graphics context