|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.japura.controller.AbstractController
org.japura.controller.Controller<V>
public abstract class Controller<V extends java.awt.Component>
The Controller isolates business logic from presentation.
Must implement the following methods:
getComponent to get the controlled componentisComponentInstancied to indicates whether the controller is
instantiatedEvery instantiated controller is added to a pool of controllers. Through the pool, its possible reach any controller.
The state of permanent indicates that the controller can't be removed from the pool unless the parent has been removed.
Annotations:
ChildController - defines that a controller can't be
instantiated by constructor, only through method createChild.Singleton - defines a controller as singleton.Copyright (C) 2009-2012 Carlos Eduardo Leite de Andrade
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see www.gnu.org/licenses/
For more information, contact: www.japura.org
E
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.japura.controller.AbstractController |
|---|
AbstractController.TokenKey |
| Constructor Summary | |
|---|---|
Controller()
|
|
| Method Summary | ||
|---|---|---|
void |
addModal(java.awt.Component component)
Shows a modal |
|
void |
addModal(java.awt.Component component,
ModalListener listener)
|
|
void |
addModal(java.awt.Component component,
ModalListener listener,
java.lang.Integer modalDepth)
|
|
protected void |
afterFreeController()
|
|
protected void |
beforeFreeController()
|
|
protected void |
cancelExecutions()
Cancels all task executions from the controllers of the group |
|
void |
closeAllModals()
Close all modals. |
|
void |
closeCurrentModal()
Close the current modal. |
|
void |
closeModal(java.awt.Component component)
Close a modal |
|
static boolean |
contains(ControllerModel controller)
|
|
static int |
count(java.lang.Class<?> clss)
Get the total of controllers of a specific class. |
|
static DebugComponent |
createDebugPanel()
|
|
protected void |
execute(Task<?> task)
|
|
protected void |
execute(Task<?> task,
boolean isAsynchronous)
|
|
protected void |
execute(Task<?> task,
boolean isAsynchronous,
java.lang.String message)
|
|
protected void |
execute(Task<?> task,
java.lang.String message)
Executes a task |
|
protected void |
execute(TaskSequence taskSequence)
|
|
protected void |
executeAndFree(Task<?> task)
|
|
protected void |
executeAndFree(Task<?> task,
java.lang.String message)
|
|
static boolean |
existsLink(ControllerModel controller,
java.lang.Class<?> clss)
|
|
static boolean |
existsLink(ControllerModel controller1,
ControllerModel controller2)
|
|
static void |
free(int id)
Remove a controller from the memory. |
|
static void |
free(int id,
boolean cancelTaskExecution)
Remove a controller from the memory. |
|
void |
freeAfterExecutions()
Removes the controller from the memory after the all task executions. |
|
static void |
freeAll()
Remove from the memory all controllers. |
|
static void |
freeAll(java.lang.Class<?> clss)
Remove from the memory all controllers of a specific class. |
|
static void |
freeAllFromGroup(int groupId,
java.lang.Class<?> clss)
Remove from the memory all controllers of a specific class and group. |
|
static void |
freeGroup(int groupdId)
Remove from the memory all controllers of a specific group. |
|
static
|
get(java.lang.Class<E> clss)
Get the first controller of a specific class. |
|
static
|
get(java.lang.Class<E> clss,
java.awt.Component comp)
Get the first controller of a specific class and controlled component. |
|
static ControllerModel |
get(java.awt.Component comp)
Get the first controller of a specific controlled component. |
|
static ControllerModel |
get(int id)
Get the controller with a specific identifier. |
|
static
|
get(int id,
java.lang.Class<E> clss)
Get the controller of a specific class and identifier. |
|
static java.util.List<ControllerModel> |
getAll()
Get all controllers |
|
static
|
getAll(java.lang.Class<E> clss)
Get all controllers of a specific class. |
|
static java.util.List<ControllerModel> |
getAllFromGroup(int groupId)
Get the all controllers of a specific group. |
|
static
|
getAllFromGroup(int groupId,
java.lang.Class<E> clss)
Get the all controllers of a specific group and class. |
|
protected abstract V |
getComponent()
Get the controlled component. |
|
java.awt.Component |
getCurrentModal()
Get the current modal component |
|
static
|
getFromGroup(int groupId,
java.lang.Class<E> clss)
Get the controller of a specific group and class. |
|
static ControllerModel |
getFromGroup(int groupId,
int id)
Get the controller of a specific group and identifier. |
|
static
|
getFromGroup(int groupId,
int id,
java.lang.Class<E> clss)
Get the controller of a specific group, class and identifier. |
|
static
|
getFromLink(ControllerModel controllerInLink,
java.lang.Class<E> clss)
|
|
static MockPool |
getMockPool()
|
|
static ModalPanelFactory |
getModalPanelFactory()
|
|
static ControllerModel |
getRoot(int groupId)
|
|
java.awt.Window |
getWindowAncestor()
|
|
static boolean |
hasMockPool()
|
|
boolean |
hasModal()
Indicates whether exists a modal. |
|
boolean |
isFocused()
|
|
static boolean |
isInstancied(java.lang.Class<?> clss)
Indicates whether the controller is instantiated. |
|
static boolean |
isInstanciedInGroup(int groupId,
java.lang.Class<?> clss)
Indicates whether the controller is instantiated in a group. |
|
boolean |
isWindowFocused()
|
|
static void |
link(ControllerModel controller1,
ControllerModel controller2)
Link two controllers each other. |
|
static MockPool |
newMockPool()
|
|
static void |
printAllControllers()
Show all the instantiated controllers in the pool. |
|
static void |
publishToAll(Message message)
|
|
static void |
removeMockPool()
|
|
void |
requestFocus()
|
|
void |
requestWindowFocus()
|
|
static void |
setModalPanelFactory(ModalPanelFactory modalPanelFactory)
|
|
void |
showConfirmationModal(java.lang.String title,
java.lang.String question,
ModalAction confirmAction)
Shows a confirmation message modal. |
|
void |
showConfirmationModal(java.lang.String title,
java.lang.String question,
ModalAction confirmAction,
ModalAction cancelAction)
Shows a confirmation message modal. |
|
static void |
showDebugWindow()
|
|
void |
showErrorModal(java.lang.String title,
java.lang.String error)
Shows a error message modal. |
|
void |
showInformationModal(java.lang.String title,
java.lang.String info)
Shows a information message modal. |
|
void |
showQuestionModal(java.lang.String title,
java.lang.String question,
ModalAction yesAction)
Shows a question message modal. |
|
void |
showQuestionModal(java.lang.String title,
java.lang.String question,
ModalAction yesAction,
ModalAction noAction)
Shows a question message modal. |
|
void |
showWarningModal(java.lang.String title,
java.lang.String warning)
Shows a warning message modal. |
|
static void |
unlink(ControllerModel controller)
|
|
static void |
unlink(ControllerModel controller1,
ControllerModel controller2)
|
|
static void |
updateDebugComponents()
|
|
| Methods inherited from class org.japura.controller.AbstractController |
|---|
addMessageFilter, canExecute, containsMessageFilter, createChild, equals, free, free, freeGroup, getChild, getChild, getChildren, getChildren, getControllerName, getFromLink, getGroup, getGroupId, getId, getMessageFilters, getModalGroupName, getParent, getParentId, getRoot, hashCode, hasLinkTo, hasLinkTo, isChildInstancied, isPermanent, isRemoved, isRoot, linkTo, publish, removeMessageFilter, removeMessageFilters, setControllerName, setModalGroupName, setPermanent, stringToDebugComponent, subscribe, testControllerModel, unlink |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.japura.controller.ControllerModel |
|---|
isComponentInstancied |
| Constructor Detail |
|---|
public Controller()
| Method Detail |
|---|
public static boolean hasMockPool()
public static MockPool newMockPool()
public static void removeMockPool()
public static MockPool getMockPool()
public static boolean existsLink(ControllerModel controller1,
ControllerModel controller2)
public static boolean existsLink(ControllerModel controller,
java.lang.Class<?> clss)
public static void link(ControllerModel controller1,
ControllerModel controller2)
controller1 - first controllercontroller2 - second controller
public static void unlink(ControllerModel controller1,
ControllerModel controller2)
public static DebugComponent createDebugPanel()
public static void showDebugWindow()
public static void free(int id)
Controllers defined as permanent, can not be removed unless the parent has been removed.
All executions of the tasks will be canceled.
id - the controller's identifierAbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
freeAll(),
freeAll(Class)
public static void free(int id,
boolean cancelTaskExecution)
Controllers defined as permanent, can not be removed unless the parent has been removed.
id - the controller's identifiercancelTaskExecution - AbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
freeAll(),
freeAll(Class)public static void freeGroup(int groupdId)
Controllers defined as permanent, can not be removed unless the parent has been removed.
All executions of the tasks will be canceled.
groupdId - AbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
free(int)public static void freeAll(java.lang.Class<?> clss)
Controllers defined as permanent, can not be removed unless the parent has been removed.
All executions of the tasks will be canceled.
clss - controller's classAbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
free(int)
public static void freeAllFromGroup(int groupId,
java.lang.Class<?> clss)
Controllers defined as permanent, can not be removed unless the parent has been removed.
All executions of the tasks will be canceled.
groupId - clss - controller's classAbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
free(int)public static boolean isInstancied(java.lang.Class<?> clss)
clss - controller's class
public static boolean isInstanciedInGroup(int groupId,
java.lang.Class<?> clss)
groupId - clss - controller's class
public static void freeAll()
Controllers defined as permanent, can not be removed unless the parent has been removed.
All executions of the tasks will be canceled.
AbstractController.setPermanent(boolean),
AbstractController.isPermanent(),
free(int),
freeAll(Class)public static int count(java.lang.Class<?> clss)
clss - the controller's class
public static <E> E get(java.lang.Class<E> clss)
If not exists, a controller will be instantiated.
E - .clss - the controller's class
get(int, Class)
public static <E> E get(int id,
java.lang.Class<E> clss)
id - the controller's identifierclss - the controller's class
NULL if its not exist.get(Class)
public static <E> E getFromGroup(int groupId,
java.lang.Class<E> clss)
groupId - the controller's group identifierclss - the controller's class
NULL if its not exist.
public static <E> E getFromGroup(int groupId,
int id,
java.lang.Class<E> clss)
groupId - the controller's group identifierid - the controller's identifierclss - the controller's class
NULL if its not exist.
public static ControllerModel getFromGroup(int groupId,
int id)
groupId - the controller's group identifierid - the controller's identifier
NULL if its not exist.
public static <E> java.util.List<E> getAllFromGroup(int groupId,
java.lang.Class<E> clss)
groupId - the controller's group identifierclss - the controller's class
get(Class)public static java.util.List<ControllerModel> getAllFromGroup(int groupId)
groupId - the controller's group identifier
get(Class)public static ControllerModel get(int id)
id - the controller's identifier
NULL if its not exist.public static <E> java.util.List<E> getAll(java.lang.Class<E> clss)
clss - the controller's class
public static java.util.List<ControllerModel> getAll()
public static <E> E get(java.lang.Class<E> clss,
java.awt.Component comp)
E - .clss - the controller's classcomp - the controlled component
NULL if its not exist.get(Class),
get(int)public static ControllerModel get(java.awt.Component comp)
comp - the controlled component
NULL if its not exist.get(Class),
get(int)public static void setModalPanelFactory(ModalPanelFactory modalPanelFactory)
public static ModalPanelFactory getModalPanelFactory()
public static boolean contains(ControllerModel controller)
public static void printAllControllers()
public static ControllerModel getRoot(int groupId)
public static void updateDebugComponents()
public static void unlink(ControllerModel controller)
public static <E> E getFromLink(ControllerModel controllerInLink,
java.lang.Class<E> clss)
public static void publishToAll(Message message)
protected void beforeFreeController()
beforeFreeController in class AbstractControllerprotected void afterFreeController()
afterFreeController in class AbstractControllerpublic java.awt.Window getWindowAncestor()
public void requestWindowFocus()
public boolean isWindowFocused()
public void requestFocus()
public boolean isFocused()
protected abstract V getComponent()
public final void freeAfterExecutions()
free(int),
freeAll(),
freeAll(Class),
beforeFreeController(),
afterFreeController()
public void showQuestionModal(java.lang.String title,
java.lang.String question,
ModalAction yesAction,
ModalAction noAction)
title - title for the modalquestion - the questionyesAction - action for the confirmation buttonnoAction - action for the cancel buttonsetModalPanelFactory(ModalPanelFactory)
public void showQuestionModal(java.lang.String title,
java.lang.String question,
ModalAction yesAction)
The cancel button just close the modal.
title - title for the modalquestion - the questionyesAction - action for the confirmation buttonsetModalPanelFactory(ModalPanelFactory)
public void showConfirmationModal(java.lang.String title,
java.lang.String question,
ModalAction confirmAction,
ModalAction cancelAction)
title - title for the modalquestion - the questionconfirmAction - action for the confirmation buttoncancelAction - action for the cancel buttonsetModalPanelFactory(ModalPanelFactory)
public void showConfirmationModal(java.lang.String title,
java.lang.String question,
ModalAction confirmAction)
The cancel button just close the modal.
title - title for the modalquestion - the questionconfirmAction - action for the confirmation buttonsetModalPanelFactory(ModalPanelFactory)
public void showInformationModal(java.lang.String title,
java.lang.String info)
title - title for the modalinfo - the informationsetModalPanelFactory(ModalPanelFactory)
public void showWarningModal(java.lang.String title,
java.lang.String warning)
title - title for the modalwarning - the warningsetModalPanelFactory(ModalPanelFactory)
public void showErrorModal(java.lang.String title,
java.lang.String error)
title - title for the modalerror - the errorsetModalPanelFactory(ModalPanelFactory)public void addModal(java.awt.Component component)
ControllerModel
component - Component
public void addModal(java.awt.Component component,
ModalListener listener)
public void addModal(java.awt.Component component,
ModalListener listener,
java.lang.Integer modalDepth)
public java.awt.Component getCurrentModal()
public void closeCurrentModal()
public void closeModal(java.awt.Component component)
ControllerModel
component - the component's modalpublic void closeAllModals()
ControllerModel
public boolean hasModal()
ControllerModel
protected void execute(Task<?> task,
java.lang.String message)
task - the taskmessage - message for the taskTaskManagerListenerprotected void execute(Task<?> task)
protected void execute(Task<?> task,
boolean isAsynchronous,
java.lang.String message)
protected void execute(Task<?> task,
boolean isAsynchronous)
protected void execute(TaskSequence taskSequence)
protected void executeAndFree(Task<?> task,
java.lang.String message)
protected void executeAndFree(Task<?> task)
protected void cancelExecutions()
execute(Task),
execute(Task, String),
executeAndFree(Task),
executeAndFree(Task, String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||