input
stringlengths
10
828
output
stringlengths
5
107
private jpanel get jcontent pane if j content pane null j content pane new jpanel j content pane set layout new border layout j content pane add get jpanel border layout north j content pane add get jpanel1 border layout south j content pane add get jscroll pane border layout center return j content pane
this method initializes j content pane
private jpanel get jpanel if j panel null grid bag constraints grid bag constraints new grid bag constraints grid bag constraints fill grid bag constraints both grid bag constraints gridy 1 grid bag constraints weightx 1 0 grid bag constraints weighty 1 0 grid bag constraints gridheight 3 grid bag constraints gridx 0 j label new jlabel j label set text preprocess results j panel new jpanel j panel set layout new grid bag layout j panel add j label new grid bag constraints j panel add get jtext area grid bag constraints return j panel
this method initializes j panel
private jbutton get jbutton if j button null j button new jbutton j button set text ok j button add action listener new java awt event action listener public void action performed java awt event action event e this dialog set visible false return j button
this method initializes j button
private jtext field get jtext field2 if j text field barcode null j text field barcode new jtext field j text field barcode set text j text field barcode add key listener new java awt event key adapter public void key typed java awt event key event e new filter return j text field barcode
this method initializes j text field
private jtable get jtable if j table null j table new jtable model j table set model model return j table
this method initializes j table
private jtext area get jtext area if j text area null j text area new jtext area j text area set editable false j text area set enabled true return j text area
this method initializes j text area
private jtext field get jtext field description if j text field description null j text field description new jtext field j text field description set editable false j text field description set text return j text field description
this method initializes j text field description
private jtext field get jtext field3 if j text field drawer number null j text field drawer number new jtext field j text field drawer number set text j text field drawer number add key listener new java awt event key adapter public void key typed java awt event key event e new filter return j text field drawer number
this method initializes j text field
private jtext field get jtext field ulx if j text field ulx null j text field ulx new jtext field return j text field ulx
this method initializes j text field ulx
private void initialize this set size 566 308 this set layout new border layout this add get jpanel1 border layout south this add get jscroll pane border layout center this add get jjtool bar bar border layout north
this method initializes this
private jtext field get jtext field uly if j text field uly null j text field uly new jtext field return j text field uly
this method initializes j text field uly
private jtable get jtable if j table null j table new jtable users table model model new users table model users life cycle find all j table set model model j table set default renderer users class new button renderer j table set default editor users class new button editor button editor open user this panel return j table
this method initializes j table
private jtool bar get jjtool bar bar if j jtool bar bar null j jtool bar bar new jtool bar j jtool bar bar set floatable false j jtool bar bar add get jbutton add user return j jtool bar bar
this method initializes j jtool bar bar
private jtext field get jtext field size width if j text field size width null j text field size width new jtext field return j text field size width
this method initializes j text field size width
public edit user panel get edit user panel if edit user panel null edit user panel new edit user panel return edit user panel
this method initializes edit user panel
public void set file file a file position template a template throws unreadable file exception candidate file a file is file readable set initial state barcode status result not checked exif comment text null label text null check the file for an exif comment get exif user comment text scan for exif when handed file if a template get template id equals position template template no component parts try if get label qrtext a template null get label ocrtext a template catch ocrread exception e log error unable to ocr file candidate file get name e get message
change the image file and position template
private jtext field get jtext field size height if j text field size height null j text field size height new jtext field return j text field size height
this method initializes j text field size height
private jpanel get jpanel1 if j panel1 null grid bag constraints grid bag constraints11 new grid bag constraints grid bag constraints11 gridx 1 grid bag constraints11 gridy 0 j panel1 new jpanel j panel1 set layout new grid bag layout j panel1 add get jbutton new grid bag constraints j panel1 add get jbutton save grid bag constraints11 return j panel1
this method initializes j panel1
private jbutton get jbutton if j button null j button new jbutton j button set text cancel j button set mnemonic key event vk c j button add action listener new java awt event action listener public void action performed java awt event action event e this dialog set visible false return j button
this method initializes j button
public void zoom to fit jviewport view jviewport this get parent if view null zoom to fit view get width view get width
zoom this image to fit entirely into a parent viewport
public dimension get image size dimension result null if image null result new dimension 0 0 else result new dimension image get width this image get height this convert get values that came back as unknown yet 1 to 0 0 if result height 1 result width 1 result new dimension 0 0 return result
convenience method to get the size of the current image
private void initialize this set size 755 353 this set preferred size new dimension 1350 1000 this set content pane get jcontent pane this set title image file and barcode value
this method initializes this
private boolean validate values boolean result true check that ul coordinate is on image if ul height min y ul height max y result false if ul width min x ul width max x result false check that size is smaller that image if size height min y size height max y result false if size width min x size width max x result false check that box fits in image if ul height size height max y result false if ul width size width max x result false return result
validate form fields
public int get result return result code
result state of the dialog
private void initialize this set size 669 347 this set content pane get jcontent pane this set title image capture app app name preferences j text field set text singleton get singleton instance get properties get properties source
this method initializes this an instance of properties editor setting up the frame
private jpanel get jcontent pane if j content pane null j content pane new jpanel j content pane set layout new border layout j content pane add get jpanel images panel border layout center return j content pane
this method initializes j content pane
private jpanel get jcontent pane if j content pane null j content pane new jpanel j content pane set layout new border layout j content pane add get jtext field border layout north j content pane add get jpanel border layout center j content pane add get jpanel1 border layout south return j content pane
this method initializes j content pane
private jpanel get jpanel if j panel null grid bag constraints grid bag constraints new grid bag constraints grid bag constraints fill grid bag constraints both grid bag constraints gridy 0 grid bag constraints weightx 1 0 grid bag constraints weighty 1 0 grid bag constraints gridx 0 j panel new jpanel j panel set layout new grid bag layout j panel add get jscroll pane grid bag constraints return j panel
this method initializes j panel
private jpanel get jpanel1 if j panel1 null j panel1 new jpanel j panel1 set layout new grid bag layout j panel1 add get jbutton new grid bag constraints j panel1 add get jbutton1 new grid bag constraints return j panel1
this method initializes j panel1
private jbutton get jbutton if j button null j button new jbutton j button set text cancel j button set mnemonic key event vk c j button add action listener new java awt event action listener public void action performed java awt event action event e this editor set visible false return j button
this method initializes j button
private jbutton get jbutton1 if j button1 null j button1 new jbutton j button1 set text save j button1 set mnemonic key event vk s j button1 add action listener new java awt event action listener public void action performed java awt event action event e try if j table is editing j table get cell editor stop cell editing singleton get singleton instance set properties image capture properties j table get model singleton get singleton instance get properties save properties this editor dispose catch exception e1 system out println save failed return j button1
this method initializes j button1
private void done singleton get singleton instance get job list remove job runnable job this
cleanup when job is complete
private jtable get jtable if j table null j table new jtable table model properties return j table
this method initializes j table
public string selection get transfer contents int br get selected row int bc get selected column int er br get selected row count int ec bc get selected column count string out for int row br row er row for int col bc col ec col out get value at row col if col 1 ec out t if er br 1 out n return new string selection out
convert the selection to tab delimited cells and
private jpanel get jpanel barcode if j panel null j panel new jpanel j panel set layout new border layout j text barcode new jtext field j text barcode set text barcode j panel add get jscroll pane border layout center j panel add j text barcode border layout south return j panel
this method initializes j panel
private void initialize this set size 940 351 this set preferred size new dimension 1250 350 this set content pane get jcontent pane this set title jframe this pack dimension screen size toolkit get default toolkit get screen size this set location screen size width this get width 2 screen size height this get height 2
this method initializes this
private jpanel get jpanel specimen if j panel specimen null j panel specimen new jpanel j panel specimen set layout new border layout j panel specimen add get jlabel specimen border layout center return j panel specimen
this method initializes j panel
private void initialize this set size new dimension 698 290 this set content pane get jpanel this set title connection dialog this get root pane set default button j button dimension screen size toolkit get default toolkit get screen size this set location screen size width this get width 2 screen size height this get height 2
this method initializes this
private jtable get jtable if j table null j table new jtable determination table model model new determination table model j table set model model if determinations null j table set model determinations return j table
this method initializes j table
private jpanel get jpanel if j panel null grid bag constraints grid bag constraints new grid bag constraints grid bag constraints gridx 1 grid bag constraints gridy 0 j panel new jpanel j panel set layout new grid bag layout j panel add get jbutton add new grid bag constraints j panel add get jbutton done grid bag constraints return j panel
this method initializes j panel
private jbutton get jbutton add if j button add null j button add new jbutton j button add set text add j button add set mnemonic key event vk a j button add add action listener new java awt event action listener public void action performed java awt event action event e if specimen null if j table is editing j table get cell editor stop cell editing determination d new determination d set specimen specimen determinations add determination d return j button add
this method initializes j button
private jtext field get jtext field username if j text field username null j text field username new jtext field 30 return j text field username
this method initializes j text field username
private jbutton get jbutton done if j button done null j button done new jbutton j button done set text done j button done set mnemonic key event vk d j button done add action listener new java awt event action listener public void action performed java awt event action event e make sure changes in field that was modal before button click are saved to the model if j table is editing j table get cell editor stop cell editing set visible false return j button done
this method initializes j button1
private void initialize this set size 415 500 this set title search for specimens this set content pane get jcontent pane this set preferred size new dimension 415 500 this pack
this method initializes this
private jpassword field get jpassword field db if j password field db null j password field db new jpassword field 30 return j password field db
this method initializes j password field db
private jtext field get jtext field driver if j text field driver null j text field driver new jtext field com mysql jdbc driver return j text field driver
this method initializes j text field driver
private jtext field get jtext field connection if j text field connection null j text field connection new jtext field jdbc mysql localhost 3306 lepidoptera return j text field connection
this method initializes j text field connection
private jtext field get jtext field dialect if j text field dialect null j text field dialect new jtext field org hibernate dialect my sqldialect return j text field dialect
this method initializes j text field dialect
public void center specimen image panel specimen center
center the specimen image in the image panel it is shown in
private jbutton get jbutton if j button null j button new jbutton login j button set mnemonic key event vk l j button add action listener new java awt event action listener public void action performed java awt event action event e result login dialog result login get user password hash self set visible false return j button
this method initializes j button
private jpanel get jpanel if j panel null grid bag constraints grid bag constraints17 new grid bag constraints grid bag constraints17 gridx 1 grid bag constraints17 gridy 0 j panel new jpanel j panel set layout new grid bag layout j panel add get jbutton new grid bag constraints j panel add get jbutton1 grid bag constraints17 return j panel
this method initializes j panel
private jbutton get jbutton1 if j button1 null j button1 new jbutton cancel j button1 set mnemonic key event vk c j button1 add action listener new java awt event action listener public void action performed java awt event action event e result login dialog result cancel self set visible false return j button1
this method initializes j button1
private jtext field get jtext field status if j text field status null j text field status new jtext field status j text field status set editable false j text field status set enabled true return j text field status
this method initializes j text field
public string get user password hash string result hash password j password field user return result
obtain sha1 hash of the text in the users password field
private jscroll pane get jscroll pane if j scroll pane null image panel barcode new jlabel image panel barcode set text j scroll pane new jscroll pane j scroll pane set viewport view image panel barcode return j scroll pane
this method initializes j scroll pane
private jtext field get jtext field if j text field drawer number null j text field drawer number new jtext field return j text field drawer number
this method initializes j text field
private image zoom panel get jlabel specimen if image panel specimen null image panel specimen new image zoom panel return image panel specimen
this method initializes j scroll pane
private jtext field get jtext field1 if j text field barcode null j text field barcode new jtext field return j text field barcode
this method initializes j text field1
private jtext field get jtext field2 if j text field family null j text field family new jtext field return j text field family
this method initializes j text field2
private jtext field get jtext field3 if j text field genus null j text field genus new jtext field return j text field genus
this method initializes j text field3
private jtext field get jtext field barcode if j text field barcode null j text field barcode new jtext field 11 j text field barcode set editable false j text field barcode set tool tip text metadata retriever get field help specimen class barcode return j text field barcode
this method initializes j text field barcode
private jpanel get jpanel unit tray taxon if j panel unit tray null j panel unit tray new jpanel j panel unit tray set layout new border layout j panel unit tray set size new dimension 108 72 j panel unit tray add get jtext field border layout south j panel unit tray add get image panel unit tray taxon border layout center return j panel unit tray
this method initializes j panel1
private image zoom panel get image panel unit tray taxon if image panel unit tray taxon null image panel unit tray taxon new image zoom panel return image panel unit tray taxon
this method initializes j scroll pane1
private jtext field get jtext field4 if j text field species null j text field species new jtext field return j text field species
this method initializes j text field4
private jtext field get jtext field email if j text field email null j text field email new jtext field return j text field email
this method initializes j text field email
private jpassword field get jpassword field user if j password field user null j password field user new jpassword field return j password field user
this method initializes j password field user
private jcombo box get jcombo box if j combo box collection null specimen life cycle sls new specimen life cycle j combo box collection new jcombo box sls get distinct collections j combo box collection set editable true return j combo box collection
this method initializes j combo box
private jbutton get jbutton2 if j button2 null j button2 new jbutton j button2 set text advanced j button2 set mnemonic key event vk a j button2 add action listener new java awt event action listener public void action performed java awt event action event e toggle advanced return j button2
this method initializes j button2
private jpanel get jpanel utl if j panel unit tray labels null j panel unit tray labels new jpanel j panel unit tray labels set layout new border layout j panel unit tray labels set size new dimension 108 72 j panel unit tray labels add get image panel tray labels border layout center return j panel unit tray labels
this method initializes j panel utl
private jcombo box get jcombo box1 if j combo box workflow status null array list string values new array list string values add string wfsv work flow status get work flow status values for int x 0 x wfsv length x values add wfsv x j combo box workflow status new jcombo box values to array j combo box workflow status get model set selected item j combo box workflow status set editable true return j combo box workflow status
this method initializes j combo box1
private jtext field get jtext field1 if j text field genus null j text field genus new jtext field j text field genus set input verifier metadata retriever get input verifier specimen class genus j text field genus j text field genus set tool tip text metadata retriever get field help specimen class genus j text field genus add key listener new java awt event key adapter public void key typed java awt event key event e this pane set state to dirty return j text field genus
this method initializes j text field1
private image zoom panel get image panel tray labels if image panel tray labels null image panel tray labels new image zoom panel return image panel tray labels
this method initializes j scroll pane1
private jtext field get jtext field5 if j text field image filename null j text field image filename new jtext field return j text field image filename
this method initializes j text field5
private jtext field get jtext field if j text field raw ocr null j text field raw ocr new jtext field j text field raw ocr set editable false return j text field raw ocr
this method initializes j text field
private jcombo box get jcombo box2 if j combo box path null icimage life cycle ils new icimage life cycle j combo box path new jcombo box ils get distinct paths j combo box path set editable true return j combo box path
this method initializes j combo box2
private jcombo box get jcombo box3 if j combo box entry by null tracking life cycle tls new tracking life cycle j combo box entry by new jcombo box tls get distinct users j combo box entry by set editable true return j combo box entry by
this method initializes j combo box3
private jtext field get jtext field6 if j text field subfamily null j text field subfamily new jtext field return j text field subfamily
this method initializes j text field
private jtext field get jtext field12 if j text field subspecies null j text field subspecies new jtext field return j text field subspecies
this method initializes j text field1
public void add collector collector collector collectors add collector this fire table data changed
add collector adds a collector to this model as a new row
private jpanel get jpanel images panel if j panel images panel null j panel images panel new jpanel j panel images panel set layout new border layout j panel images panel add get jtabbed pane border layout center j panel images panel add get jpanel image picker border layout north return j panel images panel
this method initializes j panel images panel
public void add determination determination a determination determinations add a determination this fire table data changed
add determination adds a determination to this model as a new row
private jbutton get jbutton1 if j button1 null j button1 new jbutton j button1 set text close j button1 set mnemonic key event vk c j button1 add action listener new java awt event action listener public void action performed java awt event action event e set visible false return j button1
this method initializes j button1
public void persist specimen transient instance throws save failed exception log debug persisting specimen instance try session session hibernate util get session factory get current session session begin transaction try session persist transient instance session get transaction commit log debug persist successful track transient instance catch hibernate exception e session get transaction rollback log error persist failed e throw new save failed exception unable to save specimen transient instance get barcode try session close catch session exception e catch runtime exception re log error persist failed re throw re
save a new specimen record and add an entry in the tracking table
public void attach dirty specimen instance throws save failed exception log debug attaching dirty specimen instance try session session hibernate util get session factory get current session session begin transaction try session save or update instance session get transaction commit log debug attach successful track instance catch hibernate exception e session get transaction rollback log error attach failed e throw new save failed exception unable to save specimen instance get barcode try session close catch session exception e catch runtime exception re log error attach failed re throw re
save or update an existing specimen record
public void attach clean specimen instance log debug attaching clean specimen instance try session session hibernate util get session factory get current session session begin transaction try session lock instance lock mode none session get transaction commit log debug attach successful catch hibernate exception e session get transaction rollback log error attach failed e try session close catch session exception e catch runtime exception re log error attach failed re throw re
re associate a transient instance with a session
private jtext field get jtext field12 if j text field species null j text field species new jtext field j text field species set input verifier metadata retriever get input verifier specimen class specific epithet j text field species j text field species set tool tip text metadata retriever get field help specimen class specific epithet j text field species add key listener new java awt event key adapter public void key typed java awt event key event e this pane set state to dirty return j text field species
this method initializes j text field1
public specimen merge specimen detached instance log debug merging specimen instance try session session hibernate util get session factory get current session session begin transaction try specimen result specimen session merge detached instance session get transaction commit log debug merge successful try session close catch session exception e track result return result catch hibernate exception e session get transaction rollback try session close catch session exception e1 log error merge failed e throw e catch runtime exception re log error merge failed re throw re
update db record and log current status of record
private jcombo box get jcombo box4 if j combo box collector null collector life cycle cls new collector life cycle j combo box collector new jcombo box cls get distinct collectors j combo box collector set editable true return j combo box collector
this method initializes j combo box
private jtext field get jtext field7 if j text field verbatim locality null j text field verbatim locality new jtext field return j text field verbatim locality
this method initializes j text field
private jcombo box get jcombo box5 if j combo box country null specimen life cycle sls new specimen life cycle array list string values new array list string values add values add string cv sls get distinct countries for int x 0 x cv length x values add cv x j combo box country new jcombo box values to array j combo box country set editable true return j combo box country
this method initializes j combo box
private jcombo box get jcombo box12 if j combo box questions null specimen life cycle sls new specimen life cycle array list string values new array list string values add values add string qv sls get distinct questions for int x 0 x qv length x values add qv x j combo box questions new jcombo box values to array j combo box questions set editable true return j combo box questions
this method initializes j combo box1
private jtext field get jtext field tribe if j text field tribe null j text field tribe new jtext field return j text field tribe
this method initializes j text field
private jtext field get jtext field primary division if j text field primary division null j text field primary division new jtext field return j text field primary division
this method initializes j text field
private void initialize this set size 1100 900 this set jmenu bar get jjmenu bar this set preferred size new dimension 1400 900 this set content pane get jcontent pane this set title create unit tray labels
this method initializes this
private void initialize this set size new dimension 504 188 this set preferred size new dimension 504 188 this set title details about a person this set content pane get jpanel dimension screen size toolkit get default toolkit get screen size this set location screen size width this get width 2 screen size height this get height 2
this method initializes this setting up the layout of the dialog
private jtext field get jtext field2 if j text field subspecies null j text field subspecies new jtext field j text field subspecies set input verifier metadata retriever get input verifier specimen class subspecific epithet j text field subspecies j text field subspecies set tool tip text metadata retriever get field help specimen class subspecific epithet j text field subspecies add key listener new java awt event key adapter public void key typed java awt event key event e this pane set state to dirty return j text field subspecies
this method initializes j text field2
private jpanel get jpanel if j panel null j panel new jpanel j panel set layout new border layout j panel add get jpanel1 border layout south j panel add get jpanel2 border layout center return j panel
this method initializes j panel
private jpanel get jpanel1 if j panel1 null grid bag constraints grid bag constraints1 new grid bag constraints grid bag constraints1 gridx 1 grid bag constraints grid bag constraints new grid bag constraints grid bag constraints gridx 0 grid bag constraints gridy 0 j panel1 new jpanel j panel1 set layout new grid bag layout j panel1 add get jbutton save grid bag constraints1 j panel1 add get jbutton cancel grid bag constraints return j panel1
this method initializes j panel1
private jtable get jtable if j table null table model new unit tray label table model j table new drag drop jtable table model j table set drag enabled true j table set drop mode drop mode on table model add undoable edit listener new my undoable edit listener sorter new table row sorter unit tray label table model table model j table set row sorter sorter return j table
this method initializes j table
private jbutton get jbutton cancel if j button cancel null j button cancel new jbutton j button cancel set text cancel j button cancel add action listener new java awt event action listener public void action performed java awt event action event e this dialog set visible false return j button cancel
this method initializes j button cancel