input
stringlengths
10
828
output
stringlengths
5
107
public void write storable output dw super write dw dw write storable get decorated figure
writes itself and the contained figure to the storable output
public void changed invalidate if f listener null f listener figure changed new figure change event this
informs that a figure changed the area of its display box
public void add all vector figures ignore do nothing
adds a vector of figures to the drawing
public void read storable input dr throws ioexception super read dr decorate figure dr read storable
reads itself and the contained figure from the storable input
public int get layer figure figure if f figures contains figure return 1 else return f figures index of figure
gets the layer for a certain figure first occurrence
public boolean has more elements return my single figure null
returns true if the enumeration contains more elements false
public object next element object return figure my single figure my single figure null return return figure
returns the next element of the enumeration
public figure next figure figure return figure figure my single figure my single figure null return return figure
returns the next element of the enumeration
public void write storable output dw
stores the arrow tip to a storable output
public void read storable input dr throws ioexception
reads the arrow tip from a storable input
public figure get figure from layer int layer nr if layer nr 0 layer nr f figures size return figure f figures element at layer nr else return null
gets the figure from a certain layer
public boolean is executable with view figure enumeration e view drawing figures if e has more elements e next figure null return true return false
used in enabling the properties menu item
public void connector visibility boolean is visible
sets whether the connectors should be visible
public vector selection return new vector 0
gets the currently selected figures
public void draw graphics g figure enumeration fe figures while fe has more elements fe next figure draw g
draws all the contained figures
public figure enumeration selection elements return figure enumerator get empty enumeration
gets an enumeration over the currently selected figures
public vector selection zordered return new vector 0
gets the currently seleced figures in z order
public void draw graphics g figure enumeration fe while fe has more elements fe next figure draw g
draws only the given figures
public object clone object clone null byte array output stream output new byte array output stream 200 try object output writer new object output stream output writer write object this writer close catch ioexception e system err println class not found e input stream input new byte array input stream output to byte array try object input reader new object input stream input clone object reader read object catch ioexception e system err println e to string catch class not found exception e system err println class not found e return clone
clones a figure
public void add to selection all vector figures ignore do nothing
adds a vector of figures to the current selection
public figure figure at int i return figure f figures element at i
gets a figure at the given index
public figure selection get figure selection return new standard figure selection selection elements 0
gets the current selection as a figure selection
protected undoable create undo activity return new align command undo activity view get alignment
factory method for undo activity
public figure find figure int x int y figure enumeration k figures reverse while k has more elements figure figure k next figure if figure contains point x y return figure return null
finds a top level figure
public figure find figure rectangle r figure enumeration k figures reverse while k has more elements figure figure k next figure rectangle fr figure display box if r intersects fr return figure return null
finds a top level figure that intersects the given rectangle
public figure find figure without int x int y figure without if without null return find figure x y figure enumeration k figures reverse while k has more elements figure figure k next figure if figure contains point x y figure includes without return figure return null
finds a top level figure but supresses the passed
public figure find figure rectangle r figure without if without null return find figure r figure enumeration k figures reverse while k has more elements figure figure k next figure rectangle fr figure display box if r intersects fr figure includes without return figure return null
finds a top level figure that intersects the given rectangle
public figure find figure inside int x int y figure enumeration k figures reverse while k has more elements figure figure k next figure find figure inside x y if figure null return figure return null
finds a figure but descends into a figures
public figure find figure inside without int x int y figure without figure enumeration k figures reverse while k has more elements figure figure k next figure if figure without figure found figure find figure inside x y if found null return found return null
finds a figure but descends into a figures
public boolean includes figure figure if super includes figure return true figure enumeration fe figures while fe has more elements figure f fe next figure if f includes figure return true return false
checks if the composite figure has the argument as one of
public void set drawing drawing d if f drawing null clear selection f drawing remove drawing change listener this f drawing d if f drawing null f drawing add drawing change listener this check minimum size repaint
sets and installs another drawing in the view
protected void basic move by int x int y figure enumeration fe figures while fe has more elements fe next figure move by x y
moves all the given figures by x and y
public void release super release figure enumeration fe figures while fe has more elements figure figure fe next figure figure release
releases the figure and all its children
public storable read storable throws ioexception storable storable string s read string if s equals null return null if s equals ref int ref read int return storable retrieve ref storable storable make instance s map storable storable read this return storable
reads and resurrects a storable object from the input stream
public void deactivate get wrapped tool deactivate undoable undo activity get wrapped tool get undo activity if undo activity null undo activity is undoable editor get undo manager push undo undo activity editor get undo manager clear redos update menus editor figure selection changed view
deactivates the tool
public void set cursor cursor c ignore do nothing
sets the cursor of the drawing view
public void add figure selection listener figure selection listener fsl ignore do nothing
add a listener for selection changes in this drawing view
public void add all vector figures figure enumeration k new figure enumerator figures while k has more elements add k next figure
adds a vector of figures to the drawing
public boolean undo if is redoable return get reversed activity redo return false
undo the activity
public void new window drawing initial drawing draw application window create application if initial drawing null window open else window open create drawing view initial drawing
open a new window for this application containing the passed in drawing
public void load registered images component component if f registered images size 0 return media tracker tracker new media tracker component register images with media tracker enumeration k f registered images elements while k has more elements string file name string k next element if basic get image file name null tracker add image load image file name id f registered images remove all elements block until all images are loaded try tracker wait for all catch exception e
loads all registered images
public void remove figure selection listener figure selection listener fsl ignore do nothing
remove a listener for selection changes in this drawing view
public boolean is undoable return get reversed activity is redoable
dispatch to is redoable of the activity to be reversed
public void register image string file name f registered images add element file name
registers an image that is then loaded together with
public void set undoable boolean new is undoable get reversed activity set redoable new is undoable
dispatch to set redoable of the activity to be reversed
public boolean is redoable return get reversed activity is undoable
dispatch to is undoable of the activity to be reversed
public void set redoable boolean new is redoable get reversed activity set undoable new is redoable
dispatch to set undoable of the activity to be reversed
public vector get connection figures figure in figure return new vector 0
returns the vector of connection figures
public void item state changed item event e if get selected index 0 get selected index f commands size command command command f commands element at get selected index if command is executable command execute
executes the command
public boolean figure exists figure inf figure enumeration e while e has more elements figure figure e next figure if figure includes inf return true return false
check existance of figure in the drawing
public void action performed action event e int j 0 object source e get source for int i 0 i get item count i jmenu item item get item i ignore separators a separator has a hyphen as its label if get menu component i instanceof jseparator continue if source item command cmd command f commands element at j cmd execute break j
executes the command
protected jcombo box create color choice string attribute command choice choice new command choice for int i 0 i color map size i choice add item new change attribute command color map name i attribute color map color i this return choice
creates the color choice for the given attribute
public undoable pop undo get the last element throw no such element exception if there is none undoable last undoable peek undo remove it from undo collection undo stack remove element at get undo size 1 return last undoable
throw no such element exception if there is none
public void action performed action event e f command execute if get label equals f command name set label f command name
executes the command
public undoable pop redo get the last element throw no such element exception if there is none undoable last undoable peek redo remove it from undo collection redo stack remove element at get redo size 1 return last undoable
throw no such element exception if there is none
protected jcombo box create font choice command choice choice new command choice string fonts toolkit get default toolkit get font list for int i 0 i fonts length i choice add item new change attribute command fonts i font name fonts i this return choice
creates the font choice
public void set bounds rectangle r string text f edit widget set text text f edit widget set bounds r x r y r width r height f edit widget set visible true f edit widget select all f edit widget request focus
positions the overlay
protected void add listeners add window listener new window adapter public void window closing window event event exit
registers the listeners for this window
public vector get connection figures figure in figure if no figure or figure is non connectable just return null if in figure null in figure can connect return null if in figure instanceof connection figure return null vector result new vector 5 figure enumeration figures drawing figures find all connection figures while figures has more elements figure f figures next figure if f instanceof connection figure is figure selected f connection figure cf connection figure f if cf start figure includes in figure cf end figure includes in figure result add element f return result
returns a vector of connectionfigures attached to this figure
protected file filter create file filter return new file filter public boolean accept file check file still display directories for navigation if check file is directory return true else return check file get name ends with my file extension public string get description return get file description
factory method to create a file filter that accepts file with the appropriate
public void write storable output dw super write dw dw write int figure count figure enumeration fe figures while fe has more elements dw write storable fe next figure
writes the contained figures to the storable output
public void invoke end int x int y int anchor x int anchor y drawing view view get wrapped handle invoke end x y anchor x anchor y view undoable undoable activity get wrapped handle get undo activity if undoable activity null undoable activity is undoable get drawing view editor get undo manager push undo undoable activity get drawing view editor get undo manager clear redos
tracks the end of the interaction
public dimension get minimum size return f view size
gets the minimum dimension of the drawing
public void read storable input dr throws ioexception super read dr int size dr read int f figures new vector size for int i 0 i size i add figure dr read storable
reads the contained figures from storable input
public void register file filters jfile chooser file chooser iterator formats iterator my storage formats iterator while formats iterator has next file chooser add choosable file filter storage format formats iterator next get file filter set a current activated file filter if a default storage format has been defined if get default storage format null file chooser set file filter get default storage format get file filter
register all file filters supported by storage formats
public void release figure enumeration fe get affected figures while fe has more elements fe next figure release my affected figures count 0 set affected figures figure enumerator get empty enumeration
releases all resources related to an undoable activity
public boolean is executable return get wrapped command is executable
tests if the command can be executed
public string name return get wrapped command name
gets the command name
public void init rectangle view rectangle the quad tree new quad tree new bounds view rectangle as rectangle2 d figure enumeration fe figures while fe has more elements add to quad tree fe next figure
used to optimize rendering
public vector selection protect the vector with the current selection return vector f selection clone
gets the currently selected figures
public void set scale double scale dimension old size get user size this scale scale set user size old size width old size height centralize drawing force redraw
sets a new zoom scale for this view
public figure enumeration selection elements return new figure enumerator selection zordered
gets an enumeration over the currently selected figures
public void set user size int width int height set size int width scale int height scale
sets the size of this view in user coordinates
public void set drawing view drawing view new internal drawing view internal drawing view new internal drawing view
set the drawing view which represents the internal frame
protected jcomponent create contents drawing view view create left component view create right component view if get left component null get right component null return super create contents view else if get left component null return get right component else if get right component null return get left component else return create split pane view
opens the window and initializes its contents
public drawing view get drawing view return internal drawing view
get the drawing view which represents the internal frame
protected jsplit pane create split pane drawing view view jsplit pane divided contents new jsplit pane jsplit pane horizontal split get left component get right component divided contents set alignment x jsplit pane left alignment divided contents set one touch expandable true return divided contents
method which creates the basic split pane
public void set drawing drawing new internal drawing get drawing view set drawing new internal drawing
set the drawing which is represented in the internal frame
protected void create left component drawing view view set left component new jscroll pane new jlist
method which creates the left component for the jsplit pane
public drawing get drawing return get drawing view drawing
get the drawing which is represented in the internal frame
public jcomponent get left component return left component
get the left component of the jsplit pane
public vector selection zordered vector result new vector selection count figure enumeration figures drawing figures while figures has more elements figure f figures next figure if is figure selected f result add element f return result
gets the currently selected figures in z order
protected drawing view find drawing view drawing view new drawing view container container drawing view old drawing view null component components container get components for int i 0 i components length i if components i instanceof drawing view return drawing view components i else if components i instanceof container old drawing view find drawing view new drawing view container components i if old drawing view null return old drawing view return old drawing view
searches the drawing view in the childrens component hierarchy
protected void create right component drawing view view set right component super create contents view
method which creates the right component for the jsplit pane
public jcomponent get right component return right component
get the right component of the jsplit pane
public void activate super activate view clear selection
activates the figures editor
public void set text string new text if new text equals f text mark text dirty f text new text changed
sets the text of the figure
public void palette user over palette button button boolean inside if inside show status tool button button name else show status f selected tool button name
handles when the mouse enters or leaves a palette button
public void view destroying drawing view view if component class is instance view dndinterface class is instance views x component c component view drop target dt c get drop target if dt null dt set component null dt remove drop target listener this destroy drag gestre recognizer view this super view destroying view
send when an existing view is about to be destroyed
protected void end edit if get typing target null if f text field get text length 0 get typing target set text f text field get text put created figure into a figure enumeration get undo activity set affected figures new single figure enumerator get edited figure text area tool undo activity get undo activity set backup text get typing target get text else drawing orphan get added figure nothing to undo set undo activity null f text field end overlay f text field null view check damage
ends editing of the figures text
protected point constrain point point p dimension size get size p x geom range 1 int size width scale p x p y geom range 1 int size height scale p y if get constrainer null return get constrainer constrain point p return p
constrain to user coordinates not screen coordinates
public void deactivate if is active return drawing view dv editor views for int x 0 x dv length x destroy drag gestre recognizer dv x this super deactivate
called when the tool is deactivated
public void add to selection figure figure if is figure selected figure drawing includes figure f selection add element figure f selection handles null figure invalidate fire selection changed
adds a figure to the current selection
public void mouse move mouse event evt int x int y set cursor evt get x evt get y view
handles mouse moves if the mouse button is up
public void add to selection all vector figures add to selection all new figure enumerator figures
adds a vector of figures to the current selection
protected undoable create undo activity return new text area tool undo activity view get typing target get text
factory method for undo activity
public void mouse up mouse event e int x int y view unfreeze view this should probably go after child mouse up if f child null jdk1 1 doesn t guarantee mouse down mouse drag mouse up f child mouse up e x y f child null
handles mouse up events
public boolean undo if super undo return false get drawing view clear selection if is valid text get original text figure enumeration fe get affected figures while fe has more elements get drawing view drawing orphan fe next figure add text figure if it has been removed no backup text else if is valid text get backup text figure enumeration fe get affected figures while fe has more elements get drawing view add fe next figure set text get original text else set text get original text return true
undo the activity
public void figure selection changed drawing view view setup attributes
handles a change of the current selection
public boolean redo if super redo return false get drawing view clear selection the text figure did exist but was remove if is valid text get backup text figure enumeration fe get affected figures while fe has more elements get drawing view drawing orphan fe next figure the text figure didn t exist before else if is valid text get original text figure enumeration fe get affected figures while fe has more elements get drawing view drawing add fe next figure set text get backup text else set text get backup text return true
redo the activity