|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.aspects.gui.GenericFactory
This class implements static methods that generically create GUI items. Depending on the actual view factory, the created items are for SWING, WEB or other GUI.
Constructor Summary | |
GenericFactory()
|
Method Summary | |
protected static void |
addChoices(ComboBoxModel choice,
ClassItem type,
Enum enum,
Object substance,
FieldItem field,
boolean nullAllowed,
String nullLabel,
Predicate predicate)
Adds choices within a container containing a combobox and sort them. |
static boolean |
compositeViewIsEmpty(CompositeView view)
Returns true is the CompositeView contains a view other than CompositeView. |
static FieldEditor |
createEnumEditor(ViewFactory factory,
DisplayContext context,
Object substance,
FieldItem field,
String editorName,
Enum enum,
boolean nullAllowed,
String nullLabel)
|
static DialogView |
createInputDialog(Object substance,
AbstractMethodItem method,
Object[] parameters,
DisplayContext context)
Builds a dialog box to enter the parameters of method |
static MenuView |
createMenu(ViewFactory factory,
DisplayContext context,
String label,
Menu content)
Creates a menu in a a customized gui. |
protected static CompositeView |
createObjectView(ViewFactory factory,
DisplayContext context,
ObjectView view,
Object substance,
String category)
Create a view of an object, including only the attributes of a category. |
static View |
createObjectView(ViewFactory factory,
DisplayContext context,
String viewName,
Object substance)
Creates a view on an object. |
static View |
createObjectViewNoTab(ViewFactory factory,
DisplayContext context,
Object substance)
Creates a view of an object (containing no tabs). |
static View |
createParameters(ViewFactory factory,
DisplayContext context,
AbstractMethodItem method,
Object substance,
Object[] parameters)
Create a view containing editor components for the parameters of a method. |
static FieldEditor |
createReferenceEditor(ViewFactory factory,
DisplayContext context,
Object substance,
FieldItem field,
String editorName,
ClassItem type,
Predicate predicate,
boolean nullAllowed,
String nullLabel,
boolean isCreationAllowed)
A generic view builder for a reference editor. |
static void |
fillObjectView(CompositeView view,
ClassItem cli,
String viewName,
Object substance)
|
static View |
getCollectionPane(ViewFactory factory,
DisplayContext context,
Object substance,
ObjectView objectView,
CollectionItemView memberView,
CollectionItem collection)
Builds a view that will display a given collection field of an object. |
protected static View |
getEditButton(ViewFactory factory,
Object substance,
FieldItem field,
DisplayContext context)
Constructs an edit button for reference views. |
static FieldEditor |
getEditorComponent(ViewFactory factory,
DisplayContext context,
Object substance,
AbstractMethodItem method,
int i,
boolean embedded,
Object value)
Returns a ValueEditor suitable for editing the i-th parameter of a method. |
static View |
getFieldPane(ViewFactory factory,
DisplayContext context,
Object substance,
ObjectView objectView,
FieldItem field,
boolean embedded)
|
protected static CompositeView |
getMethodsPane(ViewFactory factory,
DisplayContext context,
Object substance,
Collection methods,
String category,
ObjectView objectView)
Gets a composite panel containing a set of methods that are held by the substance object. |
static MethodView |
getMethodView(AbstractMethodItem method,
Object substance,
DisplayContext context,
ViewFactory factory,
MemberItemView memberView)
Build view for a method |
protected static View |
getPrimitiveFieldPane(ViewFactory factory,
DisplayContext context,
Object substance,
FieldItem field,
ObjectView objectView,
MemberItemView memberView,
boolean embedded)
Returns a view of a primitive field. |
protected static View |
getReferenceFieldPane(ViewFactory factory,
DisplayContext context,
Object substance,
FieldItem field,
boolean embedded,
ObjectView objectView,
MemberItemView memberView)
Build a view containing a label for the name of the field, and the view of the reference. |
protected static boolean |
getViewer(Object substance,
FieldItem field,
Object value,
CompositeView container,
ViewFactory factory,
DisplayContext context)
Instantiates a viewer for a value of a field and add it to a container. |
static void |
initCustomized(ViewFactory factory,
DisplayContext context,
CompositeView internalView,
CustomizedGUI customized,
Map panels)
Initialize the panels of a customized gui. |
static void |
setMenuBars(ViewFactory factory,
DisplayContext context,
CustomizedView view,
Hashtable menuBars)
Build the menu bar of a customized gui. |
static void |
setStatusBar(ViewFactory factory,
DisplayContext context,
CustomizedView view,
MethodItem statusBar,
String position)
Sets a status bar to a customized view. |
static void |
setToolBar(ViewFactory factory,
DisplayContext context,
CustomizedView view,
Collection toolbar)
Build the toolbar of a customized gui. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GenericFactory()
Method Detail |
public static View createObjectView(ViewFactory factory, DisplayContext context, String viewName, Object substance)
factory
- the used factorycontext
- the display context (passed to ceated sub-item so
that they know displays and customized)viewName
- name of the view to buildsubstance
- the object to build a view ofpublic static void fillObjectView(CompositeView view, ClassItem cli, String viewName, Object substance)
public static View createObjectViewNoTab(ViewFactory factory, DisplayContext context, Object substance)
factory
- the used factorycontext
- the display context (passed to ceated sub-item so
that they know displays and customized)substance
- the viewed objectpublic static boolean compositeViewIsEmpty(CompositeView view)
protected static CompositeView createObjectView(ViewFactory factory, DisplayContext context, ObjectView view, Object substance, String category)
factory
- the ViewFactorycontext
- the DisplayContextsubstance
- the object to build the view ofcategory
- the category; if null, all fields are shown
public static View getFieldPane(ViewFactory factory, DisplayContext context, Object substance, ObjectView objectView, FieldItem field, boolean embedded)
protected static boolean getViewer(Object substance, FieldItem field, Object value, CompositeView container, ViewFactory factory, DisplayContext context)
protected static View getPrimitiveFieldPane(ViewFactory factory, DisplayContext context, Object substance, FieldItem field, ObjectView objectView, MemberItemView memberView, boolean embedded)
factory
- the view factorycontext
- the display contextsubstance
- the object the field is part offield
- the field itemobjectView
- the object view that contains the field viewmemberView
- the view to build the field forembedded
- use embbeded editorsprotected static View getReferenceFieldPane(ViewFactory factory, DisplayContext context, Object substance, FieldItem field, boolean embedded, ObjectView objectView, MemberItemView memberView)
factory
- the view factorycontext
- the display contextsubstance
- the object the field is part offield
- the field itemembedded
- use embbeded editorsprotected static void addChoices(ComboBoxModel choice, ClassItem type, Enum enum, Object substance, FieldItem field, boolean nullAllowed, String nullLabel, Predicate predicate)
choice
- combo box model to filltype
- type of objects to fill the model withfield
- associated field itemnullAllowed
- boolean telling wether the add null to themodelnullLabel
- if nullAllowed==true, the label to use for the null value (if not null)predicate
- if not null, only add objects which match this
predicateprotected static View getEditButton(ViewFactory factory, Object substance, FieldItem field, DisplayContext context)
public static View getCollectionPane(ViewFactory factory, DisplayContext context, Object substance, ObjectView objectView, CollectionItemView memberView, CollectionItem collection) throws ViewFactory.UnhandledViewTypeException
factory
- the view factory to use to build other inner viewscontext
- the display contextsubstance
- the object that contains the collectioncollection
- the collection to show
ViewFactory.UnhandledViewTypeException
TableModel
protected static CompositeView getMethodsPane(ViewFactory factory, DisplayContext context, Object substance, Collection methods, String category, ObjectView objectView) throws ViewFactory.UnhandledViewTypeException
ViewFactory.UnhandledViewTypeException
public static MethodView getMethodView(AbstractMethodItem method, Object substance, DisplayContext context, ViewFactory factory, MemberItemView memberView)
method
- the method item to build a view forsubstance
- the object the method shall be invoked oncontext
- display contextfactory
- a view factory
public static View createParameters(ViewFactory factory, DisplayContext context, AbstractMethodItem method, Object substance, Object[] parameters)
Create a view containing editor components for the parameters of a method.
Parameters of type
org.objectweb.jac.aspects.gui.DisplayContext
are
not displayed.
If method is a MixinMethodItem, the first parameter is at index 1 of the parameters array.
factory
- the ViewFactorycontext
- the DisplayContextmethod
- the method whose parameters you the view ofsubstance
- the object on which the method will be
called. It used to get a default value if the method is a
setter.parameters
-
public static FieldEditor getEditorComponent(ViewFactory factory, DisplayContext context, Object substance, AbstractMethodItem method, int i, boolean embedded, Object value)
factory
- the view factorysubstance
- the substance objectmethod
- the method that contains the parameteri
- the parameter indexembedded
- wether the editor is an embedded field
editor. If true, the component will commit changes when it
looses the focus (only works for swing).value
- the initial edited value. Used only if non null.public static void initCustomized(ViewFactory factory, DisplayContext context, CompositeView internalView, CustomizedGUI customized, Map panels)
factory
- the view factorycontext
- the display contextinternalView
- the CompositeView which holds the panelscustomized
- the CustomizedGUIpanels
- if not null, overrides the content of panels
(panelID -> PanelContent)public static void setStatusBar(ViewFactory factory, DisplayContext context, CustomizedView view, MethodItem statusBar, String position)
factory
- the used factorycontext
- the passed contextview
- the customized that will hold the status barstatusBar
- the method item that defines the text to print within the status barposition
- the position
(Constants.TOP||Constants.BOTTOM
)public static void setMenuBars(ViewFactory factory, DisplayContext context, CustomizedView view, Hashtable menuBars)
factory
- the view factorycontext
- the display contextview
- the CustomizedView where to put the menu barmenuBars
- the menuBarspublic static MenuView createMenu(ViewFactory factory, DisplayContext context, String label, Menu content)
factory
- the view factorycontext
- the display contextcontent
- the content of the menu viewpublic static void setToolBar(ViewFactory factory, DisplayContext context, CustomizedView view, Collection toolbar)
factory
- the view factorycontext
- the display contextview
- the CustomizedView where to put the menu bartoolbar
- the toolbar definitionpublic static DialogView createInputDialog(Object substance, AbstractMethodItem method, Object[] parameters, DisplayContext context)
substance
- object the method will be invoked onmethod
- the methodparameters
- an array where to store the value enteres by the usercontext
- a display contextcreateParameters(ViewFactory,DisplayContext,AbstractMethodItem,Object,Object[])
public static FieldEditor createReferenceEditor(ViewFactory factory, DisplayContext context, Object substance, FieldItem field, String editorName, ClassItem type, Predicate predicate, boolean nullAllowed, String nullLabel, boolean isCreationAllowed)
factory
- context
- substance
- the object holding the fieldfield
- the field to build an editor for (may be null)editorName
- the name of the editor to buildtype
- the type of the objects to choose frompredicate
- a predicate used to filter proposed objects in
the case of a combobox.nullAllowed
- wether the user is authorised to select the null valueisCreationAllowed
- wether the user is authorised to create
new instances of typeClassAppearenceGuiConf.selectWithIndexedField(ClassItem,CollectionItem,String)
public static FieldEditor createEnumEditor(ViewFactory factory, DisplayContext context, Object substance, FieldItem field, String editorName, Enum enum, boolean nullAllowed, String nullLabel)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |