Class VPanel
This container class extends CPanel to provide a table-based vertical layout where elements are distributed across multiple rows, each containing a single cell. Each row can have configurable height and content. Useful for creating vertical layouts like sidebars, navigation menus, or multi-row content areas.
Features:
- Multi-row, single-cell vertical layout
- Configurable cell heights (fixed, percentage, or auto)
- Dynamic cell addition and removal
- Automatic spacing between cells
- Table-based structure for consistent layout
Usage:
VPanel panel = new VPanel(3); // 3 rows panel.setCellHeight(0, 100); // First row 100px panel.setCellHeight(1, "auto");// Second row auto panel.setCellHeight(2, 200); // Third row 200px panel.addElement(0, header); panel.addElement(1, content); panel.addElement(2, footer);
- Since:
- 2007
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddCell()Adds a new row to the end of this vertical panel.voidaddCells(int numCells) Adds the specified number of new rows to the end of this vertical panel.addElement(int cellIndex, Element element) Adds an element to the specified row.final VPaneladdElement(Element element) Adds a child element to this element.final voidAdds a text node to this panel.final voidAdds styled text to this panel using a CssStyle object.final voidAdds styled text to this panel using a CSS style string.getElement(int index) Returns the child element at the specified index.Returns the direct children of this element.voidgetHtml(StringBuilder buffer) Generates the HTML representation of this element, including state-based styles and interactive cursor attributes.intfinal intbooleanChecks if this element has any child elements.protected final voidHook method called during element initialization.final VPanelinsertElement(int index, Element element) Inserts a child element at the specified index.protected final voidprewrite()Hook method called before the element is written to output.final voidsetCellHeight(int cellIndex, int height) Sets the height of a cell in pixels.final voidsetCellHeight(int cellIndex, String height) Sets the height of a cell using a CSS value.protected VPanelsetElement(Element element) Replaces the content of this panel with the specified element.final voidsetNumCells(int numCells) Sets the number of rows in this vertical panel, replacing any existing rows.final voidsetSpacing(int spacing) final voidSets the text content of this panel, replacing any existing content.final voidSets styled text content of this panel using a CssStyle object, replacing any existing content.final voidSets styled text content of this panel using a Font, replacing any existing content.final voidSets styled text content of this panel using a CSS style string, replacing any existing content.setVerticalAlign(VerticalAlign align) Sets the vertical alignment of content within this panel's content area.final voidsetWrapCellText(int cellIndex, boolean flag) Methods inherited from class com.oorian.html.StyledElement
addClass, addStyle, addStyle, addStyleAttribute, addTransition, animate, clearTransitions, getActiveStyle, getCssClass, getDisabledStyle, getFocusStyle, getFocusVisibleStyle, getHoverStyle, getStyle, getStyleAttribute, hidden, hide, isDisplayed, isTransitionForwardActive, onHide, onRemovedFromPage, onShow, removeClass, setActiveStyle, setAlignContent, setAlignContent, setAlignItems, setAlignItems, setAlignSelf, setAlignSelf, setAnimation, setAnimationDelay, setAnimationDelay, setAnimationDelay, setAnimationDirection, setAnimationDirection, setAnimationDuration, setAnimationDuration, setAnimationDuration, setAnimationFillMode, setAnimationFillMode, setAnimationIterationCount, setAnimationIterationCount, setAnimationIterationCount, setAnimationName, setAnimationPlayState, setAnimationPlayState, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setBackdropFilter, setBackdropFilter, setBackfaceVisibility, setBackfaceVisibility, setBackground, setBackground, setBackgroundAttachment, setBackgroundAttachment, setBackgroundBlendMode, setBackgroundBlendMode, setBackgroundClip, setBackgroundClip, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBackgroundOrigin, setBackgroundOrigin, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundRepeat, setBackgroundRepeat, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBackgroundSize, setBlur, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottomColor, setBorderBottomColor, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomStyle, setBorderBottomStyle, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderColor, setBorderColor, setBorderColor, setBorderColor, setBorderImage, setBorderImage, setBorderImageOutset, setBorderImageRepeat, setBorderImageSlice, setBorderImageSource, setBorderImageWidth, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeftColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftStyle, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRightColor, setBorderRightColor, setBorderRightStyle, setBorderRightStyle, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderStyle, setBorderStyle, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTopColor, setBorderTopColor, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopStyle, setBorderTopStyle, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBottom, setBottom, setBottom, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxSizing, setBoxSizing, setBreakAfter, setBreakBefore, setBreakInside, setBrightness, setClass, setClear, setClear, setClip, setClipPath, setClipPath, setColGap, setColGap, setColor, setColor, setColumnCount, setColumnCount, setColumnFill, setColumnFill, setColumnGap, setColumnRule, setColumnRuleColor, setColumnRuleColor, setColumnRuleStyle, setColumnRuleStyle, setColumnRuleWidth, setColumnRuleWidth, setColumns, setColumns, setColumns, setColumnSpan, setColumnWidth, setColumnWidth, setColumnWidth, setContrast, setCounterIncrement, setCounterReset, setCursor, setCursor, setDirection, setDirection, setDisabledStyle, setDisplay, setDisplay, setFilter, setFilter, setFilterOpacity, setFlex, setFlexBasis, setFlexDirection, setFlexDirection, setFlexFlow, setFlexGrow, setFlexGrow, setFlexShrink, setFlexShrink, setFlexWrap, setFlexWrap, setFloat, setFloat, setFocusStyle, setFocusVisibleStyle, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFontFace, setFontFamily, setFontFamily, setFontFeatureSettings, setFontKerning, setFontLanguageOverride, setFontSize, setFontSize, setFontSize, setFontSizeAdjust, setFontStretch, setFontStretch, setFontStyle, setFontStyle, setFontSynthesis, setFontVariant, setFontVariant, setFontVariantAlternates, setFontVariantCaps, setFontVariantEastAsian, setFontVariantLigatures, setFontVariantNumeric, setFontVariantPosition, setFontWeight, setFontWeight, setGap, setGap, setGap, setGap, setGrayscale, setHangingPunctuation, setHangingPunctuation, setHeight, setHeight, setHeight, setHoverStyle, setHueRotate, setHyphens, setImageOrientation, setImageRendering, setImageResolution, setImeMode, setInvert, setJustifyContent, setJustifyContent, setKeyFrames, setLeft, setLeft, setLeft, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLineBreak, setLineHeight, setLineHeight, setLineHeight, setLineHeight, setMargin, setMargin, setMargin, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMarginTop, setMark, setMarkAfter, setMarkBefore, setMarks, setMarqueeDirection, setMarqueePlayCount, setMarqueeSpeed, setMarqueeStyle, setMask, setMaskType, setMaxHeight, setMaxHeight, setMaxHeight, setMaxHeightToWindowHeight, setMaxWidth, setMaxWidth, setMaxWidth, setMaxWidthToWindowWidth, setMinHeight, setMinHeight, setMinHeight, setMinHeightToWindowHeight, setMinWidth, setMinWidth, setMinWidth, setMinWidthToWindowWidth, setNavDown, setNavIndex, setNavIndex, setNavLeft, setNavRight, setNavUp, setObjectFit, setObjectPosition, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateTo, setOnDblClick, setOnDblClickChange, setOpacity, setOpacity, setOrder, setOrder, setOrphans, setOutline, setOutline, setOutline, setOutline, setOutlineColor, setOutlineColor, setOutlineOffset, setOutlineOffset, setOutlineOffset, setOutlineStyle, setOutlineStyle, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOverflow, setOverflow, setOverflow, setOverflowWrap, setOverflowX, setOverflowX, setOverflowY, setOverflowY, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPaddingTop, setPageBreakAfter, setPageBreakAfter, setPageBreakBefore, setPageBreakBefore, setPageBreakInside, setPageBreakInside, setPerspective, setPerspective, setPerspective, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPhonemes, setPosition, setPosition, setPosition, setPosition, setPosition, setQuotes, setResize, setResize, setResizeToWindowHeight, setResizeToWindowHeight, setResizeToWindowWidth, setRest, setRestAfter, setRestBefore, setRight, setRight, setRight, setRotate, setRotate, setRowGap, setRowGap, setSaturate, setScale, setScale, setSepia, setShow, setSize, setSize, setSize, setSkewX, setSkewY, setStyle, setStyle, setTabSize, setTabSize, setTabSize, setTabSize, setTextAlign, setTextAlign, setTextAlignLast, setTextAlignLast, setTextCombineUpright, setTextCombineWeight, setTextDecoration, setTextDecoration, setTextDecorationColor, setTextDecorationColor, setTextDecorationLine, setTextDecorationLine, setTextDecorationStyle, setTextDecorationStyle, setTextIndent, setTextIndent, setTextIndent, setTextIndent, setTextJustify, setTextJustify, setTextOrientation, setTextOverflow, setTextOverflow, setTextSelectDisabled, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextTransform, setTextTransform, setTextUnderlinePosition, setTop, setTop, setTop, setTransform, setTransform, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformStyle, setTransformStyle, setTransition, setTransitionDelay, setTransitionDelay, setTransitionDelay, setTransitionDuration, setTransitionDuration, setTransitionDuration, setTransitionProperty, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTranslateX, setTranslateY, setTranslateZ, setUnicodeBidi, setUnicodeBidi, setVerticalAlign, setVisibility, setVisibility, setVoiceBalance, setVoiceDuration, setVoicePitch, setVoicePitchRange, setVoiceRate, setVoiceStress, setVoiceVolume, setWhiteSpace, setWhiteSpace, setWidows, setWidth, setWidth, setWidth, setWordBreak, setWordBreak, setWordSpacing, setWordSpacing, setWordSpacing, setWordSpacing, setWordWrap, setWordWrap, setWritingMode, setZIndex, setZIndex, show, shown, stopAnimation, transitionForward, transitionForward, transitionReverse, transitionReverse, updateStyle, updateStyle, updateStyleIfChangedMethods inherited from class com.oorian.html.VisualElement
clearOnClick, click, disable, enable, getAccessKey, getAutoCapitalize, getEnterKeyHint, getInputMode, getPopover, getRole, getTabIndex, getTitle, isAutoFocus, isContentEditable, isDisabled, isDraggable, isHidden, isInert, isSpellCheck, onDisabled, onEnabled, setAccessKey, setAriaAtomic, setAriaBusy, setAriaChecked, setAriaCheckedMixed, setAriaControls, setAriaCurrent, setAriaDescribedBy, setAriaDisabled, setAriaErrorMessage, setAriaExpanded, setAriaHasPopup, setAriaHasPopup, setAriaHidden, setAriaInvalid, setAriaLabel, setAriaLabelledBy, setAriaLevel, setAriaLive, setAriaModal, setAriaOwns, setAriaPressed, setAriaRequired, setAriaSelected, setAriaValueRange, setAriaValueText, setAutoCapitalize, setAutoFocus, setConsumeEvent, setContentEditable, setDisabled, setDraggable, setDropAllowed, setEnterKeyHint, setFocus, setHidden, setInert, setInputMode, setOnAnimationCancel, setOnAnimationEnd, setOnAnimationIteration, setOnAnimationStart, setOnAuxClick, setOnBeforeInput, setOnBeforeToggle, setOnBlur, setOnChange, setOnClick, setOnClickChange, setOnCompositionEnd, setOnCompositionStart, setOnCompositionUpdate, setOnContextMenu, setOnCopy, setOnCut, setOnDocumentResize, setOnFocus, setOnFocusIn, setOnFocusOut, setOnFormData, setOnGotPointerCapture, setOnInput, setOnInvalid, setOnKeyDown, setOnKeyPressed, setOnKeyUp, setOnLostPointerCapture, setOnMouseDown, setOnMouseEnter, setOnMouseLeave, setOnMouseMove, setOnMouseOut, setOnMouseOutChangeClass, setOnMouseOutChangeStyle, setOnMouseOutChangeStyle, setOnMouseOver, setOnMouseOverChangeClass, setOnMouseOverChangeStyle, setOnMouseOverChangeStyle, setOnMouseOverShow, setOnMouseUp, setOnPageLoad, setOnPaste, setOnPointerCancel, setOnPointerDown, setOnPointerEnter, setOnPointerLeave, setOnPointerMove, setOnPointerOut, setOnPointerOver, setOnPointerUp, setOnResize, setOnScroll, setOnScrollEnd, setOnSelect, setOnSelectionChange, setOnSelectStart, setOnToggle, setOnTouchCancel, setOnTouchEnd, setOnTouchMove, setOnTouchStart, setOnTransitionCancel, setOnTransitionEnd, setOnTransitionRun, setOnTransitionStart, setOnWheel, setOnWindowResize, setPopover, setRole, setRole, setSpellCheck, setTabIndex, setTitle, setTooltipMethods inherited from class com.oorian.html.Element
addAttribute, addAttribute, addAttribute, addAttribute, addLineBreak, addLineOfText, addLineOfText, addLineOfText, addParagraph, addParagraph, addSpacer, addText, assignId, containsElement, containsElement, create, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElementById, getElementCount, getElementCount, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onShown, onUpdated, onUserEvent, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAllElements, removeAttribute, removeAttribute, removeElement, removeElement, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setTranslate, toString, unregisterListener, update, updateAttributes
-
Field Details
-
LAYOUT_FIXED
Fixed table layout mode - fixed width columns- See Also:
-
LAYOUT_AUTO
Auto table layout mode - automatic column sizing- See Also:
-
LAYOUT_INHERIT
Inherited table layout mode - inherit from parent- See Also:
-
-
Constructor Details
-
VPanel
public VPanel()Creates a new VPanel with no cells. -
VPanel
public VPanel(int cells) Creates a new VPanel with the specified number of rows.- Parameters:
cells- The number of rows to create.
-
-
Method Details
-
setNumCells
public final void setNumCells(int numCells) Sets the number of rows in this vertical panel, replacing any existing rows.- Parameters:
numCells- The number of rows to create.
-
setCellHeight
public final void setCellHeight(int cellIndex, int height) Sets the height of a cell in pixels.- Parameters:
cellIndex- The zero-based index of the row.height- The height in pixels.
-
setCellHeight
Sets the height of a cell using a CSS value.- Parameters:
cellIndex- The zero-based index of the row.height- The CSS height value (e.g., "100px", "50%", "auto").
-
addCell
public int addCell()Adds a new row to the end of this vertical panel.- Returns:
- The zero-based index of the newly added row.
-
addCells
public void addCells(int numCells) Adds the specified number of new rows to the end of this vertical panel.- Parameters:
numCells- The number of rows to add.
-
addElement
Adds an element to the specified row.- Parameters:
cellIndex- The zero-based index of the row.element- The element to add.- Returns:
- The table cell containing the element, or
nullif the row does not exist.
-
getNumberOfCells
public int getNumberOfCells() -
setSpacing
public final void setSpacing(int spacing) -
addElement
Description copied from class:ElementAdds a child element to this element.The child is removed from its previous parent if it has one, then added to this element's children. If this element is already attached to a page, the child is also attached and registered for DOM addition.
- Overrides:
addElementin classElement<T extends com.oorian.html.containers.CPanel<T>>- Parameters:
element- The child element to add.- Returns:
- this element for method chaining
-
insertElement
Description copied from class:ElementInserts a child element at the specified index.The child is removed from its previous parent if it has one, then inserted at the specified index in this element's children.
- Overrides:
insertElementin classElement<T extends com.oorian.html.containers.CPanel<T>>- Parameters:
index- The index at which to insert the child.element- The child element to insert.- Returns:
- this element for method chaining
-
getSpacing
public final int getSpacing() -
setWrapCellText
public final void setWrapCellText(int cellIndex, boolean flag) -
prewrite
protected final void prewrite()Description copied from class:ElementHook method called before the element is written to output.Override this method to perform any last-minute configuration before rendering.
-
getHtml
Description copied from class:StyledElementGenerates the HTML representation of this element, including state-based styles and interactive cursor attributes.- Overrides:
getHtmlin classStyledElement<T extends com.oorian.html.containers.Panel<T>>- Parameters:
buffer- The StringBuilder to append the HTML output to.
-
setElement
Replaces the content of this panel with the specified element.- Overrides:
setElementin classElement<T extends com.oorian.html.containers.Panel<T>>- Parameters:
element- The element to set as the sole content.- Returns:
- This element for method chaining.
-
setVerticalAlign
Sets the vertical alignment of content within this panel's content area.- Overrides:
setVerticalAlignin classStyledElement<T extends com.oorian.html.containers.Panel<T>>- Parameters:
align- The vertical alignment to apply.- Returns:
- The content area element for method chaining.
-
hasElements
public boolean hasElements()Description copied from class:ElementChecks if this element has any child elements.- Overrides:
hasElementsin classElement<T extends com.oorian.html.containers.Panel<T>>- Returns:
trueif this element has children,falseotherwise.
-
getElements
Description copied from class:ElementReturns the direct children of this element.- Overrides:
getElementsin classElement<T extends com.oorian.html.containers.Panel<T>>- Returns:
- A copy of the children collection.
-
getElement
Description copied from class:ElementReturns the child element at the specified index.- Overrides:
getElementin classElement<T extends com.oorian.html.containers.Panel<T>>- Parameters:
index- The zero-based index of the child.- Returns:
- The child element, or
nullif index is out of bounds.
-
addText
Adds a text node to this panel. -
addText
Adds styled text to this panel using a CSS style string. -
addText
Adds styled text to this panel using a CssStyle object. -
setText
Sets the text content of this panel, replacing any existing content. -
setText
Sets styled text content of this panel using a CSS style string, replacing any existing content. -
setText
Sets styled text content of this panel using a Font, replacing any existing content. -
setText
Sets styled text content of this panel using a CssStyle object, replacing any existing content. -
initialize
protected final void initialize()Description copied from class:ElementHook method called during element initialization.Override this method to set up the element's structure by adding child elements. This is called before
Element.create()and only once during the element's lifecycle.- Overrides:
initializein classStyledElement<T extends com.oorian.html.containers.Panel<T>>
-