@Name("removeFilterAction")
public void addRemoveFilterAction(@Name("removeLabel") String removeLabel, @Name("restoreLabel") String restoreLabel) {
if(removeFilterActionLabel != null) {
removeFilterActionLabel.setText(removeLabel);
} else {
removeFilterActionLabel = addAction(removeLabel, new Action() {
@Override
public void perform(AsyncCallback<Void> callback) {
applyDefaultFilter = false;
if(restoreFilterActionLabel != null)
restoreFilterActionLabel.setVisible(true);
removeFilterActionLabel.setVisible(false);
applyFilter(true);
callback.onSuccess(null);
}
}, new Value<Boolean>() {
public void getValue(AsyncCallback<Boolean> callback) {
callback.onSuccess(applyDefaultFilter);
}
public void setValue(Boolean newValue, AsyncCallback<Void> callback) {
applyDefaultFilter = ((Boolean)newValue).booleanValue();
applyFilter(true);
callback.onSuccess(null);
}
}, false);
}
if(restoreFilterActionLabel != null) {
restoreFilterActionLabel.setText(restoreLabel);
} else {
restoreFilterActionLabel = addAction(restoreLabel, new Action() {
@Override
public void perform(AsyncCallback<Void> callback) {
applyDefaultFilter = true;
if(removeFilterActionLabel != null)
removeFilterActionLabel.setVisible(true);