public class ComponentSelector extends Object implements Iterable<Component>, Set<Component>
Sets of components can either be created by explicitly adding components to the set, or by providing a "selector" string that specifies how the set should be formed. Some examples:
$("Label")
- The set of all components on the current form with UIID="Label"$("#AddressField")
- The set of components with name="AddressField"$("TextField#AddressField")
- The set of components with UIID=TextField and Name=AddressField$("Label, Button")
- Set of components in current form with UIID="Label" or UIID="Button"$("Label", myContainer)
- Set of labels within the container myContainer
$("MyContainer *")
- All descendants of the container with UIID="MyContainer". Will not include "MyContainer".$("MyContainer > *")
- All children of of the container with UIID="MyContainer".$("MyContainer > Label)
- All children with UIID=Label of container with UIID=MyContainer$("Label").getParent()
- All parent components of labels in the current form.To make selection more flexible, you can "tag" components so that they can be easily targeted by a selector.
You can add tags to components using addTags(java.lang.String...)
, and remove them using removeTags(java.lang.String...)
.
Once you have tagged a component, it can be targeted quite easily using a selector. Tags are specified in a selector with a .
prefix. E.g.:
$(".my-tag")
- The set of all components with tag "my-tag".$("Label.my-tag")
- The set of all components with tag "my-tag" and UIID="Label"$("Label.my-tag.myother-tag")
- The set of all components with tags "my-tag" and "myother-tag" and UIID="Label". Matches only components that include all of those tags.While component selection alone in the ComponentSelector is quite powerful, the true power comes when
you start to operate on the entire set of components using the Fluent API of ComponentSelector. ComponentSelector
includes wrapper methods for most of the mutator methods of Component
, Container
, and a few other common
component types.
For example, the following two snippets are equivalent:
for (Component c : $("Label")) {
c.getStyle().setFgColor(0xff0000);
}
and
$("Label").setFgColor(0xff0000);
The second snippet is clearly easier to type and more compact. But we can take it further. The Fluent API style allows you to chain together multiple method calls. This even makes it desirable to operate on single-element sets. E.g.:
Button myButton = $(new Button("Some text"))
.setUIID("Label")
.addTags("cell", "row-"+rowNum, "col-"+colNum, rowNum%2==0 ? "even":"odd")
.putClientProperty("row", rowNum)
.putClientProperty("col", colNum)
.asComponent(Button.class);
The above snippet wraps a new Button in a ComponentSelector, then uses the fluent API to apply several properties
to the button, before using asComponent()
to return the Button itself.
ComponentSelector includes a few different types of methods:
Component
, Container
, etc... to operate on all applicable components in the set.find(java.lang.String)
, getParent()
, getComponentAt(int)
,
closest(java.lang.String)
, nextSibling()
, prevSibling()
, parents(java.lang.String)
,
getComponentForm()
, and many more.fadeIn()
, fadeOut()
, slideDown()
, slideUp()
, animateLayout(int)
,
animateHierarchy(int)
, etc..$(java.lang.Runnable)
as a short-hand for Display.callSerially(java.lang.Runnable)
Set
because ComponentSelector is a set.The following is an example form that demonstrates the use of ComponentSelector to easily create effects on components in a form.
The following shows the use of tags to help with striping a table, and selecting rows when clicked on.
See full Demo App in this Github Repo
Modifying styles deserves special mention because components have multiple Style
objects associated with them.
Component.getStyle()
returns the style of the component in its current state. Component.getPressedStyle()
gets the pressed style of the component, Component.getSelectedStyle()
get its selected style, etc..
ComponentSelector wraps each of the getXXXStyle() methods of Component
with corresponding methods
that return proxy styles for all components in the set. getStyle()
returns a proxy Style
that proxies
all of the styles returned from each of the Component.getStyle()
methods in the set. getPressedStyle()
returns
a proxy for all of the pressed styles, etc..
Example Modifying Text Color of All Buttons in a container when they are pressed only
Style pressed = $("Button", myContainer).getPressedStyle();
pressed.setFgColor(0xff0000);
A slightly more elegant pattern would be to use the selectPressedStyle()
method to set the default
style for mutations to "pressed". Then we could use the fluent API of ComponentSelector to chain multiple style
mutations. E.g.:
$("Button", myContainer)
.selectPressedStyle()
.setFgColor(0xffffff)
.setBgColor(0x0)
.setBgTransparency(255);
A short-hand for this would be to add the :pressed pseudo-class to the selector. E.g.
$("Button:pressed", myContainer)
.setFgColor(0xffffff)
.setBgColor(0x0)
.setBgTransparency(255);
The following style pseudo-classes are supported:
selectPressedStyle()
selectSelectedStyle()
selectUnselectedStyle()
selectAllStyles()
selectDisabledStyle()
You can chain calls to selectedXXXStyle(), enabling to chain together mutations of multiple different style properties. E.g To change the pressed foreground color, and then change the selected foreground color, you could do:
$("Button", myContainer)
.selectPressedStyle()
.setFgColor(0x0000ff)
.selectSelectedStyle()
.setFgColor(0x00ff00);
There are many ways to remove components from a set. Obviously you can use the standard Set
methods
to explicitly remove components from your set:
ComponentSelector sel = $("Button").remove(myButton, true);
// The set of all buttons on the current form, except myButton
or
ComponentSelector sel = $("Button").removeAll($(".some-tag"), true);
// The set of all buttons that do NOT contain the tag ".some-tag"
You could also use the filter(com.codename1.ui.ComponentSelector.Filter)
to explicitly
declare which elements should be kept, and which should be discarded:
ComponentSelector sel = $("Button").filter(c->{
return c.isVisible();
});
// The set of all buttons that are currently visible.
One powerful aspect of working with sets of components is that you can generate very specific sets of components using very simple queries. Consider the following queries:
$(myButton1, myButton2).getParent()
- The set of parents of myButton1 and myButton2. If they have the
same parent, then this set will only contain a single element: the common parent container. If they have different parents, then this
set will include both parent containers.$(myButton).getParent().find(">TextField")
- The set of siblings of myButton that have UIID=TextField$(myButton).closest(".some-tag")
- The set containing the "nearest" parent container of myButton that has
the tag ".some-tag". If there are no matching components, then this will be an empty set. This is formed by crawling up the tree
until it finds a matching component. Works the same as jQuery's closest() method.$(".my-tag").getComponentAt(4)
- The set of 5th child components of containers with tag ".my-tag".Modifier and Type | Class and Description |
---|---|
static interface |
ComponentSelector.ComponentClosure
Interface used for providing callbacks that receive a Component as input.
|
static interface |
ComponentSelector.ComponentMapper
Interface used by
map(com.codename1.ui.ComponentSelector.ComponentMapper) to form a new set of
components based on the components in one set. |
static interface |
ComponentSelector.Filter
Interface used by
filter(com.codename1.ui.ComponentSelector.Filter) to form a new set of
components based on the components in one set. |
Constructor and Description |
---|
ComponentSelector(Component... cmps)
Creates a component selector that wraps the provided components.
|
ComponentSelector(Set<Component> cmps)
Creates a component selector that wraps the provided components.
|
ComponentSelector(String selector)
Creates a selector that will query the current form.
|
ComponentSelector(String selector,
Collection<Component> roots)
Creates a selector with the provided roots.
|
ComponentSelector(String selector,
Component... roots)
Creates a selector with the provided roots.
|
Modifier and Type | Method and Description |
---|---|
static ComponentSelector |
$(ActionEvent e)
Creates a ComponentInspector with the source component of the provided event.
|
static ComponentSelector |
$(Component... cmps)
Wraps provided components in a ComponentSelector set.
|
static ComponentSelector |
$(Runnable r)
|
static ComponentSelector |
$(Set<Component> cmps)
Creates a new ComponentSelector with the provided set of components.
|
static ComponentSelector |
$(String selector)
Creates a new ComponentSelector with the components matched by the provided selector.
|
static ComponentSelector |
$(String selector,
Collection<Component> roots)
Creates a ComponentSelector with the components matched by the provided selector in the provided
roots' subtrees.
|
static ComponentSelector |
$(String selector,
Component... roots)
Creates a ComponentSelector with the components matched by the provided selector in the provided
roots' subtrees.
|
boolean |
add(Component e)
Explicitly adds a component to the result set.
|
ComponentSelector |
add(Component e,
boolean chain)
Fluent API wrapper for
add(com.codename1.ui.Component) |
ComponentSelector |
addActionListener(ActionListener l)
Adds action listener to applicable components in found set.
|
boolean |
addAll(Collection<? extends Component> c)
Adds all components in the given collection to the result set.
|
ComponentSelector |
addAll(Collection<? extends Component> c,
boolean chain)
Fluent API wrapper for
addAll(java.util.Collection) . |
ComponentSelector |
addDataChangedListener(DataChangedListener l)
|
ComponentSelector |
addDragOverListener(ActionListener l)
Adds drag over listener to all components in found set.
|
ComponentSelector |
addDropListener(ActionListener l)
Adds a drop listener to all components in found set.
|
ComponentSelector |
addFocusListener(FocusListener l)
Adds a focus listener to all components in found set.
|
ComponentSelector |
addLongPressListener(ActionListener l)
Adds long pointer pressed listener to all components in found set.
|
ComponentSelector |
addPointerDraggedListener(ActionListener l)
Adds pointer dragged listener to all components in found set.
|
ComponentSelector |
addPointerPressedListener(ActionListener l)
Adds pointer pressed listener to all components in found set.
|
ComponentSelector |
addPointerReleasedListener(ActionListener l)
Adds pointer released listener to all components in found set.
|
ComponentSelector |
addScrollListener(ScrollListener l)
Adds scroll listener to all components in found set.
|
ComponentSelector |
addStyleListener(StyleListener l)
|
ComponentSelector |
addTags(String... tags)
Adds the given tags to all elements in the result set.
|
ComponentSelector |
animateHierarchy(int duration)
Animates the hierarchy of containers in this set.
|
ComponentSelector |
animateHierarchy(int duration,
SuccessCallback<ComponentSelector> callback)
|
ComponentSelector |
animateHierarchyAndWait(int duration)
|
ComponentSelector |
animateHierarchyFade(int duration,
int startingOpacity)
|
ComponentSelector |
animateHierarchyFade(int duration,
int startingOpacity,
SuccessCallback<ComponentSelector> callback)
|
ComponentSelector |
animateHierarchyFadeAndWait(int duration,
int startingOpacity)
|
ComponentSelector |
animateLayout(int duration)
|
ComponentSelector |
animateLayout(int duration,
SuccessCallback<ComponentSelector> callback)
Wraps
Container.animateLayout(int) . |
ComponentSelector |
animateLayoutAndWait(int duration)
|
ComponentSelector |
animateLayoutFade(int duration,
int startingOpacity)
Animates layout with fade on all containers in this set.
|
ComponentSelector |
animateLayoutFade(int duration,
int startingOpacity,
SuccessCallback<ComponentSelector> callback)
|
ComponentSelector |
animateLayoutFadeAndWait(int duration,
int startingOpacity)
|
ComponentSelector |
animateStyle(Style destStyle,
int duration,
SuccessCallback<ComponentSelector> callback)
Animates this set of components, replacing any modified style properties of the
destination style to the components.
|
ComponentSelector |
animateUnlayout(int duration,
int opacity)
|
ComponentSelector |
animateUnlayout(int duration,
int opacity,
SuccessCallback<ComponentSelector> callback)
|
ComponentSelector |
animateUnlayoutAndWait(int duration,
int opacity)
|
ComponentSelector |
append(Component child)
Appends a child component to the first container in this set.
|
ComponentSelector |
append(ComponentSelector.ComponentMapper mapper)
Append a child element to each container in this set.
|
ComponentSelector |
append(Object constraint,
Component child)
Appends a child component to the first container in this set.
|
ComponentSelector |
append(Object constraint,
ComponentSelector.ComponentMapper mapper)
Append a child element to each container in this set.
|
ComponentSelector |
applyRTL(boolean rtl)
|
Component |
asComponent()
Returns the first component in this set.
|
<T extends Component> |
asComponent(Class<T> type)
Returns the first component in this set.
|
List<Component> |
asList()
Returns the components of this set as a List.
|
void |
clear()
Clears the result set.
|
ComponentSelector |
clear(boolean chain)
Fluent API wrapper for (@link #clear()}
|
ComponentSelector |
clearClientProperties()
Wrapper for
Component.clearClientProperties() . |
ComponentSelector |
closest(String selector)
Creates a new set of components consistng of all "closest" ancestors of components
in this set which match the provided selector.
|
boolean |
contains(int x,
int y)
Returns true if any of the components in the found set contains the provided coordinate.
|
boolean |
contains(Object o)
Checks if an object is contained in result set.
|
boolean |
containsAll(Collection<?> c)
Checks if the result set contains all of the components found in the provided
collection.
|
boolean |
containsInSubtree(Component cmp)
Returns true if any of the containers in the current found set contains
the provided component in its subtree.
|
Style |
createProxyStyle()
Creates a proxy style to mutate the styles of all component styles in found set.
|
ComponentSelector |
each(ComponentSelector.ComponentClosure closure)
Applies the given callback to each component in the set.
|
ComponentSelector |
fadeIn()
Fade in this set of components.
|
ComponentSelector |
fadeIn(int duration)
Fade in this set of components.
|
ComponentSelector |
fadeIn(int duration,
SuccessCallback<ComponentSelector> callback)
Fade in this set of components.
|
ComponentSelector |
fadeInAndWait()
Fades in this component and blocks until animation is complete.
|
ComponentSelector |
fadeInAndWait(int duration)
Fades in this component and blocks until animation is complete.
|
ComponentSelector |
fadeOut()
Fades out components in this set.
|
ComponentSelector |
fadeOut(int duration)
Fades out components in this set.
|
ComponentSelector |
fadeOut(int duration,
SuccessCallback<ComponentSelector> callback)
Fades out components in this set.
|
ComponentSelector |
fadeOutAndWait(int duration)
Hide the matched elements by fading them to transparent.
|
ComponentSelector |
filter(ComponentSelector.Filter filter)
Creates a new set of components formed by filtering the current set using a filter function.
|
ComponentSelector |
filter(String selector)
Filters the current found set against the given selector.
|
ComponentSelector |
find(String selector)
Uses the results of this selector as the roots to create a new selector with
the provided selector string.
|
ComponentSelector |
findFirstFocusable()
Creates new ComponentSelector with the set of first focusable elements of
each of the containers in the current result set.
|
ComponentSelector |
first()
Returns a set with the first element of the current set, or an empty set if the
current set is empty.
|
ComponentSelector |
firstChild()
Creates new set consisting of the first child of each component in the current set.
|
ComponentSelector |
forceRevalidate()
|
Style |
getAllStyles()
Returns a proxy style for all of the "all" styles of the components in this set.
|
AnimationManager |
getAnimationManager()
Gets the AnimationManager for the components in this set.
|
Object |
getClientProperty(String key)
Gets a client property from the first component in the set.
|
ComponentSelector |
getComponentAt(int index)
This returns a new ComponentSelector which includes a set of all results
of calling
Container.getComponentAt(int) on containers in this
found set. |
ComponentSelector |
getComponentAt(int x,
int y)
Returns new ComponentSelector with the set of all components returned from calling
Container.getComponentAt(int, int) in the current found set. |
ComponentSelector |
getComponentForm()
Gets the set of all component forms from components in this set.
|
Style |
getDisabledStyle()
Returns a proxy style for all of the disabled styles of the components in this set.
|
ComponentSelector |
getParent()
Gets the set of all "parent" components of components in the result set.
|
Style |
getPressedStyle()
Returns a proxy style for all of the pressed styles of the components in this set.
|
Style |
getSelectedStyle()
Returns a proxy style for all of the selected styles of the components in this set.
|
Style |
getStyle()
Gets a proxy style that wraps the result of
Component.getStyle() of each component in set. |
Style |
getStyle(Component component)
Gets a style object for the given component that can be used to modify the
component's styles.
|
String |
getText()
Gets the text on the first component in this set that supports this property.
|
Style |
getUnselectedStyle()
Returns a proxy style for all of the unselected styles of the components in this set.
|
ComponentSelector |
growShrink(int duration)
|
ComponentSelector |
invalidate()
Wraps
Container.invalidate() |
boolean |
isEmpty()
Returns true if this set has no elements.
|
boolean |
isHidden()
Returns true if first component in this set is hidden.
|
boolean |
isIgnorePointerEvents() |
boolean |
isVisible()
Returns true if the first component in this set is visible.
|
Iterator<Component> |
iterator()
Returns the results of this selector.
|
ComponentSelector |
lastChild()
Creates new set consisting of the last child of each component in the current set.
|
ComponentSelector |
layoutContainer()
|
ComponentSelector |
map(ComponentSelector.ComponentMapper mapper)
Creates a new set based on the elements of the current set and a mapping function
which defines the elements that should be in the new set.
|
ComponentSelector |
merge(Style style)
Merges style with all styles of components in current found set.
|
ComponentSelector |
nextSibling()
Creates set of "next" siblings of components in this set.
|
ComponentSelector |
paint(Graphics g)
|
ComponentSelector |
paintBackgrounds(Graphics g)
|
ComponentSelector |
paintComponent(Graphics g)
|
ComponentSelector |
paintLockRelease()
|
ComponentSelector |
parent(String selector)
Creates a new set of components consisting of all of the parents of components in this set.
|
ComponentSelector |
parents(String selector)
Creates new set of components consisting of all of the ancestors of components in this set which
match the provided selector.
|
ComponentSelector |
prevSibling()
Creates set of "previous" siblings of components in this set.
|
ComponentSelector |
putClientProperty(String key,
Object value)
|
ComponentSelector |
refreshTheme()
Wraps
Component.refreshTheme() |
ComponentSelector |
refreshTheme(boolean merge)
|
ComponentSelector |
remove()
Wrapper for
Component.remove() . |
boolean |
remove(Object o)
Explicitly removes a component from the result set.
|
ComponentSelector |
remove(Object o,
boolean chain)
Fluent API wrapper for
remove(java.lang.Object) . |
ComponentSelector |
removeActionListener(ActionListener l)
Removes action listeners from components in set.
|
ComponentSelector |
removeAll()
This removes all children from all containers in found set.
|
boolean |
removeAll(Collection<?> c)
Removes all of the components in the provided collection from the result set.
|
ComponentSelector |
removeAll(Collection<?> c,
boolean chain)
Fluent API wrapper for
removeAll(java.util.Collection) |
ComponentSelector |
removeDataChangedListener(DataChangedListener l)
|
ComponentSelector |
removeDragOverListener(ActionListener l)
Removes drag over listener from all components in found set.
|
ComponentSelector |
removeDropListener(ActionListener l)
Removes a drop listener from all components in found set.
|
ComponentSelector |
removeFocusListener(FocusListener l)
Removes focus listener from all components in found set.
|
ComponentSelector |
removeLongPressListener(ActionListener l)
Removes long pointer pressed listener from all components in found set.
|
ComponentSelector |
removePointerDraggedListener(ActionListener l)
REmoves pointer dragged listener from all components in found set.
|
ComponentSelector |
removePointerPressedListener(ActionListener l)
Removes pointer pressed listener from all components in found set.
|
ComponentSelector |
removePointerReleasedListener(ActionListener l)
Removes pointer released listener from all components in found set.
|
ComponentSelector |
removeScrollListener(ScrollListener l)
Removes scroll listener from all components in found set.
|
ComponentSelector |
removeStyleListener(StyleListener l)
|
ComponentSelector |
removeStyleListeners()
Wraps
Style.removeListeners() |
ComponentSelector |
removeTags(String... tags)
Removes the given tags from all elements in the result set.
|
ComponentSelector |
repaint()
Wraps
Component.repaint() |
ComponentSelector |
repaint(int x,
int y,
int w,
int h)
|
ComponentSelector |
replace(ComponentSelector.ComponentMapper mapper)
Replaces the matched components within respective parents with replacements defined by the provided mapper.
|
ComponentSelector |
replace(ComponentSelector.ComponentMapper mapper,
Transition t)
Replaces the matched components within respective parents with replacements defined by the provided mapper.
|
ComponentSelector |
replaceAndWait(ComponentSelector.ComponentMapper mapper,
Transition t)
Replaces the matched components within respective parents with replacements defined by the provided mapper.
|
ComponentSelector |
requestFocus()
Wraps
Component.requestFocus() |
boolean |
retainAll(Collection<?> c)
Retains only elements of the result set that are contained in the provided collection.
|
ComponentSelector |
retainAll(Collection<?> c,
boolean chain)
Fluent API wrapper for
retainAll(java.util.Collection) |
ComponentSelector |
revalidate()
Wraps
Container.revalidate() |
ComponentSelector |
scrollComponentToVisible(Component cmp)
|
static ComponentSelector |
select(ActionEvent e)
|
static ComponentSelector |
select(Component... cmps)
Alias of
$(com.codename1.ui.Component...) |
static ComponentSelector |
select(Runnable r)
Alias of
$(java.lang.Runnable) |
static ComponentSelector |
select(Set<Component> cmps)
Alias of
$(java.util.Set) |
static ComponentSelector |
select(String selector)
Alias of
$(java.lang.String) |
static ComponentSelector |
select(String selector,
Collection<Component> roots)
|
static ComponentSelector |
select(String selector,
Component... roots)
|
ComponentSelector |
selectAllStyles()
Sets the current style to each component's ALL STYLES proxy style.
|
ComponentSelector |
selectDisabledStyle()
Sets the current style to the disabled style.
|
ComponentSelector |
selectPressedStyle()
Sets the current style to the pressed style.
|
ComponentSelector |
selectSelectedStyle()
Sets the current style to the selected style.
|
ComponentSelector |
selectUnselectedStyle()
Sets the current style to the unselected style.
|
ComponentSelector |
set3DText(boolean t,
boolean raised)
|
ComponentSelector |
set3DTextNorth(boolean north)
|
ComponentSelector |
setAlignment(int alignment)
Wraps
Style.setAlignment(int) |
ComponentSelector |
setAutoSizeMode(boolean b)
|
ComponentSelector |
setBackgroundGradientEndColor(int endColor)
Wraps
(int) |
ComponentSelector |
setBackgroundGradientRelativeSize(float size)
|
ComponentSelector |
setBackgroundGradientRelativeX(float x)
|
ComponentSelector |
setBackgroundGradientRelativeY(float y)
|
ComponentSelector |
setBackgroundGradientStartColor(int startColor)
|
ComponentSelector |
setBackgroundType(byte backgroundType)
|
ComponentSelector |
setBgColor(int bgColor)
Wraps
Style.setBgColor(int) |
ComponentSelector |
setBgImage(Image bgImage)
|
ComponentSelector |
setBgPainter(Painter bgPainter)
|
ComponentSelector |
setBgTransparency(int bgTransparency)
|
ComponentSelector |
setBorder(Border b)
|
ComponentSelector |
setCellRenderer(boolean cell)
|
ComponentSelector |
setCommand(Command cmd)
|
ComponentSelector |
setComponentState(Object state)
|
ComponentSelector |
setCursor(int cursor) |
ComponentSelector |
setDirtyRegion(Rectangle rect)
|
ComponentSelector |
setDisabledIcon(Image icon)
|
ComponentSelector |
setDisabledStyle(Style style)
Sets disabled style of all components in found set.
|
ComponentSelector |
setDoneListener(ActionListener l)
|
ComponentSelector |
setDraggable(boolean draggable)
|
ComponentSelector |
setDropTarget(boolean target)
|
ComponentSelector |
setEditable(boolean b)
|
ComponentSelector |
setEnabled(boolean enabled)
|
ComponentSelector |
setEndsWith3Points(boolean b)
|
ComponentSelector |
setFgColor(int color)
Wraps
Style.setFgColor(int) |
ComponentSelector |
setFlatten(boolean f)
|
ComponentSelector |
setFocusable(boolean focus)
Sets all components in the found set focusability.
|
ComponentSelector |
setFont(Font f)
|
ComponentSelector |
setFontSize(float size)
Sets the font size of all components in found set.
|
ComponentSelector |
setFontSizeMillimeters(float sizeMM)
Sets the font size of all components in found set.
|
ComponentSelector |
setFontSizePercent(double sizePercentage)
Sets the fonts size of all components in the found set as a percentage of the font
size of the components' respective parents.
|
ComponentSelector |
setGap(int gap)
Sets gap.
|
ComponentSelector |
setGrabsPointerEvents(boolean g)
|
ComponentSelector |
setHeight(int height)
Wrapper for
Component.setHeight(int) |
ComponentSelector |
setHidden(boolean b)
|
ComponentSelector |
setHidden(boolean b,
boolean changeMargin)
|
ComponentSelector |
setHideInPortait(boolean hide)
|
ComponentSelector |
setIcon(char materialIcon)
Sets the icon of all elements in this set to a material icon.
|
ComponentSelector |
setIcon(char materialIcon,
float size)
Sets the icon of all elements in this set to a material icon.
|
ComponentSelector |
setIcon(char materialIcon,
Style style,
float size)
Sets the icons of all elements in this set to a material icon.
|
ComponentSelector |
setIcon(Image icon)
Sets the icon for components in found set.
|
ComponentSelector |
setIconUIID(String uiid)
Sets the Icon UIID of elements in found set.
|
ComponentSelector |
setIgnorePointerEvents(boolean ignore) |
ComponentSelector |
setLabelForComponent(Label l)
|
ComponentSelector |
setLayout(Layout layout)
|
ComponentSelector |
setLeadComponent(Component lead)
|
ComponentSelector |
setLegacyRenderer(boolean b)
|
ComponentSelector |
setMargin(int margin)
Sets margin to all sides of found set components in pixels.
|
ComponentSelector |
setMargin(int topBottom,
int leftRight)
Sets margin on all components in found set.
|
ComponentSelector |
setMargin(int top,
int right,
int bottom,
int left)
Sets margin to all components in found set.
|
ComponentSelector |
setMarginMillimeters(float margin)
Sets margin to all components in found set.
|
ComponentSelector |
setMarginMillimeters(float topBottom,
float leftRight)
Sets margin in millimeters to all components in found set.
|
ComponentSelector |
setMarginMillimeters(float top,
float right,
float bottom,
float left)
Sets margin to all components in found set in millimeters.
|
ComponentSelector |
setMarginPercent(double margin)
Sets the margin on all components in found set as a percentage of their respective
parents' dimensions.
|
ComponentSelector |
setMarginPercent(double topBottom,
double leftRight)
Sets margin on all components in found set as a percentage of their respective parents' dimensions.
|
ComponentSelector |
setMarginPercent(double top,
double right,
double bottom,
double left)
Sets margin on all components in found set as a percentage of their respective parents' dimensions.
|
ComponentSelector |
setMask(Object mask)
|
ComponentSelector |
setMaskName(String name)
|
ComponentSelector |
setMaterialIcon(char icon,
float size)
Sets the material icon of all labels in the set.
|
ComponentSelector |
setName(String name)
|
ComponentSelector |
setOpacity(int opacity)
Wraps
Style.setOpacity(int) |
ComponentSelector |
setOverline(boolean b)
|
ComponentSelector |
setPadding(int padding)
Sets padding to all sides of found set components in pixels.
|
ComponentSelector |
setPadding(int topBottom,
int leftRight)
Sets padding on all components in found set.
|
ComponentSelector |
setPadding(int top,
int right,
int bottom,
int left)
Sets padding to all components in found set.
|
ComponentSelector |
setPaddingMillimeters(float padding)
Sets padding to all components in found set.
|
ComponentSelector |
setPaddingMillimeters(float topBottom,
float leftRight)
Sets padding in millimeters to all components in found set.
|
ComponentSelector |
setPaddingMillimeters(float top,
float right,
float bottom,
float left)
Sets padding to all components in found set in millimeters.
|
ComponentSelector |
setPaddingPercent(double padding)
Sets the padding on all components in found set as a percentage of their respective
parents' dimensions.
|
ComponentSelector |
setPaddingPercent(double topBottom,
double leftRight)
Sets padding on all components in found set as a percentage of their respective parents' dimensions.
|
ComponentSelector |
setPaddingPercent(double top,
double right,
double bottom,
double left)
Sets padding on all components in found set as a percentage of their respective parents' dimensions.
|
ComponentSelector |
setPreferredH(int h)
Wrapper for
Component.setPreferredH(int) |
ComponentSelector |
setPreferredSize(Dimension dim)
|
ComponentSelector |
setPreferredW(int w)
Wrapper for
Component.setPreferredW(int) |
ComponentSelector |
setPressedIcon(Image icon)
|
ComponentSelector |
setPressedStyle(Style style)
Sets pressed style of all components in found set.
|
ComponentSelector |
setPropertyValue(String key,
Object value)
|
ComponentSelector |
setRolloverIcon(Image icon)
|
ComponentSelector |
setRolloverPressedIcon(Image icon)
|
ComponentSelector |
setRTL(boolean rtl)
|
ComponentSelector |
setSameHeight()
|
ComponentSelector |
setSameWidth()
|
ComponentSelector |
setScrollableX(boolean b)
|
ComponentSelector |
setScrollableY(boolean b)
|
ComponentSelector |
setScrollAnimationSpeed(int speed)
|
ComponentSelector |
setScrollIncrement(int b)
|
ComponentSelector |
setScrollOpacityChangeSpeed(int scrollOpacityChangeSpeed)
|
ComponentSelector |
setScrollSize(Dimension size)
|
ComponentSelector |
setScrollVisible(boolean vis)
|
ComponentSelector |
setSelectCommandText(String text)
Sets select command text on all components in found set.
|
ComponentSelector |
setSelectedStyle(Style style)
Sets selected style of all components in found set.
|
ComponentSelector |
setShiftMillimeters(int b)
|
ComponentSelector |
setShiftText(int shift)
Sets shift text.
|
ComponentSelector |
setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
|
ComponentSelector |
setShouldLocalize(boolean b)
|
ComponentSelector |
setShowEvenIfBlank(boolean b)
|
ComponentSelector |
setSize(Dimension size)
|
ComponentSelector |
setSmoothScrolling(boolean smooth)
|
ComponentSelector |
setSnapToGrid(boolean s)
|
ComponentSelector |
setStrikeThru(boolean b)
|
ComponentSelector |
setTactileTouch(boolean t)
|
ComponentSelector |
setTensileLength(int len)
|
ComponentSelector |
setText(String text)
Sets the text on all components in found set that support this.
|
ComponentSelector |
setTextDecoration(int textDecoration)
|
ComponentSelector |
setTextPosition(int pos)
Sets text position of text.
|
ComponentSelector |
setTickerEnabled(boolean b)
|
ComponentSelector |
setUIID(String uiid)
Wrapper for
Component.setUIID(java.lang.String) |
ComponentSelector |
setUnderline(boolean b)
|
ComponentSelector |
setUnselectedStyle(Style style)
Sets unselected style of all components in found set.
|
ComponentSelector |
setVerticalAlignment(int valign)
Sets vertical alignment of text.
|
ComponentSelector |
setVisible(boolean visible)
Wrapper for
Component.setVisible(boolean) |
ComponentSelector |
setWidth(int width)
Wrapper for
Component.setWidth(int) |
ComponentSelector |
setX(int x)
Wrapper for
Component.setX(int) |
ComponentSelector |
setY(int y)
Wrapper for
Component.setY(int) |
int |
size()
Returns number of results found.
|
ComponentSelector |
slideDown()
Display the matched elements with a sliding motion.
|
ComponentSelector |
slideDown(int duration)
Display the matched elements with a sliding motion.
|
ComponentSelector |
slideDown(int duration,
SuccessCallback<ComponentSelector> callback)
Display the matched elements with a sliding motion.
|
ComponentSelector |
slideDownAndWait(int duration)
Display the matched elements with a sliding motion.
|
ComponentSelector |
slideUp()
Hide the matched elements with a sliding motion.
|
ComponentSelector |
slideUp(int duration)
Hide the matched components with a sliding motion.
|
ComponentSelector |
slideUp(int duration,
SuccessCallback<ComponentSelector> callback)
Hide the matched elements with a sliding motion.
|
ComponentSelector |
slideUpAndWait(int duration)
Hide the matched elements with a sliding motion.
|
ComponentSelector |
startTicker(long delay,
boolean rightToLeft)
|
ComponentSelector |
stopTicker()
Wraps
Label.stopTicker() |
ComponentSelector |
stripMarginAndPadding()
Strips margin and padding from components in found set.
|
Object[] |
toArray()
Returns results as an array.
|
<T> T[] |
toArray(T[] a)
Returns results as an array.
|
String |
toString()
Returns a string representation of the object.
|
public ComponentSelector(Component... cmps)
find(java.lang.String)
to perform a query using this selector
as the roots.cmps
- Components to add to this selector results.public ComponentSelector(Set<Component> cmps)
find(java.lang.String)
to perform a query using this selector
as the roots.cmps
- Components to add to this selector results.public ComponentSelector(String selector)
Generally it is better to provide a root explicitly using {@link ComponentSelector#ComponentSelector(java.lang.String, com.codename1.ui.Component...) to ensure that the selector has a tree to walk down.
selector
- The selector string.public ComponentSelector(String selector, Component... roots)
selector
- The selector stringroots
- The roots for this selector.public ComponentSelector(String selector, Collection<Component> roots)
selector
- The selector stringroots
- The roots for this selector.public static ComponentSelector $(Component... cmps)
cmps
- Components to be includd in the set.public static ComponentSelector select(Component... cmps)
$(com.codename1.ui.Component...)
cmps
- public static ComponentSelector $(ActionEvent e)
e
- The event whose source component is added to the set.public static ComponentSelector select(ActionEvent e)
e
- public static ComponentSelector $(Runnable r)
r
- public static ComponentSelector select(Runnable r)
$(java.lang.Runnable)
r
- public ComponentSelector each(ComponentSelector.ComponentClosure closure)
closure
- Callback which will be called once for each component in the set.public ComponentSelector map(ComponentSelector.ComponentMapper mapper)
mapper
- The mapper which will be called once for each element in the set. The return value
of the mapper function dictates which component should be included in the resulting set.public ComponentSelector filter(ComponentSelector.Filter filter)
filter
- The filter function called for each element in the set. If it returns true,
then the element is included in the resulting set. If false, it will not be included.public ComponentSelector filter(String selector)
selector
- The selector to filter the found set on.public ComponentSelector parent(String selector)
selector
- Selector to filter the parent components.public ComponentSelector parents(String selector)
selector
- The selector to filter the ancestors.public ComponentSelector closest(String selector)
selector
- The selector to use to match the nearest ancestor.public ComponentSelector firstChild()
public ComponentSelector lastChild()
public ComponentSelector nextSibling()
public ComponentSelector prevSibling()
public ComponentSelector animateStyle(Style destStyle, int duration, SuccessCallback<ComponentSelector> callback)
destStyle
- The style to apply to the components via animation.duration
- The duration of the animation (ms)callback
- Callback to call after animation is complete.Component.createStyleAnimation(java.lang.String, int)
public ComponentSelector fadeIn()
public ComponentSelector fadeIn(int duration)
duration
- The duration of the fade in.public ComponentSelector fadeIn(int duration, SuccessCallback<ComponentSelector> callback)
duration
- The duration of the fade in.callback
- Callback to run when animation completes.public ComponentSelector fadeInAndWait()
public ComponentSelector fadeInAndWait(int duration)
duration
- The duration of the animation.public boolean isVisible()
Component.isVisible()
public boolean isHidden()
Component.isHidden()
public ComponentSelector fadeOut()
public ComponentSelector fadeOut(int duration)
duration
- Duration of animation.public ComponentSelector fadeOut(int duration, SuccessCallback<ComponentSelector> callback)
duration
- Duration of animation.callback
- Callback to run when animation completes.public ComponentSelector slideUp(int duration)
duration
- Duration of animationpublic ComponentSelector slideUp(int duration, SuccessCallback<ComponentSelector> callback)
duration
- Duration of animation.callback
- Callback to run when animation completespublic ComponentSelector slideUpAndWait(int duration)
duration
- Duration of animation.public ComponentSelector slideDown()
public ComponentSelector slideUp()
public ComponentSelector slideDown(int duration)
duration
- Duration of animation.public ComponentSelector slideDown(int duration, SuccessCallback<ComponentSelector> callback)
duration
- Duration of animation.callback
- Callback to run when animation completes.public ComponentSelector slideDownAndWait(int duration)
duration
- Duration of animation.public ComponentSelector fadeOutAndWait(int duration)
duration
- Duration of animation.public ComponentSelector replace(ComponentSelector.ComponentMapper mapper)
c.getParent().replace(c, replacement)
) with an empty
transition.mapper
- Mapper that defines the replacements for each component in the set. If the mapper returns
the input component, then no change is made for that component. A null return value cause the component
to be removed from its parent. Returning a Component results in that component replacing the original component
within its parent.public ComponentSelector replace(ComponentSelector.ComponentMapper mapper, Transition t)
c.getParent().replace(c, replacement)
) with the provided transition.mapper
- Mapper that defines the replacements for each component in the set. If the mapper returns
the input component, then no change is made for that component. A null return value cause the component
to be removed from its parent. Returning a Component results in that component replacing the original component
within its parent.t
- Transition to use for replacements.public ComponentSelector replaceAndWait(ComponentSelector.ComponentMapper mapper, Transition t)
c.getParent().replace(c, replacement)
) with the provided transition.
Blocks the thread until the transition animation is complete.mapper
- Mapper that defines the replacements for each component in the set. If the mapper returns
the input component, then no change is made for that component. A null return value cause the component
to be removed from its parent. Returning a Component results in that component replacing the original component
within its parent.t
- public static ComponentSelector $(Set<Component> cmps)
cmps
- The components to include in the set.public static ComponentSelector select(Set<Component> cmps)
$(java.util.Set)
cmps
- public static ComponentSelector $(String selector)
selector
- A selector string that defines which components to include in the
set.public static ComponentSelector select(String selector)
$(java.lang.String)
selector
- public static ComponentSelector $(String selector, Component... roots)
selector
- Selector string to define which components will be included in the set.roots
- Roots for the selector to search. Only components within the roots' subtrees will be included in the set.public static ComponentSelector select(String selector, Component... roots)
selector
- roots
- public static ComponentSelector $(String selector, Collection<Component> roots)
selector
- Selector string to define which components will be included in the set.roots
- Roots for the selector to search. Only components within the roots' subtrees will be included in the set.public static ComponentSelector select(String selector, Collection<Component> roots)
selector
- roots
- public ComponentSelector find(String selector)
selector
- The selector string.public Style getStyle()
Component.getStyle()
of each component in set.public Style getStyle(Component component)
E.g.
ComponentSelector sel = new ComponentSelector("Button:pressed");
Style style = sel.getStyle(sel.get(0));
// This should be equivalent to sel.get(0).getPressedStyle()
sel = new ComponentSelector("Button");
style = sel.getStyle(sel.get(0));
// This should be equivalent to sel.get(0).getAllStyles()
sel = new ComponentSelector("Button:pressed, Button:selected");
style = sel.getStyle(sel.get(0));
// This should be same as
// Style.createProxyStyle(sel.get(0).getPressedStyle(), sel.get(0).getSelectedStyle())
component
- The component whose style object we wish to obtain.public Style getSelectedStyle()
public ComponentSelector selectSelectedStyle()
Component.getSelectedStyle()
public ComponentSelector selectUnselectedStyle()
Component.getUnselectedStyle()
public ComponentSelector selectPressedStyle()
Component.getPressedStyle()
public ComponentSelector selectDisabledStyle()
Component.getDisabledStyle()
public ComponentSelector selectAllStyles()
Component.getAllStyles()
public Style getUnselectedStyle()
public Style getPressedStyle()
public Style getDisabledStyle()
public Style getAllStyles()
public int size()
public boolean isEmpty()
Set
isEmpty
in interface Collection<Component>
isEmpty
in interface Set<Component>
Set.size()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
toArray
in interface Collection<Component>
toArray
in interface Set<Component>
T
- a
- Collection.toArray(Object[])
public boolean add(Component e)
public ComponentSelector append(Component child)
Container.add(com.codename1.ui.Component)
padding child on first container
in this set.child
- Component to add to container.public ComponentSelector append(Object constraint, Component child)
Container.add(java.lang.Object, com.codename1.ui.Component)
padding child on first container
in this set.constraint
- child
- public ComponentSelector append(ComponentSelector.ComponentMapper mapper)
mapper
- public ComponentSelector append(Object constraint, ComponentSelector.ComponentMapper mapper)
constraint
- mapper
- public ComponentSelector add(Component e, boolean chain)
add(com.codename1.ui.Component)
e
- Component to add to set.chain
- Dummy argument so that this version would have a different signature than Set.add(java.lang.Object)
public boolean remove(Object o)
public ComponentSelector remove(Object o, boolean chain)
remove(java.lang.Object)
.o
- The component to remove from set.chain
- Dummy argument so that this version would have a different signature than Set.remove(java.lang.Object)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<Component>
containsAll
in interface Set<Component>
c
- public boolean addAll(Collection<? extends Component> c)
public ComponentSelector addAll(Collection<? extends Component> c, boolean chain)
addAll(java.util.Collection)
.c
- The set of components to add to this set.chain
- Dummy argument so that this version would have a different signature than addAll(java.util.Collection)
public Component asComponent()
$(new Label()).setFgColor(0xff0000).asComponent()
).public <T extends Component> T asComponent(Class<T> type)
$(new Label()).setFgColor(0xff0000).asComponent(Label.class)
).T
- The type of component to returntype
- The type of component that is expected to be returned.public List<Component> asList()
public boolean retainAll(Collection<?> c)
public ComponentSelector retainAll(Collection<?> c, boolean chain)
retainAll(java.util.Collection)
c
- The collection to retain.chain
- Dummy arg.public boolean removeAll(Collection<?> c)
public ComponentSelector removeAll(Collection<?> c, boolean chain)
removeAll(java.util.Collection)
c
- Collection with components to remove,chain
- Dummy arg.public void clear()
clear
in interface Collection<Component>
clear
in interface Set<Component>
Set.isEmpty()
,
Set.size()
public ComponentSelector clear(boolean chain)
chain
- Dummy argpublic String toString()
Object
public ComponentSelector addTags(String... tags)
tags
- Tags to add.public ComponentSelector removeTags(String... tags)
tags
- public ComponentSelector getParent()
public ComponentSelector setSameWidth()
Component.setSameWidth(com.codename1.ui.Component...)
. Passes all
components in the result set as parameters of this method, effectively making them all the
same width.public ComponentSelector setSameHeight()
Component.setSameHeight(com.codename1.ui.Component...)
. Passes all
components in the result set as parameters of this method, effectively making them all the
same height.public ComponentSelector clearClientProperties()
Component.clearClientProperties()
.public ComponentSelector putClientProperty(String key, Object value)
key
- Property keyvalue
- Property valuepublic Object getClientProperty(String key)
Component.getClientProperty(java.lang.String)
key
- The key of the client property to retrieve.public ComponentSelector setDirtyRegion(Rectangle rect)
rect
- Dirty regionpublic ComponentSelector setVisible(boolean visible)
Component.setVisible(boolean)
visible
- True to make all components in result set visible. False for hidden.public ComponentSelector setX(int x)
Component.setX(int)
x
- public ComponentSelector setY(int y)
Component.setY(int)
y
- public ComponentSelector setWidth(int width)
Component.setWidth(int)
width
- public ComponentSelector setHeight(int height)
Component.setHeight(int)
height
- public ComponentSelector setPreferredSize(Dimension dim)
dim
- public ComponentSelector setPreferredH(int h)
Component.setPreferredH(int)
h
- public ComponentSelector setPreferredW(int w)
Component.setPreferredW(int)
w
- public ComponentSelector setScrollSize(Dimension size)
size
- public ComponentSelector setSize(Dimension size)
size
- public ComponentSelector setUIID(String uiid)
Component.setUIID(java.lang.String)
uiid
- public ComponentSelector remove()
Component.remove()
. This will remove all of the components
in the current found set from their respective parents.public ComponentSelector addFocusListener(FocusListener l)
Component.addFocusListener(com.codename1.ui.events.FocusListener)
l
- public ComponentSelector removeFocusListener(FocusListener l)
Component.removeFocusListener(com.codename1.ui.events.FocusListener)
l
- public ComponentSelector addScrollListener(ScrollListener l)
Component.addScrollListener(com.codename1.ui.events.ScrollListener)
l
- public ComponentSelector removeScrollListener(ScrollListener l)
Component.removeScrollListener(com.codename1.ui.events.ScrollListener)
l
- public ComponentSelector setSelectCommandText(String text)
Component.setSelectCommandText(java.lang.String)
text
- public ComponentSelector setLabelForComponent(Label l)
l
- public ComponentSelector paintBackgrounds(Graphics g)
g
- public ComponentSelector paintComponent(Graphics g)
g
- public ComponentSelector paint(Graphics g)
g
- public boolean contains(int x, int y)
Component.contains(int, int)
x
- y
- public ComponentSelector setFocusable(boolean focus)
Component.setFocusable(boolean)
focus
- public ComponentSelector repaint()
Component.repaint()
public ComponentSelector repaint(int x, int y, int w, int h)
x
- y
- w
- h
- public ComponentSelector setScrollAnimationSpeed(int speed)
speed
- public ComponentSelector setSmoothScrolling(boolean smooth)
smooth
- public ComponentSelector addDropListener(ActionListener l)
Component.addDropListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removeDropListener(ActionListener l)
Component.removeDropListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector addDragOverListener(ActionListener l)
Component.addDragOverListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removeDragOverListener(ActionListener l)
Component.removeDragOverListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector addPointerPressedListener(ActionListener l)
Component.addPointerPressedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector addLongPressListener(ActionListener l)
Component.addLongPressListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removePointerPressedListener(ActionListener l)
Component.removePointerPressedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removeLongPressListener(ActionListener l)
Component.removeLongPressListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector addPointerReleasedListener(ActionListener l)
Component.addPointerReleasedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removePointerReleasedListener(ActionListener l)
Component.removePointerReleasedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector addPointerDraggedListener(ActionListener l)
Component.addPointerDraggedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector removePointerDraggedListener(ActionListener l)
Component.removePointerDraggedListener(com.codename1.ui.events.ActionListener)
l
- public ComponentSelector setPressedStyle(Style style)
Component.setPressedStyle(com.codename1.ui.plaf.Style)
style
- public ComponentSelector setSelectedStyle(Style style)
Component.setSelectedStyle(com.codename1.ui.plaf.Style)
style
- public ComponentSelector setDisabledStyle(Style style)
Component.setDisabledStyle(com.codename1.ui.plaf.Style)
style
- public ComponentSelector setUnselectedStyle(Style style)
Component.setUnselectedStyle(com.codename1.ui.plaf.Style)
style
- public ComponentSelector requestFocus()
Component.requestFocus()
public ComponentSelector refreshTheme()
Component.refreshTheme()
public ComponentSelector refreshTheme(boolean merge)
merge
- public ComponentSelector setCellRenderer(boolean cell)
cell
- public ComponentSelector setScrollVisible(boolean vis)
vis
- public ComponentSelector setEnabled(boolean enabled)
enabled
- public ComponentSelector setName(String name)
name
- public ComponentSelector setRTL(boolean rtl)
rtl
- public ComponentSelector setTactileTouch(boolean t)
t
- public ComponentSelector setPropertyValue(String key, Object value)
key
- value
- public ComponentSelector paintLockRelease()
public ComponentSelector setSnapToGrid(boolean s)
s
- public ComponentSelector setIgnorePointerEvents(boolean ignore)
public boolean isIgnorePointerEvents()
public ComponentSelector setFlatten(boolean f)
f
- public ComponentSelector setTensileLength(int len)
len
- public ComponentSelector setGrabsPointerEvents(boolean g)
g
- public ComponentSelector setScrollOpacityChangeSpeed(int scrollOpacityChangeSpeed)
scrollOpacityChangeSpeed
- public ComponentSelector growShrink(int duration)
duration
- public ComponentSelector setDraggable(boolean draggable)
draggable
- public ComponentSelector setDropTarget(boolean target)
target
- public ComponentSelector setHideInPortait(boolean hide)
hide
- public ComponentSelector setHidden(boolean b, boolean changeMargin)
b
- changeMargin
- public ComponentSelector setHidden(boolean b)
b
- public ComponentSelector setComponentState(Object state)
state
- public ComponentSelector setLeadComponent(Component lead)
lead
- public ComponentSelector setLayout(Layout layout)
layout
- public ComponentSelector invalidate()
Container.invalidate()
public ComponentSelector setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
shouldCalcPreferredSize
- public ComponentSelector applyRTL(boolean rtl)
rtl
- public ComponentSelector removeAll()
clear()
, which
removes components from the found set, but not from their respective parents.
Wraps Container.removeAll()
public ComponentSelector revalidate()
Container.revalidate()
public ComponentSelector forceRevalidate()
public ComponentSelector layoutContainer()
public ComponentSelector getComponentAt(int index)
Container.getComponentAt(int)
on containers in this
found set. This effectively allows us to get all of the ith elements of all
matched components.index
- index
th child of each container in the current found set.public boolean containsInSubtree(Component cmp)
Container.contains(com.codename1.ui.Component)
cmp
- public ComponentSelector scrollComponentToVisible(Component cmp)
cmp
- public ComponentSelector getComponentAt(int x, int y)
Container.getComponentAt(int, int)
in the current found set.x
- y
- public ComponentSelector setScrollableX(boolean b)
b
- public ComponentSelector setScrollableY(boolean b)
b
- public ComponentSelector setScrollIncrement(int b)
b
- public ComponentSelector findFirstFocusable()
Container.findFirstFocusable()
public ComponentSelector animateHierarchyAndWait(int duration)
duration
- public ComponentSelector animateHierarchy(int duration)
Container.animateHierarchy(int)
duration
- public ComponentSelector animateHierarchy(int duration, SuccessCallback<ComponentSelector> callback)
duration
- callback
- public ComponentSelector animateHierarchyFadeAndWait(int duration, int startingOpacity)
duration
- startingOpacity
- public ComponentSelector animateHierarchyFade(int duration, int startingOpacity)
duration
- The duration of the animation.startingOpacity
- The starting opacity.public ComponentSelector animateHierarchyFade(int duration, int startingOpacity, SuccessCallback<ComponentSelector> callback)
duration
- startingOpacity
- callback
- public ComponentSelector animateLayoutFadeAndWait(int duration, int startingOpacity)
duration
- startingOpacity
- public ComponentSelector animateLayoutFade(int duration, int startingOpacity)
Container.animateLayoutFade(int, int)
.duration
- startingOpacity
- public ComponentSelector animateLayoutFade(int duration, int startingOpacity, SuccessCallback<ComponentSelector> callback)
duration
- startingOpacity
- callback
- public ComponentSelector animateLayout(int duration)
duration
- public ComponentSelector animateLayout(int duration, SuccessCallback<ComponentSelector> callback)
Container.animateLayout(int)
.duration
- callback
- public ComponentSelector animateLayoutAndWait(int duration)
duration
- public ComponentSelector animateUnlayout(int duration, int opacity)
duration
- opacity
- public ComponentSelector animateUnlayout(int duration, int opacity, SuccessCallback<ComponentSelector> callback)
duration
- opacity
- callback
- Callback to run when animation has completed.public ComponentSelector animateUnlayoutAndWait(int duration, int opacity)
duration
- opacity
- public AnimationManager getAnimationManager()
Component.getAnimationManager()
public ComponentSelector setText(String text)
text
- The text to set in the componnet.public String getText()
public ComponentSelector setIcon(Image icon)
icon
- public ComponentSelector setIcon(char materialIcon, Style style, float size)
materialIcon
- Material icon charcode.style
- The style for the icon.size
- The size for the icon. (in mm)FontImage.createMaterial(char, java.lang.String, float)
public ComponentSelector setIcon(char materialIcon, float size)
materialIcon
- The icon charcode.size
- The size of the icon (in mm)FontImage.createMaterial(char, com.codename1.ui.plaf.Style, float)
public ComponentSelector setIcon(char materialIcon)
materialIcon
- The material icon charcode.public ComponentSelector getComponentForm()
public ComponentSelector setVerticalAlignment(int valign)
valign
- Label.setVerticalAlignment(int)
public ComponentSelector setTextPosition(int pos)
pos
- Label.setTextPosition(int)
public ComponentSelector setIconUIID(String uiid)
uiid
- The UIID for icons.IconHolder.setIconUIID(java.lang.String)
public ComponentSelector setGap(int gap)
gap
- Label.setGap(int)
public ComponentSelector setShiftText(int shift)
shift
- Label.setShiftText(int)
public ComponentSelector startTicker(long delay, boolean rightToLeft)
delay
- rightToLeft
- public ComponentSelector stopTicker()
Label.stopTicker()
public ComponentSelector setTickerEnabled(boolean b)
b
- public ComponentSelector setEndsWith3Points(boolean b)
b
- public ComponentSelector setMask(Object mask)
mask
- public ComponentSelector setMaskName(String name)
name
- public ComponentSelector setShouldLocalize(boolean b)
b
- public ComponentSelector setShiftMillimeters(int b)
b
- public ComponentSelector setShowEvenIfBlank(boolean b)
b
- public ComponentSelector setLegacyRenderer(boolean b)
b
- public ComponentSelector setAutoSizeMode(boolean b)
b
- public ComponentSelector setCommand(Command cmd)
cmd
- public ComponentSelector setRolloverPressedIcon(Image icon)
icon
- public ComponentSelector setRolloverIcon(Image icon)
icon
- public ComponentSelector setPressedIcon(Image icon)
icon
- public ComponentSelector setDisabledIcon(Image icon)
icon
- public ComponentSelector addActionListener(ActionListener l)
l
- public ComponentSelector removeActionListener(ActionListener l)
l
- The listener to removepublic ComponentSelector setEditable(boolean b)
b
- public ComponentSelector addDataChangedListener(DataChangedListener l)
l
- public ComponentSelector removeDataChangedListener(DataChangedListener l)
l
- public ComponentSelector setDoneListener(ActionListener l)
l
- public ComponentSelector setPadding(int padding)
padding
- Padding in pixelsgetStyle(com.codename1.ui.Component)
public ComponentSelector stripMarginAndPadding()
Style.stripMarginAndPadding()
public ComponentSelector setPadding(int top, int right, int bottom, int left)
top
- Top padding in pixels.right
- Right padding in pixelsbottom
- Bottom padding in pixels.left
- Left padding in pixels.getStyle(com.codename1.ui.Component)
public ComponentSelector setPaddingMillimeters(float top, float right, float bottom, float left)
top
- Top padding in mm.right
- Right padding in mmbottom
- Bottom padding in mm.left
- Left padding in mm.getStyle(com.codename1.ui.Component)
public ComponentSelector setPaddingMillimeters(float topBottom, float leftRight)
topBottom
- Top and bottom padding in mm.leftRight
- Left and right padding in mm.getStyle(com.codename1.ui.Component)
public ComponentSelector setPaddingMillimeters(float padding)
padding
- Padding applied to all sides in mm.public ComponentSelector setPadding(int topBottom, int leftRight)
topBottom
- Top and bottom padding in pixels.leftRight
- Left and right padding in pixels.public ComponentSelector setPaddingPercent(double padding)
padding
- The padding expressed as a percent.public ComponentSelector setPaddingPercent(double topBottom, double leftRight)
topBottom
- Top and bottom padding as percentage of parent heights.leftRight
- Left and right padding as percentage of parent widths.public ComponentSelector setPaddingPercent(double top, double right, double bottom, double left)
top
- Top padding as percentage of parent height.right
- Right padding as percentage of parent width.bottom
- Bottom padding as percentage of parent height.left
- Left padding as percentage of parent width.public ComponentSelector setMargin(int margin)
margin
- Margin in pixelsgetStyle(com.codename1.ui.Component)
public ComponentSelector setMargin(int top, int right, int bottom, int left)
top
- Top margin in pixels.right
- Right margin in pixelsbottom
- Bottom margin in pixels.left
- Left margin in pixels.getStyle(com.codename1.ui.Component)
public ComponentSelector setMargin(int topBottom, int leftRight)
topBottom
- Top and bottom margin in pixels.leftRight
- Left and right margin in pixels.public ComponentSelector setMarginPercent(double margin)
margin
- The margin expressed as a percent.public ComponentSelector setMarginPercent(double topBottom, double leftRight)
topBottom
- Top and bottom margin as percentage of parent heights.leftRight
- Left and right margin as percentage of parent widths.public ComponentSelector setMarginPercent(double top, double right, double bottom, double left)
top
- Top margin as percentage of parent height.right
- Right margin as percentage of parent width.bottom
- Bottom margin as percentage of parent height.left
- Left margin as percentage of parent width.public ComponentSelector setMarginMillimeters(float top, float right, float bottom, float left)
top
- Top margin in mm.right
- Right margin in mmbottom
- Bottom margin in mm.left
- Left margin in mm.getStyle(com.codename1.ui.Component)
public ComponentSelector setMarginMillimeters(float topBottom, float leftRight)
topBottom
- Top and bottom margin in mm.leftRight
- Left and right margin in mm.getStyle(com.codename1.ui.Component)
public ComponentSelector setMarginMillimeters(float margin)
margin
- Margin applied to all sides in mm.public Style createProxyStyle()
public ComponentSelector merge(Style style)
style
- Style.merge(com.codename1.ui.plaf.Style)
,
getStyle(com.codename1.ui.Component)
public ComponentSelector setBgColor(int bgColor)
Style.setBgColor(int)
bgColor
- getStyle(com.codename1.ui.Component)
public ComponentSelector setAlignment(int alignment)
Style.setAlignment(int)
alignment
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBgImage(Image bgImage)
bgImage
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundType(byte backgroundType)
backgroundType
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundGradientStartColor(int startColor)
startColor
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundGradientEndColor(int endColor)
(int)
endColor
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundGradientRelativeX(float x)
x
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundGradientRelativeY(float y)
y
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBackgroundGradientRelativeSize(float size)
size
- getStyle(com.codename1.ui.Component)
public ComponentSelector setFgColor(int color)
Style.setFgColor(int)
color
- getStyle(com.codename1.ui.Component)
public ComponentSelector setFont(Font f)
f
- getStyle(com.codename1.ui.Component)
public ComponentSelector setUnderline(boolean b)
b
- getStyle(com.codename1.ui.Component)
public ComponentSelector set3DText(boolean t, boolean raised)
t
- raised
- getStyle(com.codename1.ui.Component)
public ComponentSelector set3DTextNorth(boolean north)
north
- getStyle(com.codename1.ui.Component)
public ComponentSelector setOverline(boolean b)
b
- getStyle(com.codename1.ui.Component)
public ComponentSelector setStrikeThru(boolean b)
b
- getStyle(com.codename1.ui.Component)
public ComponentSelector setTextDecoration(int textDecoration)
textDecoration
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBgTransparency(int bgTransparency)
bgTransparency
- getStyle(com.codename1.ui.Component)
public ComponentSelector setOpacity(int opacity)
Style.setOpacity(int)
opacity
- getStyle(com.codename1.ui.Component)
public ComponentSelector addStyleListener(StyleListener l)
l
- getStyle(com.codename1.ui.Component)
public ComponentSelector removeStyleListener(StyleListener l)
l
- getStyle(com.codename1.ui.Component)
public ComponentSelector removeStyleListeners()
Style.removeListeners()
getStyle(com.codename1.ui.Component)
public ComponentSelector setBorder(Border b)
b
- getStyle(com.codename1.ui.Component)
public ComponentSelector setBgPainter(Painter bgPainter)
bgPainter
- getStyle(com.codename1.ui.Component)
public ComponentSelector setFontSize(float size)
size
- Font size in pixels.getStyle(com.codename1.ui.Component)
public ComponentSelector setMaterialIcon(char icon, float size)
icon
- Material icon to set. See FontImage.setMaterialIcon(com.codename1.ui.Label, char)
size
- The icon size in millimeters.public ComponentSelector setCursor(int cursor)
public ComponentSelector setFontSizeMillimeters(float sizeMM)
sizeMM
- Font size in mm.public ComponentSelector setFontSizePercent(double sizePercentage)
sizePercentage
- Font size as a percentage of parent font size.public ComponentSelector first()