Class ReplaceCharacters

java.lang.Object
  |
  +--ReplaceCharacters

public class ReplaceCharacters
extends java.lang.Object
implements java.awt.event.ActionListener, UserOptions

This class builts the component which is popped-up when selecting the Replace characters option in the Settings menu. It is possible to use the default set for replacemnts or to built a new one.

See Also:
UserOptions

Field Summary
(package private)  javax.swing.JButton addList
           
(package private)  javax.swing.JLabel change_string
           
(package private)  javax.swing.JButton default_button
           
(package private)  javax.swing.JDialog dialog
           
(package private)  javax.swing.JButton dismiss
           
(package private)  javax.swing.JTextField from_string
           
(package private)  javax.swing.JTextArea list
           
(package private)  javax.swing.JFrame mainframe
           
(package private)  javax.swing.table.DefaultTableModel myModel
          the model for the table which shows the strings to be replaced
(package private)  javax.swing.JButton removeList
           
(package private)  javax.swing.JTable table
          the table
(package private)  javax.swing.JTextField to_string
           
(package private)  UserInterface ui
          referrecnce to the User interface
(package private)  CharactersToBeReplaced userMask
          the user's set of strings to be replaced
(package private)  javax.swing.JButton write_default
           
 
Fields inherited from interface UserOptions
DEFAULTSFILENAME, FREQUENCY_SAVE_TURNS, MAXIMUM_WORDS_STRING, NO_TURNS, REPLACEMASKSIZE, TRANSLATION_SEGMENTS
 
Constructor Summary
(package private) ReplaceCharacters(javax.swing.JFrame mainFrame, UserInterface ui)
          builts all the widgets and add them to the window builts also the objects containing the default mask and the users mask
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          describes actions on the widgets
protected  void fireChange()
          when a change occurs stateChanged is alled on the registered classes
 java.lang.String[][] getData()
           
private  int getSelection(javax.swing.JTable table)
           
 void HideDialog()
          dismiss the window
 void ShowDialog()
          pops-up the window
private  void UpdateTable(java.lang.String[][] s)
          updates the view of the table
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

userMask

CharactersToBeReplaced userMask
the user's set of strings to be replaced

from_string

javax.swing.JTextField from_string

to_string

javax.swing.JTextField to_string

list

javax.swing.JTextArea list

addList

javax.swing.JButton addList

removeList

javax.swing.JButton removeList

default_button

javax.swing.JButton default_button

dismiss

javax.swing.JButton dismiss

write_default

javax.swing.JButton write_default

change_string

javax.swing.JLabel change_string

dialog

javax.swing.JDialog dialog

mainframe

javax.swing.JFrame mainframe

ui

UserInterface ui
referrecnce to the User interface

myModel

javax.swing.table.DefaultTableModel myModel
the model for the table which shows the strings to be replaced

table

javax.swing.JTable table
the table
Constructor Detail

ReplaceCharacters

ReplaceCharacters(javax.swing.JFrame mainFrame,
                  UserInterface ui)
builts all the widgets and add them to the window builts also the objects containing the default mask and the users mask
Parameters:
mainframe - the parent window
ui - referrence to the user interface
Method Detail

getData

public java.lang.String[][] getData()
Returns:
the users's mask

ShowDialog

public void ShowDialog()
pops-up the window

HideDialog

public void HideDialog()
dismiss the window

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
describes actions on the widgets
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
CharactersToBeReplaced.getData(), CharactersToBeReplaced.setData(int), getSelection(JTable)

UpdateTable

private void UpdateTable(java.lang.String[][] s)
updates the view of the table
Parameters:
s - the mask with which the table is updated

getSelection

private int getSelection(javax.swing.JTable table)
Parameters:
table - the table where the selection is done
Returns:
the number of the selected row, if it contains data or -1 otherwise

fireChange

protected void fireChange()
when a change occurs stateChanged is alled on the registered classes
See Also:
UserInterface.changed()