public class BackgroundWorkWindow<T,V> extends AbstractWindow
On error:
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent
Window.BeforeCloseEvent, Window.BeforeCloseWithCloseButtonEvent, Window.BeforeCloseWithShortcutEvent, Window.CloseListener, Window.CloseOrigin, Window.CloseWithCommitListener, Window.Committable, Window.ContentSwitchMode, Window.Editor<T extends Entity>, Window.HasFoldersPane, Window.HasUserIndicator, Window.HasWorkArea, Window.Lookup<T extends Entity>, Window.MainWindow, Window.TopLevelWindow, Window.Wrapper
Frame.MessageMode, Frame.MessageType, Frame.NotificationType
ExpandingLayout.ExpandDirection
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.OptionsStyleProvider
Modifier and Type | Field and Description |
---|---|
protected BackgroundWorker |
backgroundWorker |
protected boolean |
cancelAllowed |
protected Button |
cancelButton |
protected BackgroundTaskHandler<V> |
taskHandler |
protected Label<java.lang.String> |
text |
frame, messages, UNKNOWN_CLOSE_ACTION_ID
BROWSE_WINDOW_SUFFIX, CLOSE_ACTION_ID, COMMIT_ACTION_ID, CREATE_WINDOW_SUFFIX, EDITOR_WINDOW_SUFFIX, LOOKUP_WINDOW_SUFFIX, NAME, SELECT_ACTION_ID
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE, UNITS_PERCENTAGE, UNITS_PIXELS
NO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION
Constructor and Description |
---|
BackgroundWorkWindow() |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
void |
init(java.util.Map<java.lang.String,java.lang.Object> params)
Called by the framework after creation of all components and before showing the screen.
|
protected boolean |
preClose(java.lang.String actionId)
Hook to be implemented in subclasses.
|
static <T,V> void |
show(BackgroundTask<T,V> task)
Show modal window with default title and message which will last until task completes.
|
static <T,V> void |
show(BackgroundTask<T,V> task,
boolean cancelAllowed)
Show modal window with default title and message which will last until task completes.
|
static <T,V> void |
show(BackgroundTask<T,V> task,
java.lang.String title,
java.lang.String message)
Show modal window with message which will last until task completes.
|
static <T,V> void |
show(BackgroundTask<T,V> task,
java.lang.String title,
java.lang.String message,
boolean cancelAllowed)
Show modal window with message which will last until task completes.
|
add, add, addAction, addAction, addBeforeWindowCloseListener, addStyleName, addTimer, afterShow, applySettings, beforeClose, closeWithDiscard, deleteSettings, expand, expand, formatMessage, getAction, getActions, getActionsPermissions, getAlignment, getCaption, getCompanion, getComponent, getComponent, getComponent, getComponents, getComposition, getContentSwitchMode, getContext, getDescription, getDialogOptions, getDsContext, getExpandDirection, getExpandRatio, getFocusComponent, getFrame, getFrameOwner, getHeight, getHeightSizeUnit, getIcon, getMargin, getMaxHeight, getMaxWidth, getMessage, getMessagesPack, getMinHeight, getMinWidth, getOwnComponent, getOwnComponents, getOwnComponentsStream, getParent, getScreenHashCode, getSettings, getSpacing, getStyleName, getTimer, getWidth, getWidthSizeUnit, getWindowManager, getWrappedFrame, getWrappedWindow, getXmlDescriptor, handleValidationErrors, hasUnsavedChanges, indexOf, init, isAttributeAccessControlEnabled, isCloseable, isEnabled, isEnabledRecursive, isExpanded, isResponsive, isSameScreen, isValid, isVisible, isVisibleRecursive, postValidate, ready, remove, removeAction, removeAction, removeAll, removeAllActions, removeBeforeWindowCloseListener, removeStyleName, resetExpanded, saveSettings, setAlignment, setCaption, setCloseable, setCompanion, setContentSwitchMode, setDescription, setDsContext, setEnabled, setExpandRatio, setFocusComponent, setFrame, setHeight, setIcon, setIconFromSet, setId, setMargin, setMaxHeight, setMaxWidth, setMessagesPack, setMinHeight, setMinWidth, setParent, setResponsive, setSpacing, setStyleName, setVisible, setWidth, setWindow, setXmlDescriptor, showValidationErrors, unwrap, unwrapComposition, validate, validate, validateAdditionalRules, validateAll
addAfterCloseListener, addAfterDetachListener, addAfterInitListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addUrlParamsChangeListener, close, closeWithDefaultAction, fireEvent, getBeanLocator, getEventHub, getExtensions, getId, getScreenData, getUiEventListeners, getWindow, isMultipleOpen, isSaveScreenHistoryOnClose, isSaveSettingsOnClose, setBeanLocator, setExtensions, setScreenData, setUiEventListeners, show
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBeforeCloseWithCloseButtonListener, addBeforeCloseWithShortcutListener, addCloseListener, addCloseWithCommitListener, addListener, close, close, closeAndRun, removeBeforeCloseWithCloseButtonListener, removeBeforeCloseWithShortcutListener, removeCloseListener, removeCloseWithCommitListener, removeListener
getComponentNN
add, focusFirstComponent, getComponentNN, remove
getHeightUnits, getId, getWidthUnits, isEnabledItself, isVisibleItself, requestFocus, setHeightAuto, setHeightFull, setSizeAuto, setSizeFull, setWidthAuto, setWidthFull
getActionNN, getSubPart
openEditor, openEditor, openEditor, openEditor, openEditor, openEditor, openEditor, openFrame, openFrame, openLookup, openLookup, openLookup, openLookup, openWindow, openWindow, showMessageDialog, showNotification, showNotification, showNotification, showOptionDialog, showOptionDialog, showWebPage
@Inject protected Label<java.lang.String> text
@Inject protected Button cancelButton
@Inject protected BackgroundWorker backgroundWorker
protected BackgroundTaskHandler<V> taskHandler
protected boolean cancelAllowed
public static <T,V> void show(BackgroundTask<T,V> task, @Nullable java.lang.String title, @Nullable java.lang.String message, boolean cancelAllowed)
T
- task progress unitV
- task result typetask
- background task containing long operationtitle
- window title, optionalmessage
- window message, optionalcancelAllowed
- show or not cancel buttonpublic static <T,V> void show(BackgroundTask<T,V> task, java.lang.String title, java.lang.String message)
T
- task progress unitV
- task result typetask
- background task containing long operationtitle
- window title, optionalmessage
- window message, optionalpublic static <T,V> void show(BackgroundTask<T,V> task, boolean cancelAllowed)
T
- task progress unitV
- task result typetask
- background task containing long operationcancelAllowed
- show or not cancel buttonpublic static <T,V> void show(BackgroundTask<T,V> task)
T
- task progress unitV
- task result typetask
- background task containing long operationpublic void init(java.util.Map<java.lang.String,java.lang.Object> params)
AbstractWindow
init
in class AbstractWindow
params
- parameters passed from caller's code, usually from
HasWindowManager.openWindow(String, WindowManager.OpenType)
and similar methods, or set in
screens.xml
for this registered screenpublic void cancel()
protected boolean preClose(java.lang.String actionId)
AbstractWindow
preClose
in class AbstractWindow
actionId
- a string that is passed to one of Screen.close(com.haulmont.cuba.gui.screen.CloseAction)
methods by calling code to identify itself.
Can be an Action
ID, or a constant like Window.COMMIT_ACTION_ID
or
Window.CLOSE_ACTION_ID
.