Search in sources :

Example 1 with RFlex

use of org.loboevolution.html.renderer.RFlex in project LoboEvolution by LoboEvolution.

the class StyleSheetRenderState method getDisplay.

/**
 * {@inheritDoc}
 */
@Override
public int getDisplay() {
    final Integer d = this.iDisplay;
    if (d != null) {
        return d;
    }
    CSSValues display = null;
    int displayInt = -1;
    final RenderState previous = this.getPreviousRenderState();
    if (previous != null && previous.getDisplay() == DISPLAY_FLEX_BOX) {
        final RFlex flex = new RFlex(previous);
        displayInt = flex.isFlexTable() ? DISPLAY_TABLE_CELL : DISPLAY_FLEX_CHILD;
        this.iDisplay = displayInt;
        return displayInt;
    } else {
        final CSS3Properties props = this.getCssProperties();
        final String displayText = props == null ? null : props.getDisplay();
        final String displayTextTL = Strings.isNotBlank(displayText) ? displayText : "";
        display = CSSValues.get(displayTextTL);
    }
    switch(display) {
        case BLOCK:
            displayInt = DISPLAY_BLOCK;
            break;
        case NONE:
            displayInt = DISPLAY_NONE;
            break;
        case LIST_ITEM:
            displayInt = DISPLAY_LIST_ITEM;
            break;
        case TABLE:
            displayInt = DISPLAY_TABLE;
            break;
        case TABLE_CELL:
            displayInt = DISPLAY_TABLE_CELL;
            break;
        case TABLE_ROW:
            displayInt = DISPLAY_TABLE_ROW;
            break;
        case TABLE_CAPTION:
            displayInt = DISPLAY_TABLE_CAPTION;
            break;
        case TABLE_COLUMN:
            displayInt = DISPLAY_TABLE_COLUMN;
            break;
        case TABLE_COLUMN_GROUP:
            displayInt = DISPLAY_TABLE_COLUMN_GROUP;
            break;
        case INLINE:
            displayInt = DISPLAY_INLINE;
            break;
        case INLINE_BLOCK:
            displayInt = DISPLAY_INLINE_BLOCK;
            break;
        case INLINE_TABLE:
            displayInt = DISPLAY_INLINE_TABLE;
            break;
        case FLEX:
            displayInt = DISPLAY_FLEX_BOX;
            break;
        case INHERIT:
            displayInt = this.getPreviousRenderState().getDisplay();
            break;
        case INITIAL:
        default:
            displayInt = this.getDefaultDisplay();
            break;
    }
    this.iDisplay = displayInt;
    return displayInt;
}
Also used : CSS3Properties(org.loboevolution.html.node.css.CSS3Properties) CSSValues(org.loboevolution.html.CSSValues) RFlex(org.loboevolution.html.renderer.RFlex)

Aggregations

CSSValues (org.loboevolution.html.CSSValues)1 CSS3Properties (org.loboevolution.html.node.css.CSS3Properties)1 RFlex (org.loboevolution.html.renderer.RFlex)1