Fixed removeListener issue + partial implementation of ?
This commit is contained in:
parent
5af79e9670
commit
9ee5ab9afc
|
@ -15,6 +15,7 @@ import javax.xml.stream.XMLStreamException;
|
||||||
import javax.xml.stream.events.*;
|
import javax.xml.stream.events.*;
|
||||||
|
|
||||||
import gui.I18N;
|
import gui.I18N;
|
||||||
|
import javafx.beans.InvalidationListener;
|
||||||
import javafx.beans.property.ReadOnlyDoubleProperty;
|
import javafx.beans.property.ReadOnlyDoubleProperty;
|
||||||
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
|
@ -34,6 +35,7 @@ public class XML_processing {
|
||||||
public static boolean isCancelled = false;
|
public static boolean isCancelled = false;
|
||||||
public static Date startTime = new Date();
|
public static Date startTime = new Date();
|
||||||
public static boolean isCollocability = false;
|
public static boolean isCollocability = false;
|
||||||
|
public static InvalidationListener progressBarListener;
|
||||||
|
|
||||||
public double getProgress() {
|
public double getProgress() {
|
||||||
return progressProperty().get();
|
return progressProperty().get();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package data;
|
package data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public enum CorpusType {
|
public enum CorpusType {
|
||||||
GIGAFIDA("Gigafida", "gigafida"),
|
GIGAFIDA("Gigafida", "gigafida"),
|
||||||
GIGAFIDA2("Gigafida2.0", "gigafida2.0"),
|
GIGAFIDA2("Gigafida2.0", "gigafida2.0"),
|
||||||
|
@ -25,4 +28,8 @@ public enum CorpusType {
|
||||||
public String getNameLowerCase() {
|
public String getNameLowerCase() {
|
||||||
return nameLowerCase;
|
return nameLowerCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<CorpusType> multipleFilesCorpuses() {
|
||||||
|
return new ArrayList<>(Arrays.asList(new CorpusType[]{GIGAFIDA, GIGAFIDA2, CCKRES}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,6 @@ public class CharacterAnalysisTab {
|
||||||
private boolean useDb;
|
private boolean useDb;
|
||||||
private HostServices hostService;
|
private HostServices hostService;
|
||||||
private ListChangeListener<String> taxonomyListener;
|
private ListChangeListener<String> taxonomyListener;
|
||||||
private InvalidationListener progressBarListener;
|
|
||||||
|
|
||||||
private static final String [] N_GRAM_COMPUTE_FOR_LETTERS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA"};
|
private static final String [] N_GRAM_COMPUTE_FOR_LETTERS_ARRAY = {"calculateFor.WORD", "calculateFor.LEMMA"};
|
||||||
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_LETTERS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_LETTERS_ARRAY));
|
private static final ArrayList<String> N_GRAM_COMPUTE_FOR_LETTERS = new ArrayList<>(Arrays.asList(N_GRAM_COMPUTE_FOR_LETTERS_ARRAY));
|
||||||
|
@ -637,13 +636,13 @@ public class CharacterAnalysisTab {
|
||||||
logger.info("Started execution: ", statistic.getFilter());
|
logger.info("Started execution: ", statistic.getFilter());
|
||||||
|
|
||||||
Collection<File> corpusFiles = statistic.getCorpus().getDetectedCorpusFiles();
|
Collection<File> corpusFiles = statistic.getCorpus().getDetectedCorpusFiles();
|
||||||
boolean corpusIsSplit = corpusFiles.size() > 1;
|
|
||||||
|
|
||||||
final Task<Void> task = new Task<Void>() {
|
final Task<Void> task = new Task<Void>() {
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
protected Void call() throws Exception {
|
protected Void call() throws Exception {
|
||||||
if(corpusFiles.size() > 1){
|
final boolean multipleFiles = CorpusType.multipleFilesCorpuses().contains(statistic.getCorpus().getCorpusType());
|
||||||
|
if(multipleFiles){
|
||||||
cancel.setVisible(true);
|
cancel.setVisible(true);
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -654,12 +653,16 @@ public class CharacterAnalysisTab {
|
||||||
for (File f : corpusFiles) {
|
for (File f : corpusFiles) {
|
||||||
final int iFinal = i;
|
final int iFinal = i;
|
||||||
XML_processing xml_processing = new XML_processing();
|
XML_processing xml_processing = new XML_processing();
|
||||||
|
xml_processing.isCancelled = false;
|
||||||
i++;
|
i++;
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (corpusFiles.size() > 1) {
|
if(xml_processing.progressBarListener != null) {
|
||||||
|
xml_processing.progressProperty().removeListener(xml_processing.progressBarListener);
|
||||||
|
}
|
||||||
|
if (multipleFiles) {
|
||||||
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
||||||
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
||||||
previousTime = new Date();
|
previousTime = new Date();
|
||||||
|
@ -667,11 +670,8 @@ public class CharacterAnalysisTab {
|
||||||
this.updateProgress(i, corpusFiles.size());
|
this.updateProgress(i, corpusFiles.size());
|
||||||
this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
||||||
} else {
|
} else {
|
||||||
if(progressBarListener != null) {
|
|
||||||
xml_processing.progressProperty().removeListener(progressBarListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBarListener = new InvalidationListener() {
|
xml_processing.progressBarListener = new InvalidationListener() {
|
||||||
int remainingSeconds = -1;
|
int remainingSeconds = -1;
|
||||||
Date previousTime = new Date();
|
Date previousTime = new Date();
|
||||||
@Override
|
@Override
|
||||||
|
@ -692,7 +692,7 @@ public class CharacterAnalysisTab {
|
||||||
// this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
// this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
||||||
|
|
||||||
|
|
||||||
xml_processing.progressProperty().addListener(progressBarListener);
|
xml_processing.progressProperty().addListener(xml_processing.progressBarListener);
|
||||||
|
|
||||||
// xml_processing.progressProperty().addListener((obs, oldProgress, newProgress) ->
|
// xml_processing.progressProperty().addListener((obs, oldProgress, newProgress) ->
|
||||||
// updateProgress((iFinal * 100) + newProgress.doubleValue(), corpusFiles.size() * 100));
|
// updateProgress((iFinal * 100) + newProgress.doubleValue(), corpusFiles.size() * 100));
|
||||||
|
|
|
@ -7,9 +7,12 @@ import static util.Util.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.util.Duration;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOCase;
|
import org.apache.commons.io.IOCase;
|
||||||
import org.apache.commons.io.LineIterator;
|
import org.apache.commons.io.LineIterator;
|
||||||
|
@ -96,8 +99,44 @@ public class CorpusTab {
|
||||||
private String corpusLocation;
|
private String corpusLocation;
|
||||||
private String corpusFilesSize;
|
private String corpusFilesSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hack allowing to modify the default behavior of the tooltips.
|
||||||
|
* @param openDelay The open delay, knowing that by default it is set to 1000.
|
||||||
|
* @param visibleDuration The visible duration, knowing that by default it is set to 5000.
|
||||||
|
* @param closeDelay The close delay, knowing that by default it is set to 200.
|
||||||
|
* @param hideOnExit Indicates whether the tooltip should be hide on exit,
|
||||||
|
* knowing that by default it is set to false.
|
||||||
|
*/
|
||||||
|
private static void updateTooltipBehavior(double openDelay, double visibleDuration,
|
||||||
|
double closeDelay, boolean hideOnExit) {
|
||||||
|
try {
|
||||||
|
// Get the non public field "BEHAVIOR"
|
||||||
|
Field fieldBehavior = Tooltip.class.getDeclaredField("BEHAVIOR");
|
||||||
|
// Make the field accessible to be able to get and set its value
|
||||||
|
fieldBehavior.setAccessible(true);
|
||||||
|
// Get the value of the static field
|
||||||
|
Object objBehavior = fieldBehavior.get(null);
|
||||||
|
// Get the constructor of the private static inner class TooltipBehavior
|
||||||
|
Constructor<?> constructor = objBehavior.getClass().getDeclaredConstructor(
|
||||||
|
Duration.class, Duration.class, Duration.class, boolean.class
|
||||||
|
);
|
||||||
|
// Make the constructor accessible to be able to invoke it
|
||||||
|
constructor.setAccessible(true);
|
||||||
|
// Create a new instance of the private static inner class TooltipBehavior
|
||||||
|
Object tooltipBehavior = constructor.newInstance(
|
||||||
|
new Duration(openDelay), new Duration(visibleDuration),
|
||||||
|
new Duration(closeDelay), hideOnExit
|
||||||
|
);
|
||||||
|
// Set the new instance of TooltipBehavior
|
||||||
|
fieldBehavior.set(null, tooltipBehavior);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
updateTooltipBehavior(0.0, 30000.0,0.0, true);
|
||||||
|
|
||||||
// add CSS style
|
// add CSS style
|
||||||
corpusTabPane.getStylesheets().add("style.css");
|
corpusTabPane.getStylesheets().add("style.css");
|
||||||
corpusTabPane.getStyleClass().add("root");
|
corpusTabPane.getStyleClass().add("root");
|
||||||
|
|
|
@ -158,7 +158,6 @@ public class OneWordAnalysisTab {
|
||||||
private ListChangeListener<String> taxonomyListener;
|
private ListChangeListener<String> taxonomyListener;
|
||||||
private ListChangeListener<String> alsoVisualizeListener;
|
private ListChangeListener<String> alsoVisualizeListener;
|
||||||
private ChangeListener<String> calculateForListener;
|
private ChangeListener<String> calculateForListener;
|
||||||
private InvalidationListener progressBarListener;
|
|
||||||
|
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
||||||
|
@ -742,7 +741,8 @@ public class OneWordAnalysisTab {
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
protected Void call() throws Exception {
|
protected Void call() throws Exception {
|
||||||
if(corpusFiles.size() > 1){
|
final boolean multipleFiles = CorpusType.multipleFilesCorpuses().contains(statistic.getCorpus().getCorpusType());
|
||||||
|
if(multipleFiles){
|
||||||
cancel.setVisible(true);
|
cancel.setVisible(true);
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -752,8 +752,12 @@ public class OneWordAnalysisTab {
|
||||||
for (File f : corpusFiles) {
|
for (File f : corpusFiles) {
|
||||||
final int iFinal = i;
|
final int iFinal = i;
|
||||||
XML_processing xml_processing = new XML_processing();
|
XML_processing xml_processing = new XML_processing();
|
||||||
|
xml_processing.isCancelled = false;
|
||||||
i++;
|
i++;
|
||||||
if (corpusFiles.size() > 1) {
|
if(xml_processing.progressBarListener != null) {
|
||||||
|
xml_processing.progressProperty().removeListener(xml_processing.progressBarListener);
|
||||||
|
}
|
||||||
|
if (multipleFiles) {
|
||||||
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
||||||
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
||||||
previousTime = new Date();
|
previousTime = new Date();
|
||||||
|
@ -765,11 +769,8 @@ public class OneWordAnalysisTab {
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
if(progressBarListener != null) {
|
|
||||||
xml_processing.progressProperty().removeListener(progressBarListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBarListener = new InvalidationListener() {
|
xml_processing.progressBarListener = new InvalidationListener() {
|
||||||
int remainingSeconds = -1;
|
int remainingSeconds = -1;
|
||||||
Date previousTime = new Date();
|
Date previousTime = new Date();
|
||||||
@Override
|
@Override
|
||||||
|
@ -787,7 +788,7 @@ public class OneWordAnalysisTab {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xml_processing.progressProperty().addListener(progressBarListener);
|
xml_processing.progressProperty().addListener(xml_processing.progressBarListener);
|
||||||
}
|
}
|
||||||
xml_processing.readXML(f.toString(), statistic);
|
xml_processing.readXML(f.toString(), statistic);
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
|
|
|
@ -207,7 +207,6 @@ public class StringAnalysisTabNew2 {
|
||||||
private ListChangeListener<String> alsoVisualizeListener;
|
private ListChangeListener<String> alsoVisualizeListener;
|
||||||
private ListChangeListener<String> collocabilityListener;
|
private ListChangeListener<String> collocabilityListener;
|
||||||
private ChangeListener<String> calculateForListener;
|
private ChangeListener<String> calculateForListener;
|
||||||
private InvalidationListener progressBarListener;
|
|
||||||
|
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica", "oblikoskladenjska oznaka");
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
||||||
|
@ -917,7 +916,8 @@ public class StringAnalysisTabNew2 {
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
protected Void call() throws Exception {
|
protected Void call() throws Exception {
|
||||||
if(corpusFiles.size() > 1){
|
final boolean multipleFiles = CorpusType.multipleFilesCorpuses().contains(statistic.getCorpus().getCorpusType());
|
||||||
|
if(multipleFiles){
|
||||||
cancel.setVisible(true);
|
cancel.setVisible(true);
|
||||||
}
|
}
|
||||||
int i = corpusFiles.size();
|
int i = corpusFiles.size();
|
||||||
|
@ -934,7 +934,10 @@ public class StringAnalysisTabNew2 {
|
||||||
final int iFinal = i;
|
final int iFinal = i;
|
||||||
XML_processing xml_processing = new XML_processing();
|
XML_processing xml_processing = new XML_processing();
|
||||||
i++;
|
i++;
|
||||||
if (corpusFiles.size() > 1) {
|
if(xml_processing.progressBarListener != null) {
|
||||||
|
xml_processing.progressProperty().removeListener(xml_processing.progressBarListener);
|
||||||
|
}
|
||||||
|
if (multipleFiles) {
|
||||||
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
||||||
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusSize - i) / 1000);
|
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusSize - i) / 1000);
|
||||||
previousTime = new Date();
|
previousTime = new Date();
|
||||||
|
@ -946,11 +949,7 @@ public class StringAnalysisTabNew2 {
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
if(progressBarListener != null) {
|
xml_processing.progressBarListener = new InvalidationListener() {
|
||||||
xml_processing.progressProperty().removeListener(progressBarListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBarListener = new InvalidationListener() {
|
|
||||||
int remainingSeconds = -1;
|
int remainingSeconds = -1;
|
||||||
Date previousTime = new Date();
|
Date previousTime = new Date();
|
||||||
@Override
|
@Override
|
||||||
|
@ -972,7 +971,7 @@ public class StringAnalysisTabNew2 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xml_processing.progressProperty().addListener(progressBarListener);
|
xml_processing.progressProperty().addListener(xml_processing.progressBarListener);
|
||||||
}
|
}
|
||||||
xml_processing.isCollocability = true;
|
xml_processing.isCollocability = true;
|
||||||
xml_processing.readXML(f.toString(), statisticsOneGrams);
|
xml_processing.readXML(f.toString(), statisticsOneGrams);
|
||||||
|
@ -1078,7 +1077,8 @@ public class StringAnalysisTabNew2 {
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
protected Void call() throws Exception {
|
protected Void call() throws Exception {
|
||||||
if(corpusFiles.size() > 1){
|
final boolean multipleFiles = CorpusType.multipleFilesCorpuses().contains(statistic.getCorpus().getCorpusType());
|
||||||
|
if(multipleFiles){
|
||||||
cancel.setVisible(true);
|
cancel.setVisible(true);
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -1094,8 +1094,12 @@ public class StringAnalysisTabNew2 {
|
||||||
for (File f : corpusFiles) {
|
for (File f : corpusFiles) {
|
||||||
final int iFinal = i;
|
final int iFinal = i;
|
||||||
XML_processing xml_processing = new XML_processing();
|
XML_processing xml_processing = new XML_processing();
|
||||||
|
xml_processing.isCancelled = false;
|
||||||
i++;
|
i++;
|
||||||
if (corpusFiles.size() > 1) {
|
if(xml_processing.progressBarListener != null) {
|
||||||
|
xml_processing.progressProperty().removeListener(xml_processing.progressBarListener);
|
||||||
|
}
|
||||||
|
if (multipleFiles) {
|
||||||
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
||||||
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusSize - i) / 1000);
|
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusSize - i) / 1000);
|
||||||
previousTime = new Date();
|
previousTime = new Date();
|
||||||
|
@ -1107,11 +1111,7 @@ public class StringAnalysisTabNew2 {
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
if(progressBarListener != null) {
|
xml_processing.progressBarListener = new InvalidationListener() {
|
||||||
xml_processing.progressProperty().removeListener(progressBarListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBarListener = new InvalidationListener() {
|
|
||||||
int remainingSeconds = -1;
|
int remainingSeconds = -1;
|
||||||
Date previousTime = new Date();
|
Date previousTime = new Date();
|
||||||
@Override
|
@Override
|
||||||
|
@ -1133,14 +1133,14 @@ public class StringAnalysisTabNew2 {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xml_processing.progressProperty().addListener(progressBarListener);
|
xml_processing.progressProperty().addListener(xml_processing.progressBarListener);
|
||||||
}
|
}
|
||||||
xml_processing.readXML(f.toString(), statistic);
|
xml_processing.readXML(f.toString(), statistic);
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!(corpusFiles.size() > 1)){
|
if(!(multipleFiles)){
|
||||||
cancel.setVisible(false);
|
cancel.setVisible(false);
|
||||||
}
|
}
|
||||||
// readXML(f.toString(), statistic);
|
// readXML(f.toString(), statistic);
|
||||||
|
|
|
@ -198,7 +198,6 @@ public class WordLevelTab {
|
||||||
private ListChangeListener<String> taxonomyListener;
|
private ListChangeListener<String> taxonomyListener;
|
||||||
private ListChangeListener<String> alsoVisualizeListener;
|
private ListChangeListener<String> alsoVisualizeListener;
|
||||||
private ChangeListener<String> calculateForListener;
|
private ChangeListener<String> calculateForListener;
|
||||||
private InvalidationListener progressBarListener;
|
|
||||||
|
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_WORDS = FXCollections.observableArrayList("lema", "različnica");
|
||||||
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
// private static final ObservableList<String> N_GRAM_COMPUTE_FOR_LETTERS = FXCollections.observableArrayList("lema", "različnica");
|
||||||
|
@ -890,7 +889,8 @@ public class WordLevelTab {
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Override
|
@Override
|
||||||
protected Void call() throws Exception {
|
protected Void call() throws Exception {
|
||||||
if(corpusFiles.size() > 1){
|
final boolean multipleFiles = CorpusType.multipleFilesCorpuses().contains(statistic.getCorpus().getCorpusType());
|
||||||
|
if(multipleFiles){
|
||||||
cancel.setVisible(true);
|
cancel.setVisible(true);
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -900,12 +900,16 @@ public class WordLevelTab {
|
||||||
for (File f : corpusFiles) {
|
for (File f : corpusFiles) {
|
||||||
final int iFinal = i;
|
final int iFinal = i;
|
||||||
XML_processing xml_processing = new XML_processing();
|
XML_processing xml_processing = new XML_processing();
|
||||||
|
xml_processing.isCancelled = false;
|
||||||
i++;
|
i++;
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
updateMessage(I18N.get("message.CANCELING_NOTIFICATION"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (corpusFiles.size() > 1) {
|
if(xml_processing.progressBarListener != null) {
|
||||||
|
xml_processing.progressProperty().removeListener(xml_processing.progressBarListener);
|
||||||
|
}
|
||||||
|
if (multipleFiles) {
|
||||||
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
if ((new Date()).getTime() - previousTime.getTime() > 500 || remainingSeconds == -1){
|
||||||
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
remainingSeconds = (int) (((new Date()).getTime() - startTime.getTime()) * (1.0/i) * (corpusFiles.size() - i) / 1000);
|
||||||
previousTime = new Date();
|
previousTime = new Date();
|
||||||
|
@ -913,11 +917,7 @@ public class WordLevelTab {
|
||||||
this.updateProgress(i, corpusFiles.size());
|
this.updateProgress(i, corpusFiles.size());
|
||||||
this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
this.updateMessage(String.format(I18N.get("message.ONGOING_NOTIFICATION_ANALYZING_FILE_X_OF_Y"), i, corpusFiles.size(), f.getName(), remainingSeconds));
|
||||||
} else {
|
} else {
|
||||||
if(progressBarListener != null) {
|
xml_processing.progressBarListener = new InvalidationListener() {
|
||||||
xml_processing.progressProperty().removeListener(progressBarListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
progressBarListener = new InvalidationListener() {
|
|
||||||
int remainingSeconds = -1;
|
int remainingSeconds = -1;
|
||||||
Date previousTime = new Date();
|
Date previousTime = new Date();
|
||||||
@Override
|
@Override
|
||||||
|
@ -935,7 +935,7 @@ public class WordLevelTab {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xml_processing.progressProperty().addListener(progressBarListener);
|
xml_processing.progressProperty().addListener(xml_processing.progressBarListener);
|
||||||
}
|
}
|
||||||
xml_processing.readXML(f.toString(), statistic);
|
xml_processing.readXML(f.toString(), statistic);
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
|
|
|
@ -16,11 +16,18 @@
|
||||||
<?import javafx.scene.control.ComboBox?>
|
<?import javafx.scene.control.ComboBox?>
|
||||||
<?import javafx.collections.FXCollections?>
|
<?import javafx.collections.FXCollections?>
|
||||||
<?import java.lang.String?>
|
<?import java.lang.String?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.image.Image?>
|
||||||
<AnchorPane fx:id="characterAnalysisTab" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.CharacterAnalysisTab">
|
<AnchorPane fx:id="characterAnalysisTab" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.CharacterAnalysisTab">
|
||||||
<Pane>
|
<Pane>
|
||||||
<Label fx:id="stringLengthL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Število črk" />
|
<Label fx:id="stringLengthL" layoutX="10.0" layoutY="20.0" prefHeight="25.0" text="Število črk" />
|
||||||
<TextField fx:id="stringLengthTF" layoutX="225.0" layoutY="20.0" prefWidth="140.0" />
|
<TextField fx:id="stringLengthTF" layoutX="225.0" layoutY="20.0" prefWidth="140.0" />
|
||||||
<Label fx:id="stringLengthLH" layoutX="10.0" layoutY="50.0" prefHeight="10.0" text="Dolžina črkovnih nizov" styleClass="help"/>
|
<Label fx:id="stringLengthLH" layoutX="10.0" layoutY="50.0" prefHeight="10.0" text="Dolžina črkovnih nizov" styleClass="help"/>
|
||||||
|
<ImageView fx:id="imageView" layoutX="1.0" layoutY="1.0" pickOnBounds="true" preserveRatio="true">
|
||||||
|
<image>
|
||||||
|
<Image url="questionmark.png" backgroundLoading="true"/>
|
||||||
|
</image>
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
<Label fx:id="calculateForL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Izračunaj za"/>
|
<Label fx:id="calculateForL" layoutX="10.0" layoutY="60.0" prefHeight="25.0" text="Izračunaj za"/>
|
||||||
<ComboBox fx:id="calculateForCB" layoutX="225.0" layoutY="60.0" minWidth="140.0" prefWidth="140.0"
|
<ComboBox fx:id="calculateForCB" layoutX="225.0" layoutY="60.0" minWidth="140.0" prefWidth="140.0"
|
||||||
|
|
BIN
src/main/resources/gui/questionmark.png
Normal file
BIN
src/main/resources/gui/questionmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 855 B |
BIN
src/main/resources/questionmark.png
Normal file
BIN
src/main/resources/questionmark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 855 B |
Loading…
Reference in New Issue
Block a user