jaxx.runtime.swing.editor.config.model
Class CallBacksManager

java.lang.Object
  extended by jaxx.runtime.swing.editor.config.model.CallBacksManager

public class CallBacksManager
extends Object

CallBack manager.

Since:
2.0
Author:
tchemit < chemit@codelutin.com >

Field Summary
protected  List<CallBackEntry> callbacks
          lists of registred callback.
 
Constructor Summary
CallBacksManager()
           
 
Method Summary
protected  CallBackEntry getCallBack(OptionModel option)
          Get the first callBack for a given option.
protected  CallBackEntry getCallBack(String name)
          Obtain a registred callBack from his name.
 Map<CallBackEntry,List<OptionModel>> getCallBacksForSaved(CategoryModel category)
          Scan a category and grab per callBack the options saved.
 Map<CallBackEntry,List<OptionModel>> getCallBacksForSaved(ConfigUIModel model)
          Scan a model and grab per callBack the options saved.
 void registerCallBack(String name, String description, Icon icon, Runnable action)
          Registers a new callback.
 void registerOption(String name, OptionModel option)
          Registers a option into a known callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callbacks

protected List<CallBackEntry> callbacks
lists of registred callback.

Constructor Detail

CallBacksManager

public CallBacksManager()
Method Detail

registerCallBack

public void registerCallBack(String name,
                             String description,
                             Icon icon,
                             Runnable action)
Registers a new callback.

Note: the order of registred callback is used to determine the higher priority of callback to launch if required.

Parameters:
name - the unique name of a callback
description - the i18n key to describe the action
icon - icon of callBack (used in ui)
action - the action of the callback

registerOption

public void registerOption(String name,
                           OptionModel option)
Registers a option into a known callback.

Parameters:
name - the name of the callback
option - the option to register for the given callback

getCallBacksForSaved

public Map<CallBackEntry,List<OptionModel>> getCallBacksForSaved(ConfigUIModel model)
Scan a model and grab per callBack the options saved.

Parameters:
model - the model to scan
Returns:
the dictionnary of options for each callback to launch

getCallBacksForSaved

public Map<CallBackEntry,List<OptionModel>> getCallBacksForSaved(CategoryModel category)
Scan a category and grab per callBack the options saved.

Parameters:
category - the category to scan
Returns:
the dictionnary of options for each callBack to launch

getCallBack

protected CallBackEntry getCallBack(OptionModel option)
Get the first callBack for a given option.

Parameters:
option - the option
Returns:
the first callBack (so the most important) on which the given option is attacjed. (can be null)

getCallBack

protected CallBackEntry getCallBack(String name)
Obtain a registred callBack from his name.

Parameters:
name - the name of the searched callBack
Returns:
the callBack for the given name (or null if not found).


Copyright © 2008-2010 CodeLutin. All Rights Reserved.