Package org.dwcj.controls.numericbox
Class NumericBox
java.lang.Object
org.dwcj.controls.AbstractControl
org.dwcj.controls.AbstractDwcControl
org.dwcj.controls.numericbox.NumericBox
- All Implemented Interfaces:
Control,Enableable,Focusable,HasAttribute,HasClassName,HasComputedStyle,HasControlText,HasDestroy,HasReadOnly,HasStyle,HasTooltip,HasVisibility,TabTraversable,TextAlignable,TextHighlightable
- Direct Known Subclasses:
NumericBoxSpinner
public class NumericBox
extends AbstractDwcControl
implements HasReadOnly, Focusable, TabTraversable, TextAlignable, TextHighlightable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.dwcj.interfaces.TextAlignable
TextAlignable.AlignmentNested classes/interfaces inherited from interface org.dwcj.interfaces.TextHighlightable
TextHighlightable.Highlight -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<Consumer<NumericBoxEditModifyEvent>>protected Stringprotected Booleanprotected Stringprotected NumericBoxEditModifyEventSinkprotected Stringprotected Booleanprotected Booleanprotected Integerprotected Integerprotected Stringprotected Booleanprotected com.basis.bbj.proxies.sysgui.BBjInputNprotected Booleanprotected Booleanprotected floatprotected BigDecimalFields inherited from class org.dwcj.controls.AbstractDwcControl
BASISNUMBER_1, BASISNUMBER_25, BASISNUMBER_250, focusable, horizontalScrollBarPosition, mouseWheelCondition, readOnly, STR_EXPANSE, STR_THEME, tabTraversable, textAlignment, textHighlight, verticalScrollBarPositionFields inherited from class org.dwcj.controls.AbstractControl
ctrl, destroyed, elementId, userData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddClassName(String selector) Adds a CSS class to the list of CSS classes for the control.protected voidcatchUp()The catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation.protected voidCreate the object on a panel p.Returns the comma character used in the NumericBox control.Returns the character to be used indicating the decimal point in the NumericBox control.Returns the EDIT string which is used to map input characters to edit functions for the NumericBox control.getError()Returns the number of the last error generated in the NumericBox control.This method returns an enum representing the current behavior of highlighting in a text control when the control receives focus.intReturns the length of the text in the NumericBox control.This method returns the left margin of the NumericBox control.getMask()Returns the mask of the NumericBox control.Returns the restore string of the NumericBox control.Returns a value indicating the text's horizontal alignment.getValue()Returns the value of the contents of the NumericBox control.isFocusable returns a value indicating whether or not the user can focus the control.Returns whether the text in the NumericBox control is highlighted when focus is gained from tabbing into the control.Returns whether the NumericBox control is in insert mode.Returns whether the NumericBox control will accept negative values.Returns whether the NumericBox control passes the ENTER key to the top-level window.Returns whether the NumericBox control passes the TAB key notification to the top-level window.Returns whether the text in the NumericBox control can be edited.Returns a boolean indicating whether or not the user can navigate to the control using the tab key.Returns whether comma characters are displayed while in edit mode in the NumericBox control.onEditModify(Consumer<NumericBoxEditModifyEvent> callback) removeClassName(String selector) Removes a CSS class from the list of CSS classes for the control.voidrestore()Sets the text in the NumericBox control to the restore string.This method selects all of the NumericBox control's current contents as if the user highlighted it with the mouse or keyboard.setAttribute(String attribute, String value) set the value for an attribute in the controlsetCommaCharacter(String comma) Sets the comma character to be used in the NumericBox control.setDotCharacter(String dot) Sets the character used to indicate the decimal point.setEditString(String edit) Sets the EDIT string, which is used to map input characters to edit functions for theNumericBox control.setEnabled(Boolean enabled) Set whether the control is to be enabledsetExpanse(NumericBox.Expanse expanse) setFocusable(Boolean focusable) setFocusable sets whether a control can be focused.setHighlight(Boolean highlight) Sets whether to highlight the text in the control when focus is gained from tabbing into the control.setHighlightOnFocus(TextHighlightable.Highlight highlight) This method sets the behavior of controls implementing the TextControl interface when receiving focus via the keyboard, mouse, or BBjControl::focus() method FOCUS mnemonic.Assigns the ID of a controlsetInsertMode(Boolean insert) Sets whether the NumericBox control is in insert mode.Sets the length of the text in the NumericBox control.Sets the left margin of the NumericBox control.Sets the mask for the NumericBox control.setNegatable(boolean negatable) Sets whether the NumericBox control accepts negative values.setPassEnter(Boolean pass) Sets whether the NumericBox control is to pass the ENTER key notification to the top-level window.setPassTab(Boolean pass) Sets whether the NumericBox control is to pass the TAB key notification to the top-level window.setReadOnly(Boolean editable) Sets whether the text in the NumericBox control can be edited.setRestore(float restore) Sets the restore value of the NumericBox control.Assigns specified value to the specified CSS propertysetTabTraversable(Boolean traverse) Sets whether or not the user can navigate to the control using the tab key.set the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at allsetTextAlignment(TextAlignable.Alignment alignment) Sets the horizontal alignment of the text within the control.setTheme(NumericBox.Theme theme) setTooltipText(String text) Set the tooltip text of the controlsetUseEditCommas(boolean useCommas) Sets whether to display the comma characters in the mask while in edit mode in the NumericBox control.setValue(float value) setValue(int value) setValue(BigDecimal value) Sets the value of the NumericBox control.setVisible(Boolean visible) Set whether the control is visible or invisibleMethods inherited from class org.dwcj.controls.AbstractDwcControl
destroy, getAttribute, getComputedStyle, getText, getTooltipText, isEnabled, isVisible, setControlExpanse, setControlThemeMethods inherited from class org.dwcj.controls.AbstractControl
getCaughtUp, getId, getUserData, isDestroyed, setUserData
-
Field Details
-
numBox
protected com.basis.bbj.proxies.sysgui.BBjInputN numBox -
callbacks
-
editModifyEventSink
-
commaChar
-
dotChar
-
editString
-
highlight
-
insertMode
-
length
-
margin
-
mask
-
negatable
-
pEnter
-
pTab
-
restore
protected float restore -
commas
-
value
-
-
Constructor Details
-
NumericBox
-
NumericBox
public NumericBox()
-
-
Method Details
-
create
Description copied from class:AbstractControlCreate the object on a panel p. The preferred way of creating an object is using the Panel::add(Control) method, instead of this- Overrides:
createin classAbstractControl- Parameters:
p- the panel to add this control on
-
onEditModify
-
getCommaCharacter
Returns the comma character used in the NumericBox control.- Returns:
- Returns the character that is used as the comma in the control.
-
getDotCharacter
Returns the character to be used indicating the decimal point in the NumericBox control.- Returns:
- Returns the character to be used indicating the decimal point.
-
getEditString
Returns the EDIT string which is used to map input characters to edit functions for the NumericBox control.- Returns:
- Returns the EDIT string which is used to map input characters to edit functions for the control.
-
getError
Returns the number of the last error generated in the NumericBox control.- Returns:
- Returns the number of the last error generated in the control.
-
isHighlight
Returns whether the text in the NumericBox control is highlighted when focus is gained from tabbing into the control.- Returns:
- Returns whether the text in the control is highlighted (false = Not highlighted, true = highlighted).
-
isInsertMode
Returns whether the NumericBox control is in insert mode.- Returns:
- Returns whether the control is in the insert mode (false = Not in insert mode, true = In insert mode).
-
getLength
public int getLength()Returns the length of the text in the NumericBox control.- Returns:
- Returns the length of the text in the control.
-
getMargin
This method returns the left margin of the NumericBox control.- Returns:
- Returns the left margin of the control.
-
getMask
Returns the mask of the NumericBox control.- Returns:
- Returns the mask of the control, which provides character-type verification.
-
isNegatable
Returns whether the NumericBox control will accept negative values.- Returns:
- Returns whether this control will accept negative values.
-
isPassEnter
Returns whether the NumericBox control passes the ENTER key to the top-level window.- Returns:
- Returns whether the ENTER key is passed to the top-level window (false = Not passed, true = Passed).
-
isPassTab
Returns whether the NumericBox control passes the TAB key notification to the top-level window.- Returns:
- Returns whether the TAB key notification is passed to the top-level window (false = Not passed, true = Passed) .
-
getRestore
Returns the restore string of the NumericBox control.- Returns:
- Returns the restore string of the BBjInputN control - the restore string is the text that appears when a user hits the restore key (usually ESC) or by calling the NumericBox::restore method.
-
isUseEditCommas
Returns whether comma characters are displayed while in edit mode in the NumericBox control.- Returns:
- Returns whether comma characters are displayed while in edit mode (0 = Do not display commas, 1 = Display commas). By default, commas are not displayed.
-
getValue
Returns the value of the contents of the NumericBox control.- Returns:
- Returns the value of the contents of the control.
-
restore
public void restore()Sets the text in the NumericBox control to the restore string. The restore string is set in the creation of the BBjInputN control or by calling the NumericBox::setRestoreString method. -
selectAll
This method selects all of the NumericBox control's current contents as if the user highlighted it with the mouse or keyboard.- Returns:
- Returns this
-
setCommaCharacter
Sets the comma character to be used in the NumericBox control. This will replace the character used to indicate a comma mask character.- Parameters:
comma- - Specifies the character to use for a comma.- Returns:
- Returns this
-
setDotCharacter
Sets the character used to indicate the decimal point. This will replace the character used to indicate the decimal point.- Parameters:
dot- - Specifies the character to use, which indicates the decimal point.- Returns:
- Returns this
-
setEditString
Sets the EDIT string, which is used to map input characters to edit functions for theNumericBox control.- Parameters:
edit- - Specifies the EDIT string.- Returns:
- Returns this
-
setHighlight
Sets whether to highlight the text in the control when focus is gained from tabbing into the control.- Parameters:
highlight- - Specifies whether the text is to be highlighted (false = No highlight, true = Highlight)- Returns:
- Returns this
-
setInsertMode
Sets whether the NumericBox control is in insert mode.- Parameters:
insert- - Sets whether the control is in insert mode (false = Not in insert mode, true = In insert mode)- Returns:
- Returns this
-
setLength
Sets the length of the text in the NumericBox control. If the setLength method is called, then the previous mask is not used. The mask for the characters will be the default mask character "X".- Parameters:
len- - Specifies the length of the text in the control.- Returns:
- Returns this
-
setMargin
Sets the left margin of the NumericBox control.- Parameters:
marginWidth- - Width of the left margin.- Returns:
- Returns this
-
setMask
Sets the mask for the NumericBox control.- Parameters:
mask- - Specifies the mask that provides character-type verification.- Returns:
- Returns this
-
setNegatable
Sets whether the NumericBox control accepts negative values. Negative values are initially accepted.- Parameters:
negatable- - Specifies whether the BBjInputN will accept negative values (false = Negative values are not accepted, true = Negative values are accepted).- Returns:
- Returns this
-
setPassEnter
Sets whether the NumericBox control is to pass the ENTER key notification to the top-level window. By default, the ENTER key is not passed.- Parameters:
pass- - Specifies whether to pass the ENTER key to the top-level window (false = Not passed, true = Passed).- Returns:
- Returns this
-
setPassTab
Sets whether the NumericBox control is to pass the TAB key notification to the top-level window.- Parameters:
pass- - Specifies whether to pass the TAB key notification to the top-level window (false = Not passed, true = Passed).- Returns:
- Returns this
-
setRestore
Sets the restore value of the NumericBox control. The restore value is the number that appears when the user hits the restore key (usually ESC) or by calling the NumericBox::restore method.- Parameters:
restore- - Specifies the restore value.- Returns:
- Returns this
-
setUseEditCommas
Sets whether to display the comma characters in the mask while in edit mode in the NumericBox control.- Parameters:
useCommas- - Specifies whether to display the comma characters in the mask while in edit mode (false = No display, true = Display)- Returns:
- Returns this
-
setValue
Sets the value of the NumericBox control. Note that a mask within a control does NOT round, but a mask within the STR() DOES round. For example, when placing a value such as 12.34567 into an inputN control that is masked with ###0.00, you'll get 12.34. However, if in console mode you print str(12.34567:"###0.00"), you'll get 12.35.- Parameters:
value- - Specifies the value to be set in the control.- Returns:
- Returns this
-
setValue
-
setValue
-
isReadOnly
Returns whether the text in the NumericBox control can be edited.- Specified by:
isReadOnlyin interfaceHasReadOnly- Returns:
- Returns whether the text in the control can be edited (false = Not Editable, true = Editable). By default, the text is editable.
-
setReadOnly
Sets whether the text in the NumericBox control can be edited. By default, the control is editable.- Specified by:
setReadOnlyin interfaceHasReadOnly- Parameters:
editable- - Sets the editability of the control (false = Not Editable, true = Editable)- Returns:
- Returns this
-
isFocusable
Description copied from interface:FocusableisFocusable returns a value indicating whether or not the user can focus the control. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse.- Specified by:
isFocusablein interfaceFocusable- Returns:
- True if object can be focused, False if not.
-
setFocusable
Description copied from interface:FocusablesetFocusable sets whether a control can be focused. Note: A focused control is the control to which keyboard interaction is directed. Typically, the focused control is indicated visually, often via a dotted grey border. A control which is not focusable, therefore, cannot be manipulated via the keyboard. It is still possible to interact with a non-focusable control via the mouse. To disable all interaction, including the mouse, see setEnabled() and setReadOnly().- Specified by:
setFocusablein interfaceFocusable- Parameters:
focusable- Boolean True for allowing focusing, False to disable focus- Returns:
- Object itself
-
isTabTraversable
Description copied from interface:TabTraversableReturns a boolean indicating whether or not the user can navigate to the control using the tab key.- Specified by:
isTabTraversablein interfaceTabTraversable- Returns:
- True if user can navigate to control with Tab key, False if not
-
setTabTraversable
Description copied from interface:TabTraversableSets whether or not the user can navigate to the control using the tab key.- Specified by:
setTabTraversablein interfaceTabTraversable- Parameters:
traverse- Boolean dictating tab traversal. True if control can be navigated to with Tab, False if not.- Returns:
- The control itself
-
getHighlightOnFocus
Description copied from interface:TextHighlightableThis method returns an enum representing the current behavior of highlighting in a text control when the control receives focus.- Specified by:
getHighlightOnFocusin interfaceTextHighlightable- Returns:
- Enum representing BBj constant for highlight on focus
-
setHighlightOnFocus
Description copied from interface:TextHighlightableThis method sets the behavior of controls implementing the TextControl interface when receiving focus via the keyboard, mouse, or BBjControl::focus() method FOCUS mnemonic.- Specified by:
setHighlightOnFocusin interfaceTextHighlightable- Parameters:
highlight- Enum representing a BBj constant that dictates highlight behavior for control- Returns:
- The control itself.
-
getTextAlignment
Description copied from interface:TextAlignableReturns a value indicating the text's horizontal alignment.- Specified by:
getTextAlignmentin interfaceTextAlignable- Returns:
-
setTextAlignment
Description copied from interface:TextAlignableSets the horizontal alignment of the text within the control.- Specified by:
setTextAlignmentin interfaceTextAlignable- Parameters:
alignment- Enum from list representing an internal BBj numeric constant- Returns:
- The control itself
-
setText
Description copied from interface:HasControlTextset the text of the control Each control implementing this interface has a text property, which might be visible in different ways (caption, title, contents of edit) or sometimes not visible at all- Specified by:
setTextin interfaceHasControlText- Overrides:
setTextin classAbstractDwcControl- Returns:
- the control itself
-
setVisible
Description copied from interface:HasVisibilitySet whether the control is visible or invisible- Specified by:
setVisiblein interfaceHasVisibility- Overrides:
setVisiblein classAbstractDwcControl- Returns:
- the control itself
-
setEnabled
Description copied from interface:EnableableSet whether the control is to be enabled- Specified by:
setEnabledin interfaceEnableable- Overrides:
setEnabledin classAbstractDwcControl- Returns:
- the control itself
-
setTooltipText
Description copied from interface:HasTooltipSet the tooltip text of the control- Specified by:
setTooltipTextin interfaceHasTooltip- Overrides:
setTooltipTextin classAbstractDwcControl- Returns:
- the control itself
-
setAttribute
Description copied from class:AbstractDwcControlset the value for an attribute in the control- Specified by:
setAttributein interfaceHasAttribute- Overrides:
setAttributein classAbstractDwcControl- Parameters:
attribute- the name of the attributevalue- the value to be set- Returns:
- the control itself
-
setId
Description copied from interface:ControlAssigns the ID of a control- Specified by:
setIdin interfaceControl- Overrides:
setIdin classAbstractControl- Parameters:
elementId- Desired ID designation- Returns:
- The control itself
-
setStyle
Description copied from interface:HasStyleAssigns specified value to the specified CSS property- Specified by:
setStylein interfaceHasStyle- Overrides:
setStylein classAbstractDwcControl- Parameters:
property- The CSS property to be changedvalue- The value of the selected CSS property- Returns:
- The control itself
-
addClassName
Description copied from interface:HasClassNameAdds a CSS class to the list of CSS classes for the control.- Specified by:
addClassNamein interfaceHasClassName- Overrides:
addClassNamein classAbstractDwcControl- Returns:
- The control itself
-
removeClassName
Description copied from interface:HasClassNameRemoves a CSS class from the list of CSS classes for the control.- Specified by:
removeClassNamein interfaceHasClassName- Overrides:
removeClassNamein classAbstractDwcControl- Returns:
- The control itself
-
setExpanse
-
setTheme
-
catchUp
Description copied from class:AbstractDwcControlThe catchUp method is used to replay attributes and settings that the API user might have added to a control before its creation. A control is not created before it's added to a panel. Anything that is added between instantiation of a control and its addition to a panel has to be recorded and replayed in this method- Overrides:
catchUpin classAbstractDwcControl- Throws:
IllegalAccessException- - thrown if an attempt is made to call this method more than once
-