refactor listener and add new duplicates filter
This commit is contained in:
parent
8e6f7098af
commit
5f5abb98b8
@ -2,8 +2,9 @@ package de.marhali.easyi18n.model.bus;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for communication of changes for participants of the data bus.
|
* Interface for communication of changes for participants of the data bus.
|
||||||
* Every listener needs to be registered manually via {@link de.marhali.easyi18n.DataBus}.
|
* Every listener needs to be registered via {@link de.marhali.easyi18n.DataBus}.
|
||||||
|
*
|
||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public interface BusListener extends UpdateDataListener, FocusKeyListener,
|
public interface BusListener extends UpdateDataListener, FilterIncompleteListener,
|
||||||
SearchQueryListener, FilterMissingTranslationsListener {}
|
FilterDuplicateListener, SearchQueryListener, FocusKeyListener {}
|
@ -0,0 +1,14 @@
|
|||||||
|
package de.marhali.easyi18n.model.bus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single event listener
|
||||||
|
* @see #onFilterDuplicate(boolean)
|
||||||
|
* @author marhali
|
||||||
|
*/
|
||||||
|
public interface FilterDuplicateListener {
|
||||||
|
/**
|
||||||
|
* Toggles filter of duplicated translation values
|
||||||
|
* @param filter True if only translations with duplicates values should be shown
|
||||||
|
*/
|
||||||
|
void onFilterDuplicate(boolean filter);
|
||||||
|
}
|
@ -4,10 +4,10 @@ package de.marhali.easyi18n.model.bus;
|
|||||||
* Single event listener.
|
* Single event listener.
|
||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public interface FilterMissingTranslationsListener {
|
public interface FilterIncompleteListener {
|
||||||
/**
|
/**
|
||||||
* Toggles filter of missing translations
|
* Toggles filter of missing translations
|
||||||
* @param filter True if only translations with missing values should bw shown
|
* @param filter True if only translations with missing values should be shown
|
||||||
*/
|
*/
|
||||||
void onFilterMissingTranslations(boolean filter);
|
void onFilterIncomplete(boolean filter);
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public interface SearchQueryListener {
|
public interface SearchQueryListener {
|
||||||
/**
|
/**
|
||||||
* Filter the displayed data according to the search query. Supply 'null' to return to the normal state.
|
* Filter the displayed data according to the search query. Supply 'null' to return to the normal state.
|
||||||
* The keys and the content itself should be considered.
|
* The keys and the content itself should be considered (full-text-search).
|
||||||
* @param query Filter key or content
|
* @param query Filter key or content
|
||||||
*/
|
*/
|
||||||
void onSearchQuery(@Nullable String query);
|
void onSearchQuery(@Nullable String query);
|
||||||
|
@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
*/
|
*/
|
||||||
public interface UpdateDataListener {
|
public interface UpdateDataListener {
|
||||||
/**
|
/**
|
||||||
* Update the translations based on the supplied data.
|
* Update the underlying translation data set.
|
||||||
* @param data Updated translations
|
* @param data Updated translations
|
||||||
*/
|
*/
|
||||||
void onUpdateData(@NotNull TranslationData data);
|
void onUpdateData(@NotNull TranslationData data);
|
||||||
|
@ -2,7 +2,7 @@ package de.marhali.easyi18n.tabs.mapper;
|
|||||||
|
|
||||||
import de.marhali.easyi18n.model.TranslationData;
|
import de.marhali.easyi18n.model.TranslationData;
|
||||||
import de.marhali.easyi18n.model.action.TranslationUpdate;
|
import de.marhali.easyi18n.model.action.TranslationUpdate;
|
||||||
import de.marhali.easyi18n.model.bus.FilterMissingTranslationsListener;
|
import de.marhali.easyi18n.model.bus.FilterIncompleteListener;
|
||||||
import de.marhali.easyi18n.model.bus.SearchQueryListener;
|
import de.marhali.easyi18n.model.bus.SearchQueryListener;
|
||||||
import de.marhali.easyi18n.model.KeyPath;
|
import de.marhali.easyi18n.model.KeyPath;
|
||||||
import de.marhali.easyi18n.model.Translation;
|
import de.marhali.easyi18n.model.Translation;
|
||||||
@ -23,7 +23,7 @@ import java.util.function.Consumer;
|
|||||||
* Mapping {@link TranslationData} to {@link TableModel}.
|
* Mapping {@link TranslationData} to {@link TableModel}.
|
||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public class TableModelMapper implements TableModel, SearchQueryListener, FilterMissingTranslationsListener {
|
public class TableModelMapper implements TableModel, SearchQueryListener, FilterIncompleteListener {
|
||||||
|
|
||||||
private final @NotNull TranslationData data;
|
private final @NotNull TranslationData data;
|
||||||
private final @NotNull KeyPathConverter converter;
|
private final @NotNull KeyPathConverter converter;
|
||||||
|
@ -5,7 +5,7 @@ import com.intellij.ui.JBColor;
|
|||||||
|
|
||||||
import de.marhali.easyi18n.model.TranslationData;
|
import de.marhali.easyi18n.model.TranslationData;
|
||||||
import de.marhali.easyi18n.model.TranslationNode;
|
import de.marhali.easyi18n.model.TranslationNode;
|
||||||
import de.marhali.easyi18n.model.bus.FilterMissingTranslationsListener;
|
import de.marhali.easyi18n.model.bus.FilterIncompleteListener;
|
||||||
import de.marhali.easyi18n.model.bus.SearchQueryListener;
|
import de.marhali.easyi18n.model.bus.SearchQueryListener;
|
||||||
import de.marhali.easyi18n.model.KeyPath;
|
import de.marhali.easyi18n.model.KeyPath;
|
||||||
import de.marhali.easyi18n.model.TranslationValue;
|
import de.marhali.easyi18n.model.TranslationValue;
|
||||||
@ -25,7 +25,7 @@ import java.util.Map;
|
|||||||
* Mapping {@link TranslationData} to {@link TreeModel}.
|
* Mapping {@link TranslationData} to {@link TreeModel}.
|
||||||
* @author marhali
|
* @author marhali
|
||||||
*/
|
*/
|
||||||
public class TreeModelMapper extends DefaultTreeModel implements SearchQueryListener, FilterMissingTranslationsListener {
|
public class TreeModelMapper extends DefaultTreeModel implements SearchQueryListener, FilterIncompleteListener {
|
||||||
|
|
||||||
private final TranslationData data;
|
private final TranslationData data;
|
||||||
private final KeyPathConverter converter;
|
private final KeyPathConverter converter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user