You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
4.7 KiB
119 lines
4.7 KiB
package gui;
|
|
|
|
import static javafx.scene.control.Alert.AlertType.*;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Locale;
|
|
|
|
import javafx.scene.control.Alert;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.layout.Pane;
|
|
|
|
public class Messages {
|
|
|
|
// warnings & errors
|
|
public static String WARNING_ONLY_NUMBERS_ALLOWED = I18N.get("message.WARNING_ONLY_NUMBERS_ALLOWED");
|
|
public static String WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES = I18N.get("message.WARNING_MISMATCHED_NGRAM_AND_TOKENS_VALUES");
|
|
public static String WARNING_MISSING_STRING_LENGTH = I18N.get("message.WARNING_MISSING_STRING_LENGTH");
|
|
public static String ERROR_WHILE_EXECUTING = I18N.get("message.ERROR_WHILE_EXECUTING");
|
|
public static String ERROR_WHILE_SAVING_RESULTS_TO_CSV = I18N.get("message.ERROR_WHILE_SAVING_RESULTS_TO_CSV");
|
|
public static String ERROR_NOT_ENOUGH_MEMORY= I18N.get("message.ERROR_NOT_ENOUGH_MEMORY");
|
|
|
|
|
|
// general notifications - static content/set only once
|
|
public static String NOTIFICATION_ANALYSIS_COMPLETED = I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED");
|
|
public static String NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS = I18N.get("message.NOTIFICATION_ANALYSIS_COMPLETED_NO_RESULTS");
|
|
|
|
// ongoing notifications - displayed while processing, dynamically changing
|
|
public static String ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y = I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y");
|
|
public static String CANCELING_NOTIFICATION = I18N.get("message.CANCELING_NOTIFICATION");
|
|
|
|
// Labels
|
|
public static String LABEL_CORPUS_LOCATION_NOT_SET = I18N.get("message.LABEL_CORPUS_LOCATION_NOT_SET");
|
|
public static String LABEL_RESULTS_LOCATION_NOT_SET = I18N.get("message.LABEL_RESULTS_LOCATION_NOT_SET");
|
|
|
|
public static String TOOLTIP_readNotePunctuationsChB = I18N.get("message.TOOLTIP_readNotePunctuationsChB");
|
|
public static String TOOLTIP_readDisplayTaxonomyChB = I18N.get("message.TOOLTIP_readDisplayTaxonomyChB");
|
|
|
|
private static Label chooseCorpusL;
|
|
private static String chooseCorpusLabelContent;
|
|
private static String[] chooseCorpusLabelProperties;
|
|
|
|
private static Pane paneSlo;
|
|
private static Pane paneEng;
|
|
|
|
// Not properly to be here. TODO move somewhere else in future
|
|
public static String HELP_URL = "http://slovnica.ijs.si/";
|
|
public static String CJVT_URL = "http://hdl.handle.net/11356/1227";
|
|
public static String GITHUB_URL = "https://gitea.cjvt.si/lkrsnik/list";
|
|
|
|
// helper maps
|
|
/**
|
|
* Typical window titles
|
|
* ERROR = "Napaka"
|
|
* WARNING = "Opozorilo"
|
|
* CONFIRMATION = "Potrdilo"
|
|
*/
|
|
static HashMap<Alert.AlertType, String> windowTitles = new HashMap<>();
|
|
|
|
static {
|
|
// automatically set window's title
|
|
windowTitles.put(ERROR, I18N.get("windowTitles.error"));
|
|
windowTitles.put(WARNING, I18N.get("windowTitles.warning"));
|
|
windowTitles.put(CONFIRMATION, I18N.get("windowTitles.confirmation"));
|
|
}
|
|
|
|
public static void reload(){
|
|
LABEL_CORPUS_LOCATION_NOT_SET = I18N.createStringBinding("message.LABEL_CORPUS_LOCATION_NOT_SET").get();
|
|
windowTitles = new HashMap<>();
|
|
windowTitles.put(ERROR, I18N.get("windowTitles.error"));
|
|
windowTitles.put(WARNING, I18N.get("windowTitles.warning"));
|
|
windowTitles.put(CONFIRMATION, I18N.get("windowTitles.confirmation"));
|
|
|
|
if(I18N.getLocale().equals(Locale.ENGLISH)){
|
|
paneSlo.setVisible(false);
|
|
paneEng.setVisible(true);
|
|
} else {
|
|
paneSlo.setVisible(true);
|
|
paneEng.setVisible(false);
|
|
}
|
|
}
|
|
|
|
public static void setPane(Pane paneSl, Pane paneEn){
|
|
paneSlo = paneSl;
|
|
paneEng = paneEn;
|
|
}
|
|
|
|
public static void setChooseCorpusL(Label chooseCorpus, String chooseCorpusLabel){
|
|
chooseCorpusL = chooseCorpus;
|
|
chooseCorpusLabelContent = chooseCorpusLabel;
|
|
|
|
chooseCorpusL.textProperty().unbind();
|
|
chooseCorpusL.setText(chooseCorpusLabelContent);
|
|
}
|
|
|
|
public static void setChooseCorpusProperties(String corpusLoc, String corpusFilesSi, String corpusName){
|
|
chooseCorpusLabelProperties = new String[3];
|
|
chooseCorpusLabelProperties[0] = corpusLoc;
|
|
chooseCorpusLabelProperties[1] = corpusFilesSi;
|
|
chooseCorpusLabelProperties[2] = corpusName;
|
|
}
|
|
|
|
public static void updateChooseCorpusL(){
|
|
if (chooseCorpusLabelProperties != null && chooseCorpusLabelProperties[0] != null && chooseCorpusLabelProperties[1] != null && chooseCorpusLabelProperties[2] != null) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(chooseCorpusLabelProperties[0])
|
|
.append("\n")
|
|
.append(String.format(I18N.get("message.NOTIFICATION_FOUND_X_FILES"), chooseCorpusLabelProperties[1]))
|
|
.append("\n")
|
|
.append(String.format(I18N.get("message.NOTIFICATION_CORPUS"), chooseCorpusLabelProperties[2]));
|
|
|
|
chooseCorpusLabelContent = sb.toString();
|
|
if (chooseCorpusL != null) {
|
|
chooseCorpusL.textProperty().unbind();
|
|
chooseCorpusL.setText(chooseCorpusLabelContent);
|
|
}
|
|
}
|
|
}
|
|
}
|