Interface Controller
-
- All Known Implementing Classes:
AlphaNumKeysController,BasicMenuController,BitoperationController,BitoperationMenuController,CalcPathViewController,CalculationControllerBase,CalculatorController,ControllerBase,ConverterController,ConverterMenuController,IEEEController,IEEEMenuController
public interface ControllerInterface for defining a controller. The controller is connected to a View or a Control to provide functions.This method
setActions()must be implemented to set actions for the operating elements of a view.The factory method
(controllable)can construct Controllers for a specific Controllable if the Controller was registered with the methodregister(Class, Class)and assigned to the Controllable.- Since:
- Bitchanger 0.1.0
- Version:
- 0.1.4
- Author:
- Tim Muehle
-
-
Field Summary
Fields Modifier and Type Field Description static HashMap<Class<? extends Controllable>,Class<? extends Controller>>REGISTERED_CONTROLLERSMap that saves the Controllers registered for a Controllable and associates them
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Controllerof(Controllable c)Factory method that creates and returns a new Controller for the given Controllable.static ControllerofArg(Controllable c, Object... args)Factory method that creates and returns a new Controller for the given Controllable.static voidregister(Class<? extends Controllable> controllable, Class<? extends Controller> controller)Registers a Controller class for the factory methodof(Controllable)and assigns it to a Controllable class.voidsetActions()Sets all functions that are needed for the view.
-
-
-
Field Detail
-
REGISTERED_CONTROLLERS
static final HashMap<Class<? extends Controllable>,Class<? extends Controller>> REGISTERED_CONTROLLERS
Map that saves the Controllers registered for a Controllable and associates them
-
-
Method Detail
-
register
static void register(Class<? extends Controllable> controllable, Class<? extends Controller> controller)
Registers a Controller class for the factory methodof(Controllable)and assigns it to a Controllable class.- Parameters:
controllable- Controllable class to which the Controller class is assignedcontroller- Controller class that is registered
-
of
static Controller of(Controllable c)
Factory method that creates and returns a new Controller for the given Controllable.Note that the registered Controller must have a public Constructor that takes the Controllable as the only parameter.
A suitable Controller can only be returned if a suitable value pair is available in the Map
REGISTERED_CONTROLLERS. A Controllable can be assigned a Controller with the methodregister(Class, Class).- Parameters:
c- Controllable, which should be given a function by the new Controller- Returns:
- new Controller that is bound to the Controllable or
nullif no Controller has been registered - Since:
- Bitchanger 0.1.4
- See Also:
register(Class, Class)
-
ofArg
static Controller ofArg(Controllable c, Object... args)
Factory method that creates and returns a new Controller for the given Controllable.Note that the registered Controller must have a public constructor that takes the Controllable as the first argument and also receives all other transferred Objects in the same order as given.
A suitable Controller can only be returned if a suitable value pair is available in the Map
REGISTERED_CONTROLLERS. A Controllable can be assigned a Controller with the methodregister(Class, Class).- Parameters:
c- Controllable, which should be given a function by the new Controllerargs- Arguments in the order they are required by the constructor- Returns:
- new Controller that is bound to the Controllable or
nullif no Controller has been registered - Since:
- Bitchanger 0.1.4
- See Also:
register(Class, Class)
-
setActions
void setActions()
Sets all functions that are needed for the view.
-
-