PL-9432 Add JavaDocs on all public methods of Filter component

This commit is contained in:
Maxim Gorbunkov 2018-03-21 11:09:38 +04:00
parent 29ce68c8a0
commit 5353bf9c08
5 changed files with 69 additions and 31 deletions

View File

@ -90,8 +90,8 @@ public class DesktopFilter extends DesktopAbstractComponent<JPanel> implements F
}
@Override
public boolean apply(boolean isNewWindow) {
return delegate.apply(isNewWindow);
public boolean apply(boolean notifyInvalidConditions) {
return delegate.apply(notifyInvalidConditions);
}
@Override

View File

@ -23,8 +23,8 @@ import com.haulmont.cuba.security.entity.FilterEntity;
import java.util.List;
public interface Filter extends Component.Margin, Component.BelongToFrame, Component.HasNamedComponents,
Component.HasXmlDescriptor, Component.HasSettings, Component.HasCaption,
Component.HasIcon, Component.Collapsable {
Component.HasXmlDescriptor, Component.HasSettings, Component.HasCaption,
Component.HasIcon, Component.Collapsable {
String NAME = "filter";
@ -52,6 +52,12 @@ public interface Filter extends Component.Margin, Component.BelongToFrame, Compo
BeforeFilterAppliedHandler getBeforeFilterAppliedHandler();
/**
* Sets the handler that will be invoked before the filter is applied. If the {@link
* BeforeFilterAppliedHandler#beforeFilterApplied()} returns false, then the filter won't be applied
*
* @param beforeFilterAppliedHandler
*/
void setBeforeFilterAppliedHandler(BeforeFilterAppliedHandler beforeFilterAppliedHandler);
AfterFilterAppliedHandler getAfterFilterAppliedHandler();
@ -59,18 +65,27 @@ public interface Filter extends Component.Margin, Component.BelongToFrame, Compo
void setAfterFilterAppliedHandler(AfterFilterAppliedHandler afterFilterAppliedHandler);
CollectionDatasource getDatasource();
void setDatasource(CollectionDatasource datasource);
void setFilterEntity(FilterEntity filterEntity);
boolean apply(boolean isNewWindow);
/**
* Applies the filter. Before the filter is applied, conditions correctness is checked. If invalid conditions are
* found (i.e. empty required conditions) then the filter will not be applied.
*
* @param notifyInvalidConditions whether a notification about invalid conditions values should be displayed
* @return true if the filter was applied, false otherwise
*/
boolean apply(boolean notifyInvalidConditions);
/**
* Sets rows count restriction. Particularly useful when maxResults field is hidden.
* 0 in case of no limits.
* Sets rows count restriction. Particularly useful when maxResults field is hidden. 0 in case of no limits.
*
* @param maxResults restriction on number of rows
*/
void setMaxResults(int maxResults);
int getMaxResults();
/**
@ -78,66 +93,88 @@ public interface Filter extends Component.Margin, Component.BelongToFrame, Compo
*/
void setModeSwitchVisible(boolean modeSwitchVisible);
/**
* Changes the filter mode and repaints the filter layout
*/
void switchFilterMode(FilterDelegate.FilterMode filterMode);
/**
* Whether to show field for rows count restriction.
* <p>Automatically set to false for {@code HierarchicalDatasource}.
* Whether to show field for rows count restriction. <p>Automatically set to false for {@code
* HierarchicalDatasource}.
*/
void setUseMaxResults(boolean useMaxResults);
boolean getUseMaxResults();
/**
* Whether to use a text field for entering a max results value.
* LookupField is used by default.
* Whether to use a text field for entering a max results value. LookupField is used by default.
*
* @param textMaxResults true if use TextField
*/
void setTextMaxResults(boolean textMaxResults);
boolean getTextMaxResults();
/**
* Sets the component associated with the filter.
*/
void setApplyTo(Component component);
Component getApplyTo();
/**
* Defines when the filter will be applied. If the attribute value is false, the filter (default or empty) will be
* applied when the screen is opened. It means that the datasource will be refreshed and linked components (e.g.
* Table) will display data. If the value is true, the filter will be applied only after the Search button is
* clicked.
*/
void setManualApplyRequired(Boolean manualApplyRequired);
Boolean getManualApplyRequired();
void setEditable(boolean editable);
boolean isEditable();
void setFolderActionsEnabled(boolean enabled);
boolean isFolderActionsEnabled();
/**
* Sets the value to the filter parameter component. Do not use this method in init() method of screen controller,
* because filter is not initialized by that time. The proper place to use the method is ready() method of
* the controller.
* @param paramName parameter name. It can be found at runtime in the filter editor window. Right click
* at the necessary condition and select 'Show component name' item in the popup menu.
* Component name there will be like 'component$genericFilter.email12482'. {@code paramName} parameter in
* this method requires only the last part of this string, i.e. you should pass 'email12482'
* @param value parameter value
* because filter is not initialized by that time. The proper place to use the method is ready() method of the
* controller.
*
* @param paramName parameter name. It can be found at runtime in the filter editor window. Right click at the
* necessary condition and select 'Show component name' item in the popup menu. Component name
* there will be like 'component$genericFilter.email12482'. {@code paramName} parameter in this
* method requires only the last part of this string, i.e. you should pass 'email12482'
* @param value parameter value
*/
void setParamValue(String paramName, Object value);
/**
* Gets the value of the filter parameter component. Do not use this method in init() method of screen controller,
* because filter is not initialized by that time. The proper place to use the method is ready() method of
* the controller.
* @param paramName parameter name. It can be found at runtime in the filter editor window. Right click
* at the necessary condition and select 'Show component name' item in the popup menu.
* Component name there will be like 'component$genericFilter.email12482'. {@code paramName} parameter in
* this method requires only the last part of this string, i.e. you should pass 'email12482'
* because filter is not initialized by that time. The proper place to use the method is ready() method of the
* controller.
*
* @param paramName parameter name. It can be found at runtime in the filter editor window. Right click at the
* necessary condition and select 'Show component name' item in the popup menu. Component name
* there will be like 'component$genericFilter.email12482'. {@code paramName} parameter in this
* method requires only the last part of this string, i.e. you should pass 'email12482'
* @return parameter value
*/
Object getParamValue(String paramName);
void addFilterEntityChangeListener(FilterEntityChangeListener listener);
List<FilterEntityChangeListener> getFilterEntityChangeListeners();
/**
* Number of conditions to be displayed in one row
*/
void setColumnsCount(int columnsCount);
int getColumnsCount();
/**
@ -146,6 +183,7 @@ public interface Filter extends Component.Margin, Component.BelongToFrame, Compo
* @param visible <code>true</code> to show the border, <code>false</code> to hide it
*/
void setBorderVisible(boolean visible);
/**
* Determines whether or not border is visible.
*

View File

@ -59,7 +59,7 @@ public interface FilterDelegate {
CollectionDatasource getDatasource();
boolean apply(boolean isNewWindow);
boolean apply(boolean notifyInvalidConditions);
String getCaption();

View File

@ -1442,7 +1442,7 @@ public class FilterDelegateImpl implements FilterDelegate {
}
@Override
public boolean apply(boolean isNewWindow) {
public boolean apply(boolean notifyInvalidConditions) {
if (beforeFilterAppliedHandler != null) {
if (!beforeFilterAppliedHandler.beforeFilterApplied()) return false;
}
@ -1450,7 +1450,7 @@ public class FilterDelegateImpl implements FilterDelegate {
if (filterEntity != null && conditions.getRoots().size() > 0) {
boolean haveCorrectCondition = hasCorrectCondition();
if (!haveCorrectCondition) {
if (!isNewWindow) {
if (!notifyInvalidConditions) {
windowManager.showNotification(messages.getMainMessage("filter.emptyConditions"),
Frame.NotificationType.HUMANIZED);
}
@ -1468,7 +1468,7 @@ public class FilterDelegateImpl implements FilterDelegate {
if (filterEntity != null) {
boolean haveRequiredConditions = haveFilledRequiredConditions();
if (!haveRequiredConditions) {
if (!isNewWindow) {
if (!notifyInvalidConditions) {
windowManager.showNotification(messages.getMainMessage("filter.emptyRequiredConditions"),
Frame.NotificationType.HUMANIZED);
}

View File

@ -76,8 +76,8 @@ public class WebFilter extends WebAbstractComponent<CubaCssActionsLayout> implem
}
@Override
public boolean apply(boolean isNewWindow) {
return delegate.apply(isNewWindow);
public boolean apply(boolean notifyInvalidConditions) {
return delegate.apply(notifyInvalidConditions);
}
@Override