input
stringlengths
10
828
output
stringlengths
5
107
public abstract action get action string action command return abstract action actions get action command
return action to the specific action command
public map get actions map return null
returns actions as map interface
public map get actions map return map actions
returns actions as map interface
public void show exam properties if exam properties action listener null exam properties action listener new exam properties action listener if exam properties null exam properties context get guimanager get exam properties exam properties add action listener exam properties action listener set exam properties exam properties show section action buttons false exam properties show application
shows the exam properties
public void set choice comments string ccomments this choice comments ccomments
sets choice comments for the question
public int get choices count if choices null return choices length else return 1
returns the choices count
public jpbfile handler get jpbfile handler if file handler null file handler new jpbfile handler return file handler
returns the file handler object
public void create new exam context get exam templates handler show select exam template
creates new exam
public void open exam jpbexam exam this method simply opens the exam and did not verify the current exam is saved or not context set exam exam context get guimanager exam changed
opens the specified exam
public int get selected index return table get selected row
returns the selected question index
public void add selection listener list selection listener listener table get selection model add list selection listener listener
adds the listener
public void remove selection listener list selection listener listener table get selection model remove list selection listener listener
removes the listener
public void show application context get guimanager build ui context get exam handler show select first action
shows the jpilot builder
public void create actions actions put new exam new new exam actions put save exam new save exam actions put open exam new open exam actions put exit new exit
creates all the actions
public void compile build try context get jpbfile handler compile build org jpilotexam exam context get jpbexam save file catch exception e e print stack trace
compile the build file to jpilotexam file for simulator
public int get max questions return max questions
returns the maximum questions this exam should contain
public void set max questions int max questions this max questions max questions
set the maximum questions this exam should contain
public void store template exam template template throws java io ioexception store template file file new file jpilot builder get instance get jpbcontext get property jpb home tmpls template get exam name tpl java beans xmlencoder e new java beans xmlencoder new java io buffered output stream new java io file output stream file e write object template e close
store exam template
public void set questions question questions vquestions clear can we put array in to vector directly with out using loop for int i 0 i questions length i vquestions add questions i
the overriden method sets the array of questions
public jpquestion get question int index return jpquestion vquestions get index
return the question specified in the index
public void compile build org jpilotexam exam exam java io file save file throws java io ioexception java beans xmlencoder e new java beans xmlencoder new java io buffered output stream new java io file output stream save file get name jpe e write object exam e close
stores the exam for simulator
public int get questions count return vquestions size
the overriden method returns questions count
public void finish if result null finish questions result new jpresult this result calculate result
finishes the exam and calculates the exam result
private void finish questions finish all questions for int i 0 i this get questions count i question this get questions i finish
finishes the questions by evaluating the result
public jpresult get jpresult return result
returns the result of the exam
public void randomize if questions null int len questions length random random new random for int i 0 i len 1 i int x random next int len question question questions i questions i questions i x questions i x question len
randomize the questions
public boolean is finished return result null false true
returns true if the exam is finished otherwise false
private void load test questions html questions new string questions length for int i 0 i questions length i html questions i html qgenerator get test question jpexam exam questions i show status set status 45 i 50 questions length
loads the htmlquestions for simulation
public void clear all tmodel clear all
clears the report table
public int get correct choice return correct choice
returns correct choice for the question
public int get selected choice return selected choice
returns correct choice for the question
public void set correct choice int correct choice this correct choice correct choice
sets correct choice
public void set selected choice int selected choice this selected choice selected choice
sets selected choice
private void set first question current question questions 0 exam panel set question text html questions 0 exam panel set marked false exam panel set question selection text get select comment exam panel set question title rb program strings get string question current question index 1 rb program strings get string of questions length
sets the first question
public int get question type return jpquestion single choice
returns the type of the question
public void finish finish true finish the exam by calculating the reusult of the question if is answered if selected choice correct choice set correct true no need to set false assumed default
finishes the question
public boolean is finished return finish
returns true if the question is finished
public void set case sensitive boolean b this case sensitive b
sets case sensitive
public int get question type return jpquestion fill in the blank
returns the type of the question
public boolean is answered return answer null false true
returns true if the question is answered otherwise false
public void finish finish true finish the exam by calculating the reusult of the question no need of setting correct false it is assumed as default if is answered if is case sensitive for int i 0 i possible answers length i if answer equals possible answers i set correct true break else for int i 0 i possible answers length i if answer equals ignore case possible answers i set correct true break
finishes the question by calculates the result
public void set parent frame jframe frame this parent frame frame
sets the parent frame
public void add htmleditor jtext component component jbutton button string title if component null button null if edit list null edit list new hashtable jbutton jtext component button add action listener listener button set action command title edit list put button component
add the text component to edit with htmleditor by performing action on
public void set htmltext string html text html set text html text text set text html text
sets the initial html text in the editor
public string get htmltext return text get text
returns the html text from the editor
public void add htmleditor action listener htmleditor action listener listener if listener null listeners add element listener
adds the object to listen htmleditor events
public boolean remove htmleditor action listener htmleditor action listener listener return listeners remove listener
remove the htmleditor event listener object from listeneing the events
public jcomponent get tool string action command return jcomponent menu item list get action command
returns the menu item for the action command
public void show editor jframe parent if dialog null dialog new jdialog parent true dialog get content pane set layout new border layout dialog get content pane add this dialog set size width height center the window uiutilities center component on screen dialog set title dialog set visible true
shows the editor with default width and height and centers the editor to
public void add filters file filter filters for int i 0 i filters length i add choosable file filter filters i
convenience method to set a list of
public void remove filters remove filters get choosable file filters
convenience method to remove all choosable
public jcomponent get tool string action command return jcomponent tool items get action command
returns the toolbar item for the action command
public void show editor jdialog parent if dialog null dialog new jdialog parent true dialog get content pane set layout new border layout dialog get content pane add this dialog set size width height set title dialog set visible true
shows the editor with default width and height and centers the editor to
public int get questions answered return questions answered
return answered questions
public int get correct answers return correct answers
returns correct answers count
public float get section percentage int section index return sections percentage section index
returns section percentage for the section index
public void show editor if dialog null dialog new jdialog dialog get content pane set layout new border layout dialog get content pane add this dialog set size width height set title dialog set visible true
shows the editor with default width and height and centers the editor to
public float get percentage gained return percentage gained
returns section percentage for the section index
public void set correct choices boolean cchoices for int i 0 i cchoices length i correct list add element new boolean cchoices i
set the correct choices for mcquestion
public void set correct choices boolean correct choices this correct choices correct choices selected choices new boolean correct choices length for int i 0 i correct choices length i selected choices i false
sets correct choices for the question
public void set title string title this title title set title
sets the title for the editor
public void set selected choices boolean selected choices this selected choices selected choices
sets selected choices for the question
public void set selected choice int choice if selected choices choice selected choices choice false selected choices count else if selected choices count correct choices count throw new illegal argument exception rb program strings get string you can select only correct choices count rb program strings get string choices for this question else selected choices choice true selected choices count
sets correct choice s
public void show editor jframe parent int width int height this width width this height height show editor parent
shows the editor with specified width and height and centers the editor
public void set correct choice int cchoice sc correct choice cchoice
set the correct choice for scquestion
public int get question type return jpquestion multiple choice
returns the type of the question
public string get description return description get extension string get extension
this is the method defined by the model
public void set correct choices count int correct choices count this correct choices count correct choices count
sets correct choices count
public int get correct choices count return correct choices count
returns correct choices count
public boolean is answered return selected choices count correct choices count true false
returns true if the question is answered otherwise false
public jpexam load exam file file throws parser configuration exception saxexception ioexception document builder factory builder factory document builder factory new instance builder factory set ignoring element content whitespace true builder factory set validating true builder factory set coalescing true builder factory set ignoring comments true document builder doc factory doc factory builder factory new document builder default handler default handler new exam loader default handler doc factory set entity resolver default handler doc factory set error handler default handler document doc doc factory parse file exam new jpexam process node doc return exam
creates a new instance of xmlexam loader
public void finish finish true finish the exam by calculating the reusult of the question if is answered boolean pass true for int i 0 i selected choices length i if selected choices i correct choices i pass false break set correct pass
finishes the question
protected jviewport create viewport return new focus view port
ensures that scroll panels have white backgrounds by default
public void button clicked action event e file chooser chooser new file chooser prefs get last path chooser set accept all file filter used accept all file filter if file filters null chooser set filters file filters to array new generic file filter 0 chooser set dialog title rb program strings get string select path chooser show open dialog this file file chooser get selected file if file null set text file to string prefs put last path file get parent
the action that is performed when button has been clicked
protected void after set text
is called after
private void initialize as html int size set content type text html list string rules new array list string rules add body td font family verdana arial helvetica sans serif font size size pt set rules string rules to array new string 0
configure the style sheet
private void set restriction set string restriction set boolean positive list restricted document doc restricted document get document doc set restriction set restriction set positive list doc add document listener this
sets the string containing the characters restriction set in this field
public long get question id return id
returns the question id
public void set problem string problem this problem problem
sets the problem
public void set tool tip text string text super set tool tip text text tool tip manager shared instance register component this
sets the tool tip text and registers with tool tip controller
public string get problem return problem
returns the problem
public string get tool tip text return is enabled super get tool tip text null
returns the tool tip text only when the component is enabled
public void set section int section this section section
sets the section to which the question belongs
public void changed update document event e document changed
invoked when text attributes change
public int get section return section
returns the section to which the question belongs
public void insert update document event e document changed
invoked when text inserted
public void set toughness int toughness this toughness toughness
set toughness of the question
public void remove update document event e document changed
invoked when text removed
public int get toughness return toughness
returns toughness of the question
public void document changed set foreground get colour for get text
handles text changes
public string get name return exam name txt get text
returns the name of the exam
protected color get colour for string text return is text valid text color black color red
returns red for invalid text black otherwise
public void set enabled boolean enabled if enabled set background system color text document changed else set background system color control set foreground system color text inactive text super set enabled enabled
ensures that the background and foreground colour are updated when the text field
public void set exhibit string exhibit this exhibit exhibit
set exhibit of the question
public void set name string name exam name txt set text name
set the name of the exam
public string get exhibit return exhibit
returns exhibit of the question
public void set correct boolean b this correct b
set correct property of the question
public string get title return exam title txt get text
returns the title of the exam
public void insert string int offs string str attribute set a throws bad location exception if str null return char source str to char array char result new char source length int j 0 for int i 0 i result length i if is valid source i offs i result j source i else toolkit get default toolkit beep super insert string offs new string result 0 j a
inserts the given string into the document omitting all
public void set marked boolean b this marked b
set marked property of the question