All Classes Namespaces Files Functions Variables
Chooser.java
Go to the documentation of this file.
1 package fi.jyu.mit.fxgui;
2 
3 import java.util.function.Consumer;
4 
5 /**
6  * Simple interface for all different choosers
7  * @author terop
8  * @version 13.1.2017
9  * @param <T> mitä luokkaa tallennetaan
10  */
11 public interface Chooser<T> {
12  /**
13  * Adds a single object to the system
14  * @param name name to be displayed in gui
15  * @param object object to be stored
16  */
17  void add(String name, T object);
18 
19  /**
20  * Adds the selection change listener to the component
21  * @param event to listen to
22  */
23  void addSelectionListener(Consumer<T> event);
24 
25  /**
26  * Adds only the object to the system
27  * @param object stored object
28  */
29  void add(T object);
30 
31  /**
32  * Adds an example string to the gui without stored object
33  * @param name string to be shown on gui
34  */
35  void addExample(String name);
36 
37  /**
38  * Clears the components of objects
39  */
40  void clear();
41 
42  /**
43  * Returns the first seleceted object
44  * @return selected object
45  */
46  T getSelectedObject();
47 
48  /**
49  * Returns the first selected objects gui text
50  * @return text shown on gui
51  */
52  String getSelectedText();
53 
54  /**
55  * Returns the first selected index
56  * @return index
57  */
58  int getSelectedIndex();
59 
60  /**
61  * Sets item in index selected
62  * @param index item to be selected
63  * @return old selected index
64  */
65  int setSelectedIndex(int index);
66 
67  /**
68  * Sets the rows.
69  *
70  * @param jono
71  * A multiline string, each line representing a single row.
72  */
73  void setRivit(String jono);
74 
75  /**
76  * Sets the rows.
77  *
78  * @param rivit
79  * A string arrays, each line representing a single row.
80  */
81  void setRivit(String[] rivit);
82 
83  /**
84  * Poistetaan alleviiva
85  * @param item mistä poistetaan
86  * @return ilman 1. alleviivaa
87  */
88  String removeMnemonic(String item);
89 
90 }