public class SpanMultiButton extends Container implements ActionSource, SelectableIconHolder, TextHolder
A powerful button like component that allows multiple rows/and an icon to be added every row/icon can have its own UIID. Internally the multi-button is a container with a lead component. Up to 4 rows are supported.
It's like MultiButton
, but it breaks lines.
MultiButton
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR
Constructor and Description |
---|
SpanMultiButton()
Default constructor allowing the designer to create an instance of this class
|
SpanMultiButton(String line1)
Initializes a multibutton with the first line of text
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener al)
Adds an action listener
|
void |
addLongPressListener(ActionListener l)
Adds a listener to the pointer event
|
void |
addPointerPressedListener(ActionListener l)
Adds a listener to the pointer event
|
void |
addPointerReleasedListener(ActionListener l)
Adds a listener to the pointer event
|
Command |
getCommand()
Returns the command for the emblem
|
Image |
getDisabledIcon()
Indicates the icon that is displayed on the button when the button is in
the disabled state
|
Image |
getEmblem()
Returns the emblem image
|
String |
getEmblemName()
Returns the name of the emblem
|
String |
getEmblemPosition()
Returns the emblem position based on border layout constraints
|
String |
getEmblemUIID()
Returns the UIID of the Emblem
|
int |
getGap()
Returns the gap in pixels between the icon/text to the Label boundaries
|
String |
getGroup()
Indicates the group for the radio button
|
Image |
getIcon()
Returns the icon image
|
Label |
getIconComponent()
Allows us to gain direct access to the icon component so we can set it directly without going
via the other methods, this is especially useful for classes such as the ImageDownloadService
which can then update the icon seamlessly.
|
Image |
getIconFromState()
Returns the icon for the button based on its current state
|
String |
getIconName()
Returns the name of the icon
|
String |
getIconPosition()
Returns the icon position based on border layout constraints
|
Component |
getIconStyleComponent()
Gets the component that should be used for styling material the material icon.
|
String |
getIconUIID()
Returns the UIID of the Icon
|
String |
getMaskName()
Set the mask name for the icon
|
String |
getNameLine1()
Returns the name of the row
|
String |
getNameLine2()
Returns the name of the row
|
String |
getNameLine3()
Returns the name of the row
|
String |
getNameLine4()
Returns the name of the row
|
Image |
getPressedIcon()
Indicates the icon that is displayed on the button when the button is in
pressed state
|
String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this
API is designed for usage internally by the GUI builder code
|
Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details).
|
Object |
getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder
|
Image |
getRolloverIcon()
Indicates the icon that is displayed on the button when the button is in
rolled over state
|
Image |
getRolloverPressedIcon()
Indicates the icon that is displayed on the button when the button is in
pressed state and is selected.
|
String |
getText()
Sets the line 1 text
The text of the component
|
String |
getTextLine1()
Returns the content of the row
|
String |
getTextLine2()
Returns the content of the row
|
String |
getTextLine3()
Returns the content of the row
|
String |
getTextLine4()
Returns the content of the row
|
int |
getTextPosition()
Returns The position of the text relative to the icon
|
String |
getUIIDLine1()
Returns the UIID of the row
|
String |
getUIIDLine2()
Returns the UIID of the row
|
String |
getUIIDLine3()
Returns the UIID of the row
|
String |
getUIIDLine4()
Returns the UIID of the row
|
boolean |
isCheckBox()
Returns true if this is a checkbox button
|
boolean |
isHorizontalLayout()
Indicates whether the first two labels are be side by side
|
boolean |
isInvertFirstTwoEntries()
Inverts the order of the first two entries so the second line appears first.
|
boolean |
isLinesTogetherMode()
Indicates if the lines are grouped together on this button
|
boolean |
isRadioButton()
Returns true if this is a radio button
|
boolean |
isSelected()
Returns true if the checkbox/radio button is selected
|
boolean |
isShouldLocalize()
Indicates if text should be localized when set to the component, by default
all text is localized so this allows disabling automatic localization for
a specific component.
|
void |
removeActionListener(ActionListener al)
Removes an action listener
|
void |
removeLongPressListener(ActionListener l)
Removes the listener from the pointer event
|
void |
removePointerPressedListener(ActionListener l)
Removes the listener from the pointer event
|
void |
removePointerReleasedListener(ActionListener l)
Removes the listener from the pointer event
|
void |
removeTextLine1()
Removes the content of the row
|
void |
removeTextLine2()
Removes the content of the row
|
void |
removeTextLine3()
Removes the content of the row
|
void |
removeTextLine4()
Removes the content of the row
|
void |
setCheckBox(boolean b)
Turns the multi-button into a checkbox multi-button
|
void |
setCommand(Command c)
Sets the command for the component, it doesn't affe
|
void |
setDisabledIcon(Image arg0)
Indicates the icon that is displayed on the button when the button is in
the disabled state
|
void |
setEmblem(Image i)
Sets the emblem
|
void |
setEmblemName(String t)
Sets the name of the emblem (important for use in generic renderers
|
void |
setEmblemPosition(String t)
Sets the emblem position based on border layout constraints
|
void |
setEmblemUIID(String t)
Sets the UIID of the emblem
|
void |
setFontIcon(Font font,
char c,
float size)
This method is shorthand for
FontImage.setFontIcon(com.codename1.ui.Label, com.codename1.ui.Font, char, float) |
void |
setGap(int gap)
Set the gap in pixels between the icon/text to the Label boundaries
|
void |
setGroup(ButtonGroup bg)
Sets the button group for a radio button mode multibutton
|
void |
setGroup(String group)
Indicates the group for the radio button
|
void |
setHorizontalLayout(boolean b)
Indicates the first two labels should be side by side
|
void |
setIcon(Image i)
Sets the icon
|
void |
setIconName(String t)
Sets the name of the icon (important for use in generic renderers
|
void |
setIconPosition(String t)
Sets the icon position based on border layout constraints
|
void |
setIconUIID(String t)
Sets the UIID of the icon
|
void |
setInvertFirstTwoEntries(boolean b)
Inverts the order of the first two entries so the second line appears first.
|
void |
setLinesTogetherMode(boolean l)
Changes the layout so the lines of the button are grouped together
|
void |
setMaskName(String maskName)
The mask name for the icon
|
void |
setMaterialIcon(char c,
float size)
This method is shorthand for
FontImage.setMaterialIcon(com.codename1.ui.Label, char, float) |
void |
setNameLine1(String t)
Sets the name of the row (important for use in generic renderers)
|
void |
setNameLine2(String t)
Sets the name of the row (important for use in generic renderers
|
void |
setNameLine3(String t)
Sets the name of the row (important for use in generic renderers
|
void |
setNameLine4(String t)
Sets the name of the row (important for use in generic renderers
|
void |
setPressedIcon(Image arg0)
Indicates the icon that is displayed on the button when the button is in
pressed state
|
String |
setPropertyValue(String name,
Object value)
Sets a new value to the given property, returns an error message if failed
and null if successful.
|
void |
setRadioButton(boolean b)
Turns the multi-button into a radio multi-button
|
void |
setRolloverIcon(Image arg0)
Indicates the icon that is displayed on the button when the button is in
rolled over state
|
void |
setRolloverPressedIcon(Image icn)
Indicates the icon that is displayed on the button when the button is in
pressed state and is selected.
|
void |
setSelected(boolean b)
Toggles the selected state for the radio button/check box modes
|
void |
setShouldLocalize(boolean shouldLocalize)
Indicates if text should be localized when set to the component, by default
all text is localized so this allows disabling automatic localization for
a specific component.
|
void |
setText(String text)
Returns the line 1 text
New text for the component
|
void |
setTextLine1(String t)
Sets the content of the row
|
void |
setTextLine2(String t)
Sets the content of the row
|
void |
setTextLine3(String t)
Sets the content of the row
|
void |
setTextLine4(String t)
Sets the content of the row
|
void |
setTextPosition(int textPosition)
Sets the position of the text relative to the icon if exists
|
void |
setUIIDLine1(String t)
Sets the UIID of the row
|
void |
setUIIDLine2(String t)
Sets the UIID of the row
|
void |
setUIIDLine3(String t)
Sets the UIID of the row
|
void |
setUIIDLine4(String t)
Sets the UIID of the row
|
add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintBackground, paintBorderBackground, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyTypeNames, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains
public SpanMultiButton(String line1)
line1
- first line of textpublic SpanMultiButton()
public void setLinesTogetherMode(boolean l)
l
- true to group the lines togetherpublic boolean isLinesTogetherMode()
public Label getIconComponent()
public void setCheckBox(boolean b)
b
- true for a checkbox multi-buttonpublic void addActionListener(ActionListener al)
addActionListener
in interface ActionSource
al
- the action listenerpublic void removeActionListener(ActionListener al)
removeActionListener
in interface ActionSource
al
- the action listenerpublic void addLongPressListener(ActionListener l)
addLongPressListener
in class Component
l
- public void removeLongPressListener(ActionListener l)
removeLongPressListener
in class Component
l
- public void addPointerPressedListener(ActionListener l)
addPointerPressedListener
in class Component
l
- public void removePointerPressedListener(ActionListener l)
removePointerPressedListener
in class Component
l
- public void addPointerReleasedListener(ActionListener l)
addPointerReleasedListener
in class Component
l
- public void removePointerReleasedListener(ActionListener l)
removePointerReleasedListener
in class Component
l
- public void setCommand(Command c)
c
- the commandpublic Command getCommand()
public boolean isCheckBox()
public void setRadioButton(boolean b)
b
- true for a radio multi-buttonpublic boolean isRadioButton()
public boolean isSelected()
public void setSelected(boolean b)
b
- true for checked false for uncheckedpublic void setHorizontalLayout(boolean b)
b
- true to place the first two labels side by sidepublic boolean isHorizontalLayout()
public void setInvertFirstTwoEntries(boolean b)
b
- true to place the second row entry as the first entrypublic boolean isInvertFirstTwoEntries()
public void setTextLine1(String t)
t
- text to setpublic String getTextLine1()
public void setNameLine1(String t)
t
- name to setpublic String getNameLine1()
public void setUIIDLine1(String t)
t
- UIID to setpublic String getUIIDLine1()
public void setTextLine2(String t)
t
- text to setpublic String getTextLine2()
public void setNameLine2(String t)
t
- name to setpublic String getNameLine2()
public void setUIIDLine2(String t)
t
- UIID to setpublic String getUIIDLine2()
public void setTextLine3(String t)
t
- text to setpublic void removeTextLine1()
public void removeTextLine2()
public void removeTextLine3()
public void removeTextLine4()
public String getTextLine3()
public void setNameLine3(String t)
t
- name to setpublic String getNameLine3()
public void setUIIDLine3(String t)
t
- UIID to setpublic String getUIIDLine3()
public void setTextLine4(String t)
t
- text to setpublic String getTextLine4()
public void setNameLine4(String t)
t
- name to setpublic String getNameLine4()
public void setUIIDLine4(String t)
t
- UIID to setpublic String getUIIDLine4()
public void setIcon(Image i)
setIcon
in interface IconHolder
i
- the iconpublic Image getIcon()
getIcon
in interface IconHolder
public void setEmblem(Image i)
i
- the iconpublic Image getEmblem()
public void setIconPosition(String t)
t
- position either North/South/East/Westpublic String getIconPosition()
public void setEmblemPosition(String t)
t
- position either North/South/East/Westpublic String getEmblemPosition()
public void setIconName(String t)
t
- name to setpublic String getIconName()
public void setIconUIID(String t)
setIconUIID
in interface IconHolder
t
- UIID to setpublic String getIconUIID()
getIconUIID
in interface IconHolder
public void setEmblemName(String t)
t
- name to setpublic String getEmblemName()
public void setEmblemUIID(String t)
t
- UIID to setpublic String getEmblemUIID()
public String[] getPropertyNames()
getPropertyNames
in class Component
public Class[] getPropertyTypes()
getPropertyTypes
in class Component
public Object getPropertyValue(String name)
getPropertyValue
in class Component
name
- the name of the propertypublic void setText(String text)
setText
in interface TextHolder
text
- the textpublic String getText()
getText
in interface TextHolder
public String setPropertyValue(String name, Object value)
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the propertypublic String getGroup()
public void setGroup(String group)
group
- the group to setpublic String getMaskName()
public void setMaskName(String maskName)
maskName
- the maskName to setpublic boolean isShouldLocalize()
public void setShouldLocalize(boolean shouldLocalize)
shouldLocalize
- the shouldLocalize to setpublic void setGroup(ButtonGroup bg)
bg
- the button grouppublic void setGap(int gap)
setGap
in interface IconHolder
gap
- the gap in pixelspublic int getGap()
getGap
in interface IconHolder
public void setTextPosition(int textPosition)
setTextPosition
in interface IconHolder
textPosition
- alignment value (LEFT, RIGHT, BOTTOM or TOP)#LEFT
,
#RIGHT
,
#BOTTOM
,
#TOP
public int getTextPosition()
getTextPosition
in interface IconHolder
#LEFT
,
#RIGHT
,
#BOTTOM
,
#TOP
public Component getIconStyleComponent()
IconHolder
IconHolder.setIconUIID(java.lang.String)
has been used
to set a custom UIID for the icon, then this will return a component with that UIID. Otherwise this will just return this component
itself.getIconStyleComponent
in interface IconHolder
public void setMaterialIcon(char c, float size)
FontImage.setMaterialIcon(com.codename1.ui.Label, char, float)
setMaterialIcon
in interface IconHolder
c
- one of the constants from FontImage
size
- the size of the icon in millimeterspublic void setFontIcon(Font font, char c, float size)
FontImage.setFontIcon(com.codename1.ui.Label, com.codename1.ui.Font, char, float)
setFontIcon
in interface IconHolder
c
- one of the constants from the fontsize
- the size of the icon in millimeterspublic Image getRolloverIcon()
getRolloverIcon
in interface SelectableIconHolder
Button.STATE_ROLLOVER
public void setPressedIcon(Image arg0)
setPressedIcon
in interface SelectableIconHolder
arg0
- icon usedButton.STATE_PRESSED
public Image getPressedIcon()
getPressedIcon
in interface SelectableIconHolder
Button.STATE_PRESSED
public void setDisabledIcon(Image arg0)
setDisabledIcon
in interface SelectableIconHolder
arg0
- icon usedpublic Image getDisabledIcon()
getDisabledIcon
in interface SelectableIconHolder
public void setRolloverPressedIcon(Image icn)
setRolloverPressedIcon
in interface SelectableIconHolder
icn
- icon usedpublic Image getRolloverPressedIcon()
getRolloverPressedIcon
in interface SelectableIconHolder
public Image getIconFromState()
getIconFromState
in interface SelectableIconHolder
public void setRolloverIcon(Image arg0)
setRolloverIcon
in interface SelectableIconHolder
arg0
- icon to useButton.STATE_ROLLOVER