package fi.celia.asciimath;
/**
*
*/
import java.awt.event.KeyEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.Event;
import java.awt.BorderLayout;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.KeyStroke;
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JFrame;
import javax.swing.JDialog;
import java.awt.GridBagLayout;
import java.awt.FlowLayout;
import javax.swing.JTextField;
import java.awt.GridBagConstraints;
import javax.swing.JButton;
import java.awt.Dimension;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import java.nio.charset.CharacterCodingException;
import java.util.*;
import java.util.logging.*;
import java.io.*;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import java.awt.Insets;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.text.Document;
import javax.swing.event.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import fi.celia.convert.chars.GiveRowMessageImpl;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/**
* /**
* <p>
* @author tuomas kassila
*
*/
/**
* @author admin
*
*/
public class GuiDtbook2AsciiMath {
/**
* The same kind of values used in combo component.
* @author admin
*
*/
private static class ComboValue
{
private String m_showValue;
private String m_indexValue;
private int m_index = -1;
public ComboValue(String p_showValue, String p_indexValue, int p_index)
{
m_showValue = p_showValue;
m_indexValue = p_indexValue;
m_index = p_index;
}
public String getShowValue() { return m_showValue; }
public String getIndexValue() { return m_indexValue; }
public int getIndex() { return m_index; }
public String toString()
{
if (m_showValue == null)
return "";
return m_showValue;
}
}
/**
* There may be some unneedef variables after earlier application
*/
/**
* Some default values are by finnish language but will be replaced from int18
* configuration file. there are different .properties file for common
* gui label text and an another for help int18 .properties file.
*/
private String m_strError = null; // @jve:decl-index=0:
/**
* A previous user selected irownumber value:
*/
private int m_iPrev_iRowNumber = -1;
private String m_errorContext = null;
private static String m_cancel = "Keskeytä";
private int m_iFrame_Width = 0;
private boolean bChangeApplicationCheckBoxConvert = false;
private int m_iFrame_Height = 0;
private Double m_frame_location_x = new Double(0);
private Double m_frame_location_y = new Double(0);
private FileInputStream fisUnModiedDtbookJAsciiMathTextArea = null;
private FileInputStream fisUnModiedDtbookConvertTextArea = null;
private boolean m_WarningTextAreaCaretLoopEventConvert = false;
Point m_frame_location = new Point(m_frame_location_x.intValue(),
m_frame_location_y.intValue());
private boolean m_bHideRuleTab = false;
private int m_indTab_Dtbook_AsciiMath_text_muunnos = -1;
private int m_indTab_Dtbook_AsciiMath_xml_muunnos = -1;
private int m_indTab_Dtbook_convert = -1;
private int m_indTab_Muunnoksen_tiivistelma_varoitukset = -1;
private int m_indTab_Muokkaa_merkkeja_html_editori = -1;
private final static String cnst_HideRuleTab = "hideruletab";
private JLabel jTextAreaLabelConvert = null;
private boolean m_ConvertTextAreaCaretLoopEvent = false;
/**
* setting selected area inside caret event handling causes
* loop, a new caret event. And to prevent that to happen
*/
private boolean m_WarningTextAreaCaretLoopEvent = false;
private boolean m_AsciiMathTextAreaCaretLoopEvent = false;
private String m_unchangedFile = "Unhanged file: ";
private String csnt_unchangedFile = "unchangedFile";
private String m_error_Occured = "Virhe sattunut!";
private String csnt_error_Occured = "erroroccured";
/**
* gui-variables and components:
*/
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="3,10"
private JPanel jContentPane = null;
private JMenuBar jJMenuBar = null;
private JMenu fileMenu = null;
private JLabel labelSelectLanguage;
//private JMenu editMenu = null;
private String m_guiLanguage = null; // @jve:decl-index=0:
private int m_iGuiLanguageIndex = 0;
//private ComboValue m_ComboValueGuiLanguage;
private ComboValue [] m_arrComboValueGuiLanguages;
private String [] m_gui_user_languages = null;
private String [] m_gui_user_languages_text = null;
private JMenu helpMenu = null;
private JMenuItem exitMenuItem = null;
private JMenuItem aboutMenuItem = null;
private JMenuItem cutMenuItem = null;
private JMenuItem copyMenuItem = null;
private JMenuItem pasteMenuItem = null;
private JMenuItem languageMenuItem = null;
private JDialog aboutDialog = null; // @jve:decl-index=0:visual-constraint="10,706"
private JPanel aboutContentPane = null;
private JPanel warningContentPane = null;
private JLabel aboutVersionLabel = null;
private JPanel jInputOutPutPanel = null;
private JTextField jDtbookTextField = null;
private JTextField jDtbookTextField2 = null;
private JTextField jDtbookTextFieldConvert = null;
private JTextField selected_jDtbookTextField = null;
private JTextField selected_jDtbookTextFieldConvert = null;
private JTextField jGiveCharacterTextField = null;
private JTextField jChagedCharacterTextField = null;
private JButton jDtBookButton = null;
private JButton jDtBookButton2 = null;
private JButton jDtBookButtonConvert = null;
private JLabel jAsciiMathLabel = null;
private JLabel jMessageLabelUnModiedDtbook = new JLabel();
private JLabel jAsciiMathLabel2 = null;
private JLabel jEmptyML2LabelConvert = null;
private JLabel jInputLabelConvert = null;
private JLabel jEmpty1LabelConvert = null;
private JTextField jAsciiMathTextField = null;
private JTextField jAsciiMathTextField2 = null;
private JTextField jAsciiMathTextFieldConvert = null;
private JButton jAsciiMathButton = null;
private JButton jAsciiMathButton2 = null;
private JButton jAsciiMathButtonConvert = null;
private JScrollPane jAsciiMathScrollPane = null;
private JScrollPane jWarningScrollPane = null;
private JTextArea jAsciiMathTextArea = null;
private JTextArea jConvertTextArea = null;
private JTextArea jSelected_AsciiMathTextArea = jAsciiMathTextArea;
private JTextArea jUnModiedDtbookOfAsciiMathTextArea = null;
private JTextArea jXmlAsciiMathTextArea = null;
private JLabel jMessageLabel = new JLabel();
private JButton jExecuteButton = null;
private JButton jExecuteButton2 = null;
private JButton jExecuteButtonConvert = null;
private JTextArea jHelpTextArea = null; // @jve:decl-index=0:visual-constraint="135,756"
private JLabel jCopyRigthLabel = null;
private JPanel jVersionPanel = null;
private JFileChooser dtbookFileChooser = null;
private JFileChooser dtbookFileChooser2 = null;
private JFileChooser dtbookFileChooserConvert = null;
private JFileChooser modifiedDtbookFileChooser = null;
private JFileChooser modifiedDtbookFileChooser2 = null;
private JFileChooser modifiedDtbookFileChooserConvert = null;
private String m_selected_fileConvert = cnstSelected_file;
private JFileChooser openInApplicationFileChooser = null;
private JFileChooser openInApplicationFileChooser2 = null;
private JFileChooser openInApplicationFileChooserConvert = null;
private JFileChooser propertyFileChooser = null;
private JFileChooser propertyFileChooser2 = null;
private JFileChooser propertyFileChooserConvert = null;
private static String m_strUserHome = null; // @jve:decl-index=0:
private File userHomeFilePropertyFile = null; // @jve:decl-index=0:
private Properties m_userhomeProperties = new Properties(); // @jve:decl-index=0:
private Properties m_asciiMathProperties = new Properties(); // @jve:decl-index=0:
private Properties languageProperties = new Properties(); // @jve:decl-index=0:
private String m_strOpenInApplication = null;
private String m_strOpenInApplication2 = null;
private String m_strOpenInApplicationConvert = null;
private String strErrorMsg = null;
private final static String cnst_lastdtbookfile2 = "lastdtbookfile2";
private final static String cnst_lastdtbookfile = "lastdtbookfile";
private final static String cnst_lastdtbookfileconvert = "lastdtbookfileconvert";
private final static String cnst_lastModifiedDtbookFileconvert = "lasttargetfileconvert";
private final static String cnst_lastModifiedDtbookFile = "lasttargetfile";
private static final String cnst_lastModifiedDtbookFile2 = "lasttargetfile2";
private final static String cnst_Flag_SpaceRule = "spacerule"; // @jve:decl-index=0:
private final static String cnst_Flag_NumberRule = "numberrule"; // @jve:decl-index=0:
private final static String cnst_Flag_ThousandRule = "thousandrule"; // @jve:decl-index=0:
private final static String cnst_Flag_ReplaceRule = "replacerule"; // @jve:decl-index=0:
private final static String cnst_Flag_Language = "gui_default_user_language";
private static final String cnst_cancel = "cancel";
private static final String cnst_fileTypeText = "fileTypeText";
private static final String cnst_typeText = "typeText";
private static String m_typeText = null;
private static final String cnst_filesType = "filesType";
private static String m_fileTypeText = null;
private static String cnst_filesOfTypeText = "filesOfTypeText";
private static String m_filesOfTypeText = null;
private static final String cnst_fileName = "fileName";
private static String m_fileName = null;
private static final String cnst_sizeText = "sizeText";
private static String m_sizeText = null;
private static final String cnst_OpenText = "openText";
private static String m_OpenText = null;
private static final String cnst_open_selected_file = "open_selected_file";
private static String m_open_selected_file = null;
private static final String cnst_ListText = "listText";
private static String m_ListText = null;
private static final String cnst_homeDirLabel = "homeDirLabel";
private static String m_homeDirLabel = null;
private static final String cnst_errorOfCreatingDir = "errorOfCreatingDir";
private static String m_errorOfCreatingDir = null;
private static final String cnst_detaljText = "detaljText";
private static String m_detaljText = null;
private static final String cnst_select_directory = "select_directory";
private static String m_select_directory = null;
private static final String cnst_directory_up ="directory_up";
private static String m_directory_up = null;
private static final String cnst_createNewDir = "createNewDir";
private static String m_createNewDir = null;
private final static String cnst_Flag_gui_user_languages = "gui_user_languages";
private final static String cnst_Flag_gui_user_languages_text = "gui_user_languages_text";
private final static String cnst_Properties_DtbokText = "dtboktext";
private final static String cnstDtbokText = "Dtbook-teksti:";
private String m_strDtbokText = cnstDtbokText;
private final static String cnst_OpenInApplication = "edit_in_application";
private final static String cnst_OpenInApplication2 = "edit_in_application2";
private final static String cnst_OpenInApplication_convert = "edit_in_application_convert";
private final static String cnst_EDITDtbook = "Muokkaa Asciimath-muunnosta";
private final static String cnst_Properties_EDITDtbook = "muokkaa_asciimath_muunnosta";
private final static String cnst_jCheckBoxCheckStrikeErrors_label = "Tarkista asciimath hipsu (`) virheet";
private final static String cnst_Properties_jCheckBoxCheckStrikeErrors_label = "check_strike_errors_label";
private static String m_jCheckBoxCheckStrikeErrors_label = cnst_jCheckBoxCheckStrikeErrors_label;
private final static String cnst_Properties_jCheckBoxCheckStrikeErrors = "check_strike_errors";
private static String m_jCheckBoxCheckStrikeErrors = cnst_jCheckBoxCheckStrikeErrors_label;
private String m_EDITDtbook = cnst_EDITDtbook;
private final static String cnst_Properties_gui_help_file = "gui_help_file";
private String m_gui_help = "\n\n Ohjelma muuntaa AsciiMath DtBook-asiakirjan AsciiMath-tekstiä. \n"
+"\n"
+" Muunnos:\n\n"
+" 1. Anna muunnettava asiakirjanimi polkuineen\n"
+" - joko tekstikenttään tai valitse tiedosto\n"
+" 'Valitse muokattava Dtbook-asiakirja'-painonapista \n"
+"\n"
+" 2. Anna Dtbook-kohde-tiedosston nimi polkuineen\n"
+" - joko tekstikenttään tai valitse tiedosto\n"
+" 'Valitse kohde-tiedosto, jonne talletetaan muunnos'\n"
+" -painonapista \n\n"
+" 3. Paina 'Suorita muunnos'-painonappia\n\n"
+" 4. Suorituksen tulos näytetään tekstikentässä\n"
+" (joka muuten sama kuin tekstitiedostossa, mutta \n"
+" joitakin tyhhjiä rivejä voi olla pois näytettävässä\n"
+" tekstissä)\n"
+"\n"
+" Jos muunnoksessa esiintyy virhe: 'invalid byte...' ja usein kohde-tiedoston koko on samalla usein 0, on usein syynä se, \n"
+" että luettu DtBook-asiakirja sisältää sekamerkkejä. Ts. UTF-8 ja IOS-8859-1 (latin 1) merkkejä sekaisin samassa\n"
+" tiedostossa. Laita silloin ruksi päälle 'DtBook-asiakirjan sekamerkit päälle ja käynnistä muunnos uudelleen.\n"
+"\n"
+" Avaa sovelluksessa:\n"
+"\n"
+" Voit avata muunnetun Dtbook-tekstin haluamassasi ohjelmassa. Ensimmäisellä kerralla painettaessa 'Avaa sovelluksessa'- \n"
+" nappia, kysytään 'Avaa Dtbook-tiedosto sovelluksesa'-ikkunassa sovellusta, jossa haluat juuri muokatun \n"
+" Dtbook-tiedoston avata. Ohjelman valinnan jälkeen avataan kyseinen Dtbook-tiedosto valitussa\n"
+" sovelluksessa. Kun haluat valita jonkin muun sovelluksen, laita ruksi päälle ''-ominaisuuskenttään.\n"
+"\n"
+" Talletut asetukset:\n"
+"\n"
+" Ohjelma tallettaa käyttäjän kotihakemistoon viimeksi käytetyt arvot seuraavista tiedoista: dtbook-tiedosto, \n"
+" kohde-tiedosto, avattava ohjelma, sivunumerot sekä dtbook xml-elementit, jotka eivät ole mukana muunnoksessa\n"
+" DtBook2ascii.properties-tiedostoon.\n"
+"\n"
+" Muut asetukset:\n"
+" Ilmoita dbtbookin rakenteista, jotka eivät ole muunnoksessa huomioitu. Sekä muuten sama kuin yllä, mutta lisäksi \n"
+" ilmotukset tulevat varoituslehdykälle kuten se olisi ML4-tekstiä, sen *joukkoon*!!! \n"
+"\n"
+" Kohdetiedoston kirjoitus merkistö:\n"
+"\n"
+" Voit vaihtaa kohde-tiedoston merkistän, jossa se talletaan valintakentästä.\n"
+"\n"
+" Vaihda ajossa olevan Dtbook:n merkkejä:\n"
+"\n"
+" Voit vaihtaa ajossa olevan Dtbook:n merkkejä haluamiksesi seuraavasti:\n"
+" 1. Valitse Muokka merkkejä html editori-lehdykkä ja toimi tekstin mukaan.\n"
+" Tarkoituksena luoda sellainen muokka merkkejä-asetustiedosto, joka sopii\n"
+" ajettavalle DTBookille. Tämä asetustiedosto koostuu komenttiriveistä (rivi\n"
+" alkaa # merkillä) sekä muutettavamerkki = uusi_arvo arvopaririveistä.\n"
+" Tässä editorissa kirjoitetaan ylimpään tekstikenttään merkki, joka\n"
+" halutaan muuttaa, painetaan varmuuden vuoksi rivinvaihtoa, kopioidaan\n"
+" jommasta kummasta alemmaasta kentästä arvo asetustiedoston riville\n"
+" joko muutettavan merkin paikalle tai korvattavan merkin paikalle, ja\n"
+" vielä lopuksi = merkki välilyöntien kanssa väliin. Ks. lehdykän esimerkkiä.\n"
+"\n";
private static final String csntDtBookAsciiMathUserFileName = "DtBookAsciiMathUser.properties";
private boolean m_bTextAreaChanged = false;
private boolean m_bTextAreaChangedConvert = false;
private JLabel jTextAreaLabel = null;
private JLabel jTextAreaLabel2 = null;
private JLabel jMuuttavamerkkiLabel = null;
private JLabel jEmptyML2Label = null;
private JLabel jEmptyML2Label2 = null;
private JButton jOpenInEditorButton = null;
private JButton jOpenInEditorButton2 = null;
private JButton jOpenInEditorButtonConvert = null;
private JPanel jEditOpenPanel = null;
private JPanel jEditOpenPanel2 = null;
private JPanel jEditOpenPanelConvert = null;
private JButton jEditButton = null;
private JButton jEditButton2 = null;
private JButton jEditButtonConvert = null;
private JCheckBox jChangeApplicationCheckBox = null;
private boolean bChangeApplicationCheckBox = false;
private JCheckBox jChangeApplicationCheckBox2 = null;
private JCheckBox jChangeApplicationCheckBoxConvert = null;
private boolean bChangeApplicationCheckBox2 = false;
private JPanel jEditPanel = null;
private JPanel jEditPanel2 = null;
private static final String cnstAsciiMathProperty = "dtbookasciimathproperties";
private static final String cnstAsciiMathProperty2 = "dtbookasciimathproperties2";
private static final String cnstPropertyConvert = "dtbookpropertiesconvert";
private static final String cnstAsciiMathPropertyFileName = "dtbookasciimath.properties";
private String m_asciimathPropertyFileName = null; // "./" + cnstAsciiMathPropertyFileName; // @jve:decl-index=0:
private String m_asciimathPropertyFileName2 = null;
private String m_PropertyConvert = null;
private static final String cnstLanguagePropertyBaseName = "dtbookasciimath_language";
private String m_languagePropertyFileName = null;
public static final String UTF_8 = "UTF-8";
public static final String UTF_16 = "UTF-16";
public static final String UTF_16BE = "UTF-16BE";
public static final String UTF_16LE = "UTF-16LE";
public static final String ISO_8859_1 = "ISO-8859-1";
public static final String US_ASCII = "US-ASCII"; // @jve:decl-index=0:
private String m_strWriteCharacterSet = UTF_8;
private String m_strWriteCharacterSet2 = UTF_8;
private String m_strWriteCharacterSetConvert = UTF_8;
private JComboBox jWriteCharSetComboBox = null;
private JComboBox jWriteCharSetComboBox2 = null;
private JComboBox jWriteCharSetComboBoxConvert = null;
private JLabel jWriteCharSetLabel = null;
private JLabel jWriteCharSetLabel2 = null;
private JLabel jWriteCharSetLabelConvert = null;
private JPanel jEditPanelConvert = null;
private JCheckBox jMixedCharSetCheckBox = null;
private JCheckBox jMixedCharSetCheckBox2 = null;
private JCheckBox jMixedCharSetCheckBoxConvert = null;
private boolean m_bDtbookContainsMixedCharsets = false;
private boolean m_bDtbookContainsMixedCharsets2 = false;
private boolean m_bDtbookContainsMixedCharsetConvert = false;
private int m_iExecuteResult = 0;
private int m_iExecuteResultConvert = 0;
private StringBuffer m_sbMessage = new StringBuffer (); // @jve:decl-index=0:
private StringBuffer m_sbWarnings = new StringBuffer (); // @jve:decl-index=0:
private JPanel jSettingPanel = null;
private JPanel jSettingPanel2 = null;
private JPanel jSettingPanelConvert = null;
private JTabbedPane jTabbedPane = null;
private JPanel jPanel = null;
//private boolean m_bUnScriptedXmlStructureCheckBox = false;
private boolean m_bUnScriptedXmlMessageCheckBox = false;
private DtBookAsciiMath m_dtBook2asciimath; // @jve:decl-index=0:
private DtBookCharConvert m_DtBookCharConvert;
private String m_xslDtBook2AsciiMathPath = ".";
private JTextArea jWarningTextArea = null;
private static String m_strDtBookAsciiMathPropertyFileName;
private static Logger m_logger;
private JTextArea jCheckStructureDescriptionTextArea = null;
private JTextArea jUnstructuredXmlLabelTextArea = null;
//private JCheckBox jMainHeaderCheckBox = null;
//private JCheckBox jRemoveLFBeforeKKoodiCheckBox = null;
private JTextField jTextFieldAsciiMathPropertyFileName = null;
private JTextField jTextFieldAsciiMathPropertyFileName2 = null;
private JTextField jTextPropertyFileNameConvert = null;
//private JTextField jTextFieldMuokkaaMerkkeja2 = null;
private JButton jButtonRunProperties = null;
private JButton jButtonMuokkaaMerkkeja2 = null;
private JButton jButtonMuokkaaMerkkejaConvert = null;
private JPanel jCharEditorPanel = null;
private JLabel jAnnamerkkiLabel;
private JTextArea jAnnamerkkiOhjeTextArea = null;
private JLabel jEmptyLabel3 = null;
private JTextField jHexaTextField = null;
private JLabel jHexaLabel = null;
private JPanel jInputOutPutPanelXmlAsciiMath = null;
private JPanel jInputOutPutPanelConvert = null;
private JLabel jAsciiMathLabelConvert = null;
private JCheckBox jRuleSpaceCheckBox = null;
private JCheckBox jNumberRuleCheckBox = null;
private JCheckBox jThousandNumberRuleCheckBox = null;
private JCheckBox jReplaceRuleCheckBox = null;
private boolean m_bSpaceRule = false;
private boolean m_bNumberRule = false;
private boolean m_bThousandNumberRule = false;
private boolean m_bReplaceRule = false;
private JPanel jPanelLanguage = null;
private JComboBox jComboBoxLanguage = null;
private JLabel jLabelEmpty4 = null;
private JDialog jDialogLanguage = null; // @jve:decl-index=0:visual-constraint="890,816"
private JPanel jContentPaneDialogLanguage = null;
private JComboBox jComboBoxDialogLanguage = null;
private JLabel jInputLabel = null;
private JLabel jInputLabel2 = null;
private JButton jButtonDialogLanuageClose = null; // @jve:decl-index=0:visual-constraint="899,736"
private Color asciiMathColor = Color.LIGHT_GRAY; // @jve:decl-index=0:
private Color asciiMath2Color = Color.PINK ;
private Color asciiMath2ColorConvert = Color.MAGENTA;
private boolean m_bOnLoadTimeOfApplication = true;
private boolean m_bCorrectStrikeErrors = true;
/**
* Gui label variables:
*/
private final static String cnstanna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan = "Anna toinen Dtbook-tiedosto, jonne muunnos talletaan";
private final static String cnstProperty_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan = "anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan";
private String m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan = cnstanna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan;
private final static String cnstWarningsOrErrors = "Varoituksia, virheitä: ks lehdykkä!";
private final static String cnstProperty_WarningsOrErrors = "WarningsOrErrors";
private String m_WarningsOrErrors = cnstWarningsOrErrors;
private static final String cnstjAnnamerkkiOhjeTextArea = "'Html merkin tai merkkijonon editori. Näyttää syötetyn merkin tai merkkijonon arvon html- tai hexa-koodattuna.\n"
+"Tarvitset tätä silloin, kun lisää esim AsciiMath kaavaan erisuuruusmerkkejä. Alla on kys. malli (1 kommenttirivi, jossa erikoismerkki vaihtuisi merkkijonoksi jos ei ei olisi kommenttirivi ja 1 asetusarvopariä):\n\n"
+"Syötetyssä kentässä: <\n"
+"Muutettava merkki htlm-muodossa: <\n"
+"Sama hexakoodattuna: <\n\n"
+"Syötetyssä kentässä: >\n"
+"Muutettava merkki htlm-muodossa: >\n"
+"Sama hexakoodattuna: >\n";
private static final String cnstProperty_jAnnamerkkiOhjeTextArea = "jAnnamerkkiOhjeTextArea";
private String m_jAnnamerkkiOhjeTextArea = cnstjAnnamerkkiOhjeTextArea;
private static final String cnstAvaa_dtbook_tiedosto_sovelluksessa = " ";
private static final String cnstProperty_avaa_dtbook_tiedosto_sovelluksessa = "avaa_dtbook_tiedosto_sovelluksessa";
private String m_avaa_dtbook_tiedosto_sovelluksessa = cnstAvaa_dtbook_tiedosto_sovelluksessa;
private static final String cnst_changedFile = "Changed file";
private static final String cnstProperty_changedFile = "changedfile";
private String m_changedFile = cnst_changedFile;
private static final String cnst_pagenumber = "SivuNumero";
private static final String cnstProperty_pagenumber = "pagenumber";
private String m_pagenumber = cnst_pagenumber;
private String m_pagenumberConvert = cnst_pagenumber;
private static final String cnst_afterbrowsercall = "Selaimen suorituksen jälkeinen paluukoodi";
private static final String cnstProperty_afterbrowsercall = "pagenumber";
public static String m_afterbrowsercall = cnst_afterbrowsercall;
private static final String cnst_possible_reasons_are = "Mahdollisia syitä";
private static final String cnstProperty_possible_reasons_are = "possible_reasons_are";
public static String m_possible_reasons_are = cnst_possible_reasons_are;
private static final String cnst_browser_exec_problem_reason_2 = "1. If the browser has been allready running before this run: do you have saved generated web page in the time ";
private static final String cnstProperty_browser_exec_problem_reason_2 = "browser_exec_problem_reason_2";
public static String m_browser_exec_problem_reason_2 = cnst_browser_exec_problem_reason_2;
private static final String cnstSelect_1_rule_before_execution = "Valitse vähintään 1 muunnossääntö ennen muunnosta!";
private static final String cnstProperty_Select_1_rule_before_execution = "select_1_rule_before_execution";
private String m_Select_1_rule_before_execution = cnstSelect_1_rule_before_execution;
private static final String cnstRuleIsNotSelected = "Sääntö ei valittuna";
private static final String cnstProperty_RuleIsNotSelected = "ruleisnotselected";
private String m_RuleIsNotSelected = cnstRuleIsNotSelected;
private static final String cnstAnna_muokattava_Dtbook_asiakirja = "Anna muokattava Dtbook-asiakirja";
private static final String cnstProperty_Anna_muokattava_Dtbook_asiakirja = "anna_muokattava_dtbook_asiakirja";
private String m_Anna_muokattava_Dtbook_asiakirja = cnstAnna_muokattava_Dtbook_asiakirja;
private final static String cnst1Valitse_muokattava_Dtbook_asiakirja = "1. Valitse muokattava Dtbook-asiakirja";
private static final String cnstProperty_1Valitse_muokattava_Dtbook_asiakirja = "valitse_muokattava_dtbook_asiakirja";
private String m_1Valitse_muokattava_Dtbook_asiakirja = cnst1Valitse_muokattava_Dtbook_asiakirja;
private static final String cnstSelected_file = "Valittu tiedosto";
private static final String cnstProperty_selected_file = "selected_file";
private String m_selected_file = cnstSelected_file;
private static final String cnstSelected_file2 = "Valittu tiedosto";
private static final String cnstProperty_selected_file2 = "selected_file2";
private String m_selected_file2 = cnstSelected_file2;
private static final String cnsttulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan = "Tulosta asciimath lausekkeet tiivistelmalehdykkaan"; // @jve:decl-index=0:
private static final String cnstProperty_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan = "tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan"; // @jve:decl-index=0:
private String m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan = cnsttulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan; // @jve:decl-index=0:
private static final String cnstconvertCharCodes2WarningsPanel = "Varoituksiin merkkikoodit"; // @jve:decl-index=0:
private static final String cnstProperty_convertCharCodes2WarningsPanel = "convertCharCodes2WarningsPanel"; // @jve:decl-index=0:
private String m_convertCharCodes2WarningsPanel = cnstconvertCharCodes2WarningsPanel; // @jve:decl-index=0:
private static final String cnstConvertContinueWithErrors = "Muunnos virheistä huolimatta"; // @jve:decl-index=0:
private static final String cnstProperty_ConvertContinueWithErrors = "convertcontinuewitherrors"; // @jve:decl-index=0:
private String m_ConvertContinueWithErrors = cnstConvertContinueWithErrors; // @jve:decl-index=0:
private static final String cnstmuunnoksen_varoitukset = "Muunnoksen varoitukset"; // @jve:decl-index=0:
private static final String cnstProperty_muunnoksen_varoitukset = "muunnoksen_varoitukset";
private String m_muunnoksen_varoitukset = cnstmuunnoksen_varoitukset;
private static final String cnst_jAnnamerkkiLabel = "Anna muutettava merkki: (Huom! Paina enteriä merki(e)n jälkeen, jos alimmaiset kentät eivät pysy ajantasalla muunnoksessa)";
private static final String cnstProperty_jAnnamerkkiLabel = "jAnnamerkkiLabel";
private String m_jAnnamerkkiLabel = cnst_jAnnamerkkiLabel;
private static final String cnst2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos = "2. Valitse kohde-tiedosto, jonne talletetaan muunnos";
private static final String cnstProperty_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos = "2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos";
private String m_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos = cnst2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos;
private static final String cnst2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos = "2. Valitse Dtbook-tiedosto, jonne talletetaan muunnos";
private static final String cnstProperty_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos = "2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos";
private String m_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos = cnst2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos;
private static final String cnst4_suorita_asciimath_teksti_muunnos = "4. Suorita AsciiMath teksti-muunnos";
private static final String cnstProperty_4_suorita_asciimath_teksti_muunnos = "4_suorita_asciimath_teksti_muunnos";
private String m_4_suorita_asciimath_teksti_muunnos = cnst4_suorita_asciimath_teksti_muunnos;
private static final String cnst4_suorita_asciimath_xml_muunnos = "4. Suorita AsciiMath Xml-muunnos";
private static final String cnstProperty_4_suorita_asciimath_xml_muunnos = "4_suorita_asciimath_xml_muunnos";
private String m_4_suorita_asciimath_xml_muunnos = cnst4_suorita_asciimath_xml_muunnos;
private static final String cnst4_suorita_asciimath_merkki_muunnos = "4. Suorita merkki-muunnos";
private static final String cnstProperty_4_suorita_asciimath_merkki_muunnos = "4_suorita_merkki_muunnos";
private String m_4_suorita_asciimath_merkki_muunnos = cnst4_suorita_asciimath_merkki_muunnos;
private static final String cnstavaa_sovelluksessa = "Avaa sovelluksessa";
private static final String cnstProperty_avaa_sovelluksessa = "avaa_sovelluksessa";
private String m_avaa_sovelluksessa = cnstavaa_sovelluksessa;
private static final String cnstvalittua_sovellusta = "Valittua sovellusta (";
private static final String cnstProperty_valittua_sovellusta = "valittua_sovellusta";
private String m_valittua_sovellusta = cnstvalittua_sovellusta;
private static final String cnstselected_application = "Valittu sovellus";
private static final String cnstProperty_selected_application = "selected_application";
private String m_selected_application = cnstselected_application;
private static final String cnstvalittua_sovellusta_ei_ole = ") ei ole!";
private static final String cnstProperty_valittua_sovellusta_ei_ole = "valittua_sovellusta_ei_ole";
private String m_valittua_sovellusta_ei_ole = cnstvalittua_sovellusta_ei_ole;
private static final String cnstei_valittu_dtbook_tiedostoa = "Ei valittu DtBook-tiedostoa.";
private static final String cnstProperty_ei_valittu_dtbook_tiedostoa = "ei_valittu_dtbook_tiedostoa";
private String m_ei_valittu_dtbook_tiedostoa = cnstei_valittu_dtbook_tiedostoa;
private static final String cnstajossa = "Ajossa tapahtui virhe (ohjelma:";
private static final String cnstProperty_ajossa = "ajossa_virhe";
private String m_ajossa = cnstajossa;
private static final String cnstAvattu = "Avattu:";
private static final String cnstProperty_Avattu = "avattu";
private String m_Avattu = cnstAvattu;
private static final String cnsttalleta = "Talleta";
private static final String cnstProperty_talleta = "talleta";
private String m_talleta = cnsttalleta;
// TODO: update variable into .properties file:
private static final String cnsttallettu = "Tallettu tiedostoon: ";
private static final String cnstProperty_tallettu = "tallettu";
private JScrollPane jScrollPaneXmlAsciiMath;
private JScrollPane jScrollPaneConvert = null;
private JPanel jPanelJInputOutPutPanelXmlAsciiMathTab;
private JPanel jPanelJInputOutPutPanelConvertTab;
private JPanel jPanelCharEditorPanel;
private JPanel jPanelXmlAsciiMath;
private JPanel jPanelRuleTab;
private JScrollPane jScrollUnModiedDtbook;
private JLabel jLabelPageNumber;
private JLabel jLabelPageNumberConvert;
private JPanel jPanel1;
private JCheckBox jCheckBoxCorrectStrikeErrors;
private JCheckBox jCheckBoxCorrectStrikeErrors2;
private JPanel jPanelInputDoc;
private JCheckBox jCheckBoxCheckStrikeErrors;
private JCheckBox jCheckBoxCheckStrikeErrors2;
private JCheckBox jCheckBoxPrintXmlAsciiStatements;
private String m_tallettu = cnsttallettu;
private static final String cnstPropertyFileIsMissing = "Asetustiedosto puuttuu. Täytä se ennen suoritusta.";
private static final String cnstProperty_PropertyFileIsMissing = "propertyFileIsMissing";
private String m_PropertyFileIsMissing = cnstPropertyFileIsMissing;
private static final String cnstvaihda_avaa_sovellus_toiseksi = "Vaihda 'Avaa sovellus' toiseksi";
private static final String cnstProperty_vaihda_avaa_sovellus_toiseksi = "vaihda_avaa_sovellus_toiseksi";
private String m_vaihda_avaa_sovellus_toiseksi = cnstvaihda_avaa_sovellus_toiseksi;
private static final String cnstml4_kirjoitus_merkisto = "Kirjoitus merkistö: ";
private static final String cnstProperty_ml4_kirjoitus_merkisto = "ml4_kirjoitus_merkisto";
private String m_ml4_kirjoitus_merkisto = cnstml4_kirjoitus_merkisto;
private static final String cnstdtbook_kirjoitus_merkisto = "Kirjoitus merkistö";
private static final String cnstProperty_dtbook_kirjoitus_merkisto = "dtbook_kirjoitus_merkisto";
private String m_dtbook_kirjoitus_merkisto = cnstdtbook_kirjoitus_merkisto;
private static final String cnstsekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = "Sekamerkejä UTF-8 sekä ISO-8859-1 (ns latin1)";
private static final String cnstProperty_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = "sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1";
private String m_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = cnstsekamerkeja_utf_8_seka_iso_8859_1_ns_latin1;
private static final String cnstdtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = "Dtbook-asiakirja sisältää sekamerkejä UTF-8 sekä ISO-8859-1 (ns latin1)";
private static final String cnstProperty_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = "dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1";
private String m_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = cnstdtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1;
private static final String cnst3_valitse_asetustiedosto_valinnainen = "3. Valitse asetustiedosto (valinnainen)";
private static final String cnstProperty_3_valitse_asetustiedosto_valinnainen = "3_valitse_asetustiedosto_valinnainen";
private String m_3_valitse_asetustiedosto_valinnainen = cnst3_valitse_asetustiedosto_valinnainen;
private static final String cnst3_valitse_muokkaa_merkkeja_tiedosto_valinnainen = "3. Valitse asetustiedosto (valinnainen)";
private static final String cnstProperty_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen = "3_valitse_muokkaa_merkkeja_tiedosto_valinnainen";
private String m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen = cnst3_valitse_muokkaa_merkkeja_tiedosto_valinnainen;
private static final String cnstsama_hexa_arvona = "Sama hexa-arvona:";
private static final String cnstProperty_sama_hexa_arvona = "sama_hexa_arvona";
private String m_sama_hexa_arvona = cnstsama_hexa_arvona;
private static final String cnstmuutettava_merkki_koodattuna_html_muotoon = "Muutettava merkki koodattuna html-muotoon:"; // @jve:decl-index=0:
private static final String cnstProperty_muutettava_merkki_koodattuna_html_muotoon = "muutettava_merkki_koodattuna_html_muotoon";
private String m_muutettava_merkki_koodattuna_html_muotoon = cnstmuutettava_merkki_koodattuna_html_muotoon;
private static final String cnstSelect_file ="Valitse tiedosto";
private static final String cnstProperty_Select_file = "select_file";
private String m_select_file = cnstSelect_file;
private static final String cnstSelect_save_file ="Valitse tallennettava Dtbook-tiedosto";
private static final String cnstProperty_Select_save_file = "select_save_file";
private String m_select_save_file = cnstSelect_save_file;
private static final String cnstSelect_save_file2 ="Valitse tallennettava Dtbook-tiedosto";
private static final String cnstProperty_Select_save_file2 = "select_save_file2";
private String m_select_save_file2 = cnstSelect_save_file2;
/*
private final String cnstanna_tiedosto_jonne_muunnos_talletaan = "Anna tiedosto, jonne muunnos talletaan";
private final String cnstProperty_anna_tiedosto_jonne_muunnos_talletaan = "anna_tiedosto_jonne_muunnos_talletaan";
private String m_anna_tiedosto_jonne_muunnos_talletaan = cnstanna_tiedosto_jonne_muunnos_talletaan;
*/
private static final String cnstDesimaalisaanto = "Desimaalisääntö";
private static final String cnstProperty_Desimaalisaanto = "desimaalisaanto";
private String m_Desimaalisaanto = cnstDesimaalisaanto;
private static final String cnsttuhannetsaanto = "Tuhannetsääntö";
private static final String cnstProperty_tuhannetsaanto = "tuhannetsaanto";
private String m_tuhannetsaanto = cnsttuhannetsaanto;
private static final String cnstvalilyontisaanto = "Välilyöntisääntö";
private static final String cnstProperty_valilyontisaanto = "valilyontisaanto";
private String m_valilyontisaanto = cnstvalilyontisaanto;
private static final String cnstkorvaasaanto = "Korvaasääntö";
private static final String cnstProperty_korvaasaanto = "korvaasaanto";
private String m_korvaasaanto = cnstkorvaasaanto;
private static final String cnstkayttoliitymakielen_valinta = "Käyttöliitymäkielen valinta";
private static final String cnstProperty_kayttoliitymakielen_valinta = "kayttoliitymakielen_valinta";
private String m_kayttoliitymakielen_valinta = cnstkayttoliitymakielen_valinta;
private static final String cnsttiedosto = "Tiedosto";
private static final String cnstProperty_tiedosto = "tiedosto";
private String m_tiedosto = cnsttiedosto;
private static final String cnstapua = "Apua";
private static final String cnstProperty_apua = "apua";
private String m_apua = cnstapua;
private static final String cnstpoistu_ohjelmasta = "Poistu ohjelmasta";
private static final String cnstProperty_poistu_ohjelmasta = "poistu_ohjelmasta";
private String m_poistu_ohjelmasta = cnstpoistu_ohjelmasta;
private static final String cnstohjelmasta_ja_sen_kaytasta = "Ohjelmasta ja sen käytästä...";
private static final String cnstProperty_ohjelmasta_ja_sen_kaytasta = "ohjelmasta_ja_sen_kaytasta";
private String m_ohjelmasta_ja_sen_kaytasta = cnstohjelmasta_ja_sen_kaytasta;
private static final String cnstOhjelmasta = "Ohjelmasta";
private static final String cnstProperty_Ohjelmasta = "ohjelmasta";
private String m_Ohjelmasta = cnstOhjelmasta;
private static final String cnstvalitse_kayttoliityma_kieli = "Valitse käyttöliitymä kieli"; // @jve:decl-index=0:
private static final String cnstProperty_valitse_kayttoliityma_kieli = "valitse_kayttoliityma_kieli";
private String m_valitse_kayttoliityma_kieli = cnstvalitse_kayttoliityma_kieli;
private static final String cnstMuunnoksen_tiivistelma_varoitukset = "Ajon tiivistelmä / varoitukset";
private static final String cnstProperty_Muunnoksen_tiivistelma_varoitukset = "muunnoksen_tiivistelma_varoitukset";
private String m_Muunnoksen_tiivistelma_varoitukset = cnstMuunnoksen_tiivistelma_varoitukset;
private JCheckBox jCheckContinueWithErrors;
private JPanel jPanelConvertExecution;
private JCheckBox jCheckBoxPrintConvertWarnings;
private JPanel jPanelConvert;
private static final String cnstMuokkaa_merkkeja_html_editori = "html merkkieditori";
private static final String cnstProperty_Muokkaa_merkkeja_html_editori = "muokkaa_merkkeja_html_editori";
private String m_Muokkaa_merkkeja_html_editori = cnstMuokkaa_merkkeja_html_editori;
/*
private final String cnstDtbook_AsciiMath_text_muunnos = "Muunnoksen tiivistelmä / varoitukset";
private final String cnstProperty_Dtbook_AsciiMath_text_muunnos = "dtbook_asciimath_text_muunnos";
private String m_Dtbook_AsciiMath_text_muunnos = cnstDtbook_AsciiMath_text_muunnos;
*/
private static final String cnstDtbook_AsciiMath_text_muunnos = "Dtbook AsciiMath text -muunnos";
private static final String cnstProperty_Dtbook_AsciiMath_text_muunnos = "dtbook_asciimath_text_muunnos";
private String m_Dtbook_AsciiMath_text_muunnos = cnstDtbook_AsciiMath_text_muunnos;
private static final String cnstDtbook_AsciiMath_xml_muunnos = "AsciiMath Xml -muunnos";
private static final String cnstProperty_Dtbook_AsciiMath_xml_muunnos = "dtbook_asciimath_xml_muunnos";
private String m_Dtbook_AsciiMath_xml_muunnos = cnstDtbook_AsciiMath_xml_muunnos;
private static final String cnstDtbook_convert = "Merkkimuunnos";
private static final String cnstPropertyDtbook_convert = "dtbook_merkki_muunnos";
private String m_Dtbook_convert = cnstDtbook_convert;
private static final String cnstajetaan_sekamerkista_muunnosta = "Ajetaan sekamerkistö-muunnosta....";
private static final String cnstProperty_ajetaan_sekamerkista_muunnosta = "ajetaan_sekamerkista_muunnosta";
private String m_ajetaan_sekamerkista_muunnosta = cnstajetaan_sekamerkista_muunnosta;
private static final String cnstajetaan_muunnosta = "Ajetaan muunnosta....";
private static final String cnstProperty_ajetaan_muunnosta = "ajetaan_muunnosta";
private String m_ajetaan_muunnosta = cnstajetaan_muunnosta;
private static final String cnstExecutionStarted = "Muunnos käynnistetty:";
private static final String cnstProperty_executionStarted = "executionstarted";
private String m_executionStarted = cnstExecutionStarted;
private static final String cnstTarget = "Kohde:";
private static final String cnstProperty_target = "target";
private String m_target = cnstTarget;
private static final String cnstCharactersetConversionText = "Suoritetaan ensin merkistän muunnos siltä varalta, " + "dtbook-asiakirja sisältää merkkejä eri merkistäistä (utf-8:sta sekä iso-8859-1:stä\n";
;
private static final String cnstProperty_charactersetConversionText = "charactersetconversiontext";
private String m_charactersetConversionText = cnstCharactersetConversionText;
private static final String cnstSelect_dtbookFileName = "Valitse Dtbook tiedosto";
private static final String cnstProperty_Select_dtbookFileName = "select_dtbookfilename";
private String m_select_dtbookFileName = cnstSelect_dtbookFileName;
private static final String cnstanna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty = "Valitse DtBook-tiedosto";
private static final String cnstProperty_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty = "anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty";
private String m_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty = cnstanna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty;
private static final String cnst_file_is_directory = "Antamasi dtbook-tiedosto on hakemisto! Ajo keskeytetty.";
private static final String cnstProperty_file_is_directory = "file_is_directory";
private String m_file_is_directory = cnst_file_is_directory;
private static final String cnst_inchanging = "Muunnos käynnissä";
private static final String cnstProperty_inchanging = "inchanging";
private String m_inchanging = cnst_inchanging;
private static final String cnst_runexecutedbutwarnings = "Ajo valmis, mutta varoituksia 'Muunnoksen varoituksia lehdykässä (ks. myäs Muunnoksen asetukset-lehdykkä, rakenteen käsittelemätt. tarkistus)!";
private static final String cnstProperty_runexecutedbutwarnings = "runexecutedbutwarnings";
private String m_runexecutedbutwarnings = cnst_runexecutedbutwarnings;
private static final String cnst_correctedFile = "Korjattu tiedosto: ";
private static final String cnstProperty_correctedFile = "correctedfile";
private String m_correctedFile = cnst_correctedFile;
private static final String cnst_correctStrikeErrors = "Korjaa hipsuvirheet";
private static final String cnstProperty_correctStrikeErrors = "correcterrors";
private String m_correctStrikeErrors = cnst_correctStrikeErrors;
private static final String cnst_dtbook_did_not_exists = "Antamaasi dtbook-tiedostoa ei ole!.\n Ajo keskeytetty.";
private static final String cnstProperty_dtbook_did_not_exists = "dtbook_did_not_exists";
private String m_dtbook_did_not_exists = cnst_dtbook_did_not_exists;
private static final String cnst_missing_cfg_file_field = "'Aseta asetustiedosto-tiedosto'-kenttä on tyhjä.\n Ajo keskeytetty.";
private static final String cnstProperty_missing_cfg_file_field = "missing_cfg_file_field";
private String m_missing_cfg_file_field = cnst_missing_cfg_file_field;
private static final String cnst_dtbook_document = "DtBook-asiakirjaa";
private static final String cnstProperty_dtbook_document = "dtbook_document";
private String m_dtbook_document = cnst_dtbook_document;
private static final String cnst_no_existence_canceled = " ei ole!.\n Ajo keskeytetty.";
private static final String cnstProperty_no_existence_canceled = "no_existence_canceled";
private String m_no_existence_canceled = cnst_no_existence_canceled;
private static final String cnstantamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty = "Antamasi dtbook-tiedosto on hakemisto!.\n Ajo keskeytetty.";
private static final String cnstProperty_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty = "antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty";
private String m_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty = cnstantamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty;
private static final String cnstantamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty = "Antamaasi dtbook-tiedostoa ei ole!.\n Ajo keskeytetty.";
private static final String cnstProperty_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty = "antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty";
private String m_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty = cnstantamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty;
private String m_output = "Output";
private static final String cnst_output = "output";
private static final String cnstanna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty = "'Anna kohde-tiedosto'-kenttä on tyhjä.\n Ajo keskeytetty.";
private static final String cnstProperty_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty = "anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty";
private String m_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty = cnstanna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty;
private static final String cnstmuunnos_kaynnissa = "Muunnos käynnissä...";
private static final String cnstProperty_muunnos_kaynnissa = "muunnos_kaynnissa";
private String m_muunnos_kaynnissa = cnstmuunnos_kaynnissa;
private static final String cnstajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus = "Ajo valmis, mutta varoituksia 'Muunnoksen varoituksia lehdykässä (ks. myäs Muunnoksen asetukset-lehdykkä, rakenteen käsittelemätt. tarkistus)!";
private static final String cnstProperty_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus = "ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus";
private String m_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus = cnstajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus;
private static final String cnstajo_valmis = "Ajo valmis.";
private static final String cnstProperty_ajo_valmis = "ajo_valmis";
private String m_ajo_valmis = cnstajo_valmis;
private static final String cnstajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa = "Ajon aikainen virhe! Ks. yllä olevaa tekstikenttää!";
private static final String cnstProperty_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa = "ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa";
private String m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa = cnstajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa;
private static final String cnstvalittua_dtbook_tiedostoa = "Valittua DtBook-tiedostoa (";
private static final String cnstProperty_valittua_dtbook_tiedostoa = "valittua_dtbook_tiedostoa";
private String m_valittua_dtbook_tiedostoa = cnstvalittua_dtbook_tiedostoa;
private static final String cnstei_valittu_ml4_tiedostoa = "Ei valittu tiedostoa.";
private static final String cnstProperty_ei_valittu_ml4_tiedostoa = "ei_valittu_ml4_tiedostoa";
private String m_ei_valittu_ml4_tiedostoa = cnstei_valittu_ml4_tiedostoa;
private static final String cnstSelected_file_is_new = "Valittu tiedosto on uusi tiedosto:";
private static final String cnstProperty_selected_file_is_new = "selected_file_is_new";
private String m_selected_file_is_new = cnstSelected_file_is_new;
private static final String cnstei_valittu_muokkaa_riveja_tiedostoa = "Ei valittu asetustiedostoa.";
private static final String cnstProperty_ei_valittu_muokkaa_riveja_tiedostoa = "ei_valittu_muokkaa_riveja_tiedostoa";
private String m_ei_valittu_muokkaa_riveja_tiedostoa = cnstei_valittu_muokkaa_riveja_tiedostoa;
private static final String cnstSelected_configfile_dosnot_exist = "Valittua asetustiedostoa ei ole:";
private static final String cnstProperty_selected_configfile_dosnot_exist = "selected_configfile_dosnot_exist";
private String m_selected_configfile_dosnot_exist = cnstSelected_configfile_dosnot_exist;
private static final String cnstSelect_config_file = "Valitse asetustiedosto";
private static final String cnstProperty_select_config_file = "select_config_file";
private String m_select_config_file = cnstSelect_config_file;
private static final String cnstSelect_config_file2 = "Valitse asetustiedosto";
private static final String cnstProperty_select_config_file2 = "select_config_file2";
private String m_select_config_file2 = cnstSelect_config_file2;
private String m_select_config_fileConvert = m_select_config_file2;
// ss
private ResourceBundle resourcebundle;
private Locale currentLocale;
private JCheckBox jCheckBoxWarnings = null;
private JCheckBox jCheckBoxPrintAsciMaths = null;
enum WARNINGS_DATA_TYPE
{ ASCIIMATHRULE_IN_WARNINGS, ASCIIMATHXMLWARNINGS_IN_WARNINGS, CHARCONVERSIONWARNINGS_IN_WARNINGS }
private WARNINGS_DATA_TYPE m_WARNINGS_DATA_TYPE = null;
/**
* This method initializes jInputOutPutPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJInputOutPutPanel() {
if (jInputOutPutPanel == null) {
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.gridx = 0;
gridBagConstraints71.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 1;
jLabelEmpty4 = new JLabel();
jLabelEmpty4.setText(" ");
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.gridx = 0;
gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints6.gridy = 0;
GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
gridBagConstraints22.gridx = 0;
gridBagConstraints22.fill = GridBagConstraints.BOTH;
gridBagConstraints22.gridheight = 1;
gridBagConstraints22.gridy = 9;
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.BOTH;
gridBagConstraints15.gridy = 12;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridx = 0;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.gridy = 2;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.weighty = 1.0;
gridBagConstraints13.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.anchor = GridBagConstraints.WEST;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 14;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.gridx = 0;
gridBagConstraints31.anchor = GridBagConstraints.WEST;
gridBagConstraints31.gridy = 8;
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.gridx = 0;
gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints14.gridy = 16;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.gridx = 0;
gridBagConstraints41.gridy = 19;
GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
gridBagConstraints23.gridx = 0;
gridBagConstraints23.anchor = GridBagConstraints.WEST;
gridBagConstraints23.fill = GridBagConstraints.NONE;
gridBagConstraints23.gridy = 20;
jEmptyML2Label = new JLabel();
jEmptyML2Label.setText(" ");
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.gridx = 0;
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.fill = GridBagConstraints.NONE;
gridBagConstraints12.gridy = 23;
jTextAreaLabel = new JLabel();
jTextAreaLabel.setText(m_strDtbokText);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.gridy = 3;
JLabel jEmpty1Label2 = new JLabel();
jEmpty1Label2.setText(" ");
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.gridy = 9;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.BOTH;
gridBagConstraints3.gridy = 8;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.gridx = 0;
gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = GridBagConstraints.WEST;
gridBagConstraints21.gridy = 7;
jAsciiMathLabel = new JLabel();
//jAsciiMathLabel.setText("Anna toinen Dtbook-tiedosto, jonne muunnos talletaan");
jAsciiMathLabel.setText(m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 5;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.gridy = 2;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.gridy = 3;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridx = 0;
jInputOutPutPanel = new JPanel();
GridBagLayout gblayout = new GridBagLayout();
jInputOutPutPanel.setLayout(gblayout);
//JLabel jInputLabel = new JLabel("Anna muokattava Dtbook-asiakirja");
jInputLabel = new JLabel(m_Anna_muokattava_Dtbook_asiakirja);
jInputOutPutPanel.add(jInputLabel, gridBagConstraints1);
jInputOutPutPanel.add(getJDtbookTextField(), gridBagConstraints);
jInputOutPutPanel.add(getJDtBookButton(), gridBagConstraints2);
jInputOutPutPanel.add(jAsciiMathLabel, gridBagConstraints21);
jInputOutPutPanel.add(getJAsciiMathTextField(), gridBagConstraints3);
jInputOutPutPanel.add(getAsciiMathButton(), gridBagConstraints4);
jInputOutPutPanel.add(jTextAreaLabel, gridBagConstraints12);
jInputOutPutPanel.add(getJEditOpenPanel(), gridBagConstraints41);
jInputOutPutPanel.add(getJEditPanel(), gridBagConstraints14);
jInputOutPutPanel.add(getJSettingPanel(), gridBagConstraints11);
jInputOutPutPanel.add(getJTextFieldMuokkaaMerkkeja(), gridBagConstraints15);
jInputOutPutPanel.add(getJPanelLanguage(), gridBagConstraints6);
jInputOutPutPanel.add(jLabelEmpty4, gridBagConstraints71);
//jInputOutPutPanel.add(getJScrollPane1(), new GridBagConstraints(0, 29, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jInputOutPutPanel.setBackground(asciiMathColor);
}
return jInputOutPutPanel;
}
/**
* This method initializes jInputOutPutPanelXmlAsciiMath
*
* @return javax.swing.JPanel
*/
private JPanel getJInputOutPutPanelXmlAsciiMath() {
if (jInputOutPutPanelXmlAsciiMath == null) {
GridBagConstraints gridBagConstraints221 = new GridBagConstraints();
gridBagConstraints221.gridx = 0;
gridBagConstraints221.fill = GridBagConstraints.BOTH;
gridBagConstraints221.gridheight = 1;
gridBagConstraints221.gridy = 9;
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.BOTH;
gridBagConstraints15.gridy = 10;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridx = 0;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.BOTH;
gridBagConstraints13.gridy = 2;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.weighty = 1.0;
gridBagConstraints13.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.anchor = GridBagConstraints.WEST;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 12;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.gridx = 0;
gridBagConstraints31.anchor = GridBagConstraints.WEST;
gridBagConstraints31.gridy = 8;
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.gridx = 0;
gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints14.gridy = 14;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.gridx = 0;
gridBagConstraints41.gridy = 17;
GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
gridBagConstraints23.gridx = 0;
gridBagConstraints23.anchor = GridBagConstraints.WEST;
gridBagConstraints23.fill = GridBagConstraints.NONE;
gridBagConstraints23.gridy = 20;
jEmptyML2Label2 = new JLabel();
jEmptyML2Label2.setText(" ");
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.gridx = 0;
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.fill = GridBagConstraints.NONE;
gridBagConstraints12.gridy = 21;
jTextAreaLabel2 = new JLabel();
jTextAreaLabel2.setText(m_strDtbokText);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.gridy = 3;
JLabel jEmpty1Label2 = new JLabel();
jEmpty1Label2.setText(" ");
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.gridy = 7;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.BOTH;
gridBagConstraints3.gridy = 6;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.gridx = 0;
gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = GridBagConstraints.WEST;
gridBagConstraints21.gridy = 5;
jAsciiMathLabel2 = new JLabel();
jAsciiMathLabel2.setText(m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 3;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.gridy = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridx = 0;
jInputOutPutPanelXmlAsciiMath = new JPanel();
jInputOutPutPanelXmlAsciiMath.setBackground(asciiMath2Color);
GridBagLayout gblayout = new GridBagLayout();
jInputOutPutPanelXmlAsciiMath.setLayout(gblayout);
//JLabel jInputLabel2 = new JLabel("Anna muokattava Dtbook-asiakirja");
jInputLabel2 = new JLabel(m_Anna_muokattava_Dtbook_asiakirja);
jInputOutPutPanelXmlAsciiMath.add(jInputLabel2, gridBagConstraints1);
jInputOutPutPanelXmlAsciiMath.add(getJDtbookTextField2(), gridBagConstraints);
jInputOutPutPanelXmlAsciiMath.add(getJDtBookButton2(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jInputOutPutPanelXmlAsciiMath.add(jAsciiMathLabel2, gridBagConstraints21);
jInputOutPutPanelXmlAsciiMath.add(getJAsciiMathTextField2(), gridBagConstraints3);
jInputOutPutPanelXmlAsciiMath.add(getJAsciiMathButton2(), gridBagConstraints4);
jInputOutPutPanelXmlAsciiMath.add(jTextAreaLabel2, gridBagConstraints12);
jInputOutPutPanelXmlAsciiMath.add(jEmptyML2Label2, gridBagConstraints23);
jInputOutPutPanelXmlAsciiMath.add(getJEditOpenPanel2(), gridBagConstraints41);
jInputOutPutPanelXmlAsciiMath.add(getJEditPanel2(), gridBagConstraints14);
jInputOutPutPanelXmlAsciiMath.add(getJSettingPanel2(), gridBagConstraints11);
jInputOutPutPanelXmlAsciiMath.add(getJTextFieldMuokkaaMerkkeja2(), gridBagConstraints15);
JPanel jp = getJPanelInputDoc();
jp.add(getJCheckBoxPrintXmlAsciiStatements());
jp.add(getJCheckBoxCheckStrikeErrors2());
jp.add(getJCheckBoxCorrectStrikeErrors());
jInputOutPutPanelXmlAsciiMath.add(jp, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
return jInputOutPutPanelXmlAsciiMath;
}
/**
* This method initializes jInputOutPutPanelXmlAsciiMath
*
* @return javax.swing.JPanel
*/
private JPanel getJInputOutPutPanelConvert() {
if (jInputOutPutPanelConvert == null) {
GridBagConstraints gridBagConstraints221 = new GridBagConstraints();
gridBagConstraints221.gridx = 0;
gridBagConstraints221.fill = GridBagConstraints.BOTH;
gridBagConstraints221.gridheight = 1;
gridBagConstraints221.gridy = 9;
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.BOTH;
gridBagConstraints15.gridy = 10;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridx = 0;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.BOTH;
gridBagConstraints13.gridy = 2;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.weighty = 1.0;
gridBagConstraints13.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.anchor = GridBagConstraints.WEST;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 12;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.gridx = 0;
gridBagConstraints31.anchor = GridBagConstraints.WEST;
gridBagConstraints31.gridy = 8;
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.gridx = 0;
gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints14.gridy = 14;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.gridx = 0;
gridBagConstraints41.gridy = 17;
GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
gridBagConstraints23.gridx = 0;
gridBagConstraints23.anchor = GridBagConstraints.WEST;
gridBagConstraints23.fill = GridBagConstraints.NONE;
gridBagConstraints23.gridy = 20;
jEmptyML2LabelConvert = new JLabel();
jEmptyML2LabelConvert.setText(" ");
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.gridx = 0;
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.fill = GridBagConstraints.NONE;
gridBagConstraints12.gridy = 21;
jTextAreaLabelConvert = new JLabel();
jTextAreaLabelConvert.setText(m_strDtbokText);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.gridy = 3;
jEmpty1LabelConvert = new JLabel();
jEmpty1LabelConvert.setText(" ");
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.gridy = 7;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.BOTH;
gridBagConstraints3.gridy = 6;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.gridx = 0;
gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = GridBagConstraints.WEST;
gridBagConstraints21.gridy = 5;
jAsciiMathLabelConvert = new JLabel();
jAsciiMathLabelConvert.setText(m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 3;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.gridy = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridx = 0;
jInputOutPutPanelConvert = new JPanel();
jInputOutPutPanelConvert.setBackground(asciiMath2ColorConvert);
GridBagLayout gblayout = new GridBagLayout();
jInputOutPutPanelConvert.setLayout(gblayout);
//JLabel jInputLabel2 = new JLabel("Anna muokattava Dtbook-asiakirja");
jInputLabelConvert = new JLabel(m_Anna_muokattava_Dtbook_asiakirja);
jInputOutPutPanelConvert.add(jInputLabelConvert, gridBagConstraints1);
jInputOutPutPanelConvert.add(getJDtbookTextFieldConvert(), gridBagConstraints);
jInputOutPutPanelConvert.add(getJDtBookButtonConvert(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jInputOutPutPanelConvert.add(jAsciiMathLabelConvert, gridBagConstraints21);
jInputOutPutPanelConvert.add(getJAsciiMathTextFieldConvert(), gridBagConstraints3);
jInputOutPutPanelConvert.add(getJAsciiMathButtonConvert(), gridBagConstraints4);
jInputOutPutPanelConvert.add(jTextAreaLabelConvert, gridBagConstraints12);
jInputOutPutPanelConvert.add(jEmptyML2LabelConvert, gridBagConstraints23);
jInputOutPutPanelConvert.add(getJEditOpenPanelConvert(), gridBagConstraints41);
jInputOutPutPanelConvert.add(getJEditPanelConvert(), gridBagConstraints14);
jInputOutPutPanelConvert.add(getJSettingPanelConvert(), gridBagConstraints11);
jInputOutPutPanelConvert.add(getJTextFieldMuokkaaMerkkejaConvert(), gridBagConstraints15);
// jInputOutPutPanelConvert.add(getJPanelConvertExecution(), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
JPanel jp = getJPanelInputDoc();
// TODO: jp.add(getJCheckBoxPrintConvertStatements());
// TODO: jp.add(getJCheckBoxCheckStrikeErrorsConvert());
// TODO: jp.add(getJCheckBoxCorrectStrikeErrors());
//jInputOutPutPanelConvert.add(jp, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
return jInputOutPutPanelConvert;
}
/**
* This method sets assiimath .properties file name, called in the main-method.
*
* @param fname
*/
private void setAsciiMathPropertyFileName(String fname)
{
this.m_asciimathPropertyFileName = fname;
}
/*
* This method sets the second assiimath .properties file name, called in the main-method.
*
* @param fname
*/
/*
private void setAsciiMathPropertyFileName2(String fname)
{
this.m_asciimathPropertyFileName2 = fname;
}
*/
/**
* Asetetaan ohjelman gui .properties file, ehka main-methodissa.
*
* @param fname
*/
private void setLanguagePropertyFileName(String fname)
{
this.m_languagePropertyFileName = fname;
}
/**
* This method initializes jDtbookTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJDtbookTextField() {
if (jDtbookTextField == null) {
jDtbookTextField = new JTextField();
}
return jDtbookTextField;
}
/**
* This method initializes jDtbookTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJDtbookTextField2() {
if (jDtbookTextField2 == null) {
jDtbookTextField2 = new JTextField();
}
return jDtbookTextField2;
}
/**
* This method initializes jDtbookTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJDtbookTextFieldConvert() {
if (jDtbookTextFieldConvert == null) {
jDtbookTextFieldConvert = new JTextField();
}
return jDtbookTextFieldConvert;
}
/**
* This method initializes jDtbookTextField
*
* @return javax.swing.JTextField
*/
private JTextField getAnnamerkkiTextField() {
if (jGiveCharacterTextField == null) {
jGiveCharacterTextField = new JTextField();
jGiveCharacterTextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent e) {
//System.out.println("keyTyped()"); // TODO Auto-generated Event stub keyTyped()
int keyCode = e.getKeyChar();
jChagedCharacterTextField.setText(
getHthlCodeString(jGiveCharacterTextField.getText()));
jHexaTextField.setText(
getHexaCodeString(jGiveCharacterTextField.getText()));
}
});
}
return jGiveCharacterTextField;
}
/**
* @param value
* @return
*/
private String
getHthlCodeString(String value)
{
if (value == null)
return value;
int max = value.length();
if (max == 0)
return value;
StringBuffer ret = new StringBuffer();
int keyCode;
for(int i = 0; i < max; i++)
{
keyCode = value.charAt(i);
ret.append("&#" + keyCode +";");
}
return ret.toString();
}
/**
* @param value
* @return
*/
private String
getHexaCodeString(String value)
{
if (value == null)
return value;
int max = value.length();
if (max == 0)
return value;
StringBuffer ret = new StringBuffer();
int keyCode;
for(int i = 0; i < max; i++)
{
keyCode = value.charAt(i);
ret.append("&#x" + Integer.toHexString(keyCode) +";");
}
return ret.toString();
}
/**
* This method initializes jDtbookTextField
*
* @return javax.swing.JTextField
*/
private JTextField getMuutettavamerkkiTextField() {
if (jChagedCharacterTextField == null) {
jChagedCharacterTextField = new JTextField();
jChagedCharacterTextField.setEditable(false);
}
return jChagedCharacterTextField;
}
/**
* This method initializes jDtBookButton
*
* @return javax.swing.JButton
*/
private JButton getJDtBookButton() {
if (jDtBookButton == null) {
//jDtBookButton = new JButton("1. Valitse muokattava Dtbook-asiakirja");
jDtBookButton = new JButton(m_1Valitse_muokattava_Dtbook_asiakirja);
jDtBookButton.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectDtBookFileName()");
selectDtBookFileName();
}
});
}
return jDtBookButton;
}
/**
* This method initializes jDtBookButton
*
* @return javax.swing.JButton
*/
private JButton getJDtBookButton2() {
if (jDtBookButton2 == null) {
//jDtBookButton2 = new JButton("1. Valitse muokattava Dtbook-asiakirja");
jDtBookButton2 = new JButton(m_1Valitse_muokattava_Dtbook_asiakirja);
jDtBookButton2.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectDtBookFileName2()");
selectDtBookFileName2();
}
});
}
return jDtBookButton2;
}
/**
* This method initializes jDtBookButton
*
* @return javax.swing.JButton
*/
private JButton getJDtBookButtonConvert() {
if (jDtBookButtonConvert == null) {
//jDtBookButton2 = new JButton("1. Valitse muokattava Dtbook-asiakirja");
jDtBookButtonConvert = new JButton(m_1Valitse_muokattava_Dtbook_asiakirja);
jDtBookButtonConvert.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectDtBookFileName2()");
selectDtBookFileNameConvert();
}
});
}
return jDtBookButtonConvert;
}
/**
* This method initializes jAsciiMathTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJAsciiMathTextField() {
if (jAsciiMathTextField == null) {
jAsciiMathTextField = new JTextField();
}
return jAsciiMathTextField;
}
/**
* This method initializes jAsciiMathTextField2
*
* @return javax.swing.JTextField
*/
private JTextField getJAsciiMathTextField2() {
if (jAsciiMathTextField2 == null) {
jAsciiMathTextField2 = new JTextField();
}
return jAsciiMathTextField2;
}
/**
* This method initializes jAsciiMathTextField2
*
* @return javax.swing.JTextField
*/
private JTextField getJAsciiMathTextFieldConvert() {
if (jAsciiMathTextFieldConvert == null) {
jAsciiMathTextFieldConvert = new JTextField();
}
return jAsciiMathTextFieldConvert;
}
/**
* This method initializes jAsciiMathButton
*
* @return javax.swing.JButton
*/
private JButton getAsciiMathButton() {
if (jAsciiMathButton == null) {
jAsciiMathButton = new JButton();
//jAsciiMathButton.setText("2. Valitse kohde-tiedosto, jonne talletetaan muunnos");
jAsciiMathButton.setText(m_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos);
jAsciiMathButton.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectModifiedDtbookFileName()");
selectModifiedDtbookFileName();
}
});
}
return jAsciiMathButton;
}
/**
* This method initializes jAsciiMathButton2
*
* @return javax.swing.JButton
*/
private JButton getJAsciiMathButton2() {
if (jAsciiMathButton2 == null) {
jAsciiMathButton2 = new JButton();
//jAsciiMathButton2.setText("2. Valitse Dtbook-tiedosto, jonne talletetaan muunnos");
jAsciiMathButton2.setText(m_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos);
jAsciiMathButton2.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectML4FileName()");
selectAsciiMathFileName2();
}
});
}
return jAsciiMathButton2;
}
/**
* This method initializes jAsciiMathButton2
*
* @return javax.swing.JButton
*/
private JButton getJAsciiMathButtonConvert() {
if (jAsciiMathButtonConvert == null) {
jAsciiMathButtonConvert = new JButton();
//jAsciiMathButton2.setText("2. Valitse Dtbook-tiedosto, jonne talletetaan muunnos");
jAsciiMathButtonConvert.setText(m_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos);
jAsciiMathButtonConvert.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectML4FileName()");
selectAsciiMathFileNameConvert();
}
});
}
return jAsciiMathButtonConvert;
}
/**
* This method initializes jAsciiMathScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJAsciiMathScrollPane() {
if (jAsciiMathScrollPane == null) {
jAsciiMathScrollPane = new JScrollPane();
jAsciiMathScrollPane.setViewportView(getJAsciiMathTextArea());
//jAsciiMathScrollPane.setViewportView(getJAsciiMathTextArea());
}
return jAsciiMathScrollPane;
}
private void setAsciiMathScrollPane_UnModiedDtbookJAsciiMathTextArea()
{
if (selected_jDtbookTextField.getText() != null
&& selected_jDtbookTextField.getText().trim().length() != 0)
{
JViewport jp = jAsciiMathScrollPane.getViewport();
JTextArea jUnModiedDtbookOfJAsciiMathTextArea = getUnModiedDtbookOfJAsciiMathTextArea();
try {
if (fisUnModiedDtbookJAsciiMathTextArea == null)
{
String fileName = selected_jDtbookTextField.getText();
fisUnModiedDtbookJAsciiMathTextArea = new FileInputStream(fileName);
InputStreamReader isr = new InputStreamReader(fisUnModiedDtbookJAsciiMathTextArea, "UTF-8");
int c;
char ch;
StringBuffer sp = new StringBuffer();
while( (c = isr.read()) != -1)
{
ch = (char)c;
sp.append(ch);
}
String strData = sp.toString();
jUnModiedDtbookOfAsciiMathTextArea.setText(strData);
jMessageLabelUnModiedDtbook.setText(m_unchangedFile +" " + jDtbookTextField.getText());
jMessageLabelUnModiedDtbook.paint(jMessageLabel.getGraphics());
}
} catch(Exception e){
e.printStackTrace();
}
}
}
/**
* This method initializes jWarningScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getWarningScrollPane() {
if (jWarningScrollPane == null) {
jWarningScrollPane = new JScrollPane();
jWarningScrollPane.setPreferredSize(new java.awt.Dimension(1068, 258));
jWarningScrollPane.setViewportView(getWarningTextArea());
}
return jWarningScrollPane;
}
/**
* This method initializes jML4TextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJAsciiMathTextArea() {
if (jAsciiMathTextArea == null) {
jAsciiMathTextArea = new JTextArea();
jAsciiMathTextArea.setFocusable(true);
jAsciiMathTextArea.setEditable(false);
jAsciiMathTextArea.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent e) {
//System.out.println("keyTyped()");
m_bTextAreaChanged = true;
}
});
jAsciiMathTextArea.setEnabled(true);
jAsciiMathTextArea.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
if (jAsciiMathTextArea.getText().length() == 0)
return;
int dot = e.getDot();
int mark = e.getMark();
//if (dot == mark) { // no selection
try {
int iSelectedLineNumber = jAsciiMathTextArea.getLineOfOffset(dot);
int iStartOfiSelectedLineNumber = jAsciiMathTextArea.getLineStartOffset(iSelectedLineNumber);
int iEndOfiSelectedLineNumber = jAsciiMathTextArea.getLineEndOffset(iSelectedLineNumber);
/*
System.out.println("jAsciiMathTextArea iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber +
"\n");
*/
jLabelPageNumber.setText("" +(iSelectedLineNumber+1)+" ");
//Convert it to view coordinates
//System.out.println("caret: text position: " + dot + "\n");
} catch (BadLocationException ble) {
System.out.println(ble.getMessage());
//System.out.println("caret: text position: " + dot + "\n");
}
}
});
}
return jAsciiMathTextArea;
}
/**
* This method initializes jML4TextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getUnModiedDtbookOfJAsciiMathTextArea() {
if (jUnModiedDtbookOfAsciiMathTextArea == null) {
jUnModiedDtbookOfAsciiMathTextArea = new JTextArea();
jUnModiedDtbookOfAsciiMathTextArea.setEditable(false);
jUnModiedDtbookOfAsciiMathTextArea.setEnabled(true);
jUnModiedDtbookOfAsciiMathTextArea.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
int dot = e.getDot();
int mark = e.getMark();
if (jUnModiedDtbookOfAsciiMathTextArea.getText().length() == 0)
return;
//if (dot == mark) { // no selection
try {
int iSelectedLineNumber = jAsciiMathTextArea.getLineOfOffset(dot);
int iStartOfiSelectedLineNumber = jAsciiMathTextArea.getLineStartOffset(iSelectedLineNumber);
int iEndOfiSelectedLineNumber = jAsciiMathTextArea.getLineEndOffset(iSelectedLineNumber);
/*
System.out.println("jAsciiMathTextArea iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber +
"\n");
*/
jLabelPageNumber.setText("" +(iSelectedLineNumber+1)+" ");
//Convert it to view coordinates
//System.out.println("caret: text position: " + dot + "\n");
} catch (BadLocationException ble) {
System.out.println(ble.getMessage());
//System.out.println("caret: text position: " + dot + "\n");
}
}
});
}
return jUnModiedDtbookOfAsciiMathTextArea;
}
/**
* This method initializes jExecuteButton
*
* @return javax.swing.JButton
*/
private JButton getJExecuteButton() {
if (jExecuteButton == null) {
jExecuteButton = new JButton();
//jExecuteButton.setText("4. Suorita AsciiMath teksti-muunnos");
jExecuteButton.setText(m_4_suorita_asciimath_teksti_muunnos);
jExecuteButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("executeDtbookAsciiMath()");
selected_jDtbookTextField = jDtbookTextField;
m_WarningTextAreaCaretLoopEvent = false;
fisUnModiedDtbookJAsciiMathTextArea = null;
executeDtbookAsciiMathConversion();
}
});
}
return jExecuteButton;
}
/**
* This method initializes jExecuteButton
*
* @return javax.swing.JButton
*/
private JButton getJExecuteButton2() {
if (jExecuteButton2 == null) {
jExecuteButton2 = new JButton();
//jExecuteButton2.setText("4. Suorita AsciiMath Xml-muunnos");
jExecuteButton2.setText(m_4_suorita_asciimath_xml_muunnos);
jExecuteButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("Suorita annettu xml-muunnos");
selected_jDtbookTextField = jDtbookTextField2;
fisUnModiedDtbookJAsciiMathTextArea = null;
m_WarningTextAreaCaretLoopEvent = false;
executeDtbook2AsciimathXmlConversion();
}
});
}
return jExecuteButton2;
}
/**
* This method initializes jExecuteButton
*
* @return javax.swing.JButton
*/
private JButton getJExecuteButtonConvert() {
if (jExecuteButtonConvert == null) {
jExecuteButtonConvert = new JButton();
//jExecuteButton2.setText("4. Suorita AsciiMath Xml-muunnos");
jExecuteButtonConvert.setText(m_4_suorita_asciimath_merkki_muunnos);
jExecuteButtonConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
String value = jTextPropertyFileNameConvert.getText();
if (value == null || value.trim().length() == 0)
{
jMessageLabel.setText(m_PropertyFileIsMissing);
return ;
}
//System.out.println("Suorita annettu xml-muunnos");
selected_jDtbookTextFieldConvert = jDtbookTextFieldConvert;
fisUnModiedDtbookConvertTextArea = null;
m_WarningTextAreaCaretLoopEventConvert = false;
executeDtbookConvertConversion();
}
});
}
return jExecuteButtonConvert;
}
private void executeDtbookConvertConversion()
{
/*
* jDtbookTextFieldConvert
* jAsciiMathTextFieldConvert
* jTextPropertyFileNameConvert
*/
/* This code block must updated with gui-variables and xml-execution with asmiimath-to-xml:
*/
jConvertTextArea.setEditable(false);
jEditButtonConvert.setText(m_EDITDtbook);
jEditButtonConvert.setEnabled(false);
jOpenInEditorButtonConvert.setEnabled(false);
storePropertiesToUserHome(); // TODO: store also xml asciimath file name
if (m_bDtbookContainsMixedCharsetConvert)
//jMessageLabel.setText("Ajetaan sekamerkistä-muunnosta....");
jMessageLabel.setText(m_ajetaan_sekamerkista_muunnosta);
else
//jMessageLabel.setText("Ajetaan muunnosta....");
jMessageLabel.setText(m_ajetaan_muunnosta);
StringBuffer sb = new StringBuffer(jMessageLabel.getText() +"\n");
String dbbookFileNameValue = jDtbookTextFieldConvert.getText();
if (dbbookFileNameValue == null || dbbookFileNameValue.trim().length() == 0)
{
//jMessageLabel.setText("'Anna muokattava Dtbook-asiakirja'-kenttä on tyhjä.\n Ajo keskeytetty.");
jMessageLabel.setText(m_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jConvertTextArea.setText(sb.toString());
return ;
}
else
{
File tmpFile = new File(dbbookFileNameValue);
if (tmpFile.isDirectory())
{
jMessageLabel.setText(m_file_is_directory);
sb.append(jMessageLabel.getText() +"\n");
jConvertTextArea.setText(sb.toString());
return ;
}
if (!tmpFile.exists())
{
jMessageLabel.setText(m_dtbook_did_not_exists);
sb.append(jMessageLabel.getText() +"\n");
jConvertTextArea.setText(sb.toString());
return ;
}
String ml4FileNameValue = jAsciiMathTextFieldConvert.getText();
if (ml4FileNameValue == null || ml4FileNameValue.trim().length() == 0)
{
jMessageLabel.setText(m_missing_cfg_file_field);
sb.append(jMessageLabel.getText() +"\n");
jConvertTextArea.setText(sb.toString());
return ;
}
else
{
File dtBookFile = new File(dbbookFileNameValue);
if (!dtBookFile.exists())
{
jMessageLabel.setText(m_dtbook_document +" (" + dbbookFileNameValue
+") " + m_no_existence_canceled);
sb.append(jMessageLabel.getText() +"\n");
jConvertTextArea.setText(sb.toString());
return ;
}
//ks alla: jEditButton.setEnabled(false);
jOpenInEditorButtonConvert.setEnabled(false);
jConvertTextArea.setEditable(false);
jConvertTextArea.setText("Dtbook: " +dbbookFileNameValue +"\n"
+"Conversion: " +ml4FileNameValue +"\n");
//jMessageLabel.setText("Muunnos käynnissä...");
jMessageLabel.setText(m_inchanging +" ...");
m_iExecuteResult = 0;
executeDtbookCharConversion(jDtbookTextFieldConvert.getText(),
jAsciiMathTextFieldConvert.getText());
//jos käsitellään samaan aikaan kuin tämän komponentin eventin aikana,
// tulee pitkän ajan päästä: socket error: jEditButton.setEnabled(true);
// sillä tämä suoritus on lähtäisin jEditButton:sta!!
if (m_iExecuteResult == 0)
{
//if (bXslWarnings)
//{
if (m_sbWarnings.toString().trim().length() != 0)
{
jTabbedPane.setSelectedComponent(getWarningContentPane());
jWarningTextArea.setText(m_sbWarnings.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
//jMessageLabel.setText("Ajo valmis, mutta varoituksia 'Muunnoksen varoituksia lehdykässä (ks. myäs Muunnoksen asetukset-lehdykkä, rakenteen käsittelemätt. tarkistus)!");
jWarningScrollPane.setViewportView(getWarningTextArea());
jMessageLabel.setText(m_runexecutedbutwarnings); }
else
{
//jMessageLabel.setText("Ajo valmis.");
jMessageLabel.setText(m_ajo_valmis);
}
//jTabbedPane.setSelectedComponent(getJInputOutPutPanel());
jWarningScrollPane.setViewportView(getWarningTextArea());
jEditButtonConvert.setEnabled(true);
jOpenInEditorButtonConvert.setEnabled(true);
if (m_bDtbookContainsMixedCharsetConvert)
jMessageLabel.setText(m_correctedFile // "Korjattu tiedosto: "
+": " + m_DtBookCharConvert.getKorjattuDtBookTiedostoNimi());
/*
if (m_bUnScriptedXmlStructureCheckBox && !m_bUnScriptedXmlMessageCheckBox)
{
File ml4File = new File(ml4FileNameValue);
ml4File.delete();
jMessageLabel.setText("Ajo valmis, mutta ML4-tiedosto poistettu, koska DtBookrakenteen-rakenteinen virhetarkistus ML4-tiedoston joukkoon päällä. Ruuudulla tulos (ks. asetuksekset-lehdykkä)!!");
jEditButton.setEnabled(false);
jOpenInEditorButton.setEnabled(false);
}
*/
}
else
{
// jEditButtonConvert.setEnabled(true);
// jMessageLabel.setText("Ajo valmis.");
// jMessageLabel.setText(m_ajo_valmis);
// jOpenInEditorButtonConvert.setEnabled(true);
}
//}
jWarningScrollPane.setViewportView(getWarningTextArea());
jWarningScrollPane.updateUI();
jPanelConvert.updateUI();
}
}
}
/**
* This method initializes jHelpTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJHelpTextArea() {
if (jHelpTextArea == null) {
jHelpTextArea = new JTextArea();
jHelpTextArea.setText(m_gui_help);
jHelpTextArea.setEditable(false);
}
return jHelpTextArea;
}
/**
* This method initializes jVersionPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJVersionPanel() {
if (jVersionPanel == null) {
jVersionPanel = new JPanel();
jVersionPanel.setLayout(new BorderLayout());
jVersionPanel.add(getAboutVersionLabel(), BorderLayout.NORTH);
jVersionPanel.add(getCopyRigthLabel(), BorderLayout.CENTER);
}
return jVersionPanel;
}
/**
* This method initializes jOpenInEditorButton
*
* @return javax.swing.JButton
*/
private JButton getJOpenInEditorButton() {
if (jOpenInEditorButton == null) {
jOpenInEditorButton = new JButton();
//jOpenInEditorButton.setText("Avaa sovelluksessa");
jOpenInEditorButton.setText(m_avaa_sovelluksessa);
jOpenInEditorButton.setEnabled(false);
jOpenInEditorButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("Avaa sovelluksessa()");
openInApplication();
}
});
}
return jOpenInEditorButton;
}
/**
* This method initializes jOpenInEditorButton
*
* @return javax.swing.JButton
*/
private JButton getJOpenInEditorButtonConvert() {
if (jOpenInEditorButtonConvert == null) {
jOpenInEditorButtonConvert = new JButton();
//jOpenInEditorButton2.setText("Avaa sovelluksessa");
jOpenInEditorButtonConvert.setText(m_avaa_sovelluksessa);
jOpenInEditorButtonConvert.setEnabled(false);
jOpenInEditorButtonConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("Avaa sovelluksessa()");
openInApplicationConvert();
}
});
}
return jOpenInEditorButtonConvert;
}
// TODO:
private void openInApplicationConvert()
{
if ( bChangeApplicationCheckBoxConvert
|| m_strOpenInApplicationConvert == null || m_strOpenInApplicationConvert.trim().length() == 0)
{
m_strOpenInApplicationConvert = getsOpenInApplicationValueConvert();
if (m_strOpenInApplicationConvert == null || m_strOpenInApplicationConvert.trim().length() == 0)
return;
jChangeApplicationCheckBoxConvert.setSelected(false);
}
editInApplicationConvert(m_strOpenInApplicationConvert);
}
/**
* This method initializes jOpenInEditorButton
*
* @return javax.swing.JButton
*/
private JButton getJOpenInEditorButton2() {
if (jOpenInEditorButton2 == null) {
jOpenInEditorButton2 = new JButton();
//jOpenInEditorButton2.setText("Avaa sovelluksessa");
jOpenInEditorButton2.setText(m_avaa_sovelluksessa);
jOpenInEditorButton2.setEnabled(false);
jOpenInEditorButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("Avaa sovelluksessa()");
openInApplication2();
}
});
}
return jOpenInEditorButton2;
}
/**
* open dtbook in the specific application
*/
private void openInApplication()
{
if (bChangeApplicationCheckBox
|| m_strOpenInApplication == null || m_strOpenInApplication.trim().length() == 0)
{
m_strOpenInApplication = getsOpenInApplicationValue();
if (m_strOpenInApplication == null || m_strOpenInApplication.trim().length() == 0)
return;
jChangeApplicationCheckBox.setSelected(false);
}
editInApplication(m_strOpenInApplication);
}
/**
* open asciimath dtbook in the specific application
*/
private void openInApplication2()
{
if (bChangeApplicationCheckBox2
|| m_strOpenInApplication2 == null || m_strOpenInApplication2.trim().length() == 0)
{
m_strOpenInApplication2 = getsOpenInApplicationValue2();
if (m_strOpenInApplication2 == null || m_strOpenInApplication2.trim().length() == 0)
return;
jChangeApplicationCheckBox2.setSelected(false);
}
editInApplication(m_strOpenInApplication2);
}
/**
* Get application name of edit/viewed dtbook-document in dtbook rule
* applcation.
*
* @return
*/
private String getsOpenInApplicationValue()
{
if (openInApplicationFileChooser == null)
{
openInApplicationFileChooser = new JFileChooser();
//openInApplicationFileChooser.setDialogTitle("Avaa Dtbook-tiedosto sovelluksessa");
openInApplicationFileChooser.setDialogTitle(m_avaa_dtbook_tiedosto_sovelluksessa);
openInApplicationFileChooser.setMultiSelectionEnabled(false);
if (userHomeFilePropertyFile != null)
{
String executeForOpenFileName = m_userhomeProperties.getProperty(cnst_OpenInApplication, "");
if (executeForOpenFileName.trim().length() != 0)
{
m_strOpenInApplication = executeForOpenFileName;
}
}
if (m_strOpenInApplication != null)
openInApplicationFileChooser.setSelectedFile(new File(m_strOpenInApplication));
}
int returnVal = openInApplicationFileChooser.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = openInApplicationFileChooser.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua sovellusta (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_sovellusta + file.getName() + m_valittua_sovellusta_ei_ole);
}
else
{
jMessageLabel.setText(m_selected_application +" " + file.getName());
return file.getAbsolutePath();
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
return null;
}
/**
* @param p_strOpenInApplication
*/
private void editInApplication(String p_strOpenInApplication)
{
if (p_strOpenInApplication == null || p_strOpenInApplication.trim().length() == 0)
return;
try {
if (p_strOpenInApplication.contains(" "))
p_strOpenInApplication = "\"" + p_strOpenInApplication + "\"";
String strRun = p_strOpenInApplication + " " + jAsciiMathTextField.getText();
Process p = Runtime.getRuntime().exec (strRun);
String strReadCharacterSet = m_strWriteCharacterSet;
m_iExecuteResult = 0;
if (File.separatorChar == ';')
{
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream(),
strReadCharacterSet));
String line;
StringBuffer sb = new StringBuffer ();
while ((line = input.readLine()) != null) {
//System.out.println(line);
sb.append(line +"\n");
}
input.close();
m_iExecuteResult = p.exitValue();
}
if (m_iExecuteResult != 0)
{
//jMessageLabel.setText("Ajossa (" + strRun +") tapahtui virhe!" );
jMessageLabel.setText(cnstajossa +" "+ strRun +"!");
// jChangeApplicationCheckBox.setSelected(true);
}
else
jMessageLabel.setText(m_Avattu + " " + jAsciiMathTextField.getText() );
} catch (Exception e){
e.printStackTrace();
jChangeApplicationCheckBox.setSelected(true);
jMessageLabel.setText(cnstajossa +" "+ e.getMessage());
}
}
/**
* @param p_strOpenInApplication
*/
private void editInApplicationConvert(String p_strOpenInApplication)
{
if (p_strOpenInApplication == null || p_strOpenInApplication.trim().length() == 0)
return;
try {
if (p_strOpenInApplication.contains(" "))
p_strOpenInApplication = "\"" + p_strOpenInApplication + "\"";
String strRun = p_strOpenInApplication + " " + jAsciiMathTextFieldConvert.getText();
m_iExecuteResultConvert = 0;
Process p = Runtime.getRuntime().exec (strRun);
String strReadCharacterSet = m_strWriteCharacterSet;
if (File.separatorChar == ';')
{
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream(),
strReadCharacterSet));
String line;
StringBuffer sb = new StringBuffer ();
while ((line = input.readLine()) != null) {
//System.out.println(line);
sb.append(line +"\n");
}
input.close();
m_iExecuteResultConvert = p.exitValue();
}
if (m_iExecuteResultConvert != 0)
{
//jMessageLabel.setText("Ajossa (" + strRun +") tapahtui virhe!" );
jMessageLabel.setText(cnstajossa +" "+ strRun +"!");
// jChangeApplicationCheckBoxConvert.setSelected(true);
}
else
jMessageLabel.setText(m_Avattu + " " + jAsciiMathTextFieldConvert.getText() );
} catch (Exception e){
e.printStackTrace();
jChangeApplicationCheckBoxConvert.setSelected(true);
jMessageLabel.setText(cnstajossa +" "+ e.getMessage());
}
}
/**
* Get application name of edit/viewed dtbook-document in dtbook rule
* applcation.
*
* @return
*/
private String getsOpenInApplicationValueConvert()
{
if (openInApplicationFileChooserConvert == null)
{
openInApplicationFileChooserConvert = new JFileChooser();
//openInApplicationFileChooser.setDialogTitle("Avaa Dtbook-tiedosto sovelluksessa");
openInApplicationFileChooserConvert.setDialogTitle(m_avaa_dtbook_tiedosto_sovelluksessa);
openInApplicationFileChooserConvert.setMultiSelectionEnabled(false);
if (userHomeFilePropertyFile != null)
{
String executeForOpenFileName = m_userhomeProperties.getProperty(cnst_OpenInApplication_convert, "");
if (executeForOpenFileName.trim().length() != 0)
{
m_strOpenInApplicationConvert = executeForOpenFileName;
}
}
if (m_strOpenInApplicationConvert != null)
openInApplicationFileChooserConvert.setSelectedFile(new File(m_strOpenInApplicationConvert));
}
int returnVal = openInApplicationFileChooserConvert.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = openInApplicationFileChooserConvert.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua sovellusta (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_sovellusta + file.getName() + m_valittua_sovellusta_ei_ole);
}
else
{
jMessageLabel.setText(m_selected_application +" " + file.getName());
return file.getAbsolutePath();
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
return null;
}
/**
* Get application name of edit/viewed dtbook-document in dtbook firefox
* applcation (asciimath data into asciimath daisy xml blocks.
*
* @return
*/
private String getsOpenInApplicationValue2()
{
if (openInApplicationFileChooser2 == null)
{
openInApplicationFileChooser2 = new JFileChooser();
//openInApplicationFileChooser.setDialogTitle("Avaa Dtbook-tiedosto sovelluksessa");
openInApplicationFileChooser2.setDialogTitle(m_avaa_dtbook_tiedosto_sovelluksessa);
openInApplicationFileChooser2.setMultiSelectionEnabled(false);
if (userHomeFilePropertyFile != null)
{
String executeForOpenFileName = m_userhomeProperties.getProperty(cnst_OpenInApplication2, "");
if (executeForOpenFileName.trim().length() != 0)
{
m_strOpenInApplication2 = executeForOpenFileName;
}
}
if (m_strOpenInApplication2 != null)
openInApplicationFileChooser2.setSelectedFile(new File(m_strOpenInApplication2));
}
int returnVal = openInApplicationFileChooser2.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = openInApplicationFileChooser2.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua sovellusta (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_sovellusta + file.getName() + m_valittua_sovellusta_ei_ole);
}
else
{
jMessageLabel.setText(m_selected_application +" " + file.getName());
return file.getAbsolutePath();
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
return null;
}
/**
* This method initializes jEditOpenPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJEditOpenPanel() {
if (jEditOpenPanel == null) {
jEditOpenPanel = new JPanel();
jEditOpenPanel.setLayout(new GridBagLayout());
}
return jEditOpenPanel;
}
/**
* This method initializes jEditOpenPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJEditOpenPanel2() {
if (jEditOpenPanel2 == null) {
jEditOpenPanel2 = new JPanel();
jEditOpenPanel2.setLayout(new GridBagLayout());
}
return jEditOpenPanel2;
}
/**
* This method initializes jEditOpenPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJEditOpenPanelConvert() {
if (jEditOpenPanelConvert == null) {
jEditOpenPanelConvert = new JPanel();
jEditOpenPanelConvert.setLayout(new GridBagLayout());
}
return jEditOpenPanelConvert;
}
/**
* This method initializes jEditButton
*
* @return javax.swing.JButton
*/
private JButton getJEditButton() {
if (jEditButton == null) {
jEditButton = new JButton();
jEditButton.setText(m_EDITDtbook);
jEditButton.setEnabled(false);
jEditButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
String bt = jEditButton.getText();
if (bt.equals(m_EDITDtbook))
{
//jEditButton.setText("Talleta");
jEditButton.setText(m_talleta);
jAsciiMathTextArea.setEditable(true);
}
else
{
saveTextArea(jAsciiMathTextArea.getText());
}
}
});
}
return jEditButton;
}
/**
* This method initializes jEditButton
*
* @return javax.swing.JButton
*/
private JButton getJEditButton2() {
if (jEditButton2 == null) {
jEditButton2 = new JButton();
jEditButton2.setText(m_EDITDtbook);
jEditButton2.setEnabled(false);
jEditButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
String bt = jEditButton2.getText();
if (bt.equals(m_EDITDtbook))
{
//jEditButton2.setText("Talleta");
jEditButton2.setText(m_talleta);
jAsciiMathTextArea.setEditable(true);
}
else
{
saveTextArea(jAsciiMathTextArea.getText());
}
}
});
}
return jEditButton2;
}
/**
* This method initializes jEditButton
*
* @return javax.swing.JButton
*/
private JButton getJEditButtonConvert() {
if (jEditButtonConvert == null) {
jEditButtonConvert = new JButton();
jEditButtonConvert.setText(m_EDITDtbook);
jEditButtonConvert.setEnabled(false);
jEditButtonConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
String bt = jEditButtonConvert.getText();
if (bt.equals(m_EDITDtbook))
{
//jEditButton2.setText("Talleta");
jEditButtonConvert.setText(m_talleta);
jConvertTextArea.setEditable(true);
}
else
{
saveTextAreaConvert(jConvertTextArea.getText());
}
}
});
}
return jEditButtonConvert;
}
/**
* @param savethistext
*/
private void saveTextArea(String savethistext)
{
if (savethistext == null)
return;
File storeFile = new File(jAsciiMathTextField.getText());
try {
/*
*/
FileOutputStream ofs = new FileOutputStream(storeFile);
OutputStreamWriter osw = new OutputStreamWriter(
ofs, m_strWriteCharacterSet);
//BufferedReader ml4Input = new BufferedReader
//(new InputStreamReader(new FileInputStream(outputFile)));
osw.write(savethistext);
osw.flush();
osw.close();
//jMessageLabel.setText("Tallettu " +jAsciiMathTextField.getText() +"-tiedostoon");
jMessageLabel.setText(m_tallettu +jAsciiMathTextField.getText());
m_bTextAreaChanged = false;
} catch (Exception e) {
e.printStackTrace();
jMessageLabel.setText(e.getMessage());
}
}
/**
* @param savethistext
*/
private void saveTextAreaConvert(String savethistext)
{
if (savethistext == null)
return;
File storeFile = new File(jAsciiMathTextField.getText());
try {
/*
*/
FileOutputStream ofs = new FileOutputStream(storeFile);
OutputStreamWriter osw = new OutputStreamWriter(
ofs, m_strWriteCharacterSet);
//BufferedReader ml4Input = new BufferedReader
//(new InputStreamReader(new FileInputStream(outputFile)));
osw.write(savethistext);
osw.flush();
osw.close();
//jMessageLabel.setText("Tallettu " +jAsciiMathTextField.getText() +"-tiedostoon");
jMessageLabel.setText(m_tallettu +jAsciiMathTextField.getText());
m_bTextAreaChangedConvert = false;
} catch (Exception e) {
e.printStackTrace();
jMessageLabel.setText(e.getMessage());
}
}
/**
* This method initializes jChangeApplicationCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJChangeApplicationCheckBox() {
if (jChangeApplicationCheckBox == null) {
jChangeApplicationCheckBox = new JCheckBox();
jChangeApplicationCheckBox.setBackground(asciiMathColor);
//jChangeApplicationCheckBox.setText("Vaihda 'Avaa sovellus' toiseksi");
jChangeApplicationCheckBox.setText(m_vaihda_avaa_sovellus_toiseksi);
jChangeApplicationCheckBox
.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
//System.out.println("stateChanged()");
if (jChangeApplicationCheckBox.isSelected())
bChangeApplicationCheckBox = true;
else
bChangeApplicationCheckBox = false;
}
});
jChangeApplicationCheckBox.setEnabled(true);
}
return jChangeApplicationCheckBox;
}
/**
* This method initializes jChangeApplicationCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJChangeApplicationCheckBox2() {
if (jChangeApplicationCheckBox2 == null) {
jChangeApplicationCheckBox2 = new JCheckBox();
//jChangeApplicationCheckBox2.setText("Vaihda 'Avaa sovellus' toiseksi");
jChangeApplicationCheckBox2.setText(m_vaihda_avaa_sovellus_toiseksi);
jChangeApplicationCheckBox2.setBackground(asciiMath2Color);
jChangeApplicationCheckBox2
.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
//System.out.println("stateChanged()");
if (jChangeApplicationCheckBox2.isSelected())
bChangeApplicationCheckBox2 = true;
else
bChangeApplicationCheckBox2 = false;
}
});
}
return jChangeApplicationCheckBox2;
}
/**
* This method initializes jChangeApplicationCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJChangeApplicationCheckBoxConvert() {
if (jChangeApplicationCheckBoxConvert == null) {
jChangeApplicationCheckBoxConvert = new JCheckBox();
//jChangeApplicationCheckBoxConvert.setText("Vaihda 'Avaa sovellus' toiseksi");
jChangeApplicationCheckBoxConvert.setText(m_vaihda_avaa_sovellus_toiseksi);
jChangeApplicationCheckBoxConvert.setBackground(asciiMath2ColorConvert);
jChangeApplicationCheckBoxConvert
.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
//System.out.println("stateChanged()");
if (jChangeApplicationCheckBoxConvert.isSelected())
bChangeApplicationCheckBoxConvert = true;
else
bChangeApplicationCheckBoxConvert = false;
}
});
}
return jChangeApplicationCheckBoxConvert;
}
/**
* This method initializes jEditPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJEditPanel() {
if (jEditPanel == null) {
jWriteCharSetLabel = new JLabel();
//jWriteCharSetLabel.setText("Kirjoitus merkistö: ");
jWriteCharSetLabel.setText(m_ml4_kirjoitus_merkisto);
FlowLayout flowLayout = new FlowLayout();
flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
jEditPanel = new JPanel();
jEditPanel.setLayout(flowLayout);
jEditPanel.add(getJExecuteButton(), null);
jEditPanel.add(getJEditButton(), null);
jEditPanel.add(getJOpenInEditorButton(), null);
jEditPanel.add(getJChangeApplicationCheckBox(), null);
jEditPanel.add(jWriteCharSetLabel, null);
jEditPanel.add(getJWriteCharSetComboBox(), null);
jEditPanel.setBackground(asciiMathColor);
}
return jEditPanel;
}
/**
* This method initializes jEditPanel2
*
* @return javax.swing.JPanel
*/
private JPanel getJEditPanel2() {
if (jEditPanel2 == null) {
jWriteCharSetLabel2 = new JLabel();
//jWriteCharSetLabel2.setText("Dtbook kirjoitus merkistö");
jWriteCharSetLabel2.setText(m_dtbook_kirjoitus_merkisto);
FlowLayout flowLayout = new FlowLayout();
flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
jEditPanel2 = new JPanel();
jEditPanel2.setLayout(flowLayout);
jEditPanel2.add(getJExecuteButton2(), null);
jEditPanel2.add(getJEditButton2(), null);
jEditPanel2.add(getJOpenInEditorButton2(), null);
jEditPanel2.add(getJChangeApplicationCheckBox2(), null);
jEditPanel2.add(jWriteCharSetLabel2, null);
jEditPanel2.add(getJWriteCharSetComboBox2(), null);
jEditPanel2.setBackground(asciiMath2Color);
}
return jEditPanel2;
}
/**
* This method initializes jEditPanel2
*
* @return javax.swing.JPanel
*/
private JPanel getJEditPanelConvert() {
if (jEditPanelConvert == null) {
jWriteCharSetLabelConvert = new JLabel();
//jWriteCharSetLabel2.setText("Dtbook kirjoitus merkistö");
jWriteCharSetLabelConvert.setText(m_dtbook_kirjoitus_merkisto);
FlowLayout flowLayout = new FlowLayout();
flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
jEditPanelConvert = new JPanel();
jEditPanelConvert.setLayout(flowLayout);
jEditPanelConvert.add(getJExecuteButtonConvert(), null);
jEditPanelConvert.add(getJEditButtonConvert(), null);
jEditPanelConvert.add(getJOpenInEditorButtonConvert(), null);
jEditPanelConvert.add(getJChangeApplicationCheckBoxConvert(), null);
jEditPanelConvert.add(jWriteCharSetLabelConvert, null);
jEditPanelConvert.add(getJWriteCharSetComboBoxConvert(), null);
jEditPanelConvert.setBackground(asciiMath2ColorConvert);
}
return jEditPanelConvert;
}
/**
* This method initializes jWriteCharSetComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJWriteCharSetComboBox() {
if (jWriteCharSetComboBox == null) {
jWriteCharSetComboBox = new JComboBox();
jWriteCharSetComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
m_strWriteCharacterSet = jWriteCharSetComboBox.getSelectedItem().toString();
}
});
jWriteCharSetComboBox.addItem(UTF_8);
jWriteCharSetComboBox.addItem(ISO_8859_1);
//jWriteCharSetComboBox.addItem(UTF_16);
jWriteCharSetComboBox.addItem(US_ASCII);
//jWriteCharSetComboBox.addItem(UTF_16BE);
//jWriteCharSetComboBox.addItem(UTF_16LE);
}
return jWriteCharSetComboBox;
}
/**
* This method initializes jWriteCharSetComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJWriteCharSetComboBox2() {
if (jWriteCharSetComboBox2 == null) {
jWriteCharSetComboBox2 = new JComboBox();
jWriteCharSetComboBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
m_strWriteCharacterSet2 = jWriteCharSetComboBox2.getSelectedItem().toString();
}
});
jWriteCharSetComboBox2.addItem(UTF_8);
jWriteCharSetComboBox2.addItem(ISO_8859_1);
//jWriteCharSetComboBox.addItem(UTF_16);
jWriteCharSetComboBox2.addItem(US_ASCII);
//jWriteCharSetComboBox2.addItem(UTF_16BE);
//jWriteCharSetComboBox2.addItem(UTF_16LE);
}
return jWriteCharSetComboBox2;
}
/**
* This method initializes jWriteCharSetComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getJWriteCharSetComboBoxConvert() {
if (jWriteCharSetComboBoxConvert == null) {
jWriteCharSetComboBoxConvert = new JComboBox();
jWriteCharSetComboBoxConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
m_strWriteCharacterSetConvert = jWriteCharSetComboBoxConvert.getSelectedItem().toString();
}
});
jWriteCharSetComboBoxConvert.addItem(UTF_8);
jWriteCharSetComboBoxConvert.addItem(ISO_8859_1);
//jWriteCharSetComboBox.addItem(UTF_16);
jWriteCharSetComboBoxConvert.addItem(US_ASCII);
//jWriteCharSetComboBoxConvert.addItem(UTF_16BE);
//jWriteCharSetComboBoxConvert.addItem(UTF_16LE);
}
return jWriteCharSetComboBoxConvert;
}
/**
*
*/
private void check_isSelected_MixedCharSetCheckBox()
{
if (jMixedCharSetCheckBox.isSelected())
m_bDtbookContainsMixedCharsets = true;
else
m_bDtbookContainsMixedCharsets = false;
}
/**
*
*/
private void check_isSelected_MixedCharSetCheckBox2()
{
if (jMixedCharSetCheckBox2.isSelected())
m_bDtbookContainsMixedCharsets2 = true;
else
m_bDtbookContainsMixedCharsets2 = false;
}
/**
*
*/
private void check_isSelected_MixedCharSetCheckBoxConvert()
{
if (jMixedCharSetCheckBoxConvert.isSelected())
m_bDtbookContainsMixedCharsetConvert = true;
else
m_bDtbookContainsMixedCharsetConvert = false;
}
/**
* This method initializes jMixedCharSetCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJMixedCharSetCheckBox() {
if (jMixedCharSetCheckBox == null) {
jMixedCharSetCheckBox = new JCheckBox();
jMixedCharSetCheckBox.setBackground(asciiMathColor);
//jMixedCharSetCheckBox.setText("Sekamerkejä UTF-8 sekä ISO-8859-1 (ns latin1)");
jMixedCharSetCheckBox.setText(m_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
jMixedCharSetCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
check_isSelected_MixedCharSetCheckBox();
}
});
}
return jMixedCharSetCheckBox;
}
/**
* This method initializes jMixedCharSetCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJMixedCharSetCheckBox2() {
if (jMixedCharSetCheckBox2 == null) {
jMixedCharSetCheckBox2 = new JCheckBox();
//jMixedCharSetCheckBox2.setText("Dtbook-asiakirja sisältää sekamerkejä UTF-8 sekä ISO-8859-1 (ns latin1)");
jMixedCharSetCheckBox2.setText(m_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
jMixedCharSetCheckBox2.setBackground(asciiMath2Color);
jMixedCharSetCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
check_isSelected_MixedCharSetCheckBox2();
}
});
}
return jMixedCharSetCheckBox2;
}
/**
* This method initializes jMixedCharSetCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJMixedCharSetCheckBoxConvert() {
if (jMixedCharSetCheckBoxConvert == null) {
jMixedCharSetCheckBoxConvert = new JCheckBox();
//jMixedCharSetCheckBox2.setText("Dtbook-asiakirja sisältää sekamerkejä UTF-8 sekä ISO-8859-1 (ns latin1)");
jMixedCharSetCheckBoxConvert.setText(m_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
jMixedCharSetCheckBoxConvert.setBackground(asciiMath2ColorConvert);
jMixedCharSetCheckBoxConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
check_isSelected_MixedCharSetCheckBoxConvert();
}
});
}
return jMixedCharSetCheckBoxConvert;
}
/**
* This method initializes jSettingPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJSettingPanel() {
if (jSettingPanel == null) {
FlowLayout flowLayout1 = new FlowLayout();
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
jSettingPanel = new JPanel();
jSettingPanel.setLayout(flowLayout1);
jSettingPanel.add(getJMixedCharSetCheckBox(), null);
jSettingPanel.add(getJRuleSpaceCheckBox(), null);
jSettingPanel.add(getJNumberRuleCheckBox(), null);
jSettingPanel.add(getJThousandNumberRuleCheckBox(), null);
jSettingPanel.add(getJButtonMuokkaaMerkkeja(), null);
jSettingPanel.add(getJReplaceRuleCheckBox());
jSettingPanel.setBackground(asciiMathColor);
}
return jSettingPanel;
}
/**
* This method initializes jSettingPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJSettingPanel2() {
if (jSettingPanel2 == null) {
FlowLayout flowLayout1 = new FlowLayout();
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
jSettingPanel2 = new JPanel();
jSettingPanel2.setLayout(flowLayout1);
jSettingPanel2.add(getJMixedCharSetCheckBox2(), null);
jSettingPanel2.add(getJButtonMuokkaaMerkkeja2(), null);
jSettingPanel2.setBackground(asciiMath2Color);
}
return jSettingPanel2;
}
/**
* This method initializes jSettingPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJSettingPanelConvert() {
if (jSettingPanelConvert == null) {
FlowLayout flowLayout1 = new FlowLayout();
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
jSettingPanelConvert = new JPanel();
jSettingPanelConvert.setLayout(flowLayout1);
jSettingPanelConvert.add(getJMixedCharSetCheckBoxConvert(), null);
jSettingPanelConvert.add(getJButtonMuokkaaMerkkejaConvert(), null);
jSettingPanelConvert.setBackground(asciiMath2ColorConvert);
}
return jSettingPanelConvert;
}
/**
* This method initializes aboutContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getWarningContentPane() {
if (warningContentPane == null) {
FlowLayout flowLayout2 = new FlowLayout();
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
BorderLayout borderLayout1 = new BorderLayout();
borderLayout1.setHgap(20);
borderLayout1.setVgap(20);
BorderLayout bl = new BorderLayout();
warningContentPane = new JPanel();
warningContentPane.setLayout(bl);
warningContentPane.setPreferredSize(new java.awt.Dimension(1068, 411));
//warningContentPane.setLayout(borderLayout1);
warningContentPane.add(getWarningScrollPane(), BorderLayout.NORTH);
// warningContentPane.add(getWarningTextArea(), BorderLayout.NORTH);
warningContentPane.add(getJScrollPaneUnModifiedDtBook(), BorderLayout.CENTER);
warningContentPane.add(jMessageLabelUnModiedDtbook, BorderLayout.SOUTH);
//jWarningScrollPane.setPreferredSize(jWarningScrollPane.getPreferredSize());
}
return warningContentPane;
}
/**
* This method initializes jTabbedPane
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getJTabbedPane() {
if (jTabbedPane == null)
{
jTabbedPane = new JTabbedPane();
jTabbedPane.setBackground(asciiMathColor);
//jTabbedPane.addTab("Dtbook AsciiMath text -muunnos", null, getJInputOutPutPanel(),
//"DtBook-AsciiMath-muunnokseen");
if (m_bHideRuleTab)
getJPanelRuleTab();
else
jTabbedPane.addTab(m_Dtbook_AsciiMath_text_muunnos, null, getJPanelRuleTab(), null);
m_indTab_Dtbook_AsciiMath_text_muunnos = jTabbedPane.getComponentCount() -1;
jTabbedPane.addTab(m_Dtbook_AsciiMath_xml_muunnos, null, getJPanelXmlAsciiMath(), null);
m_indTab_Dtbook_AsciiMath_xml_muunnos = jTabbedPane.getComponentCount() -1;
jTabbedPane.addTab(m_Dtbook_convert, null, getJPanelConvert(), null);
m_indTab_Dtbook_convert = jTabbedPane.getComponentCount() -1;
jTabbedPane.addTab(m_Muunnoksen_tiivistelma_varoitukset, getWarningContentPane());
m_indTab_Muunnoksen_tiivistelma_varoitukset = jTabbedPane.getComponentCount() -1;
jTabbedPane.addTab(m_Muokkaa_merkkeja_html_editori, null, getJPanelCharEditorPanel(), null);
m_indTab_Muokkaa_merkkeja_html_editori = jTabbedPane.getComponentCount() -1;
/*
jTabbedPane.addFocusListener(new FocusListener(){
public void focusGained(FocusEvent e) // Invoked when a component gains the keyboard focus.
{
System.out.println(e.getSource().getClass().getName());
System.out.println(jTabbedPane.getSelectedIndex());
?*
jTabbedPane.addTab(m_Dtbook_AsciiMath_text_muunnos, null, getJInputOutPutPanel());
jTabbedPane.addTab(m_Dtbook_AsciiMath_xml_muunnos, null, getJInputOutPutPanel2());
jTabbedPane.addTab(m_Muunnoksen_tiivistelma_varoitukset, null, getWarningContentPane());
jTabbedPane.addTab(m_Muokkaa_merkkeja_html_editori, null,
*?
?*
if (jTabbedPane.getSelectedComponent().equals(m_Dtbook_AsciiMath_text_muunnos))
setAsciiMathScrollPane_JAsciiMathTextArea();
else
if (jTabbedPane.getSelectedComponent().equals(m_Dtbook_AsciiMath_xml_muunnos))
setAsciiMathScrollPane_UnModiedDtbookJAsciiMathTextArea();
*?
}
public void focusLost(FocusEvent e)
{
e.getSource();
}
});
*/
jTabbedPane.addChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent e)
{
//System.out.println(e.getSource().getClass().getName());
//System.out.println(jTabbedPane.getSelectedIndex());
int selIndex = jTabbedPane.getSelectedIndex();
if (selIndex == 0)
{
//??? setAsciiMathScrollPane_JAsciiMathTextArea();
//jMessageLabel.setText("Modified file: " + jDtbookTextField.getText());
jSelected_AsciiMathTextArea = jAsciiMathTextArea;
selected_jDtbookTextField = jDtbookTextField;
}
if (selIndex == 1)
{
jSelected_AsciiMathTextArea = jXmlAsciiMathTextArea;
selected_jDtbookTextField = jDtbookTextField2;
}
if (selIndex == 2)
{
jSelected_AsciiMathTextArea = jConvertTextArea;
selected_jDtbookTextField = jDtbookTextFieldConvert;
}
// if (selIndex == 2)
}});
//getJInputOutPutPanel2();
}
return jTabbedPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
}
return jPanel;
}
/**
* This method initializes jWarningTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getWarningTextArea() {
if (jWarningTextArea == null) {
jWarningTextArea = new JTextArea();
jWarningTextArea.setText("");
//jWarningTextArea.setForeground(Color.BLACK);
//jWarningTextArea.setEnabled(false);
jWarningTextArea.setEnabled(true);
jWarningTextArea.setFocusable(true);
jWarningTextArea.setEditable(false);
// jWarningTextArea.setAutoscrolls(true);
// jWarningTextArea.setPreferredSize(new java.awt.Dimension(1071, 255));
//jWarningTextArea.setPreferredSize(new java.awt.Dimension(1065, 255));
jWarningTextArea.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
//m_WarningTextAreaCaretLoopEvent = true;
//Get the location in the text
if (m_WarningTextAreaCaretLoopEvent)
{
return;
}
if (jWarningTextArea.getText().length() == 0)
return;
int dot = e.getDot();
int mark = e.getMark();
if (dot == mark) { // no selection
try {
//Rectangle caretCoords = jWarningTextArea.modelToView(dot);
//System.out.println("jWarningTextArea.getLineOfOffset='" +jWarningTextArea.getLineOfOffset(dot)+"'");
int iSelectedLineNumber = jWarningTextArea.getLineOfOffset(dot);
int iStartOfiSelectedLineNumber = jWarningTextArea.getLineStartOffset(iSelectedLineNumber);
int iEndOfiSelectedLineNumber = jWarningTextArea.getLineEndOffset(iSelectedLineNumber);
//String strSelectedRow = jWarningTextArea.getText(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber);
String strSelectedRow = jWarningTextArea.getText().substring(iStartOfiSelectedLineNumber);
/*
System.out.println("iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber +
"\n");
*/
if (m_WARNINGS_DATA_TYPE == WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS)
{
final String strRowSearch = "row:";
int indRow = strSelectedRow.indexOf(strRowSearch);
int iRowLen = strSelectedRow.length();
if (indRow == 0 && iRowLen > 0)
{
// try {
int ind = (indRow + strRowSearch.length());
int indChar = ind;
while (strSelectedRow.charAt(ind) == '\n')
ind++;
while (strSelectedRow.charAt(ind) == ' ')
ind++;
while (strSelectedRow.charAt(indChar) != '\n')
indChar++;
if (indChar > (iRowLen-1))
indChar = iRowLen -1;
String strRowNumber = strSelectedRow.substring(ind, indChar);
String strAsciiMathValue = "";
int iRowNumber = new Integer(strRowNumber);
int indNextRow = strSelectedRow.indexOf(strRowSearch,
(strRowSearch.length()-1));
if (indNextRow == -1)
indNextRow = iRowLen -1;
strSelectedRow = strSelectedRow.substring(0, indNextRow);
final String strSearchColumn = "column:";
int indColumn = strSelectedRow.indexOf(strSearchColumn);
String strColumn = null;
int iColumn = 1;
if (indColumn > -1)
{
strColumn = strSelectedRow.substring(indColumn +strSearchColumn.length());
ind = 0;
while (strColumn.charAt(ind) == ' ')
ind++;
indChar = 0;
while (strColumn.charAt(indChar) != '\n')
indChar++;
strColumn = strColumn.substring(ind, indChar);
iColumn = new Integer(strColumn);
//System.out.println("strColumn='" + strColumn +"'");
}
final String strSearchAsciiMath = "AsciiMath:";
int indAsciiMath = strSelectedRow.indexOf(strSearchAsciiMath);
String strAsciiMath = null;
if (indAsciiMath > -1)
{
strAsciiMath = strSelectedRow.substring(indAsciiMath +strSearchAsciiMath.length());
ind = 0;
while (strAsciiMath.charAt(ind) == '\n')
ind++;
while (strAsciiMath.charAt(ind) == ' ')
ind++;
indChar = ind;
while (strAsciiMath.charAt(indChar) != '\n')
indChar++;
strAsciiMath = strAsciiMath.substring(ind, indChar);
strAsciiMathValue = strAsciiMath;
//System.out.println("AsciiMath='" + strAsciiMath +"'");
}
//Caret caret = jWarningTextArea.getCaret();
jWarningTextArea.setCaretColor(Color.BLUE);
m_WarningTextAreaCaretLoopEvent = true;
/* Thread thread = new RunAbel(){
public run
}
*/
jWarningTextArea.select(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber+1);
setAsciiMathScrollPane_UnModiedDtbookJAsciiMathTextArea();
/*
if ()
jSelected_AsciiMathTextArea.setSelectionStart(selectionStart)
jSelected_AsciiMathTextArea.setLocation(arg0, arg1)
*/
if (m_iPrev_iRowNumber != -1 && iRowNumber < m_iPrev_iRowNumber)
{
jUnModiedDtbookOfAsciiMathTextArea.moveCaretPosition(0);
jUnModiedDtbookOfAsciiMathTextArea.paint(jUnModiedDtbookOfAsciiMathTextArea.getGraphics());
try {
Thread.sleep(100);
} catch(Exception te){
}
}
// selectUnModifiedTextArea(iRowNumber, iColumn, strAsciiMathValue);
selectAsciiMathTextArea(iRowNumber, iColumn, strAsciiMathValue);
m_iPrev_iRowNumber = iRowNumber;
//jWarningTextArea.requestFocus();
/*
} catch (Exception e2){
e2.printStackTrace();
}
*/
}
}
else
if (m_WARNINGS_DATA_TYPE == WARNINGS_DATA_TYPE.ASCIIMATHRULE_IN_WARNINGS)
{
String strRowSearch = "row =";
int indRow = strSelectedRow.indexOf(strRowSearch);
String strConsSearchColumn = "column =";
if (indRow == -1)
{
strRowSearch = "row:";
strConsSearchColumn = "column:";
indRow = strSelectedRow.indexOf(strRowSearch);
}
int iRowLen = strSelectedRow.length();
// ddddd
if (indRow > -1 && iRowLen > 0)
{
// try {
int ind = (indRow + strRowSearch.length());
int indChar = ind;
while (strSelectedRow.charAt(ind) == '\n')
ind++;
while (strSelectedRow.charAt(ind) == ' ')
ind++;
while (strSelectedRow.charAt(indChar) != '\n')
indChar++;
if (indChar > (iRowLen-1))
indChar = iRowLen -1;
String strRowNumber = strSelectedRow.substring(ind, indChar);
String strAsciiMathValue = "";
int iRowNumber = new Integer(strRowNumber);
int indNextRow = strSelectedRow.indexOf(strRowSearch,
(strRowSearch.length()-1));
if (indNextRow == -1)
indNextRow = iRowLen -1;
strSelectedRow = strSelectedRow.substring(0, indNextRow);
final String strSearchColumn = strConsSearchColumn;
int indColumn = strSelectedRow.indexOf(strSearchColumn);
String strColumn = null;
int iColumn = 1;
if (indColumn > -1)
{
strColumn = strSelectedRow.substring(indColumn +strSearchColumn.length());
ind = 0;
while (strColumn.charAt(ind) == ' ')
ind++;
indChar = 0;
while (strColumn.charAt(indChar) != '\n')
indChar++;
strColumn = strColumn.substring(ind, indChar);
iColumn = new Integer(strColumn);
//System.out.println("strColumn='" + strColumn +"'");
}
//Caret caret = jWarningTextArea.getCaret();
jWarningTextArea.setCaretColor(Color.BLUE);
m_WarningTextAreaCaretLoopEvent = true;
/* Thread thread = new RunAbel(){
public run
}
*/
jWarningTextArea.select(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber+1);
setAsciiMathScrollPane_UnModiedDtbookJAsciiMathTextArea();
/*
if ()
jSelected_AsciiMathTextArea.setSelectionStart(selectionStart)
jSelected_AsciiMathTextArea.setLocation(arg0, arg1)
*/
if (m_iPrev_iRowNumber != -1 && iRowNumber < m_iPrev_iRowNumber)
{
jUnModiedDtbookOfAsciiMathTextArea.moveCaretPosition(0);
jUnModiedDtbookOfAsciiMathTextArea.paint(jUnModiedDtbookOfAsciiMathTextArea.getGraphics());
try {
Thread.sleep(100);
} catch(Exception te){
}
}
// selectUnModifiedTextArea(iRowNumber, iColumn, strAsciiMathValue);
selectAsciiMathTextArea(iRowNumber, iColumn, strAsciiMathValue);
m_iPrev_iRowNumber = iRowNumber;
//jWarningTextArea.requestFocus();
/*
} catch (Exception e2){
e2.printStackTrace();
}
*/
}
}
else
if (m_WARNINGS_DATA_TYPE == WARNINGS_DATA_TYPE.CHARCONVERSIONWARNINGS_IN_WARNINGS)
{
final String strRowSearch = "row:";
int indRow = strSelectedRow.indexOf(strRowSearch);
int iRowLen = strSelectedRow.length();
if (indRow == 0 && iRowLen > 0)
{
int ind = (indRow + strRowSearch.length());
int indChar = ind;
while (strSelectedRow.charAt(ind) == '\n')
ind++;
while (strSelectedRow.charAt(ind) == ' ')
ind++;
while (strSelectedRow.charAt(indChar) != '\n')
indChar++;
if (indChar > (iRowLen-1))
indChar = iRowLen -1;
String strRowNumber = strSelectedRow.substring(ind, indChar);
String strAsciiMathValue = "";
int iRowNumber = new Integer(strRowNumber.trim());
int indNextRow = strSelectedRow.indexOf(strRowSearch,
(strRowSearch.length()-1));
if (indNextRow == -1)
indNextRow = iRowLen -1;
strSelectedRow = strSelectedRow.substring(0, indNextRow);
final String strSearchColumn = "column:";
int indColumn = strSelectedRow.indexOf(strSearchColumn);
String strColumn = null;
int iColumn = 1;
if (indColumn > -1)
{
strColumn = strSelectedRow.substring(indColumn +strSearchColumn.length());
ind = 0;
while (strColumn.charAt(ind) == ' ')
ind++;
indChar = 0;
while (strColumn.charAt(indChar) != '\n')
indChar++;
strColumn = strColumn.substring(ind, indChar);
iColumn = new Integer(strColumn.trim());
//System.out.println("strColumn='" + strColumn +"'");
}
//Caret caret = jWarningTextArea.getCaret();
jWarningTextArea.setCaretColor(Color.BLUE);
m_WarningTextAreaCaretLoopEvent = true;
/* Thread thread = new RunAbel(){
public run
}
*/
jWarningTextArea.select(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber+1);
setAsciiMathScrollPane_UnModiedDtbookJAsciiMathTextArea();
/*
if ()
jSelected_AsciiMathTextArea.setSelectionStart(selectionStart)
jSelected_AsciiMathTextArea.setLocation(arg0, arg1)
*/
if (m_iPrev_iRowNumber == -1 || (m_iPrev_iRowNumber != -1 && iRowNumber <= m_iPrev_iRowNumber))
{
jUnModiedDtbookOfAsciiMathTextArea.moveCaretPosition(0);
jUnModiedDtbookOfAsciiMathTextArea.paint(jUnModiedDtbookOfAsciiMathTextArea.getGraphics());
try {
Thread.sleep(100);
} catch(Exception te){
}
}
// selectAsciiMathTextArea(iRowNumber, iColumn, strAsciiMathValue);
if (iColumn > 0)
iColumn = iColumn -1;
selectUnModifiedTextArea(iRowNumber, iColumn, strAsciiMathValue);
m_iPrev_iRowNumber = iRowNumber;
//jWarningTextArea.requestFocus();
/*
} catch (Exception e2){
e2.printStackTrace();
}
*/
}
/*
sb.append("" +iItems +":\n");
sb.append("row: " + arrblok[i].getRow()+"\n");
sb.append("column: " + arrblok[i].getColumn()+"\n");
sb.append("position: " + arrblok[i].getIndFound()+"\n");
sb.append("position end: " + arrblok[i].getIndFoundEnd()+"\n");
if (arrblok[i].isStrikesChecked())
*/
}
/*
//Convert it to view coordinates
System.out.println("caret: text position: " + dot +
?*
", view location = [" +
caretCoords.x + ", " + caretCoords.y + "]" +
*?
"\n");
*/
} catch (BadLocationException ble) {
System.out.println(ble.getMessage());
System.out.println("caret: text position: " + dot + "\n");
}
} else if (dot < mark) {
//System.out.println("selection from: " + dot + " to " + mark + "\n");
} else {
//System.out.println("selection from: " + mark + " to " + dot + "\n");
}
m_WarningTextAreaCaretLoopEvent = false;
}
});
}
return jWarningTextArea;
}
private void
selectAsciiMathTextArea(int iSelectedLineNumber, int iColumn, String strAsciiMathValue)
throws BadLocationException
{
HashMap<String, List<AsciiMathBlockValue>> hmAsciiMath = m_dtBook2asciimath.getAsciiMathHashMap();
if (hmAsciiMath == null)
return;
List<AsciiMathBlockValue> lineList = hmAsciiMath.get("" +iSelectedLineNumber);
if (lineList == null)
return;
AsciiMathBlockValue asciimathValue = lineList.get(0);
if (lineList.size() > 1)
{
int max = lineList.size();
AsciiMathBlockValue tmp_asciimathValue;
for(int i = 0 ; i < max; i++)
{
tmp_asciimathValue = lineList.get(i);
if (tmp_asciimathValue == null )
continue;
if (tmp_asciimathValue.getColumn() == iColumn)
{
asciimathValue = tmp_asciimathValue;
break;
}
}
}
jUnModiedDtbookOfAsciiMathTextArea.setFocusable(true);
jUnModiedDtbookOfAsciiMathTextArea.requestFocus();
jUnModiedDtbookOfAsciiMathTextArea.setAutoscrolls(true);
int iStartOfiSelectedLineNumber = -1;
//iStartOfiSelectedLineNumber = jSelected_AsciiMathTextArea.getLineStartOffset(iSelectedLineNumber-1);
iStartOfiSelectedLineNumber = jUnModiedDtbookOfAsciiMathTextArea.getLineStartOffset(iSelectedLineNumber-1);
int iEndOfiSelectedLineNumber = jUnModiedDtbookOfAsciiMathTextArea.getLineEndOffset(iSelectedLineNumber-1);
iEndOfiSelectedLineNumber = iEndOfiSelectedLineNumber - iStartOfiSelectedLineNumber;
int selectStart = iStartOfiSelectedLineNumber +iColumn + "<span class=\"asciimath\">".length();
if (selectStart < 0)
selectStart = iStartOfiSelectedLineNumber +iColumn;
jUnModiedDtbookOfAsciiMathTextArea.moveCaretPosition(selectStart);
jUnModiedDtbookOfAsciiMathTextArea.select( selectStart /* iStartOfiSelectedLineNumber +iColumn */,
(iStartOfiSelectedLineNumber + iEndOfiSelectedLineNumber));
/*
System.out.println("mehod selectAsciiMathTextArea: " +jSelected_AsciiMathTextArea.getLineCount());
System.out.println("iSelectedLineNumber=" + iSelectedLineNumber + " icolumn= " + iColumn);
System.out.println("mehod selectAsciiMathTextArea:");
strAsciiMathValue = asciimathValue.getAsciiMathValue();
int iStartOfiSelectedLineNumber = -1;
//iStartOfiSelectedLineNumber = jSelected_AsciiMathTextArea.getLineStartOffset(iSelectedLineNumber);
iStartOfiSelectedLineNumber = jSelected_AsciiMathTextArea.getLineStartOffset(iSelectedLineNumber);
//asciimathValue.getIndEndofStartBlock();
String strSelectedRow = jSelected_AsciiMathTextArea.getText().substring(iStartOfiSelectedLineNumber);
int indFound = strSelectedRow.indexOf(strAsciiMathValue);
if (indFound == -1)
iStartOfiSelectedLineNumber = asciimathValue.getIndEndofStartBlock();
else
iStartOfiSelectedLineNumber = indFound;
if (iStartOfiSelectedLineNumber == -1)
{
iStartOfiSelectedLineNumber = asciimathValue.getIndFound();
strSelectedRow = jSelected_AsciiMathTextArea.getText();
}
// jSelected_AsciiMathTextArea.getLineStartOffset((iSelectedLineNumber-1));
//int iEndOfiSelectedLineNumber = jSelected_AsciiMathTextArea.getLineEndOffset(iSelectedLineNumber-1) - iStartOfiSelectedLineNumber;
int iEndOfiSelectedLineNumber = asciimathValue.getIndFoundEnd() - iStartOfiSelectedLineNumber;
System.out.println("asciimathValue.getIndAsciiMathBlockEnds() " + asciimathValue.getIndAsciiMathBlockEnds());
System.out.println("iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber + "\n");
strSelectedRow = strSelectedRow.substring(iStartOfiSelectedLineNumber);
int indLF = 0;
int len = strSelectedRow.length();
while(indLF < len && strSelectedRow.charAt(indLF) != '\n')
indLF++;
/*
strSelectedRow = strSelectedRow.substring(0, indLF);
*/
/*
int indSpan = strSelectedRow.indexOf("</span>");
if (indSpan > -1)
iEndOfiSelectedLineNumber = iStartOfiSelectedLineNumber + indSpan;
else
System.out.println("strSelectedRow='" +strSelectedRow.substring(0, indLF) +"'");
*/
/*
jSelected_AsciiMathTextArea.setCaretColor(Color.BLUE);
//m_CaretLoopEvent = true;
iEndOfiSelectedLineNumber = iStartOfiSelectedLineNumber + indLF;
jSelected_AsciiMathTextArea.moveCaretPosition(iStartOfiSelectedLineNumber);
try {
Thread.sleep(200);
} catch(Exception e){
}
int iStartOfiSelectedLineNumberOfjAsciiMathTextArea = jSelected_AsciiMathTextArea.getLineStartOffset(iSelectedLineNumber-1);
int iEndOfiSelectedLineNumberOfjAsciiMathTextArea = jSelected_AsciiMathTextArea.getLineEndOffset(iSelectedLineNumber-1);
//jSelected_AsciiMathTextArea.select(iStartOfiSelectedLineNumberOfjAsciiMathTextArea +iColumn, (iStartOfiSelectedLineNumberOfjAsciiMathTextArea+indLF));
jSelected_AsciiMathTextArea.select(iStartOfiSelectedLineNumber, (iEndOfiSelectedLineNumber));
*/
/*
try { Thread.sleep(1000);
} catch(Exception e){
}
jSelected_AsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
jSelected_AsciiMathTextArea.getParent().paintAll(jSelected_AsciiMathTextArea.getParent().getGraphics());
*/
}
private void
selectUnModifiedTextArea(int iSelectedLineNumber, int iColumn, String strAsciiMathValue)
throws BadLocationException
{
jUnModiedDtbookOfAsciiMathTextArea.setFocusable(true);
jUnModiedDtbookOfAsciiMathTextArea.requestFocus();
jUnModiedDtbookOfAsciiMathTextArea.setAutoscrolls(true);
int iStartOfiSelectedLineNumber = -1;
//iStartOfiSelectedLineNumber = jSelected_AsciiMathTextArea.getLineStartOffset(iSelectedLineNumber-1);
iStartOfiSelectedLineNumber = jUnModiedDtbookOfAsciiMathTextArea.getLineStartOffset(iSelectedLineNumber-1);
int iEndOfiSelectedLineNumber = jUnModiedDtbookOfAsciiMathTextArea.getLineEndOffset(iSelectedLineNumber-1);
iEndOfiSelectedLineNumber = iEndOfiSelectedLineNumber - iStartOfiSelectedLineNumber;
int selectStart = iStartOfiSelectedLineNumber +iColumn;
if (selectStart < 0)
selectStart = 0;
jUnModiedDtbookOfAsciiMathTextArea.moveCaretPosition(selectStart);
jUnModiedDtbookOfAsciiMathTextArea.select( selectStart /* iStartOfiSelectedLineNumber +iColumn */,
(iStartOfiSelectedLineNumber + iEndOfiSelectedLineNumber));
}
/**
* This method initializes jCheckStructureDescriptionTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJCheckStructureDescriptionTextArea() {
if (jCheckStructureDescriptionTextArea == null) {
jCheckStructureDescriptionTextArea = new JTextArea();
}
return jCheckStructureDescriptionTextArea;
}
/**
* This method initializes jTextFieldMuokkaaMerkkeja
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldMuokkaaMerkkeja() {
if (jTextFieldAsciiMathPropertyFileName == null) {
jTextFieldAsciiMathPropertyFileName = new JTextField();
}
return jTextFieldAsciiMathPropertyFileName;
}
/**
* This method initializes jTextFieldMuokkaaMerkkeja
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldMuokkaaMerkkeja2() {
if (jTextFieldAsciiMathPropertyFileName2 == null) {
jTextFieldAsciiMathPropertyFileName2 = new JTextField();
}
return jTextFieldAsciiMathPropertyFileName2;
}
/**
* This method initializes jTextFieldMuokkaaMerkkeja
*
* @return javax.swing.JTextField
*/
private JTextField getJTextFieldMuokkaaMerkkejaConvert() {
if (jTextPropertyFileNameConvert == null) {
jTextPropertyFileNameConvert = new JTextField();
}
return jTextPropertyFileNameConvert;
}
/**
* This method initializes jButtonMuokkaaMerkkeja
*
* @return javax.swing.JButton
*/
private JButton getJButtonMuokkaaMerkkeja() {
if (jButtonRunProperties == null) {
jButtonRunProperties = new JButton();
//jButtonMuokkaaMerkkeja.setText("3. Valitse asetustiedosto (valinnainen)");
jButtonRunProperties.setText(m_3_valitse_asetustiedosto_valinnainen);
jButtonRunProperties.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
muokkaaMerkkeja();
}
});
;
}
return jButtonRunProperties;
}
/**
* This method initializes jButtonMuokkaaMerkkeja
*
* @return javax.swing.JButton
*/
private JButton getJButtonMuokkaaMerkkeja2() {
if (jButtonMuokkaaMerkkeja2 == null) {
jButtonMuokkaaMerkkeja2 = new JButton();
//jButtonMuokkaaMerkkeja2.setText("3. Valitse Muokkaa Merkkejä tiedosto (valinnainen)");
jButtonMuokkaaMerkkeja2.setText(m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
jButtonMuokkaaMerkkeja2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
muokkaaMerkkeja2();
}
});
;
}
return jButtonMuokkaaMerkkeja2;
}
/**
* This method initializes jButtonMuokkaaMerkkeja
*
* @return javax.swing.JButton
*/
private JButton getJButtonMuokkaaMerkkejaConvert() {
if (jButtonMuokkaaMerkkejaConvert == null) {
jButtonMuokkaaMerkkejaConvert = new JButton();
//jButtonMuokkaaMerkkejaConvert.setText("3. Valitse Muokkaa Merkkejä tiedosto (valinnainen)");
jButtonMuokkaaMerkkejaConvert.setText(m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
jButtonMuokkaaMerkkejaConvert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
muokkaaMerkkejaConvert();
}
});
;
}
return jButtonMuokkaaMerkkejaConvert;
}
// TODO:
private void muokkaaMerkkejaConvert()
{
if (propertyFileChooserConvert == null)
{
String p_value = jTextPropertyFileNameConvert.getText();
if (p_value == null || p_value.trim().length() == 0)
p_value = m_select_config_fileConvert;
propertyFileChooserConvert = new JFileChooser(m_select_config_fileConvert);
propertyFileChooserConvert.setDialogTitle(p_value);
propertyFileChooserConvert.setMultiSelectionEnabled(false);
propertyFileChooserConvert.setSelectedFile(new File(jTextPropertyFileNameConvert.getText())); }
int returnVal = propertyFileChooserConvert.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = propertyFileChooserConvert.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{ // seek 8
jMessageLabel.setText(m_selected_configfile_dosnot_exist +" " + file.getName());
jTextPropertyFileNameConvert.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_fileConvert +" " + file.getName());
jTextPropertyFileNameConvert.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu Muokkaa rivejä-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_muokkaa_riveja_tiedostoa);
}
}
/**
* This method initializes jCharEditorPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJCharEditorPanel() {
if (jCharEditorPanel == null) {
GridBagConstraints gridBagConstraints42 = new GridBagConstraints();
gridBagConstraints42.gridx = 0;
gridBagConstraints42.anchor = GridBagConstraints.WEST;
gridBagConstraints42.insets = new Insets(0, 7, 0, 0);
gridBagConstraints42.gridy = 25;
jHexaLabel = new JLabel();
//jHexaLabel.setText("Sama hexa-arvona:");
jHexaLabel.setText(m_sama_hexa_arvona);
GridBagConstraints gridBagConstraints32 = new GridBagConstraints();
gridBagConstraints32.fill = GridBagConstraints.BOTH;
gridBagConstraints32.gridy = 26;
gridBagConstraints32.weightx = 1.0;
gridBagConstraints32.gridx = 0;
GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
gridBagConstraints24.gridx = 0;
gridBagConstraints24.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints24.gridy = 1;
jEmptyLabel3 = new JLabel();
jEmptyLabel3.setText(" ");
GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
gridBagConstraints16.gridy = 0;
gridBagConstraints16.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints16.insets = new Insets(0, 5, 0, 0);
gridBagConstraints16.anchor = GridBagConstraints.NORTH;
gridBagConstraints16.gridx = 0;
jCharEditorPanel = new JPanel();
//jCharEditorPanel.setLayout(new GridBagLayout());
GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
gridBagConstraints22.gridx = 0;
gridBagConstraints22.fill = GridBagConstraints.BOTH;
gridBagConstraints22.gridheight = 1;
gridBagConstraints22.gridy = 9;
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.BOTH;
gridBagConstraints15.gridy = 10;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridx = 0;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.BOTH;
gridBagConstraints13.gridy = 2;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.weighty = 1.0;
gridBagConstraints13.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.anchor = GridBagConstraints.WEST;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 12;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.gridx = 0;
gridBagConstraints31.anchor = GridBagConstraints.WEST;
gridBagConstraints31.gridy = 8;
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.gridx = 0;
gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints14.anchor = GridBagConstraints.WEST;
gridBagConstraints14.gridy = 24;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.gridx = 0;
gridBagConstraints41.gridy = 17;
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.gridx = 0;
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.fill = GridBagConstraints.NONE;
gridBagConstraints12.insets = new Insets(0, 5, 0, 0);
gridBagConstraints12.gridy = 23;
jMuuttavamerkkiLabel = new JLabel();
//jMuuttavamerkkiLabel.setText("Muutettava merkki koodattuna html-muotoon:");
jMuuttavamerkkiLabel.setText(m_muutettava_merkki_koodattuna_html_muotoon);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.gridy = 3;
JLabel jEmpty1Label2 = new JLabel();
jEmpty1Label2.setText(" ");
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.gridy = 7;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.BOTH;
gridBagConstraints3.gridy = 6;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.gridx = 0;
gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = GridBagConstraints.WEST;
gridBagConstraints21.gridy = 5;
//jML4Label = new JLabel();
//jML4Label.setText("Anna ML4-tiedosto, jonne muunnos talletaan");
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 3;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.insets = new Insets(0, 5, 0, 0);
gridBagConstraints1.gridy = 2;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridy = 3;
gridBagConstraints.weightx = 0.0;
gridBagConstraints.gridwidth = 0;
gridBagConstraints.gridheight = 13;
gridBagConstraints.gridx = 0;
GridBagLayout gblayout = new GridBagLayout();
jCharEditorPanel.setLayout(gblayout);
jAnnamerkkiLabel = new JLabel(m_jAnnamerkkiLabel); // "Anna muutettava merkki: (Huom! Paina enteriä merki(e)n jälkeen, jos alimmaiset kentät eivät pysy ajantasalla muunnoksessa)");
jCharEditorPanel.add(jAnnamerkkiLabel, gridBagConstraints1);
jCharEditorPanel.add(getAnnamerkkiTextField(), gridBagConstraints);
jCharEditorPanel.add(jMuuttavamerkkiLabel, gridBagConstraints12);
jCharEditorPanel.add(getMuutettavamerkkiTextField(), gridBagConstraints14);
jCharEditorPanel.add(getJAnnamerkkiOhjeTextArea(), gridBagConstraints16);
//jCharEditorPanel.add(getJML4Button(), gridBagConstraints4);
jCharEditorPanel.add(jEmptyLabel3, gridBagConstraints24);
jCharEditorPanel.add(getJHexaTextField(), gridBagConstraints32);
jCharEditorPanel.add(jHexaLabel, gridBagConstraints42);
jCharEditorPanel.setBackground(asciiMathColor);
}
return jCharEditorPanel;
}
/**
* This method initializes jAnnamerkkiOhjeTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJAnnamerkkiOhjeTextArea() {
if (jAnnamerkkiOhjeTextArea == null) {
jAnnamerkkiOhjeTextArea = new JTextArea();
jAnnamerkkiOhjeTextArea.setEditable(false);
//Font font = new Font();
//jAnnamerkkiOhjeTextArea.setFont(font);
jAnnamerkkiOhjeTextArea.setText(m_jAnnamerkkiOhjeTextArea);
}
return jAnnamerkkiOhjeTextArea;
}
/**
* This method initializes jHexaTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJHexaTextField() {
if (jHexaTextField == null) {
jHexaTextField = new JTextField();
jHexaTextField.setEditable(false);
}
return jHexaTextField;
}
/**
* This method initializes jRuleSpaceCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJRuleSpaceCheckBox() {
if (jRuleSpaceCheckBox == null) {
jRuleSpaceCheckBox = new JCheckBox();
jRuleSpaceCheckBox.setBackground(asciiMathColor);
//jRuleSpaceCheckBox.setText("Välilyöntisääntö");
jRuleSpaceCheckBox.setText(m_valilyontisaanto);
jRuleSpaceCheckBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
//System.out.println("itemStateChanged()");
if (jRuleSpaceCheckBox.isSelected())
m_bSpaceRule = true;
else
m_bSpaceRule = false;
}
});
}
return jRuleSpaceCheckBox;
}
/**
* This method initializes jNumberRuleCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJNumberRuleCheckBox() {
if (jNumberRuleCheckBox == null) {
jNumberRuleCheckBox = new JCheckBox();
jNumberRuleCheckBox.setBackground(asciiMathColor);
//jNumberRuleCheckBox.setText("Desimaalisääntö");
jNumberRuleCheckBox.setText(m_Desimaalisaanto);
jNumberRuleCheckBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
//System.out.println("itemStateChanged()");
if (jNumberRuleCheckBox.isSelected())
m_bNumberRule = true;
else
m_bNumberRule = false;
}
});
}
return jNumberRuleCheckBox;
}
/**
* This method initializes jThousandNumberRuleCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJThousandNumberRuleCheckBox() {
if (jThousandNumberRuleCheckBox == null) {
jThousandNumberRuleCheckBox = new JCheckBox();
jThousandNumberRuleCheckBox.setBackground(asciiMathColor);
//jThousandNumberRuleCheckBox.setText("Tuhannetsääntö");
jThousandNumberRuleCheckBox.setText(m_tuhannetsaanto);
jThousandNumberRuleCheckBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
//System.out.println("itemStateChanged()");
if (jThousandNumberRuleCheckBox.isSelected())
m_bThousandNumberRule = true;
else
m_bThousandNumberRule = false;
}
});
}
return jThousandNumberRuleCheckBox;
}
/**
* This method initializes jReplaceRuleCheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJReplaceRuleCheckBox() {
if (jReplaceRuleCheckBox == null) {
jReplaceRuleCheckBox = new JCheckBox();
jReplaceRuleCheckBox.setBackground(asciiMathColor);
//jReplaceRuleCheckBox.setText("Korvaasääntö");
jReplaceRuleCheckBox.setText(m_korvaasaanto);
jReplaceRuleCheckBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
//System.out.println("itemStateChanged()");
if (jReplaceRuleCheckBox.isSelected())
m_bReplaceRule = true;
else
m_bReplaceRule = false;
}
});
}
return jReplaceRuleCheckBox;
}
/**
* This method initializes jPanelLanguage
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelLanguage() {
if (jPanelLanguage == null) {
FlowLayout flowLayout3 = new FlowLayout();
flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
jPanelLanguage = new JPanel();
labelSelectLanguage = new JLabel(m_valitse_kayttoliityma_kieli);
jPanelLanguage.setLayout(flowLayout3);
jPanelLanguage.setBackground(asciiMathColor);
jPanelLanguage.add(labelSelectLanguage, null);
jPanelLanguage.add(getJComboBoxLanguage(), null);
jPanelLanguage.add(getJCheckBoxWarnings(), null);
jPanelLanguage.add(getJCheckBoxPrintAsciMaths(), null);
jPanelLanguage.add(getJCheckBoxCheckStrikeErrors(), null);
jPanelLanguage.add(getJCheckBoxCorrectStrikeErrorsB());
}
return jPanelLanguage;
}
/**
* This method initializes jComboBoxLanguage
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxLanguage() {
if (jComboBoxLanguage == null)
{
jComboBoxLanguage = new JComboBox();
ComboValue [] arrLanguage = getArrGuiLanguages();
if (arrLanguage != null)
{
int max = arrLanguage.length;
for(int i = 0 ; i < max; i++)
{
if (arrLanguage[i] == null || arrLanguage[i].toString().length() == 0)
continue;
jComboBoxLanguage.addItem(arrLanguage[i]);
}
}
jComboBoxLanguage.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
ComboValue selectedLanguage = (ComboValue)jComboBoxLanguage.getSelectedItem();
if (selectedLanguage != null)
setGuiLanguage(jComboBoxLanguage, selectedLanguage);
}
});
jComboBoxLanguage.setSelectedIndex(m_iGuiLanguageIndex);
}
return jComboBoxLanguage;
}
/**
* @return
*/
private ComboValue [] getArrGuiLanguages()
{
// m_gui_user_languages
return m_arrComboValueGuiLanguages;
}
/**
* This method initializes jDialogLanguage
*
* @return javax.swing.JDialog
*/
private JDialog getJDialogLanguage() {
if (jDialogLanguage == null) {
jDialogLanguage = new JDialog();
jDialogLanguage.setSize(new Dimension(332, 80));
//jDialogLanguage.setTitle("Valitse käyttöliitymä kieli");
jDialogLanguage.setTitle(m_valitse_kayttoliityma_kieli);
jDialogLanguage.setContentPane(getJContentPaneLanguage());
}
return jDialogLanguage;
}
/**
* This method initializes jContentPaneDialogLanguage
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPaneLanguage() {
if (jContentPaneDialogLanguage == null) {
jContentPaneDialogLanguage = new JPanel();
jContentPaneDialogLanguage.setLayout(new BorderLayout());
jContentPaneDialogLanguage.add(getJComboBoxDialogLanguage(), BorderLayout.NORTH);
jContentPaneDialogLanguage.add(getJButtonDialogLanuageClose(), BorderLayout.CENTER);
}
return jContentPaneDialogLanguage;
}
/**
* This method initializes jComboBoxDialogLanguage
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxDialogLanguage() {
if (jComboBoxDialogLanguage == null) {
jComboBoxDialogLanguage = new JComboBox();
ComboValue [] arrLanguage = getArrGuiLanguages();
if (arrLanguage != null)
{
int max = arrLanguage.length;
for(int i = 0 ; i < max; i++)
{
if (arrLanguage[i] == null || arrLanguage[i].toString().length() == 0)
continue;
jComboBoxDialogLanguage.addItem(arrLanguage[i]);
}
}
jComboBoxDialogLanguage.setSelectedIndex(m_iGuiLanguageIndex);
}
return jComboBoxDialogLanguage;
}
/**
* This method initializes jButtonDialogLanuageClose
*
* @return javax.swing.JButton
*/
private JButton getJButtonDialogLanuageClose() {
if (jButtonDialogLanuageClose == null) {
jButtonDialogLanuageClose = new JButton();
//jButtonDialogLanuageClose.setText("Käyttöliitymäkielen valinta");
jButtonDialogLanuageClose.setText(m_kayttoliitymakielen_valinta);
jButtonDialogLanuageClose
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()");
JDialog dialog = getJDialogLanguage();
JComboBox combo = getJComboBoxDialogLanguage();
ComboValue selectedLanguage = (ComboValue)combo.getSelectedItem();
if (selectedLanguage != null)
setGuiLanguage(combo, selectedLanguage);
dialog.dispose();
}
});
}
return jButtonDialogLanuageClose;
}
/**
* @param callingJComboBox
* @param guiLanguage
*/
private void setGuiLanguage(JComboBox callingJComboBox, ComboValue guiLanguage)
{
m_guiLanguage = guiLanguage.getIndexValue();
m_iGuiLanguageIndex = callingJComboBox.getSelectedIndex();
if (jComboBoxDialogLanguage != null && callingJComboBox.equals(jComboBoxDialogLanguage)
&& m_iGuiLanguageIndex != jComboBoxLanguage.getSelectedIndex() )
{
jComboBoxLanguage.setSelectedIndex(m_iGuiLanguageIndex);
return;
}
else
if (jComboBoxDialogLanguage != null && callingJComboBox.equals(jComboBoxLanguage)
&& m_iGuiLanguageIndex != jComboBoxDialogLanguage.getSelectedIndex())
{
jComboBoxDialogLanguage.setSelectedIndex(m_iGuiLanguageIndex);
return;
}
try {
if (!m_bOnLoadTimeOfApplication)
loadGuiComponentTextValues();
} catch(Exception e){
m_logger.severe(e.getMessage());
e.printStackTrace();
}
}
/**
* This method initializes jCheckBoxWarnings
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxWarnings() {
if (jCheckBoxWarnings == null) {
jCheckBoxWarnings = new JCheckBox();
jCheckBoxWarnings.setBackground(asciiMathColor);
jCheckBoxWarnings.setText(m_muunnoksen_varoitukset);
}
return jCheckBoxWarnings;
}
/**
* This method initializes jCheckBoxPrintAsciMaths
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getJCheckBoxPrintAsciMaths() {
if (jCheckBoxPrintAsciMaths == null) {
jCheckBoxPrintAsciMaths = new JCheckBox();
jCheckBoxPrintAsciMaths.setBackground(asciiMathColor);
jCheckBoxPrintAsciMaths.setText(m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan);
}
return jCheckBoxPrintAsciMaths;
}
/**
* The main method, where gui applicaiton is starting.
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//Locale fin = new Locale("fi", "FI");
//Locale.setDefault(fin);
// get user-home value
m_strUserHome = System.getProperty("user.home");
// set logger isntance and used logger file
final String cnstConsoleHandlerLevel = "java.util.logging.ConsoleHand" +
"ler.level";
if (System.getProperty(cnstConsoleHandlerLevel) == null)
System.setProperty(cnstConsoleHandlerLevel, "NONE");
final String loggerProperties = "dtbook2ml4logger.properties";
final String cnstLoggerFile = "java.util.logging.config.file";
if (System.getProperty(cnstLoggerFile) == null)
System.setProperty(cnstLoggerFile, loggerProperties);
try {
String logFileName = "GUIDtbookAsciiMath.log";
if (m_strUserHome != null)
logFileName = m_strUserHome + File.separator + logFileName;
Handler fh = new FileHandler(logFileName);
Logger.getAnonymousLogger().addHandler(fh);
m_logger = Logger.getAnonymousLogger();
m_logger.addHandler(fh);
m_logger.info("GUIDtbookAsciiMath application is starting");
// if user-home exists, set used user own property file, where
// are user specific values at the next start time
if (m_strUserHome != null)
m_strDtBookAsciiMathPropertyFileName = m_strUserHome + File.separator
+ cnstAsciiMathPropertyFileName;
// read asciimath property file
if (m_strDtBookAsciiMathPropertyFileName != null)
{
File f = new File(m_strDtBookAsciiMathPropertyFileName);
if (! f.exists() )
{
m_strDtBookAsciiMathPropertyFileName = null;
String path = ".";
if (args.length == 1)
{
path = args[0];
}
m_strDtBookAsciiMathPropertyFileName = path + File.separator
+ cnstAsciiMathPropertyFileName;
f = new File(m_strDtBookAsciiMathPropertyFileName);
if (! f.exists() )
m_strDtBookAsciiMathPropertyFileName = null;
else
{
m_logger.info("Founded an asciimath-property file: " + m_strDtBookAsciiMathPropertyFileName);
System.out.println("Founded an asciimath-property file:: " + m_strDtBookAsciiMathPropertyFileName);
}
}
else
{
m_logger.info("Founded an asciimath-property file from user-home: asciimath-property olemassa: " + m_strDtBookAsciiMathPropertyFileName);
System.out.println("Founded an asciimath-property file from user-home" + m_strDtBookAsciiMathPropertyFileName);
}
}
} catch (IOException ioe){
ioe.printStackTrace();
printStackTraceIntoLogger(m_logger, ioe, true);
}
/*
UIManager.put
("FileChooser.lookInLabelText", m_select_directory);
UIManager.put
("FileChooser.filesOfTypeLabelText",
m_fileTypeText);
UIManager.put
("FileChooser.upFolderToolTipText",
m_directory_up);
UIManager.put
("FileChooser.fileNameLabelText",
m_fileName);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.homeFolderToolTipText",
m_homeDirLabel);
UIManager.put
("FileChooser.newFolderToolTipText",
m_createNewDir);
UIManager.put
("FileChooser.listViewButtonToolTipText",
m_ListText);
UIManager.put
("FileChooser.detailsViewButtonToolTipText",
m_detaljText);
UIManager.put
("FileChooser.fileTypeHeaderText",
m_typeText);
UIManager.put
("FileChooser.filesOfTypeLabelText",
m_typeText);
UIManager.put
("FileChooser.fileSizeHeaderText",
m_sizeText);
UIManager.put
("FileChooser.openButtonText",
m_OpenText);
UIManager.put
("FileChooser.cancelButtonText",
m_cancel);
UIManager.put
("FileChooser.newFolderErrorText",
m_errorOfCreatingDir);
*/
/*
FileChooser.openDialogTitleText JFileChooser The text on the title bar (open dialog) Open
FileChooser.saveDialogTitleText JFileChooser The text on the title bar (save dialog) Save
FileChooser.lookInLabelText JFileChooser The text for the label in front of the folder selection box (open dialog) ä 1 Look In:
FileChooser.saveInLabelText JFileChooser The text for the label in front of the folder selection box (save dialog) ä 1 Save In:
FileChooser.upFolderToolTipText JFileChooser The tooltip of the button for navigating to the parent folder ä 2 Up One Level
FileChooser.homeFolderToolTipText JFileChooser The tooltip of the button for navigating to the home folder ä 3 Desktop
FileChooser.newFolderToolTipText JFileChooser The tooltip of the button used to create a new folder ä 4 Create New Folder
FileChooser.listViewButtonToolTipText JFileChooser The tooltip of the button for switching to list view ä 5 List
FileChooser.detailsViewButtonToolTipText JFileChooser The tooltip of the button for switching to detailed view ä 6 Details
FileChooser.fileNameHeaderText JFileChooser The text placed on the header column displaying the file name in the detailed view ä 7 Name
FileChooser.fileSizeHeaderText JFileChooser The text placed on the header column displaying the file size in the detailed view ä 8 Size
FileChooser.fileTypeHeaderText JFileChooser The text placed on the header column displaying the file type in the detailed view ä 9 Type
JFileChooser The text placed on the header column displaying the last modified date of the file in the detailed view ä 10 Date FileChooser.fileAttrHeaderText JFileChooser The text placed on the header column displaying the file attributes in the detailed view Attributes
FileChooser.fileNameLabelText JFileChooser The text of the label in front of the textfield containing the selected file name ä 11 File Name:
FileChooser.filesOfTypeLabelText JFileChooser The text for the label in front of the filter selection box ä 12 Files of Type:
FileChooser.openButtonText JFileChooser The text on the button used to select the file on an open type dialog ä 13 Open
FileChooser.openButtonToolTipText JFileChooser The tooltip text for the button used to select the file on an open type dialog ä 13 Open selected file
FileChooser.saveButtonText JFileChooser The text on the button used to select the file on a save type dialog ä 13 Save
FileChooser.saveButtonToolTipText JFileChooser The tooltip text for the button used to select the file on a save type dialog ä 13 Save selected file
FileChooser.directoryOpenButtonText JFileChooser The text on the button used to open a folder while browsing ä 13 Save
FileChooser.directoryOpenButtonToolTipText JFileChooser The tooltip text for the button used to open a folder while browsing ä 13 Save selected file
FileChooser.cancelButtonText JFileChooser The text on the button used to cancel the file selection dialog ä 14 Cancel
FileChooser.cancelButtonToolTipText JFileChooser The tooltip text for the button used to cancel the file selection dialog ä 14 Abort file chooser dialog
FileChooser.updateButtonText JFileChooser
FileChooser.updateButtonToolTipText JFileChooser
FileChooser.helpButtonText JFileChooser
FileChooser.helpButtonToolTipText JFileChooser
FileChooser.newFolderErrorText JFileChooser The error text to appear when an error occurs while creating a new folder Error creating new folder
*/
// invoke swing appplication here
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GuiDtbook2AsciiMath application = new GuiDtbook2AsciiMath();
application.setAsciiMathPropertyFileName(m_strDtBookAsciiMathPropertyFileName);
application.getJFrame().setVisible(true);
}
});
}
/**
* @param logger
* @param err
* @param bSystemPrintln
*/
private static void
printStackTraceIntoLogger(Logger logger,
Exception err,
boolean bSystemPrintln )
//throws UnsupportedEncodingException
{
try {
boolean autoFlush = true;
StringWriter out = new StringWriter();
PrintWriter ps = new PrintWriter(out, autoFlush);
err.printStackTrace(ps);
String value = out.toString();
if (logger != null)
logger.severe(value);
if (bSystemPrintln)
System.err.println(value);
} catch (Exception e) {
//skip
}
}
/**
* @param iFrame_Height
* @param iFrame_Width
*/
private void saveWindowSize(int iFrame_Height, int iFrame_Width)
{
m_userhomeProperties.setProperty("frame_Height", "" +iFrame_Height);
m_userhomeProperties.setProperty("frame_Width", "" +iFrame_Width);
}
/**
* @param locationX
* @param locationY
*/
private void saveWindowLocation(double locationX, double locationY)
{
m_userhomeProperties.setProperty("frame_locationY", "" +locationY);
m_userhomeProperties.setProperty("frame_locationX", "" +locationX);
}
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
private JFrame getJFrame() {
if (jFrame == null) {
init();
jFrame = new JFrame();
// Event Handling
jFrame.addComponentListener(new ComponentAdapter()
{
public void componentResized(ComponentEvent e)
{
JFrame tmp = (JFrame)e.getSource();
int tmp_m_iFrame_Width = tmp.getWidth();
int tmp_m_iFrame_Height = tmp.getHeight();
if (tmp_m_iFrame_Width != m_iFrame_Width)
saveWindowSize(tmp_m_iFrame_Height, tmp_m_iFrame_Width);
else
if (tmp_m_iFrame_Height != m_iFrame_Height)
saveWindowSize(tmp_m_iFrame_Height, tmp_m_iFrame_Width);
}
public void componentMoved(ComponentEvent e)
{
JFrame tmp = (JFrame)e.getSource();
Point tmp_location = tmp.getLocation();
if (tmp_location.getX() != m_frame_location.getX() ||
tmp_location.getY() != m_frame_location.getY())
saveWindowLocation(tmp_location.getX(), tmp_location.getY());
}
});
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setJMenuBar(getJJMenuBar());
if (m_iFrame_Width == 0 || m_iFrame_Height == 0)
jFrame.setSize(1081, 686);
else
jFrame.setSize(m_iFrame_Width, m_iFrame_Height);
Point loc = jFrame.getLocation();
if (m_frame_location_x == 0.0 || m_frame_location_y == 0.0)
;
else
{
//loc.translate(m_frame_location_x.intValue(), m_frame_location_y.intValue());
jFrame.setLocation(new Point(m_frame_location_x.intValue(), m_frame_location_y.intValue()));
}
jFrame.setTitle("DtBookAsciiMath");
jFrame.setContentPane(getJContentPane());
jFrame.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
//System.out.println("windowClosing()");
if (!storePropertiesToUserHome())
return;
System.exit(0);
}
});
if (strErrorMsg != null)
jMessageLabel.setText(strErrorMsg);
setUIControlsAfterSettings();
}
m_bOnLoadTimeOfApplication = false;
return jFrame;
}
/**
*
*/
private void setUIControlsAfterSettings()
{
jTextFieldAsciiMathPropertyFileName.setText(m_asciimathPropertyFileName);
jTextFieldAsciiMathPropertyFileName2.setText(m_asciimathPropertyFileName2);
jTextPropertyFileNameConvert.setText(m_PropertyConvert);
/*
jPageNumCheckBox.setSelected(true);
if (value_PageNumCheckBox != null)
{
if (value_PageNumCheckBox.equals(""))
jPageNumCheckBox.setSelected(false);
}
pageNumCheckBoxClicked();
*/
if (m_strError != null)
{
String msg = m_strError;
if (m_errorContext != null)
msg = m_errorContext + "\n\n" +m_strError;
this.jMessageLabel.setText(m_strError);
JOptionPane.showMessageDialog(jFrame,
msg,
m_error_Occured,
JOptionPane.ERROR_MESSAGE);
}
}
/**
* Is called under initializing the application
*/
private void init()
{
try {
// user home property file values
if (m_strUserHome != null)
{
File userHomeFile = new File(m_strUserHome);
if (userHomeFile.exists() && userHomeFile.isDirectory())
{
userHomeFilePropertyFile = new File(m_strUserHome + File.separator + csntDtBookAsciiMathUserFileName);
try {
FileInputStream fis = new FileInputStream(userHomeFilePropertyFile);
m_userhomeProperties.load(fis);
fis.close();
m_strOpenInApplication = m_userhomeProperties.getProperty(cnst_OpenInApplication);
m_strOpenInApplication2 = m_userhomeProperties.getProperty(cnst_OpenInApplication2);
m_strOpenInApplicationConvert = m_userhomeProperties.getProperty(cnst_OpenInApplication_convert);
String user_guilanguage = m_userhomeProperties.getProperty(cnst_Flag_Language);
if (user_guilanguage != null && user_guilanguage.trim().length() != 0)
m_guiLanguage = user_guilanguage;
else
{
String guilanguage = m_asciiMathProperties.getProperty(cnst_Flag_Language);
if (guilanguage != null && guilanguage.trim().length() != 0)
m_guiLanguage = guilanguage;
}
String tmp_asciimathPropertyFileName = m_userhomeProperties.getProperty(cnstAsciiMathProperty, "");
if (/* m_asciimathPropertyFileName == null
&& */ tmp_asciimathPropertyFileName != null
&& tmp_asciimathPropertyFileName.trim().length() != 0)
m_asciimathPropertyFileName = tmp_asciimathPropertyFileName;
String tmp_asciimathPropertyFileName2 = m_userhomeProperties.getProperty(cnstAsciiMathProperty2, "");
if (/* m_asciimathPropertyFileName == null
&& */ tmp_asciimathPropertyFileName2 != null
&& tmp_asciimathPropertyFileName2.trim().length() != 0)
m_asciimathPropertyFileName2 = tmp_asciimathPropertyFileName2;
String tmp_PropertyFileNameConvert = m_userhomeProperties.getProperty(cnstPropertyConvert, "");
if (/* tmp_PropertyConvert == null
&& */ tmp_PropertyFileNameConvert != null
&& tmp_PropertyFileNameConvert.trim().length() != 0)
m_PropertyConvert = tmp_PropertyFileNameConvert;
} catch (Exception e){
String msg = e.getMessage();
if (msg != null
&& !(msg.contains("cannot find the file")
|| msg.contains("Määritettyä tiedostoa ei läydy")))
{
e.printStackTrace();
strErrorMsg = e.getMessage();
}
}
}
/*
try {
m_dtBook2asciimath = new DtBookAsciiMath(m_logger, strUserHome);
m_dtBook2asciimath.setLogger(m_logger);
} catch(Exception e) {
e.printStackTrace();
}
*/
}
// read comon property values
String tmp_frame_height = m_userhomeProperties.getProperty("frame_Height");
if (tmp_frame_height != null && tmp_frame_height.trim().length() != 0)
{
m_iFrame_Height = new Integer(tmp_frame_height);
}
String tmp_frame_Width = m_userhomeProperties.getProperty("frame_Width");
if (tmp_frame_Width != null && tmp_frame_Width.trim().length() != 0)
{
m_iFrame_Width = new Integer(tmp_frame_Width);
}
String tmp_frame_location_y = m_userhomeProperties.getProperty("frame_locationY");
if (tmp_frame_location_y != null && tmp_frame_location_y.trim().length() != 0)
{
m_frame_location_y = new Double(tmp_frame_location_y);
}
String tmp_frame_location_x = m_userhomeProperties.getProperty("frame_locationX");
if (tmp_frame_location_x != null && tmp_frame_location_x.trim().length() != 0)
{
m_frame_location_x = new Double(tmp_frame_location_x);
}
if (m_asciimathPropertyFileName == null || m_asciimathPropertyFileName.trim().length() == 0)
m_asciimathPropertyFileName = "./" + cnstAsciiMathPropertyFileName;
/*
if (m_asciimathPropertyFileName2 == null || m_asciimathPropertyFileName2.trim().length() == 0)
m_asciimathPropertyFileName2 = "./" + cnstAsciiMathPropertyFileName2;
*/
try {
loadConfigFile();
} catch(Exception e){
m_asciimathPropertyFileName = "./" + cnstAsciiMathPropertyFileName;
//m_asciimathPropertyFileName2 = "./" + cnstAsciiMathPropertyFileName2;
loadConfigFile();
}
String strHideRuleTab = m_asciiMathProperties.getProperty(cnst_HideRuleTab, "").toLowerCase();
if ( strHideRuleTab != null && strHideRuleTab.trim().length() != 0
&& (strHideRuleTab.equals("true") || strHideRuleTab.equals("false")))
{
m_bHideRuleTab = Boolean.valueOf(strHideRuleTab);
}
String strGui_user_languages = m_asciiMathProperties.getProperty(cnst_Flag_gui_user_languages, "");
if ( strGui_user_languages != null && strGui_user_languages.trim().length() != 0)
{
m_gui_user_languages = strGui_user_languages.split(" ");
}
if (m_gui_user_languages == null || m_gui_user_languages.length == 0)
m_gui_user_languages = new String[] { "fi_FI" };
String strGui_user_languages_text = m_asciiMathProperties.getProperty(cnst_Flag_gui_user_languages_text, "");
if ( strGui_user_languages_text != null && strGui_user_languages_text.trim().length() != 0)
{
m_gui_user_languages_text = strGui_user_languages_text.split(" ");
}
if (m_gui_user_languages_text == null || m_gui_user_languages_text.length == 0)
m_gui_user_languages_text = new String[] { "Suomi" };
String gui_language = m_asciiMathProperties.getProperty(cnst_Flag_Language, "");
if (m_guiLanguage == null && gui_language != null && gui_language.trim().length() != 0)
m_guiLanguage = gui_language;
m_dtBook2asciimath = new DtBookAsciiMath(m_logger, m_strUserHome);
m_dtBook2asciimath.setLogger(m_logger);
createGuiLanaguageComboValues();
loadGuiComponentTextValues();
} catch(Exception e) {
e.printStackTrace();
m_strError = e.getMessage();
}
}
/**
*
*/
private void createGuiLanaguageComboValues()
{
int size_array = m_gui_user_languages.length;
int size_text_array = m_gui_user_languages_text.length;
boolean bSizes_are_same = (size_text_array == size_array);
if (size_text_array != size_array)
m_logger.severe("The language data: Sizes of gui_user_languages (" + size_array
+") and gui_user_languages_text (" +size_text_array +" are different! "
+"Check configuration of the application!");
m_arrComboValueGuiLanguages = new ComboValue [size_array];
String strGui_user_language, strGui_user_language_text;
for(int i = 0 ; i < size_array; i++)
{
strGui_user_language = null;
if (bSizes_are_same || !(size_text_array < size_array) )
{
strGui_user_language = m_gui_user_languages[i];
strGui_user_language_text = m_gui_user_languages_text[i];
m_arrComboValueGuiLanguages[i] = new ComboValue (strGui_user_language_text,
strGui_user_language, i);
}
else
{
if (!(size_text_array > size_array) && i < size_text_array)
{
strGui_user_language = m_gui_user_languages[i];
strGui_user_language_text = m_gui_user_languages_text[i];
m_arrComboValueGuiLanguages[i] = new ComboValue (strGui_user_language_text,
strGui_user_language, i);
}
else
{
strGui_user_language = m_gui_user_languages[i];
m_arrComboValueGuiLanguages[i] = new ComboValue (strGui_user_language,
strGui_user_language, i);
}
}
if (strGui_user_language != null && strGui_user_language.equals(m_guiLanguage))
m_iGuiLanguageIndex = i;
}
}
/**
* This method loads components text (label) values after changing
* gui language.
* @throws FileNotFoundException
* @throws IOException
*/
private void loadGuiComponentTextValues()
throws FileNotFoundException, IOException
{
currentLocale = getCurrentLocale(m_guiLanguage);
//if (m_languagePropertyFileName != null && m_languagePropertyFileName.trim().length() != 0)
//{
m_errorContext = "To try open Gui-config file: AsciiMathLanguage" ;
try {
Locale.setDefault(currentLocale);
resourcebundle =
ResourceBundle.getBundle("AsciiMathLanguage", currentLocale);
} catch(Exception e){
m_logger.severe(e.getLocalizedMessage());
e.printStackTrace();
m_logger.info("Default resourcebundles will try to load:");
resourcebundle =
ResourceBundle.getBundle("AsciiMathLanguage");
m_logger.info("Default resourcebundles loaded");
}
//}
String local_avaa_dtbook_tiedosto_sovelluksessa = resourcebundle.getString(cnstProperty_avaa_dtbook_tiedosto_sovelluksessa);
if (local_avaa_dtbook_tiedosto_sovelluksessa != null && local_avaa_dtbook_tiedosto_sovelluksessa.trim().length() != 0)
{
m_avaa_dtbook_tiedosto_sovelluksessa = local_avaa_dtbook_tiedosto_sovelluksessa;
}
String local_changedFile = resourcebundle.getString(cnstProperty_changedFile);
if (local_changedFile != null && local_changedFile.trim().length() != 0)
{
m_changedFile = local_changedFile;
}
String local_pagenumber = resourcebundle.getString(cnstProperty_pagenumber);
if (local_pagenumber != null && local_pagenumber.trim().length() != 0)
{
m_pagenumber = local_pagenumber;
}
m_pagenumberConvert = m_pagenumber;
String local_afterbrowsercall = resourcebundle.getString(cnstProperty_afterbrowsercall);
if (local_afterbrowsercall != null && local_afterbrowsercall.trim().length() != 0)
{
m_afterbrowsercall = local_afterbrowsercall;
}
String local_possible_reasons_are = resourcebundle.getString(cnstProperty_possible_reasons_are);
if (local_possible_reasons_are != null && local_possible_reasons_are.trim().length() != 0)
{
m_possible_reasons_are = local_possible_reasons_are;
}
String local_browser_exec_problem_reason_1 = resourcebundle.getString(cnstProperty_browser_exec_problem_reason_2);
if (local_browser_exec_problem_reason_1 != null && local_browser_exec_problem_reason_1.trim().length() != 0)
{
m_browser_exec_problem_reason_2 = local_browser_exec_problem_reason_1;
}
String local_Select_1_rule_before_execution = resourcebundle.getString(cnstProperty_Select_1_rule_before_execution);
if (local_Select_1_rule_before_execution != null && local_Select_1_rule_before_execution.trim().length() != 0)
{
m_Select_1_rule_before_execution = local_Select_1_rule_before_execution;
}
String local_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan = resourcebundle.getString(cnstProperty_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
if (local_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan != null && local_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan.trim().length() != 0)
{
m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan = local_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan;
}
String local_cnstjAnnamerkkiOhjeTextArea = resourcebundle.getString(cnstProperty_jAnnamerkkiOhjeTextArea);
if (local_cnstjAnnamerkkiOhjeTextArea != null && local_cnstjAnnamerkkiOhjeTextArea.trim().length() != 0)
{
File fHelp = new File(local_cnstjAnnamerkkiOhjeTextArea);
FileInputStream fHelpStream = new FileInputStream(fHelp);
BufferedReader input = new BufferedReader
(new InputStreamReader(fHelpStream, "UTF-8"));
String line;
StringBuffer sb = new StringBuffer ();
while ((line = input.readLine()) != null) {
//System.out.println(line);
sb.append(line +"\n");
}
input.close();
if (sb.length() > 0)
m_jAnnamerkkiOhjeTextArea = sb.toString();
}
String local_1Valitse_muokattava_Dtbook_asiakirja = resourcebundle.getString(cnstProperty_1Valitse_muokattava_Dtbook_asiakirja);
if (local_1Valitse_muokattava_Dtbook_asiakirja != null && local_1Valitse_muokattava_Dtbook_asiakirja.trim().length() != 0)
{
m_1Valitse_muokattava_Dtbook_asiakirja = local_1Valitse_muokattava_Dtbook_asiakirja;
}
String local_selected_file = resourcebundle.getString(cnstProperty_selected_file);
if (local_selected_file != null && local_selected_file.trim().length() != 0)
{
m_selected_file = local_selected_file;
m_selected_fileConvert = local_selected_file;
}
String local_selected_file2 = resourcebundle.getString(cnstProperty_selected_file2);
if (local_selected_file2 != null && local_selected_file2.trim().length() != 0)
{
m_selected_file2 = local_selected_file2;
}
String local_anna_muokattava_Dtbook_asiakirja = resourcebundle.getString(cnstProperty_Anna_muokattava_Dtbook_asiakirja);
if (local_anna_muokattava_Dtbook_asiakirja != null && local_anna_muokattava_Dtbook_asiakirja.trim().length() != 0)
{
m_Anna_muokattava_Dtbook_asiakirja = local_anna_muokattava_Dtbook_asiakirja;
}
String local_muunnoksen_varoitukset = resourcebundle.getString(cnstProperty_muunnoksen_varoitukset);
if (local_muunnoksen_varoitukset != null && local_muunnoksen_varoitukset.trim().length() != 0)
{
m_muunnoksen_varoitukset = local_muunnoksen_varoitukset;
}
String local_WarningsOrErrors = resourcebundle.getString(cnstProperty_WarningsOrErrors);
if (local_WarningsOrErrors != null && local_WarningsOrErrors.trim().length() != 0)
{
m_WarningsOrErrors = local_WarningsOrErrors;
}
String local_jAnnamerkkiLabel = resourcebundle.getString(cnstProperty_jAnnamerkkiLabel);
if (local_jAnnamerkkiLabel != null && local_jAnnamerkkiLabel.trim().length() != 0)
{
m_jAnnamerkkiLabel = local_jAnnamerkkiLabel;
}
String local_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan = resourcebundle.getString(cnstProperty_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan);
if (local_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan != null && local_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan.trim().length() != 0)
{
m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan = local_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan;
}
String local_convertWarnings2WarningsPanel = resourcebundle.getString(cnstProperty_convertCharCodes2WarningsPanel);
if (local_convertWarnings2WarningsPanel != null && local_convertWarnings2WarningsPanel.trim().length() != 0)
{
m_convertCharCodes2WarningsPanel = local_convertWarnings2WarningsPanel;
}
String local_ConvertContinueWithErrors = resourcebundle.getString(cnstProperty_ConvertContinueWithErrors);
if (local_ConvertContinueWithErrors != null && local_ConvertContinueWithErrors.trim().length() != 0)
{
m_ConvertContinueWithErrors = local_ConvertContinueWithErrors;
}
String local_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos = resourcebundle.getString(cnstProperty_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos);
if (local_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos != null && local_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos.trim().length() != 0)
{
m_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos = local_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos;
}
String local_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos = resourcebundle.getString(cnstProperty_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos);
if (local_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos != null && local_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos.trim().length() != 0)
{
m_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos = local_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos;
}
String local_4_suorita_asciimath_teksti_muunnos = resourcebundle.getString(cnstProperty_4_suorita_asciimath_teksti_muunnos);
if (local_4_suorita_asciimath_teksti_muunnos != null && local_4_suorita_asciimath_teksti_muunnos.trim().length() != 0)
{
m_4_suorita_asciimath_teksti_muunnos = local_4_suorita_asciimath_teksti_muunnos;
}
String local_4_suorita_asciimath_xml_muunnos = resourcebundle.getString(cnstProperty_4_suorita_asciimath_xml_muunnos);
if (local_4_suorita_asciimath_xml_muunnos != null && local_4_suorita_asciimath_xml_muunnos.trim().length() != 0)
{
m_4_suorita_asciimath_xml_muunnos = local_4_suorita_asciimath_xml_muunnos;
}
String local_4_suorita_asciimath_merkki_muunnos = resourcebundle.getString(cnstProperty_4_suorita_asciimath_merkki_muunnos);
if (local_4_suorita_asciimath_merkki_muunnos != null && local_4_suorita_asciimath_merkki_muunnos.trim().length() != 0)
{
m_4_suorita_asciimath_merkki_muunnos = local_4_suorita_asciimath_merkki_muunnos;
}
String local_avaa_sovelluksessa = resourcebundle.getString(cnstProperty_avaa_sovelluksessa);
if (local_avaa_sovelluksessa != null && local_avaa_sovelluksessa.trim().length() != 0)
{
m_avaa_sovelluksessa = local_avaa_sovelluksessa;
}
String local_valittua_sovellusta = resourcebundle.getString(cnstProperty_valittua_sovellusta);
if (local_valittua_sovellusta != null && local_valittua_sovellusta.trim().length() != 0)
{
m_valittua_sovellusta = local_valittua_sovellusta;
}
String local_valittua_sovellusta_ei_ole = resourcebundle.getString(cnstProperty_valittua_sovellusta_ei_ole);
if (local_valittua_sovellusta_ei_ole != null && local_valittua_sovellusta_ei_ole.trim().length() != 0)
{
m_valittua_sovellusta_ei_ole = local_valittua_sovellusta_ei_ole;
}
String local_ei_valittu_dtbook_tiedostoa = resourcebundle.getString(cnstProperty_ei_valittu_dtbook_tiedostoa);
if (local_ei_valittu_dtbook_tiedostoa != null && local_ei_valittu_dtbook_tiedostoa.trim().length() != 0)
{
m_ei_valittu_dtbook_tiedostoa = local_ei_valittu_dtbook_tiedostoa;
}
String local_ajossa = resourcebundle.getString(cnstProperty_ajossa);
if (local_ajossa != null && local_ajossa.trim().length() != 0)
{
m_ajossa = local_ajossa;
}
String local_talleta = resourcebundle.getString(cnstProperty_talleta);
if (local_talleta != null && local_talleta.trim().length() != 0)
{
m_talleta = local_talleta;
}
String local_tallettu = resourcebundle.getString(cnstProperty_tallettu);
if (local_tallettu != null && local_tallettu.trim().length() != 0)
{
m_tallettu = local_tallettu;
}
String local_vaihda_avaa_sovellus_toiseksi = resourcebundle.getString(cnstProperty_vaihda_avaa_sovellus_toiseksi);
if (local_vaihda_avaa_sovellus_toiseksi != null && local_vaihda_avaa_sovellus_toiseksi.trim().length() != 0)
{
m_vaihda_avaa_sovellus_toiseksi = local_vaihda_avaa_sovellus_toiseksi;
}
String local_ml4_kirjoitus_merkisto = resourcebundle.getString(cnstProperty_ml4_kirjoitus_merkisto);
if (local_ml4_kirjoitus_merkisto != null && local_ml4_kirjoitus_merkisto.trim().length() != 0)
{
m_ml4_kirjoitus_merkisto = local_ml4_kirjoitus_merkisto;
}
String local_dtbook_kirjoitus_merkisto = resourcebundle.getString(cnstProperty_dtbook_kirjoitus_merkisto);
if (local_dtbook_kirjoitus_merkisto != null && local_dtbook_kirjoitus_merkisto.trim().length() != 0)
{
m_dtbook_kirjoitus_merkisto = local_dtbook_kirjoitus_merkisto;
}
String local_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = resourcebundle.getString(cnstProperty_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
if (local_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 != null && local_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1.trim().length() != 0)
{
m_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = local_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1;
}
String local_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = resourcebundle.getString(cnstProperty_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
if (local_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 != null && local_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1.trim().length() != 0)
{
m_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1 = local_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1;
}
String local_3_valitse_asetustiedosto_valinnainen = resourcebundle.getString(cnstProperty_3_valitse_asetustiedosto_valinnainen);
if (local_3_valitse_asetustiedosto_valinnainen != null && local_3_valitse_asetustiedosto_valinnainen.trim().length() != 0)
{
m_3_valitse_asetustiedosto_valinnainen = local_3_valitse_asetustiedosto_valinnainen;
}
String local_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen = resourcebundle.getString(cnstProperty_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
if (local_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen != null && local_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen.trim().length() != 0)
{
m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen = local_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen;
}
String local_sama_hexa_arvona = resourcebundle.getString(cnstProperty_sama_hexa_arvona);
if (local_sama_hexa_arvona != null && local_sama_hexa_arvona.trim().length() != 0)
{
m_sama_hexa_arvona = local_sama_hexa_arvona;
}
String local_muutettava_merkki_koodattuna_html_muotoon = resourcebundle.getString(cnstProperty_muutettava_merkki_koodattuna_html_muotoon);
if (local_muutettava_merkki_koodattuna_html_muotoon != null && local_muutettava_merkki_koodattuna_html_muotoon.trim().length() != 0)
{
m_muutettava_merkki_koodattuna_html_muotoon = local_muutettava_merkki_koodattuna_html_muotoon;
}
String local_Select_file = resourcebundle.getString(cnstProperty_Select_file);
if (local_Select_file != null && local_Select_file.trim().length() != 0)
{
m_select_file = local_Select_file;
}
String local_Select_save_file = resourcebundle.getString(cnstProperty_Select_save_file);
if (local_Select_save_file != null && local_Select_save_file.trim().length() != 0)
{
m_select_save_file = local_Select_save_file;
}
String local_Select_save_file2 = resourcebundle.getString(cnstProperty_Select_save_file2);
if (local_Select_save_file2 != null && local_Select_save_file2.trim().length() != 0)
{
m_select_save_file2 = local_Select_save_file2;
}
/*
String local_anna_tiedosto_jonne_muunnos_talletaan = resourcebundle.getString(cnstProperty_anna_tiedosto_jonne_muunnos_talletaan);
if (local_anna_tiedosto_jonne_muunnos_talletaan != null && local_anna_tiedosto_jonne_muunnos_talletaan.trim().length() != 0)
{
m_anna_tiedosto_jonne_muunnos_talletaan = local_anna_tiedosto_jonne_muunnos_talletaan;
}
*/
String local_valilyontisaanto = resourcebundle.getString(cnstProperty_valilyontisaanto);
if (local_valilyontisaanto != null && local_valilyontisaanto.trim().length() != 0)
{
m_valilyontisaanto = local_valilyontisaanto;
}
String local_tuhannetsaanto = resourcebundle.getString(cnstProperty_tuhannetsaanto);
if (local_tuhannetsaanto != null && local_tuhannetsaanto.trim().length() != 0)
{
m_tuhannetsaanto = local_tuhannetsaanto;
}
String local_Desimaalisaanto = resourcebundle.getString(cnstProperty_Desimaalisaanto);
if (local_Desimaalisaanto != null && local_Desimaalisaanto.trim().length() != 0)
{
m_Desimaalisaanto = local_Desimaalisaanto;
}
String local_korvaasaanto = resourcebundle.getString(cnstProperty_korvaasaanto);
if (local_korvaasaanto != null && local_korvaasaanto.trim().length() != 0)
{
m_korvaasaanto = local_korvaasaanto;
}
String local_kayttoliitymakielen_valinta = resourcebundle.getString(cnstProperty_kayttoliitymakielen_valinta);
if (local_kayttoliitymakielen_valinta != null && local_kayttoliitymakielen_valinta.trim().length() != 0)
{
m_kayttoliitymakielen_valinta = local_kayttoliitymakielen_valinta;
}
String local_tiedosto = resourcebundle.getString(cnstProperty_tiedosto);
if (local_tiedosto != null && local_tiedosto.trim().length() != 0)
{
m_tiedosto = local_tiedosto;
}
String local_apua = resourcebundle.getString(cnstProperty_apua);
if (local_apua != null && local_apua.trim().length() != 0)
{
m_apua = local_apua;
}
String local_poistu_ohjelmasta = resourcebundle.getString(cnstProperty_poistu_ohjelmasta);
if (local_poistu_ohjelmasta != null && local_poistu_ohjelmasta.trim().length() != 0)
{
m_poistu_ohjelmasta = local_poistu_ohjelmasta;
}
String local_Ohjelmasta = resourcebundle.getString(cnstProperty_Ohjelmasta);
if (local_Ohjelmasta != null && local_Ohjelmasta.trim().length() != 0)
{
m_Ohjelmasta = local_Ohjelmasta;
}
String local_ohjelmasta_ja_sen_kaytasta = resourcebundle.getString(cnstProperty_ohjelmasta_ja_sen_kaytasta);
if (local_ohjelmasta_ja_sen_kaytasta != null && local_ohjelmasta_ja_sen_kaytasta.trim().length() != 0)
{
m_ohjelmasta_ja_sen_kaytasta = local_ohjelmasta_ja_sen_kaytasta;
}
String local_valitse_kayttoliityma_kieli = resourcebundle.getString(cnstProperty_valitse_kayttoliityma_kieli);
if (local_valitse_kayttoliityma_kieli != null && local_valitse_kayttoliityma_kieli.trim().length() != 0)
{
m_valitse_kayttoliityma_kieli = local_valitse_kayttoliityma_kieli;
}
String local_Muunnoksen_tiivistelma_varoitukset = resourcebundle.getString(cnstProperty_Muunnoksen_tiivistelma_varoitukset);
if (local_Muunnoksen_tiivistelma_varoitukset != null && local_Muunnoksen_tiivistelma_varoitukset.trim().length() != 0)
{
m_Muunnoksen_tiivistelma_varoitukset = local_Muunnoksen_tiivistelma_varoitukset;
}
String local_Muokkaa_merkkeja_html_editori = resourcebundle.getString(cnstProperty_Muokkaa_merkkeja_html_editori);
if (local_Muokkaa_merkkeja_html_editori != null && local_Muokkaa_merkkeja_html_editori.trim().length() != 0)
{
m_Muokkaa_merkkeja_html_editori = local_Muokkaa_merkkeja_html_editori;
}
String local_Dtbook_AsciiMath_text_muunnos = resourcebundle.getString(cnstProperty_Dtbook_AsciiMath_text_muunnos);
if (local_Dtbook_AsciiMath_text_muunnos != null && local_Dtbook_AsciiMath_text_muunnos.trim().length() != 0)
{
m_Dtbook_AsciiMath_text_muunnos = local_Dtbook_AsciiMath_text_muunnos;
}
String local_Dtbook_AsciiMath_xml_muunnos = resourcebundle.getString(cnstProperty_Dtbook_AsciiMath_xml_muunnos);
if (local_Dtbook_AsciiMath_xml_muunnos != null && local_Dtbook_AsciiMath_xml_muunnos.trim().length() != 0)
{
m_Dtbook_AsciiMath_xml_muunnos = local_Dtbook_AsciiMath_xml_muunnos;
}
String local_Dtbook_convert = resourcebundle.getString(cnstPropertyDtbook_convert);
if (local_Dtbook_convert != null && local_Dtbook_convert.trim().length() != 0)
{
m_Dtbook_convert = local_Dtbook_convert;
}
String local_ajetaan_sekamerkista_muunnosta = resourcebundle.getString(cnstProperty_ajetaan_sekamerkista_muunnosta);
if (local_ajetaan_sekamerkista_muunnosta != null && local_ajetaan_sekamerkista_muunnosta.trim().length() != 0)
{
m_ajetaan_sekamerkista_muunnosta = local_ajetaan_sekamerkista_muunnosta;
}
String local_ajetaan_muunnosta = resourcebundle.getString(cnstProperty_ajetaan_muunnosta);
if (local_ajetaan_muunnosta != null && local_ajetaan_muunnosta.trim().length() != 0)
{
m_ajetaan_muunnosta = local_ajetaan_muunnosta;
}
String local_executionStarted = resourcebundle.getString(cnstProperty_executionStarted);
if (local_executionStarted != null && local_executionStarted.trim().length() != 0)
{
m_executionStarted = local_executionStarted;
}
String local_target = resourcebundle.getString(cnstProperty_target);
if (local_target != null && local_target.trim().length() != 0)
{
m_target = local_target;
}
String local_charactersetConversionText = resourcebundle.getString(cnstProperty_charactersetConversionText);
if (local_charactersetConversionText != null && local_charactersetConversionText.trim().length() != 0)
{
m_charactersetConversionText = local_charactersetConversionText;
}
String local_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty = resourcebundle.getString(cnstProperty_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty);
if (local_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty != null && local_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty.trim().length() != 0)
{
m_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty = local_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty;
}
String local_file_is_directory = resourcebundle.getString(cnstProperty_file_is_directory);
if (local_file_is_directory != null && local_file_is_directory.trim().length() != 0)
{
m_file_is_directory = local_file_is_directory;
}
String local_inchanging = resourcebundle.getString(cnstProperty_inchanging);
if (local_inchanging != null && local_inchanging.trim().length() != 0)
{
m_inchanging = local_inchanging;
}
String local_runexecutedbutwarnings = resourcebundle.getString(cnstProperty_runexecutedbutwarnings);
if (local_runexecutedbutwarnings != null && local_runexecutedbutwarnings.trim().length() != 0)
{
m_runexecutedbutwarnings = local_runexecutedbutwarnings;
}
String local_correctedFile = resourcebundle.getString(cnstProperty_correctedFile);
if (local_correctedFile != null && local_correctedFile.trim().length() != 0)
{
m_correctedFile = local_correctedFile;
}
String local_correctStrikeErrors = resourcebundle.getString(cnstProperty_correctStrikeErrors);
if (local_correctStrikeErrors != null && local_correctStrikeErrors.trim().length() != 0)
{
m_correctStrikeErrors = local_correctStrikeErrors;
}
String local_no_existence_canceled = resourcebundle.getString(cnstProperty_no_existence_canceled);
if (local_no_existence_canceled != null && local_no_existence_canceled.trim().length() != 0)
{
m_no_existence_canceled = local_no_existence_canceled;
}
String local_missing_cfg_file_field = resourcebundle.getString(cnstProperty_missing_cfg_file_field);
if (local_missing_cfg_file_field != null && local_missing_cfg_file_field.trim().length() != 0)
{
m_missing_cfg_file_field = local_missing_cfg_file_field;
}
String local_dtbook_did_not_exists = resourcebundle.getString(cnstProperty_dtbook_did_not_exists);
if (local_dtbook_did_not_exists != null && local_dtbook_did_not_exists.trim().length() != 0)
{
m_dtbook_did_not_exists = local_dtbook_did_not_exists;
}
String local_select_dtbookFileName = resourcebundle.getString(cnstProperty_Select_dtbookFileName);
if (local_select_dtbookFileName != null && local_select_dtbookFileName.trim().length() != 0)
{
m_select_dtbookFileName = local_select_dtbookFileName;
}
String local_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty = resourcebundle.getString(cnstProperty_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty);
if (local_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty != null && local_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty.trim().length() != 0)
{
m_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty = local_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty;
}
String local_output = resourcebundle.getString(cnst_output);
if (local_output != null && local_output.trim().length() != 0)
{
m_output = local_output;
}
String local_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty = resourcebundle.getString(cnstProperty_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty);
if (local_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty != null && local_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty.trim().length() != 0)
{
m_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty = local_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty;
}
String local_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty = resourcebundle.getString(cnstProperty_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty);
if (local_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty != null && local_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty.trim().length() != 0)
{
m_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty = local_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty;
}
String local_muunnos_kaynnissa = resourcebundle.getString(cnstProperty_muunnos_kaynnissa);
if (local_muunnos_kaynnissa != null && local_muunnos_kaynnissa.trim().length() != 0)
{
m_muunnos_kaynnissa = local_muunnos_kaynnissa;
}
String local_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus = resourcebundle.getString(cnstProperty_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus);
if (local_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus != null && local_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus.trim().length() != 0)
{
m_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus = local_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus;
}
String local_ajo_valmis = resourcebundle.getString(cnstProperty_ajo_valmis);
if (local_ajo_valmis != null && local_ajo_valmis.trim().length() != 0)
{
m_ajo_valmis = local_ajo_valmis;
}
String local_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa = resourcebundle.getString(cnstProperty_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
if (local_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa != null && local_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa.trim().length() != 0)
{
m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa = local_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa;
}
String local_valittua_dtbook_tiedostoa = resourcebundle.getString(cnstProperty_valittua_dtbook_tiedostoa);
if (local_valittua_dtbook_tiedostoa != null && local_valittua_dtbook_tiedostoa.trim().length() != 0)
{
m_valittua_dtbook_tiedostoa = local_valittua_dtbook_tiedostoa;
}
String local_ei_valittu_ml4_tiedostoa = resourcebundle.getString(cnstProperty_ei_valittu_ml4_tiedostoa);
if (local_ei_valittu_ml4_tiedostoa != null && local_ei_valittu_ml4_tiedostoa.trim().length() != 0)
{
m_ei_valittu_ml4_tiedostoa = local_ei_valittu_ml4_tiedostoa;
}
String local_Selected_file_is_new = resourcebundle.getString(cnstProperty_selected_file_is_new);
if (local_Selected_file_is_new != null && local_Selected_file_is_new.trim().length() != 0)
{
m_selected_file_is_new = local_ei_valittu_ml4_tiedostoa;
}
String local_ei_valittu_muokkaa_riveja_tiedostoa = resourcebundle.getString(cnstProperty_ei_valittu_muokkaa_riveja_tiedostoa);
if (local_ei_valittu_muokkaa_riveja_tiedostoa != null && local_ei_valittu_muokkaa_riveja_tiedostoa.trim().length() != 0)
{
m_ei_valittu_muokkaa_riveja_tiedostoa = local_ei_valittu_muokkaa_riveja_tiedostoa;
}
String local_selected_configfile_dosnot_exist = resourcebundle.getString(cnstProperty_selected_configfile_dosnot_exist);
if (local_selected_configfile_dosnot_exist != null && local_selected_configfile_dosnot_exist.trim().length() != 0)
{
m_selected_configfile_dosnot_exist = local_selected_configfile_dosnot_exist;
}
String local_select_config_file = resourcebundle.getString(cnstProperty_select_config_file);
if (local_select_config_file != null && local_select_config_file.trim().length() != 0)
{
m_select_config_file = local_select_config_file;
}
String local_strDtbook = resourcebundle.getString(cnst_Properties_DtbokText);
if (local_strDtbook != null && local_strDtbook.trim().length() != 0)
{
m_strDtbokText = local_strDtbook;
}
String local_EDITDtbook = resourcebundle.getString(cnst_Properties_EDITDtbook);
if (local_EDITDtbook != null && local_EDITDtbook.trim().length() != 0)
{
m_EDITDtbook = local_EDITDtbook;
}
String local_m_jCheckBoxCheckStrikeErrors_label = resourcebundle.getString(cnst_Properties_jCheckBoxCheckStrikeErrors_label);
if (local_m_jCheckBoxCheckStrikeErrors_label != null && local_m_jCheckBoxCheckStrikeErrors_label.trim().length() != 0)
{
m_jCheckBoxCheckStrikeErrors_label = local_m_jCheckBoxCheckStrikeErrors_label;
}
String local_m_jCheckBoxCheckStrikeErrors = resourcebundle.getString(cnst_Properties_jCheckBoxCheckStrikeErrors);
if (local_m_jCheckBoxCheckStrikeErrors != null && local_m_jCheckBoxCheckStrikeErrors.trim().length() != 0)
{
m_jCheckBoxCheckStrikeErrors = local_m_jCheckBoxCheckStrikeErrors;
if (m_jCheckBoxCheckStrikeErrors != null
&& m_jCheckBoxCheckStrikeErrors.toLowerCase().equals("true"))
{
jCheckBoxCheckStrikeErrors.setSelected(true);
jCheckBoxCheckStrikeErrors2.setSelected(true);
}
}
String local_cancel = resourcebundle.getString(cnst_cancel);
if (local_cancel != null && local_cancel.trim().length() != 0)
m_cancel = local_cancel;
String local_errorOfCreatingDir = resourcebundle.getString(cnst_errorOfCreatingDir);
if (local_errorOfCreatingDir != null && local_errorOfCreatingDir.trim().length() != 0)
m_errorOfCreatingDir = local_errorOfCreatingDir;
String local_OpenText = resourcebundle.getString(cnst_OpenText);
if (local_OpenText != null && local_OpenText.trim().length() != 0)
m_OpenText = local_OpenText;
String local_directory_up = resourcebundle.getString(cnst_directory_up);
if (local_directory_up != null && local_directory_up.trim().length() != 0)
m_directory_up = local_directory_up;
String local_ListText = resourcebundle.getString(cnst_ListText);
if (local_ListText != null && local_ListText.trim().length() != 0)
m_ListText = local_ListText;
String local_sizeText = resourcebundle.getString(cnst_sizeText);
if (local_sizeText != null && local_sizeText.trim().length() != 0)
m_sizeText = local_sizeText;
String local_detaljText = resourcebundle.getString(cnst_detaljText);
if (local_detaljText != null && local_detaljText.trim().length() != 0)
m_detaljText = local_detaljText;
String local_createNewDir = resourcebundle.getString(cnst_createNewDir);
if (local_createNewDir != null && local_createNewDir.trim().length() != 0)
m_createNewDir = local_createNewDir;
String local_error_Occured = resourcebundle.getString(csnt_error_Occured);
if (local_error_Occured != null && local_error_Occured.trim().length() != 0)
m_error_Occured = local_error_Occured;
String local_unchangedFile = resourcebundle.getString(csnt_unchangedFile);
if (local_unchangedFile != null && local_unchangedFile.trim().length() != 0)
m_unchangedFile = local_unchangedFile;
String local_fileTypeText = resourcebundle.getString(cnst_fileTypeText);
if (local_fileTypeText != null && local_fileTypeText.trim().length() != 0)
m_fileTypeText = local_fileTypeText;
String local_fileName = resourcebundle.getString(cnst_fileName);
if (local_fileName != null && local_fileName.trim().length() != 0)
m_fileName = local_fileName;
String local_open_selected_file = resourcebundle.getString(cnst_open_selected_file);
if (local_open_selected_file != null && local_open_selected_file.trim().length() != 0)
m_open_selected_file = local_open_selected_file;
String local_select_directory = resourcebundle.getString(cnst_select_directory);
if (local_select_directory != null && local_select_directory.trim().length() != 0)
m_select_directory = local_select_directory;
String local_homeDirLabel = resourcebundle.getString(cnst_homeDirLabel);
if (local_homeDirLabel != null && local_homeDirLabel.trim().length() != 0)
m_homeDirLabel = local_homeDirLabel;
String local_filesOfTypeText = resourcebundle.getString(cnst_filesOfTypeText);
if (local_filesOfTypeText != null && local_filesOfTypeText.trim().length() != 0)
m_filesOfTypeText = local_filesOfTypeText;
// load hep text from a file
String local_cnst_gui_help_file = resourcebundle.getString(cnst_Properties_gui_help_file);
if (local_cnst_gui_help_file != null && local_cnst_gui_help_file.trim().length() != 0)
{
File fHelp = new File(local_cnst_gui_help_file);
System.out.println("fHelp=" + fHelp.getCanonicalPath());
FileInputStream fHelpStream = new FileInputStream(fHelp);
BufferedReader input = new BufferedReader
(new InputStreamReader(fHelpStream, "UTF-8"));
String line;
StringBuffer sb = new StringBuffer ();
while ((line = input.readLine()) != null) {
//System.out.println(line);
sb.append(line +"\n");
}
input.close();
if (sb.length() > 0)
m_gui_help = sb.toString();
}
UIManager.put
("FileChooser.lookInLabelText", m_select_directory);
UIManager.put
("FileChooser.filesOfTypeLabelText",
m_fileTypeText);
UIManager.put
("FileChooser.upFolderToolTipText",
m_directory_up);
UIManager.put
("FileChooser.fileNameLabelText",
m_fileName);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.openButtonToolTipText",
m_open_selected_file);
UIManager.put
("FileChooser.homeFolderToolTipText",
m_homeDirLabel);
UIManager.put
("FileChooser.newFolderToolTipText",
m_createNewDir);
UIManager.put
("FileChooser.listViewButtonToolTipText",
m_ListText);
UIManager.put
("FileChooser.detailsViewButtonToolTipText",
m_detaljText);
UIManager.put
("FileChooser.fileTypeHeaderText",
m_typeText);
UIManager.put
("FileChooser.filesOfTypeLabelText",
m_filesOfTypeText);
UIManager.put
("FileChooser.fileSizeHeaderText",
m_sizeText);
UIManager.put
("FileChooser.openButtonText",
m_OpenText);
UIManager.put
("FileChooser.cancelButtonText",
m_cancel);
UIManager.put
("FileChooser.newFolderErrorText",
m_errorOfCreatingDir);
// TODO: REMOVE TEST CODE:
if (dtbookFileChooser != null)
dtbookFileChooser.paintAll(dtbookFileChooser.getGraphics());
// TODO: REMOVE TEST CODE END
if (!m_bOnLoadTimeOfApplication)
{
setGuiTextValuesForComponents();
//jFrame.paintAll(jFrame.getGraphics());
}
}
/**
* called after user has been changed gui language (new label text vaulues)
*/
private void setGuiTextValuesForComponents()
{
jAsciiMathLabel.setText(m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
jAsciiMathButton.setText(m_2_valitse_kohde_tiedosto_jonne_talletetaan_muunnos);
jAsciiMathButton2.setText(m_2_valitse_dtbook_tiedosto_jonne_talletetaan_muunnos);
jExecuteButton2.setText(m_4_suorita_asciimath_xml_muunnos);
jExecuteButtonConvert.setText(m_4_suorita_asciimath_merkki_muunnos);
jExecuteButton.setText(m_4_suorita_asciimath_teksti_muunnos);
jOpenInEditorButton.setText(m_avaa_sovelluksessa);
jOpenInEditorButton2.setText(m_avaa_sovelluksessa);
jChangeApplicationCheckBox.setText(m_vaihda_avaa_sovellus_toiseksi);
jChangeApplicationCheckBox2.setText(m_vaihda_avaa_sovellus_toiseksi);
jChangeApplicationCheckBoxConvert.setText(m_vaihda_avaa_sovellus_toiseksi);
jWriteCharSetLabel.setText(m_ml4_kirjoitus_merkisto);
jWriteCharSetLabel2.setText(m_dtbook_kirjoitus_merkisto);
jMixedCharSetCheckBox.setText(m_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
jMixedCharSetCheckBox2.setText(m_dtbook_asiakirja_sisaltaa_sekamerkeja_utf_8_seka_iso_8859_1_ns_latin1);
jButtonRunProperties.setText(m_3_valitse_asetustiedosto_valinnainen);
jButtonMuokkaaMerkkeja2.setText(m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
jButtonMuokkaaMerkkejaConvert.setText(m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
jButtonMuokkaaMerkkejaConvert.setText(m_3_valitse_muokkaa_merkkeja_tiedosto_valinnainen);
jHexaLabel.setText(m_sama_hexa_arvona);
jAnnamerkkiLabel.setText(m_jAnnamerkkiLabel);
jMuuttavamerkkiLabel.setText(m_muutettava_merkki_koodattuna_html_muotoon);
jRuleSpaceCheckBox.setText(m_valilyontisaanto);
jThousandNumberRuleCheckBox.setText(m_tuhannetsaanto);
jDtBookButton.setText(m_1Valitse_muokattava_Dtbook_asiakirja);
jCheckBoxPrintAsciMaths.setText(m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan);
jCheckBoxPrintXmlAsciiStatements.setText(m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan);
jCheckBoxWarnings.setText(m_muunnoksen_varoitukset);
jTextAreaLabel.setText(m_strDtbokText);
jEditButton.setText(m_EDITDtbook);
jNumberRuleCheckBox.setText(m_Desimaalisaanto);
jReplaceRuleCheckBox.setText(m_korvaasaanto);
fileMenu.setText(m_tiedosto);
helpMenu.setText(m_apua);
exitMenuItem.setText(m_poistu_ohjelmasta);
aboutMenuItem.setText(m_ohjelmasta_ja_sen_kaytasta);
if (aboutDialog != null)
aboutDialog.setTitle(m_Ohjelmasta);
languageMenuItem.setText(m_valitse_kayttoliityma_kieli);
if (jDialogLanguage != null)
jDialogLanguage.setTitle(m_valitse_kayttoliityma_kieli);
if (labelSelectLanguage != null)
labelSelectLanguage.setText(m_valitse_kayttoliityma_kieli);
/*
if (m_bHideRuleTab)
getJPanelRuleTab();
else
jTabbedPane.addTab(m_Dtbook_AsciiMath_text_muunnos, null, getJPanelRuleTab(), null);
jTabbedPane.addTab(m_Dtbook_AsciiMath_xml_muunnos, null, getJPanelXmlAsciiMath(), null);
jTabbedPane.addTab(m_Dtbook_convert, null, getJPanelConvert(), null);
jTabbedPane.addTab(m_Muunnoksen_tiivistelma_varoitukset, getWarningContentPane());
jTabbedPane.addTab(m_Muokkaa_merkkeja_html_editori, null, getJPanelCharEditorPanel(), null);
*/
jTabbedPane.setTitleAt(m_indTab_Muunnoksen_tiivistelma_varoitukset, m_Muunnoksen_tiivistelma_varoitukset);
jTabbedPane.setTitleAt(m_indTab_Dtbook_convert, this.m_Dtbook_convert);
jTabbedPane.setTitleAt(m_indTab_Muokkaa_merkkeja_html_editori, m_Muokkaa_merkkeja_html_editori);
if (!m_bHideRuleTab)
jTabbedPane.setTitleAt(m_indTab_Dtbook_AsciiMath_text_muunnos, m_Dtbook_AsciiMath_text_muunnos);
jTabbedPane.setTitleAt(m_indTab_Dtbook_AsciiMath_xml_muunnos, m_Dtbook_AsciiMath_xml_muunnos);
if (jHelpTextArea != null)
jHelpTextArea.setText(m_gui_help);
jDtBookButton2.setText(m_1Valitse_muokattava_Dtbook_asiakirja);
jDtBookButton.setText(m_1Valitse_muokattava_Dtbook_asiakirja);
jAnnamerkkiOhjeTextArea.setText(m_jAnnamerkkiOhjeTextArea);
jInputLabel.setText(m_Anna_muokattava_Dtbook_asiakirja);
if (jInputLabel2 != null)
jInputLabel2.setText(m_Anna_muokattava_Dtbook_asiakirja);
jAsciiMathLabel2.setText(m_anna_toinen_dtbook_tiedosto_jonne_muunnos_talletaan);
jCheckBoxCheckStrikeErrors.setText(m_jCheckBoxCheckStrikeErrors_label);
jCheckBoxCheckStrikeErrors2.setText(m_jCheckBoxCheckStrikeErrors_label);
dtbookFileChooser = null;
dtbookFileChooser2 = null;
modifiedDtbookFileChooser = null;
modifiedDtbookFileChooser2 = null;
modifiedDtbookFileChooserConvert = null;
openInApplicationFileChooser = null;
openInApplicationFileChooser2 = null;
propertyFileChooser = null;
propertyFileChooser2 = null;
}
/**
* @param guiLanguage
* @return
*/
private Locale getCurrentLocale(String guiLanguage)
{
if (guiLanguage == null || guiLanguage.trim().length() == 0)
return Locale.getDefault();
return new Locale(guiLanguage);
}
/**
* @throws FileNotFoundException
* @throws IOException
*/
private void loadConfigFile()
throws FileNotFoundException, IOException
{
if (m_asciimathPropertyFileName != null && m_asciimathPropertyFileName.trim().length() != 0)
{
m_errorContext = "Try open a configfile : " + m_asciimathPropertyFileName;
FileReader fr = new FileReader(m_asciimathPropertyFileName);
m_asciiMathProperties.load(fr);
fr.close();
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
BorderLayout borderLayout = new BorderLayout();
borderLayout.setHgap(3);
borderLayout.setHgap(30);
borderLayout.setVgap(3);
borderLayout.setVgap(15);
jMessageLabel.setText(" ");
jContentPane = new JPanel();
jContentPane.setBackground(asciiMathColor);
jContentPane.setLayout(borderLayout);
jContentPane.setLayout(borderLayout);
jContentPane.setPreferredSize(new java.awt.Dimension(1073, 627));
//jContentPane.add(getJTabbedPane(), BorderLayout.NORTH); // gridBagConstraints13
jContentPane.add(getJTabbedPane(), BorderLayout.CENTER); // gridBagConstraints13
//jContentPane.add(getJInputOutPutPanel(), );
//jInputOutPutPanel.add(getJML4ScrollPane(), gridBagConstraints7);
//jContentPane.add(getJAsciiMathScrollPane());
jContentPane.add(getJPanel1(), BorderLayout.SOUTH);
String lastML4FileName = m_userhomeProperties.getProperty(cnst_lastModifiedDtbookFile, "");
if (lastML4FileName != null && lastML4FileName.trim().length() != 0)
{
jAsciiMathTextField.setText(lastML4FileName);
}
String lastML4FileName2 = m_userhomeProperties.getProperty(cnst_lastModifiedDtbookFile2, "");
if (lastML4FileName2 != null && lastML4FileName2.trim().length() != 0)
{
jAsciiMathTextField2.setText(lastML4FileName2);
}
String lastFileNameConvert = m_userhomeProperties.getProperty(cnst_lastModifiedDtbookFileconvert, "");
if (lastFileNameConvert != null && lastFileNameConvert.trim().length() != 0)
{
jAsciiMathTextFieldConvert.setText(lastFileNameConvert);
}
String strSpaceRule = m_userhomeProperties.getProperty(cnst_Flag_SpaceRule, "");
m_bSpaceRule = false;
if (strSpaceRule != null && strSpaceRule.trim().length() != 0)
{
if (strSpaceRule.equals("on"))
m_bSpaceRule = true;
}
jRuleSpaceCheckBox.setSelected(m_bSpaceRule);
String strNumberRule = m_userhomeProperties.getProperty(cnst_Flag_NumberRule, "");
m_bNumberRule = false;
if (strNumberRule != null && strNumberRule.trim().length() != 0)
{
if (strNumberRule.equals("on"))
m_bNumberRule = true;
}
jNumberRuleCheckBox.setSelected(m_bNumberRule);
String strThousandNumberRule = m_userhomeProperties.getProperty(cnst_Flag_ThousandRule, "");
m_bThousandNumberRule = false;
if (strThousandNumberRule != null && strThousandNumberRule.trim().length() != 0)
{
if (strThousandNumberRule.equals("on"))
m_bThousandNumberRule = true;
}
jThousandNumberRuleCheckBox.setSelected(m_bThousandNumberRule);
String strReplaceRule = m_userhomeProperties.getProperty(cnst_Flag_ReplaceRule, "");
m_bReplaceRule = false;
if ( strReplaceRule != null && strReplaceRule.trim().length() != 0)
{
if (strReplaceRule.equals("on"))
m_bReplaceRule = true;
}
jReplaceRuleCheckBox.setSelected(m_bReplaceRule);
String strPropLanguage = m_userhomeProperties.getProperty(cnst_Flag_Language, "");
if ( strPropLanguage != null && strPropLanguage.trim().length() != 0)
{
m_guiLanguage = strPropLanguage;
}
if (m_guiLanguage == null || m_guiLanguage.trim().length() == 0)
m_guiLanguage = "fi_FI";
jComboBoxLanguage.setSelectedItem(m_guiLanguage);
String strPropAsciiMathPropertyFileName = m_userhomeProperties.getProperty(cnstAsciiMathProperty, "");
if ( strPropAsciiMathPropertyFileName != null && strPropAsciiMathPropertyFileName.trim().length() != 0)
{
m_asciimathPropertyFileName = strPropAsciiMathPropertyFileName;
}
jComboBoxLanguage.setSelectedItem(m_guiLanguage);
String lastdtbookFileName = m_userhomeProperties.getProperty(cnst_lastdtbookfile, "");
if (lastdtbookFileName != null && lastdtbookFileName.trim().length() != 0)
{
jDtbookTextField.setText(lastdtbookFileName);
}
String lastdtbookFileName2 = m_userhomeProperties.getProperty(cnst_lastdtbookfile2, "");
if (lastdtbookFileName2 != null && lastdtbookFileName2.trim().length() != 0)
{
jDtbookTextField2.setText(lastdtbookFileName2);
}
String lastdtbookFileNameConvert = m_userhomeProperties.getProperty(cnst_lastdtbookfileconvert, "");
if (lastdtbookFileNameConvert != null && lastdtbookFileNameConvert.trim().length() != 0)
{
jDtbookTextFieldConvert.setText(lastdtbookFileNameConvert);
}
String lastModifiedDtbookFileconvert = m_userhomeProperties.getProperty(cnst_lastModifiedDtbookFileconvert, "");
if (lastModifiedDtbookFileconvert != null && lastModifiedDtbookFileconvert.trim().length() != 0)
{
jAsciiMathTextFieldConvert.setText(lastModifiedDtbookFileconvert);
}
jChangeApplicationCheckBox.setSelected(false);
jChangeApplicationCheckBox.setEnabled(false);
}
return jContentPane;
}
/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getJJMenuBar() {
if (jJMenuBar == null) {
jJMenuBar = new JMenuBar();
jJMenuBar.add(getFileMenu());
//jJMenuBar.add(getEditMenu());
jJMenuBar.add(getHelpMenu());
}
return jJMenuBar;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
if (fileMenu == null) {
fileMenu = new JMenu();
//fileMenu.setText("Tiedosto");
fileMenu.setText(m_tiedosto);
fileMenu.add(getLanguageMenuItem());
fileMenu.add(getExitMenuItem());
}
return fileMenu;
}
/*
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
/*
private JMenu getEditMenu() {
if (editMenu == null) {
editMenu = new JMenu();
editMenu.setText("Muokkaa");
editMenu.add(getCutMenuItem());
editMenu.add(getCopyMenuItem());
editMenu.add(getPasteMenuItem());
}
return editMenu;
}
*/
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getHelpMenu() {
if (helpMenu == null) {
helpMenu = new JMenu();
//helpMenu.setText("Apua");
helpMenu.setText(m_apua);
helpMenu.add(getAboutMenuItem());
}
return helpMenu;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExitMenuItem() {
if (exitMenuItem == null) {
exitMenuItem = new JMenuItem();
//exitMenuItem.setText("Poistu ohjelmasta");
exitMenuItem.setText(m_poistu_ohjelmasta);
exitMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
storePropertiesToUserHome();
jFrame.dispose();
// System.exit(0);
}
});
}
return exitMenuItem;
}
private boolean storePropertiesToUserHome()
{
try {
if (m_bTextAreaChanged)
{
saveTextArea(jAsciiMathTextArea.getText());
//if (!askIfUnsavedWillSaved())
//return false;
}
if (m_bTextAreaChangedConvert)
{
saveTextAreaConvert(jConvertTextArea.getText());
//if (!askIfUnsavedWillSaved())
//return false;
}
setSettingsIntoProperty();
FileOutputStream fos = new FileOutputStream(userHomeFilePropertyFile);
m_userhomeProperties.store(fos, "");
fos.close();
return true;
} catch (Exception e) {
e.printStackTrace();
jMessageLabel.setText(e.getMessage());
return true;
}
}
/**
* @return
*/
private boolean askIfUnsavedWillSaved()
{
return false;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getAboutMenuItem() {
if (aboutMenuItem == null) {
aboutMenuItem = new JMenuItem();
//aboutMenuItem.setText("Ohjelmasta ja sen käytästä...");
aboutMenuItem.setText(m_ohjelmasta_ja_sen_kaytasta);
aboutMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JDialog aboutDialog = getAboutDialog();
//aboutDialog.pack(); tata ei saa laittaa paalle, sellainen on getAboutDialog():ssa!
Point loc = getJFrame().getLocation();
loc.translate(20, 20);
aboutDialog.setLocation(loc);
aboutDialog.setVisible(true);
getAboutDialog().requestFocus();
int iStart = jHelpTextArea.getSelectionStart();
jHelpTextArea.select(iStart, iStart);
jHelpTextArea.setSelectionStart(iStart);
}
});
}
return aboutMenuItem;
}
/**
* This method initializes aboutDialog
*
* @return javax.swing.JDialog
*/
private JDialog getAboutDialog() {
if (aboutDialog == null) {
aboutDialog = new JDialog(getJFrame(), true);
aboutDialog.setTitle(m_Ohjelmasta);
aboutDialog.setSize(new Dimension(859, 357));
JScrollPane scrollpane = new JScrollPane(getAboutContentPane());
scrollpane.setAutoscrolls(false);
aboutDialog.setContentPane(scrollpane);
aboutDialog.setBounds(200, 200, 600, 600);
aboutDialog.setResizable(true);
Dimension preferredSize =
aboutDialog.getPreferredSize();
Double width = jFrame.getSize().width * 0.8;
preferredSize.width = width.intValue();
Double height = jFrame.getSize().height * 0.8;
preferredSize.height = height.intValue();
aboutDialog.pack();
aboutDialog.setMaximumSize(preferredSize);
aboutDialog.setMinimumSize(preferredSize);
aboutDialog.setSize(preferredSize.width, preferredSize.height);
scrollpane.getHorizontalScrollBar().setLocation(0, 0);
//.keyPress(java.awt.event.KeyEvent.VK_CONTROL);
//robot.keyPress(java.awt.event.KeyEvent.VK_END);
//robot.keyRelease(java.awt.event.KeyEvent.VK_END);
//robot.keyRelease(java.awt.event.KeyEvent.VK_CONTROL);
//aboutDialog.setm
}
return aboutDialog;
}
/**
* This method initializes aboutContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getAboutContentPane() {
if (aboutContentPane == null) {
BorderLayout borderLayout1 = new BorderLayout();
borderLayout1.setHgap(10);
borderLayout1.setVgap(10);
aboutContentPane = new JPanel();
aboutContentPane.setLayout(new BorderLayout());
aboutContentPane.setLayout(borderLayout1);
aboutContentPane.add(getJVersionPanel(), BorderLayout.NORTH);
aboutContentPane.add(getJHelpTextArea(), BorderLayout.CENTER);
}
return aboutContentPane;
}
/**
* This method initializes aboutVersionLabel
*
* @return javax.swing.JLabel
*/
private JLabel getAboutVersionLabel() {
if (aboutVersionLabel == null) {
aboutVersionLabel = new JLabel();
aboutVersionLabel.setText("DtBook2AsciiMath version 1.16");
aboutVersionLabel.setHorizontalAlignment(SwingConstants.CENTER);
}
return aboutVersionLabel;
}
/**
* This method initializes aboutVersionLabel
*
* @return javax.swing.JLabel
*/
private JLabel getCopyRigthLabel() {
if (jCopyRigthLabel == null) {
jCopyRigthLabel = new JLabel();
jCopyRigthLabel.setText("(c) Celia & Tuomas Kassila");
jCopyRigthLabel.setHorizontalAlignment(SwingConstants.CENTER);
}
return jCopyRigthLabel;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getLanguageMenuItem() {
if (languageMenuItem == null) {
languageMenuItem = new JMenuItem();
//languageMenuItem.setText("Valitse käyttöliitymä kieli...");
languageMenuItem.setText(m_valitse_kayttoliityma_kieli +"...");
languageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L,
Event.CTRL_MASK, true));
languageMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("selectDtBookFileName()");
selectUsedGuiLanguage();
}
});
}
return languageMenuItem;
}
/**
*
*/
private void selectUsedGuiLanguage()
{
JDialog dialog = getJDialogLanguage();
//aboutDialog.pack(); tata ei saa laittaa paalle, sellainen on getAboutDialog():ssa!
Point loc = getJFrame().getLocation();
loc.translate(20, 20);
dialog.setLocation(loc);
dialog.setVisible(true);
dialog.requestFocus();
}
/**
* saves property values into user home values
*/
private void setSettingsIntoProperty()
{
m_userhomeProperties.setProperty(cnst_lastdtbookfile, jDtbookTextField.getText());
m_userhomeProperties.setProperty(cnst_lastModifiedDtbookFile, this.jAsciiMathTextField.getText());
m_userhomeProperties.setProperty(cnst_lastdtbookfile2, jDtbookTextField2.getText());
m_userhomeProperties.setProperty(cnst_lastModifiedDtbookFile2, this.jAsciiMathTextField2.getText());
m_userhomeProperties.setProperty(cnst_lastdtbookfile2, jDtbookTextField2.getText());
m_userhomeProperties.setProperty(cnst_lastModifiedDtbookFile2, this.jAsciiMathTextField2.getText());
m_userhomeProperties.setProperty(cnst_lastdtbookfileconvert, this.jDtbookTextFieldConvert.getText());
m_userhomeProperties.setProperty(cnst_lastModifiedDtbookFileconvert, this.jAsciiMathTextFieldConvert.getText());
/*
properties.setProperty(cnst_nkl_muokkaariveja_cfg_file, this.jTextFieldMuokkaaMerkkeja.getText());
*/
if (m_strOpenInApplication == null)
m_strOpenInApplication = "";
if (m_strOpenInApplication2 == null)
m_strOpenInApplication2 = "";
m_userhomeProperties.setProperty(cnst_OpenInApplication2, (m_strOpenInApplication2 == null ? "": m_strOpenInApplication2));
m_userhomeProperties.setProperty(cnst_OpenInApplication, (m_strOpenInApplication == null ? "": m_strOpenInApplication));
m_userhomeProperties.setProperty(cnst_OpenInApplication_convert, (m_strOpenInApplicationConvert == null ? "": m_strOpenInApplicationConvert));
if (m_bSpaceRule)
m_userhomeProperties.setProperty(cnst_Flag_SpaceRule, "on");
else
m_userhomeProperties.setProperty(cnst_Flag_SpaceRule, "off");
m_userhomeProperties.setProperty(cnst_Flag_Language, m_guiLanguage);
if (m_bNumberRule)
m_userhomeProperties.setProperty(cnst_Flag_NumberRule, "on");
else
m_userhomeProperties.setProperty(cnst_Flag_NumberRule, "off");
if (m_bThousandNumberRule)
m_userhomeProperties.setProperty(cnst_Flag_ThousandRule, "on");
else
m_userhomeProperties.setProperty(cnst_Flag_ThousandRule, "off");
if (m_bReplaceRule)
m_userhomeProperties.setProperty(cnst_Flag_ReplaceRule, "on");
else
m_userhomeProperties.setProperty(cnst_Flag_ReplaceRule, "off");
m_userhomeProperties.setProperty(cnstAsciiMathProperty, jTextFieldAsciiMathPropertyFileName.getText());
m_userhomeProperties.setProperty(cnstAsciiMathProperty2, jTextFieldAsciiMathPropertyFileName2.getText());
m_userhomeProperties.setProperty(cnstPropertyConvert, jTextPropertyFileNameConvert.getText());
/*
if (bUnScriptedXmlStructureCheckBox)
properties.setProperty(DtBookAsciiMath.cnst_UnScriptedXmlStructureCheckBox, "paalla");
else
properties.setProperty(DtBookAsciiMath.cnst_UnScriptedXmlStructureCheckBox, "");
*/
}
/**
*
*/
private void executeDtbookAsciiMathConversion()
{
jWarningTextArea.setText("");
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHRULE_IN_WARNINGS;
if (!jRuleSpaceCheckBox.isSelected()
&& !jNumberRuleCheckBox.isSelected()
&& !jThousandNumberRuleCheckBox.isSelected()
&& !jReplaceRuleCheckBox.isSelected())
{
JOptionPane.showMessageDialog(jFrame,
m_Select_1_rule_before_execution,
m_RuleIsNotSelected,
JOptionPane.PLAIN_MESSAGE);
return ;
}
jAsciiMathTextArea.setEditable(false);
jEditButton.setText(m_EDITDtbook);
storePropertiesToUserHome();
if (m_bDtbookContainsMixedCharsets)
//jMessageLabel.setText("Ajetaan sekamerkistä-muunnosta....");
jMessageLabel.setText(m_ajetaan_sekamerkista_muunnosta);
else
//jMessageLabel.setText("Ajetaan muunnosta....");
jMessageLabel.setText(m_ajetaan_muunnosta);
StringBuffer sb = new StringBuffer(jMessageLabel.getText() +"\n");
String dbbookFileNameValue = jDtbookTextField.getText();
if (dbbookFileNameValue == null || dbbookFileNameValue.trim().length() == 0)
{
//jMessageLabel.setText("'Anna muokattava Dtbook-asiakirja'-kenttä on tyhjä.\n Ajo keskeytetty.");
jMessageLabel.setText(m_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
else
{
File tmpFile = new File(dbbookFileNameValue);
if (tmpFile.isDirectory())
{
//jMessageLabel.setText("Antamasi dtbook-tiedosto on hakemisto!.\n Ajo keskeytetty.");
jMessageLabel.setText(m_antamasi_dtbook_tiedosto_on_hakemisto_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
if (!tmpFile.exists())
{
//jMessageLabel.setText("Antamaasi dtbook-tiedostoa ei ole!.\n Ajo keskeytetty.");
jMessageLabel.setText(m_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
String outputDtbookFileNameValue = jAsciiMathTextField.getText();
if (outputDtbookFileNameValue == null || outputDtbookFileNameValue.trim().length() == 0)
{
//jMessageLabel.setText("'Anna kohde-tiedosto'-kenttä on tyhjä.\n Ajo keskeytetty.");
jMessageLabel.setText(m_anna_kohde_tiedosto_kentta_on_tyhja_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
else
{
File dtBookFile = new File(dbbookFileNameValue);
if (!dtBookFile.exists())
{
jMessageLabel.setText(m_antamaasi_dtbook_tiedostoa_ei_ole_ajo_keskeytetty +" "
+ dbbookFileNameValue );
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
jEditButton.setEnabled(false);
jOpenInEditorButton.setEnabled(false);
//ks alla: jEditButton.setEnabled(false);
//jOpenInEditorButton.setEnabled(false);
jAsciiMathTextArea.setEditable(false);
jAsciiMathTextArea.setText("Dtbook: " +dbbookFileNameValue +"\n"
+ m_output +": " +outputDtbookFileNameValue +"\n");
jAsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
//jMessageLabel.setText("Muunnos käynnissä...");
jMessageLabel.setText(m_muunnos_kaynnissa);
jMessageLabel.paint(jMessageLabel.getGraphics());
m_iExecuteResult = 0;
try {
executeDtbookAsciiMathConversion(dbbookFileNameValue, outputDtbookFileNameValue);
} catch (Exception e){
}
//jos käsitellään samaan aikaan kuin tämän komponentin eventin aikana,
// tulee pitkän ajan päästä: socket error: jEditButton.setEnabled(true);
// sillä tämä suoritus on lähtäisin jEditButton:sta!!
if (m_iExecuteResult == 0)
{
//if (bXslWarnings)
//{
if (m_sbWarnings.toString().trim().length() != 0)
{
jTabbedPane.setSelectedComponent(getWarningContentPane());
jWarningTextArea.setForeground(Color.BLACK);
jWarningTextArea.setText(m_sbWarnings.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHRULE_IN_WARNINGS;
//jMessageLabel.setText("Ajo valmis, mutta varoituksia 'Muunnoksen varoituksia lehdykässä (ks. myäs Muunnoksen asetukset-lehdykkä, rakenteen käsittelemätt. tarkistus)!");
jMessageLabel.setText(m_ajo_valmis_mutta_varoituksia_muunnoksen_varoituksia_lehdykassa_ks_myas_muunnoksen_asetukset_lehdykka_rakenteen_kasittelematt_tarkistus);
}
else
{
//jMessageLabel.setText("Ajo valmis.");
jMessageLabel.setText(m_ajo_valmis);
}
//jTabbedPane.setSelectedComponent(getJInputOutPutPanel());
jEditButton.setEnabled(true);
jOpenInEditorButton.setEnabled(true);
if (m_bDtbookContainsMixedCharsets)
jMessageLabel.setText(m_changedFile +": " // "Changed file: "
+ m_dtBook2asciimath.getKorjattuDtBookTiedostoNimi());
}
else
{
jEditButton2.setEnabled(true);
//jMessageLabel.setText("Ajo valmis.");
//if (m_sbError. m_sbWarnings.toString().trim().length() == 0)
//jMessageLabel.setText(m_ajo_valmis);
jOpenInEditorButton2.setEnabled(true);
}
//}
}
}
}
private void executeDtbookCharConversion(String dbbookFileNameValue, String dtbookConversionFileNameValue)
{
try {
String exec_dbbookFileNameValue = dbbookFileNameValue;
jConvertTextArea.setText(m_strDtbokText);
//jConvertTextArea.setText("");
jWarningTextArea.setText("");
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.CHARCONVERSIONWARNINGS_IN_WARNINGS;
// jScrollPaneConvert.setViewportView(getJAsciiMathTextArea());
jWarningScrollPane.setViewportView(getWarningTextArea());
boolean executeAndRenameOK = false;
m_iExecuteResult = 0;
File outputFile = null;
String line;
String outputFileName = dtbookConversionFileNameValue;
if (dtbookConversionFileNameValue.contains(" "))
outputFileName = "\"" + dtbookConversionFileNameValue + "\"";
m_sbMessage = new StringBuffer ();
m_sbMessage.append(m_executionStarted + "\n");
m_sbMessage.append("DtBook: " + dbbookFileNameValue +"\n");
m_sbMessage.append(m_target +" " +dtbookConversionFileNameValue +"\n");
if (m_bDtbookContainsMixedCharsetConvert)
{
m_sbMessage.append(m_charactersetConversionText);
}
jConvertTextArea.setText(m_sbMessage.toString());
jConvertTextArea.paint(jConvertTextArea.getGraphics());
//Graphics g = jML4TextArea.getGraphics();
//jML4TextArea.addNotify();
//Thread.sleep(1000);
m_sbMessage = new StringBuffer ();
m_sbWarnings = new StringBuffer ();
//m_userhomeProperties.setProperty("nkl_linux", ""); // ei ajeta linuxilla
boolean bLisaaMerkisto = false;
if (m_strWriteCharacterSetConvert != null && m_strWriteCharacterSetConvert.contains(ISO_8859_1))
bLisaaMerkisto = true;
m_PropertyConvert = jTextPropertyFileNameConvert.getText();
if (m_PropertyConvert != null &&
m_PropertyConvert.trim().length() == 0)
m_PropertyConvert = null;
/*
if (this.m_sbWarnings.length() != 0)
{
jAsciiMathTextArea.setText("");
jAsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
}
*/
m_sbWarnings = new StringBuffer();
jMessageLabel.paint(jMessageLabel.getGraphics());
jContentPane.paint(jContentPane.getGraphics());
jWarningTextArea.setText("");
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.CHARCONVERSIONWARNINGS_IN_WARNINGS;
boolean bCorrectStrikeErrors = false;
jUnModiedDtbookOfAsciiMathTextArea.setText("");
m_DtBookCharConvert = new DtBookCharConvert(m_logger, m_strUserHome,
new GiveRowMessageImpl(m_logger, m_strUserHome));
/* Runnable runable = new Runnable()
{
public void run()
{ */
/*
* boolean bDtbookContainsMixedCharsets,
Properties properties,
String dbtbookFileNameValue,
String outputFileNameValue,
String strReadCharacterSetOfInputFile,
String strWriteCharacterSet,
String xslDtBook2ML4Path,
boolean bGenerateNKLVariablesFromTemplate,
boolean bLisaaMerkisto,
boolean bErrorConvertedSourceFile,
boolean bRemoveLFBetweenKKoodi,
String jasciiMathPropertyFileName,
boolean bWarningsOn,
boolean bPrintAsciMaths,
boolean bCheckStrikeErrors,
boolean p_bCorrectStrikeErrors
*/
try {
boolean bShowCharCodes = true;
if (jCheckBoxPrintConvertWarnings != null)
bShowCharCodes = jCheckBoxPrintConvertWarnings.isSelected();
boolean bPrintExecutionResult = true;
boolean bCheckBoxCheckStrikeErrors = false;
boolean bCheckBoxCorrectStrikeErrors = false;
boolean bLisaaMerkistoConvert = false;
boolean bJatkaLoppuunVaikkaKysymysmerkkeja = false;
/*
* boolean bDtbookContainsMixedCharsets,
Properties properties,
String dbtbookFileNameValue,
String outputFileNameValue,
String strReadCharacterSetOfInputFile,
String strWriteCharacterSet,
boolean bLisaaMerkisto,
boolean bErrorConvertedSourceFile,
String convertPropertyFileName,
boolean bJatkaLoppuunVaikkaKysymysmerkkeja,
boolean bShowCharCodes
*/
m_DtBookCharConvert.executeCharConversion(m_bDtbookContainsMixedCharsets,
m_userhomeProperties,
exec_dbbookFileNameValue,
dtbookConversionFileNameValue,
UTF_8,
jWriteCharSetComboBoxConvert.getSelectedItem().toString(),
bLisaaMerkistoConvert,
true,
jTextPropertyFileNameConvert.getText(),
bJatkaLoppuunVaikkaKysymysmerkkeja,
bShowCharCodes
); // saadaan properties oliosta vastaava arvo, ks. yllä parametrina
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
if (m_DtBookCharConvert.getErrorString() != null)
m_sbMessage = new StringBuffer(m_DtBookCharConvert.getErrorString());
else
if (m_DtBookCharConvert.getStrMessageLabel() != null)
m_sbMessage = new StringBuffer(m_DtBookCharConvert.getErrorString());
/* }
};
m_executionThread =
*/
} catch (CharacterCodingException cce) {
cce.printStackTrace();
giveErrorMessage(m_DtBookCharConvert, cce);
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
giveErrorMessage(m_DtBookCharConvert, fnfe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (IOException ioe) {
ioe.printStackTrace();
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
giveErrorMessage(m_DtBookCharConvert, ioe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (Exception err) {
err.printStackTrace();
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
giveErrorMessage(m_DtBookCharConvert, err);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
}
if (m_DtBookCharConvert.getExecuteResult() != 0)
{
m_DtBookCharConvert.close();
m_DtBookCharConvert.clear();
jConvertTextArea.setText(m_sbMessage.toString() /* + m_DtBookCharConvert.getML4String().toString() */);
jChangeApplicationCheckBox.setEnabled(false);
jTextAreaLabelConvert.setText(m_strDtbokText +" " +dtbookConversionFileNameValue );
jMessageLabel.setText(m_DtBookCharConvert.getStrMessageLabel());
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_DtBookCharConvert.getErrorString();
StringBuffer sbuf = new StringBuffer();
if (tmp != null)
sbWarning.append(tmp);
///if (jCheckBoxPrintConvertWarnings.isSelected())
//{
// String sb = m_DtBookCharConvert.getPrintData();
// if (sb != null)
// {
// String value = sb; // sb.toString();
String value = null;
String fName = m_DtBookCharConvert.getErrorFileName();
//if (fName != null && fName.contains(" "))
//fName = "'" + fName +"'";
m_DtBookCharConvert = null;
System.gc();
FileInputStream fr = new FileInputStream(fName);
BufferedInputStream bis = new BufferedInputStream (fr);
// InputStreamReader ir = new InputStreamReader(bis);
if (bis != null)
{
int ch;
int iCont = 0;
int available = bis.available();
System.err.println("available=" + available);
if (available > 10000)
available = 10000;
while((ch = bis.read()) != -1 && iCont < available)
{
sbuf.append((char)ch);
iCont++;
// System.err.println("lCont++=" + iCont);
}
bis.close();
System.err.println("lCont=" + iCont);
System.err.println("sbuf.length()=" + sbuf.length());
// sbWarning = sbuf;
}
if (sbuf != null && sbuf.length() > 0)
sbWarning.append("\nPrintlist:\n*********\n\n" + sbuf.toString() +"\n\n -- End --");
// }
// }
// System.err.println("1 sbWarning.length()=" +sbWarning.length());
// jTabbedPane.setSelectedComponent(getWarningContentPane());
jWarningScrollPane.remove(jWarningTextArea);
jWarningTextArea = null;
jWarningScrollPane.setViewportView(getWarningTextArea());
// jWarningTextArea.removeAll();
jWarningTextArea.setText(sbWarning.toString());
jTabbedPane.updateUI();
jTabbedPane.repaint();
jTabbedPane.revalidate();
jWarningScrollPane.setViewportView(getWarningTextArea());
jWarningScrollPane.updateUI();
jWarningScrollPane.repaint();
jWarningScrollPane.revalidate();
warningContentPane.getParent().repaint();
try {
Thread.sleep(500);
} catch(Exception e){
}
jWarningTextArea.setCaretPosition(0);
// jWarningScrollPane.setViewportView(getWarningTextArea());
// jWarningTextArea.getParent().update(jWarningTextArea.getParent().getGraphics());
jMessageLabel.setText(m_WarningsOrErrors);
jMessageLabel.paint(jMessageLabel.getGraphics());
return;
}
else
if (m_DtBookCharConvert.getExecuteAndRenameOK())
{
jConvertTextArea.setText("");
jChangeApplicationCheckBox.setEnabled(true);
// korjattu DtBook2ML4-luokan lukuvaiheessa:
/*
if (ISO_8859_1.equals(strWriteCharacterSet))
jML4TextArea.setText(mDtBook2ML4.getML4String());
else
jML4TextArea.setText(new String(mDtBook2ML4.getML4String().getBytes(ISO_8859_1), UTF_8));
*/
jConvertTextArea.setText(m_DtBookCharConvert.getML4String());
m_iExecuteResult = m_DtBookCharConvert.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_DtBookCharConvert.getErrorString();
if (tmp != null)
sbWarning.append(tmp);
///if (jCheckBoxPrintConvertWarnings.isSelected())
//{
String sb = m_DtBookCharConvert.getPrintData();
if (sb != null)
{
String value = sb; // sb.toString();
if (value != null && value.length() > 0)
sbWarning.append("\nPrintlist:\n*********\n\n" + value +"\n\n -- End --");
}
//}
//jWarningTextArea.setAutoscrolls(true);
int len = sbWarning.length();
if (len > 10000)
len = 10000;
if (len > 0)
jWarningTextArea.setText(sbWarning.toString().substring(0, len-1));
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.CHARCONVERSIONWARNINGS_IN_WARNINGS;
jWarningScrollPane.setViewportView(getWarningTextArea());
jWarningTextArea.paint(jWarningTextArea.getGraphics());
jWarningTextArea.setCaretPosition(0);
// ???
jChangeApplicationCheckBox.setEnabled(true);
jTextAreaLabelConvert.setText(cnstDtbokText +" " +dtbookConversionFileNameValue );
}
/*
if (bDtbookContainsMixedCharsets
&& exec_dbbookFileNameValue != null
&& exec_dbbookFileNameValue.contains("_m"))
{
File deleteFile = new File(exec_dbbookFileNameValue);
if (deleteFile.exists())
deleteFile.delete();
}
if (tmp_ml4File.exists())
tmp_ml4File.delete();
*/
/*
List<TransformerException> warnings = mDtBook2asciimath.getWarningTransformerExceptions();
if (warnings != null && warnings.size() > 0)
{
int max = warnings.size();
TransformerException tfe;
String msg;
for(int i = 0; i < max; i++)
{
tfe = warnings.get(i);
msg = tfe.getMessage();
if ("Can not load requested doc: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
if ("Can not make URL from: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
sbWarnings.append( msg +"\n");
bXslWarnings = true;
}
}
*/
/*
} catch (DecoderCharacterSetException dcse) {
dcse.printStackTrace();
giveXslErrorMessage(mDtBook2asciimath, dcse);
//jMessageLabel.setText("Ajon aikainen virhe! Ks. yllä olevaa tekstikenttää!");
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (CharacterCodingException cce) {
cce.printStackTrace();
giveXslErrorMessage(m_DtBookCharConvert, cce);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
giveXslErrorMessage(m_DtBookCharConvert, fnfe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (IOException ioe) {
ioe.printStackTrace();
giveXslErrorMessage(m_DtBookCharConvert, ioe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
} catch (Exception err) {
err.printStackTrace();
giveErrorMessage(m_DtBookCharConvert, err);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
}
}
/**
* This method is converting asciimath xml blocks within firefox browser
* into ascimath daisy xml entities.
*/
private void executeDtbook2AsciimathXmlConversion()
{
/* This code block must updated with gui-variables and xml-execution with asmiimath-to-xml:
*/
jXmlAsciiMathTextArea.setEditable(false);
jEditButton2.setText(m_EDITDtbook);
jEditButton2.setEnabled(false);
jOpenInEditorButton2.setEnabled(false);
storePropertiesToUserHome(); // TODO: store also xml asciimath file name
if (m_bDtbookContainsMixedCharsets2)
//jMessageLabel.setText("Ajetaan sekamerkistä-muunnosta....");
jMessageLabel.setText(m_ajetaan_sekamerkista_muunnosta);
else
//jMessageLabel.setText("Ajetaan muunnosta....");
jMessageLabel.setText(m_ajetaan_muunnosta);
StringBuffer sb = new StringBuffer(jMessageLabel.getText() +"\n");
String dbbookFileNameValue = jDtbookTextField2.getText();
if (dbbookFileNameValue == null || dbbookFileNameValue.trim().length() == 0)
{
//jMessageLabel.setText("'Anna muokattava Dtbook-asiakirja'-kenttä on tyhjä.\n Ajo keskeytetty.");
jMessageLabel.setText(m_anna_muokattava_dtbook_asiakirja_kentta_on_tyhja_ajo_keskeytetty);
sb.append(jMessageLabel.getText() +"\n");
jXmlAsciiMathTextArea.setText(sb.toString());
return ;
}
else
{
File tmpFile = new File(dbbookFileNameValue);
if (tmpFile.isDirectory())
{
jMessageLabel.setText(m_file_is_directory);
sb.append(jMessageLabel.getText() +"\n");
jXmlAsciiMathTextArea.setText(sb.toString());
return ;
}
if (!tmpFile.exists())
{
jMessageLabel.setText(m_dtbook_did_not_exists);
sb.append(jMessageLabel.getText() +"\n");
jAsciiMathTextArea.setText(sb.toString());
return ;
}
String ml4FileNameValue = jAsciiMathTextField2.getText();
if (ml4FileNameValue == null || ml4FileNameValue.trim().length() == 0)
{
jMessageLabel.setText(m_missing_cfg_file_field);
sb.append(jMessageLabel.getText() +"\n");
jXmlAsciiMathTextArea.setText(sb.toString());
return ;
}
else
{
File dtBookFile = new File(dbbookFileNameValue);
if (!dtBookFile.exists())
{
jMessageLabel.setText(m_dtbook_document +" (" + dbbookFileNameValue
+") " + m_no_existence_canceled);
sb.append(jMessageLabel.getText() +"\n");
jXmlAsciiMathTextArea.setText(sb.toString());
return ;
}
//ks alla: jEditButton.setEnabled(false);
jOpenInEditorButton2.setEnabled(false);
jAsciiMathTextArea.setEditable(false);
jXmlAsciiMathTextArea.setText("Dtbook: " +dbbookFileNameValue +"\n"
+"ML4: " +ml4FileNameValue +"\n");
//jMessageLabel.setText("Muunnos käynnissä...");
jMessageLabel.setText(m_inchanging +" ...");
m_iExecuteResult = 0;
executeDtbookAsciiMathXmlConversion(dbbookFileNameValue, ml4FileNameValue);
//jos käsitellään samaan aikaan kuin tämän komponentin eventin aikana,
// tulee pitkän ajan päästä: socket error: jEditButton.setEnabled(true);
// sillä tämä suoritus on lähtäisin jEditButton:sta!!
if (m_iExecuteResult == 0)
{
//if (bXslWarnings)
//{
if (m_sbWarnings.toString().trim().length() != 0)
{
jTabbedPane.setSelectedComponent(getWarningContentPane());
jWarningTextArea.setText(m_sbWarnings.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
//jMessageLabel.setText("Ajo valmis, mutta varoituksia 'Muunnoksen varoituksia lehdykässä (ks. myäs Muunnoksen asetukset-lehdykkä, rakenteen käsittelemätt. tarkistus)!");
jMessageLabel.setText(m_runexecutedbutwarnings); }
else
{
//jMessageLabel.setText("Ajo valmis.");
jMessageLabel.setText(m_ajo_valmis);
}
//jTabbedPane.setSelectedComponent(getJInputOutPutPanel());
jEditButton2.setEnabled(true);
jOpenInEditorButton2.setEnabled(true);
if (m_bDtbookContainsMixedCharsets2)
jMessageLabel.setText(m_correctedFile // "Korjattu tiedosto: "
+": " + m_DtBookCharConvert.getKorjattuDtBookTiedostoNimi());
/*
if (m_bUnScriptedXmlStructureCheckBox && !m_bUnScriptedXmlMessageCheckBox)
{
File ml4File = new File(ml4FileNameValue);
ml4File.delete();
jMessageLabel.setText("Ajo valmis, mutta ML4-tiedosto poistettu, koska DtBookrakenteen-rakenteinen virhetarkistus ML4-tiedoston joukkoon päällä. Ruuudulla tulos (ks. asetuksekset-lehdykkä)!!");
jEditButton.setEnabled(false);
jOpenInEditorButton.setEnabled(false);
}
*/
}
else
{
jEditButton2.setEnabled(true);
//jMessageLabel.setText("Ajo valmis.");
jMessageLabel.setText(m_ajo_valmis);
jOpenInEditorButton2.setEnabled(true);
}
//}
}
}
}
/**
* @param dbbookFileNameValue
* @param dtbookConversionFileNameValue
*/
private void
executeDtbookAsciiMathConversion(String dbbookFileNameValue, String dtbookConversionFileNameValue)
{
try {
String exec_dbbookFileNameValue = dbbookFileNameValue;
jTextAreaLabel.setText(m_strDtbokText);
//jAsciiMathTextArea.setText("");
jWarningTextArea.setText("");
jAsciiMathScrollPane.setViewportView(getJAsciiMathTextArea());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHRULE_IN_WARNINGS;
jWarningScrollPane.setViewportView(getWarningTextArea());
jWarningScrollPane.setAutoscrolls(true);
boolean executeAndRenameOK = false;
m_iExecuteResult = 0;
File outputFile = null;
String line;
String outputFileName = dtbookConversionFileNameValue;
if (dtbookConversionFileNameValue.contains(" "))
outputFileName = "\"" + dtbookConversionFileNameValue + "\"";
m_sbMessage = new StringBuffer ();
m_sbMessage.append(m_executionStarted + "\n");
m_sbMessage.append("DtBook: " + dbbookFileNameValue +"\n");
m_sbMessage.append(m_target +" " +dtbookConversionFileNameValue +"\n");
if (m_bDtbookContainsMixedCharsets)
{
m_sbMessage.append(m_charactersetConversionText);
}
jAsciiMathTextArea.setText(m_sbMessage.toString());
jAsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
//Graphics g = jML4TextArea.getGraphics();
//jML4TextArea.addNotify();
//Thread.sleep(1000);
m_sbMessage = new StringBuffer ();
m_sbWarnings = new StringBuffer ();
//m_userhomeProperties.setProperty("nkl_linux", ""); // ei ajeta linuxilla
boolean bLisaaMerkisto = false;
if (m_strWriteCharacterSet != null && m_strWriteCharacterSet.contains(ISO_8859_1))
bLisaaMerkisto = true;
m_asciimathPropertyFileName = jTextFieldAsciiMathPropertyFileName.getText();
if (m_asciimathPropertyFileName != null &&
m_asciimathPropertyFileName.trim().length() == 0)
m_asciimathPropertyFileName = null;
/*
if (this.m_sbWarnings.length() != 0)
{
jAsciiMathTextArea.setText("");
jAsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
}
*/
m_sbWarnings = new StringBuffer();
jMessageLabel.paint(jMessageLabel.getGraphics());
jContentPane.paint(jContentPane.getGraphics());
jWarningTextArea.setText("");
boolean bCorrectStrikeErrors = false;
jUnModiedDtbookOfAsciiMathTextArea.setText("");
m_dtBook2asciimath = new DtBookAsciiMath(m_logger, m_strUserHome);
/* Runnable runable = new Runnable()
{
public void run()
{ */
try {
m_dtBook2asciimath.executeRuleConversion(m_bDtbookContainsMixedCharsets,
m_userhomeProperties,
exec_dbbookFileNameValue,
dtbookConversionFileNameValue,
UTF_8,
m_strWriteCharacterSet,
m_xslDtBook2AsciiMathPath,
true, bLisaaMerkisto,
false,
false,
m_asciimathPropertyFileName,
m_bSpaceRule,
m_bNumberRule,
m_bThousandNumberRule,
m_bReplaceRule,
jCheckBoxWarnings.isSelected(),
jCheckBoxPrintAsciMaths.isSelected(),
jCheckBoxCheckStrikeErrors.isSelected(),
jCheckBoxCorrectStrikeErrors.isSelected()
); // saadaan properties oliosta vastaava arvo, ks. yllä parametrina
/* }
};
m_executionThread =
*/
} catch (CharacterCodingException cce) {
cce.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, cce);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, fnfe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (IOException ioe) {
ioe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, ioe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (Exception err) {
err.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, err);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
}
if (m_dtBook2asciimath.getExecuteResult() != 0)
{
jAsciiMathTextArea.setText(m_sbMessage.toString() + m_dtBook2asciimath.getML4String().toString());
jChangeApplicationCheckBox.setEnabled(false);
jTextAreaLabel.setText(m_strDtbokText +" " +dtbookConversionFileNameValue );
jMessageLabel.setText(m_dtBook2asciimath.getStrMessageLabel());
m_iExecuteResult = m_dtBook2asciimath.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_dtBook2asciimath.getErrorString();
if (tmp != null)
sbWarning.append(tmp);
if (jCheckBoxPrintAsciMaths.isSelected())
{
StringBuffer sb = m_dtBook2asciimath.getPrintData();
if (sb != null)
sbWarning.append("\nPrintlist:\n*********\n\n" + sb.toString());
}
jWarningTextArea.setText(sbWarning.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHRULE_IN_WARNINGS;
jWarningTextArea.setCaretPosition(0);
jMessageLabel.setText(m_WarningsOrErrors);
jMessageLabel.paint(jMessageLabel.getGraphics());
return;
}
else
if (m_dtBook2asciimath.getExecuteAndRenameOK())
{
jAsciiMathTextArea.setText("");
jChangeApplicationCheckBox.setEnabled(true);
// korjattu DtBook2ML4-luokan lukuvaiheessa:
/*
if (ISO_8859_1.equals(strWriteCharacterSet))
jML4TextArea.setText(mDtBook2ML4.getML4String());
else
jML4TextArea.setText(new String(mDtBook2ML4.getML4String().getBytes(ISO_8859_1), UTF_8));
*/
jAsciiMathTextArea.setText(m_dtBook2asciimath.getML4String());
m_iExecuteResult = m_dtBook2asciimath.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_dtBook2asciimath.getErrorString();
if (tmp != null)
sbWarning.append(tmp);
if (jCheckBoxPrintAsciMaths.isSelected())
{
StringBuffer sb = m_dtBook2asciimath.getPrintData();
if (sb != null)
sbWarning.append("\nPrintlist:\n*********\n\n" + sb.toString());
}
jWarningTextArea.setText(sbWarning.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
jWarningTextArea.setCaretPosition(0);
// ???
jChangeApplicationCheckBox.setEnabled(true);
jTextAreaLabel.setText(cnstDtbokText +" " +dtbookConversionFileNameValue );
}
/*
if (bDtbookContainsMixedCharsets
&& exec_dbbookFileNameValue != null
&& exec_dbbookFileNameValue.contains("_m"))
{
File deleteFile = new File(exec_dbbookFileNameValue);
if (deleteFile.exists())
deleteFile.delete();
}
if (tmp_ml4File.exists())
tmp_ml4File.delete();
*/
/*
List<TransformerException> warnings = mDtBook2asciimath.getWarningTransformerExceptions();
if (warnings != null && warnings.size() > 0)
{
int max = warnings.size();
TransformerException tfe;
String msg;
for(int i = 0; i < max; i++)
{
tfe = warnings.get(i);
msg = tfe.getMessage();
if ("Can not load requested doc: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
if ("Can not make URL from: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
sbWarnings.append( msg +"\n");
bXslWarnings = true;
}
}
*/
/*
} catch (DecoderCharacterSetException dcse) {
dcse.printStackTrace();
giveXslErrorMessage(mDtBook2asciimath, dcse);
//jMessageLabel.setText("Ajon aikainen virhe! Ks. yllä olevaa tekstikenttää!");
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (CharacterCodingException cce) {
cce.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, cce);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, fnfe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
/*
} catch (IOException ioe) {
ioe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, ioe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
} catch (Exception err) {
err.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, err);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
}
}
/**
* This method is converting asciimath xml blocks within firefox browser
* into ascimath daisy xml entities.
*
* @param dbbookFileNameValue
* @param dtbookConversionFileNameValue
*/
private void
executeDtbookAsciiMathXmlConversion(String dbbookFileNameValue, String dtbookConversionFileNameValue)
{
try {
String exec_dbbookFileNameValue = dbbookFileNameValue;
jTextAreaLabel.setText(m_strDtbokText);
//jAsciiMathTextArea.setText("");
jWarningTextArea.setText("");
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
//jAsciiMathScrollPane.setViewportView(getJAsciiMathTextArea());
jWarningScrollPane.setViewportView(getWarningTextArea());
boolean executeAndRenameOK = false;
m_iExecuteResult = 0;
File outputFile = null;
String line;
String outputFileName = dtbookConversionFileNameValue;
if (dtbookConversionFileNameValue.contains(" "))
outputFileName = "\"" + dtbookConversionFileNameValue + "\"";
m_sbMessage = new StringBuffer ();
m_sbMessage.append(m_executionStarted + "\n");
m_sbMessage.append("DtBook: " + dbbookFileNameValue +"\n");
m_sbMessage.append(m_target +" " +dtbookConversionFileNameValue +"\n");
if (m_bDtbookContainsMixedCharsets)
{
m_sbMessage.append(m_charactersetConversionText);
}
jXmlAsciiMathTextArea.setText(m_sbMessage.toString());
jXmlAsciiMathTextArea.paint(jXmlAsciiMathTextArea.getGraphics());
//Graphics g = jML4TextArea.getGraphics();
//jML4TextArea.addNotify();
//Thread.sleep(1000);
m_sbMessage = new StringBuffer ();
m_sbWarnings = new StringBuffer ();
//m_userhomeProperties.setProperty("nkl_linux", ""); // ei ajeta linuxilla
boolean bLisaaMerkisto = false;
if (m_strWriteCharacterSet != null && m_strWriteCharacterSet.contains(ISO_8859_1))
bLisaaMerkisto = true;
m_asciimathPropertyFileName = jTextFieldAsciiMathPropertyFileName.getText();
if (m_asciimathPropertyFileName != null &&
m_asciimathPropertyFileName.trim().length() == 0)
m_asciimathPropertyFileName = null;
/*
if (this.m_sbWarnings.length() != 0)
{
jXmlAsciiMathTextArea.setText("");
jXmlAsciiMathTextArea.paint(jAsciiMathTextArea.getGraphics());
}
*/
m_sbWarnings = new StringBuffer();
jMessageLabel.paint(jMessageLabel.getGraphics());
jContentPane.paint(jContentPane.getGraphics());
jWarningTextArea.setText("");
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
boolean bCorrectStrikeErrors = false;
jUnModiedDtbookOfAsciiMathTextArea.setText("");
m_dtBook2asciimath = new DtBookAsciiMath(m_logger, m_strUserHome);
int run_result = -1;
try {
run_result = m_dtBook2asciimath.executeXmlConversion(m_bDtbookContainsMixedCharsets,
m_userhomeProperties,
exec_dbbookFileNameValue,
dtbookConversionFileNameValue,
UTF_8,
m_strWriteCharacterSet,
m_xslDtBook2AsciiMathPath,
true, bLisaaMerkisto,
false,
false,
m_asciimathPropertyFileName,
false,
false,
false,
false,
jCheckBoxWarnings.isSelected(),
jCheckBoxPrintXmlAsciiStatements.isSelected(),
jCheckBoxCheckStrikeErrors2.isSelected(),
jCheckBoxCorrectStrikeErrors2.isSelected()
); // saadaan properties oliosta vastaava arvo, ks. yllä parametrina
// TODO: korjaa xml koodit tahan!:
} catch (Exception e){
jTextAreaLabel.setText(jTextAreaLabel.getText() + " " + e.getMessage());
// throw e;
}
if (m_dtBook2asciimath.getExecuteResult() != 0)
{
//jAsciiMathTextArea.setText(m_sbMessage.toString() + m_dtBook2asciimath.getML4String().toString());
jChangeApplicationCheckBox.setEnabled(false);
jTextAreaLabel.setText(m_strDtbokText +" " +dtbookConversionFileNameValue );
jMessageLabel.setText(m_dtBook2asciimath.getStrMessageLabel());
m_iExecuteResult = m_dtBook2asciimath.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_dtBook2asciimath.getErrorString();
if (tmp != null)
sbWarning.append(tmp);
if (jCheckBoxPrintXmlAsciiStatements.isSelected())
{
StringBuffer sb = m_dtBook2asciimath.getPrintData();
if (sb != null)
sbWarning.append("\nPrintlist:\n*********\n\n" + sb.toString());
}
jWarningTextArea.setText(sbWarning.toString());
jWarningTextArea.setCaretPosition(0);
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.ASCIIMATHXMLWARNINGS_IN_WARNINGS;
// ???
jXmlAsciiMathTextArea.setText(jAsciiMathTextArea.getText() +"\n\n !!!" + sbWarning);
return;
}
else
if (m_dtBook2asciimath.getExecuteAndRenameOK())
{
jXmlAsciiMathTextArea.setText("");
jChangeApplicationCheckBox.setEnabled(true);
// korjattu DtBook2ML4-luokan lukuvaiheessa:
/*
if (ISO_8859_1.equals(strWriteCharacterSet))
jML4TextArea.setText(mDtBook2ML4.getML4String());
else
jML4TextArea.setText(new String(mDtBook2ML4.getML4String().getBytes(ISO_8859_1), UTF_8));
*/
jXmlAsciiMathTextArea.setText(m_dtBook2asciimath.getML4String());
m_iExecuteResult = m_dtBook2asciimath.getExecuteResult();
StringBuffer sbWarning = new StringBuffer();
String tmp = m_dtBook2asciimath.getErrorString();
if (tmp != null)
sbWarning.append(tmp);
if (jCheckBoxPrintXmlAsciiStatements.isSelected())
{
StringBuffer sb = m_dtBook2asciimath.getPrintData();
if (sb != null)
sbWarning.append("\nPrintlist:\n*********\n\n" + sb.toString());
}
jWarningTextArea.setText(sbWarning.toString());
m_WARNINGS_DATA_TYPE = WARNINGS_DATA_TYPE.CHARCONVERSIONWARNINGS_IN_WARNINGS;
// ???
jWarningTextArea.setCaretPosition(0);
jChangeApplicationCheckBox.setEnabled(true);
jTextAreaLabel.setText(cnstDtbokText +" " +dtbookConversionFileNameValue );
}
/*
if (bDtbookContainsMixedCharsets
&& exec_dbbookFileNameValue != null
&& exec_dbbookFileNameValue.contains("_m"))
{
File deleteFile = new File(exec_dbbookFileNameValue);
if (deleteFile.exists())
deleteFile.delete();
}
if (tmp_ml4File.exists())
tmp_ml4File.delete();
*/
/*
List<TransformerException> warnings = mDtBook2asciimath.getWarningTransformerExceptions();
if (warnings != null && warnings.size() > 0)
{
int max = warnings.size();
TransformerException tfe;
String msg;
for(int i = 0; i < max; i++)
{
tfe = warnings.get(i);
msg = tfe.getMessage();
if ("Can not load requested doc: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
if ("Can not make URL from: null".equals(msg))
continue; // kun muistista ladataan xsl +käytetään
// urisolveria, tulee tällainen warning, joka ohitetaan
sbWarnings.append( msg +"\n");
bXslWarnings = true;
}
}
*/
/*
} catch (DecoderCharacterSetException dcse) {
dcse.printStackTrace();
giveXslErrorMessage(mDtBook2asciimath, dcse);
//jMessageLabel.setText("Ajon aikainen virhe! Ks. yllä olevaa tekstikenttää!");
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (CharacterCodingException cce) {
cce.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, cce);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (FileNotFoundException fnfe) {
fnfe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, fnfe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
} catch (IOException ioe) {
ioe.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, ioe);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
*/
} catch (Exception err) {
err.printStackTrace();
giveXslErrorMessage(m_dtBook2asciimath, err);
jMessageLabel.setText(m_ajon_aikainen_virhe_ks_ylla_olevaa_tekstikenttaa);
}
}
/**
* @param mDtBook2ML4
* @param exception
*/
private void
giveXslErrorMessage(DtBookAsciiMath mDtBook2ML4, Exception exception)
{
m_iExecuteResult = 1;
/*
int len = fatalErrorTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
String msgError;
for(int i = 0; i < len; i++)
{
ffe = fatalErrorTransformerExceptions.get(i);
msgError = ffe.getMessage();
if (msgError != null)
{
sbMessage.append (msgError);
if (msgError.contains("Invalid byte")
&& msgError.contains("UTF-8 sequence"))
{
if (!jMixedCharSetCheckBox.isSelected())
{
sbMessage.append("\n\n!!!!!! DtBook-asiakirja sisältää todennäkäisesti sekaisin eri merkistäjen merkkejä\n"
+"(esim UFT-8 ja ISO-8859-1 eli Latin1). Laitettiin ruksi päälle 'Dtbook-sisältää sekamerkkejä'\n"
+"ja aja muunnos uudelleen tällä optiolla");
jMixedCharSetCheckBox.setSelected(true);
check_isSelected_MixedCharSetCheckBox();
}
}
}
}
}
len = exceptionTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
for(int i = 0; i < len; i++)
{
ffe = exceptionTransformerExceptions.get(i);
sbMessage.append (ffe.getMessage());
}
}
len = warningTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
for(int i = 0; i < len; i++)
{
ffe = warningTransformerExceptions.get(i);
sbMessage.append (ffe.getMessage());
}
}
if (len == 0)
sbMessage.append ("\nKatso myäs ohjelman dos-boksia eli käynnistysikkunan\n"
+"mahdollista virheilmoitusta.");
jAsciiMathTextArea.setText(jAsciiMathTextArea.getText() + sbMessage.toString());
*/
}
/**
* @param mDtBook2ML4
* @param exception
*/
private void
giveErrorMessage(DtBookCharConvert mDtBook2ML4, Exception exception)
{
m_iExecuteResult = 1;
/*
int len = fatalErrorTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
String msgError;
for(int i = 0; i < len; i++)
{
ffe = fatalErrorTransformerExceptions.get(i);
msgError = ffe.getMessage();
if (msgError != null)
{
sbMessage.append (msgError);
if (msgError.contains("Invalid byte")
&& msgError.contains("UTF-8 sequence"))
{
if (!jMixedCharSetCheckBox.isSelected())
{
sbMessage.append("\n\n!!!!!! DtBook-asiakirja sisältää todennäkäisesti sekaisin eri merkistäjen merkkejä\n"
+"(esim UFT-8 ja ISO-8859-1 eli Latin1). Laitettiin ruksi päälle 'Dtbook-sisältää sekamerkkejä'\n"
+"ja aja muunnos uudelleen tällä optiolla");
jMixedCharSetCheckBox.setSelected(true);
check_isSelected_MixedCharSetCheckBox();
}
}
}
}
}
len = exceptionTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
for(int i = 0; i < len; i++)
{
ffe = exceptionTransformerExceptions.get(i);
sbMessage.append (ffe.getMessage());
}
}
len = warningTransformerExceptions.size();
if (len > 0)
{
TransformerException ffe;
for(int i = 0; i < len; i++)
{
ffe = warningTransformerExceptions.get(i);
sbMessage.append (ffe.getMessage());
}
}
if (len == 0)
sbMessage.append ("\nKatso myäs ohjelman dos-boksia eli käynnistysikkunan\n"
+"mahdollista virheilmoitusta.");
jAsciiMathTextArea.setText(jAsciiMathTextArea.getText() + sbMessage.toString());
*/
}
private void createDtBookFileName()
{
if (dtbookFileChooser == null)
{
dtbookFileChooser = new JFileChooser();
/*
if (userHomeFilePropertyFile != null)
{
String lastDtBookFileName = properties.getProperty(cnst_lastdtbookfile, "");
if (lastDtBookFileName.trim().length() != 0)
{
lastDtBookFileName = lastDtBookFileName;
dtbookFileChooser.setSelectedFile(new File(lastDtBookFileName));
}
}
*/
dtbookFileChooser.setSelectedFile(new File(jDtbookTextField.getText()));
dtbookFileChooser.setDialogTitle(m_select_dtbookFileName);
dtbookFileChooser.setMultiSelectionEnabled(false);
}
}
/**
*
*/
private void selectDtBookFileName()
{
createDtBookFileName();
int returnVal = dtbookFileChooser.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = dtbookFileChooser.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua DtBook-tiedostoa (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_dtbook_tiedostoa);
}
else
{
//jMessageLabel.setText("Valittu DtBook-tiedosto " + file.getName());
jMessageLabel.setText(m_selected_file + " " + file.getName());
this.jDtbookTextField.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
}
private void createDtbookFileName2()
{
if (dtbookFileChooser2 == null)
{
dtbookFileChooser2 = new JFileChooser();
/*
if (userHomeFilePropertyFile != null)
{
String lastDtBookFileName = properties.getProperty(cnst_lastdtbookfile, "");
if (lastDtBookFileName.trim().length() != 0)
{
lastDtBookFileName2 = lastDtBookFileName2;
dtbookFileChooser2.setSelectedFile(new File(lastDtBookFileName));
}
}
*/
dtbookFileChooser2.setSelectedFile(new File(jDtbookTextField2.getText()));
dtbookFileChooser2.setDialogTitle(m_select_dtbookFileName);
dtbookFileChooser2.setMultiSelectionEnabled(false);
}
}
private void createDtbookFileNameConvert()
{
if (dtbookFileChooserConvert == null)
{
dtbookFileChooserConvert = new JFileChooser();
/*
if (userHomeFilePropertyFile != null)
{
String lastDtBookFileName = properties.getProperty(cnst_lastdtbookfile, "");
if (lastDtBookFileName.trim().length() != 0)
{
lastDtBookFileName2 = lastDtBookFileName2;
dtbookFileChooserConvert.setSelectedFile(new File(lastDtBookFileName));
}
}
*/
dtbookFileChooserConvert.setSelectedFile(new File(jDtbookTextField2.getText()));
dtbookFileChooserConvert.setDialogTitle(m_select_dtbookFileName);
dtbookFileChooserConvert.setMultiSelectionEnabled(false);
}
}
/**
* called from asciimath part of application
*/
private void selectDtBookFileName2()
{
createDtbookFileName2();
int returnVal = dtbookFileChooser2.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = dtbookFileChooser2.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua DtBook-tiedostoa (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_dtbook_tiedostoa);
}
else
{
jMessageLabel.setText("DtBook " + file.getName());
this.jDtbookTextField2.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
}
/**
* called from asciimath part of application
*/
private void selectDtBookFileNameConvert()
{
createDtbookFileNameConvert();
int returnVal = dtbookFileChooserConvert.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = dtbookFileChooserConvert.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittua DtBook-tiedostoa (" + file.getName() +") ei ole!");
jMessageLabel.setText(m_valittua_dtbook_tiedostoa);
}
else
{
jMessageLabel.setText("DtBook " + file.getName());
this.jDtbookTextFieldConvert.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu DtBook-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_dtbook_tiedostoa);
}
}
private void createModifiedDtbookFileChooser()
{
if (modifiedDtbookFileChooser == null)
{
modifiedDtbookFileChooser = new JFileChooser(m_select_file);
modifiedDtbookFileChooser.setDialogTitle(m_select_save_file);
modifiedDtbookFileChooser.setMultiSelectionEnabled(false);
/*
if (userHomeFilePropertyFile != null)
{
String lastML4FileName = properties.getProperty(cnst_lastml4file, "");
if (lastML4FileName != null && lastML4FileName.trim().length() != 0)
{
ml4FileChooser.setSelectedFile(new File(lastML4FileName));
}
}
*/
modifiedDtbookFileChooser.setSelectedFile(new File(jAsciiMathTextField.getText()));
}
}
/**
*
*/
private void selectModifiedDtbookFileName()
{
createModifiedDtbookFileChooser();
int returnVal = modifiedDtbookFileChooser.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = modifiedDtbookFileChooser.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
//jMessageLabel.setText("Valittu ML4-tiedostoa on uusi tiedosto: " + file.getName());
jAsciiMathTextField.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_file +" " + file.getName());
jAsciiMathTextField.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu ML4-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_ml4_tiedostoa);
}
}
private void createModifiedDtbookFileChooser2()
{
if (modifiedDtbookFileChooser2 == null)
{
modifiedDtbookFileChooser2 = new JFileChooser(m_selected_file2);
modifiedDtbookFileChooser2.setDialogTitle(m_select_save_file2);
modifiedDtbookFileChooser2.setMultiSelectionEnabled(false);
/*
if (userHomeFilePropertyFile != null)
{
String lastML4FileName = properties.getProperty(cnst_lastml4file, "");
if (lastML4FileName != null && lastML4FileName.trim().length() != 0)
{
ml4FileChooser2.setSelectedFile(new File(lastML4FileName));
}
}
*/
modifiedDtbookFileChooser2.setSelectedFile(new File(jAsciiMathTextField2.getText()));
}
}
private void createModifiedDtbookFileChooserConvert()
{
if (modifiedDtbookFileChooserConvert == null)
{
modifiedDtbookFileChooserConvert = new JFileChooser(m_selected_fileConvert);
modifiedDtbookFileChooserConvert.setDialogTitle(m_select_save_file2);
modifiedDtbookFileChooserConvert.setMultiSelectionEnabled(false);
/*
if (userHomeFilePropertyFile != null)
{
String lastML4FileName = properties.getProperty(cnst_lastml4file, "");
if (lastML4FileName != null && lastML4FileName.trim().length() != 0)
{
ml4FileChooser2.setSelectedFile(new File(lastML4FileName));
}
}
*/
modifiedDtbookFileChooserConvert.setSelectedFile(new File(jAsciiMathTextFieldConvert.getText()));
}
}
/**
*
*/
private void selectAsciiMathFileName2()
{
createModifiedDtbookFileChooser2();
int returnVal = modifiedDtbookFileChooser2.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = modifiedDtbookFileChooser2.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
jMessageLabel.setText(m_selected_file_is_new+" " + file.getName());
jAsciiMathTextField2.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_file2 +" " + file.getName());
jAsciiMathTextField2.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu ML4-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_ml4_tiedostoa);
}
}
private void selectAsciiMathFileNameConvert()
{
createModifiedDtbookFileChooserConvert();
int returnVal = modifiedDtbookFileChooserConvert.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = modifiedDtbookFileChooserConvert.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
jMessageLabel.setText(m_selected_file_is_new+" " + file.getName());
jAsciiMathTextFieldConvert.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_file2 +" " + file.getName());
jAsciiMathTextFieldConvert.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu ML4-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_ml4_tiedostoa);
}
}
/**
*
*/
private void muokkaaMerkkeja()
{
if (propertyFileChooser == null)
{
propertyFileChooser = new JFileChooser(m_select_config_file);
propertyFileChooser.setDialogTitle(m_select_config_file);
propertyFileChooser.setMultiSelectionEnabled(false);
propertyFileChooser.setSelectedFile(new File(jTextFieldAsciiMathPropertyFileName.getText()));
}
int returnVal = propertyFileChooser.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = propertyFileChooser.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{
jMessageLabel.setText(m_selected_configfile_dosnot_exist+" " + file.getName());
jTextFieldAsciiMathPropertyFileName.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_file +" " + file.getName());
jTextFieldAsciiMathPropertyFileName.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu Muokkaa rivejä-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_muokkaa_riveja_tiedostoa);
}
}
/**
* *Called from asciimath execution)
*/
private void muokkaaMerkkeja2()
{
if (propertyFileChooser2 == null)
{
propertyFileChooser2 = new JFileChooser(m_select_config_file2);
propertyFileChooser2.setDialogTitle(m_select_config_file2);
propertyFileChooser2.setMultiSelectionEnabled(false);
propertyFileChooser2.setSelectedFile(new File(jTextFieldAsciiMathPropertyFileName2.getText())); }
int returnVal = propertyFileChooser2.showOpenDialog(jFrame);
if (returnVal == JFileChooser.APPROVE_OPTION)
{
File file = propertyFileChooser2.getSelectedFile();
//This is where a real application would open the file.
if (!file.exists())
{ // seek 8
jMessageLabel.setText(m_selected_configfile_dosnot_exist +" " + file.getName());
jTextFieldAsciiMathPropertyFileName2.setText(file.getAbsolutePath());
}
else
{
jMessageLabel.setText(m_selected_file +" " + file.getName());
jTextFieldAsciiMathPropertyFileName2.setText(file.getAbsolutePath());
}
} else
{
//jMessageLabel.setText("Ei valittu Muokkaa rivejä-tiedostoa.");
jMessageLabel.setText(m_ei_valittu_muokkaa_riveja_tiedostoa);
}
}
/**
* @return
*/
private JCheckBox getJCheckBoxPrintXmlAsciiStatements() {
if(jCheckBoxPrintXmlAsciiStatements == null) {
jCheckBoxPrintXmlAsciiStatements = new JCheckBox();
jCheckBoxPrintXmlAsciiStatements.setText(m_tulosta_asciimath_lausekkeet_tiivistelma_lehdykkaan);
jCheckBoxPrintXmlAsciiStatements.setBackground(asciiMath2Color);
}
return jCheckBoxPrintXmlAsciiStatements;
}
private JCheckBox getJCheckBoxCheckStrikeErrors() {
if(jCheckBoxCheckStrikeErrors == null) {
jCheckBoxCheckStrikeErrors = new JCheckBox();
jCheckBoxCheckStrikeErrors.setBackground(asciiMathColor);
jCheckBoxCheckStrikeErrors.setEnabled(true);
jCheckBoxCheckStrikeErrors.setSelected(true);
jCheckBoxCheckStrikeErrors.setText(m_jCheckBoxCheckStrikeErrors_label);
}
return jCheckBoxCheckStrikeErrors;
}
private JCheckBox getJCheckBoxCheckStrikeErrors2() {
if(jCheckBoxCheckStrikeErrors2 == null) {
jCheckBoxCheckStrikeErrors2 = new JCheckBox();
jCheckBoxCheckStrikeErrors2.setBackground(asciiMath2Color);
jCheckBoxCheckStrikeErrors2.setEnabled(true);
jCheckBoxCheckStrikeErrors2.setSelected(true);
jCheckBoxCheckStrikeErrors2.setText(m_jCheckBoxCheckStrikeErrors_label);
}
return jCheckBoxCheckStrikeErrors2;
}
private JPanel getJPanelInputDoc() {
if(jPanelInputDoc == null) {
jPanelInputDoc = new JPanel();
jPanelInputDoc.setBackground(asciiMath2Color);
}
return jPanelInputDoc;
}
private JCheckBox getJCheckBoxCorrectStrikeErrors() {
if(jCheckBoxCorrectStrikeErrors2 == null) {
jCheckBoxCorrectStrikeErrors2 = new JCheckBox();
jCheckBoxCorrectStrikeErrors2.setBackground(asciiMath2Color);
// jCheckBoxCorrectStrikeErrors2.setText("Korjaa hipsuvirheet");
jCheckBoxCorrectStrikeErrors2.setText(m_correctStrikeErrors);
}
return jCheckBoxCorrectStrikeErrors2;
}
private JCheckBox getJCheckBoxCorrectStrikeErrorsB() {
if(jCheckBoxCorrectStrikeErrors == null) {
jCheckBoxCorrectStrikeErrors = new JCheckBox();
jCheckBoxCorrectStrikeErrors.setBackground(asciiMathColor);
jCheckBoxCorrectStrikeErrors.setText(m_correctStrikeErrors);
}
return jCheckBoxCorrectStrikeErrors;
}
private JPanel getJPanel1() {
if(jPanel1 == null) {
jPanel1 = new JPanel();
BorderLayout jPanel1Layout = new BorderLayout();
//jPanel1.setPreferredSize(new java.awt.Dimension(1073, 14));
jPanel1.setLayout(jPanel1Layout);
jMessageLabel = new JLabel();
BorderLayout jMessageLabelLayout = new BorderLayout();
jMessageLabel.setLayout(jMessageLabelLayout);
jPanel1.add(jMessageLabel, BorderLayout.WEST);
jPanel1.add(getJLabelPageNumber(), BorderLayout.EAST);
}
return jPanel1;
}
private JLabel getJLabelPageNumber() {
if(jLabelPageNumber == null) {
jLabelPageNumber = new JLabel();
jLabelPageNumber.setBackground(asciiMathColor);
jLabelPageNumber.setText(m_pagenumber);
}
return jLabelPageNumber;
}
private JLabel getJLabelPageNumberConvert() {
if(jLabelPageNumberConvert == null) {
jLabelPageNumberConvert = new JLabel();
jLabelPageNumberConvert.setBackground(asciiMath2ColorConvert);
jLabelPageNumberConvert.setText(m_pagenumberConvert);
}
return jLabelPageNumberConvert;
}
/*
private JLabel getJLabel1() {
if(jLabel1 == null) {
jLabel1 = new JLabel();
jLabel1.setText("getJPanelLanguage");
}
return jLabel1;
}
*/
private JScrollPane getJScrollPaneUnModifiedDtBook() {
if(jScrollUnModiedDtbook == null) {
jScrollUnModiedDtbook = new JScrollPane();
jScrollUnModiedDtbook.setPreferredSize(new java.awt.Dimension(1068, 313));
jScrollUnModiedDtbook.setViewportView(getUnModiedDtbookOfJAsciiMathTextArea());
//jScrollPane1.setPreferredSize(new java.awt.Dimension(1068, 317));
}
return jScrollUnModiedDtbook;
}
private JPanel getJPanelRuleTab() {
if(jPanelRuleTab == null) {
jPanelRuleTab = new JPanel();
//jPanel2.setPreferredSize(new java.awt.Dimension(1068, 572));
jPanelRuleTab.setLayout(new BorderLayout());
jPanelRuleTab.add(getJInputOutPutPanel(), BorderLayout.NORTH);
jPanelRuleTab.add(getJAsciiMathScrollPane(), BorderLayout.CENTER);
}
return jPanelRuleTab;
}
private JPanel getJPanelXmlAsciiMath() {
if(jPanelXmlAsciiMath == null) {
jPanelXmlAsciiMath = new JPanel();
BorderLayout bl = new BorderLayout ();
jPanelXmlAsciiMath.setLayout(bl);
jPanelXmlAsciiMath.setPreferredSize(new java.awt.Dimension(1068, 572));
jPanelXmlAsciiMath.add(getJInputOutPutPanelXmlAsciiMathTab(), BorderLayout.NORTH);
jPanelXmlAsciiMath.add(getJScrollPaneXmlAsciiMath(), BorderLayout.CENTER);
}
return jPanelXmlAsciiMath;
}
private JPanel getJPanelCharEditorPanel() {
if(jPanelCharEditorPanel == null) {
BorderLayout bl = new BorderLayout();
jPanelCharEditorPanel = new JPanel();
jPanelCharEditorPanel.setLayout(bl);
//jPanel2.setPreferredSize(new java.awt.Dimension(1068, 572));
jPanelCharEditorPanel.add(getJCharEditorPanel(), BorderLayout.NORTH);
}
return jPanelCharEditorPanel;
}
private JPanel getJInputOutPutPanelXmlAsciiMathTab() {
if(jPanelJInputOutPutPanelXmlAsciiMathTab == null) {
jPanelJInputOutPutPanelXmlAsciiMathTab = new JPanel();
jPanelJInputOutPutPanelXmlAsciiMathTab.setPreferredSize(new java.awt.Dimension(1068, 237));
BorderLayout bl = new BorderLayout();
jPanelJInputOutPutPanelXmlAsciiMathTab.setLayout(bl);
jPanelJInputOutPutPanelXmlAsciiMathTab.add(getJInputOutPutPanelXmlAsciiMath(), BorderLayout.NORTH);
}
return jPanelJInputOutPutPanelXmlAsciiMathTab;
}
private JPanel getJInputOutPutPanelConvertTab() {
if(jPanelJInputOutPutPanelConvertTab == null) {
jPanelJInputOutPutPanelConvertTab = new JPanel();
jPanelJInputOutPutPanelConvertTab.setPreferredSize(new java.awt.Dimension(1068, 237));
BorderLayout bl = new BorderLayout();
jPanelJInputOutPutPanelConvertTab.setLayout(bl);
jPanelJInputOutPutPanelConvertTab.add(getJInputOutPutPanelConvert(), BorderLayout.NORTH);
}
return jPanelJInputOutPutPanelConvertTab;
}
private JScrollPane getJScrollPaneXmlAsciiMath() {
if(jScrollPaneXmlAsciiMath == null) {
jScrollPaneXmlAsciiMath = new JScrollPane();
jScrollPaneXmlAsciiMath.setViewportView(getJXmlAsciiMathTextArea());
}
return jScrollPaneXmlAsciiMath;
}
private JScrollPane getJScrollPaneConvert() {
if(jScrollPaneConvert == null) {
jScrollPaneConvert = new JScrollPane();
jScrollPaneConvert.setViewportView(getJConvertTextArea());
}
return jScrollPaneConvert;
}
private JTextArea getJXmlAsciiMathTextArea() {
if(jXmlAsciiMathTextArea == null) {
jXmlAsciiMathTextArea = new JTextArea();
jXmlAsciiMathTextArea.setText(" ");
jXmlAsciiMathTextArea.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
/*
if (m_ZmlAsciiMathTextAreaCaretLoopEvent)
{
return;
}
*/
if (jXmlAsciiMathTextArea.getText().length() == 0)
return;
int dot = e.getDot();
int mark = e.getMark();
m_AsciiMathTextAreaCaretLoopEvent = true;
//if (dot == mark) { // no selection
try {
int iSelectedLineNumber = jXmlAsciiMathTextArea.getLineOfOffset(dot);
int iStartOfiSelectedLineNumber = jXmlAsciiMathTextArea.getLineStartOffset(iSelectedLineNumber);
int iEndOfiSelectedLineNumber = jXmlAsciiMathTextArea.getLineEndOffset(iSelectedLineNumber);
String strSelectedRow = jXmlAsciiMathTextArea.getText(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber);
/*
System.out.println("jXmlAsciiMathTextArea iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber +
"\n");
*/
jLabelPageNumber.setText("" +(iSelectedLineNumber+1)+" ");
//Convert it to view coordinates
//System.out.println("caret: text position: " + dot + "\n");
} catch (BadLocationException ble) {
System.out.println(ble.getMessage());
System.out.println("caret: text position: " + dot + "\n");
}
}
});
}
return jXmlAsciiMathTextArea;
}
private JTextArea getJConvertTextArea() {
if(jConvertTextArea == null) {
jConvertTextArea = new JTextArea();
jConvertTextArea.setText(" ");
jConvertTextArea.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent e) {
//System.out.println("keyTyped()");
m_bTextAreaChangedConvert = true;
}
});
jConvertTextArea.addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent e)
{
/*
if (m_ZmlAsciiMathTextAreaCaretLoopEvent)
{
return;
}
*/
if (jConvertTextArea.getText().length() == 0)
return;
int dot = e.getDot();
int mark = e.getMark();
m_ConvertTextAreaCaretLoopEvent = true;
//if (dot == mark) { // no selection
try {
int iSelectedLineNumber = jConvertTextArea.getLineOfOffset(dot);
int iStartOfiSelectedLineNumber = jConvertTextArea.getLineStartOffset(iSelectedLineNumber);
int iEndOfiSelectedLineNumber = jConvertTextArea.getLineEndOffset(iSelectedLineNumber);
String strSelectedRow = jConvertTextArea.getText(iStartOfiSelectedLineNumber, iEndOfiSelectedLineNumber);
/*
System.out.println("jXmlAsciiMathTextArea iStartOfiSelectedLineNumber: " + iStartOfiSelectedLineNumber +
" iEndOfiSelectedLineNumber: " + iEndOfiSelectedLineNumber +
"\n");
*/
if (iSelectedLineNumber < 0)
return; // tka 15.4.2011
jLabelPageNumber.setText("" +(iSelectedLineNumber+1)+" ");
//Convert it to view coordinates
//System.out.println("caret: text position: " + dot + "\n");
} catch (BadLocationException ble) {
System.out.println(ble.getMessage());
System.out.println("caret: text position: " + dot + "\n");
}
}
});
}
return jConvertTextArea;
}
private JPanel getJPanelConvert() {
if(jPanelConvert == null) {
jPanelConvert = new JPanel();
//if(jPanel_convert == null) {
//jPanel_convert = new JPanel();
BorderLayout bl = new BorderLayout ();
//jPanel_convert.setLayout(bl);
jPanelConvert.setLayout(bl);
jPanelConvert.setPreferredSize(new java.awt.Dimension(1066, 574));
// jPanelConvert.setPreferredSize(new java.awt.Dimension(1068, 572));
jPanelConvert.add(getJInputOutPutPanelConvertTab(), BorderLayout.NORTH);
jPanelConvert.add(getJScrollPaneConvert(), BorderLayout.CENTER);
//}
//return jPanel_convert;
// }
}
return jPanelConvert;
}
private JCheckBox getJCheckBoxPrintConvertWarnings() {
if(jCheckBoxPrintConvertWarnings == null) {
jCheckBoxPrintConvertWarnings = new JCheckBox();
jCheckBoxPrintConvertWarnings.setBackground(asciiMath2ColorConvert);
jCheckBoxPrintConvertWarnings.setText(m_convertCharCodes2WarningsPanel);
}
return jCheckBoxPrintConvertWarnings;
}
private JPanel getJPanelConvertExecution() {
if(jPanelConvertExecution == null) {
jPanelConvertExecution = new JPanel();
jPanelConvertExecution.add(getJCheckBoxPrintConvertWarnings());
jPanelConvertExecution.setBackground(asciiMath2ColorConvert);
jPanelConvertExecution.add(getJCheckContinueWithErrors());
}
return jPanelConvertExecution;
}
private JCheckBox getJCheckContinueWithErrors() {
if(jCheckContinueWithErrors == null) {
jCheckContinueWithErrors = new JCheckBox();
jCheckContinueWithErrors.setBackground(asciiMath2ColorConvert);
jCheckContinueWithErrors.setText(m_ConvertContinueWithErrors);
}
return jCheckContinueWithErrors;
}
}