public class MultiList

  1. Object
  2. Component
  3. List
  4. MultiList

ImplementsActionSource, Animation, Editable, StyleListener

A list with a com.codename1.components.MultiButton renderer, notice that we strongly discourage usage of lists.. This simplifies the process of working with the list and its model as the renderer comes pre-configured for common use cases.

public void showForm() {
  Form hi = new Form("MultiList", new BorderLayout());

  int mm = Display.getInstance().convertToPixels(3);
  EncodedImage placeholder = EncodedImage.createFromImage(Image.createImage(mm * 3, mm * 4, 0), false);
  Image icon1 = URLImage.createToStorage(placeholder, "icon1", "http://www.georgerrmartin.com/wp-content/uploads/2013/03/GOTMTI2.jpg");
  Image icon2 = URLImage.createToStorage(placeholder, "icon2", "http://www.georgerrmartin.com/wp-content/uploads/2012/08/clashofkings.jpg");
  Image icon3 = URLImage.createToStorage(placeholder, "icon3", "http://www.georgerrmartin.com/wp-content/uploads/2013/03/stormswordsMTI.jpg");
  Image icon4 = URLImage.createToStorage(placeholder, "icon4", "http://www.georgerrmartin.com/wp-content/uploads/2012/08/feastforcrows.jpg");
  Image icon5 = URLImage.createToStorage(placeholder, "icon5", "http://georgerrmartin.com/gallery/art/dragons05.jpg");

  ArrayList> data = new ArrayList<>();
  data.add(createListEntry("A Game of Thrones", "1996", icon1));
  data.add(createListEntry("A Clash Of Kings", "1998", icon2));
  data.add(createListEntry("A Storm Of Swords", "2000", icon3));
  data.add(createListEntry("A Feast For Crows", "2005", icon4));
  data.add(createListEntry("A Dance With Dragons", "2011", icon5));
  data.add(createListEntry("The Winds of Winter", "2016 (please, please, please)", placeholder));
  data.add(createListEntry("A Dream of Spring", "Ugh", placeholder));

  DefaultListModel> model = new DefaultListModel<>(data);
  MultiList ml = new MultiList(model);
  hi.add(BorderLayout.CENTER, ml);
  hi.show();
}

private Map createListEntry(String name, String date, Image icon) {
  Map entry = new HashMap<>();
  entry.put("Line1", name);
  entry.put("Line2", date);
  entry.put("icon", icon);
  return entry;
}

Constructors

public MultiList(ListModel model)Constructor that accepts a model for the list
public MultiList()Constructor for the GUI builder

Methods

protected void initComponent()Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state
protected void deinitialize()Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
public MultiButton getSelectedButton()Allows developers to customize the properties of the selected multi-button in code
public MultiButton getUnselectedButton()Allows developers to customize the properties of the unselected multi-button in code
public 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
public Class[] getPropertyTypes()Matches the property names method (see that method for further details).
public Object getPropertyValue(String name)Returns the current value of the property name, this method is used by the GUI builder
public String setPropertyValue(String name, Object value)Sets a new value to the given property, returns an error message if failed and null if successful.

Inherited fields

Inherited methods

From List

isDefaultIgnoreFocusComponentWhenUnfocused, setDefaultIgnoreFocusComponentWhenUnfocused, isDefaultFireOnClick, setDefaultFireOnClick, initLaf, laidOut, modelChanged, listSelectionChanged, getSideGap, isScrollableY, isScrollableX, getMaxElementHeight, setMaxElementHeight, getMinElementHeight, setMinElementHeight, size, getAccessibilityItemBounds, getAccessibilityItemText, getAccessibilityVisibleItemIndices, getCurrentSelected, getSelectedIndex, setSelectedIndex, getVisibleBounds, getDragRegionStatus, setSelectedIndex, getSelectedItem, setSelectedItem, getModel, setModel, setShouldCalcPreferredSize, isNumericKeyActions, setNumericKeyActions, isCommandList, setCommandList, isIgnoreFocusComponentWhenUnfocused, setIgnoreFocusComponentWhenUnfocused, isMutableRendererBackgrounds, setMutableRendererBackgrounds, getListSizeCalculationSampleCount, setListSizeCalculationSampleCount, isLongPointerPressActionEnabled, setLongPointerPressActionEnabled, setListCellRenderer, getRenderer, setRenderer, getOrientation, setOrientation, refreshTheme, scrollRectToVisible, setHandlesInput, fireClicked, isSelectableInteraction, keyReleased, keyPressed, paint, shouldRenderSelection, addSelectionListener, removeSelectionListener, addActionListener, getActionListeners, getListeners, removeActionListener, fireActionEvent, fireActionEvent, setInputOnFocus, setPaintFocusBehindList, getItemGap, setItemGap, getRenderingPrototype, setRenderingPrototype, longPointerPress, pointerPressed, pointerHover, pointerDragged, getSelectedRect, setFireOnClick, pointerHoverReleased, pointerReleased, calcPreferredSize, addItem, getFixedSelection, setFixedSelection, animate, isTactileTouch, setScrollToSelected, getGridPosY, getGridPosX, paramString, getHint, setHint, getHintIcon, setHintIcon, setHint

From Component

setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, getUIManager, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, clearClientProperties, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, getBottomGap, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, handlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, stopScrollMomentum, pointerHoverPressed, pinch, pinchReleased, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, dragInitiated, drawDraggedImage, draggingOver, dragEnter, dragExit, drop, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, mouseWheel, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, refreshTheme, refreshTheme, isDragActivated, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, setCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditing, isEditable, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, isEnabled, setEnabled, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, setTactileTouch, getPropertyTypeNames, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, cancelRepaints, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip

Constructor details

MultiList

public MultiList(ListModel model)
Constructor that accepts a model for the list

Parameters

model ListModel
the model object to assign to the list

MultiList

public MultiList()
Constructor for the GUI builder

Method details

initComponent

protected void initComponent()
Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state

deinitialize

protected void deinitialize()
Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.

getSelectedButton

public MultiButton getSelectedButton()
Allows developers to customize the properties of the selected multi-button in code

Returns

the selected multi button

getUnselectedButton

public MultiButton getUnselectedButton()
Allows developers to customize the properties of the unselected multi-button in code

Returns

the unselected multi button

getPropertyNames

public 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

Returns

the property names allowing mutation

getPropertyTypes

public Class[] getPropertyTypes()
Matches the property names method (see that method for further details).

Returns

the types of the properties

getPropertyValue

public Object getPropertyValue(String name)
Returns the current value of the property name, this method is used by the GUI builder

Parameters

name String
the name of the property

Returns

the value of said property

setPropertyValue

public String setPropertyValue(String name, Object value)
Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as “$designMode” might be sent to components to indicate application state.

Parameters

name String
the name of the property
value Object
new value for the property

Returns

error message or null