
org.ioc.commons.flowcontrol.operationmanager.impl.HasVisibilityOperationHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ioc-commons-ext Show documentation
Show all versions of ioc-commons-ext Show documentation
Library which contains some extension classes for the library IOC-Commons.
It provides some interface definitions and some tool classes which are non-dependent from the used technology;
i.e. the classes and interfaces from this library do not depend on the choosen ioc-commons-implementation library.
The newest version!
package org.ioc.commons.flowcontrol.operationmanager.impl;
import org.ioc.commons.flowcontrol.operationmanager.IsOperation;
import org.ioc.commons.flowcontrol.operationmanager.OperationHandler;
import org.ioc.commons.ui.HasVisibility;
import org.ioc.commons.utils.FormatterLogger;
/**
* It wraps an operation handler from some HasVisibility components.
*
* Instanciated from {@link OperationHandlerFactory}
*
* @author Jesús Lunar Pérez
*
* @param
* Operation type
*/
public class HasVisibilityOperationHandler & IsOperation> implements OperationHandler {
private static final FormatterLogger logger = FormatterLogger.getLogger(HasVisibilityOperationHandler.class);
private HasVisibility[] visibles;
private boolean logWhenNull;
HasVisibilityOperationHandler(boolean logWhenNull, HasVisibility... visibles) {
this.visibles = visibles;
this.logWhenNull = logWhenNull;
}
@Override
public void onOperationBeginning(Object sender, O operation) {
if (this.visibles != null) {
for (HasVisibility loader : visibles) {
if (loader != null) {
loader.setVisible(false);
} else if (logWhenNull) {
logger.warn("Ignoring null visible component assigned");
}
}
}
}
@Override
public void onOperationFinished(Object sender, O operation, boolean success) {
if (this.visibles != null) {
for (HasVisibility loader : visibles) {
if (loader != null) {
loader.setVisible(true);
} else if (logWhenNull) {
logger.warn("Ignoring null visible component assigned");
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy