public class Utils extends Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
void |
addBrowserWindowResizeListener(ExecutionContext ctx,
ClosureHolder listener)
Adds a listener for the browser window resize events.
|
Object |
call(ExecutionContext ctx,
RecordHolder c,
String method,
ListHolder args)
Calls a method on the underlying Java UI component.
|
Object |
call(ExecutionContext ctx,
RecordHolder c,
String method,
Object... args)
Calls a method on the underlying Java UI component.
|
Object |
callFormComponent(ExecutionContext ctx,
String method,
ListHolder args)
Calls a method on a form component (this).
|
Object |
callFormComponent(ExecutionContext ctx,
String method,
Object... args)
Calls a method on a form component (this).
|
void |
clearDataErrorMessages(ExecutionContext ctx,
RecordHolder component)
Clears error messages on the components and it's descendants.
|
Decimal |
compare(ExecutionContext ctx,
Object o1,
Object o2)
Compares two comparables (Strings, Dates, Integers, Decimals).
|
void |
createNative(ExecutionContext ctx)
Called in the forms::FormComponent constructor - registers the component to the
Form and creates appropriate Vaadin component. |
void |
detectLocation(ExecutionContext ctx,
RecordHolder optsHolder,
ClosureHolder resultCallback)
Requests a location detection.
|
Decimal |
gc(ExecutionContext ctx)
Runs a full garbage collection, both over the form and the model.
|
RecordHolder |
getBrowserWindowSize(ExecutionContext ctx)
Returns the browser window size.
|
RecordHolder |
getRecordAndProperty(ExecutionContext ctx,
ReferenceHolder ref)
If given reference is a pointer to some record field, returns both the record and the property.
|
void |
handleSubmitNavigation(ExecutionContext ctx,
SetHolder todos,
RecordHolder screenNavigation)
Handles the navigation logic after a form has been submitted.
|
String |
localize(ExecutionContext ctx,
String message)
Localized the provided message using the current component.
|
String |
localize(ExecutionContext ctx,
String message,
RecordHolder component)
Localizes the provided message.
|
boolean |
matches(ExecutionContext ctx,
String str,
String regexp)
Attempts to match the entire string against the pattern
|
void |
navigate(ExecutionContext ctx,
RecordHolder navigation)
Navigates to given target.
|
RecordHolder |
saveForm(ExecutionContext ctx)
Saves the current Todo/Document.
|
void |
showDataErrorMessages(ExecutionContext ctx,
ListHolder constraintViolations,
RecordHolder component)
Shows the constraint violations on the components which are bound to the same record properties
as the constraint violations.
|
public Object call(ExecutionContext ctx, RecordHolder c, String method, Object... args)
FormComponent
implementor;
if there is no such method, the underlying Vaadin widget is searched. If there is no such method, this method fails with an exception.ctx
- current execution contextc
- the component definition record, not null.method
- the method name, not null.args
- parametersRuntimeException
- if no such method exists.public Object call(ExecutionContext ctx, RecordHolder c, String method, ListHolder args)
FormComponent
implementor;
if there is no such method, the underlying Vaadin widget is searched. If there is no such method, this method fails with an exception.ctx
- current execution contextc
- the component definition record, not null.method
- the method name, not null.args
- optional list of parameters, may be null.RuntimeException
- if no such method exists.public Object callFormComponent(ExecutionContext ctx, String method, Object... args) throws ErrorException
ctx
- method
- args
- ErrorException
public Object callFormComponent(ExecutionContext ctx, String method, ListHolder args) throws ErrorException
ctx
- method
- args
- ErrorException
public void createNative(ExecutionContext ctx)
Form
and creates appropriate Vaadin component.ctx
- current execution contextpublic RecordHolder getRecordAndProperty(ExecutionContext ctx, ReferenceHolder ref) throws ErrorException
ctx
- current execution contextref
- the reference, not null.ErrorException
public void navigate(ExecutionContext ctx, RecordHolder navigation)
ctx
- current execution contextnavigation
- the human::Navigation subclass, not null.public void handleSubmitNavigation(ExecutionContext ctx, SetHolder todos, RecordHolder screenNavigation)
human::Navigation
record then the screenNavigation
is
taken into account.ctx
- todos
- newly created todosscreenNavigation
- the user navigationpublic RecordHolder saveForm(ExecutionContext ctx) throws ErrorException
ctx
- ErrorException
- if the save action fails.public Decimal compare(ExecutionContext ctx, Object o1, Object o2)
ctx
- o1
- first object to compare, not null.o2
- second object to compare, not null.public boolean matches(ExecutionContext ctx, String str, String regexp)
ctx
- str
- the stringregexp
- the patterntrue
if, and only if, the entire string matches the regex patternpublic Decimal gc(ExecutionContext ctx)
ctx
- public String localize(ExecutionContext ctx, String message, RecordHolder component)
ctx
- message
- the message to localizecomponent
- public String localize(ExecutionContext ctx, String message)
ctx
- message
- the message to localizepublic void detectLocation(ExecutionContext ctx, RecordHolder optsHolder, ClosureHolder resultCallback)
ctx
- optsHolder
- the position options forms::PositionOptions
resultCallback
- the callback which is notified when the location has been detectedpublic RecordHolder getBrowserWindowSize(ExecutionContext ctx)
ctx
- forms::Dimension
representing the browser window size.public void addBrowserWindowResizeListener(ExecutionContext ctx, ClosureHolder listener)
ctx
- listener
- public void showDataErrorMessages(ExecutionContext ctx, ListHolder constraintViolations, RecordHolder component)
component
is not specified then all components in the form are
considered.ctx
- constraintViolations
- component
- the component where to start; null
means form's root componentpublic void clearDataErrorMessages(ExecutionContext ctx, RecordHolder component)
null
) then clears all error messages on the
components in the form.ctx
- component
- the component (optional)Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.