public class FrameGuiImpl extends Frame<GuiOutputManager>
Frame
is a top-level window with a title and a border.Modifier and Type | Class and Description |
---|---|
protected class |
FrameGuiImpl.GuiScrollContainer
The implementation of frame's scrollable container.
|
Frame.ScrollContainer
Widget.ZOrderClass
Modifier and Type | Field and Description |
---|---|
private CoordinatesConversion |
cc
Coordinate converter
|
private static int |
DEFAULT_MINIMAL_SIZE_IN_PIXELS
The frame's minimal size given in pixels.
|
private double |
defaultMinimalHeight
The default minimal height of the empty frame.
|
private double |
defaultMinimalWidth
The default minimal width of the empty frame.
|
private boolean |
explicitVirtualHeight
Keeping track on explicit virtual height setting.
|
private boolean |
explicitVirtualWidth
Keeping track on explicit virtual width setting.
|
private BorderedPanelGuiImpl |
frameTitle
Panel for the frame's title.
|
private GuiColorResolver |
gc
Color resolver
|
private GuiColorResolver |
gct
Title color resolver
|
private GuiDriver |
gd
Screen driver
|
private GuiFontResolver |
gf
Font resolver - frame title.
|
private LineBorderGuiImpl |
lineBorder
Cached line border.
|
private GuiOutputManager |
screen
Output manager
|
chooseHandler, configUpdateActive, contentPane, currentStatement, cursor, down, downBody, EXTRA_DLG_PIXELS, frameScroll, headersHeight, headersOutput, lastRow, needPause, nonbody, originalHeightChars, paintable, redirected, savedTabOrder, startRow, touched, trailingSkips, underline, underlinedRow, verticalStepBoxed
location, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
FrameGuiImpl(WidgetId id,
FrameConfig cfg)
Special constructor used to restore component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
protected void |
activateDirectManipulation()
Activates direct manipulation engine for this widget.
|
private void |
activateHorizontalBarQuirk()
Activate the horizonta scrollbar 4GL bug for all ancestor frames, except the root one.
|
protected double |
adjustMinSize(double minWidthOrHeight,
boolean isHeight)
Adjusts the minimum frame width or height value depending on the current min value and
the presense of the box within the frame.
|
protected double |
adjustWidth(double width,
double screenWidth)
Adjust frame width.
|
void |
afterConfigUpdate(FrameConfig beforeUpdate)
The method is called after the configuration associated with
the implementor changes.
|
protected void |
calculateHeight(Dimension d,
double delta)
Calculate frame height.
|
protected double |
calculateHeightDelta()
Calculate frame height delta.
|
protected double |
captionHeight()
Get the frame's caption height, in character units.
|
protected Colors |
compareColors(BaseConfig config,
Colors colors)
Compare colors.
|
private void |
configContentPanels()
Configure frame scroll pane
|
private void |
configScrollPane()
Configure frame scroll pane
|
protected MouseHoverAction |
createMouseHoverAction()
Create handler for processing mouse hover events
|
protected SensitiveScrollContainer<GuiOutputManager> |
createScrollContainer()
Creates the frame's scroll container.
|
protected void |
deactivateDirectManipulation()
Deactivates direct manipulation engine for this widget.
|
Widget<GuiOutputManager> |
defaultFocus()
Get default focusable widget.
|
void |
destroy()
Destroy this widget.
|
protected void |
doLayoutWorker(boolean suppressDrawing)
Process frame layout.
|
void |
draw(Point origin,
Dimension size)
Draw the peer container.
|
protected boolean |
drawDownFrame(Point top,
boolean redir)
Draw the body of a down frame.
|
private void |
drawGrid()
Draws frame grid before the frame content painting.
|
private void |
drawResizeAnchors(int xr,
int yr,
int wr,
int hr)
Draws the 8 resize anchors within the given rectangle area.
|
protected void |
drawUnderline(Widget<GuiOutputManager> comp)
Draw underline for specified widget.
|
private void |
drawWidgetsSelectionStatus()
Updates the status of the selected widgets.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint p)
Find the widget positioned just bellow the specified mouse position (in physical units).
|
protected Rectangle |
frameContentBounds()
Get the bounds of the frame's content.
|
java.util.Optional<MousePtrWrapper> |
getCustomMousePointer()
Get the current custom mouse pointer if it is set
|
Dimension |
getDialogDecorationCharSize()
Returns the size of the decoration elements for dialog-box.
|
(package private) ColorRgb |
getFrameBgColor()
Get the color used to draw the frame background.
|
double |
getLabelHeight(java.lang.String labelText,
LabeledWidget<GuiOutputManager> widget,
boolean topLabel)
Compute the label height in character units.
|
double |
getLabelWidth(java.lang.String label,
LabeledWidget<GuiOutputManager> widget)
Compute the label width in character units, depending on the current font.
|
protected Dimension |
getMaxFrameSize()
The method returns the maximum frame size according to the virtual size
of the enclosing frame or according to the workspace size of its parent
window.
|
NativePoint |
getPortableMouseEventCoordinates(NativePoint point)
Get a point to represent the LAST-EVENT:X and LAST-EVENT:Y coordinates.
|
double |
getRowDelta()
Get a delta which is added between frames, when their Y coordinate is automatically
computed.
|
boolean |
hasBox()
The method returns
true when the frame should have a box around. |
void |
initialize(WidgetId id,
FrameConfig wcfg)
Replacement API for the logic which should exist in the widget's c'tor, but the logic
can't be executed as it depends on the widget being registered into the official registry.
|
protected boolean |
isDirectManipulationRequired()
Checks if direct manipulation feature must be installed or removed in GUI mode.
|
Point |
location()
Get frame location relative to container.
|
NativePoint |
physicalLocation()
Get frame physical location relative to container, expressed in units native to UI type.
|
boolean |
processCancelButton()
Processing for cancel button in a frame.
|
boolean |
processDefaultButton(KeyInput event)
Processing for default button in a frame.
|
void |
realizeFrame(boolean realize)
Realize the frame, only if it's not yet realized.
|
private void |
repaintCaption()
Raise a
PaintEvent for the frame's title, as needed. |
protected void |
resetColors(BaseConfig config)
Reset colors.
|
private static int |
resolveLabelFont(LabeledWidget<GuiOutputManager> lwidget)
Resolves the effective font for a label of the supplied labeled widget.
|
void |
setFocus(Widget<GuiOutputManager> focus)
Set focus to specified widget.
|
void |
setInnerSize(double innerWidth,
double innerHeight)
Setting the inner size of the container.
|
void |
setOuterSize(double width,
double height)
Sets the size of the peer container.
|
void |
setVisible(boolean visible)
Handle change of frame visibility.
|
boolean |
supportsCustomMousePointer()
Check if the widget supports LOAD-MOUSE-POINTER() method
|
private void |
updateScrollPaneSize()
Updates frame scroll pane size with possible frame title.
|
addWidget, adjustDown, adjustDown, allFramesVisible, applyConfig, arrangeToInteract, arrangeToStream, attachToWindow, calculateFrameRect, calculateWidthDelta, canSetColumn, canSetHeightChars, canSetRow, canSetWidthChars, clear, clearCurrent, clearWorker, clipping, config, currentFocus, doLayout, doLayout, draw, enableAllWidgets, enabledWidgetsByList, enterChoose, fixNonBody, forceBox, getBorderBottomChars, getBorderLeftChars, getBorderRightChars, getBorderTopChars, getChooseData, getChooseHelp, getContentPane, getCursor, getDown, getDownConfigs, getField, getField, getFirstEnabledWidget, getFirstFocusableId, getFirstFocusableId, getFixedHeight, getFocusId, getFrameValue, getFrameValue, getInnerSize, getIterationHeight, getIterationIds, getLeadingSkipSize, getMinHeight, getNextEnabledWidget, getOriginalHeightChars, getRootFrame, getSavedDimension, getScopeNesting, getSelectedField, getSelectedWidget, getStreamId, getTrailingSkipSize, getValues, getZOrderClass, hasAnyEnabled, hasDefaultButton, hasEditors, hasEnabled, hasHeaders, hasSavedState, hasTitle, isActive, isAlive, isAllClear, isAttrSpace, isAutoplacing, isCanHide, isCanHideOthers, isCanWipeScreen, isChooseActive, isConfigUpdateActive, isCurrentTouched, isDelayedRepaint, isDialog, isDown, isDownCalculated, isDynamic, isExplicitHide, isFixedWidth, isFocusAttractor, isFocusReset, isForcedRefresh, isForcePause, isForceWipeScreen, isHonorNextConditionalDown, isInChoose, isInScope, isInternalGo, isLabels, isLastWidget, isLeftMostWidget, isNeedPause, isNeedReset, isNoHide, isPendingFixedDown, isPendingUnderline, isPlacedForRedirected, isRedirected, isRightMostWidget, isRootFrame, isSideLabels, isStreamed, isThreeD, isTopFrame, isViewed, isVisibilityChanged, isWithHeaders, leaveChoose, markAsStreamed, moveAboveWidget, moveBelowWidget, moveCursor, moveToBottom, moveToTop, moveWidgetBeforeTabItem, needClearRow, notifyClose, notifyPageBreak, notifyUnbind, placeAtTop, placed, placeToWindow, placeToWindow, postponePlace, postponeSetVisible, postprocess, postprocessConfig, prepareIteration, preprocess, previousFocus, processFrameMnemonic, processKeyEvent, rearrangeEditors, relayout, relocateComponent, repaint, repaintCurrent, repaintUninitialized, requestFocus, reset, resetAll, resetAutoplacing, resetChanged, resetForcedRefresh, resetNeedPause, resetPlacementQuirk, resetWidget, resolveWidgetId, restore, restoreEditors, restoreInitialTabOrder, scroll, setAlive, setAllClear, setAttrSpace, setBodyVisible, setBox, setCanHide, setCanHideOthers, setCanWipeScreen, setChooseAt, setColumns, setCurrentStatement, setCursor, setDelayedRepaint, setDown, setDynCol, setDynRow, setExplicitHide, setFocusAttractor, setFocusId, setFocusReset, setForcePause, setForceWipeScreen, setFormatCheck, setHeight, setHonorNextConditionalDown, setInScope, setLabels, setLayout, setNeedPause, setNeedPauseDirect, setNeedReset, setPaintable, setPendingFixedDown, setPendingUnderline, setProtected, setRedirected, setSavedDimension, setScopeNesting, setSize, setState, setValue, setValue, setViewed, setVisibilityChanged, setWidth, shortName, switchLabelsEmptyMode, toString, touchBody, touchRow, unbind, underline, view
add, add, add, addDirectly, belongsTo, checkWidget, childrenLocation, clipRectangle, currentFocus, cycleFocus, detach, dimension, endSizeChange, firstFocus, focus, focusTraversable, focusWorker, get, getClipRect, getEffectiveScrollableSize, getFocusInt, getIgnoreFocus, getLayout, getScrollableSize, getWidgetsList, hasFocusable, height, insets, lastFocus, minimumSize, moveAfterTabItem, moveBeforeTabItem, moveToBottom, moveToBottomInClass, moveToTop, moveToTopInClass, moveToZpos, nextFocus, normalizeZOrder, prepareWidgets, prevFocus, remove, replace, setFocusInt, setIgnoreFocus, setInsets, setSize, startSizeChange, unrealize, updateSizeWorker, widgets, width
_setHidden, _setVisible, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidthNative, getVisiblePart, hasFocus, hidden, hide, highlighted, ignoreAction, isDirectManipulationCapable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isTotallyObscured, isVisible, manageSystemActions, mouseActions, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, prepParentLocation, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, refresh, registerWidgetStateListener, repaint, requestSync, resetBitmap, resizeTo, resolveFont, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, sync, topLevelWindow, translate, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, forceCursorOnFocus, forceVisibility, getActualBounds, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, hasFocus, hidden, hide, highlighted, isDirectManipulable, isDisplayed, isEnabled, isFocusable, isHeader, isRealized, isRMBEntrySupported, isTabStop, isTotallyObscured, isVisible, name, navigable, parent, parent, parentOrSelf, physicalBounds, physicalDimension, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyListeners, processMnemonic, raiseLegacyMouseEvents, repaint, requestSync, resizeTo, screen, screenLocation, screenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, topLevelWindow, window
private static final int DEFAULT_MINIMAL_SIZE_IN_PIXELS
private GuiDriver gd
private GuiOutputManager screen
private CoordinatesConversion cc
private GuiColorResolver gc
private GuiColorResolver gct
private GuiFontResolver gf
private BorderedPanelGuiImpl frameTitle
private LineBorderGuiImpl lineBorder
private boolean explicitVirtualWidth
private boolean explicitVirtualHeight
private final double defaultMinimalWidth
private final double defaultMinimalHeight
public FrameGuiImpl(WidgetId id, FrameConfig cfg)
Call initialize(com.goldencode.p2j.ui.WidgetId, com.goldencode.p2j.ui.FrameConfig)
to finish the widget initialization.
id
- The widget's ID.cfg
- Configuration data.public double getLabelWidth(java.lang.String label, LabeledWidget<GuiOutputManager> widget)
getLabelWidth
in class Frame<GuiOutputManager>
label
- The label text.widget
- The widgeth to which the label belongs.public double getLabelHeight(java.lang.String labelText, LabeledWidget<GuiOutputManager> widget, boolean topLabel)
getLabelHeight
in class Frame<GuiOutputManager>
labelText
- The label text.widget
- The widget to which the label belongs.topLabel
- Flag identifying that the label is shown above the widget.public double getRowDelta()
getRowDelta
in class Frame<GuiOutputManager>
FontManager.getPixelsPerRow(com.goldencode.p2j.ui.client.driver.ScreenDriver<?>)
value.public Point location()
location
in interface Widget<GuiOutputManager>
location
in class Frame<GuiOutputManager>
public NativePoint physicalLocation()
physicalLocation
in interface Widget<GuiOutputManager>
physicalLocation
in class Frame<GuiOutputManager>
public void initialize(WidgetId id, FrameConfig wcfg)
This API is called after the widget is created and added to the registry.
initialize
in interface WidgetWithConfig<FrameConfig>
initialize
in class Frame<GuiOutputManager>
id
- The widget's ID.wcfg
- The config used to initialize this widget.public void setVisible(boolean visible)
setVisible
in interface Widget<GuiOutputManager>
setVisible
in class Frame<GuiOutputManager>
visible
- New visibility state. true
- show frame,
false
- hide frame.public Dimension getDialogDecorationCharSize()
getDialogDecorationCharSize
in class Frame<GuiOutputManager>
protected void doLayoutWorker(boolean suppressDrawing)
doLayoutWorker
in class Frame<GuiOutputManager>
suppressDrawing
- If true
then drawing is suppressed even if frame
is visible.public void realizeFrame(boolean realize)
realizeFrame
in class Frame<GuiOutputManager>
realize
- Flag indicating if the frame should be realized.protected void activateDirectManipulation()
activateDirectManipulation
in class AbstractWidget<GuiOutputManager>
protected void deactivateDirectManipulation()
deactivateDirectManipulation
in class AbstractWidget<GuiOutputManager>
protected boolean isDirectManipulationRequired()
isDirectManipulationRequired
in class AbstractWidget<GuiOutputManager>
TRUE
if direct manipulation is need to be installed,
FALSE
if direct manipulation is need to be removed.ColorRgb getFrameBgColor()
public void draw(Point origin, Dimension size)
Drawing for the redirected terminal differs. Labels/headers are drawn only once per page, instead of the usual once per frame.
draw
in class Frame<GuiOutputManager>
origin
- The coordinate of the upper-left corner for peer container in
character units.size
- The size of the peer container in character units.public void destroy()
destroy
in interface Widget<GuiOutputManager>
destroy
in class Frame<GuiOutputManager>
protected void calculateHeight(Dimension d, double delta)
calculateHeight
in class Frame<GuiOutputManager>
d
- Frame dimensions.delta
- Height delta.protected double adjustMinSize(double minWidthOrHeight, boolean isHeight)
adjustMinSize
in class Frame<GuiOutputManager>
minWidthOrHeight
- The size value to be adjusted.isHeight
- TRUE
if the size value is height, FALSE
if width.protected boolean drawDownFrame(Point top, boolean redir)
drawDownFrame
in class Frame<GuiOutputManager>
top
- The location from where to start drawing.redir
- Flag indicating if redirected mode is active.true
if the screen needs to be synchronized.public Widget<GuiOutputManager> findMouseSource(NativePoint p)
findMouseSource
in interface Widget<GuiOutputManager>
findMouseSource
in class AbstractContainer<GuiOutputManager>
p
- The mouse physical location.null
if none found.public NativePoint getPortableMouseEventCoordinates(NativePoint point)
getPortableMouseEventCoordinates
in class AbstractWidget<GuiOutputManager>
point
- The point (relative to the window's top-left corner) for which the coordinates for
the portable mouse events are needed.null
if such an event can't be raised.public boolean processDefaultButton(KeyInput event)
processDefaultButton
in class Frame<GuiOutputManager>
TRUE
if event be re-routed to default button,
FALSE
otherwise.public boolean processCancelButton()
processCancelButton
in class Frame<GuiOutputManager>
TRUE
if event be re-routed to cancel button,
FALSE
otherwise.public void afterConfigUpdate(FrameConfig beforeUpdate)
afterConfigUpdate
in interface ConfigOwner<FrameConfig>
afterConfigUpdate
in class Frame<GuiOutputManager>
beforeUpdate
- public void setOuterSize(double width, double height)
setOuterSize
in class Frame<GuiOutputManager>
width
- The new width of the container in character units.height
- The new height of the container in character units.public void setInnerSize(double innerWidth, double innerHeight)
setInnerSize
in class Frame<GuiOutputManager>
innerWidth
- The new inner width of the container in character units.innerHeight
- The new inner height of the container in character units.public boolean hasBox()
true
when the frame should have a box around.
Note that the returned value may differ from FrameConfig.box
as
for example dialog boxes do not draw a box even when BOX set to true.hasBox
in class Frame<GuiOutputManager>
public boolean supportsCustomMousePointer()
supportsCustomMousePointer
in interface Widget<GuiOutputManager>
supportsCustomMousePointer
in class AbstractWidget<GuiOutputManager>
true
if the widget supports
LOAD-MOUSE-POINTER() methodpublic java.util.Optional<MousePtrWrapper> getCustomMousePointer()
getCustomMousePointer
in interface Widget<GuiOutputManager>
getCustomMousePointer
in class AbstractWidget<GuiOutputManager>
protected MouseHoverAction createMouseHoverAction()
createMouseHoverAction
in class AbstractWidget<GuiOutputManager>
protected double adjustWidth(double width, double screenWidth)
adjustWidth
in class Frame<GuiOutputManager>
width
- Input width.screenWidth
- Screen height.protected void drawUnderline(Widget<GuiOutputManager> comp)
drawUnderline
in class Frame<GuiOutputManager>
comp
- The base component to draw underline for.protected void resetColors(BaseConfig config)
resetColors
in class Frame<GuiOutputManager>
config
- Widget configuration.protected Colors compareColors(BaseConfig config, Colors colors)
ChUI implementation must compare dcolor and pfcolor.
GUI implementation must compare bgcolor and fgcolor.
compareColors
in class Frame<GuiOutputManager>
config
- Widget configuration.colors
- Colors to be compared.protected double calculateHeightDelta()
calculateHeightDelta
in class Frame<GuiOutputManager>
protected Dimension getMaxFrameSize()
getMaxFrameSize
in class Frame<GuiOutputManager>
public void setFocus(Widget<GuiOutputManager> focus)
Post a repaint for the frame's title, too, to update the frame focus state.
setFocus
in interface Container<GuiOutputManager>
setFocus
in class AbstractContainer<GuiOutputManager>
focus
- Widget to set focus on.public Widget<GuiOutputManager> defaultFocus()
defaultFocus
in interface Container<GuiOutputManager>
defaultFocus
in class AbstractContainer<GuiOutputManager>
protected Rectangle frameContentBounds()
frameContentBounds
in class Frame<GuiOutputManager>
private void repaintCaption()
PaintEvent
for the frame's title, as needed.protected double captionHeight()
captionHeight
in class Frame<GuiOutputManager>
protected SensitiveScrollContainer<GuiOutputManager> createScrollContainer()
createScrollContainer
in class Frame<GuiOutputManager>
private static int resolveLabelFont(LabeledWidget<GuiOutputManager> lwidget)
lwidget
- A labeled widget reference.private void configScrollPane()
private void configContentPanels()
private void activateHorizontalBarQuirk()
private void updateScrollPaneSize()
private void drawGrid()
BorderedPanelGuiImpl
painting routine after background refresh but before widgets
drawings context.private void drawWidgetsSelectionStatus()
private void drawResizeAnchors(int xr, int yr, int wr, int hr)
xr
- X starting point for rectangular area.yr
- Y starting point for rectangular area.wr
- The width for rectangular area.hr
- The height for rectangular area.