Class Dialog
java.lang.Object
vaadinx.awt.Component
vaadinx.awt.Container
vaadinx.awt.Window
vaadinx.awt.Dialog
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
FileDialog, JDialog
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAWT's modality type — controls which other windows the modal Dialog blocks. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Dialog.ModalityTypeAWT's default modality type forsetModal(true)and the boolean-taking ctors:APPLICATION_MODAL.Fields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, FILL_CHROME, FILL_DEFAULT, LEFT_ALIGNMENT, listenerList, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDialog(com.vaadin.flow.component.Component peer, Window owner, String title, Dialog.ModalityType modalityType) The JDK'sDialog(Window, String, ModalityType)body over a given peer:JDialogthreads itsSJDialogthrough here (D_peer_ctor_injection), since the public ctors hardcodeSFrame.Dialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc) Dialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) Dialog(Window owner, String title, Dialog.ModalityType modalityType) Dialog(Window owner, String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc) Dialog(Window owner, Dialog.ModalityType modalityType) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanblocksAfterVisibilityChange(boolean b) A modal show is followed byparkUntilClose, so its peer write is the one that must not be quietly dropped — seeWindow.blocksAfterVisibilityChange(boolean).voiddispose()Override ofWindow.dispose()that releases any modal latch after the standard dispose work — mirrors JDK Dialog's "dispose unblocks a parked modal show" contract.getTitle()The title, which isnullif the dialog was given none — unlikeFrame.getTitle().voidhide()booleanisModal()AWT contract:isModal()returnsmodalityType != MODELESS.booleanbooleanprotected Stringprotected voidRelease on peer-originated close too.voidsetBackground(Color bgColor) voidsetModal(boolean modal) AWT shape:setModal(true)sets the modality type toDEFAULT_MODALITY_TYPE(APPLICATION_MODAL);setModal(false)sets it toMODELESS.voidStore the modality type and mirror the bool (!= MODELESS) to the Vaadin Dialog peer so the overlay traps focus correctly.voidsetOpacity(float opacity) AWT's other two throws are not reproduced, and deliberately: both ask the platform whether it can do translucency at all — a browser can, so the answers would be "yes, supported" and the throws unreachable.voidsetResizable(boolean resizable) Also drives the peer's resize grips, since a Vaadin Dialog overlay has real ones.voidvoidvoidsetUndecorated(boolean b) voidsetVisible(boolean b) The blocking-modal park splits acrossshow()andhide(), where the JDK puts it, so this stays the JDK's own pure delegation:show()— aftersuper.show()has opened the peer,isModal()parks the caller on a fresh future until close.hide()— releases any modal latch, mirroring JDK Dialog's contract that a programmatic hide unblocks a parked modal show.voidshow()Show, then (if modal) block — two steps, not one, which is what lets a background thread show a modal at all.Methods inherited from class Window
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, applyVisibleToPeer, applyVisibleToPeerImpl, createBufferStrategy, createBufferStrategy, disposePeer, fireWindowEvent, fireWindowFocusEvent, fireWindowStateEvent, getBackground, getBounds, getBounds, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getHeight, getIconImages, getInputContext, getLayout, getLocale, getLocation, getLocation, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getSize, getSize, getToolkit, getWarningString, getWidth, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, getX, getY, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLayout, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setSize, setSize, toBack, toFrontMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, update, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, fireComponentEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isThemeDefault, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Field Details
-
DEFAULT_MODALITY_TYPE
AWT's default modality type forsetModal(true)and the boolean-taking ctors:APPLICATION_MODAL.
-
-
Constructor Details
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
-
Dialog
- Throws:
IllegalArgumentException- ifowneris neither aFramenor aDialog
-
Dialog
public Dialog(Window owner, String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc) -
Dialog
protected Dialog(com.vaadin.flow.component.Component peer, Window owner, String title, Dialog.ModalityType modalityType) The JDK'sDialog(Window, String, ModalityType)body over a given peer:JDialogthreads itsSJDialogthrough here (D_peer_ctor_injection), since the public ctors hardcodeSFrame.- Throws:
IllegalArgumentException- ifowneris neither aFramenor aDialog
-
-
Method Details
-
getTitle
The title, which isnullif the dialog was given none — unlikeFrame.getTitle(). -
setTitle
-
isModal
public boolean isModal()AWT contract:isModal()returnsmodalityType != MODELESS. -
setModal
public void setModal(boolean modal) AWT shape:setModal(true)sets the modality type toDEFAULT_MODALITY_TYPE(APPLICATION_MODAL);setModal(false)sets it toMODELESS. The actual modal flag is stored on the modality-type field. -
getModalityType
-
setModalityType
Store the modality type and mirror the bool (!= MODELESS) to the Vaadin Dialog peer so the overlay traps focus correctly. Null coerces toMODELESSper AWT contract. -
isResizable
public boolean isResizable() -
setResizable
public void setResizable(boolean resizable) Also drives the peer's resize grips, since a Vaadin Dialog overlay has real ones. Fires noPropertyChangeEvent, unlikeFrame.setResizable(boolean). -
isUndecorated
public boolean isUndecorated() -
setUndecorated
public void setUndecorated(boolean b) -
setOpacity
public void setOpacity(float opacity) Description copied from class:WindowAWT's other two throws are not reproduced, and deliberately: both ask the platform whether it can do translucency at all — a browser can, so the answers would be "yes, supported" and the throws unreachable. What is declined is the peer push, so the window renders fully opaque.- Overrides:
setOpacityin classWindow- Parameters:
opacity- in[0, 1]
-
setShape
-
setBackground
- Overrides:
setBackgroundin classWindow
-
setVisible
public void setVisible(boolean b) The blocking-modal park splits acrossshow()andhide(), where the JDK puts it, so this stays the JDK's own pure delegation:- Overrides:
setVisiblein classWindow
-
show
public void show()Show, then (if modal) block — two steps, not one, which is what lets a background thread show a modal at all.The JDK's own shape, from
java.awt.Dialog.show()/WaitDispatchSupport.enter():conditionalShowrealises the dialog first, and only then does a modal enter its secondary loop — which, for a non-EDT caller, posts the pump to the EDT and blocks the caller alone. So real Swing blocks exactly one thread while the EDT stays free to deliver the click that ends it. Vaadin's request threads play the EDT's part:super.show()hops the peer write onto the UI thread and returns, and the caller blocks below, outside that hop. -
blocksAfterVisibilityChange
protected boolean blocksAfterVisibilityChange(boolean b) A modal show is followed byparkUntilClose, so its peer write is the one that must not be quietly dropped — seeWindow.blocksAfterVisibilityChange(boolean).- Overrides:
blocksAfterVisibilityChangein classWindow- Parameters:
b- the visibility being applied, since only a show can be followed by a park
-
hide
-
dispose
public void dispose()Override ofWindow.dispose()that releases any modal latch after the standard dispose work — mirrors JDK Dialog's "dispose unblocks a parked modal show" contract. -
processWindowEvent
Release on peer-originated close too.WINDOW_CLOSINGfires viaWindow.processWindowEvent(vaadinx.awt.event.WindowEvent)for ESC / outside-click / header close. JDialog's close-op switch may dispose (which releases too — countDown is idempotent on a 1-count latch), butHIDE_ON_CLOSEcloses the peer without disposing, and that path also needs to release the latch.- Overrides:
processWindowEventin classWindow
-
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classWindow
-
paramString
- Overrides:
paramStringin classContainer
-