77 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Java
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Java
		
	
	
		
			Executable File
		
	
	
	
	
| package data;
 | |
| 
 | |
| import java.util.ArrayList;
 | |
| import java.util.Arrays;
 | |
| import java.util.stream.Collectors;
 | |
| 
 | |
| import javafx.collections.FXCollections;
 | |
| import javafx.collections.ObservableList;
 | |
| 
 | |
| public enum GigafidaTaxonomy {
 | |
| 	TISK("tisk", "T"),
 | |
| 	KNJIZNO("knjižno", "T.K"),
 | |
| 	LEPOSLOVNO("leposlovno", "T.K.L"),
 | |
| 	STROKOVNO("strokovno", "T.K.S"),
 | |
| 	PERIODICNO("periodično", "T.P"),
 | |
| 	CASOPIS("časopis", "T.P.C"),
 | |
| 	REVIJA("revija", "T.P.R"),
 | |
| 	INTERNET("internet", "I");
 | |
| 
 | |
| 	private final String name;
 | |
| 	private final String taxonomy;
 | |
| 
 | |
| 	private static final ObservableList<String> FOR_COMBO_BOX;
 | |
| 
 | |
| 	static {
 | |
| 		ArrayList<String> values = Arrays.stream(GigafidaTaxonomy.values()).map(x -> x.name).collect(Collectors.toCollection(ArrayList::new));
 | |
| 		FOR_COMBO_BOX = FXCollections.observableArrayList(values);
 | |
| 	}
 | |
| 
 | |
| 	GigafidaTaxonomy(String name, String taxonomy) {
 | |
| 		this.name = name;
 | |
| 		this.taxonomy = taxonomy;
 | |
| 	}
 | |
| 
 | |
| 	public String toString() {
 | |
| 		return this.name;
 | |
| 	}
 | |
| 
 | |
| 	public String getTaxonomnyString() {
 | |
| 		return this.taxonomy;
 | |
| 	}
 | |
| 
 | |
| 	public static GigafidaTaxonomy factory(String tax) {
 | |
| 		if (tax != null) {
 | |
| 			if (TISK.toString().equals(tax)) {
 | |
| 				return TISK;
 | |
| 			}
 | |
| 			if (KNJIZNO.toString().equals(tax)) {
 | |
| 				return KNJIZNO;
 | |
| 			}
 | |
| 			if (LEPOSLOVNO.toString().equals(tax)) {
 | |
| 				return LEPOSLOVNO;
 | |
| 			}
 | |
| 			if (STROKOVNO.toString().equals(tax)) {
 | |
| 				return STROKOVNO;
 | |
| 			}
 | |
| 			if (PERIODICNO.toString().equals(tax)) {
 | |
| 				return PERIODICNO;
 | |
| 			}
 | |
| 			if (CASOPIS.toString().equals(tax)) {
 | |
| 				return CASOPIS;
 | |
| 			}
 | |
| 			if (REVIJA.toString().equals(tax)) {
 | |
| 				return REVIJA;
 | |
| 			}
 | |
| 			if (INTERNET.toString().equals(tax)) {
 | |
| 				return INTERNET;
 | |
| 			}
 | |
| 		}
 | |
| 		return null;
 | |
| 	}
 | |
| 
 | |
| 	public static ObservableList<String> getForComboBox() {
 | |
| 		return FOR_COMBO_BOX;
 | |
| 	}
 | |
| }
 |