|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.dom.css.CssBase
to.etc.domui.dom.html.NodeBase
to.etc.domui.dom.html.NodeContainer
to.etc.domui.dom.html.Div
to.etc.domui.component.lookup.LookupForm<T>
public class LookupForm<T>
Creates a search box to enter search criteria. This only presents the search part of the form, constructed by metadata where needed, and the "search", "clear fields" and optional "new" buttons. The actual searching must be done by the user of this component.
The component will return a QCriteria query representing the search query constructed by the user. This QCriteria object can, after retrieval, be used to add extra search restrictions easily.
When used as-is, this form will use the class' metadata to discover any defined search properties, and then populate the form with lookup controls which allow searches on those properties. This is for "default" lookup screens. For more complex screens or lookup parts that have controls interact with eachother you can manually define the contents of the lookup form. By adding lookup items manually you disable the automatic discovery of search options. This is proper because no form should ever depend on the content, structure or order of metadata-defined lookup items!!! So if you want to manipulate the lookup form's contents you have to define it's layout by hand.
Defining a form by hand is easy. To just add a property to search for to the form call addProperty(String propname). This will create the default lookup input thing and label for the property, as defined by metadata and factories. If you need more control you can also call one of the addManualXXXX methods which allow full control over the controls and search criteria used by the form.
Each search item added will usually return a LookupForm.Item. This is a handle to the created lookup control and associated data and can be used to manipulate the control or it's presentation at runtime.
The constructor for this control accepts an ellipsis list of property names to quickly create a lookup using user-specified properties.
Nested Class Summary | |
---|---|
static class |
LookupForm.ButtonMode
|
static class |
LookupForm.Item
This is the definition for an Item to look up. |
Constructor Summary | |
---|---|
LookupForm(java.lang.Class<T> lookupClass,
ClassMetaModel cmm,
java.lang.String... propertyList)
Create a LookupForm to find instances of the specified class. |
|
LookupForm(java.lang.Class<T> lookupClass,
java.lang.String... propertyList)
|
Method Summary | ||
---|---|---|
void |
addButtonItem(NodeBase b)
|
|
void |
addButtonItem(NodeBase b,
int order)
Add a button (or other item) to show on the button row. |
|
void |
addButtonItem(NodeBase b,
int order,
LookupForm.ButtonMode both)
Add a button (or other item) to show on the button row. |
|
LookupForm.Item |
addChildProperty(java.lang.String propPath)
Add lookup control instance for search properties on child list (oneToMany relation) members. |
|
LookupForm.Item |
addChildPropertyLabel(java.lang.String label,
java.lang.String propPath)
Add lookup control instance for search properties on child list (oneToMany relation) members. |
|
void |
addItemBreak()
|
|
LookupForm.Item |
addManual(ILookupControlInstance lci)
Add a manually-created lookup control instance to the item list. |
|
|
addManual(java.lang.String property,
X control)
Add a manually created control and link it to some property. |
|
LookupForm.Item |
addManualPropertyLabel(java.lang.String property,
ILookupControlInstance lci)
Adds a manually-defined control, and use the specified property as the source for it's default label. |
|
LookupForm.Item |
addManualTextLabel(java.lang.String labelText,
ILookupControlInstance lci)
Add a manually-created lookup control instance with user-specified label to the item list. |
|
LookupForm.Item |
addProperty(java.lang.String path)
Add a property to look up to the list. |
|
LookupForm.Item |
addProperty(java.lang.String path,
int minlen)
Add a property to look up to the list. |
|
LookupForm.Item |
addProperty(java.lang.String path,
int minlen,
boolean ignorecase)
Add a property to look up to the list. |
|
LookupForm.Item |
addProperty(java.lang.String path,
java.lang.String label)
Add a property to look up to the list with user-specified label. |
|
void |
clearInput()
Tells all input items to clear their content, clearing all user choices from the form. |
|
void |
createContent()
Actually show the thingy. |
|
protected void |
defineDefaultButtons()
|
|
QCriteria<T> |
getEnteredCriteria()
This checks all of the search fields for data. |
|
java.lang.Class<T> |
getLookupClass()
Returns the class whose instances we're looking up (a persistent class somehow). |
|
ClassMetaModel |
getMetaModel()
Return the metamodel that this class uses to get it's data from. |
|
IClicked<LookupForm<T>> |
getOnCancel()
|
|
IClicked<? extends LookupForm<T>> |
getOnClear()
|
|
IClicked<LookupForm<T>> |
getOnNew()
Sets the onNew handler. |
|
java.lang.String |
getPageTitle()
Returns the search block's part title, if present. |
|
boolean |
hasUserDefinedCriteria()
This is T when the user has actually entered something in one of the search components. |
|
boolean |
isRenderAsCollapsed()
|
|
void |
reset()
Clear out the entire definition for this lookup form. |
|
void |
setClicked(IClicked<?> clicked)
Set the handler to call when the "Search" button is clicked. |
|
void |
setOnCancel(IClicked<LookupForm<T>> onCancel)
When set, this causes a "cancel" button to be added to the form. |
|
void |
setOnClear(IClicked<? extends LookupForm<T>> onClear)
Listener to call when the "clear" button is pressed. |
|
void |
setOnNew(IClicked<LookupForm<T>> onNew)
Returns the onNew handler. |
|
void |
setPageTitle(java.lang.String title)
Sets a part title for this search block. |
|
void |
setRenderAsCollapsed(boolean renderAsCollapsed)
|
|
void |
setSearchProperties(java.util.List<SearchPropertyMetaModel> list)
Set the search properties to use from a list of metadata properties. |
|
void |
setTwoColumnsMode(int minSizeForTwoColumnsMode)
Sets rendering of search fields into two columns. |
Methods inherited from class to.etc.domui.dom.html.Div |
---|
afterCreateContent, componentHandleWebAction, fadeIn, fadeIn, fadeOut, getDragHandler, getDropBody, getDropHandler, getDropMode, getReturnPressed, setDragHandler, setDropBody, setDropHandler, setReturnPressed, slideDown, slideUp, tb, visit |
Methods inherited from class to.etc.domui.dom.html.NodeContainer |
---|
add, add, add, addTable, canContain, delegateTo, findChildIndex, forceRebuild, getChild, getChildCount, getChildren, getDeepChild, getDeepChildren, getErrorFence, internalCheckNotDirty, internalClearDelta, internalClearDeltaFully, internalGetOldChildren, internalShelve, internalUnshelve, iterator, moveControlToModel, moveModelToControl, onRefresh, removeAllChildren, removeChild, removeChild, replaceChild, setControlsEnabled, setErrorFence, setErrorFence, setText, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LookupForm(@Nonnull java.lang.Class<T> lookupClass, java.lang.String... propertyList)
public LookupForm(@Nonnull java.lang.Class<T> lookupClass, @Nullable ClassMetaModel cmm, java.lang.String... propertyList)
lookupClass
- Method Detail |
---|
@Nonnull public ClassMetaModel getMetaModel()
@Nonnull public java.lang.Class<T> getLookupClass()
public void createContent() throws java.lang.Exception
createContent
in class NodeBase
java.lang.Exception
NodeBase.createContent()
protected void defineDefaultButtons()
public void setSearchProperties(java.util.List<SearchPropertyMetaModel> list)
list
- public LookupForm.Item addProperty(java.lang.String path, int minlen, boolean ignorecase)
path
- The property name (or path to some PARENT property) to search on, relative to the lookup class.minlen
- ignorecase
- public LookupForm.Item addProperty(java.lang.String path, int minlen)
path
- The property name (or path to some PARENT property) to search on, relative to the lookup class.minlen
- public LookupForm.Item addProperty(java.lang.String path, java.lang.String label)
path
- The property name (or path to some PARENT property) to search on, relative to the lookup class.label
- The label text to use. Use the empty string to prevent a label from being generated. This still adds an empty cell for the label though.public LookupForm.Item addProperty(java.lang.String path)
path
- The property name (or path to some PARENT property) to search on, relative to the lookup class.public void addItemBreak()
public LookupForm.Item addManual(ILookupControlInstance lci)
public <X extends NodeBase & IInputNode<?>> LookupForm.Item addManual(java.lang.String property, X control)
X
- property
- control
-
public LookupForm.Item addManualTextLabel(java.lang.String labelText, ILookupControlInstance lci)
public LookupForm.Item addManualPropertyLabel(java.lang.String property, ILookupControlInstance lci)
property
- lci
-
public LookupForm.Item addChildProperty(java.lang.String propPath)
propPath
- Must be parentprop.childprop dotted form. Label is used from parent property meta.public LookupForm.Item addChildPropertyLabel(java.lang.String label, java.lang.String propPath)
label
- Label that is displayed. If null, default label from parent property meta is used.propPath
- Must be parentprop.childprop dotted form.public void reset()
public QCriteria<T> getEnteredCriteria() throws java.lang.Exception
Internally this just walks the list of thingies added when the components were added to the form. Each thingy refers to the input components used to register the search on a property, and knows how to convert that thingy to a criteria fragment.
java.lang.Exception
public void clearInput()
public IClicked<LookupForm<T>> getOnNew()
public void setOnNew(IClicked<LookupForm<T>> onNew)
onNew
- public java.lang.String getPageTitle()
public void setPageTitle(java.lang.String title)
title
- public void setClicked(IClicked<?> clicked)
setClicked
in class NodeBase
NodeBase.setClicked(to.etc.domui.dom.html.IClicked)
public IClicked<? extends LookupForm<T>> getOnClear()
public void setOnClear(IClicked<? extends LookupForm<T>> onClear)
onClear
- public void setOnCancel(IClicked<LookupForm<T>> onCancel)
onCancel
- public IClicked<LookupForm<T>> getOnCancel()
public void addButtonItem(NodeBase b)
public void addButtonItem(NodeBase b, int order)
b
- order
- public void addButtonItem(NodeBase b, int order, LookupForm.ButtonMode both)
b
- order
- both
- public boolean isRenderAsCollapsed()
public void setRenderAsCollapsed(boolean renderAsCollapsed)
public void setTwoColumnsMode(int minSizeForTwoColumnsMode)
minSizeForTwoColumnsMode
- public boolean hasUserDefinedCriteria()
getEnteredCriteria()
MUST BE EXECUTED BEFORE checking for this property value!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |